blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
5f108b2a00c47d382162637b40c47abb72f3af6f
94a71a5e087f43679d1a73fbc18901297bf2e73e
/RedBlackBST.java
6e3dc7b287d55e2b43bf52da533e44205bfc2af8
[]
no_license
hevrr/rbsearchtree
8fabf4c8ec14e09860192bd17bb697aa36969dba
b68407e302e29c1cac4f93b638d692268a5f210a
refs/heads/master
2022-11-15T16:33:32.660878
2020-07-15T22:56:22
2020-07-15T22:56:22
279,998,641
0
0
null
null
null
null
UTF-8
Java
false
false
10,939
java
import edu.princeton.cs.algs4.StdOut; import java.awt.*; public class RedBlackBST<T> { /* root */ Node root; /* constructor */ public RedBlackBST() { root = null; } /* inserts the specified key-value pair into the symbol table, overwriting the old value with the new value if the symbol table already contains the specified key */ public void put(int key, T element) { root = put(root, key, element); root.isRed = false; } /* recursive put function */ private Node put(Node node, int key, T element) { /* base case: returns new node */ if (node == null) return new Node(key, element, true); /* if current node is greater than, go to left child node */ if (key < node.key) node.left = put(node.left, key, element); /* if current node is less than, go to right child node */ else if (key > node.key) node.right = put(node.right, key, element); /* replace element if value already exists */ else node.element = element; /* returns current node after three special cases have been checked */ return checkCases(node); } /* three special cases to form red-black left leaning bs tree */ private Node checkCases(Node node) { /* case where right is red and left is black */ /* rotates left */ if (red(node.right) && !red(node.left)) node = rotateLeft(node); /* case where both left children are red */ /* rotates right */ if (red(node.left) && red(node.left.left)) node = rotateRight(node); /* flips color if children are both red */ if (red(node.left) && red(node.right)) flipColors(node); return node; } /* gets value at given key */ public T get(int key) { return get(root, key); } /* recursive get function */ private T get(Node node, int key) { if (node == null) return null; if (key < node.key) return get(node.left, key); else if (key > node.key) return get(node.right, key); else return node.element; } /* removes the specified key and its associated value from this symbol table (if the key is in this symbol table) */ public void delete(int key) { if (contains(key)) { if (!red(root.left) && !red(root.right)) root.isRed = true; root = delete(root, key); if (root != null) root.isRed = false; } } /* recursive delete function */ private Node delete(Node node, int key) { /* if key is left of current node */ if (key < node.key) { /* both nodes to the left are black */ if (!red(node.left) && !red(node.left.left)) { /* flip current node's color */ flipColors(node); /* current node's right's left is red */ if (red(node.right.left)) { /* rotate right right node*/ node.right = rotateRight(node.right); /* rotate left current node */ node = rotateLeft(node); /* swap colors */ flipColors(node); } } /* delete left node */ node.left = delete(node.left, key); } /* if key is right of current node */ else { /* if node to left is red */ if (red(node.left)) node = rotateRight(node); /* if right doesn't exist and key is current */ if (node.right == null && key == node.key) return null; /* if right is black and right's left is also black */ if (!red(node.right) && !red(node.right.left)) { /* swap colors */ flipColors(node); /* if left's left is red */ if (red(node.left.left)) { /* rotate right */ node = rotateRight(node); /* swap colors */ flipColors(node); } } /* if current node is the key */ if (node.key == key) { /* get the minimum and swap */ Node temp = min(node.right); node.key = temp.key; node.element = temp.element; node.right = deleteMin(node.right); } /* recursively delete key */ else { node.right = delete(node.right, key); } } /* balance */ return checkCases(node); } /* utility function for checking if node exists and is red */ private boolean red(Node n) { return n != null && n.isRed == true; } /* flips colors */ private void flipColors(Node n) { n.isRed = !n.isRed; n.right.isRed = !n.right.isRed; n.left.isRed = !n.left.isRed; } /* shifts to right of node */ private Node rotateRight(Node node) { /* moving pointers */ Node left = node.left; node.left = left.right; left.right = node; left.isRed = node.isRed; left.right.isRed = true; return left; } /* shifts to left of node */ private Node rotateLeft(Node node) { /* moving pointers */ Node right = node.right; node.right = right.left; right.left = node; right.isRed = node.isRed; right.left.isRed = true; return right; } /* deletes minimum */ private Node deleteMin(Node node) { if (node.left == null) return null; if (!red(node.left) && !red(node.left.left)) { flipColors(node); if (red(node.right.left)) { node.right = rotateRight(node.right); node = rotateLeft(node); flipColors(node); } } node.left = deleteMin(node.left); return checkCases(node); } /* returns the largest key in the symbol table */ public int max() { if (root == null) return 0; return max(root).key; } /* helper function */ private Node max(Node node) { if (node.right == null) return node; else return max(node.right); } /* returns the smallest key in the symbol table */ public int min() { if (root == null) return 0; return min(root).key; } /* helper function */ private Node min(Node node) { if (node.left == null) return node; else return min(node.left); } /* checks whether tree contains given key */ public boolean contains(int key) { return get(key) != null; } /* returns height of tree*/ public int height() { return height(root) + 1; } /* helper function */ private int height(Node node) { if (node == null) return -1; return Math.max(height(node.left), height(node.right)) + 1; } /* returns the number of key-value pairs in this symbol table */ public int size() { return size(root); } /* helper function */ private int size(Node node) { if (node == null) return 0; return size(node.left) + size(node.right) + 1; } /* returns whether tree is empty */ public boolean isEmpty() { return root == null; } /* in order traversal wrapper function */ public void levelOrder() { int height = height(); for (int i = 1; i <= height; i++) levelOrder(root, i); StdOut.println(); } /* level order traversal helper function */ private void levelOrder(Node root, int level) { if (root == null) return; if (level == 1) StdOut.print(root.element + " "); else if (level > 1) { levelOrder(root.left, level - 1); levelOrder(root.right, level - 1); } } /* in order traversal wrapper function */ public void inOrder() { inOrder(root); StdOut.println(); } /* in order traversal helper function */ private void inOrder(Node node) { if (node != null) { inOrder(node.left); StdOut.print(node.element + " "); inOrder(node.right); } } /* post order traversal wrapper function */ public void postOrder() { postOrder(root); StdOut.println(); } /* post order traversal helper function */ private void postOrder(Node node) { if (node == null) return; /* recursion of left node */ postOrder(node.left); /* recursion of right node */ postOrder(node.right); /* of current node */ StdOut.print(node.element + " "); } /* pre order traversal wrapper function */ public void preOrder() { preOrder(root); StdOut.println(); } /* pre order traversal helper function */ private void preOrder(Node node) { if (node == null) return; /* of current node */ StdOut.print(node.element + " "); /* recursion of left node */ preOrder(node.left); /* recursion of right node */ preOrder(node.right); } /* recursive visualizeTree */ public String visualizeTree() { return visualizeTree("", true, "", root); } private String visualizeTree(String prev, boolean tail, String s, Node n) { if (n == null) return ""; if (n.right != null) { String temp = ""; temp += prev; if (tail) temp += "│ "; else temp += " "; s = visualizeTree(temp, false, s, n.right); } s += prev; if (tail) s += "└─ "; else s += "┌─ "; s += n.element.toString() + "\n"; if (n.left != null) { String temp = ""; temp += prev; if (tail) temp += " "; else temp += "│ "; s = visualizeTree(temp, true, s, n.left); } return s; } /* node class */ public class Node { /* elements */ int key; T element; boolean isRed; Node left, right; /* constructor */ public Node(int key, T element, boolean isRed) { this.key = key; this.element = element; this.isRed = isRed; this.left = this.right = null; } } }
3f51f021818806d17f851f53d9e9fd0187d7b6ce
e44dd912d33b84cc814fcf44d897a771c6243aeb
/spring_ecomm-master/src/main/java/com/example/demo/service/amazonService/AmazonService.java
c149c46f5a3f238584165ef8397ae9f0a9e83b0f
[]
no_license
HmmmHmmm99/code-web-quan-ly-cua-hang-mo-hinh-MVC
bbe1ffa37c0c2223a5c77a6ff00986f5c9063a5e
1d44e76d84fa9393f59c5ebb15620310a9438b84
refs/heads/master
2023-08-25T17:02:06.109334
2021-11-05T08:30:41
2021-11-05T08:30:41
424,867,283
0
0
null
null
null
null
UTF-8
Java
false
false
249
java
package com.example.demo.service.amazonService; import org.springframework.web.multipart.MultipartFile; import com.example.demo.entity.ItemSale; public interface AmazonService { void uploadFile(MultipartFile multipartFile, ItemSale itemSale); }
e5cbcfb6841377a8cdce74aaf171a0edbd5cd46e
acc3e8bf8c49c8f577d03d836e725c669194677e
/javase-test/src/main/java/com/figer/tools/shanbay/CreateWordListResp.java
d1d7619174d1c5abd0711a0b266cd13a93f7b1c2
[]
no_license
codefiger/javaTest
3bc83671d0c26922aef0542ae9e9b162cc4510a9
4bcc6990037398ab2cf2fe6666dd31b7387be56d
refs/heads/master
2020-04-07T06:24:38.211368
2017-08-10T13:51:06
2017-08-10T13:51:06
48,683,105
7
0
null
null
null
null
UTF-8
Java
false
false
761
java
package com.figer.tools.shanbay; /** * Created by figer on 20/11/2016. */ public class CreateWordListResp { private String msg; private String status_code; private Data data; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getStatus_code() { return status_code; } public void setStatus_code(String status_code) { this.status_code = status_code; } public Data getData() { return data; } public void setData(Data data) { this.data = data; } @Override public String toString() { return "CreateWordListResp{" + "msg='" + msg + '\'' + ", status_code='" + status_code + '\'' + ", data=" + data + '}'; } }
6db4048a7643ff277f2a24bde676ab580e3d3d0f
9b537c88e78b82f58e04171d6d68ace7a2b66ab7
/datalake/src/main/java/com/sequenceiq/datalake/flow/dr/backup/event/DatalakeDatabaseBackupFailedEvent.java
ff8d8eba1f09d39c610db6cb53eafebdede3fb55
[ "LicenseRef-scancode-warranty-disclaimer", "ANTLR-PD", "CDDL-1.0", "bzip2-1.0.6", "Zlib", "BSD-3-Clause", "MIT", "EPL-1.0", "LicenseRef-scancode-proprietary-license", "LicenseRef-scancode-jdbm-1.00", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
stoty/cloudbreak
10d9eea4961e43533088467f9ff58221abaf0f1b
a8afecf96a02d2ccdb8abf9c329f8269c7b4264d
refs/heads/master
2022-03-12T03:39:52.991951
2022-01-26T15:23:41
2022-01-26T15:23:41
224,849,359
0
0
Apache-2.0
2019-11-29T12:23:00
2019-11-29T12:23:00
null
UTF-8
Java
false
false
841
java
package com.sequenceiq.datalake.flow.dr.backup.event; import com.sequenceiq.datalake.flow.SdxEvent; public class DatalakeDatabaseBackupFailedEvent extends SdxEvent { private final Exception exception; public DatalakeDatabaseBackupFailedEvent(Long sdxId, String userId, Exception exception) { super(sdxId, userId); this.exception = exception; } public static DatalakeDatabaseBackupFailedEvent from(SdxEvent event, Exception exception) { return new DatalakeDatabaseBackupFailedEvent(event.getResourceId(), event.getUserId(), exception); } public Exception getException() { return exception; } @Override public String toString() { return "DatalakeDatabaseBackupFailedEvent{" + "exception= " + exception.toString() + '}'; } }
c014e97adf753d66715e696756a6d3716f77be20
291fe7fb4cc5b682e560b0c5958e2220054451c6
/Big32/src/main/java/com/mega/mvc01/Start2.java
18adbfea3ea81028bc6943f00b1ff1c2bc737ab2
[]
no_license
MinksChung/BigdataCourse
44dc5e7e578515e1dafbb7870911e09347a788f4
293803415da5d9f354059ea556818cc7610f36a5
refs/heads/master
2022-12-22T06:14:59.880933
2020-01-26T14:58:09
2020-01-26T14:58:09
202,575,724
0
0
null
2022-12-15T23:28:43
2019-08-15T16:29:35
Python
UTF-8
Java
false
false
117
java
package com.mega.mvc01; import javax.servlet.http.HttpServlet; public class Start2 extends HttpServlet { }
18aa8d068658fe7b4a63170a717853431d8d53db
1443243d71d05405ebb94079663da84454e01c1f
/aoe-rms-spoon/src/main/java/com/thekoldar/aoe_rms_spoon/ast/functions/RandomNode.java
56d0a1bd73fb6b4e45d8c5820c079fa08d012dcd
[ "Apache-2.0" ]
permissive
Koldar/aoe-rms-spoon
533661d7b0f4932ed53d8603800fe83fdb50e8c4
9c8cbe97000c20a5d14f809fcc805fd6491720f7
refs/heads/main
2023-03-04T23:50:07.608338
2021-02-15T12:21:29
2021-02-15T12:21:29
327,687,424
1
0
null
null
null
null
UTF-8
Java
false
false
3,497
java
package com.thekoldar.aoe_rms_spoon.ast.functions; import java.util.Optional; import org.eclipse.collections.api.RichIterable; import org.eclipse.collections.api.factory.Lists; import org.eclipse.collections.api.factory.Sets; import org.eclipse.collections.api.list.ImmutableList; import org.eclipse.collections.impl.factory.primitive.IntSets; import org.eclipse.collections.impl.tuple.Tuples; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.thekoldar.aoe_rms_spoon.ast.ExprType; import com.thekoldar.aoe_rms_spoon.ast.IRMSNode; import com.thekoldar.aoe_rms_spoon.ast.RMSNodeType; import com.thekoldar.aoe_rms_spoon.ast.abstract_nodes.AbstractRMSNode; import com.thekoldar.aoe_rms_spoon.framework.code_generation.CodeGenerationInput; import com.thekoldar.aoe_rms_spoon.framework.code_generation.CodeGenerationOutput; import com.thekoldar.aoe_rms_spoon.framework.models.exceptions.AbstractRMSException; import com.thekoldar.aoe_rms_spoon.framework.models.exceptions.RMSErrorCode; import com.thekoldar.aoe_rms_spoon.framework.semantic_analysis.SemanticCheckInput; import com.thekoldar.aoe_rms_spoon.framework.semantic_analysis.SemanticCheckOutput; import com.thekoldar.aoe_rms_spoon.framework.utils.Utils; /** * Specifies a random choice. Each children repersents a percent_chance element within the random * * each of this percent needs to be independently semantically checked * @author massi * */ public class RandomNode extends AbstractRMSNode { private static final Logger LOG = LoggerFactory.getLogger(RandomNode.class); public RandomNode() { super(RMSNodeType.RANDOM); } @Override public Optional<ExprType> getType() { return this.getChildren().get(0).getType(); } @Override public SemanticCheckOutput semanticCheck(SemanticCheckInput input) throws AbstractRMSException { var result = input.createOutput(); //make sure the children are all percent_chance result.ensureDirectChildrenAreOnlyOf(this, RMSNodeType.PERCENT_CHANCE); //make sure the children the sum of the percent_change is at most 100 var setOfPossiblePercentValues = this.getChildren() .collect(c -> (PercentChance)c) .collect(pc -> pc.getPercentValue(input)) .collect(i -> i.getPossibleValues().toList()) .toList() ; var combinations = Utils.cartesianProduct(setOfPossiblePercentValues).toList(); var totalsPossible = combinations .collect(c -> { return Tuples.pair(c, c.sumOfInt(i -> i.intValue())); } ) .toList(); var more100 = totalsPossible.select(p -> p.getTwo() > 100).getAny(); if (more100 != null) { result.addError(this, RMSErrorCode.INVALID_ARGUMENT, "percent_chance percentages surpasses the 100%%!"); } var less100 = totalsPossible.select(p -> p.getTwo() < 100).getAny(); if (less100 != null) { result.addWarning(this, RMSErrorCode.INVALID_ARGUMENT, "the combination %s sums up to %d%%. There is %d%% that none of the choices will be considered", less100.getOne().makeString(), less100.getTwo(), 100 - less100.getTwo().intValue()); } return result.merge(this.semanticCheckChildren(input)); } @Override public CodeGenerationOutput codeGeneration(CodeGenerationInput input) { var result = CodeGenerationOutput.instance(); result.addLine("start_random"); result.increaseTabNumber(); for (var c : this.children) { result.merge(c.codeGeneration(input)); } result.decreaseTabNumber(); result.addLine("end_random"); result.addLine(); return result; } }
64e1d132d1142f98f4ee034aa406f28cf46a3ab4
e58750ca7f4598396363d9b129d6fc7b279acc3a
/server/src/main/java/cn/besbing/server/controllers/pages/DataloaderCloudLimsControllers.java
8f76a45352609ef075b1820a433e0ef2f9e47883
[]
no_license
madull/dataloadercloud3
a194bbcea74d10504badbab94f0c46fb2e870c40
3d3157c170d027a9809d0f79dd7c35e4cfdfa434
refs/heads/master
2023-02-03T23:53:34.747822
2020-12-12T06:37:45
2020-12-12T06:37:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,609
java
package cn.besbing.server.controllers.pages; import cn.besbing.model.entities.primary.CProjLoginSample; import cn.besbing.model.entities.primary.DlPermission; import cn.besbing.model.entities.primary.ListObject; import cn.besbing.model.entities.primary.ResultView; import cn.besbing.server.service.primary.PrimaryCProjLoginSampleServiceImpl; import cn.besbing.server.service.primary.PrimaryCProjTaskCoreServiceImpl; import cn.besbing.server.service.primary.PrimaryResultViewServiceImple; import cn.besbing.server.utils.AbstractLog; import com.sun.org.apache.xpath.internal.operations.Mod; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; /** * Xiamen HLYY Network Technology Co., Ltd. * DataLoader Cloud * * @Author sheny * @Date 2020/10/16 14:24 * @Version 1.0 * @Site https://besbing.cn * @Address Xiamen Bazaar U.S. District, 326 South Road, A Dong A209. */ @RequestMapping("dlclims") @Controller public class DataloaderCloudLimsControllers extends AbstractLog { @Autowired private PrimaryCProjLoginSampleServiceImpl primaryCProjLoginSampleService; @Autowired private PrimaryResultViewServiceImple resultViewServiceImple; @Autowired private PrimaryCProjTaskCoreServiceImpl taskCoreService; @GetMapping("editproject") public String editproject(Model model, String seqnum) { try{ CProjLoginSample cProjLoginSample = primaryCProjLoginSampleService.selectProjectInfobyPrimary(seqnum); model.addAttribute("projectInfo",cProjLoginSample); }catch (Exception e){ logger.error(this.getClass() + "error:" + e.getStackTrace()); } return "pages/lims/serviceforself/projectmodify/editproject"; } @GetMapping("viewsample") public String viewsample(Model model,String project){ /**样品接收*/ List<CProjLoginSample> list = primaryCProjLoginSampleService.getProjectInfoByProject(project); model.addAttribute("project",list); return "pages/lims/limsweb/sample/viewsample"; } @GetMapping("viewcharge") public String viewcharge(Model model, String taskId) { try{ //开始整理在查看结果页面待显示的表单 List<String> resultnames = resultViewServiceImple.getDistinctResultNameByTaskid(taskId); List<String> resultsamples = resultViewServiceImple.getDistinctResultSampleByTaskid(taskId); List<ResultView> resultViews = resultViewServiceImple.getResultViewByTaskid(taskId); /** * 组装测试条件 */ List<ListObject> conditions = new ArrayList<>(); try { conditions = taskCoreService.getTestConditionsByTaskid(taskId); Collections.sort(conditions); }catch (Exception e){ e.getStackTrace(); } String tableData[][] = new String[resultsamples.size()+1][resultnames.size()+1]; tableData[0][0] = "试验详细数据"; /*列生成*/ for (int i = 1;i < tableData[0].length;i++){ tableData[0][i] = resultnames.get(i-1); } /*样品行生成*/ for (int i = 1;i < tableData.length; i++){ tableData[i][0] = resultsamples.get(i-1); } /*测试数据插入*/ for (ResultView resultView : resultViews){ for (int i = 1;i < resultsamples.size()+1;i++){ for (int j = 1;j < resultnames.size()+1; j++){ if (resultView.getName().equals(tableData[0][j]) && resultView.getSampleNumber().toString().equals(tableData[i][0])){ tableData[i][j] = resultView.getFormatvalue(); } } } } /** * 组装返回的表格数据 */ String htmlTable = "<table class='layui-table'><tbody>"; for (int i = 0;i < tableData.length; i++){ htmlTable += "<tr>"; for (int j = 0; j< tableData[0].length; j++){ htmlTable += "<td>" + tableData[i][j] + "</td>"; } htmlTable += "</tr>"; } htmlTable += "</tbody></table>"; /** * 组装逻辑(important!将来可能用在lims3.0的报告显示): */ model.addAttribute("tableX",resultnames.size() + 1); model.addAttribute("tableY",resultsamples.size()); model.addAttribute("tabledata", Arrays.asList(tableData)); model.addAttribute("htmlTable",htmlTable); model.addAttribute("conditions",conditions); }catch (Exception e){ logger.error(this.getClass() + "error:" + e.getStackTrace()); } return "pages/lims/serviceforself/viewcharge/viewcharge"; } @GetMapping("receive") public String receive(Model model,String projno){ model.addAttribute("projno",projno); return "pages/lims/limsweb/sample/receive"; } @GetMapping("grouprecevesample") public String grouprecevesample(){ return "pages/lims/limsweb/sample/groupreceivebyhandle"; } }
63e530cf71e97abb8aa356ae993e519ba2825f38
7f31427cb17ecb57846dc970b3e49e4dc4d21720
/fuzzyclustering/fuzzyclustering/fuzzyclustering-IR/src/main/java/co/edu/sanmartin/fuzzyclustering/ir/normalize/stemmer/language/russianStemmer.java
04dddd19eca28ed0e4b8c1d7fd5ab67ce0fccb9c
[]
no_license
Ruframapi/fuzzy-clustering
b3bb7ce8531c223206778cd5f61837ed68f04ea0
d6acff3420520fcf061c064bdd7e30026c331827
refs/heads/master
2021-01-10T15:34:29.992990
2013-10-09T12:56:15
2013-10-09T12:56:15
44,202,276
0
0
null
null
null
null
UTF-8
Java
false
false
32,951
java
// This file was generated automatically by the Snowball to Java compiler package co.edu.sanmartin.fuzzyclustering.ir.normalize.stemmer.language; import co.edu.sanmartin.fuzzyclustering.ir.normalize.stemmer.snowball.Among; import co.edu.sanmartin.fuzzyclustering.ir.normalize.stemmer.snowball.SnowballStemmer; /** * This class was automatically generated by a Snowball to Java compiler * It implements the stemming algorithm defined by a snowball script. */ public class russianStemmer extends SnowballStemmer { private static final long serialVersionUID = 1L; private final static russianStemmer methodObject = new russianStemmer (); private final static Among a_0[] = { new Among ( "\u0432", -1, 1, "", methodObject ), new Among ( "\u0438\u0432", 0, 2, "", methodObject ), new Among ( "\u044B\u0432", 0, 2, "", methodObject ), new Among ( "\u0432\u0448\u0438", -1, 1, "", methodObject ), new Among ( "\u0438\u0432\u0448\u0438", 3, 2, "", methodObject ), new Among ( "\u044B\u0432\u0448\u0438", 3, 2, "", methodObject ), new Among ( "\u0432\u0448\u0438\u0441\u044C", -1, 1, "", methodObject ), new Among ( "\u0438\u0432\u0448\u0438\u0441\u044C", 6, 2, "", methodObject ), new Among ( "\u044B\u0432\u0448\u0438\u0441\u044C", 6, 2, "", methodObject ) }; private final static Among a_1[] = { new Among ( "\u0435\u0435", -1, 1, "", methodObject ), new Among ( "\u0438\u0435", -1, 1, "", methodObject ), new Among ( "\u043E\u0435", -1, 1, "", methodObject ), new Among ( "\u044B\u0435", -1, 1, "", methodObject ), new Among ( "\u0438\u043C\u0438", -1, 1, "", methodObject ), new Among ( "\u044B\u043C\u0438", -1, 1, "", methodObject ), new Among ( "\u0435\u0439", -1, 1, "", methodObject ), new Among ( "\u0438\u0439", -1, 1, "", methodObject ), new Among ( "\u043E\u0439", -1, 1, "", methodObject ), new Among ( "\u044B\u0439", -1, 1, "", methodObject ), new Among ( "\u0435\u043C", -1, 1, "", methodObject ), new Among ( "\u0438\u043C", -1, 1, "", methodObject ), new Among ( "\u043E\u043C", -1, 1, "", methodObject ), new Among ( "\u044B\u043C", -1, 1, "", methodObject ), new Among ( "\u0435\u0433\u043E", -1, 1, "", methodObject ), new Among ( "\u043E\u0433\u043E", -1, 1, "", methodObject ), new Among ( "\u0435\u043C\u0443", -1, 1, "", methodObject ), new Among ( "\u043E\u043C\u0443", -1, 1, "", methodObject ), new Among ( "\u0438\u0445", -1, 1, "", methodObject ), new Among ( "\u044B\u0445", -1, 1, "", methodObject ), new Among ( "\u0435\u044E", -1, 1, "", methodObject ), new Among ( "\u043E\u044E", -1, 1, "", methodObject ), new Among ( "\u0443\u044E", -1, 1, "", methodObject ), new Among ( "\u044E\u044E", -1, 1, "", methodObject ), new Among ( "\u0430\u044F", -1, 1, "", methodObject ), new Among ( "\u044F\u044F", -1, 1, "", methodObject ) }; private final static Among a_2[] = { new Among ( "\u0435\u043C", -1, 1, "", methodObject ), new Among ( "\u043D\u043D", -1, 1, "", methodObject ), new Among ( "\u0432\u0448", -1, 1, "", methodObject ), new Among ( "\u0438\u0432\u0448", 2, 2, "", methodObject ), new Among ( "\u044B\u0432\u0448", 2, 2, "", methodObject ), new Among ( "\u0449", -1, 1, "", methodObject ), new Among ( "\u044E\u0449", 5, 1, "", methodObject ), new Among ( "\u0443\u044E\u0449", 6, 2, "", methodObject ) }; private final static Among a_3[] = { new Among ( "\u0441\u044C", -1, 1, "", methodObject ), new Among ( "\u0441\u044F", -1, 1, "", methodObject ) }; private final static Among a_4[] = { new Among ( "\u043B\u0430", -1, 1, "", methodObject ), new Among ( "\u0438\u043B\u0430", 0, 2, "", methodObject ), new Among ( "\u044B\u043B\u0430", 0, 2, "", methodObject ), new Among ( "\u043D\u0430", -1, 1, "", methodObject ), new Among ( "\u0435\u043D\u0430", 3, 2, "", methodObject ), new Among ( "\u0435\u0442\u0435", -1, 1, "", methodObject ), new Among ( "\u0438\u0442\u0435", -1, 2, "", methodObject ), new Among ( "\u0439\u0442\u0435", -1, 1, "", methodObject ), new Among ( "\u0435\u0439\u0442\u0435", 7, 2, "", methodObject ), new Among ( "\u0443\u0439\u0442\u0435", 7, 2, "", methodObject ), new Among ( "\u043B\u0438", -1, 1, "", methodObject ), new Among ( "\u0438\u043B\u0438", 10, 2, "", methodObject ), new Among ( "\u044B\u043B\u0438", 10, 2, "", methodObject ), new Among ( "\u0439", -1, 1, "", methodObject ), new Among ( "\u0435\u0439", 13, 2, "", methodObject ), new Among ( "\u0443\u0439", 13, 2, "", methodObject ), new Among ( "\u043B", -1, 1, "", methodObject ), new Among ( "\u0438\u043B", 16, 2, "", methodObject ), new Among ( "\u044B\u043B", 16, 2, "", methodObject ), new Among ( "\u0435\u043C", -1, 1, "", methodObject ), new Among ( "\u0438\u043C", -1, 2, "", methodObject ), new Among ( "\u044B\u043C", -1, 2, "", methodObject ), new Among ( "\u043D", -1, 1, "", methodObject ), new Among ( "\u0435\u043D", 22, 2, "", methodObject ), new Among ( "\u043B\u043E", -1, 1, "", methodObject ), new Among ( "\u0438\u043B\u043E", 24, 2, "", methodObject ), new Among ( "\u044B\u043B\u043E", 24, 2, "", methodObject ), new Among ( "\u043D\u043E", -1, 1, "", methodObject ), new Among ( "\u0435\u043D\u043E", 27, 2, "", methodObject ), new Among ( "\u043D\u043D\u043E", 27, 1, "", methodObject ), new Among ( "\u0435\u0442", -1, 1, "", methodObject ), new Among ( "\u0443\u0435\u0442", 30, 2, "", methodObject ), new Among ( "\u0438\u0442", -1, 2, "", methodObject ), new Among ( "\u044B\u0442", -1, 2, "", methodObject ), new Among ( "\u044E\u0442", -1, 1, "", methodObject ), new Among ( "\u0443\u044E\u0442", 34, 2, "", methodObject ), new Among ( "\u044F\u0442", -1, 2, "", methodObject ), new Among ( "\u043D\u044B", -1, 1, "", methodObject ), new Among ( "\u0435\u043D\u044B", 37, 2, "", methodObject ), new Among ( "\u0442\u044C", -1, 1, "", methodObject ), new Among ( "\u0438\u0442\u044C", 39, 2, "", methodObject ), new Among ( "\u044B\u0442\u044C", 39, 2, "", methodObject ), new Among ( "\u0435\u0448\u044C", -1, 1, "", methodObject ), new Among ( "\u0438\u0448\u044C", -1, 2, "", methodObject ), new Among ( "\u044E", -1, 2, "", methodObject ), new Among ( "\u0443\u044E", 44, 2, "", methodObject ) }; private final static Among a_5[] = { new Among ( "\u0430", -1, 1, "", methodObject ), new Among ( "\u0435\u0432", -1, 1, "", methodObject ), new Among ( "\u043E\u0432", -1, 1, "", methodObject ), new Among ( "\u0435", -1, 1, "", methodObject ), new Among ( "\u0438\u0435", 3, 1, "", methodObject ), new Among ( "\u044C\u0435", 3, 1, "", methodObject ), new Among ( "\u0438", -1, 1, "", methodObject ), new Among ( "\u0435\u0438", 6, 1, "", methodObject ), new Among ( "\u0438\u0438", 6, 1, "", methodObject ), new Among ( "\u0430\u043C\u0438", 6, 1, "", methodObject ), new Among ( "\u044F\u043C\u0438", 6, 1, "", methodObject ), new Among ( "\u0438\u044F\u043C\u0438", 10, 1, "", methodObject ), new Among ( "\u0439", -1, 1, "", methodObject ), new Among ( "\u0435\u0439", 12, 1, "", methodObject ), new Among ( "\u0438\u0435\u0439", 13, 1, "", methodObject ), new Among ( "\u0438\u0439", 12, 1, "", methodObject ), new Among ( "\u043E\u0439", 12, 1, "", methodObject ), new Among ( "\u0430\u043C", -1, 1, "", methodObject ), new Among ( "\u0435\u043C", -1, 1, "", methodObject ), new Among ( "\u0438\u0435\u043C", 18, 1, "", methodObject ), new Among ( "\u043E\u043C", -1, 1, "", methodObject ), new Among ( "\u044F\u043C", -1, 1, "", methodObject ), new Among ( "\u0438\u044F\u043C", 21, 1, "", methodObject ), new Among ( "\u043E", -1, 1, "", methodObject ), new Among ( "\u0443", -1, 1, "", methodObject ), new Among ( "\u0430\u0445", -1, 1, "", methodObject ), new Among ( "\u044F\u0445", -1, 1, "", methodObject ), new Among ( "\u0438\u044F\u0445", 26, 1, "", methodObject ), new Among ( "\u044B", -1, 1, "", methodObject ), new Among ( "\u044C", -1, 1, "", methodObject ), new Among ( "\u044E", -1, 1, "", methodObject ), new Among ( "\u0438\u044E", 30, 1, "", methodObject ), new Among ( "\u044C\u044E", 30, 1, "", methodObject ), new Among ( "\u044F", -1, 1, "", methodObject ), new Among ( "\u0438\u044F", 33, 1, "", methodObject ), new Among ( "\u044C\u044F", 33, 1, "", methodObject ) }; private final static Among a_6[] = { new Among ( "\u043E\u0441\u0442", -1, 1, "", methodObject ), new Among ( "\u043E\u0441\u0442\u044C", -1, 1, "", methodObject ) }; private final static Among a_7[] = { new Among ( "\u0435\u0439\u0448\u0435", -1, 1, "", methodObject ), new Among ( "\u043D", -1, 2, "", methodObject ), new Among ( "\u0435\u0439\u0448", -1, 1, "", methodObject ), new Among ( "\u044C", -1, 3, "", methodObject ) }; private static final char g_v[] = {33, 65, 8, 232 }; private int I_p2; private int I_pV; private void copy_from(russianStemmer other) { I_p2 = other.I_p2; I_pV = other.I_pV; super.copy_from(other); } private boolean r_mark_regions() { int v_1; // (, line 57 I_pV = limit; I_p2 = limit; // do, line 61 v_1 = cursor; lab0: do { // (, line 61 // gopast, line 62 golab1: while(true) { lab2: do { if (!(in_grouping(g_v, 1072, 1103))) { break lab2; } break golab1; } while (false); if (cursor >= limit) { break lab0; } cursor++; } // setmark pV, line 62 I_pV = cursor; // gopast, line 62 golab3: while(true) { lab4: do { if (!(out_grouping(g_v, 1072, 1103))) { break lab4; } break golab3; } while (false); if (cursor >= limit) { break lab0; } cursor++; } // gopast, line 63 golab5: while(true) { lab6: do { if (!(in_grouping(g_v, 1072, 1103))) { break lab6; } break golab5; } while (false); if (cursor >= limit) { break lab0; } cursor++; } // gopast, line 63 golab7: while(true) { lab8: do { if (!(out_grouping(g_v, 1072, 1103))) { break lab8; } break golab7; } while (false); if (cursor >= limit) { break lab0; } cursor++; } // setmark p2, line 63 I_p2 = cursor; } while (false); cursor = v_1; return true; } private boolean r_R2() { if (!(I_p2 <= cursor)) { return false; } return true; } private boolean r_perfective_gerund() { int among_var; int v_1; // (, line 71 // [, line 72 ket = cursor; // substring, line 72 among_var = find_among_b(a_0, 9); if (among_var == 0) { return false; } // ], line 72 bra = cursor; switch(among_var) { case 0: return false; case 1: // (, line 76 // or, line 76 lab0: do { v_1 = limit - cursor; lab1: do { // literal, line 76 if (!(eq_s_b(1, "\u0430"))) { break lab1; } break lab0; } while (false); cursor = limit - v_1; // literal, line 76 if (!(eq_s_b(1, "\u044F"))) { return false; } } while (false); // delete, line 76 slice_del(); break; case 2: // (, line 83 // delete, line 83 slice_del(); break; } return true; } private boolean r_adjective() { int among_var; // (, line 87 // [, line 88 ket = cursor; // substring, line 88 among_var = find_among_b(a_1, 26); if (among_var == 0) { return false; } // ], line 88 bra = cursor; switch(among_var) { case 0: return false; case 1: // (, line 97 // delete, line 97 slice_del(); break; } return true; } private boolean r_adjectival() { int among_var; int v_1; int v_2; // (, line 101 // call adjective, line 102 if (!r_adjective()) { return false; } // try, line 109 v_1 = limit - cursor; lab0: do { // (, line 109 // [, line 110 ket = cursor; // substring, line 110 among_var = find_among_b(a_2, 8); if (among_var == 0) { cursor = limit - v_1; break lab0; } // ], line 110 bra = cursor; switch(among_var) { case 0: cursor = limit - v_1; break lab0; case 1: // (, line 115 // or, line 115 lab1: do { v_2 = limit - cursor; lab2: do { // literal, line 115 if (!(eq_s_b(1, "\u0430"))) { break lab2; } break lab1; } while (false); cursor = limit - v_2; // literal, line 115 if (!(eq_s_b(1, "\u044F"))) { cursor = limit - v_1; break lab0; } } while (false); // delete, line 115 slice_del(); break; case 2: // (, line 122 // delete, line 122 slice_del(); break; } } while (false); return true; } private boolean r_reflexive() { int among_var; // (, line 128 // [, line 129 ket = cursor; // substring, line 129 among_var = find_among_b(a_3, 2); if (among_var == 0) { return false; } // ], line 129 bra = cursor; switch(among_var) { case 0: return false; case 1: // (, line 132 // delete, line 132 slice_del(); break; } return true; } private boolean r_verb() { int among_var; int v_1; // (, line 136 // [, line 137 ket = cursor; // substring, line 137 among_var = find_among_b(a_4, 46); if (among_var == 0) { return false; } // ], line 137 bra = cursor; switch(among_var) { case 0: return false; case 1: // (, line 143 // or, line 143 lab0: do { v_1 = limit - cursor; lab1: do { // literal, line 143 if (!(eq_s_b(1, "\u0430"))) { break lab1; } break lab0; } while (false); cursor = limit - v_1; // literal, line 143 if (!(eq_s_b(1, "\u044F"))) { return false; } } while (false); // delete, line 143 slice_del(); break; case 2: // (, line 151 // delete, line 151 slice_del(); break; } return true; } private boolean r_noun() { int among_var; // (, line 159 // [, line 160 ket = cursor; // substring, line 160 among_var = find_among_b(a_5, 36); if (among_var == 0) { return false; } // ], line 160 bra = cursor; switch(among_var) { case 0: return false; case 1: // (, line 167 // delete, line 167 slice_del(); break; } return true; } private boolean r_derivational() { int among_var; // (, line 175 // [, line 176 ket = cursor; // substring, line 176 among_var = find_among_b(a_6, 2); if (among_var == 0) { return false; } // ], line 176 bra = cursor; // call R2, line 176 if (!r_R2()) { return false; } switch(among_var) { case 0: return false; case 1: // (, line 179 // delete, line 179 slice_del(); break; } return true; } private boolean r_tidy_up() { int among_var; // (, line 183 // [, line 184 ket = cursor; // substring, line 184 among_var = find_among_b(a_7, 4); if (among_var == 0) { return false; } // ], line 184 bra = cursor; switch(among_var) { case 0: return false; case 1: // (, line 188 // delete, line 188 slice_del(); // [, line 189 ket = cursor; // literal, line 189 if (!(eq_s_b(1, "\u043D"))) { return false; } // ], line 189 bra = cursor; // literal, line 189 if (!(eq_s_b(1, "\u043D"))) { return false; } // delete, line 189 slice_del(); break; case 2: // (, line 192 // literal, line 192 if (!(eq_s_b(1, "\u043D"))) { return false; } // delete, line 192 slice_del(); break; case 3: // (, line 194 // delete, line 194 slice_del(); break; } return true; } public boolean stem() { int v_1; int v_2; int v_3; int v_4; int v_5; int v_6; int v_7; int v_8; int v_9; int v_10; // (, line 199 // do, line 201 v_1 = cursor; lab0: do { // call mark_regions, line 201 if (!r_mark_regions()) { break lab0; } } while (false); cursor = v_1; // backwards, line 202 limit_backward = cursor; cursor = limit; // setlimit, line 202 v_2 = limit - cursor; // tomark, line 202 if (cursor < I_pV) { return false; } cursor = I_pV; v_3 = limit_backward; limit_backward = cursor; cursor = limit - v_2; // (, line 202 // do, line 203 v_4 = limit - cursor; lab1: do { // (, line 203 // or, line 204 lab2: do { v_5 = limit - cursor; lab3: do { // call perfective_gerund, line 204 if (!r_perfective_gerund()) { break lab3; } break lab2; } while (false); cursor = limit - v_5; // (, line 205 // try, line 205 v_6 = limit - cursor; lab4: do { // call reflexive, line 205 if (!r_reflexive()) { cursor = limit - v_6; break lab4; } } while (false); // or, line 206 lab5: do { v_7 = limit - cursor; lab6: do { // call adjectival, line 206 if (!r_adjectival()) { break lab6; } break lab5; } while (false); cursor = limit - v_7; lab7: do { // call verb, line 206 if (!r_verb()) { break lab7; } break lab5; } while (false); cursor = limit - v_7; // call noun, line 206 if (!r_noun()) { break lab1; } } while (false); } while (false); } while (false); cursor = limit - v_4; // try, line 209 v_8 = limit - cursor; lab8: do { // (, line 209 // [, line 209 ket = cursor; // literal, line 209 if (!(eq_s_b(1, "\u0438"))) { cursor = limit - v_8; break lab8; } // ], line 209 bra = cursor; // delete, line 209 slice_del(); } while (false); // do, line 212 v_9 = limit - cursor; lab9: do { // call derivational, line 212 if (!r_derivational()) { break lab9; } } while (false); cursor = limit - v_9; // do, line 213 v_10 = limit - cursor; lab10: do { // call tidy_up, line 213 if (!r_tidy_up()) { break lab10; } } while (false); cursor = limit - v_10; limit_backward = v_3; cursor = limit_backward; return true; } public boolean equals( Object o ) { return o instanceof russianStemmer; } public int hashCode() { return russianStemmer.class.getName().hashCode(); } }
0a51c73fefe5165c5558f3ed04c723040e68fc01
92e2880a56cb5da2e51fef40a1e8553f68d10308
/src/main/java/com/junitPractice/helper/StringHelper.java
b4150365784e36b9abb0c84011cda9620bc9ccc5
[]
no_license
nmp4817/JUnit-Practice
14ba7c836b0839c29012f045c79a6ce260c8da7d
bb020da6ff96500cdb8ed533b2568c8fffa24fbb
refs/heads/master
2021-01-24T03:52:32.709359
2018-02-26T19:02:56
2018-02-26T19:02:56
122,908,703
0
0
null
null
null
null
UTF-8
Java
false
false
653
java
package com.junitPractice.helper; public class StringHelper { public String truncateAInFirst2Positions(String str) { if (str.length() <= 2) return str.replaceAll("A", ""); String first2Chars = str.substring(0, 2); String stringMinusFirst2Chars = str.substring(2); return first2Chars.replaceAll("A", "") + stringMinusFirst2Chars; } public boolean areFirstAndLastTwoCharactersTheSame(String str) { if (str.length() <= 1) return false; if (str.length() == 2) return true; String first2Chars = str.substring(0, 2); String last2Chars = str.substring(str.length() - 2); return first2Chars.equals(last2Chars); } }
761edcdfd4dc07046fcf6095b19160aeb2a80dd1
ac275c73051c4321a4be61048b00631037554216
/app/src/main/java/com/example/paulivanov/construx/MaterialEstimateRvAdapter.java
04fcfecde84a0d7146bfd45354efec20bb11e18e
[ "MIT" ]
permissive
PaulIvanov/ConstruxCalculator
bad2e0a48349e0818972b71b40b0cc456eb2b6c1
862f7d83faac2136e3e51ec8bc29d961eed33892
refs/heads/master
2021-04-03T05:04:45.342545
2018-10-03T05:12:19
2018-10-03T05:12:19
124,585,906
0
0
null
null
null
null
UTF-8
Java
false
false
3,872
java
package com.example.paulivanov.construx; import android.content.Intent; import android.support.design.widget.Snackbar; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.List; /** * Created by PaulIvanov on 1/10/2018. */ public class MaterialEstimateRvAdapter extends RecyclerView.Adapter<MaterialEstimateRvAdapter.MaterialEstimateViewHolder> { @Override public MaterialEstimateViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.activity_material_estimate_card_view, parent, false); return new MaterialEstimateRvAdapter.MaterialEstimateViewHolder(v); } @Override public void onBindViewHolder(MaterialEstimateViewHolder holder, int position) { MaterialEstimate est = MaterialEstimate.get(position); int materialTotalPrice = 0; int materialTotalMeas = 0; List<Measurement> measurements = Measurement.find(Measurement.class, "1=1"); for(Measurement meas : measurements){ try{ if(meas.getMaterialEstimate().getId().equals(est.getId())){ int totalMeas = meas.getLength() * meas.getWidth(); materialTotalPrice += totalMeas * est.getMaterialPrice(); materialTotalMeas += totalMeas; } } catch(Exception ex) { meas.delete(); } } String unitOfMeasure = " " + est.getMaterial().getUnitOfMeasure(); holder.MaterialName.setText(est.getMaterial().getMaterialName()); holder.MaterialPrice.setText("$" + Integer.toString((est.getMaterialPrice())) + unitOfMeasure); holder.MaterialTotalPrice.setText("Total: $"+ Integer.toString(materialTotalPrice)); holder.MaterialTotalMeas.setText("Total: " + Integer.toString(materialTotalMeas) + unitOfMeasure); } @Override public int getItemCount() { return MaterialEstimate.size(); } List<MaterialEstimate> MaterialEstimate; MaterialEstimateRvAdapter(List<MaterialEstimate> MaterialEstimate){ this.MaterialEstimate = MaterialEstimate; } public static class MaterialEstimateViewHolder extends RecyclerView.ViewHolder { CardView estimateCv; long estimateId; long materialEstId; TextView MaterialName; TextView MaterialPrice; TextView MaterialTotalPrice; TextView MaterialTotalMeas; MaterialEstimateViewHolder(final View itemView) { super(itemView); estimateCv = (CardView)itemView.findViewById(R.id.material_estimate_cv); estimateCv.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { MaterialEstimate materialEstimate = com.example.paulivanov.construx.MaterialEstimate.findById(MaterialEstimate.class, materialEstId); boolean result = materialEstimate.delete(); view.refreshDrawableState(); Snackbar.make(view, "Material Estimate Deleted", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); return result; } }); MaterialName = (TextView)itemView.findViewById(R.id.material_est_name); MaterialPrice = (TextView)itemView.findViewById(R.id.material_est_price); MaterialTotalPrice = (TextView)itemView.findViewById(R.id.material_est_total_price); MaterialTotalMeas = (TextView)itemView.findViewById(R.id.material_total_meas); } } }
cdafc1e520c249d1baa103d8a41d35bb4554c4f3
946e3ad8ab402cc5c6fa19c008c5df6e96dfed03
/AIMA.src/src/IA/probAntenas/ProbAntenasHeuristicFunction3.java
df66c8fa705823cdd561284f4b5b94ecc890c864
[]
no_license
noxerr/IA
a6993d63f981cef22a0304a7982e3afe864b7e34
3d879a6b8994cc513d17e8a139bcbe4fe97d5c29
refs/heads/master
2021-01-10T05:41:33.511995
2015-10-26T19:27:30
2015-10-26T19:27:30
43,503,651
3
0
null
null
null
null
UTF-8
Java
false
false
680
java
package IA.probAntenas; import aima.search.framework.HeuristicFunction; public class ProbAntenasHeuristicFunction3 implements HeuristicFunction { public boolean equals(Object obj) { boolean retValue; retValue = super.equals(obj); return retValue; } public double getHeuristicValue(Object state) { ProbAntenasBoard board=(ProbAntenasBoard)state; int cob=board.calculaCobertura(); int pot=board.potenciaEfectiva(); int an=board.antenasEfectivas(); int heur=0; if (pot>board.getMaxPotencia()) return(java.lang.Integer.MAX_VALUE); heur=((board.getDimPlano()*board.getDimPlano())-cob)-(pot*an); return(heur); } }
c7a88682c2457771f8a0bb368a350b5283cc97f8
f0d25d83176909b18b9989e6fe34c414590c3599
/app/src/main/java/com/google/android/gms/internal/zzaqx.java
2d625a3ccc0aeb8e28581a7d0fe3db4bb27331f1
[]
no_license
lycfr/lq
e8dd702263e6565486bea92f05cd93e45ef8defc
123914e7c0d45956184dc908e87f63870e46aa2e
refs/heads/master
2022-04-07T18:16:31.660038
2020-02-23T03:09:18
2020-02-23T03:09:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,319
java
package com.google.android.gms.internal; import android.content.Context; import android.os.IBinder; import android.os.IInterface; import android.os.Looper; import com.google.android.gms.auth.account.zzd; import com.google.android.gms.auth.account.zze; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.common.internal.zzq; import com.google.android.gms.common.internal.zzz; import com.tencent.smtt.sdk.TbsListener; public final class zzaqx extends zzz<zzd> { public zzaqx(Context context, Looper looper, zzq zzq, GoogleApiClient.ConnectionCallbacks connectionCallbacks, GoogleApiClient.OnConnectionFailedListener onConnectionFailedListener) { super(context, looper, TbsListener.ErrorCode.DOWNLOAD_HAS_LOCAL_TBS_ERROR, zzq, connectionCallbacks, onConnectionFailedListener); } /* access modifiers changed from: protected */ public final /* synthetic */ IInterface zzd(IBinder iBinder) { return zze.zzz(iBinder); } /* access modifiers changed from: protected */ public final String zzdb() { return "com.google.android.gms.auth.account.workaccount.START"; } /* access modifiers changed from: protected */ public final String zzdc() { return "com.google.android.gms.auth.account.IWorkAccountService"; } }
ab7c303be2c1f28a60ec068e3cef3d28de84be59
75c4712ae3f946db0c9196ee8307748231487e4b
/src/main/java/com/alipay/api/request/AlipayEbppInstserviceDeductQueryRequest.java
a4a635130e5639be40071a4b5a49d1bfe2d94135
[ "Apache-2.0" ]
permissive
yuanbaoMarvin/alipay-sdk-java-all
70a72a969f464d79c79d09af8b6b01fa177ac1be
25f3003d820dbd0b73739d8e32a6093468d9ed92
refs/heads/master
2023-06-03T16:54:25.138471
2021-06-25T14:48:21
2021-06-25T14:48:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,171
java
package com.alipay.api.request; import com.alipay.api.domain.AlipayEbppInstserviceDeductQueryModel; import java.util.Map; import com.alipay.api.AlipayRequest; import com.alipay.api.internal.util.AlipayHashMap; import com.alipay.api.response.AlipayEbppInstserviceDeductQueryResponse; import com.alipay.api.AlipayObject; /** * ALIPAY API: alipay.ebpp.instservice.deduct.query request * * @author auto create * @since 1.0, 2020-07-02 15:55:21 */ public class AlipayEbppInstserviceDeductQueryRequest implements AlipayRequest<AlipayEbppInstserviceDeductQueryResponse> { private AlipayHashMap udfParams; // add user-defined text parameters private String apiVersion="1.0"; /** * 政务民生机构代扣流程查询 */ private String bizContent; public void setBizContent(String bizContent) { this.bizContent = bizContent; } public String getBizContent() { return this.bizContent; } private String terminalType; private String terminalInfo; private String prodCode; private String notifyUrl; private String returnUrl; private boolean needEncrypt=false; private AlipayObject bizModel=null; public String getNotifyUrl() { return this.notifyUrl; } public void setNotifyUrl(String notifyUrl) { this.notifyUrl = notifyUrl; } public String getReturnUrl() { return this.returnUrl; } public void setReturnUrl(String returnUrl) { this.returnUrl = returnUrl; } public String getApiVersion() { return this.apiVersion; } public void setApiVersion(String apiVersion) { this.apiVersion = apiVersion; } public void setTerminalType(String terminalType){ this.terminalType=terminalType; } public String getTerminalType(){ return this.terminalType; } public void setTerminalInfo(String terminalInfo){ this.terminalInfo=terminalInfo; } public String getTerminalInfo(){ return this.terminalInfo; } public void setProdCode(String prodCode) { this.prodCode=prodCode; } public String getProdCode() { return this.prodCode; } public String getApiMethodName() { return "alipay.ebpp.instservice.deduct.query"; } public Map<String, String> getTextParams() { AlipayHashMap txtParams = new AlipayHashMap(); txtParams.put("biz_content", this.bizContent); if(udfParams != null) { txtParams.putAll(this.udfParams); } return txtParams; } public void putOtherTextParam(String key, String value) { if(this.udfParams == null) { this.udfParams = new AlipayHashMap(); } this.udfParams.put(key, value); } public Class<AlipayEbppInstserviceDeductQueryResponse> getResponseClass() { return AlipayEbppInstserviceDeductQueryResponse.class; } public boolean isNeedEncrypt() { return this.needEncrypt; } public void setNeedEncrypt(boolean needEncrypt) { this.needEncrypt=needEncrypt; } public AlipayObject getBizModel() { return this.bizModel; } public void setBizModel(AlipayObject bizModel) { this.bizModel=bizModel; } }
d064fec00aa215fdc0c0adb77b98c99405a9e7f9
6d6a2896e206089fed182d93f60e0691126d889c
/weka/main/java/weka/experiment/OutputZipper.java
645792f9f34690f7795e8f0fe541708f7b434fb2
[]
no_license
azizisya/benhesrc
2291c9d9cb22171f4e382968c14721d440bbabf2
4bd27c1f6e91b2aec1bd71f0810d1bbd0db902b5
refs/heads/master
2020-05-18T08:53:54.800452
2011-02-24T09:41:17
2011-02-24T09:41:17
34,458,592
2
0
null
null
null
null
UTF-8
Java
false
false
3,995
java
/* * 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 2 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, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * OutputZipper.java * Copyright (C) 2000 University of Waikato, Hamilton, New Zealand * */ package weka.experiment; import weka.core.RevisionHandler; import weka.core.RevisionUtils; import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.util.zip.GZIPOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; /** * OutputZipper writes output to either gzipped files or to a * multi entry zip file. If the destination file is a directory * each output string will be written to an individually named * gzip file. If the destination file is a file, then each * output string is appended as a named entry to the zip file until * finished() is called to close the file. * * @author Mark Hall ([email protected]) * @version $Revision: 1.1 $ */ public class OutputZipper implements RevisionHandler { File m_destination; DataOutputStream m_zipOut = null; ZipOutputStream m_zs = null; /** * Constructor. * * @param destination a destination file or directory * @throws Exception if something goes wrong. */ public OutputZipper(File destination) throws Exception { m_destination = destination; // if a directory is specified then use gzip format, otherwise // use zip if (!m_destination.isDirectory()) { m_zs = new ZipOutputStream(new FileOutputStream(m_destination)); m_zipOut = new DataOutputStream(m_zs); } } /** * Saves a string to either an individual gzipped file or as * an entry in a zip file. * * @param outString the output string to save * @param name the name of the file/entry to save it to * @throws Exception if something goes wrong */ public void zipit(String outString, String name) throws Exception { File saveFile; ZipEntry ze; if (m_zipOut == null) { saveFile = new File(m_destination, name+".gz"); DataOutputStream dout = new DataOutputStream(new GZIPOutputStream( new FileOutputStream(saveFile))); dout.writeBytes(outString); dout.close(); } else { ze = new ZipEntry(name); m_zs.putNextEntry(ze); m_zipOut.writeBytes(outString); m_zs.closeEntry(); } } /** * Closes the zip file. * * @throws Exception if something goes wrong */ public void finished() throws Exception { if (m_zipOut != null) { m_zipOut.close(); } } /** * Returns the revision string. * * @return the revision */ public String getRevision() { return RevisionUtils.extract("$Revision: 1.1 $"); } /** * Main method for testing this class */ public static void main(String [] args) { try { File testF = new File(new File(System.getProperty("user.dir")), "testOut.zip"); OutputZipper oz = new OutputZipper(testF); /* OutputZipper oz = new OutputZipper( new File(System.getProperty("user.dir"))); */ oz.zipit("Here is some test text to be zipped","testzip"); oz.zipit("Here is a second entry to be zipped","testzip2"); oz.finished(); } catch (Exception ex) { ex.printStackTrace(); System.err.println(ex.getMessage()); } } }
[ "ben.he.src@f3485be4-0bd3-11df-ad0c-0fb4090ca1bc" ]
ben.he.src@f3485be4-0bd3-11df-ad0c-0fb4090ca1bc
f342f2c07a14fd301cbf74c673f09fac8ff8eac6
dd4f8078cdc36d18032cc66faed26e260147d0a5
/lib/src/androidTest/java/net/treelzebub/sweepingcircleprogressview/ExampleInstrumentedTest.java
d84b16f1d2fedf08d4462d4fda2646063b020857
[ "MIT" ]
permissive
treelzebub/SweepingCircleProgressView
380fe182a5ab443eb1af237a81f83e136d949032
9e7492c48be172c680322382ebae8116021d7c71
refs/heads/master
2021-01-12T05:32:39.152167
2016-12-22T21:50:43
2016-12-22T21:50:43
77,122,037
0
0
null
null
null
null
UTF-8
Java
false
false
791
java
package net.treelzebub.sweepingcircleprogressview; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("net.treelzebub.sweepingcircleprogressview.test", appContext.getPackageName()); } }
7b689946b98ba9ddc654945b2b0494f412faafb9
fb1e39c907eb8cfb39b576bcfa51ac1946ee6edf
/app/src/main/java/com/MCAssignment/wifi/CheckInternetConnection.java
59832eef481155f8b0edff42ad642be1fbc3f8be
[ "MIT" ]
permissive
limkhashing/Mobile-Computing-Assignment
d6dacce3b2f50a0ba23753afaf6e78258c1cb8f4
9782543179a7b090c5925f7106e9582c7fa46a73
refs/heads/master
2022-04-09T19:22:10.527964
2020-01-13T09:19:51
2020-01-13T09:19:51
104,985,235
0
0
null
2019-11-07T03:20:14
2017-09-27T07:16:44
Java
UTF-8
Java
false
false
2,417
java
package com.MCAssignment.wifi; import android.app.ProgressDialog; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; import java.util.concurrent.Executor; import java.util.concurrent.Executors; public class CheckInternetConnection { boolean connectionResult; Context context; ProgressDialog progressDialog; Executor executor = Executors.newSingleThreadExecutor(); public CheckInternetConnection(Context context) { this.context = context; progressDialog = new ProgressDialog(context); } public void setConnectionResult(boolean connectionResult) { this.connectionResult = connectionResult; } public boolean isConnectionResult() { return connectionResult; } public void executeCheckInternet() { CheckInternet checkInternet = new CheckInternet(); checkInternet.execute(); } class CheckInternet extends AsyncTask<Void, Void, Boolean> { @Override protected Boolean doInBackground(Void... params) { if(hasInternetAccess()) { try { int timeoutMs = 1500; Socket sock = new Socket(); SocketAddress sockaddr = new InetSocketAddress("8.8.8.8", 53); sock.connect(sockaddr, timeoutMs); sock.close(); return true; } catch (IOException e) { return false; } } else { return false; } } @Override protected void onPostExecute(Boolean result) { setConnectionResult(result); } public boolean hasInternetAccess() { ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); if(netInfo != null && netInfo.isConnected() && netInfo.isAvailable()) // if got connection { return true; } else { return false; } } } }
f6fe83f3af5ba07657f9fab2372cbb61dbd7daf1
7b32aea12ea66175d1c628a1ad46d9ab40aeba65
/src/main/java/me/tucao/web/mvc/controllers/AppsController.java
7fc2345e8163c65bc5cde88dccd5d721ca944648
[]
no_license
wptree/tucao
ff394c079aea73459b83159c2a474802a6ea50ff
a7c50e43e700b6517688002a2a3a56b36d3742ad
refs/heads/master
2020-05-02T21:26:03.038239
2013-03-28T13:13:49
2013-03-28T13:13:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
548
java
package me.tucao.web.mvc.controllers; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller public class AppsController { @RequestMapping(value="/apps", method=RequestMethod.GET) public String view(Model model, HttpServletRequest request, HttpSession session){ return "apps"; } }
822e399e3fbbe5dbea4eaa64a2ff336401dbc829
fb60413b02cdf8a5c38d24b033d2900832ba9f19
/game_server/src/com/pwrd/war/gameserver/player/handler/PlayerMessageHandler.java
5e833ad736f8843c2f8b6873f85127ab4a723d52
[]
no_license
tommyadan/webgame
4729fc44617b9f104e0084d41763d98b3068f394
2117929e143e7498e524305ed529c4ee09163474
refs/heads/master
2021-05-27T04:59:34.506955
2012-08-20T14:30:07
2012-08-20T14:30:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,734
java
package com.pwrd.war.gameserver.player.handler; import com.pwrd.war.common.constants.Loggers; import com.pwrd.war.common.constants.WallowConstants; import com.pwrd.war.core.async.IIoOperation; import com.pwrd.war.core.msg.IMessage; import com.pwrd.war.core.msg.SysInternalMessage; import com.pwrd.war.db.model.PlayerGuideEntity; import com.pwrd.war.gameserver.common.Globals; import com.pwrd.war.gameserver.common.event.PlayerOffLineEvent; import com.pwrd.war.gameserver.common.i18n.LangService; import com.pwrd.war.gameserver.common.i18n.constants.PlayerLangConstants_30000; import com.pwrd.war.gameserver.common.i18n.constants.SceneLangConstants_60000; import com.pwrd.war.gameserver.human.manager.HumanInitManager; import com.pwrd.war.gameserver.player.OnlinePlayerService; import com.pwrd.war.gameserver.player.Player; import com.pwrd.war.gameserver.player.PlayerExitReason; import com.pwrd.war.gameserver.player.PlayerState; import com.pwrd.war.gameserver.player.RoleInfo; import com.pwrd.war.gameserver.player.msg.CGCreateRole; import com.pwrd.war.gameserver.player.msg.CGEnterScene; import com.pwrd.war.gameserver.player.msg.CGPlayerChargeDiamond; import com.pwrd.war.gameserver.player.msg.CGPlayerCookieLogin; import com.pwrd.war.gameserver.player.msg.CGPlayerEnter; import com.pwrd.war.gameserver.player.msg.CGPlayerGuide; import com.pwrd.war.gameserver.player.msg.CGPlayerGuideList; import com.pwrd.war.gameserver.player.msg.CGPlayerLogin; import com.pwrd.war.gameserver.player.msg.CGPlayerQueryAccount; import com.pwrd.war.gameserver.player.msg.CGRoleTemplate; import com.pwrd.war.gameserver.player.msg.GCNotifyException; import com.pwrd.war.gameserver.player.msg.GCPlayerGuideList; import com.pwrd.war.gameserver.player.msg.GCRoleTemplate; /** * 玩家消息处理器,处理玩家登录、换线、换地图等消息,主线程中调用 * */ public class PlayerMessageHandler { protected OnlinePlayerService onlinePlayerService; protected LangService langService; protected PlayerMessageHandler(OnlinePlayerService playerManager,LangService langService) { this.onlinePlayerService = playerManager; this.langService = langService; } /** * 玩家主动下线时调用此方法 * * @param player */ public void handlePlayerCloseSession(final Player player) { if (player != null) { final IMessage offlineMsg = new SysInternalMessage() { @Override public void execute() { if (player.getState() != PlayerState.logouting) { if (player.getWallowFlag() == WallowConstants.WALLOW_FLAG_ON) { Globals.getWallowService().onPlayerExit(player.getPassportId()); } PlayerOffLineEvent e = new PlayerOffLineEvent(player); Globals.getEventService().fireEvent(e); Globals.getOnlinePlayerService().offlinePlayer(player,player.exitReason == null ? PlayerExitReason.LOGOUT : player.exitReason); } } }; Globals.getMessageProcessor().put(offlineMsg); } } public void handlePlayerLogin(Player player, CGPlayerLogin cgPlayerLogin) { String account = cgPlayerLogin.getAccount(); String password = cgPlayerLogin.getPassword(); // 验证用户名和密码不能为空 if (account == null || account.equals("")) { return; } if (password == null || password.equals("")) { return; } if (Globals.getOnlinePlayerService().isFull()) { // 服务器人满了 player.sendMessage(new GCNotifyException(PlayerLangConstants_30000.LOGIN_ERROR_SERVER_FULL, langService.read( PlayerLangConstants_30000.LOGIN_ERROR_SERVER_FULL))); player.exitReason = PlayerExitReason.SERVER_IS_FULL; player.disconnect(); return; } Globals.getLoginLogicalProcessor().playerLogin(player, account, password); } public void handlePlayerCookieLogin(Player player,CGPlayerCookieLogin cgPlayerCookieLogin) { String cookieValue = cgPlayerCookieLogin.getCookieValue(); // 验证cookie不能为空 if (cookieValue == null || cookieValue.equals("")) { return; } if (Globals.getOnlinePlayerService().isFull()) { // 服务器人满了 player.sendMessage(new GCNotifyException(PlayerLangConstants_30000.LOGIN_ERROR_SERVER_FULL, langService.read( PlayerLangConstants_30000.LOGIN_ERROR_SERVER_FULL))); player.exitReason = PlayerExitReason.SERVER_IS_FULL; player.disconnect(); return; } Globals.getLoginLogicalProcessor().playerCookieLogin(player, cookieValue); } /** * 客户段请求角色模板 * 简单的消息,不涉及逻辑,就在这里直接处理了 * @param player * @param cgRoleTemplate */ public void handleRoleTemplate(Player player, CGRoleTemplate cgRoleTemplate) { GCRoleTemplate gcRoleTemplate = new GCRoleTemplate(); player.sendMessage(gcRoleTemplate); } public void handleCreateRole(Player player, CGCreateRole msg) { String roleName = msg.getName(); RoleInfo role = new RoleInfo(); role.setName(roleName); role.setPassportId(player.getPassportId()); role.setSex(msg.getSex()); role.setVocation(msg.getVocation()); role.setCamp(msg.getCamp()); // PetSelection selection = new PetSelection(); // //TODO // selection.setTemplateId(41011001); //// role.setSelection(selection); Globals.getLoginLogicalProcessor().createRole(player, role); } /** * 选择角色,由于默认肯定是一个角色,所以命名为PlayerEnter,实际就是SelectRole * @param player * @param cgPlayerEnter */ public void handlePlayerEnter(final Player player, CGPlayerEnter cgPlayerEnter) { String roleUUID = cgPlayerEnter.getRoleUUID(); //人数已经满,不能进入服务器,断开连接 if (!Globals.getOnlinePlayerService().onPlayerEnterServer(player, roleUUID)) { Loggers.gameLogger.warn("player " + player.getPassportName() + " can't enter server"); player.sendMessage(new GCNotifyException(PlayerLangConstants_30000.LOGIN_ERROR_SERVER_FULL, Globals.getLangService().read(PlayerLangConstants_30000.LOGIN_ERROR_SERVER_FULL))); player.exitReason = PlayerExitReason.SERVER_ERROR; player.disconnect(); return ; } //需要判断合法性 Globals.getLoginLogicalProcessor().selectRole(player, roleUUID); } /** * * 进入地图 * * @see HumanInitManager#noticeHuman * @param player * @param cgEnterScene */ public void handleEnterScene(final Player player, CGEnterScene cgEnterScene) { if(player.getState() == PlayerState.incoming){//只有在第一次进入场景的时候需要设置为entering player.setState(PlayerState.entering); } //人数出现错误,不能进入场景,断开连接 if (!Globals.getSceneService().onPlayerEnterScene(player, cgEnterScene.getLine())) { Loggers.gameLogger.warn("player " + player.getPassportName() + " can't enter scene, targetSceneId :" + player.getTargetSceneId()); player.sendMessage(new GCNotifyException(SceneLangConstants_60000.ENTER_SCENE_FAIL, Globals.getLangService().read(SceneLangConstants_60000.ENTER_SCENE_FAIL))); player.exitReason = PlayerExitReason.SERVER_ERROR; player.disconnect(); return; } } /** * 玩家充值消息 * @param player * @param cgPlayerChargeGold */ public void handlePlayerChargeDiamond(Player player,CGPlayerChargeDiamond cgPlayerChargeDiamond) { int mmCost = cgPlayerChargeDiamond.getMmCost(); Globals.getChargeLogicalProcessor().chargeGold(player, mmCost); } /** * 玩家账户查询 * @param player * @param cgPlayerQueryAccount */ public void handlePlayerQueryAccount(Player player,CGPlayerQueryAccount cgPlayerQueryAccount) { Globals.getChargeLogicalProcessor().queryPlayerAccount(player); } //取新手引导列表 public void handlePlayerGuideList(Player player, CGPlayerGuideList msg){ class GetList implements IIoOperation{ public Player player; @Override public int doStop() { return STAGE_STOP_DONE; } @Override public int doStart() { return STAGE_START_DONE; } @Override public int doIo() { PlayerGuideEntity ent = Globals.getDaoService().getPlayerGuideDAO().getByPlayerUUID(player.getRoleUUID()); if(ent != null){ GCPlayerGuideList rmsg = new GCPlayerGuideList(ent.getIds()); player.sendMessage(rmsg); }else{ GCPlayerGuideList rmsg = new GCPlayerGuideList(""); player.sendMessage(rmsg); } return STAGE_IO_DONE; } }; GetList op = new GetList(); op.player = player; Globals.getAsyncService().createOperationAndExecuteAtOnce(op); } //新手引导保存 public void handlePlayerGuide(Player player, CGPlayerGuide msg){ class Save implements IIoOperation{ public String playerUUID; public String guideId; @Override public int doStop() { return STAGE_STOP_DONE; } @Override public int doStart() { return STAGE_START_DONE; } @Override public int doIo() { PlayerGuideEntity ent = Globals.getDaoService().getPlayerGuideDAO().getByPlayerUUID(playerUUID); if(ent == null){ ent = new PlayerGuideEntity(); ent.setPlayerUUID(playerUUID); ent.setIds(guideId); Globals.getDaoService().getPlayerGuideDAO().save(ent); }else{ ent.setIds(ent.getIds()+","+guideId); Globals.getDaoService().getPlayerGuideDAO().saveOrUpdate(ent); } return STAGE_IO_DONE; } }; Save op = new Save(); op.playerUUID = player.getRoleUUID(); op.guideId = msg.getGuideId(); Globals.getAsyncService().createOperationAndExecuteAtOnce(op); } }
971015479c64be31ab88ca6a111984bf9cc2de5d
600531083b0044e596d737d70dd5c17b0358763f
/my_ssm/ssm-demo/ssm-resume/src/main/java/com/ssm/resume/tools/PDFUtil.java
d0d59180fa93a0dbc4ef55d3260799b375f70f9d
[ "MIT" ]
permissive
kinghaoYPGE/my_java
97e0368ea63f69693cf35e088e6a2cd07cceef2d
ca01e2a8625bc5d3e0ff0c0c73be29df2f2981cc
refs/heads/master
2022-12-21T20:16:37.318722
2020-05-18T12:01:03
2020-05-18T12:01:03
183,593,359
0
0
MIT
2022-12-16T09:03:02
2019-04-26T08:51:08
JavaScript
UTF-8
Java
false
false
1,538
java
package com.ssm.resume.tools; import com.itextpdf.text.pdf.AcroFields; import com.itextpdf.text.pdf.BaseFont; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfStamper; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.util.Map; public class PDFUtil { /** * 将数据填入pdf模板 * * @param in pdf模板输入流 * @param data 替换数据 */ public static ByteArrayOutputStream generate(InputStream in, Map data) throws Exception { PdfReader template = new PdfReader(in); try { ByteArrayOutputStream out = new ByteArrayOutputStream(); PdfStamper stamp = new PdfStamper(template, out); // 获取pdf文件表单域 AcroFields form = stamp.getAcroFields(); //支持中文 BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.EMBEDDED); //迭代map,将map对应的值写入表单 for (Object o : data.keySet()) { String key = (String) o; String value = (String) data.get(key); form.setFieldProperty(key, "textfont", font, null); form.setField(key, value, value); } stamp.setFormFlattening(true); stamp.close(); return out; } catch (Exception e) { e.printStackTrace(); throw e; } finally { template.close(); in.close(); } } }
4dd4ddedd1c23a33d8cf7cec17270b2fb1a04aca
fd64b263cbb7654265fd97bbe7d195ba1f8de129
/src/test/java/com/brainyodds/config/WebConfigurerTest.java
2892030bf8947ed25df2a14e00981cf200f6b865
[]
no_license
talfoa/brainy-odds-repository
8e5bdcd81474537a0f76e37e56f6c60e0d194665
9e96dff164300a9a92f029754374a409321dbd7e
refs/heads/master
2023-01-03T06:54:04.914807
2020-10-27T15:41:46
2020-10-27T15:41:46
307,748,561
0
0
null
2020-10-27T16:47:00
2020-10-27T15:41:27
Java
UTF-8
Java
false
false
6,721
java
package com.brainyodds.config; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.options; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import io.github.jhipster.config.JHipsterConstants; import io.github.jhipster.config.JHipsterProperties; import io.github.jhipster.web.filter.CachingHttpHeadersFilter; import java.io.File; import java.util.*; import javax.servlet.*; import org.h2.server.web.WebServlet; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory; import org.springframework.http.HttpHeaders; import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.web.MockServletContext; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; /** * Unit tests for the {@link WebConfigurer} class. */ public class WebConfigurerTest { private WebConfigurer webConfigurer; private MockServletContext servletContext; private MockEnvironment env; private JHipsterProperties props; @BeforeEach public void setup() { servletContext = spy(new MockServletContext()); doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class)); doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class)); env = new MockEnvironment(); props = new JHipsterProperties(); webConfigurer = new WebConfigurer(env, props); } @Test public void testStartUpProdServletContext() throws ServletException { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); webConfigurer.onStartup(servletContext); verify(servletContext, never()).addServlet(eq("H2Console"), any(WebServlet.class)); } @Test public void testStartUpDevServletContext() throws ServletException { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT); webConfigurer.onStartup(servletContext); verify(servletContext).addServlet(eq("H2Console"), any(WebServlet.class)); } @Test public void testCustomizeServletContainer() { env.setActiveProfiles(JHipsterConstants.SPRING_PROFILE_PRODUCTION); UndertowServletWebServerFactory container = new UndertowServletWebServerFactory(); webConfigurer.customize(container); assertThat(container.getMimeMappings().get("abs")).isEqualTo("audio/x-mpeg"); assertThat(container.getMimeMappings().get("html")).isEqualTo("text/html;charset=utf-8"); assertThat(container.getMimeMappings().get("json")).isEqualTo("text/html;charset=utf-8"); if (container.getDocumentRoot() != null) { assertThat(container.getDocumentRoot()).isEqualTo(new File("target/classes/static/")); } } @Test public void testCorsFilterOnApiPath() throws Exception { props.getCors().setAllowedOrigins(Collections.singletonList("*")); props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); props.getCors().setAllowedHeaders(Collections.singletonList("*")); props.getCors().setMaxAge(1800L); props.getCors().setAllowCredentials(true); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); mockMvc .perform( options("/api/test-cors") .header(HttpHeaders.ORIGIN, "other.domain.com") .header(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD, "POST") ) .andExpect(status().isOk()) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")) .andExpect(header().string(HttpHeaders.VARY, "Origin")) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,PUT,DELETE")) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true")) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_MAX_AGE, "1800")); mockMvc .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) .andExpect(status().isOk()) .andExpect(header().string(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "other.domain.com")); } @Test public void testCorsFilterOnOtherPath() throws Exception { props.getCors().setAllowedOrigins(Collections.singletonList("*")); props.getCors().setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); props.getCors().setAllowedHeaders(Collections.singletonList("*")); props.getCors().setMaxAge(1800L); props.getCors().setAllowCredentials(true); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); mockMvc .perform(get("/test/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) .andExpect(status().isOk()) .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); } @Test public void testCorsFilterDeactivated() throws Exception { props.getCors().setAllowedOrigins(null); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); mockMvc .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) .andExpect(status().isOk()) .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); } @Test public void testCorsFilterDeactivated2() throws Exception { props.getCors().setAllowedOrigins(new ArrayList<>()); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new WebConfigurerTestController()).addFilters(webConfigurer.corsFilter()).build(); mockMvc .perform(get("/api/test-cors").header(HttpHeaders.ORIGIN, "other.domain.com")) .andExpect(status().isOk()) .andExpect(header().doesNotExist(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN)); } }
623baa476d04967a6c8d469a168527e0a895d2f2
61602d4b976db2084059453edeafe63865f96ec5
/com/xunlei/downloadprovider/personal/a/b/g.java
a5a0463fc8d9e6654b2279e35c4118836d4b4c6e
[]
no_license
ZoranLi/thunder
9d18fd0a0ec0a5bb3b3f920f9413c1ace2beb4d0
0778679ef03ba1103b1d9d9a626c8449b19be14b
refs/heads/master
2020-03-20T23:29:27.131636
2018-06-19T06:43:26
2018-06-19T06:43:26
137,848,886
12
1
null
null
null
null
UTF-8
Java
false
false
1,373
java
package com.xunlei.downloadprovider.personal.a.b; import android.graphics.Rect; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ItemDecoration; import android.support.v7.widget.RecyclerView.State; import android.view.View; import com.xunlei.common.androidutil.DipPixelUtil; /* compiled from: UserGridItemDecoration */ public final class g extends ItemDecoration { public final void getItemOffsets(Rect rect, View view, RecyclerView recyclerView, State state) { state = ((GridLayoutManager) recyclerView.getLayoutManager()).getSpanCount(); rect.left = 0; rect.bottom = 0; view = recyclerView.getChildLayoutPosition(view); if (view % state == null) { rect.left = 0; } View view2 = h.a; state = DipPixelUtil.dip2px(5.0f); int i = view2 % 3; if (i == 0) { if (view == view2 - 3 || view == view2 - 2 || view == view2 - 1) { rect.bottom = state; } } else if (i == 1) { if (view == view2 - 1 || view == view2 || view == view2 + 1) { rect.bottom = state; } } else if (i == 2 && (view == view2 - 2 || view == view2 - 1 || view == view2)) { rect.bottom = state; } } }
3921c6d62c42600752b91bc86639938294b804b9
76baceccda28dd75f3da4ddeb0cf1f2d5899b228
/MEDIATOR/20190511/src/Colleague.java
579da16d8e1241c3f5b72feaa0a62abf621215e2
[]
no_license
escort94/JavaDesignPattern
722adc813ac16030855a0a198ff7eee34382241e
bae23d28eb4f76fd882424eca7d6567eec6a12d7
refs/heads/master
2022-06-12T18:55:23.488233
2020-05-08T02:57:00
2020-05-08T02:57:00
262,198,567
0
0
null
null
null
null
UTF-8
Java
false
false
537
java
public abstract class Colleague { private Mediator mediator; private int colleagueCode; public Colleague(Mediator mediator) { super(); this.mediator = mediator; mediator.addColleague(this); } public void saleOffer(String stock, int shares) { mediator.saleOffer(stock, shares, this.colleagueCode); } public void buyOffer(String stock, int shares) { mediator.buyOffer(stock, shares, this.colleagueCode); } public void setCollCode(int collCode) { colleagueCode = collCode;} }
353e9f630ceafe0ed832e52d84dc94f05130e25f
d8a20117aec7158fc362bc36009280fb9dd49234
/eureka-server/src/main/java/com/hsb/cloud/SpringCloudEurekaApplication.java
75003f1f868303e4cc7ac005a4e2a7cdf88de394
[]
no_license
heshengbang/spring-cloud-example
888cde0d255beb14a00f698e508a02c0ff56c371
7cfaadfce1ed06a099b440b304656ee66830c141
refs/heads/master
2021-07-17T12:02:23.972578
2019-01-08T01:42:08
2019-01-08T01:42:08
140,861,337
0
0
null
null
null
null
UTF-8
Java
false
false
603
java
package com.hsb.cloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; /** * Created by heshengbang on 2018/7/14. * https://github.com/heshengbang * www.heshengbang.tech * email: [email protected] */ @SpringBootApplication //启用服务注册服务 @EnableEurekaServer public class SpringCloudEurekaApplication { public static void main(String[] args) { SpringApplication.run(SpringCloudEurekaApplication.class, args); } }
739227ada7a09fab3d8517561e0d533fa775dee7
edd80d375ebdc2c5b46d3ded276e2a08b5d1543f
/library/src/main/java/com/jewelbao/library/utils/IOUtils.java
8cccc17defccc02d344e8cf1c116de214e61dfa6
[]
no_license
jewelbao/JewelSample
521b9dc8c1f390904e7865696fe8a0af03a86160
61d84a3e5218489377f316231232597fe30f1e11
refs/heads/master
2020-04-06T07:10:16.134800
2019-06-28T06:42:39
2019-06-28T06:42:39
65,712,737
0
0
null
null
null
null
UTF-8
Java
false
false
1,814
java
package com.jewelbao.library.utils; import java.io.Closeable; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; /** IO utils @author Vladislav Bauer */ public class IOUtils { private IOUtils() { throw new AssertionError(); } /** Close closable object and wrap {@link IOException} with {@link RuntimeException} @param closeable closeable object */ public static void close(Closeable closeable) { if(closeable != null) { try { closeable.close(); } catch(IOException e) { throw new RuntimeException("IOException occurred. ", e); } } } /** Close closable and hide possible {@link IOException} @param closeable closeable object */ public static void closeQuietly(Closeable closeable) { if(closeable != null) { try { closeable.close(); } catch(IOException e) { // Ignored } } } /** 保存文本 @param fileName 文件名字 @param content 内容 @param append 是否累加 @return 是否成功 */ public static boolean saveTextValue(String fileName, String content, boolean append) { try { File textFile = new File(fileName); if(!append && textFile.exists()) textFile.delete(); FileOutputStream os = new FileOutputStream(textFile); os.write(content.getBytes("UTF-8")); os.close(); } catch(Exception ee) { return false; } return true; } /** 删除目录下所有文件 @param Path 路径 */ public static void deleteAllFile(String Path) { // 删除目录下所有文件 File path = new File(Path); File files[] = path.listFiles(); if(files != null) { for(File tfi : files) { if(tfi.isDirectory()) { System.out.println(tfi.getName()); } else { tfi.delete(); } } } } }
f3181ea83f7bcb35e6904b505cc63f5d1512b773
3cdfa964af25bc07c3e3b50168790a578632215e
/msg/src/main/java/org/alok/java/msg/service/ProfileService.java
bb89467d661a0fe57ebd39d1fe7809e5ecb473d1
[]
no_license
alokkumar123/MessangerApi
cd6d6d29e801cb0b54ed32081f9b5c586596f195
b0b0404d34f75eba216bce39e18dd05c46fb8600
refs/heads/master
2021-07-10T01:38:00.106622
2017-10-12T12:37:14
2017-10-12T12:37:14
105,913,931
0
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
package org.alok.java.msg.service; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.alok.java.msg.database.DataBaseClass; import org.alok.java.msg.model.Profile; public class ProfileService { private static Map<String,Profile> profiles = DataBaseClass.getProfiles(); public ProfileService(){ profiles.put("AlokP1", new Profile(1L,"Alok Profile","Alok","Kumar")); } public List<Profile> getAllProfiles(){ return new ArrayList<Profile>(profiles.values()); } public Profile getPdofileName(String profileName){ return profiles.get(profileName); } public Profile addProfile(Profile profile){ profile.setId(profiles.size()+1); profiles.put(profile.getProfileName(), profile); return profile; } public Profile updateProfileName(Profile profile){ if(profile.getProfileName().isEmpty()){ return null; } profiles.put(profile.getProfileName(), profile); return profile; } public Profile removePfroflie(String profileName){ return profiles.remove(profileName); } }
b19a80cc93bfccf6690d78b0b671908160dfef05
8b8fbf236f3572724a2e4bbcd885d7cb583a8ff3
/tfmall-customer-service/src/test/java/com/tianfang/customer/CustomerApplicationTests.java
6586029a45ed997c4923b655481de0515339c240
[]
no_license
toBe-Better/mall
5154bd2492c1bc1cad9a53ac0158483aee4f5cdd
4d4fd242824545d5d6e47bc7a80b6a78c2b1807c
refs/heads/master
2022-12-13T21:01:18.356383
2020-09-18T09:25:55
2020-09-18T09:25:55
296,209,340
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package com.tianfang.customer; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class CustomerApplicationTests { @Test void contextLoads() { } }
f9d7a0d06347ca0af9bf836ac180f5df506a60d6
49f5c3a3a5e8cd10346407a3457565d00b76bb23
/app/src/main/java/com/papermanagement/response/ForceDataResponse.java
eaa765e7ca92d34363c7a491c1e7c500658a78aa
[]
no_license
renyangwei/produce_control_system_app
cfa81b658dd4a7759b1d7c998941bf8d6ccc94f4
87ae092acd97552c50d6b0cf89e43981f8430477
refs/heads/master
2020-04-15T03:48:09.970826
2018-10-31T15:48:59
2018-10-31T15:48:59
164,360,629
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package com.papermanagement.response; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; /** * 强制刷新返回 */ public class ForceDataResponse { @SerializedName("response") @Expose private String response; public String getResponse() { return response; } public void setResponse(String response) { this.response = response; } }
05c883b2a5456a24e484ad0dda10d178f730248f
555c90b51f3214acc462f2599b8e80796ffa8360
/lims/src/cn/nchu/lims/util/lang/StringUtil.java
61657a34348685992cda42adc84ee8ec77e1b193
[]
no_license
XIAAMAN/BackstageManageProject
7ae9002135d94e85ed55273544c8ab183d0b679c
5c27675fb54b60c8b76a8669fd40d74431afdbd8
refs/heads/master
2021-08-23T07:20:05.954828
2017-12-04T03:12:35
2017-12-04T03:12:35
112,989,515
1
0
null
null
null
null
GB18030
Java
false
false
3,062
java
package cn.nchu.lims.util.lang; import java.util.regex.Pattern; public class StringUtil { /** * 判读字符串是否为null 或为"" * @param title * @return boolean */ public static boolean isNullOrEmpty(String str) { return (str == null || str.trim().equals("")); } /** * 判断是否符合邮箱格式 * @param str : String * @return boolean */ public static boolean isEmail(String str) { return (!StringUtil.isNullOrEmpty(str) && Pattern.matches("^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w+)+)$", str.trim())); } /** * 判断是否符合邮箱格式,或者是否为空 * 用户修改信息时的校验 * @param str : String * @return boolean */ public static boolean isEmailOrNull(String str) { return (StringUtil.isNullOrEmpty(str) || Pattern.matches("^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w+)+)$", str.trim())); } /** * 判断字符串是否符合长度要求 * @param min : int * @param str : Stirng * @param max : int * @return boolean */ public static boolean inLength(int min, String str, int max) { return (!StringUtil.isNullOrEmpty(str.trim()) && str.trim().length() >= min && str.trim().length() <= max); } /** * 判断字符串是否符合长度要求,或者是否为空 * 用户修改信息时的校验 * @param min : int * @param str : Stirng * @param max : int * @return boolean */ public static boolean inLengthOrNull(int min, String str, int max) { return (StringUtil.isNullOrEmpty(str.trim()) || str.trim().length() >= min && str.trim().length() <= max); } /** * 判断字符串是否存在数组中 * @param str * @param array * @return */ public static boolean inArray(String str, String[] array) { boolean empty = false, in = false; empty = StringUtil.isNullOrEmpty(str.trim()); // 判断测试字符是否为空或为"" for(String string : array) { // 判断str是否在array里面 if(str.trim().equals(string)) { in = true; break; } } return (!empty && in); } /** * 判断字符串是否存在数组中,或者是否为空 * @param str * @param array * @return */ public static boolean inArrayOrNull(String str, String[] array) { boolean empty = false, in = false; empty = StringUtil.isNullOrEmpty(str.trim()); // 判断测试字符是否为空或为"" for(String string : array) { // 判断str是否在array里面 if(str.trim().equals(string)) { in = true; break; } } return (empty || in); } /** * 将一个字符串通过特定的字符分割成数组 * @param param String 要分割的字符串 * @param split String 用于分割的字符 * @return */ public static String[] split(String param, String split) { String[] params = null; params = param.split(split); return params; } /** * 字符串首字母转换成大写 * @param param String * @return String */ public static String FirstToUp(String param) { return param.replaceFirst(param.substring(0, 1),param.substring(0, 1).toUpperCase()) ; } }
535c70d33280c75f4f4ab1cda9fc25837d39d264
ab5a8b9396189c7962088e7e1a5c7772801554f4
/src/main/java/com/ldgx/eshop/service/IGoodsService.java
ebb7ffc2f5aebb9686e4bfd90ce11038dabe72fd
[]
no_license
fulq1234/eshop-back
7bef64bcf0b73586e3136fae7471f49fe580f1d0
b2aac4d783909a69eaf4cc19f1811e3c90e3daff
refs/heads/master
2021-04-25T15:34:44.927504
2017-12-07T00:55:53
2017-12-07T00:55:53
109,658,870
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package com.ldgx.eshop.service; import java.util.List; import com.ldgx.eshop.entity.Goods; public interface IGoodsService { public List<Goods> query(String name,int limit) throws Exception; }
08efd6eb89931d17ad317d1a8775b4e2ec1bbba0
eb84b0ce1957e11d9e9c911f5b3d01ebdd3be745
/src/main/java/ai/hual/labrador/local/remote/ManageDictAccessor.java
e48c2fd2291572e12a62a82ac74f66fa64001779
[]
no_license
zhengyul9/Dialog-Robot
75b58fbf86cb3b2dc5e52082765854b067c3323b
414593674521896427a099d17139efb67e1b1516
refs/heads/master
2022-11-21T15:24:40.030048
2020-08-23T19:45:57
2020-08-23T19:45:57
204,849,324
0
1
null
2022-11-16T08:34:10
2019-08-28T04:40:50
Java
UTF-8
Java
false
false
1,154
java
package ai.hual.labrador.local.remote; import ai.hual.labrador.dialog.accessors.DictAccessor; import ai.hual.labrador.nlu.DictModel; import ai.hual.labrador.nlu.DictModelSerDeser; import ai.hual.labrador.nlu.annotators.DictAnnotator; import java.nio.charset.StandardCharsets; import java.util.List; import java.util.Properties; public class ManageDictAccessor implements DictAccessor { private ManageClient client; private DictModel cachedDictModel; ManageDictAccessor(ManageClient client) { this.client = client; } private DictModel fetchDictModel() { if (cachedDictModel == null) { cachedDictModel = new DictModelSerDeser().deserialize( client.get("/bot/{botName}/dicts/export", null).getBytes(StandardCharsets.UTF_8)); } return cachedDictModel; } @Override public DictModel getDictModel() { return fetchDictModel(); } @Override public DictAnnotator constructDictAnnotator(boolean useNormalDict, List<String> dictTypes) { return new DictAnnotator(fetchDictModel(), new Properties(), useNormalDict, dictTypes); } }
89d42460f154749ef75f9f96a6afb8ce29b09b5a
86987be3eb14f46cd1b2b175b1e5c1a66f009157
/app/src/main/java/com/example/retailnav/activity_map.java
b8975f6b3b210db4f3bd5706c54250b48142e9bd
[]
no_license
UmaAthikala/RetailNav
f3acddd3209e886a1caaf63e7d1430a782704dd4
bf655d3958facc4d71c348d48c88062e554584d5
refs/heads/master
2022-09-07T22:09:07.654611
2020-05-30T21:44:48
2020-05-30T21:44:48
267,157,497
0
0
null
null
null
null
UTF-8
Java
false
false
4,358
java
package com.example.retailnav; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.drawable.GradientDrawable; import android.os.Bundle; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import androidx.appcompat.app.AppCompatActivity; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class activity_map extends AppCompatActivity { ArrayList<String> shoppingList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map); Intent i = getIntent(); shoppingList = (ArrayList<String>) i.getSerializableExtra("shoppinglist"); // To get names of all files inside the "Files" folder BufferedReader reader = null; try { reader = new BufferedReader( new InputStreamReader(getAssets().open("positions.txt"))); // do reading, usually loop until end of file reading String mLine; Bitmap bitmap = Bitmap.createBitmap(1000, 1000, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); canvas.drawColor(Color.BLACK); Paint paint = new Paint(); paint.setColor(Color.RED); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(8); paint.setAntiAlias(true); int offset = 50; canvas.drawLine(300,600,200,100, paint); ImageView mImageView = (ImageView) findViewById(R.id.iv); mImageView.setImageBitmap(bitmap); int prev_x=-1,prev_y=-1; while ((mLine = reader.readLine()) != null) { //System.out.println("\n*****\n*******\n*****\n****\n"+mLine); String node_details[]=mLine.split(","); create_nodes(node_details); } } catch (IOException e) { //log the exception } finally { if (reader != null) { try { reader.close(); } catch (IOException e) { //log the exception } } } } protected void create_nodes(String node_details[]) { int node_id = Integer.parseInt(node_details[0]); int node_x = Integer.parseInt(node_details[2]); int node_y = Integer.parseInt(node_details[3]); //System.out.println(node_id + "," + node_details[1] + "," + node_x + "," + node_y); RelativeLayout map_layout; map_layout = (RelativeLayout) findViewById(R.id.activity_map); Button node = new Button(this); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); params.setMargins(node_x * 10, 0, 0, node_y * 10); node.setLayoutParams(params); node.setGravity(1); node.setClickable(true); node.setFocusable(true); node.setPadding(2, 2, 2, 2); node.setId(node_id); node.setText(node_details[1]); node.setHeight(80); node.setWidth(200); GradientDrawable shape = new GradientDrawable(); shape.setShape(GradientDrawable.RECTANGLE); shape.setCornerRadii(new float[] { 8, 8, 8, 8, 0, 0, 0, 0 }); if(node_details[1].contentEquals("Entrance")) shape.setColor(Color.GRAY); else if(shoppingList.contains(node_details[1])) { shape.setColor(Color.YELLOW); System.out.println("\n\n***************"+node_details[1]); } else shape.setColor(Color.GREEN); shape.setStroke(3, Color.BLACK); node.setBackground(shape); if (map_layout != null) { map_layout.addView(node); } } }
9a99ed4d1c4dba85af5a0e9055a4febb2c1be0a7
f28dce60491e33aefb5c2187871c1df784ccdb3a
/src/main/java/com/nostra13/universalimageloader/cache/disc/impl/ext/LruDiskCache.java
0591c6928a29071d181ca267944d1cbb407fd2df
[ "Apache-2.0" ]
permissive
JackChan1999/boohee_v5.6
861a5cad79f2bfbd96d528d6a2aff84a39127c83
221f7ea237f491e2153039a42941a515493ba52c
refs/heads/master
2021-06-11T23:32:55.977231
2017-02-14T18:07:04
2017-02-14T18:07:04
81,962,585
8
6
null
null
null
null
UTF-8
Java
false
false
6,980
java
package com.nostra13.universalimageloader.cache.disc.impl.ext; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import com.nostra13.universalimageloader.cache.disc.DiskCache; import com.nostra13.universalimageloader.cache.disc.impl.ext.DiskLruCache.Editor; import com.nostra13.universalimageloader.cache.disc.impl.ext.DiskLruCache.Snapshot; import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; import com.nostra13.universalimageloader.utils.IoUtils; import com.nostra13.universalimageloader.utils.IoUtils.CopyListener; import com.nostra13.universalimageloader.utils.L; import java.io.BufferedOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class LruDiskCache implements DiskCache { public static final int DEFAULT_BUFFER_SIZE = 32768; public static final CompressFormat DEFAULT_COMPRESS_FORMAT = CompressFormat.PNG; public static final int DEFAULT_COMPRESS_QUALITY = 100; private static final String ERROR_ARG_NEGATIVE = " argument must be positive " + "number"; private static final String ERROR_ARG_NULL = " argument must be not null"; protected int bufferSize; protected DiskLruCache cache; protected CompressFormat compressFormat; protected int compressQuality; protected final FileNameGenerator fileNameGenerator; private File reserveCacheDir; public LruDiskCache(File cacheDir, FileNameGenerator fileNameGenerator, long cacheMaxSize) throws IOException { this(cacheDir, null, fileNameGenerator, cacheMaxSize, 0); } public LruDiskCache(File cacheDir, File reserveCacheDir, FileNameGenerator fileNameGenerator, long cacheMaxSize, int cacheMaxFileCount) throws IOException { this.bufferSize = 32768; this.compressFormat = DEFAULT_COMPRESS_FORMAT; this.compressQuality = 100; if (cacheDir == null) { throw new IllegalArgumentException("cacheDir argument must be not null"); } else if (cacheMaxSize < 0) { throw new IllegalArgumentException("cacheMaxSize argument must be positive number"); } else if (cacheMaxFileCount < 0) { throw new IllegalArgumentException("cacheMaxFileCount argument must be positive " + "number"); } else if (fileNameGenerator == null) { throw new IllegalArgumentException("fileNameGenerator argument must be not null"); } else { if (cacheMaxSize == 0) { cacheMaxSize = Long.MAX_VALUE; } if (cacheMaxFileCount == 0) { cacheMaxFileCount = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED; } this.reserveCacheDir = reserveCacheDir; this.fileNameGenerator = fileNameGenerator; initCache(cacheDir, reserveCacheDir, cacheMaxSize, cacheMaxFileCount); } } private void initCache(File cacheDir, File reserveCacheDir, long cacheMaxSize, int cacheMaxFileCount) throws IOException { try { this.cache = DiskLruCache.open(cacheDir, 1, 1, cacheMaxSize, cacheMaxFileCount); } catch (IOException e) { L.e(e); if (reserveCacheDir != null) { initCache(reserveCacheDir, null, cacheMaxSize, cacheMaxFileCount); } if (this.cache == null) { throw e; } } } public File getDirectory() { return this.cache.getDirectory(); } public File get(String imageUri) { File file = null; Snapshot snapshot = null; try { snapshot = this.cache.get(getKey(imageUri)); if (snapshot != null) { file = snapshot.getFile(0); } if (snapshot != null) { snapshot.close(); } } catch (IOException e) { L.e(e); if (snapshot != null) { snapshot.close(); } } catch (Throwable th) { if (snapshot != null) { snapshot.close(); } } return file; } public boolean save(String imageUri, InputStream imageStream, CopyListener listener) throws IOException { boolean z = false; Editor editor = this.cache.edit(getKey(imageUri)); if (editor != null) { OutputStream os = new BufferedOutputStream(editor.newOutputStream(0), this.bufferSize); z = false; try { z = IoUtils.copyStream(imageStream, os, listener, this.bufferSize); } finally { IoUtils.closeSilently(os); if (z) { editor.commit(); } else { editor.abort(); } } } return z; } public boolean save(String imageUri, Bitmap bitmap) throws IOException { boolean z = false; Editor editor = this.cache.edit(getKey(imageUri)); if (editor != null) { OutputStream os = new BufferedOutputStream(editor.newOutputStream(0), this.bufferSize); z = false; try { z = bitmap.compress(this.compressFormat, this.compressQuality, os); if (z) { editor.commit(); } else { editor.abort(); } } finally { IoUtils.closeSilently(os); } } return z; } public boolean remove(String imageUri) { try { return this.cache.remove(getKey(imageUri)); } catch (IOException e) { L.e(e); return false; } } public void close() { try { this.cache.close(); } catch (IOException e) { L.e(e); } this.cache = null; } public void clear() { try { this.cache.delete(); } catch (IOException e) { L.e(e); } try { initCache(this.cache.getDirectory(), this.reserveCacheDir, this.cache.getMaxSize(), this.cache.getMaxFileCount()); } catch (IOException e2) { L.e(e2); } } private String getKey(String imageUri) { return this.fileNameGenerator.generate(imageUri); } public void setBufferSize(int bufferSize) { this.bufferSize = bufferSize; } public void setCompressFormat(CompressFormat compressFormat) { this.compressFormat = compressFormat; } public void setCompressQuality(int compressQuality) { this.compressQuality = compressQuality; } }
f0e22b4e8e9b743f39381f18ee85a9fb6a747000
e2a75f497ea75646a9e602d893f00f06373b7ae8
/src/enums/switch语句中的enum/TrafficLight.java
d196a0b91c07df5ecb799aed38c596d774ea3fcf
[]
no_license
Javaer-liuqianshun/ThinkInJava
51f83b0141358d5e8862695d8f5ea5524dbc17da
28389002147bdef2ef4fa2e0413194d6a4f38d1d
refs/heads/master
2021-09-15T21:21:30.593510
2018-06-11T03:39:36
2018-06-11T03:39:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
848
java
package enums.switch语句中的enum; /** * @ Author: liuqianshun * @ Description: * * 书593案例 * * @ Date: Created in 2018-02-05 * @ Modified: **/ public class TrafficLight { Signal color = Signal.RED; public void change() { switch (color) { case RED: color = Signal.GREEN; break; case GREEN: color = Signal.YELLOW; break; case YELLOW: color = Signal.RED; break; } } @Override public String toString() { return "The traffic light is " + color; } public static void main(String[] args) { TrafficLight t = new TrafficLight(); for (int i = 0; i < 7; i++) { System.out.println(t); t.change(); } } }
dbb747bc1fbcc0e8ef6a61b1e2c752873f16abfd
105f439dc4f85834f2e23725d5d0a5396505891a
/src/main/java/com/redhat/gpte/training/springboot/AMQPConfiguration.java
ddfce6c87b5997f85a280f0897a385839b1a9fb8
[ "Apache-2.0" ]
permissive
darachcawley/sboot-amq-enrich-persist
e2dc8d50f43eee78124db818898d2edfac37edee
c0990d6d89e530dc46aa54c960efce8b3535c189
refs/heads/master
2022-02-07T05:55:53.281809
2019-12-05T17:16:55
2019-12-05T17:16:55
226,141,547
0
0
Apache-2.0
2022-01-21T23:34:52
2019-12-05T16:14:59
Java
UTF-8
Java
false
false
1,275
java
package com.redhat.gpte.training.springboot; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; /** * Configuration parameters filled in from application.properties and overridden using env variables on Openshift. */ @Configuration @ConfigurationProperties(prefix = "amqp") public class AMQPConfiguration { /** * AMQ service host */ private String host; /** * AMQ service port */ private Integer port; /** * AMQ username */ private String username; /** * AMQ password */ private String password; public AMQPConfiguration() { } public String getHost() { return host; } public void setHost(String host) { this.host = host; } public Integer getPort() { return port; } public void setPort(Integer port) { this.port = port; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
8dfd4aa2664f2b419a126f2a86f9d83f9cdb1bc6
722d77df3558db90e12536f12a8dd4ed71466525
/src/skyline/TEST.java
9a923634df9d9da512bd039929e3d8359e863dc3
[ "MIT" ]
permissive
kstrickey/skyline
d11ce4f5a97a0be5cf795ec832302a5e57472449
1b5e1b613f43d0e35b236334e3b8518e1a071149
refs/heads/master
2021-01-10T08:33:44.026677
2016-01-01T04:56:45
2016-01-01T04:56:45
48,869,835
0
0
null
null
null
null
UTF-8
Java
false
false
613
java
package skyline; import java.util.ArrayList; public class TEST { public static void main(String[] args) { // Building searsTower = new Building(10, 5); // // ArrayList<CivilianInBuilding> people = new ArrayList<CivilianInBuilding>(); // // for (int i = 0; i < 150; i++) { // CivilianInBuilding person = new CivilianInBuilding(searsTower); // people.add(person); // } // // // for (int i = 9; i >= 0; i--) { // for (int j = 0; j < 5; j++) { // System.out.print(searsTower.getWindows()[i][j].getNumberOfCivilians() + " - "); // } // System.out.println(); // } // } }
b0fcb8171f8fa1190612524d9996edb139065ddf
36b8ba4952b5cdd365b5fc233dbdaaec74351d4e
/core-java/src/chapter3/src/DigitSequence.java
0f58348d9c70dcf0ed9fceba59875ab098591604
[]
no_license
yoojaeseon1/core-java
494bd1ccd148ac57e21d4468aeeebbe677b7f0ab
771d86fd1c004622e5a52e326b90715b0c0c5ce7
refs/heads/master
2021-07-08T06:34:16.062003
2020-07-11T12:10:22
2020-07-11T12:10:22
150,973,929
0
1
null
null
null
null
UTF-8
Java
false
false
899
java
package chapter3.src; public class DigitSequence implements IntSequence{ private int number; public DigitSequence(int n) { number = n; } public boolean hasNext() { return number != 0; } public int next() { int result = number % 10; number /= 10; return result; } @Override public double average(IntSequence seq, int n) { return 0; } public static IntSequence digitOf(int n) { return new DigitSequence(n); } public int getNum() { return 2; } public static void main(String[] args) { // DigitSequence sequence = new DigitSequence(1234); // // if(sequence instanceof DigitSequence) { // DigitSequence digits = (DigitSequence) sequence; // } IntSequence digits = IntSequence.digitsOf(1729); // System.out.println(digits.next()); System.out.println(IntSequence.getNum()); // System.out.println(DigitSequence.getNum()); } }
38a7f398c62b380e2ee3399012893fad485bb408
5f783378eb66481617346c3ea9aa8df20c683b0a
/src/main/java/com/netsuite/suitetalk/proxy/v2018_1/lists/accounting/RevRecTemplate.java
d5a8704b281fe06d804f965efbe8225ea552bc78
[]
no_license
djXplosivo/suitetalk-axis-proxy
b9bd506bcb43e4254439baf3a46c7ef688c7e57f
0ffba614f117962f9de2867a0677ec8494a2605a
refs/heads/master
2020-03-28T02:49:27.612364
2018-09-06T02:36:05
2018-09-06T02:36:05
147,599,598
0
0
null
null
null
null
UTF-8
Java
false
false
14,151
java
package com.netsuite.suitetalk.proxy.v2018_1.lists.accounting; import com.netsuite.suitetalk.proxy.v2018_1.lists.accounting.types.RevRecScheduleAmortizationType; import com.netsuite.suitetalk.proxy.v2018_1.lists.accounting.types.RevRecScheduleRecogIntervalSrc; import com.netsuite.suitetalk.proxy.v2018_1.lists.accounting.types.RevRecScheduleRecurrenceType; import com.netsuite.suitetalk.proxy.v2018_1.platform.core.NullField; import com.netsuite.suitetalk.proxy.v2018_1.platform.core.Record; import java.io.Serializable; import javax.xml.namespace.QName; import org.apache.axis.description.AttributeDesc; import org.apache.axis.description.ElementDesc; import org.apache.axis.description.TypeDesc; import org.apache.axis.encoding.Deserializer; import org.apache.axis.encoding.Serializer; import org.apache.axis.encoding.ser.BeanDeserializer; import org.apache.axis.encoding.ser.BeanSerializer; public class RevRecTemplate extends Record implements Serializable { private String name; private RevRecScheduleAmortizationType amortizationType; private RevRecScheduleRecurrenceType recurrenceType; private RevRecScheduleRecogIntervalSrc recogIntervalSrc; private Long amortizationPeriod; private Long periodOffset; private Long revRecOffset; private Double initialAmount; private Boolean isInactive; private RevRecTemplateRecurrenceList recurrenceList; private String internalId; private String externalId; private Object __equalsCalc = null; private boolean __hashCodeCalc = false; private static TypeDesc typeDesc = new TypeDesc(RevRecTemplate.class, true); public RevRecTemplate() { super(); } public RevRecTemplate(NullField nullFieldList, String internalId, String externalId, String name, RevRecScheduleAmortizationType amortizationType, RevRecScheduleRecurrenceType recurrenceType, RevRecScheduleRecogIntervalSrc recogIntervalSrc, Long amortizationPeriod, Long periodOffset, Long revRecOffset, Double initialAmount, Boolean isInactive, RevRecTemplateRecurrenceList recurrenceList) { super(nullFieldList); this.internalId = internalId; this.externalId = externalId; this.name = name; this.amortizationType = amortizationType; this.recurrenceType = recurrenceType; this.recogIntervalSrc = recogIntervalSrc; this.amortizationPeriod = amortizationPeriod; this.periodOffset = periodOffset; this.revRecOffset = revRecOffset; this.initialAmount = initialAmount; this.isInactive = isInactive; this.recurrenceList = recurrenceList; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public RevRecScheduleAmortizationType getAmortizationType() { return this.amortizationType; } public void setAmortizationType(RevRecScheduleAmortizationType amortizationType) { this.amortizationType = amortizationType; } public RevRecScheduleRecurrenceType getRecurrenceType() { return this.recurrenceType; } public void setRecurrenceType(RevRecScheduleRecurrenceType recurrenceType) { this.recurrenceType = recurrenceType; } public RevRecScheduleRecogIntervalSrc getRecogIntervalSrc() { return this.recogIntervalSrc; } public void setRecogIntervalSrc(RevRecScheduleRecogIntervalSrc recogIntervalSrc) { this.recogIntervalSrc = recogIntervalSrc; } public Long getAmortizationPeriod() { return this.amortizationPeriod; } public void setAmortizationPeriod(Long amortizationPeriod) { this.amortizationPeriod = amortizationPeriod; } public Long getPeriodOffset() { return this.periodOffset; } public void setPeriodOffset(Long periodOffset) { this.periodOffset = periodOffset; } public Long getRevRecOffset() { return this.revRecOffset; } public void setRevRecOffset(Long revRecOffset) { this.revRecOffset = revRecOffset; } public Double getInitialAmount() { return this.initialAmount; } public void setInitialAmount(Double initialAmount) { this.initialAmount = initialAmount; } public Boolean getIsInactive() { return this.isInactive; } public void setIsInactive(Boolean isInactive) { this.isInactive = isInactive; } public RevRecTemplateRecurrenceList getRecurrenceList() { return this.recurrenceList; } public void setRecurrenceList(RevRecTemplateRecurrenceList recurrenceList) { this.recurrenceList = recurrenceList; } public String getInternalId() { return this.internalId; } public void setInternalId(String internalId) { this.internalId = internalId; } public String getExternalId() { return this.externalId; } public void setExternalId(String externalId) { this.externalId = externalId; } public synchronized boolean equals(Object obj) { if (!(obj instanceof RevRecTemplate)) { return false; } else { RevRecTemplate other = (RevRecTemplate)obj; if (obj == null) { return false; } else if (this == obj) { return true; } else if (this.__equalsCalc != null) { return this.__equalsCalc == obj; } else { this.__equalsCalc = obj; boolean _equals = super.equals(obj) && (this.name == null && other.getName() == null || this.name != null && this.name.equals(other.getName())) && (this.amortizationType == null && other.getAmortizationType() == null || this.amortizationType != null && this.amortizationType.equals(other.getAmortizationType())) && (this.recurrenceType == null && other.getRecurrenceType() == null || this.recurrenceType != null && this.recurrenceType.equals(other.getRecurrenceType())) && (this.recogIntervalSrc == null && other.getRecogIntervalSrc() == null || this.recogIntervalSrc != null && this.recogIntervalSrc.equals(other.getRecogIntervalSrc())) && (this.amortizationPeriod == null && other.getAmortizationPeriod() == null || this.amortizationPeriod != null && this.amortizationPeriod.equals(other.getAmortizationPeriod())) && (this.periodOffset == null && other.getPeriodOffset() == null || this.periodOffset != null && this.periodOffset.equals(other.getPeriodOffset())) && (this.revRecOffset == null && other.getRevRecOffset() == null || this.revRecOffset != null && this.revRecOffset.equals(other.getRevRecOffset())) && (this.initialAmount == null && other.getInitialAmount() == null || this.initialAmount != null && this.initialAmount.equals(other.getInitialAmount())) && (this.isInactive == null && other.getIsInactive() == null || this.isInactive != null && this.isInactive.equals(other.getIsInactive())) && (this.recurrenceList == null && other.getRecurrenceList() == null || this.recurrenceList != null && this.recurrenceList.equals(other.getRecurrenceList())) && (this.internalId == null && other.getInternalId() == null || this.internalId != null && this.internalId.equals(other.getInternalId())) && (this.externalId == null && other.getExternalId() == null || this.externalId != null && this.externalId.equals(other.getExternalId())); this.__equalsCalc = null; return _equals; } } } public synchronized int hashCode() { if (this.__hashCodeCalc) { return 0; } else { this.__hashCodeCalc = true; int _hashCode = super.hashCode(); if (this.getName() != null) { _hashCode += this.getName().hashCode(); } if (this.getAmortizationType() != null) { _hashCode += this.getAmortizationType().hashCode(); } if (this.getRecurrenceType() != null) { _hashCode += this.getRecurrenceType().hashCode(); } if (this.getRecogIntervalSrc() != null) { _hashCode += this.getRecogIntervalSrc().hashCode(); } if (this.getAmortizationPeriod() != null) { _hashCode += this.getAmortizationPeriod().hashCode(); } if (this.getPeriodOffset() != null) { _hashCode += this.getPeriodOffset().hashCode(); } if (this.getRevRecOffset() != null) { _hashCode += this.getRevRecOffset().hashCode(); } if (this.getInitialAmount() != null) { _hashCode += this.getInitialAmount().hashCode(); } if (this.getIsInactive() != null) { _hashCode += this.getIsInactive().hashCode(); } if (this.getRecurrenceList() != null) { _hashCode += this.getRecurrenceList().hashCode(); } if (this.getInternalId() != null) { _hashCode += this.getInternalId().hashCode(); } if (this.getExternalId() != null) { _hashCode += this.getExternalId().hashCode(); } this.__hashCodeCalc = false; return _hashCode; } } public static TypeDesc getTypeDesc() { return typeDesc; } public static Serializer getSerializer(String mechType, Class _javaType, QName _xmlType) { return new BeanSerializer(_javaType, _xmlType, typeDesc); } public static Deserializer getDeserializer(String mechType, Class _javaType, QName _xmlType) { return new BeanDeserializer(_javaType, _xmlType, typeDesc); } static { typeDesc.setXmlType(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "RevRecTemplate")); AttributeDesc attrField = new AttributeDesc(); attrField.setFieldName("internalId"); attrField.setXmlName(new QName("", "internalId")); attrField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string")); typeDesc.addFieldDesc(attrField); attrField = new AttributeDesc(); attrField.setFieldName("externalId"); attrField.setXmlName(new QName("", "externalId")); attrField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string")); typeDesc.addFieldDesc(attrField); ElementDesc elemField = new ElementDesc(); elemField.setFieldName("name"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "name")); elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("amortizationType"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "amortizationType")); elemField.setXmlType(new QName("urn:types.accounting_2018_1.lists.webservices.netsuite.com", "RevRecScheduleAmortizationType")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("recurrenceType"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "recurrenceType")); elemField.setXmlType(new QName("urn:types.accounting_2018_1.lists.webservices.netsuite.com", "RevRecScheduleRecurrenceType")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("recogIntervalSrc"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "recogIntervalSrc")); elemField.setXmlType(new QName("urn:types.accounting_2018_1.lists.webservices.netsuite.com", "RevRecScheduleRecogIntervalSrc")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("amortizationPeriod"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "amortizationPeriod")); elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "long")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("periodOffset"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "periodOffset")); elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "long")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("revRecOffset"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "revRecOffset")); elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "long")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("initialAmount"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "initialAmount")); elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "double")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("isInactive"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "isInactive")); elemField.setXmlType(new QName("http://www.w3.org/2001/XMLSchema", "boolean")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); elemField = new ElementDesc(); elemField.setFieldName("recurrenceList"); elemField.setXmlName(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "recurrenceList")); elemField.setXmlType(new QName("urn:accounting_2018_1.lists.webservices.netsuite.com", "RevRecTemplateRecurrenceList")); elemField.setMinOccurs(0); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } }
6e468f4f316115c856e3a6b96473b214c475388a
f02d9bde0338a8f79c11257af50940e9f6acb3aa
/src/br/com/baldaccini/bkpsgbweb/manipularArquivos/IniciarBackupBancoDados.java
226029b778cf8a5dc1b3ed577430f6e687b468d4
[]
no_license
jhonerossini/DesktopSgbWeb2021
86d887aa0ed608e089f97112b636a55035e80db9
6f845b32f5bb000457ba0fae07a2afcc69f4f5ec
refs/heads/main
2023-05-13T06:54:45.334709
2021-02-07T20:12:11
2021-02-07T20:12:11
336,878,284
0
0
null
null
null
null
UTF-8
Java
false
false
2,190
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package br.com.baldaccini.bkpsgbweb.manipularArquivos; import br.com.baldaccini.bkpsgbweb.log.GravarBackupBancoLog; import br.com.baldaccini.bkpsgbweb.modelo.BackupBancoDados; import br.com.baldaccini.bkpsgbweb.swing.ConfigBkp; /** * * @author JHONE */ public class IniciarBackupBancoDados implements Runnable { private boolean startStop = true; private boolean pause = false; private final BackupBancoDados bkp; private ConsultaBackupBancoDados consultaBackupBancoDados; public IniciarBackupBancoDados(BackupBancoDados backup) { this.bkp = backup; } @Override @SuppressWarnings("SleepWhileInLoop") public void run() { consultaBackupBancoDados = new ConsultaBackupBancoDados(getBkp()); while (isStartStop()) { try { if (isPause()) { synchronized (this) { wait(); } } consultaBackupBancoDados.iniciarBackupArquivo(); synchronized (this) { wait((59 * 1000)); } } catch (InterruptedException ex) { GravarBackupBancoLog.gravarLogError(ex.getMessage(), ConfigBkp.getInstance()); } } GravarBackupBancoLog.gravarLogInformation("Vereficação de backup parada", ConfigBkp.getInstance()); } public boolean isStartStop() { return startStop; } /** * @return the bkp */ public BackupBancoDados getBkp() { return bkp; } /** * @return the pause */ public boolean isPause() { return pause; } /** */ public void pause() { this.pause = true; } public void continuar() { this.pause = false; synchronized (this) { notify(); } } /** */ public void iniciar() { this.startStop = true; } /** */ public void parar() { this.startStop = false; synchronized (this) { notify(); } } }
ab52aa245b19a7cc4bf791e2215448d9805c4992
da9803e6ec270fc049fd4dd468805f8d00505e5a
/src/main/java/ua/pp/leon/taskweb/Main.java
72863e97513ff5e7a25bb2a23ebbc8cdc0d7bbb0
[]
no_license
hnleon/WebTask20160805
d4f956e79ecd0f7956a4a98b363aedfaf1f48967
b079bf64ee564dffd7df4e520376d2cd1b146066
refs/heads/master
2021-01-20T20:48:40.854236
2016-08-12T11:41:12
2016-08-12T11:41:12
65,546,878
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package ua.pp.leon.taskweb; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; /** * * @author Andrii Zalevskyi <[email protected]> */ @SpringBootApplication public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { SpringApplication.run(Main.class, args); } }
d83491f3340c8f1fd3cc6745960e9a590164b658
4c522388ff944f39d1c417a233727af1a636980d
/src/com/diamondsoftware/android/common/CommonMethods.java
e7741c0bd8d6838da80d214ad670de6898d3b84b
[]
no_license
samuelsmichael/MassageNearbyClient
aa4c437605eef77d10020e69b11b16faa6da5db4
29092996f9d46c5855ab9b4b6c55f4d5ff467e50
refs/heads/master
2021-01-01T20:00:50.528509
2014-12-28T23:59:07
2014-12-28T23:59:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,055
java
package com.diamondsoftware.android.common; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.util.Enumeration; import java.util.List; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.util.Log; public class CommonMethods { public static String getLocalIpAddress() { try { for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement(); for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { String hostAddress=inetAddress.getHostAddress().toString(); return hostAddress; } } } } catch (SocketException ex) { Log.e("ServerActivity", ex.toString()); } return null; } public static String getCurrentSsid(Context context) { String ssid = null; ConnectivityManager connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (networkInfo.isConnected()) { final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); final WifiInfo connectionInfo = wifiManager.getConnectionInfo(); if (connectionInfo != null && !(connectionInfo.getSSID().equals(""))) { //if (connectionInfo != null && !StringUtil.isBlank(connectionInfo.getSSID())) { ssid = connectionInfo.getSSID(); } } return ssid; } }
685dd888b62ba81856a05a2c69032fd8a2366b84
52edceb8b951918df6a2bffc0480ea5b6b2bae24
/develop/src/main/java/com/greyu/ysj/mapper/ConfigurationMapper.java
7df2badc7b0aa02caa4c961eb2ddddd6b17d28d3
[]
no_license
github4n/EBuySellServer
3332a965681477f7293a55f52fe93dd61d908ea8
4f641e28d197ea406f942ac2a41b8d8750979d6c
refs/heads/master
2022-01-25T04:19:06.858153
2019-06-14T22:58:33
2019-06-14T22:58:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
139
java
package com.greyu.ysj.mapper; import com.greyu.ysj.entity.Configuration; public interface ConfigurationMapper { Configuration find(); }
fec6b30e60609d87bdc933d527da4b71f5b5ef80
dfc9e7552307290a15ca4b61f9fc402d64860681
/Comecando_com_java/Aula06/src/com/nil/cursojava/aula06/CurtoCircuito.java
53b45fe4025683cb62be5609fab097ca01450dc2
[]
no_license
AguiarVicente/Java-Basico
e3b79a1b84a6373cd7427bdcac67ccf8bfc33181
caa98c141bf100bb16c45b7d75d7f8e5eb7f17c0
refs/heads/main
2023-02-15T14:51:28.368531
2021-01-05T00:16:08
2021-01-05T00:16:08
326,046,018
0
0
null
null
null
null
UTF-8
Java
false
false
491
java
package com.nil.cursojava.aula06; public class CurtoCircuito { public static void main(String[] args) { boolean verdadeiro = true; boolean falso = false; boolean resultado1 = verdadeiro & falso; boolean resultado2 = verdadeiro && falso; boolean resultado3 = falso & verdadeiro; boolean resultado4 = falso && verdadeiro; System.out.println(resultado1); System.out.println(resultado2); System.out.println(resultado3); System.out.println(resultado4); } }
0a17a1bf8c2e0d2f82a902e41ae647f124caf96b
e27942cce249f7d62b7dc8c9b86cd40391c1ddd4
/modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201702/cm/CurrencyCodeErrorReason.java
46c2ac5b6f535a27a51e40f10b40541e952069a4
[ "Apache-2.0" ]
permissive
mo4ss/googleads-java-lib
b4b6178747d25d16ae6aa0c80d80ee18a2dfe01a
efaa9c3bd8a46a3ed4b00963dc9760c6dd8bd641
refs/heads/master
2022-12-05T00:30:56.740813
2022-11-16T10:47:15
2022-11-16T10:47:15
108,132,394
0
0
Apache-2.0
2022-11-16T10:47:16
2017-10-24T13:41:43
Java
UTF-8
Java
false
false
1,437
java
// Copyright 2017 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.api.ads.adwords.jaxws.v201702.cm; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for CurrencyCodeError.Reason. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="CurrencyCodeError.Reason"> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string"> * &lt;enumeration value="UNSUPPORTED_CURRENCY_CODE"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "CurrencyCodeError.Reason") @XmlEnum public enum CurrencyCodeErrorReason { UNSUPPORTED_CURRENCY_CODE; public String value() { return name(); } public static CurrencyCodeErrorReason fromValue(String v) { return valueOf(v); } }
ec765996bbc28f1af2de2ba025b0db9c5f2d8976
d5f098de3be552d1c50060d612a0550365d06c05
/leetcode/560_subarray_sum_equals_k.java
ce5cb086202b222cb010c819b7dc5ef9bfec7fbc
[]
no_license
yuzheng21/codecon
d5d843a09f6a7de354fc399b72d8121e5decd58a
744899abd9907961589f5bba7b93d0cd85edc38d
refs/heads/master
2021-06-03T03:44:33.736129
2020-05-25T08:51:57
2020-05-25T08:51:57
63,125,473
0
0
null
null
null
null
UTF-8
Java
false
false
1,061
java
class Solution { // preSum + hashmap // similar to range query + 2sum public int subarraySum(int[] nums, int k) { int ret = 0; int sum = 0; // sum so far Map<Integer, Integer> map = new HashMap<>(); // key is preSum, value is count map.put(0, 1); for (int i = 0; i < nums.length; i++) { sum += nums[i]; int other = sum - k; if (map.containsKey(other)) { ret += map.get(other); } map.put(sum, map.getOrDefault(sum, 0) + 1); } return ret; } // two for loops public int subarraySum(int[] nums, int k) { int ret = 0; int[] dp = new int[nums.length + 1]; for (int i = 0; i < nums.length; i++) { dp[i + 1] = dp[i] + nums[i]; } for (int i = 0; i < dp.length; i++) { for (int j = i + 1; j < dp.length; j++) { if (dp[j] - dp[i] == k) { ret++; } } } return ret; } }
7ed077a091de3a33c247206ae997364a5b1b6e25
4e2954fb27c0814b5851cb6c22126bec307f85b1
/requs-core/src/main/java/org/requs/facet/decor/Aggregate.java
5ab796a12ddc1fd9d155d0024984ac1303d4ab4f
[ "BSD-2-Clause" ]
permissive
kikec/requs
7954fa8e28e008edb918b4510146930af10c8bf2
39b0cd689ca094aeb9c75e298d56f64e24206d27
refs/heads/master
2021-01-18T02:09:07.247670
2014-05-02T19:10:17
2014-05-02T19:10:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,972
java
/** * Copyright (c) 2009-2014, requs.org * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: 1) Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. 2) Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. 3) Neither the name of the requs.org nor * the names of its contributors may be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.requs.facet.decor; import com.jcabi.aspects.Immutable; import com.jcabi.log.Logger; import java.io.File; import java.io.IOException; import java.util.Collection; import lombok.EqualsAndHashCode; import lombok.ToString; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.CharEncoding; import org.requs.Docs; import org.requs.Facet; /** * Aggregate sources into one file. * * @author Yegor Bugayenko ([email protected]) * @version $Id$ * @since 1.2 */ @Immutable @ToString(of = { }) @EqualsAndHashCode(of = "dir") public final class Aggregate implements Facet { /** * Directory with sources. */ private final transient String dir; /** * Ctor. * @param path Path to the directory with sources */ public Aggregate(final File path) { this.dir = path.getAbsolutePath(); } @Override public void touch(final Docs docs) throws IOException { final StringBuilder text = new StringBuilder(0); final Collection<File> files = FileUtils.listFiles( new File(this.dir), new String[]{"req"}, true ); for (final File file : files) { Logger.info(this, "source file: %s", file); text.append( FileUtils.readFileToString(file, CharEncoding.UTF_8) ).append('\n'); } docs.get("input.req").write(text.toString()); } }
839320399cd2f41e618ae69fbdba06f1098cb67d
d969c310acdb1dc2fc78175f6a070737f2b2d7d0
/mvc-web-app/src/main/java/graded/unit/lostmypetwebapp/service/MessageService.java
92ad26b8ecd382d22a8427f399917347536a2980
[]
no_license
Pio-Trek/Lost-My-Pet
2a95db71766b904fd6fc1eb8dadfa67c0df0a192
fcf57b8030f59062553da0fbfae6d508cf63f6a3
refs/heads/master
2020-03-19T18:37:25.031823
2019-02-07T18:54:12
2019-02-07T18:54:12
136,817,407
1
0
null
null
null
null
UTF-8
Java
false
false
3,574
java
package graded.unit.lostmypetwebapp.service; import graded.unit.lostmypetwebapp.dao.MessageConversationDao; import graded.unit.lostmypetwebapp.model.messages.Conversation; import graded.unit.lostmypetwebapp.model.messages.Message; import graded.unit.lostmypetwebapp.model.users.User; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import java.util.List; /** * Service layer which manages the data of the {@link Message} domain object * * @author Piotr Przechodzki * @since 21/05/2018 */ @Service public class MessageService { private final MessageConversationDao messageConversationDao; public MessageService(MessageConversationDao messageConversationDao) { this.messageConversationDao = messageConversationDao; } /** * Fetch a single message by id. * * @param messageId This is an id number of the {@link Message} object to be fetched. * @return {@link Message} object. */ public Message getMessageById(String messageId) { return messageConversationDao.fetchMessageById(messageId).getBody(); } /** * Fetch a list of messages by sender id. * * @param senderId This is an sender id number of the {@link User} object. * @return List of {@link Message} objects. */ public List<Message> getAllMessagesBySenderId(String senderId) { return messageConversationDao.fetchAllMessagesBySenderId(senderId).getBody(); } /** * Fetch a list of messages by recipient id. * * @param recipientId This is an recipient id number of the {@link User} object. * @return List of {@link Message} objects. */ public List<Message> getAllMessagesByRecipientId(String recipientId) { return messageConversationDao.fetchAllMessagesByRecipientId(recipientId).getBody(); } /** * Fetch a list of conversations that relate to a selected message by message id. * * @param messageId This is an id number of the {@link Message} object by which conversations will be fetched. * @return List of {@link Conversation} objects. */ public List<Conversation> getConversationsByMessageId(String messageId) { return messageConversationDao.fetchConversationsByMessageId(messageId).getBody(); } /** * Count all conversations that relate to a selected message by message id. * * @param messageId This is an id number of the {@link Message} object by which conversations will be counted. * @return Number of selected message conversations. */ public int numberOfConversationsByMessageId(String messageId) { return messageConversationDao.countConversationsByMessageId(messageId); } /** * Insert a new message. * * @param message This is the new object of the {@link Message} to be saved. * @return {@link Message} object */ public ResponseEntity<Message> saveMessage(Message message) { return messageConversationDao.insertMessage(message); } /** * Insert a new conversation. * * @param conversation This is the new object of the {@link Conversation} to be saved. */ public void saveConversation(Conversation conversation) { this.messageConversationDao.insertConversation(conversation); } /** * Delete message by id. * * @param id This is an id number of the {@link Message} object to be deleted. */ public void deleteMessage(String id) { this.messageConversationDao.removeMessage(id); } }
682eecf621295017738ce29402497981fc7e3129
8a79a1d2448685af76700a9f911f837db5adb2a0
/fundamental/fundamental-datasource/src/main/java/platform/fundamental/datasource/DbcpFactoryBean.java
b17c7fd8877e75cf4a3700a5b4bf8897bdff55f2
[]
no_license
WelkinLee/platform
b10cdb2f9a6c779ea929d727b57e5d8e5dbe6fe9
247ed5e397acf6bfd17eacf5e22850c36574ce40
refs/heads/master
2021-01-01T06:37:00.974751
2017-07-17T11:47:53
2017-07-17T11:47:53
93,838,592
0
0
null
null
null
null
UTF-8
Java
false
false
3,675
java
package platform.fundamental.datasource; import org.whut.platform.fundamental.config.FundamentalConfigProvider; import org.whut.platform.fundamental.logger.PlatformLogger; import org.apache.commons.dbcp.BasicDataSource; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; import java.lang.reflect.Method; import java.util.Locale; import java.util.Map; import java.util.Properties; public class DbcpFactoryBean implements FactoryBean<BasicDataSource>, DisposableBean, InitializingBean { private static final PlatformLogger LOGGER = PlatformLogger.getLogger(DbcpFactoryBean.class); private BasicDataSource ds; private Properties properties; private String dbname; public void afterPropertiesSet() throws Exception { setProperties(FundamentalConfigProvider.getProp()); } public BasicDataSource getObject() { ds = new BasicDataSource(); this.tryToSetProperties(); return ds; } public void destroy() { if (ds == null) { return; } try { ds.close(); ds = null; } catch (Exception ex) { LOGGER.warn("close dbcp error", ex); } } public Class<?> getObjectType() { return BasicDataSource.class; } public boolean isSingleton() { return true; } public void setProperties(Properties properties) { this.properties = properties; } public void setDbname(String dbname) { this.dbname = dbname; } protected void tryToSetProperties() { String configPrefix = "dbcp."; if (dbname != null && dbname.trim().length() > 0) { configPrefix = configPrefix + dbname + "."; } if (properties == null) { throw new IllegalArgumentException( "there is no dbcp properties setting."); } for (Map.Entry<Object, Object> entry : properties.entrySet()) { String key = (String) entry.getKey(); String value = (String) entry.getValue(); if (!key.startsWith(configPrefix)) { continue; } String propertyName = key.substring(configPrefix.length()); try { tryToSetProperty(propertyName, value); } catch (Exception ex) { LOGGER.info("error to set property : key : " + key + ", value : " + value, ex); } } } protected void tryToSetProperty(String propertyName, String propertyValue) throws Exception { String setterName = "set" + propertyName.substring(0, 1).toUpperCase(Locale.CHINA) + propertyName.substring(1); Method[] methods = BasicDataSource.class.getMethods(); for (Method method : methods) { if (!method.getName().equals(setterName)) { continue; } Class<?>[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length == 1) { LOGGER.debug("match method : {}, {}", new Object[] { method, propertyValue }); Class<?> parameterType = parameterTypes[0]; this.invokeSetValue(method, parameterType, propertyValue); } } } private void invokeSetValue(Method method, Class<?> parameterType, String propertyValue) throws Exception { LOGGER.info("name :"+method.getName()+" value :"+propertyValue); if (parameterType == String.class) { method.invoke(ds, propertyValue); } else if (parameterType == Integer.class || parameterType == int.class) { method.invoke(ds, Integer.parseInt(propertyValue)); } else if (parameterType == Long.class || parameterType == long.class) { method.invoke(ds, Long.parseLong(propertyValue)); } else if (parameterType == Boolean.class || parameterType == boolean.class) { method.invoke(ds, Boolean.valueOf(propertyValue)); } else { LOGGER.info("cannot process parameterType : [" + parameterType + "]"); } } }
ec8476a767817e6fb3d48c40794624826f1224b3
0e26280875c7d8e9fca0fb9bd46fbbd0f4224da1
/Product/src/main/java/com/first/Product/ProductApplication.java
f34331abdf85b1c222e7b15d74f5b55908765a1f
[]
no_license
patilabhieet59/microservices
b73c8533b112d9ec33aaf5033af251e43eb510d2
de29b236e8f308b58fa9e96283f197be5dd9e0c1
refs/heads/master
2020-07-02T21:02:40.978079
2019-08-18T05:39:07
2019-08-18T05:39:07
201,665,008
0
0
null
null
null
null
UTF-8
Java
false
false
312
java
package com.first.Product; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ProductApplication { public static void main(String[] args) { SpringApplication.run(ProductApplication.class, args); } }
2a0dc9cda0659c35340a4c97bd5e91f1494b9710
52fee8533d560b9296cedd38c3d175523a5a5593
/06.String Processing - Exercise/src/p09MatchFullName.java
e11cc98335aa5b8c147e745c50ddd6526f65ad37
[]
no_license
rayailieva/JavaAdvanced
7c3addeb6f5202d9c7bcd070c0e7eae146f96ecf
2fe381da16c53420be96178ccf54e85856282b24
refs/heads/master
2020-03-14T06:52:52.480367
2018-06-10T10:51:12
2018-06-10T10:51:12
131,492,444
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
import java.util.Scanner; import java.util.regex.Pattern; public class p09MatchFullName { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String line = scanner.nextLine(); String regex = ("^[A-Z][a-z]{2,}[ ]{1}[A-Z][a-z]{2,}$"); while(!line.equals("end")){ if(Pattern.matches(regex, line)){ System.out.println(line); } line = scanner.nextLine(); } } }
a6a8dab52e45d826abd9f1e130de07269a17638a
21354d0781a36199b4137dc6b5afe87687bdadf2
/Restaurant/app/src/test/java/com/myproject/restaurant/ExampleUnitTest.java
b16125ffff7f0e240a5f0e79646d7a6a334f9cc9
[]
no_license
jwang71/Small-Projects
92d7c52cfc2082c68b2d184bae3f83c39a57052e
e4d296b137815bdef3901be26497148bb7b74c5e
refs/heads/master
2021-09-09T13:53:14.909244
2018-03-16T18:34:49
2018-03-16T18:34:49
125,554,927
0
0
null
null
null
null
UTF-8
Java
false
false
402
java
package com.myproject.restaurant; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
2a90cff2a2f3dab8e79f0c621b064a778b5d76cd
81e8618c37e3fbffc5aff9edc8263e8a198e085f
/src/core/modelDAO/DAO_HoaDonDatPhong.java
0c6f4730dd26dac4e186275c976ed389fda96d26
[]
no_license
zico109/Project
d363ff79b38b265e3c84941b120298b29788fdb9
6b1f1dea40aaff2120d5e37df43a9cac89d9afe9
refs/heads/master
2020-04-13T07:20:53.282983
2019-02-20T06:34:12
2019-02-20T06:34:12
163,048,904
0
0
null
null
null
null
UTF-8
Java
false
false
222
java
package core.modelDAO; import core.dao.ObjectDAO; import core.model.HoaDonDatPhong; public class DAO_HoaDonDatPhong extends ObjectDAO<HoaDonDatPhong> { public DAO_HoaDonDatPhong(){ this.table = "HoaDonDatPhong"; } }
861374386f1dadec85c38e409e23587f8622657d
8075b286e017bca065996260722f1e27e1cf6a29
/java/src/main/java/com/overload/util/benchmarking/BenchmarkTask.java
511500f91ae0d214174b169fbb00c3c49c8ddeec
[ "MIT" ]
permissive
eduardorabelo/game_machine
68ff6b0bb595623dd229784549449abaf34a7e69
ebdabc2ded724284bf5a139c4753216c2285723d
refs/heads/master
2021-01-18T18:35:30.277537
2013-09-05T08:57:05
2013-09-05T08:57:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
580
java
package com.overload.util.benchmarking; /** * @author Odell */ public interface BenchmarkTask { /** * Returns how many calls to the function are to be made to benchmark this task. * @return how many calls to the function are to be made to benchmark this task. */ public int getIterationCount(); /** * Prepares this task to be executed.<br> * This function is not included in the benchmarking. */ public void prepare(); /** * Executes this task.<br> * This function should be included in the benchmarking. */ public void execute(); }
6708eb1b04c5088fd0f05fb16c8619f660890e23
75bfefe1118631115f6887ef15d86312d45b9478
/src/main/java/com/example/microservices/currencyconversionservice/CurrencyConversionBean.java
2a8e8e6e55489ab7fd16c2ab38db4bedf309d180
[]
no_license
Joselon1999/currency-conversion-service
ddd86b766ef147465770b5afca1baf6bbf848859
2c6f90a755173f26b43c75a56bbecc9219420d49
refs/heads/master
2020-04-01T03:13:29.240150
2018-10-15T04:00:20
2018-10-15T04:00:20
152,814,364
0
0
null
null
null
null
UTF-8
Java
false
false
1,915
java
package com.example.microservices.currencyconversionservice; import java.math.BigDecimal; public class CurrencyConversionBean { private Long id; private String from; private String to; private BigDecimal conversionMultiple; private BigDecimal quantity; private BigDecimal totalCalculatedAmount; private int port; public CurrencyConversionBean(){ } public CurrencyConversionBean(Long id, String from, String to, BigDecimal conversionMultiple, BigDecimal quantity, BigDecimal totalCalculatedAmount, int port) { this.id = id; this.from = from; this.to = to; this.conversionMultiple = conversionMultiple; this.quantity = quantity; this.totalCalculatedAmount = totalCalculatedAmount; this.port = port; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } public String getTo() { return to; } public void setTo(String to) { this.to = to; } public BigDecimal getConversionMultiple() { return conversionMultiple; } public void setConversionMultiple(BigDecimal conversionMultiple) { this.conversionMultiple = conversionMultiple; } public BigDecimal getQuantity() { return quantity; } public void setQuantity(BigDecimal quantity) { this.quantity = quantity; } public BigDecimal getTotalCalculatedAmount() { return totalCalculatedAmount; } public void setTotalCalculatedAmount(BigDecimal totalCalculatedAmount) { this.totalCalculatedAmount = totalCalculatedAmount; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } }
9edc16951249f5c7fb70a0935a91d7dde6d78644
9890270021cb87ccdedc332de2d1589c9d573b08
/netflix/netflix/memreader/SubSamplingAndSetDivision.java
7d2575cccb87f7eaf989f01f11be2d61f916effc
[]
no_license
musi/GitHubRecommender
fb34c4da9c0f380cd7ba0779bcdc845a12440f7b
8446b99269f312a63eb2c7855a034885a938547d
refs/heads/master
2021-01-19T10:59:28.195568
2013-09-06T11:23:33
2013-09-06T11:23:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
26,400
java
package netflix.memreader; //delete this and may u have to write efficient code for 80% train and 20% test set import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.util.Random; import java.util.Scanner; import cern.colt.list.IntArrayList; import cern.colt.list.LongArrayList; public class SubSamplingAndSetDivision { //Max users to be considered final int MAX_USERS = 20000; //Max movies to be considered final int MAX_MOVIES = 20000; private MemReader mr; private int crossValidation; private String outFileIdTr; //train private String outFileIdT; //test private String outFileTr; private String outFileT; //write buffers private String outFileTAndTr; private String trainSetFileName; //train and test set files to be written private String testSetFileName; private String trainAndTestSetFileName; //both Train and test set to be written private String myPath; private Random rand; MemHelper mainMh; int moviesSizeToBeConsidered; int userSizeToBeConsidered; int dataSetFlg; /*************************************************************************************************/ /** * @author Musi * @param String, MainMemHelper file to be divided * @param String, Training buffer * @param String, Test buffer * @param String, TrainAndTest buffer * @param String, TrainingSetFile Name * @param String, TestSetFile Name * @param String, TrainAndTestSetFile Name * @param int, movieSize to Be considered * @param int, userSize to Be considered * @param int, 0=sml, 1=ml, 2=ft * */ public SubSamplingAndSetDivision (String myMh, String outFileTr, String outFileT, String outFileTAndTr, String trainSetFileName, String testSetFileName, String trainAndTestSetFileName, int moviesSizeToBeConsidered, int userSizeToBeConsidered, int dataSetFlg) { this.outFileTr = outFileTr; this.outFileT = outFileT; this.outFileTAndTr = outFileTAndTr; this.trainSetFileName = trainSetFileName; this.testSetFileName = testSetFileName; this.trainAndTestSetFileName = trainAndTestSetFileName; this.moviesSizeToBeConsidered = moviesSizeToBeConsidered; this.userSizeToBeConsidered = userSizeToBeConsidered; this.dataSetFlg = dataSetFlg; //0=sml, 1=ml, 2=ft mainMh = new MemHelper(myMh); rand = new Random(); } /************************************************************************************************/ public SubSamplingAndSetDivision(int n) { crossValidation=n; } /************************************************************************************************/ //read a file, write 10% in one file and the remaining 90% in another with same names (e.g. test and train set) // repeat it for many times public void readData(double div, boolean clustering) { byte n=8; //e.g. for 90% train and 10% test int uid; LongArrayList movies; IntArrayList allUsers; BufferedWriter outT; BufferedWriter outTr; //Buffers for writing outut files BufferedWriter outTAndTr; int ts=0; int trs=0; int all=0; //------------------------------------------------------------------------------ //Do Filtering here: Filter all movies, rated by less than a specified threshold //------------------------------------------------------------------------------ //-------------------------- // Movie Filtering //-------------------------- IntArrayList doNotIncludeTheseMovies = new IntArrayList(); //movies have less than prespecified threshold IntArrayList allMovies = mainMh.getListOfMovies(); int noOfItems = allMovies.size(); int movieSize = 0; LongArrayList usersWhoSawCurrentMovie = null; // for all items for(int j=1; j<noOfItems;j++) { int mid = (j); usersWhoSawCurrentMovie = mainMh.getUsersWhoSawMovie(mid); movieSize = usersWhoSawCurrentMovie.size(); if(movieSize<moviesSizeToBeConsidered) { doNotIncludeTheseMovies.add(mid); } } System.out.println("Movers are :" + allMovies.size()); System.out.println("Movies less than "+ moviesSizeToBeConsidered + "size ="+ doNotIncludeTheseMovies.size()); //--------------------------------------------------------------------------------------------------------------------------------- // Here we will do the subsampling. E.g. If there are 480,000 users in the netflix we will randomly select 20,000 at max // After these users have been selected, we go and write this object first.....object writing // (1) main object (will become the main memHelper), (2) test obejct (will become the testmemhelper), and (3) train object (will // become the train MemHelper) //-------------------------- // User Filtering //-------------------------- IntArrayList doNotIncludeTheseUsers = new IntArrayList(); //users have less than prespecified threshold IntArrayList doIncludeTheseUsers = new IntArrayList(); //users sub smapled from the whole dataset IntArrayList myUsers = mainMh.getListOfUsers(); //all users in the file int noOfUsers = allMovies.size(); int userSize = 0; LongArrayList moviesSeenByCurrentUser; /* for (int i = 0; i < myUsers.size(); i++) //go through all the users { uid = myUsers.getQuick(i); moviesSeenByCurrentUser = mainMh.getMoviesSeenByUser(uid); //get movies seen by this user userSize = moviesSeenByCurrentUser.size(); if (userSize<userSizeToBeConsidered) { doNotIncludeTheseUsers.add(uid); } }// end of for */ int totalUsersProcessed = 0; int dummy = 0; IntArrayList sampleAlreadyThere = new IntArrayList(); while (totalUsersProcessed <MAX_USERS) { //generate a random number try {dummy = (int) rand.nextInt(noOfUsers - 1); //select some random movies to delete (take their indexes) } catch (Exception no){ System.out.println(" error in random numbers"); } //If we have not processed this sample before if(sampleAlreadyThere.contains(dummy)==false) { sampleAlreadyThere.add(dummy); // add it uid = myUsers.getQuick(dummy); // get uid doIncludeTheseUsers.add(uid); // set of users, who will be there in the train/test set totalUsersProcessed++; } }//end while System.out.println("Users are :" + myUsers.size()); System.out.println("Users less than "+ userSizeToBeConsidered + "size ="+ doNotIncludeTheseUsers.size()); System.out.println("Users qualified for the trin/test are "+ doIncludeTheseUsers.size()); //------------------------------------------------------------------------------ // Divide into Test and Train set //------------------------------------------------------------------------------ allUsers = mainMh.getListOfUsers(); //all users in the file try { outT = new BufferedWriter(new FileWriter(outFileT)); // we wanna write in o/p file outTr = new BufferedWriter(new FileWriter(outFileTr)); // we wanna write in o/p file outTAndTr = new BufferedWriter(new FileWriter(outFileTAndTr)); // we wanna write in o/p file //_________________________________________________________________________________ int allSamples = 0; userSize = doIncludeTheseUsers.size(); for (int i = 0; i < userSize; i++) //go through all the users (qualified to be there in the final set, after sub sampling) { uid = allUsers.getQuick(i); movies = mainMh.getMoviesSeenByUser(uid); //get movies seen by this user int mySize = movies.size(); all = all+ mySize; int trainSize = (int) ((div) * mySize); //80%-20% if (trainSize==0) trainSize = 1; int testSize = mySize - trainSize; int totalProcessed = 0; int del = 0; int mid = 0; long tMid = 0; double rating = 0; if(!doNotIncludeTheseUsers.contains(uid)) { IntArrayList movieAlreadyThere = new IntArrayList(); while (totalProcessed <mySize) { if (totalProcessed <testSize && testSize >0) { //generate a random number try {del = (int) rand.nextInt(mySize-1); //select some random movies to delete (take their indexes) } catch (Exception no){ System.out.println(" error in random numbers"); } tMid = movies.getQuick(del); mid = MemHelper.parseUserOrMovie(tMid); if (!(movieAlreadyThere.contains(mid))) //if movie has not already been processed { movieAlreadyThere.add(mid); // Do movie Size Thresholding if(!doNotIncludeTheseMovies.contains(mid)) { rating = mainMh.getRating(uid, mid); String oneSample = (uid + "," + mid + "," + rating) ; //very important, we write in term of uid, mid, rating outT.write(oneSample); outT.newLine(); outTAndTr.write(oneSample); outTAndTr.newLine(); ts++; } allSamples++; totalProcessed++; //System.out.println("ts"+ (ts) + " with size= "+ mySize + " processed = "+ totalProcessed ); } // finished writing test } //end of if else { for (int k=0;k<mySize;k++) { mid = MemHelper.parseUserOrMovie(movies.getQuick(k)); if (!(movieAlreadyThere.contains(mid))) { // Do movie Size Thresholding if(!doNotIncludeTheseMovies.contains(mid)) { rating = mainMh.getRating(uid, mid); String oneSample = (uid + "," + mid + "," + rating) ; //very important, we write in term of mid, uid, rating outTr.write(oneSample); outTr.newLine(); outTAndTr.write(oneSample); outTAndTr.newLine(); trs++; } allSamples++; totalProcessed++; //System.out.println("trs "+ (trs)); } } } //end of train set }//end of while }//end of user Thresholing if(i%200 ==0 && i>=0) System.out.println("processing user " +i); } //end of all users System.out.println("Test = " + ts + " Train= " +trs + " all= "+all + " sum = " + (ts+trs) + " all="+allSamples); outT.close(); outTr.close(); outTAndTr.close(); }// end of try catch (IOException e) { System.out.println("Write error! Java error: " + e); System.exit(1); } //end of try-catch } /************************************************************************************************/ /************************************************************************************************/ public String getTestingData(int n) { return (outFileIdT + n + ".dat"); } public String getTrainingData(int n) { return (outFileIdTr + n + ".dat"); } public String getPath(int n) { return (myPath); } /************************************************************************************************/ public static void main(String arg[]) { int dataSetChoice = 0; //0=sml, 1=ml, 2=ft, 3= Ml(10M), 4=NF int trainingOrAllDivision = 0; // 0 =all, 1=training //This movie should be included by that much no. of users for consideration, and same for users int moviesSizeToBeConsidered = 0; //(e.g. 2 means>=1) int usersSizeToBeConsidered = 0; //declare var String t="", tr="", tAndTr="", p="", pm="", m=""; String trainSetName ="", testSetName="", trainAndTestSetName=""; System.out.println(" Going to divide data into test and train data"); if(dataSetChoice ==0) { /* t = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\Clustering\\sml_TestSet.dat"; tr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\Clustering\\sml_TrainSet.dat"; tAndTr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\Clustering\\sml_MainSet.dat"; p = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\Clustering\\"; pm = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\Clustering\\"; */ /* t = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\NB\\sml_TestSet.dat"; tr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\NB\\sml_TrainSet.dat"; tAndTr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\NB\\sml_MainSet.dat"; p = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\NB\\"; pm = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\NB\\"; */ t = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FiveFoldData/sml_TestSet.dat"; tr = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FiveFoldData/sml_TrainSet.dat"; tAndTr = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FiveFoldData/sml_MainSet.dat"; p = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FiveFoldData/"; pm = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FiveFoldData/"; m = pm + "sml_storedFeaturesRatingsTF.dat"; /* //To filter the movies trainSetName = p + "sml_clusteringTrainSetStoredTF" +(moviesSizeToBeConsidered-1)+".dat"; testSetName = p + "sml_clusteringTestSetStoredTF" +(moviesSizeToBeConsidered-1)+".dat"; trainAndTestSetName = p + "sml_modifiedStoredFeaturesRatingsTF" +(moviesSizeToBeConsidered-1)+".dat"; */ //do not need to filter movies trainSetName = p + "sml_clusteringTrainSetStoredTF.dat"; testSetName = p + "sml_clusteringTestSetStoredTF.dat"; trainAndTestSetName = p + "sml_modifiedStoredFeaturesRatingsTF.dat"; //--------------------------------- /*//Feature Play for SVD data division t = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FeaturesPlay/sml_testSet.dat"; tr = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FeaturesPlay/sml_trainSet.dat"; tAndTr = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FeaturesPlay/sml_mainSet.dat"; p = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FeaturesPlay/"; pm = "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FeaturesPlay/"; m = pm + "C:/Users/Musi/workspace/MusiRecommender/DataSets/SML_ML/SVD/FeaturesPlay/sml_clusteringTrainSetStoredTF.dat/"; m = pm + "sml_storedFeaturesRatingsTF.dat"; //do not need to filter movies trainSetName = p + "sml_train_trainSetStoredFold1.dat"; testSetName = p + "sml_train_testSetStoredFold1.dat"; trainAndTestSetName = p + "sml_train_modifiedSetStoredFold1.dat";*/ //---------------------------------------- // Need to have X% data, with x=variable (x=training set size) } else if(dataSetChoice ==1) { t = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\ml_TestSet.dat"; tr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\ml_TrainSet.dat"; tAndTr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\ml_MainSet.dat"; p = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\"; pm = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\"; //To filter the movies /* trainSetName = p + "ml_clusteringTrainSetStoredTF" +(moviesSizeToBeConsidered-1)+".dat"; testSetName = p + "ml_clusteringTestSetStoredTF" +(moviesSizeToBeConsidered-1)+".dat"; trainAndTestSetName = p + "ml_modifiedStoredFeaturesRatingsTF" +(moviesSizeToBeConsidered-1)+".dat"; */ if(trainingOrAllDivision==0) { m = pm + "ml_storedFeaturesRatingsTF.dat"; //To filter the movies /*trainSetName = p + "ml_clusteringTrainSetStoredTF" +(moviesSizeToBeConsidered-1)+".dat"; testSetName = p + "ml_clusteringTestSetStoredTF" +(moviesSizeToBeConsidered-1)+".dat"; trainAndTestSetName = p + "ml_modifiedStoredFeaturesRatingsTF" +(moviesSizeToBeConsidered-1)+".dat"; */ //do not need to filter movies trainSetName = p + "ml_clusteringTrainSetStoredTF.dat"; testSetName = p + "ml_clusteringTestSetStoredTF.dat"; trainAndTestSetName = p + "ml_modifiedStoredFeaturesRatingsTF.dat"; } else { m = p + "ml_clusteringTrainSetStoredTF.dat"; //For dividing training set into validation and test set //do not need to filter mvoies trainSetName = p + "ml_clusteringTrainingTrainSetStoredTF.dat"; testSetName = p + "ml_clusteringTrainingValidationSetStoredTF.dat"; trainAndTestSetName = p + "ml_modifiedTrainingStoredFeaturesRatingsTF.dat"; } } else if(dataSetChoice ==2) { t = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\FT\\Clustering\\ft_TestSet.dat"; tr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\FT\\Clustering\\ft_TrainSet.dat"; tAndTr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\FT\\Clustering\\ft_MainSet.dat"; p = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\FT\\Clustering\\"; pm = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\FT\\Clustering\\"; m = pm + "ft_storedFeaturesRatingsTF.dat"; //m = pm + "ft_storedFeaturesRatingsTF10.dat"; /*//To filter the movies trainSetName = p + "ft_clusteringTrainSetStoredTF" +(moviesSizeToBeConsidered-1)+".dat"; testSetName = p + "ft_clusteringTestSetStoredTF" +(moviesSizeToBeConsidered-1)+".dat"; trainAndTestSetName = p + "ft_modifiedStoredFeaturesRatingsTF" +(moviesSizeToBeConsidered-1)+".dat"; */ //SVDs int xFactor = 20; String path ="C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\FT\\SVD\\" + xFactor +"\\" ; t = path + "ft_TestSet.dat"; tr = path + "ft_TrainSet.dat"; tAndTr = path + "ft_MainSet.dat"; p = path ; pm = path; m = pm + "ft_storedFeaturesRatingsBothTF5.dat"; //m = pm + "ft_storedFeaturesRatingsTF10.dat"; //do not need to filter mvoies trainSetName = p + "ft_clusteringTrainSetStoredTF5.dat"; testSetName = p + "ft_clusteringTestSetStoredTF5.dat"; trainAndTestSetName = p + "ft_modifiedStoredFeaturesRatingsTF5.dat"; } //ML (10M) else if(dataSetChoice ==3) { t = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\ml10_TestSet.dat"; tr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\ml10_TrainSet.dat"; tAndTr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\ml10_MainSet.dat"; p = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\"; pm = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\"; } //ML10 else if(dataSetChoice ==4) { t = "C:/Users/Musi/Desktop/movie_ml_5/movie_ml/ml_data_10M/ml10_TestSet.dat"; tr = "C:/Users/Musi/Desktop/movie_ml_5/movie_ml/ml_data_10M/ml10_TrainSet.dat"; tAndTr = "C:/Users/Musi/Desktop/movie_ml_5/movie_ml/ml_data_10M/ml10_MainSet.dat"; p = "C:/Users/Musi/Desktop/movie_ml_5/movie_ml/ml_data_10M"; pm = "C:/Users/Musi/Desktop/movie_ml_5/movie_ml/ml_data_10M"; m = pm + "ml10_storedFeaturesRatingsTF.dat"; //do not need to filter movies trainSetName = p + "ml_clusteringTrainSetStoredTF.dat"; testSetName = p + "ml_clusteringTestSetStoredTF.dat"; trainAndTestSetName = p + "ml_modifiedStoredFeaturesRatingsTF.dat"; } //NF else if(dataSetChoice ==5) { t = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\nf_TestSet.dat"; tr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\nf_TrainSet.dat"; tAndTr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\nf_MainSet.dat"; p = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\"; pm = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\ML_ML\\SVD\\"; } //call constructor and methods for dividing SubSamplingAndSetDivision dis = new SubSamplingAndSetDivision(m, //main memHelper file tr, //Train write Buffer t, //Test write Buffer tAndTr, //Modified Main write Buffer trainSetName, //TrainSet name to be written testSetName, //TestSet name to be written trainAndTestSetName, //Train and TestSet name to be written moviesSizeToBeConsidered, //Min Movies size usersSizeToBeConsidered, //Min User Size dataSetChoice); //0=sml,1=ml,2=ft //read the data and divide dis.readData(0.8, false); MemReader myReader = new MemReader(); //write into memReader objs myReader.writeIntoDisk(t, testSetName, false); myReader.writeIntoDisk(tr, trainSetName, false); myReader.writeIntoDisk(tAndTr, trainAndTestSetName, false); // Analyze file for statistics AnalyzeAFile testAnalyzer = new AnalyzeAFile (); // testAnalyzer.analyzeContent(testName, moviesSizeToBeConsidered, 20); /* testAnalyzer.analyzeContent(modifiedName, moviesSizeToBeConsidered, usersSizeToBeConsidered); testAnalyzer.analyzeContent(testName, 0, 0); testAnalyzer.analyzeContent(trainName, 0 , 0); */ /* //to check sensitivity parameter for 80-20 main test train dividion and for 80 validation and test (x =0.1 to 0.6), then cross validation on each for (int i=0; i<6;i++) { // sml String t = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\TestTrain\\sml_"+ ((i+1)*10)+ "testSet.dat"; String tr = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\TestTrain\\sml_" + ((10- (i+1))*10)+ "trainSet.dat"; String p = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\TestTrain\\Trainer\\Actual20\\"; String pm = "C:\\Users\\Musi\\workspace\\MusiRecommender\\DataSets\\SML_ML\\TestTrain\\"; String m = p + "sml_80trainSetStored.dat"; FTDivideIntoSets dis= new FTDivideIntoSets(m, tr, t); //dis.readData(0.8); dis.readData((10-(i+1))/10); System.out.println(" Done " +i); MemReader myReader = new MemReader(); myReader.writeIntoDisk(t, p + "Case" + ((i+1)*10)+ "sml_" + ((i+1)*10)+ "testSetStored.dat"); //write test set into memory myReader.writeIntoDisk(tr, p + "Case" + ((i+1)*10)+"sml_" + + ((10-(i+1))*10)+ "trainSetStored.dat"); } */ System.out.println(" Done "); } /************************************************************************************************/ /*************************************************************************************************/ //Imprtant: How to call this method from other class //1- Call the constrcutor with all parameters //2- then call this method /** * Divide into test and train objects: we can do include only movies or users which have rated * a specified no. of movies * @param mainFile , main memHelper file String * @param trainFile , train memHelper file String * @param testFile , test memHelper file String * @param trainAndTestFile , testAndTrain memHelper file String (modified writing) * @param minMoviesSize, A movie should be rated by that much guys for including into the writing * @param minUsersSize, A user should have rated more than this thrshold * @param divisionFactor, e.g. 20-80 (test set factor) */ public void divideIntoTestTrain (double divisionFactor, boolean clust ) { System.out.println(" Going to divide data into test and train data"); //Call read data and divide into sets method //note parameters have been set through the constrcutor readData(divisionFactor, clust); //MemReader object MemReader myReader = new MemReader(); //write into memReader objs myReader.writeIntoDisk(outFileT, testSetFileName, true); myReader.writeIntoDisk(outFileTr, trainSetFileName, true); //myReader.writeIntoDisk(outFileTAndTr, trainAndTestSetFileName); //there is no need of it here System.out.println(" Done "); } /*************************************************************************************************/ /*************************************************************************************************/ }
5332253248a4c340b6f28f88195e1a801586a26d
7b9cde4d4d1dbadbe4cd9eb2b1ab87b33e8f9b67
/minebuilders/clearlag/commands/CheckCmd.java
59e2f13c20fbfef81e59c40f5ff00d04e972b6fb
[]
no_license
fxusers/LaggClear
4ff5ccd0fcf45efb41550c6c3e2cffa328987fad
2d207411455001113e6639bc7da2b9c2dca50839
refs/heads/master
2020-03-09T19:12:06.548320
2018-04-10T15:11:49
2018-04-10T15:11:49
128,951,945
0
0
null
null
null
null
UTF-8
Java
false
false
4,070
java
package me.minebuilders.clearlag.commands; import java.util.Iterator; import me.minebuilders.clearlag.Config; import me.minebuilders.clearlag.Modules; import me.minebuilders.clearlag.Util; import me.minebuilders.clearlag.modules.CommandModule; import me.minebuilders.clearlag.modules.ReloadableModule; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.block.BlockState; import org.bukkit.block.CreatureSpawner; import org.bukkit.configuration.Configuration; import org.bukkit.entity.Animals; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.Item; import org.bukkit.entity.Monster; public class CheckCmd extends CommandModule implements ReloadableModule { private boolean monster; private boolean animals; private boolean creature; public CheckCmd() { super.forcePlayer = true; super.cmdName = "check"; super.argLength = 1; super.usage = "(Counts entities in your worlds)"; } public boolean run() { Configuration config = Config.getConfig(); int removed1 = 0; int removed = 0; int chunks = 0; int spawners = 0; Iterator var7 = Bukkit.getServer().getWorlds().iterator(); while(true) { World w; do { if (!var7.hasNext()) { Util.scm("&4*&3&m &8(&a&lServer Status&8)&3&m &4*", super.sender); super.sender.sendMessage(ChatColor.DARK_AQUA + " Items on the ground: " + ChatColor.AQUA + removed1); super.sender.sendMessage(ChatColor.DARK_AQUA + " Mobs alive: " + ChatColor.AQUA + removed); super.sender.sendMessage(ChatColor.DARK_AQUA + " Chunks Loaded: " + ChatColor.AQUA + chunks); super.sender.sendMessage(ChatColor.DARK_AQUA + " Active mob spawners: " + ChatColor.AQUA + spawners); super.sender.sendMessage(ChatColor.DARK_AQUA + " Current TPS: " + ChatColor.AQUA + Modules.TPSTask.getStringTPS()); super.sender.sendMessage(ChatColor.DARK_AQUA + " Players online: " + ChatColor.AQUA + Bukkit.getServer().getOnlinePlayers().length); Util.scm("&4*&3&m &4*", super.sender); return true; } w = (World)var7.next(); } while(config.getStringList("check.world-filter").contains(w.getName())); Chunk[] var11; int var10 = (var11 = w.getLoadedChunks()).length; for(int var9 = 0; var9 < var10; ++var9) { Chunk c = var11[var9]; BlockState[] var15; int var14 = (var15 = c.getTileEntities()).length; int var13; for(var13 = 0; var13 < var14; ++var13) { BlockState bt = var15[var13]; if (bt instanceof CreatureSpawner) { ++spawners; } } Entity[] var17; var14 = (var17 = c.getEntities()).length; for(var13 = 0; var13 < var14; ++var13) { Entity e = var17[var13]; if (e instanceof Monster && this.monster) { ++removed; } else if (e instanceof Animals && this.animals) { ++removed; } else if (e instanceof Creature && this.creature) { ++removed; } else if (e instanceof Item) { ++removed1; } } ++chunks; } } } public void load() { super.load(); this.reload(); } public void reload() { this.monster = Config.getConfig().getBoolean("check.mobs.monster"); this.animals = Config.getConfig().getBoolean("check.mobs.monster"); this.creature = Config.getConfig().getBoolean("check.mobs.monster"); } }
72b29f455d0816a44e1b72c14e7de7820316f131
231a828518021345de448c47c31f3b4c11333d0e
/src/pdf/bouncycastle/asn1/cms/Time.java
f99110d3068469e3a46caf324c1e1cc778f50b4e
[]
no_license
Dynamit88/PDFBox-Java
f39b96b25f85271efbb3a9135cf6a15591dec678
480a576bc97fc52299e1e869bb80a1aeade67502
refs/heads/master
2020-05-24T14:58:29.287880
2019-05-18T04:25:21
2019-05-18T04:25:21
187,312,933
0
0
null
null
null
null
UTF-8
Java
false
false
5,719
java
package pdf.bouncycastle.asn1.cms; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.SimpleTimeZone; import pdf.bouncycastle.asn1.ASN1Choice; import pdf.bouncycastle.asn1.ASN1GeneralizedTime; import pdf.bouncycastle.asn1.ASN1Object; import pdf.bouncycastle.asn1.ASN1Primitive; import pdf.bouncycastle.asn1.ASN1TaggedObject; import pdf.bouncycastle.asn1.ASN1UTCTime; import pdf.bouncycastle.asn1.DERGeneralizedTime; import pdf.bouncycastle.asn1.DERUTCTime; /** * <a href="http://tools.ietf.org/html/rfc5652#section-11.3">RFC 5652</a>: * Dual-mode timestamp format producing either UTCTIme or GeneralizedTime. * <p> * <pre> * Time ::= CHOICE { * utcTime UTCTime, * generalTime GeneralizedTime } * </pre> * <p> * This has a constructor using java.util.Date for input which generates * a {@link pdf.bouncycastle.asn1.DERUTCTime DERUTCTime} object if the * supplied datetime is in range 1950-01-01-00:00:00 UTC until 2049-12-31-23:59:60 UTC. * If the datetime value is outside that range, the generated object will be * {@link pdf.bouncycastle.asn1.DERGeneralizedTime DERGeneralizedTime}. */ public class Time extends ASN1Object implements ASN1Choice { ASN1Primitive time; public static Time getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(obj.getObject()); } /** * @deprecated use getInstance() */ public Time( ASN1Primitive time) { if (!(time instanceof ASN1UTCTime) && !(time instanceof ASN1GeneralizedTime)) { throw new IllegalArgumentException("unknown object passed to Time"); } this.time = time; } /** * Creates a time object from a given date - if the date is between 1950 * and 2049 a UTCTime object is generated, otherwise a GeneralizedTime * is used. * * @param time a date object representing the time of interest. */ public Time( Date time) { SimpleTimeZone tz = new SimpleTimeZone(0, "Z"); SimpleDateFormat dateF = new SimpleDateFormat("yyyyMMddHHmmss"); dateF.setTimeZone(tz); String d = dateF.format(time) + "Z"; int year = Integer.parseInt(d.substring(0, 4)); if (year < 1950 || year > 2049) { this.time = new DERGeneralizedTime(d); } else { this.time = new DERUTCTime(d.substring(2)); } } /** * Creates a time object from a given date and locale - if the date is between 1950 * and 2049 a UTCTime object is generated, otherwise a GeneralizedTime * is used. You may need to use this constructor if the default locale * doesn't use a Gregorian calender so that the GeneralizedTime produced is compatible with other ASN.1 implementations. * * @param time a date object representing the time of interest. * @param locale an appropriate Locale for producing an ASN.1 GeneralizedTime value. */ public Time( Date time, Locale locale) { SimpleTimeZone tz = new SimpleTimeZone(0, "Z"); SimpleDateFormat dateF = new SimpleDateFormat("yyyyMMddHHmmss", locale); dateF.setTimeZone(tz); String d = dateF.format(time) + "Z"; int year = Integer.parseInt(d.substring(0, 4)); if (year < 1950 || year > 2049) { this.time = new DERGeneralizedTime(d); } else { this.time = new DERUTCTime(d.substring(2)); } } /** * Return a Time object from the given object. * <p> * Accepted inputs: * <ul> * <li> null &rarr; null * <li> {@link Time} object * <li> {@link pdf.bouncycastle.asn1.DERUTCTime DERUTCTime} object * <li> {@link pdf.bouncycastle.asn1.DERGeneralizedTime DERGeneralizedTime} object * </ul> * * @param obj the object we want converted. * @exception IllegalArgumentException if the object cannot be converted. */ public static Time getInstance( Object obj) { if (obj == null || obj instanceof Time) { return (Time)obj; } else if (obj instanceof ASN1UTCTime) { return new Time((ASN1UTCTime)obj); } else if (obj instanceof ASN1GeneralizedTime) { return new Time((ASN1GeneralizedTime)obj); } throw new IllegalArgumentException("unknown object in factory: " + obj.getClass().getName()); } /** * Get the date+tine as a String in full form century format. */ public String getTime() { if (time instanceof ASN1UTCTime) { return ((ASN1UTCTime)time).getAdjustedTime(); } else { return ((ASN1GeneralizedTime)time).getTime(); } } /** * Get java.util.Date version of date+time. */ public Date getDate() { try { if (time instanceof ASN1UTCTime) { return ((ASN1UTCTime)time).getAdjustedDate(); } else { return ((ASN1GeneralizedTime)time).getDate(); } } catch (ParseException e) { // this should never happen throw new IllegalStateException("invalid date string: " + e.getMessage()); } } /** * Produce an object suitable for an ASN1OutputStream. */ public ASN1Primitive toASN1Primitive() { return time; } }
10c488c39cc36c0c717039d6628db249841d96fd
abfc267d7522bc4b67a7ebacd01c5c6d49318904
/src/test/java/TestVote.java
9c529af616e58e46a72133efc8233276a6b94bb2
[]
no_license
lyd123qw2008/VoteSystemOnline-Maven-Webapp
c2b3bb849ee8d98e92909d92d1003e9a3ec00cbd
61e20c2d6a8e34fcba310fdc290045a246efad5d
refs/heads/master
2020-12-30T11:39:09.986255
2017-05-24T17:14:51
2017-05-24T17:14:51
91,577,985
0
0
null
2017-05-24T09:10:23
2017-05-17T13:11:51
JavaScript
UTF-8
Java
false
false
1,468
java
import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.gdpu.dao.VoteDao; import com.gdpu.entity.Vote; import com.gdpu.service.VoteService; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:applicationContext.xml"}) public class TestVote { @Resource private VoteDao voteDao; @Resource private VoteService voteService; @Test public void testfindVoteByTitle(){ Vote vote = new Vote(); vote.setTitle("%2%"); List<Vote> list = voteDao.findVoteByTitle(vote); System.out.println(list); } @Test public void testaddVote(){ Vote vote = new Vote(); System.out.println(vote.getVoteId()); } @Test public void testfindVoteById(){ Vote vote = null; vote = voteDao.findVoteById(87); System.out.println(vote); } @Test public void testlist(){ Map<String,Object> map = new HashMap<String, Object>(); Vote vote = new Vote(); // vote.setTitle(); map.put("page", 1); map.put("rows", 10); map.put("title", "%1%"); List<Vote> list = voteDao.list(map); System.out.println(list); } @Test public void testupdateVote(){ Vote vote = new Vote(); vote.setType(1); vote.setPublish(1); vote.setVoteId(137); voteService.updateVote(vote); } }
47ffba1e32e935167302a32afc77873a791a2b1b
22707dcc079b60f0f2f72493d002488cbd46c216
/MyApplication/app/src/main/java/com/example/wasabi/toolbarhomework/MainActivity.java
37342d60948029c0c7a49249c17ead5318515e4b
[]
no_license
WasabiMayo/toolbars-and-menus-hw
9876644903ff47a58314b6e8997b34d72f8d9167
a20ffbe2edcc1735c7969c4f66fb5d2b0df138e3
refs/heads/master
2020-12-25T01:37:33.972408
2016-02-22T14:03:54
2016-02-22T14:03:54
52,180,111
0
0
null
2016-02-20T23:05:32
2016-02-20T23:05:32
null
UTF-8
Java
false
false
7,351
java
package com.example.wasabi.toolbarhomework; import android.content.Intent; import android.media.MediaPlayer; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.ImageView; import android.widget.SeekBar; import android.widget.TextView; import android.widget.Toast; import java.util.concurrent.TimeUnit; public class MainActivity extends AppCompatActivity { boolean isLiked; MediaPlayer mMediaPlayer; ImageView mPlayIcon, mForwardIcon, mAlbumArt, mSettingsIcon, mPersonalIcon, mChatIcon; TextView mLikeText, mDislikeText, mTimeElapsedText, mTimeRemainingText; SeekBar mSeekbar; double finalTime, elapsedTime; int forwardTime = 2000; Handler handler = new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); isLiked = false; mAlbumArt = (ImageView) findViewById(R.id.albumart); mSettingsIcon = (ImageView) findViewById(R.id.settings_imageview); mPersonalIcon = (ImageView) findViewById(R.id.personal_imageview); mChatIcon = (ImageView) findViewById(R.id.comment_imageview); mPlayIcon = (ImageView) findViewById(R.id.play_icon); mForwardIcon = (ImageView) findViewById(R.id.forward_icon); mLikeText = (TextView) findViewById(R.id.like_textview); mDislikeText = (TextView) findViewById(R.id.dislike_textview); mTimeElapsedText = (TextView) findViewById(R.id.elapsed_time_textview); mTimeRemainingText = (TextView) findViewById(R.id.remaining_time_textview); mSeekbar = (SeekBar) findViewById(R.id.seekbar); mMediaPlayer = MediaPlayer.create(this, R.raw.bensound_funnysong); finalTime = (double) mMediaPlayer.getDuration(); int finalMin = (int)(TimeUnit.MILLISECONDS.toMinutes((long)finalTime)); int finalSec = (int)(TimeUnit.MILLISECONDS.toSeconds((long)finalTime) - TimeUnit.MINUTES.toSeconds(finalMin)); mSeekbar.setMax((int) finalTime); mSeekbar.setClickable(false); if(mSettingsIcon!=null && mPersonalIcon != null && mChatIcon != null) { mSettingsIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "Pressed settings icon", Toast.LENGTH_SHORT).show(); } }); mPersonalIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "Pressed personal info icon", Toast.LENGTH_SHORT).show(); } }); mChatIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "Pressed chat icon", Toast.LENGTH_SHORT).show(); } }); } mTimeElapsedText.setText("0:00"); if(finalSec<10){ mTimeRemainingText.setText(finalMin + ":0" + finalSec); }else { mTimeRemainingText.setText(finalMin + ":" + finalSec); } mAlbumArt.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, TedActivity.class); startActivity(intent); } }); mLikeText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "Pressed like button", Toast.LENGTH_SHORT).show(); } }); mDislikeText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this, "Pressed dislike button", Toast.LENGTH_SHORT).show(); } }); mPlayIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (mMediaPlayer.isPlaying()) { mMediaPlayer.pause(); mPlayIcon.setImageResource(android.R.drawable.ic_media_play); } else { mPlayIcon.setImageResource(android.R.drawable.ic_media_pause); mMediaPlayer.start(); elapsedTime = mMediaPlayer.getCurrentPosition(); mSeekbar.setProgress((int) elapsedTime); handler.postDelayed(updateSeekbarTime, 100); } } }); mForwardIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if((elapsedTime+forwardTime) < mMediaPlayer.getDuration()){ elapsedTime += forwardTime; mMediaPlayer.seekTo((int)elapsedTime); } } }); } Runnable updateSeekbarTime = new Runnable() { @Override public void run() { elapsedTime = mMediaPlayer.getCurrentPosition(); mSeekbar.setProgress((int) elapsedTime); double remainingTime = finalTime - elapsedTime; int remainingMin = (int) (TimeUnit.MILLISECONDS.toMinutes((long) remainingTime)); int remainingSec = (int) ((TimeUnit.MILLISECONDS.toSeconds((long) remainingTime)) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes((long) remainingTime))); if(remainingSec<10){ mTimeRemainingText.setText(remainingMin + ":0" + remainingSec); }else{ mTimeRemainingText.setText(remainingMin + ":" + remainingSec); } int elapsedMin = (int)(TimeUnit.MILLISECONDS.toMinutes((long)elapsedTime)); int elapsedSec = (int) ((TimeUnit.MILLISECONDS.toSeconds((long)elapsedTime)) - (TimeUnit.MINUTES.toSeconds((long)elapsedMin))); if(elapsedSec<10){ mTimeElapsedText.setText(elapsedMin + ":0" + elapsedSec); } else { mTimeElapsedText.setText(elapsedMin + ":" + elapsedSec); } handler.postDelayed(this, 100); } }; @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.pandora_menu,menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case R.id.action_like: Toast.makeText(MainActivity.this, "Pressed like button", Toast.LENGTH_SHORT).show(); return true; } return super.onOptionsItemSelected(item); } }
7b75cfade630e9029689641e5f3c9827f9598b9e
c41750c718bf1329d525c7ff39770c9ce5c1ebc3
/이펙티브 자바/effectiveJava/src/test/java/Chap12_Serialization/item89/readresolve/PeriodTest.java
ef2fd45f0809caa7af6785fb6514b0bca64a5149
[]
no_license
Java-Bom/ReadingRecord
45a2649b96a4180063b6d398e9db24ae80664ffa
004f9967c1502115b00cf23f60cf0d5a7fd9b2d2
refs/heads/master
2022-07-07T16:10:59.206131
2022-06-18T03:40:43
2022-06-18T03:40:57
214,052,494
472
47
null
2022-05-25T02:36:10
2019-10-10T00:44:15
Java
UTF-8
Java
false
false
1,568
java
package Chap12_Serialization.item89.readresolve; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.Base64; import java.util.Date; import static org.assertj.core.api.Assertions.assertThat; class PeriodTest { @DisplayName("readResolve가 readObject를 덮어 쓰는 결과를 내놓는다.") @Test void name() throws IOException, ClassNotFoundException { byte[] serializedPeriodBytes; Period period = new Period(new Date(1), new Date(2)); try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { try (ObjectOutputStream oos = new ObjectOutputStream(baos)) { oos.writeObject(period); serializedPeriodBytes = baos.toByteArray(); } } byte[] deserializedPeriodBytes = Base64.getDecoder().decode(Base64.getEncoder().encodeToString(serializedPeriodBytes)); Period deserializedPeriod; try (ByteArrayInputStream bais = new ByteArrayInputStream(deserializedPeriodBytes)) { try (ObjectInputStream ois = new ObjectInputStream(bais)) { Object objectMember = ois.readObject(); deserializedPeriod = (Period) objectMember; } } assertThat(deserializedPeriod).isNotEqualTo(period); assertThat(deserializedPeriod).isEqualTo(Period.INSTANCE); } }
5df58367cd66f68ec5e434574a4305bae5263ad0
e5204e3696f2f90553a563e50a40dcff659f2090
/FB/673. Number of Longest Increasing Subsequence.java
85e7c3094f2ccbe189287dc9aa05f3721d490854
[]
no_license
HaoSungogogo/Leetcode
d563f74c656d07aa90ccbf6198af8933124bd6c5
855760793e9dc814e8c65d0b7a37148af1a6a9c5
refs/heads/master
2021-01-02T08:35:00.253823
2019-01-05T21:49:04
2019-01-05T21:49:04
98,950,629
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
class Solution { public int findNumberOfLIS(int[] nums) { if (nums == null || nums.length == 0) { return 0; } int[] dp = new int[nums.length]; int[] count = new int[nums.length]; int max = 0; int counter = 0; for (int i = 0; i < nums.length; i++) { dp[i] = 1; count[i] = 1; for (int j = 0; j < i; j++) { if (nums[i] > nums[j]) { if (dp[j] + 1 > dp[i]) { dp[i] = dp[j] + 1; count[i] = count[j]; } else if (dp[j] + 1 == dp[i]) { count[i] += count[j]; } } } if (dp[i] > max) { max = dp[i]; counter = count[i]; } else if (dp[i] == max) { counter += count[i]; } } return counter; } } Using two dp array to record the length of longest increasing Subsequence and the number of ways to construct such array.
9750a147de537b83256163f4081f0a5f52134ddc
c8e4ee52536ae256db661c920a8d8d295f6cf4b7
/freeSchool/src/main/java/bf/gov/data/InscriptionPK.java
3b6ae71ea9d86e4e6e8aa41fcb6b3b4ff89f625a
[]
no_license
yigalpenBado/free_school
9dda4ba2c1df34081f4eff7c3ff446fb6d472bb6
67a64ee9f29189b8fd4b706987ce2539a9d3a814
refs/heads/master
2021-05-13T22:19:55.949435
2018-01-09T07:42:39
2018-01-09T07:42:39
116,485,542
0
0
null
null
null
null
UTF-8
Java
false
false
2,937
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 bf.gov.data; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; /** * * @author peter */ @Embeddable public class InscriptionPK implements Serializable { @Basic(optional = false) @NotNull @Size(min = 1, max = 10) @Column(name = "matricule") private String matricule; @Basic(optional = false) @NotNull @Size(min = 1, max = 5) @Column(name = "code_classe") private String codeClasse; @Basic(optional = false) @NotNull @Column(name = "numero_annee") private int numeroAnnee; public InscriptionPK() { } public InscriptionPK(String matricule, String codeClasse, int numeroAnnee) { this.matricule = matricule; this.codeClasse = codeClasse; this.numeroAnnee = numeroAnnee; } public String getMatricule() { return matricule; } public void setMatricule(String matricule) { this.matricule = matricule; } public String getCodeClasse() { return codeClasse; } public void setCodeClasse(String codeClasse) { this.codeClasse = codeClasse; } public int getNumeroAnnee() { return numeroAnnee; } public void setNumeroAnnee(int numeroAnnee) { this.numeroAnnee = numeroAnnee; } @Override public int hashCode() { int hash = 0; hash += (matricule != null ? matricule.hashCode() : 0); hash += (codeClasse != null ? codeClasse.hashCode() : 0); hash += (int) numeroAnnee; return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof InscriptionPK)) { return false; } InscriptionPK other = (InscriptionPK) object; if ((this.matricule == null && other.matricule != null) || (this.matricule != null && !this.matricule.equals(other.matricule))) { return false; } if ((this.codeClasse == null && other.codeClasse != null) || (this.codeClasse != null && !this.codeClasse.equals(other.codeClasse))) { return false; } if (this.numeroAnnee != other.numeroAnnee) { return false; } return true; } @Override public String toString() { return "bf.gov.data.InscriptionPK[ matricule=" + matricule + ", codeClasse=" + codeClasse + ", numeroAnnee=" + numeroAnnee + " ]"; } }
[ "peter@DESKTOP-JOQE2F4" ]
peter@DESKTOP-JOQE2F4
424e59924f0a3494b363df1f253432320c546b40
91f5be7778918bd2154edc532b38a969d4682775
/Boxes/src/com/formatic/boxes/widgets/events/CharSelectorListener.java
db78e99acb847926daf64f93518ccf11a50436f8
[]
no_license
antoniovazquezaraujo/boxes
3199aacf9374559dcf85d816dda3f6746444f21a
9e9164101546e730bbe730eeb48c6db2485ec341
refs/heads/master
2021-01-13T09:50:26.269839
2014-06-26T16:40:54
2014-06-26T16:40:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,013
java
/* BOXES A minimalist color box framework Copyright (C) 2014 Antonio Vazquez Araujo (antoniovazquezaraujo[at]gmail[dot]com) This file is part of Boxes. Boxes 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. Boxes 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 Boxes. If not, see <http://www.gnu.org/licenses/>. */ package com.formatic.boxes.widgets.events; import com.formatic.boxes.Color; public interface CharSelectorListener { void charSelected(char c); }
304118522f647919a85b397af1af31d2aedd1a09
3559ed7b0aa73726aafe78a46a2dfbf69a7575b1
/src/com/javarush/task/task10/task1001/Solution.java
31b6aaf605108845020e599ae6981c574390266d
[]
no_license
parotkok/1.JavaSyntax
4831195c555d3a542b8ffd92c1622b6cc5fcb42c
49f76a462595bc4510c486e4682772ce327d28f4
refs/heads/master
2021-01-03T02:57:29.747853
2020-04-14T20:12:25
2020-04-14T20:12:25
239,892,266
0
0
null
null
null
null
UTF-8
Java
false
false
1,616
java
package com.javarush.task.task10.task1001; /* Задача №1 на преобразование целых типов */ /* Расставьте правильно операторы приведения типа, чтобы получился ответ: d > 0 int a = 0; int b = (byte) a + 46; byte c = (byte) (a*b); double f = (char) 1234.15; long d = (short) (a + f / c + b); Требования: Программа должна выводить текст на экран. Нельзя менять команду вывода на экран. Метод main() должен содержать переменную a типа int. Метод main() должен содержать переменную b типа int. Метод main() должен содержать переменную c типа byte. Метод main() должен содержать переменную f типа double. Метод main() должен содержать переменную d типа long. Начальное значение переменных при инициализации менять нельзя. Можно только редактировать операторы приведения типа (добавлять/удалять/изменять). Программа должна выводить число больше, чем 0. */ public class Solution { public static void main(String[] args) { int a = 0; int b = (byte) a + 46; byte c = (byte) (a * b); double f = 1234.15; long d = (long) (a + f / c + b); System.out.println(d); } }
590b744eafcd4c77a095a82a7febae97eb642507
44404942a6da545933a18140ec4b9b368ad459b8
/com.eclipserunner.plugin/src/com/eclipserunner/utils/SelectionUtils.java
9da152e7e7c748364aee4840fac6dd639f9b64d7
[ "MIT" ]
permissive
zaunerc/eclipserunnerplugin
5c4abfe8c4962b93352425258a55c8fd7037caf2
3faead560cae5daf89926b1e03ec18c79cf17a6b
refs/heads/master
2021-07-06T04:41:54.602606
2021-05-13T17:46:14
2021-05-13T17:46:14
61,304,232
5
2
null
2020-06-02T13:50:34
2016-06-16T15:18:01
Java
UTF-8
Java
false
false
2,210
java
package com.eclipserunner.utils; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; /** * Utility methods related to object selection. * * @author vachacz */ public class SelectionUtils { public static <T> T getFirstSelectedItemByType(ISelection selection, Class<T> instanceClass) { if (selection instanceof IStructuredSelection) { return getFirstSelectedItemByType((IStructuredSelection) selection, instanceClass); } return null; } @SuppressWarnings("unchecked") public static <T> T getFirstSelectedItemByType(IStructuredSelection selection, Class<T> instanceClass) { Iterator<?> iterator = selection.iterator(); while (iterator.hasNext()) { Object item = iterator.next(); if (instanceClass.isInstance(item)) { return (T) item; } } return null; } public static <T> List<T> getAllSelectedItemsByType(ISelection selection, Class<T> instanceClass) { if (selection instanceof IStructuredSelection) { return getAllSelectedItemsByType((IStructuredSelection) selection, instanceClass); } return Collections.emptyList(); } @SuppressWarnings("unchecked") public static <T> List<T> getAllSelectedItemsByType(IStructuredSelection selection, Class<T> instanceClass) { List<T> selectedOfType = new ArrayList<T>(); Iterator<?> iterator = selection.iterator(); while (iterator.hasNext()) { Object item = iterator.next(); if (instanceClass.isInstance(item)) { selectedOfType.add((T) item); } } return selectedOfType; } @SuppressWarnings("rawtypes") public static List<Class> getSelectedItemTypes(IStructuredSelection selection) { List<Class> selectedItemTypes = new ArrayList<Class>(); Iterator<?> iterator = selection.iterator(); while (iterator.hasNext()) { Object item = iterator.next(); if (!selectedItemTypes.contains(item.getClass())) { selectedItemTypes.add(item.getClass()); } } return selectedItemTypes; } public static boolean isSameTypeNodeSelection(IStructuredSelection selection) { return getSelectedItemTypes(selection).size() == 1; } }
9f0281bc9f8d24e30e00b32f13e30755084f8fd1
cec1602d23034a8f6372c019e5770773f893a5f0
/sources/org/litepal/crud/model/AssociationsInfo.java
18cb457ab4423c9822aa30f8e561ed36083c2466
[]
no_license
sengeiou/zeroner_app
77fc7daa04c652a5cacaa0cb161edd338bfe2b52
e95ae1d7cfbab5ca1606ec9913416dadf7d29250
refs/heads/master
2022-03-31T06:55:26.896963
2020-01-24T09:20:37
2020-01-24T09:20:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,486
java
package org.litepal.crud.model; import java.lang.reflect.Field; public class AssociationsInfo { private Field associateOtherModelFromSelf; private Field associateSelfFromOtherModel; private String associatedClassName; private int associationType; private String classHoldsForeignKey; private String selfClassName; public String getSelfClassName() { return this.selfClassName; } public void setSelfClassName(String selfClassName2) { this.selfClassName = selfClassName2; } public String getAssociatedClassName() { return this.associatedClassName; } public void setAssociatedClassName(String associatedClassName2) { this.associatedClassName = associatedClassName2; } public String getClassHoldsForeignKey() { return this.classHoldsForeignKey; } public void setClassHoldsForeignKey(String classHoldsForeignKey2) { this.classHoldsForeignKey = classHoldsForeignKey2; } public Field getAssociateOtherModelFromSelf() { return this.associateOtherModelFromSelf; } public void setAssociateOtherModelFromSelf(Field associateOtherModelFromSelf2) { this.associateOtherModelFromSelf = associateOtherModelFromSelf2; } public Field getAssociateSelfFromOtherModel() { return this.associateSelfFromOtherModel; } public void setAssociateSelfFromOtherModel(Field associateSelfFromOtherModel2) { this.associateSelfFromOtherModel = associateSelfFromOtherModel2; } public int getAssociationType() { return this.associationType; } public void setAssociationType(int associationType2) { this.associationType = associationType2; } public boolean equals(Object o) { if (o instanceof AssociationsInfo) { AssociationsInfo other = (AssociationsInfo) o; if (o != null && other != null && other.getAssociationType() == this.associationType && other.getClassHoldsForeignKey().equals(this.classHoldsForeignKey)) { if (other.getSelfClassName().equals(this.selfClassName) && other.getAssociatedClassName().equals(this.associatedClassName)) { return true; } if (other.getSelfClassName().equals(this.associatedClassName) && other.getAssociatedClassName().equals(this.selfClassName)) { return true; } } } return false; } }
3a68a4e2ce494d570cc1246db7b405e39219b89e
b20e9dd3d3e0c7ef9ee278c532b74b18ded3369b
/src/main/java/com/tydic/udbh/entity/sms/MessageInfo.java
b11c55e5c6f2ca208720d328b6abe4347c7d0e2a
[]
no_license
xiefeife/udbh
308e190b5c2d13f448e3d36ee5922c7a35113072
664f6504ff6cfe2e4b995cb7c9c9cc7ddab208f9
refs/heads/main
2023-04-01T20:16:12.951430
2021-04-11T11:38:50
2021-04-11T11:38:50
356,836,067
0
0
null
null
null
null
UTF-8
Java
false
false
695
java
package com.tydic.udbh.entity.sms; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; /** * 短信信息 * * @author Cloud(郭云峰) * @date 2021/2/2 11:14 */ @Data @Builder @AllArgsConstructor @NoArgsConstructor public class MessageInfo implements Serializable { private static final long serialVersionUID = 2140025219341425569L; /** * 模板参数 */ private Object paramInfo; /** * 模板信息 */ private String templateId; /** * 发送者 */ private String sender; /** * 接收人 */ private String recipient; }
8b823dfc878e69b041e5ceb15e20e04b8e367f84
3d3cdcec463ddeb3595d280951ffb741e21fa1bf
/Custom EndPoint/demo/src/main/java/com/example/service/UserService.java
11f648076c8aefffaa7ec5855b21c5768a7f4643
[]
no_license
99246255/SpringBoot-Learning
ff46ca02236f6294c1bab76652a56515d9116e58
79102c1ae1d36ea92b83fdee16fb5d6b424be757
refs/heads/master
2020-03-17T05:59:48.216203
2018-07-02T03:09:44
2018-07-02T03:09:44
133,336,892
2
0
null
null
null
null
UTF-8
Java
false
false
722
java
package com.example.service; import com.example.entity.User; import com.example.repository.UserRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service @Transactional public class UserService { @Autowired UserRepository userRepository; public List<User> findByName(String name){ return userRepository.findByName(name); } public Page<User> findAll(PageRequest pageable){ return userRepository.findAll(pageable); } }
d4d029a1e5a9d5a19e968565a400c0e71c952e05
63e1d85ab538fb41c0c6117f68a453acef01316c
/src/main/java/br/com/marcospcruz/controleestoque/view/PrincipalGUI.java
0221af0d39bac9efb52b2e3b7aacf67e1c75a252
[]
no_license
marcospcruz/controleestoque
8a7e229d3f3b8badd8cce46f465d0ccebc2d20a4
03b021e2b8f4826e1ed2c695944a44b379d1d2d1
refs/heads/master
2021-01-10T07:53:37.657732
2016-03-27T15:52:16
2016-03-27T15:52:16
54,750,242
0
0
null
null
null
null
UTF-8
Java
false
false
12,868
java
package br.com.marcospcruz.controleestoque.view; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.List; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFormattedTextField; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import javax.swing.table.DefaultTableCellRenderer; import br.com.marcospcruz.controleestoque.controller.EstoqueController; import br.com.marcospcruz.controleestoque.controller.relatorio.RelatorioEstoqueGeral; import br.com.marcospcruz.controleestoque.model.ItemEstoque; import br.com.marcospcruz.controleestoque.model.SubTipoProduto; import br.com.marcospcruz.controleestoque.util.ConstantesEnum; import br.com.marcospcruz.controleestoque.util.MyFormatador; import br.com.marcospcruz.controleestoque.view.util.MyTableModel; public class PrincipalGUI extends JFrame implements ActionListener, MouseListener { /** * */ private static final long serialVersionUID = 2191305646130817805L; private static final Object[] COLUNAS_JTABLE = { ConstantesEnum.CODIGO_LABEL.getValue().toString(), ConstantesEnum.CATEGORIA_LABEL.getValue().toString(), ConstantesEnum.TIPO_ITEM_LABEL.getValue().toString(), ConstantesEnum.DESCRICAO_ITEM_LABEL.getValue().toString(), ConstantesEnum.QUANTIDADE_LABEL.getValue().toString(), ConstantesEnum.VALOR_UNITARIO_LABEL.getValue().toString(), ConstantesEnum.VALOR_TOTAL_LABEL.getValue().toString() }; private JPanel jPanelEstoque; private JPanel jPanelCadastros; private Toolkit toolkit; private JButton btnTipoProduto; private JButton btnProduto; private JFormattedTextField txtBuscaDescricaoProduto; private JButton btnBuscaItem; private EstoqueController controller; private MyTableModel myTableModel; private JTable jTable; private JScrollPane jScrollPane; private JPanel jPanelTableEstoque; private JButton btnLimpaConsulta; private JButton btnRelatorioGeralEstoque; private JButton btnNovoItemEstoque; public PrincipalGUI(String tituloJanela) { super(tituloJanela); setSize(configuraDimensaoJanela()); controller = new EstoqueController(); carregaJPanel(); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } private JPanel carregaLogoMarca() { JLabel label = null; try { URI uriImagem = getClass().getClassLoader() .getResource("META-INF\\logo_marca.jpg").toURI(); ImageIcon icon = new ImageIcon(uriImagem.toURL()); label = new JLabel(icon); } catch (URISyntaxException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } label.setPreferredSize(new Dimension(400, 100)); JPanel p = new JPanel(new FlowLayout()); p.add(label); p.setBackground(Color.YELLOW); return p; } private Dimension configuraDimensaoJanela() { toolkit = Toolkit.getDefaultToolkit(); return toolkit.getScreenSize(); } private void carregaJPanel() { jPanelCadastros = new JPanel(); jPanelCadastros.setBorder(new TitledBorder("Cadastros")); jPanelCadastros.setSize(getWidth(), 300); carregaComponentesPanelCadastro(); add(jPanelCadastros, BorderLayout.NORTH); carregaComponentesPanelEstoque(); add(jPanelEstoque, BorderLayout.CENTER); } private void carregaComponentesPanelEstoque() { // jPanelEstoque = new JPanel(new GridLayout(2, 1)); jPanelEstoque = new JPanel(new BorderLayout()); jPanelEstoque.setBorder(new TitledBorder("Estoque Loja")); jPanelEstoque.add(carregaAcoesEstoque(), BorderLayout.NORTH); jPanelEstoque.add(carregaFormEstoque(), BorderLayout.CENTER); } private JPanel carregaTableEstoquePnl() { JPanel panel = new JPanel(new BorderLayout()); panel.setBorder(new TitledBorder("Estoque de Produtos")); carregaTableModel(); jTable = inicializaJTable(); jScrollPane = new JScrollPane(jTable); jScrollPane.setSize(new Dimension(panel.getWidth() - 15, panel .getHeight() - 20)); panel.add(jScrollPane, BorderLayout.CENTER); // panel.add(carregaLogoMarca(), BorderLayout.SOUTH); return panel; } @SuppressWarnings("rawtypes") private void carregaTableModel() { List linhas = carregaLinhasTableModel(controller.getItensEstoque()); carregaTableModel(linhas); } @SuppressWarnings("rawtypes") protected void carregaTableModel(List linhas) { myTableModel = new MyTableModel(linhas, COLUNAS_JTABLE); myTableModel.fireTableDataChanged(); } @SuppressWarnings({ "unchecked", "rawtypes" }) private List carregaLinhasTableModel(List<ItemEstoque> itensEstoque) { List linhas = new ArrayList(); for (ItemEstoque itemEstoque : itensEstoque) { linhas.add(processaColuna(itemEstoque)); } return linhas; } private Object[] processaColuna(ItemEstoque itemEstoque) { float valor = itemEstoque.getQuantidade() * itemEstoque.getProduto().getValorUnitario(); String simboloMonetarioBr = ConstantesEnum.SIMBOLO_MONETARIO_BR .getValue().toString(); String valorTotal = simboloMonetarioBr + MyFormatador.formataStringDecimais(valor); String valorUnitario = simboloMonetarioBr + MyFormatador.formataStringDecimais(itemEstoque.getProduto() .getValorUnitario()); SubTipoProduto tipoProduto = (SubTipoProduto) itemEstoque.getProduto() .getTipoProduto(); Object[] colunas = { itemEstoque.getIdItemEstoque(), tipoProduto.getSuperTipoProduto().getDescricaoTipo(), tipoProduto.getDescricaoTipo(), itemEstoque.getProduto().getDescricaoProduto(), itemEstoque.getQuantidade(), valorUnitario, valorTotal }; return colunas; } private JPanel carregaAcoesEstoque() { JPanel panel = new JPanel(); panel.add(carregaBuscaItemPnl()); panel.add(carregaPnlBotoes()); return panel; } private JPanel carregaPnlBotoes() { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder("")); btnNovoItemEstoque = inicializaJButton(ConstantesEnum.LBL_BTN_NOVO_ITEM_ESTOQUE .getValue().toString()); panel.add(btnNovoItemEstoque); return panel; } private JPanel carregaBuscaItemPnl() { JPanel panel = new JPanel(new GridLayout(2, 1)); panel.setBorder(new TitledBorder("Consulta de Estoque")); panel.add(carregaFormularioBusca()); panel.add(carregaBotoesConsulta()); return panel; } private JPanel carregaFormularioBusca() { JPanel panel = new JPanel(); panel.add(new JLabel(ConstantesEnum.DESCRICAO_ITEM_LABEL.getValue() .toString())); txtBuscaDescricaoProduto = new JFormattedTextField(); txtBuscaDescricaoProduto.setColumns(20); panel.add(txtBuscaDescricaoProduto); return panel; } private JPanel carregaBotoesConsulta() { JPanel panel = new JPanel(new GridLayout(1, 2)); btnBuscaItem = inicializaJButton("Consulta Estoque"); btnLimpaConsulta = inicializaJButton("Limpar Consulta"); panel.add(btnBuscaItem); panel.add(btnLimpaConsulta); return panel; } private JPanel carregaFormEstoque() { JPanel panel = new JPanel(new BorderLayout()); // panel.add(carregaItemEstoquePnl(), BorderLayout.NORTH); jPanelTableEstoque = carregaTableEstoquePnl(); panel.add(jPanelTableEstoque, BorderLayout.CENTER); panel.add(carregaPanelBtnRelatorios(), BorderLayout.EAST); return panel; } private JPanel carregaPanelBtnRelatorios() { JPanel panel = new JPanel(); panel.setBorder(new TitledBorder(ConstantesEnum.RELATORIO_TITLE_BORDER .getValue().toString())); btnRelatorioGeralEstoque = inicializaJButton(ConstantesEnum.LBL_BTN_RELATORIO .getValue().toString()); panel.add(btnRelatorioGeralEstoque); return panel; } private void carregaComponentesPanelCadastro() { Rectangle retangulo = new Rectangle(10, 100, 130, 50); btnTipoProduto = inicializaJButton(ConstantesEnum.LBL_BTN_TIPO_PRODUTO .getValue().toString(), retangulo); jPanelCadastros.add(btnTipoProduto); btnProduto = inicializaJButton(ConstantesEnum.PRODUTO_LABEL .getValue().toString(), btnTipoProduto.getWidth() + 20, 100, 130, 50); jPanelCadastros.add(btnProduto); jPanelCadastros.setSize(btnProduto.getWidth(), btnProduto.getHeight()); } private JButton inicializaJButton(String text) { JButton jButton = new JButton(text); jButton.addActionListener(this); return jButton; } private JButton inicializaJButton(String text, Rectangle retangulo) { return inicializaJButton(text, (int) retangulo.getX(), (int) retangulo.getY(), (int) retangulo.getWidth(), (int) retangulo.getHeight()); } private JButton inicializaJButton(String text, int x, int y, int width, int height) { JButton jButton = inicializaJButton(text); jButton.setBounds(x, y, width, height); return jButton; } public void actionPerformed(ActionEvent e) { try { selecionaAcao(e.getActionCommand()); } catch (Exception e1) { e1.printStackTrace(); JOptionPane.showMessageDialog(null, e1.getMessage(), "Alerta", JOptionPane.ERROR_MESSAGE); } atualizaTableModel(controller.getItemEstoque()); } private void selecionaAcao(String actionCommand) throws Exception { if (actionCommand.equals(ConstantesEnum.LBL_BTN_NOVO_ITEM_ESTOQUE .getValue().toString())) { new ItemEstoqueDialog(controller, this); } else if (actionCommand.equals(ConstantesEnum.LBL_BTN_RELATORIO .getValue().toString())) { RelatorioEstoqueGeral printer = new RelatorioEstoqueGeral(); printer.gerarRelatorio(); } else if (actionCommand.equals(ConstantesEnum.CONSULTA_ESTOQUE .getValue().toString())) { buscaItemEstoque(); } else if (actionCommand.equals(ConstantesEnum.LBL_BTN_TIPO_PRODUTO .getValue().toString())) { new TipoProdutoDialog(this); // atualizaView(); } else if (actionCommand.equals(ConstantesEnum.PRODUTO_LABEL .getValue().toString())) { new ProdutoDialog(this); // atualizaView(); controller.anulaAtributos(); } else if (actionCommand.equals(ConstantesEnum.LBL_BTN_LIMPAR .getValue().toString())) { controller.anulaAtributos(); // atualizaView(); } else { txtBuscaDescricaoProduto.setText(""); // controller.anulaAtributos(); } } private void buscaItemEstoque() throws Exception { String descricao = txtBuscaDescricaoProduto.getText(); if (descricao.length() > 0) { controller.anulaAtributos(); controller.buscaItemEstoque(descricao); controller.validaBusca(); txtBuscaDescricaoProduto.setText(""); } } @SuppressWarnings({ "rawtypes", "unchecked" }) private void atualizaTableModel(ItemEstoque item) { try { List linhas = new ArrayList(); linhas.add(item); carregaTableModel(carregaLinhasTableModel(linhas)); } catch (NullPointerException e) { e.printStackTrace(); carregaTableModel(); } Rectangle retangulo = jScrollPane.getBounds(); jPanelTableEstoque.remove(jScrollPane); jTable = inicializaJTable(); jScrollPane = new JScrollPane(jTable); jScrollPane.setBounds(retangulo); jPanelTableEstoque.add(jScrollPane); jPanelTableEstoque.repaint(); } JTable inicializaJTable() { JTable jTable = new JTable(myTableModel); jTable.addMouseListener(this); DefaultTableCellRenderer direita = new DefaultTableCellRenderer(); direita.setHorizontalAlignment(SwingConstants.RIGHT); jTable.getColumnModel().getColumn(0).setCellRenderer(direita); jTable.getColumnModel().getColumn(4).setCellRenderer(direita); jTable.getColumnModel().getColumn(5).setCellRenderer(direita); jTable.getColumnModel().getColumn(6).setCellRenderer(direita); return jTable; } public void mouseClicked(MouseEvent e) { if (e.getSource() instanceof JTable) { JTable table = (JTable) e.getSource(); int indiceLinha = table.getSelectedRow(); int idItemEstoque = (Integer) table.getModel().getValueAt( indiceLinha, 0); controller.busca(idItemEstoque); new ItemDoEstoqueDialog(this, controller); controller.anulaAtributos(); atualizaTableModel(null); } } public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } }
bcc832b1f9838e21675b825024a584d168bbd8af
5e50e7773858af321004cbe26a91647392d0e492
/app/src/main/java/gevorgyan/vahan/newsfeed/ui/fragment/SavedArticlesFragment.java
db97e16077878a5c887c59ed246234201a401fa8
[]
no_license
vahan8/Watcher
1f4b359519d28551278ed842b627ffa1908e7682
9238c0d2f6f0f246b04ecc27fbbbdeea078ca437
refs/heads/master
2020-04-17T07:22:38.426379
2018-11-28T05:15:36
2018-11-28T05:15:36
159,072,623
0
0
null
null
null
null
UTF-8
Java
false
false
5,717
java
package gevorgyan.vahan.newsfeed.ui.fragment; import android.app.ActivityOptions; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; import java.util.List; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.RecyclerView; import gevorgyan.vahan.newsfeed.R; import gevorgyan.vahan.newsfeed.domain.enums.ListViewMode; import gevorgyan.vahan.newsfeed.domain.model.Article; import gevorgyan.vahan.newsfeed.ui.activity.ArticleActivity; import gevorgyan.vahan.newsfeed.ui.adapter.SavedArticlesAdapter; import gevorgyan.vahan.newsfeed.ui.viewmodel.SavedArticlesViewModel; import gevorgyan.vahan.newsfeed.util.RecyclerViewUtils; public class SavedArticlesFragment extends Fragment { private SavedArticlesViewModel viewModel; private SavedArticlesAdapter adapter; private RecyclerView recyclerView; private TextView emptyView; private ListViewMode listViewMode; private MenuItem menuItemListLayoutMode; public static SavedArticlesFragment newInstance() { return new SavedArticlesFragment(); } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_saved_articles, container, false); recyclerView = view.findViewById(R.id.recyclerview); emptyView = view.findViewById(R.id.textview_empty); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); listViewMode = ListViewMode.LIST; viewModel = ViewModelProviders.of(this).get(SavedArticlesViewModel.class); viewModel.getArticlesObservable().observe(this, new Observer<List<Article>>() { @Override public void onChanged(List<Article> articles) { adapter.swap(articles); if (articles.size() == 0) { emptyView.setVisibility(View.VISIBLE); recyclerView.setVisibility(View.GONE); } else { emptyView.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); } } }); viewModel.loadData(); RecyclerView.ItemAnimator itemAnimator = new DefaultItemAnimator(); recyclerView.setItemAnimator(itemAnimator); RecyclerViewUtils.setLayoutManager(requireActivity(), recyclerView, ListViewMode.LIST); adapter = new SavedArticlesAdapter(requireActivity(), new ArrayList<Article>(), ListViewMode.LIST); recyclerView.setAdapter(adapter); adapter.setItemClickListener(new SavedArticlesAdapter.ItemsClickListener() { @Override public void onClick(Article article, final ImageView imageView) { Bundle bundle = new Bundle(); bundle.putSerializable(ArticleActivity.KEY_ARTICLE, article); Intent intent = new Intent(requireActivity(), ArticleActivity.class); intent.putExtras(bundle); View v = imageView.getRootView(); ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(requireActivity(), imageView, getString(R.string.thumbnail)); startActivity(intent, options.toBundle()); } }); setHasOptionsMenu(true); } @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.fragment_saved_articles, menu); menuItemListLayoutMode = menu.findItem(R.id.menu_list_layout_mode); } @Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_list_layout_mode: switch (listViewMode) { case MINI_CARD: listViewMode = ListViewMode.LIST; adapter.setListViewMode(ListViewMode.LIST); RecyclerViewUtils.setLayoutManager(requireActivity(), recyclerView, ListViewMode.LIST); menuItemListLayoutMode.setIcon(R.drawable.ic_view_agenda_white_36dp); menuItemListLayoutMode.setTitle(R.string.view_mode_list); break; case LIST: listViewMode = ListViewMode.MINI_CARD; adapter.setListViewMode(ListViewMode.MINI_CARD); RecyclerViewUtils.setLayoutManager(requireActivity(), recyclerView, ListViewMode.MINI_CARD); menuItemListLayoutMode.setIcon(R.drawable.ic_view_list_white_36dp); menuItemListLayoutMode.setTitle(R.string.view_mode_mini_card); break; default: break; } return true; default: return super.onOptionsItemSelected(item); } } }
63ac117ba8d520edd0dcc67b2e07a96d4f7e5975
9a940b5caeb501efb911992d35761091487c41db
/soar-consumer/src/main/java/heelenyc/soar/consumer/remote/tcp/coder/TcpResponseDecoder.java
d6739ec31a5f770f5f1e772704c50bea3482a1d3
[]
no_license
heelenyc/soar
00770d152c85979ab7684c6d98040e0224ddfca2
cc2a19a0be587cd7e5937d81569ece8b7c3e4130
refs/heads/master
2023-03-04T19:34:23.782224
2023-02-27T01:23:11
2023-02-27T01:23:11
20,716,199
0
0
null
null
null
null
UTF-8
Java
false
false
2,393
java
package heelenyc.soar.consumer.remote.tcp.coder; import heelenyc.soar.core.api.bean.ProtocolToken; import heelenyc.soar.core.api.bean.ResponseBytePacket; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ReplayingDecoder; import java.util.List; /** * @author yicheng * @since 2016年1月11日 * */ public class TcpResponseDecoder extends ReplayingDecoder<TcpProtocolState> { //private Logger logger = LoggerFactory.getLogger(this.getClass()); /** Decoded command and arguments */ private byte[] headBuffer; private byte[] bodyBuffer; private int BODY_LEN; public TcpResponseDecoder() { super(TcpProtocolState.TO_READ_HEADER); } /** * Decode in block-io style, rather than nio. because reps protocol has a * dynamic body len */ @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception { switch (state()) { case TO_READ_HEADER: // header 长度固定 headBuffer = new byte[ProtocolToken.HEADER_LENGTH]; in.readBytes(headBuffer); checkpoint(TcpProtocolState.TO_READ_BODY); // 获取长度 BODY_LEN = ((headBuffer[1] & 0x000000ff) << 8) + (headBuffer[2] & 0x000000ff); break; case TO_READ_BODY: bodyBuffer = new byte[BODY_LEN]; in.readBytes(bodyBuffer); // 全部完成 // 回归初始状态 checkpoint(TcpProtocolState.TO_READ_HEADER); // 处理后续 out.add(new ResponseBytePacket(headBuffer,bodyBuffer)); BODY_LEN = 0; headBuffer = null; bodyBuffer = null; break; default: throw new IllegalStateException("invalide state default!"); } } // /** // * 读取字符型的int值,包括结尾的 \r\n // * @param in // * @return // */ // private int readInt(ByteBuf in) { // int integer = 0; // char c; // while ((c = (char) in.readByte()) != '\r') { // integer = (integer * 10) + (c - '0'); // } // // skip \n // if (in.readByte() != '\n') { // throw new IllegalStateException("Invalid number"); // } // return integer; // } }
e432452005397fcafd335442d5c5f774c4cae3e0
d9f40b2fb973b40d18b9f85fe53850a2138b4cfd
/miniMusic/src/MinMinMusicApp.java
92fc2411b005dab3c8e44ce05eba3cfbd1e50dfb
[]
no_license
pengyu-wang/miniMusic
cfce4e6eace9ff3850a7998ea8500553e9c479a9
6c756ada4faec60c8bd3b7d6b3a899c1f3c2bea5
refs/heads/master
2022-11-13T07:58:05.383757
2020-07-01T04:47:56
2020-07-01T04:47:56
276,203,044
0
1
null
null
null
null
UTF-8
Java
false
false
949
java
import javax.sound.midi.*; public class MinMinMusicApp { public static void main(String[] args){ MinMinMusicApp mini = new MinMinMusicApp(); mini.play(); } public void play(){ try{ Sequencer player = MidiSystem.getSequencer(); player.open(); Sequence seq = new Sequence(Sequence.PPQ,4); Track track = seq.createTrack(); ShortMessage a = new ShortMessage(); a.setMessage(192,1,102,0); MidiEvent noteOn = new MidiEvent(a,1); track.add(noteOn); ShortMessage b = new ShortMessage(); // testing git 2 a.setMessage(128,2,44,100); MidiEvent noteOff = new MidiEvent(b,16); track.add(noteOff); player.setSequence(seq); player.start(); } catch (Exception ex) { ex.printStackTrace(); // testing github desktop } } }
a5ddf84aa614966f72cef2929f602790f436581b
a16446b6bc90ae71cc8ba1c7dff87a61d29fc155
/src/main/java/com/github/yukon39/bsl/debugserver/debugee/debugBaseData/BSLModuleIdInternalStr.java
e9253e99e4b8db66375f13e16f5e167dcc22876d
[ "MIT" ]
permissive
khorevaa/bsl-debug-server
df222e7db44cf21a16f2c13d5614007a02a8548d
1123ea35782c353c08055049849631d92101347f
refs/heads/master
2022-11-24T00:06:01.710839
2020-07-25T17:42:42
2020-07-25T17:42:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
132
java
package com.github.yukon39.bsl.debugserver.debugee.debugBaseData; public class BSLModuleIdInternalStr { public char[] value; }
3b80c097117e51dc96ca7c9c03bffc43b2db946b
d9e0f846d42517dd4e21cb7c91e48e73f360483a
/Progtech-design-patterns/builder/PizzaBuilder.java
42c90b3b988af628e2ab3a48e85cd5bb001a00b7
[]
no_license
Kuran-Bertalan/Programming-technologies
728392756f631121e67475b0d66df38dedbf6870
2cec46a1dcf06a7f64fe1e8129968fc457b622d4
refs/heads/main
2023-06-02T10:50:46.738639
2021-06-30T22:40:45
2021-06-30T22:40:45
381,848,971
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
package builder; import java.util.ArrayList; import java.util.List; public abstract class PizzaBuilder { String name; List<String> toppings = new ArrayList<String>(); public abstract PizzaBuilder addCheese(); public abstract PizzaBuilder addSauce(); public abstract PizzaBuilder addTomatoes(); public abstract PizzaBuilder addGarlic(); public abstract PizzaBuilder addOlives(); public abstract PizzaBuilder addSpinach(); public abstract PizzaBuilder addPepperoni(); public abstract PizzaBuilder addSausage(); public Pizza build() { Pizza pizza = new Pizza(); pizza.setName(this.name); pizza.addToppings(toppings); return pizza; } }
38c169116ad9eb6efccc28a5a152ce5185eaff56
e6da5c0241a7c890c9faba8f868538eedcdcca14
/ElectroCom/src/main/java/com/is/ElectroCom/controllers/HomeController.java
03d9c7b806b3178a101e33afdab40dddecea23f9
[]
no_license
LorandHalasz/ElectroCom
a7cc21b1506dd7ad9a8294d134288f83d5187172
3305b05054f4084cf2d463f521815b15afcb0668
refs/heads/master
2021-10-24T11:14:35.791842
2019-03-25T13:21:47
2019-03-25T13:21:47
176,928,733
0
0
null
null
null
null
UTF-8
Java
false
false
1,378
java
package com.is.ElectroCom.controllers; import com.is.ElectroCom.services.InterfaceUserService; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; // clasa HomeController se utilizeaza pentru a rezolva request-urile de tip GET si POST @Controller public class HomeController { private InterfaceUserService userService; public HomeController(InterfaceUserService userService) { this.userService = userService; } // Metoda care se utilizeaza in momentul in care un utilizator doreste sa acceseze pagina de home a aplicatiei @RequestMapping(value = {"", "/home"},method = RequestMethod.GET) public String setActualUser(Model model){ model.addAttribute("actualUser",userService.getActualUser()); if(userService.getActualUser().getRole().equals("Admin")) model.addAttribute("admin", true); else model.addAttribute("notAdmin", true); return "home"; } // Metoda care se utilizeaza in momentul in care un utilizator doreste sa se delogheze din aplicatie @RequestMapping(value = {"/logout"}, method = RequestMethod.POST) public String logout(){ userService.logout(); return "redirect:/login"; } }
3e5c165d19df5d7eb5c752f3228b173f76ef2758
2474f0681788ef6005cf682e837dad9950d8791a
/downloadmanagerlib/src/main/java/git/dzc/downloadmanagerlib/download/DownloadManager.java
fd679e022c2bd40f77ee96e6dedcecd6f8204c4a
[]
no_license
nongliangbo/DownloadManager
e54eeb32d89385f633370d138e6ba8b9c6bcb715
0c314000c0eba557c03c74cae4026ec221d3be03
refs/heads/master
2021-01-22T06:48:54.177666
2016-02-10T06:51:41
2016-02-10T06:51:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,579
java
package git.dzc.downloadmanagerlib.download; import android.content.Context; import android.util.Log; import okhttp3.OkHttpClient; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ScheduledExecutorService; /** * Created by dzc on 15/11/21. */ public class DownloadManager { private static final String TAG = "DownloadManager"; private Context context; private static DownloadManager downloadManager; private static DownloadDao downloadDao; private int mPoolSize = 5; private ExecutorService executorService; private Map<String,Future> futureMap; private OkHttpClient client; public Map<String, DownloadTask> getCurrentTaskList() { return currentTaskList; } private Map<String,DownloadTask> currentTaskList = new HashMap<>(); public void init(){ executorService = Executors.newFixedThreadPool(mPoolSize); futureMap = new HashMap<>(); DaoMaster.OpenHelper openHelper = new DaoMaster.DevOpenHelper(context,"downloadDB",null); DaoMaster daoMaster = new DaoMaster(openHelper.getWritableDatabase()); downloadDao = daoMaster.newSession().getDownloadDao(); client = new OkHttpClient(); } private DownloadManager() { init(); } private DownloadManager(Context context) { this.context = context; init(); } public static DownloadManager getInstance(Context context){ if(downloadManager==null){ downloadManager = new DownloadManager(context); } return downloadManager; } public void addDownloadTask(DownloadTask task,DownloadTaskListener listenr){ if(null!=currentTaskList.get(task.getId())&&task.getDownloadStatus()!=DownloadStatus.DOWNLOAD_STATUS_INIT){ Log.d(TAG,"task already exist"); return ; } currentTaskList.put(task.getId(), task); task.setDownloadStatus(DownloadStatus.DOWNLOAD_STATUS_PREPARE); task.setDownloadDao(downloadDao); task.setHttpClient(client); task.addDownloadListener(listenr); Future future = executorService.submit(task); futureMap.put(task.getId(),future); } public void addDownloadListener(DownloadTask task,DownloadTaskListener listener){ task.addDownloadListener(listener); } public void removeDownloadListener(DownloadTask task,DownloadTaskListener listener){ task.removeDownloadListener(listener); } public void addDownloadTask(DownloadTask task){ addDownloadTask(task, null); } public void cancel(DownloadTask task){ task.setDownloadStatus(DownloadStatus.DOWNLOAD_STATUS_CANCEL); } public List<DownloadDBEntity> loadAllDownloadEntityFromDB(){ return downloadDao.loadAll(); } public List<DownloadTask> loadAllDownloadTaskFromDB(){ List<DownloadDBEntity> list = loadAllDownloadEntityFromDB(); List<DownloadTask> downloadTaskList = null; if(list!=null&&!list.isEmpty()){ downloadTaskList = new ArrayList<>(); for(DownloadDBEntity entity:list){ downloadTaskList.add(DownloadTask.parse(entity)); } } return downloadTaskList; } public DownloadTask getTaskById(String taskId){ return currentTaskList.get(taskId); } }
90a7d7b381b5566601dac36a290dc0333e488e81
97d3d7f2bac36415d1cbc00b29a921e748ad7b03
/APP/Fairy_Commie/app/src/main/java/com/example/hoyoung/fairy_commie/MainActivity.java
f4b2adc0bc13411114304e47bc327a7c6dfd72d7
[]
no_license
Jdud913/CDP_02
983e79e1d50c52be839851e869e2ca8d28c76b17
681e899c0c939dff3a65b87cfa7a551e69a3cf41
refs/heads/master
2021-01-21T04:32:40.589271
2016-07-12T07:46:20
2016-07-12T07:46:20
53,565,059
1
0
null
null
null
null
UTF-8
Java
false
false
497
java
package com.example.hoyoung.fairy_commie; import android.os.Bundle; import com.nhn.android.maps.NMapActivity; import com.nhn.android.maps.NMapView; public class MainActivity extends NMapActivity implements NMapView.OnMapStateChangeListener, NMapView.OnMapViewTouchEventListener{ public static final String API_KEY = @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
55294e8fbc23f71b4d72b4ce386e7d5feb584b33
de6476190412c92d545e8b6da22b30c69bb0326b
/app/src/main/java/id/web/owob/loginform/data/LoginRepository.java
066e97fcd5f186b97c700d6f4ffd21f80cae6dd0
[]
no_license
parcox/LoginForm
fec4e8b8b4966ac4ac3cacef4180cb18b735d8d0
cbe9dca44122d55dffcd4f409657f350a3dfff06
refs/heads/master
2022-09-08T18:10:53.616340
2020-06-02T00:11:36
2020-06-02T00:11:36
268,660,588
0
0
null
null
null
null
UTF-8
Java
false
false
1,713
java
package id.web.owob.loginform.data; import id.web.owob.loginform.data.model.LoggedInUser; /** * Class that requests authentication and user information from the remote data source and * maintains an in-memory cache of login status and user credentials information. */ public class LoginRepository { private static volatile LoginRepository instance; private LoginDataSource dataSource; // If user credentials will be cached in local storage, it is recommended it be encrypted // @see https://developer.android.com/training/articles/keystore private LoggedInUser user = null; // private constructor : singleton access private LoginRepository(LoginDataSource dataSource) { this.dataSource = dataSource; } public static LoginRepository getInstance(LoginDataSource dataSource) { if (instance == null) { instance = new LoginRepository(dataSource); } return instance; } public boolean isLoggedIn() { return user != null; } public void logout() { user = null; dataSource.logout(); } private void setLoggedInUser(LoggedInUser user) { this.user = user; // If user credentials will be cached in local storage, it is recommended it be encrypted // @see https://developer.android.com/training/articles/keystore } public Result<LoggedInUser> login(String username, String password) { // handle login Result<LoggedInUser> result = dataSource.login(username, password); if (result instanceof Result.Success) { setLoggedInUser(((Result.Success<LoggedInUser>) result).getData()); } return result; } }
7e294fbfe06f8c573eba883ae0951a7b37f9d032
4aa90348abcb2119011728dc067afd501f275374
/app/src/main/java/com/tencent/mm/plugin/appbrand/jsapi/audio/JsApiOperateAudio$OperateAudioTask.java
df804f5397bc0b7c84bba4123adbd954d9dd01a6
[]
no_license
jambestwick/HackWechat
0d4ceb2d79ccddb45004ca667e9a6a984a80f0f6
6a34899c8bfd50d19e5a5ec36a58218598172a6b
refs/heads/master
2022-01-27T12:48:43.446804
2021-12-29T10:36:30
2021-12-29T10:36:30
249,366,791
0
0
null
2020-03-23T07:48:32
2020-03-23T07:48:32
null
UTF-8
Java
false
false
6,768
java
package com.tencent.mm.plugin.appbrand.jsapi.audio; import android.os.Parcel; import android.os.Parcelable.Creator; import com.tencent.mm.ac.a; import com.tencent.mm.ac.b; import com.tencent.mm.g.a.s; import com.tencent.mm.plugin.appbrand.ipc.MainProcessTask; import com.tencent.mm.plugin.appbrand.j; import com.tencent.mm.plugin.appbrand.jsapi.e; import com.tencent.mm.sdk.platformtools.x; final class JsApiOperateAudio$OperateAudioTask extends MainProcessTask { public static final Creator<JsApiOperateAudio$OperateAudioTask> CREATOR = new 1(); public String appId = ""; public String fnF = ""; public int fnG = 0; public String hkD = ""; public String iEa; private e jcL; public j jcM; public int jcN; public boolean jeA = false; public String jeK = ""; public String jeL; public String jey; public String processName = ""; public JsApiOperateAudio$OperateAudioTask(e eVar, j jVar, int i) { this.jcL = eVar; this.jcM = jVar; this.jcN = i; } public JsApiOperateAudio$OperateAudioTask(Parcel parcel) { f(parcel); } public final void Yr() { boolean z = false; x.i("MicroMsg.Audio.JsApiOperateAudio", "runInMainProcess"); x.i("MicroMsg.Audio.JsApiOperateAudio", "operationType;%s, currentTime:%d", new Object[]{this.jeK, Integer.valueOf(this.fnG)}); this.jeA = false; String str = this.jeK; if (str.equalsIgnoreCase("play")) { a iN = b.iN(this.fnF); if (iN == null) { x.e("MicroMsg.Audio.JsApiOperateAudio", "play operate, playParam is null"); iN = com.tencent.mm.plugin.appbrand.media.e.b(this.appId, this.fnF, this.hkD, this.jeL, this.iEa, this.processName); } String str2 = this.fnF; if (!b.iM(str2)) { z = b.a(str2, iN); } else if (b.iM(str2) && !b.iL(str2)) { z = b.a(str2, iN); } if (z) { x.i("MicroMsg.Audio.JsApiOperateAudio", "play audio ok"); } else if (b.iL(this.fnF)) { this.jeA = true; this.jey = "audio is playing, don't play again"; } else { this.jeA = true; this.jey = "play audio fail"; } } else if (str.equalsIgnoreCase("pause")) { str = this.fnF; if (b.iL(str)) { r0 = b.iK(str); } else { b.iK(str); r0 = false; } if (r0) { x.i("MicroMsg.Audio.JsApiOperateAudio", "pause audio ok"); } else { this.jeA = true; this.jey = "pause audio fail"; } } else if (str.equalsIgnoreCase("seek")) { if (this.fnG < 0) { x.e("MicroMsg.Audio.JsApiOperateAudio", "currentTime %d is invalid!", new Object[]{Integer.valueOf(this.fnG)}); this.jeA = true; this.jey = "currentTime is invalid"; } else { x.i("MicroMsg.AudioPlayerHelper", "seekToAudio, audioId:%s, currentTime:%d", new Object[]{this.fnF, Integer.valueOf(this.fnG)}); com.tencent.mm.sdk.b.b sVar = new s(); sVar.fnD.action = 4; sVar.fnD.fnF = str; sVar.fnD.fnG = r1; com.tencent.mm.sdk.b.a.xef.m(sVar); if (sVar.fnE.fnI) { x.i("MicroMsg.Audio.JsApiOperateAudio", "seek audio ok"); } else { this.jeA = true; this.jey = "seek audio fail"; } } } else if (str.equalsIgnoreCase("stop")) { str = this.fnF; com.tencent.mm.sdk.b.b sVar2 = new s(); sVar2.fnD.action = 13; sVar2.fnD.fnF = str; com.tencent.mm.sdk.b.a.xef.m(sVar2); if (sVar2.fnE.fnI) { x.i("MicroMsg.AudioPlayerHelper", "stopAudioOnBackground, audioId:%s", new Object[]{str}); sVar2 = new s(); sVar2.fnD.action = 14; sVar2.fnD.fnF = str; com.tencent.mm.sdk.b.a.xef.m(sVar2); r0 = sVar2.fnE.fnI; } else { sVar2 = new s(); sVar2.fnD.action = 17; sVar2.fnD.fnF = str; com.tencent.mm.sdk.b.a.xef.m(sVar2); if (sVar2.fnE.fnI) { r0 = true; } else { x.i("MicroMsg.AudioPlayerHelper", "stopAudio, audioId:%s", new Object[]{str}); sVar2 = new s(); sVar2.fnD.action = 3; sVar2.fnD.fnF = str; com.tencent.mm.sdk.b.a.xef.m(sVar2); r0 = sVar2.fnE.fnI; } } if (r0) { x.i("MicroMsg.Audio.JsApiOperateAudio", "stop audio ok"); } else { this.jeA = true; this.jey = "stop audio fail"; } } else { x.e("MicroMsg.Audio.JsApiOperateAudio", "operationType is invalid"); this.jeA = true; this.jey = "operationType is invalid"; } if (this.jeA) { x.e("MicroMsg.Audio.JsApiOperateAudio", this.jey); } afp(); } public final void Ys() { if (this.jcM == null) { x.e("MicroMsg.Audio.JsApiOperateAudio", "server is null"); } else if (this.jeA) { this.jcM.E(this.jcN, this.jcL.e("fail:" + this.jey, null)); } else { this.jcM.E(this.jcN, this.jcL.e("ok", null)); } } public final void f(Parcel parcel) { boolean z = true; this.appId = parcel.readString(); this.fnF = parcel.readString(); this.jeK = parcel.readString(); this.fnG = parcel.readInt(); if (parcel.readInt() != 1) { z = false; } this.jeA = z; this.jey = parcel.readString(); this.jeL = parcel.readString(); this.iEa = parcel.readString(); this.processName = parcel.readString(); this.hkD = parcel.readString(); } public final void writeToParcel(Parcel parcel, int i) { parcel.writeString(this.appId); parcel.writeString(this.fnF); parcel.writeString(this.jeK); parcel.writeInt(this.fnG); parcel.writeInt(this.jeA ? 1 : 0); parcel.writeString(this.jey); parcel.writeString(this.jeL); parcel.writeString(this.iEa); parcel.writeString(this.processName); parcel.writeString(this.hkD); } }
68c9f98774f07aaec7cc64e0d7db8f40aecfc117
f0d64469db210ae08b7a2786c9818bc5ed1ea307
/FinalyearProject.editor/src/finalYearName/presentation/FinalYearNameModelWizard.java
793d6d687062cea12a3595f5aeff2752be44b0bb
[]
no_license
Skoutellas69/finalYearProject
9d96812ce9021906befceea3f545c32f6195bcf7
ba8329e064762e25c155279f27c13142e1498d69
refs/heads/master
2016-08-12T12:26:58.479255
2016-04-22T17:57:16
2016-04-22T17:57:16
55,364,992
0
0
null
null
null
null
UTF-8
Java
false
false
18,389
java
/** */ package finalYearName.presentation; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.MissingResourceException; import java.util.StringTokenizer; import org.eclipse.emf.common.CommonPlugin; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.Wizard; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.INewWizard; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.part.ISetSelectionTarget; import finalYearName.FinalYearNameFactory; import finalYearName.FinalYearNamePackage; import finalYearName.provider.MyEditPlugin; import org.eclipse.core.runtime.Path; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; /** * This is a simple wizard for creating a new model file. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class FinalYearNameModelWizard extends Wizard implements INewWizard { /** * The supported extensions for created files. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final List<String> FILE_EXTENSIONS = Collections.unmodifiableList(Arrays.asList(MyEditorPlugin.INSTANCE.getString("_UI_FinalYearNameEditorFilenameExtensions").split("\\s*,\\s*"))); /** * A formatted list of supported file extensions, suitable for display. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static final String FORMATTED_FILE_EXTENSIONS = MyEditorPlugin.INSTANCE.getString("_UI_FinalYearNameEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", "); /** * This caches an instance of the model package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FinalYearNamePackage finalYearNamePackage = FinalYearNamePackage.eINSTANCE; /** * This caches an instance of the model factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FinalYearNameFactory finalYearNameFactory = finalYearNamePackage.getFinalYearNameFactory(); /** * This is the file creation page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FinalYearNameModelWizardNewFileCreationPage newFileCreationPage; /** * This is the initial object creation page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected FinalYearNameModelWizardInitialObjectCreationPage initialObjectCreationPage; /** * Remember the selection during initialization for populating the default container. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IStructuredSelection selection; /** * Remember the workbench during initialization. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IWorkbench workbench; /** * Caches the names of the types that can be created as the root object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected List<String> initialObjectNames; /** * This just records the information. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; this.selection = selection; setWindowTitle(MyEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(MyEditorPlugin.INSTANCE.getImage("full/wizban/NewFinalYearName"))); } /** * Returns the names of the types that can be created as the root object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<String> getInitialObjectNames() { if (initialObjectNames == null) { initialObjectNames = new ArrayList<String>(); for (EClassifier eClassifier : finalYearNamePackage.getEClassifiers()) { if (eClassifier instanceof EClass) { EClass eClass = (EClass)eClassifier; if (!eClass.isAbstract()) { initialObjectNames.add(eClass.getName()); } } } Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator()); } return initialObjectNames; } /** * Create a new model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EObject createInitialModel() { EClass eClass = (EClass)finalYearNamePackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); EObject rootObject = finalYearNameFactory.create(eClass); return rootObject; } /** * Do the work after everything is specified. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean performFinish() { try { // Remember the file. // final IFile modelFile = getModelFile(); // Do the work within an operation. // WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { @Override protected void execute(IProgressMonitor progressMonitor) { try { // Create a resource set // ResourceSet resourceSet = new ResourceSetImpl(); // Get the URI of the model file. // URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); // Create a resource for this file. // Resource resource = resourceSet.createResource(fileURI); // Add the initial model object to the contents. // EObject rootObject = createInitialModel(); if (rootObject != null) { resource.getContents().add(rootObject); } // Save the contents of the resource to the file system. // Map<Object, Object> options = new HashMap<Object, Object>(); options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); resource.save(options); } catch (Exception exception) { MyEditorPlugin.INSTANCE.log(exception); } finally { progressMonitor.done(); } } }; getContainer().run(false, false, operation); // Select the new file resource in the current view. // IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); IWorkbenchPage page = workbenchWindow.getActivePage(); final IWorkbenchPart activePart = page.getActivePart(); if (activePart instanceof ISetSelectionTarget) { final ISelection targetSelection = new StructuredSelection(modelFile); getShell().getDisplay().asyncExec (new Runnable() { public void run() { ((ISetSelectionTarget)activePart).selectReveal(targetSelection); } }); } // Open an editor on the new file. // try { page.openEditor (new FileEditorInput(modelFile), workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); } catch (PartInitException exception) { MessageDialog.openError(workbenchWindow.getShell(), MyEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); return false; } return true; } catch (Exception exception) { MyEditorPlugin.INSTANCE.log(exception); return false; } } /** * This is the one page of the wizard. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class FinalYearNameModelWizardNewFileCreationPage extends WizardNewFileCreationPage { /** * Pass in the selection. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FinalYearNameModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { super(pageId, selection); } /** * The framework calls this to see if the file is correct. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected boolean validatePage() { if (super.validatePage()) { String extension = new Path(getFileName()).getFileExtension(); if (extension == null || !FILE_EXTENSIONS.contains(extension)) { String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension"; setErrorMessage(MyEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); return false; } return true; } return false; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IFile getModelFile() { return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); } } /** * This is the page where the type of object to create is selected. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class FinalYearNameModelWizardInitialObjectCreationPage extends WizardPage { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Combo initialObjectField; /** * @generated * <!-- begin-user-doc --> * <!-- end-user-doc --> */ protected List<String> encodings; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Combo encodingField; /** * Pass in the selection. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FinalYearNameModelWizardInitialObjectCreationPage(String pageId) { super(pageId); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void createControl(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); { GridLayout layout = new GridLayout(); layout.numColumns = 1; layout.verticalSpacing = 12; composite.setLayout(layout); GridData data = new GridData(); data.verticalAlignment = GridData.FILL; data.grabExcessVerticalSpace = true; data.horizontalAlignment = GridData.FILL; composite.setLayoutData(data); } Label containerLabel = new Label(composite, SWT.LEFT); { containerLabel.setText(MyEditorPlugin.INSTANCE.getString("_UI_ModelObject")); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; containerLabel.setLayoutData(data); } initialObjectField = new Combo(composite, SWT.BORDER); { GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; initialObjectField.setLayoutData(data); } for (String objectName : getInitialObjectNames()) { initialObjectField.add(getLabel(objectName)); } if (initialObjectField.getItemCount() == 1) { initialObjectField.select(0); } initialObjectField.addModifyListener(validator); Label encodingLabel = new Label(composite, SWT.LEFT); { encodingLabel.setText(MyEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; encodingLabel.setLayoutData(data); } encodingField = new Combo(composite, SWT.BORDER); { GridData data = new GridData(); data.horizontalAlignment = GridData.FILL; data.grabExcessHorizontalSpace = true; encodingField.setLayoutData(data); } for (String encoding : getEncodings()) { encodingField.add(encoding); } encodingField.select(0); encodingField.addModifyListener(validator); setPageComplete(validatePage()); setControl(composite); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ModifyListener validator = new ModifyListener() { public void modifyText(ModifyEvent e) { setPageComplete(validatePage()); } }; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected boolean validatePage() { return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { if (initialObjectField.getItemCount() == 1) { initialObjectField.clearSelection(); encodingField.setFocus(); } else { encodingField.clearSelection(); initialObjectField.setFocus(); } } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getInitialObjectName() { String label = initialObjectField.getText(); for (String name : getInitialObjectNames()) { if (getLabel(name).equals(label)) { return name; } } return null; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getEncoding() { return encodingField.getText(); } /** * Returns the label for the specified type name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected String getLabel(String typeName) { try { return MyEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); } catch(MissingResourceException mre) { MyEditorPlugin.INSTANCE.log(mre); } return typeName; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected Collection<String> getEncodings() { if (encodings == null) { encodings = new ArrayList<String>(); for (StringTokenizer stringTokenizer = new StringTokenizer(MyEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens(); ) { encodings.add(stringTokenizer.nextToken()); } } return encodings; } } /** * The framework calls this to create the contents of the wizard. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void addPages() { // Create a page, set the title, and the initial model file name. // newFileCreationPage = new FinalYearNameModelWizardNewFileCreationPage("Whatever", selection); newFileCreationPage.setTitle(MyEditorPlugin.INSTANCE.getString("_UI_FinalYearNameModelWizard_label")); newFileCreationPage.setDescription(MyEditorPlugin.INSTANCE.getString("_UI_FinalYearNameModelWizard_description")); newFileCreationPage.setFileName(MyEditorPlugin.INSTANCE.getString("_UI_FinalYearNameEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0)); addPage(newFileCreationPage); // Try and get the resource selection to determine a current directory for the file dialog. // if (selection != null && !selection.isEmpty()) { // Get the resource... // Object selectedElement = selection.iterator().next(); if (selectedElement instanceof IResource) { // Get the resource parent, if its a file. // IResource selectedResource = (IResource)selectedElement; if (selectedResource.getType() == IResource.FILE) { selectedResource = selectedResource.getParent(); } // This gives us a directory... // if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { // Set this for the container. // newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); // Make up a unique new name here. // String defaultModelBaseFilename = MyEditorPlugin.INSTANCE.getString("_UI_FinalYearNameEditorFilenameDefaultBase"); String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0); String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; } newFileCreationPage.setFileName(modelFilename); } } } initialObjectCreationPage = new FinalYearNameModelWizardInitialObjectCreationPage("Whatever2"); initialObjectCreationPage.setTitle(MyEditorPlugin.INSTANCE.getString("_UI_FinalYearNameModelWizard_label")); initialObjectCreationPage.setDescription(MyEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); addPage(initialObjectCreationPage); } /** * Get the file from the page. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public IFile getModelFile() { return newFileCreationPage.getModelFile(); } }
00dfce611d3e98ba8db0b4d6e4a53c975c589388
9febdc3e7b80db015d4c387eb2a1f91b393a2501
/app/src/main/java/com/alexzh/nestedtoolbartutorial/DetailFragment.java
281571f4a9ecfe7edf0b93cd3d87135b264f02d9
[]
no_license
AlexZhukovich/NestedToolbarTutorial
d4ed6abe6e98a98200b836660eb45dbdc9f217e8
059188af2948e59026ef99c2ab6452555ee4f033
refs/heads/master
2021-01-15T19:27:59.916777
2015-08-16T07:22:40
2015-08-16T07:22:40
40,800,085
36
7
null
null
null
null
UTF-8
Java
false
false
1,031
java
package com.alexzh.nestedtoolbartutorial; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class DetailFragment extends Fragment { public final static String COUNTRY = "country"; public static Fragment newInstance(String country) { Fragment fragment = new DetailFragment(); Bundle args = new Bundle(); args.putString(COUNTRY, country); fragment.setArguments(args); return fragment; } @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_detail, container, false); TextView mCountry = (TextView) rootView.findViewById(R.id.countryTextView); mCountry.setText(getArguments().getString(COUNTRY)); return rootView; } }
1d1966c4c375d19197d5829d220f379cc538ff40
49f110e3c4c8e35599b1b536b86cc50644dd88a7
/core/target/generated-sources/java/com/capitalone/dashboard/model/QJobCollectorItem.java
05fd96ec87bb1ae33b4af2d38182162b41f7108e
[ "Apache-2.0" ]
permissive
nag10/reposiatary
c40032f266d7887a437fcf7c7bc3a98df37121ad
7f8793dbe64bb3bcc90e316dea61971619550bfb
refs/heads/master
2021-01-02T08:22:39.019348
2017-08-18T07:50:44
2017-08-18T07:50:44
98,995,629
0
0
null
null
null
null
UTF-8
Java
false
false
2,720
java
package com.capitalone.dashboard.model; import static com.mysema.query.types.PathMetadataFactory.*; import com.mysema.query.types.path.*; import com.mysema.query.types.PathMetadata; import javax.annotation.Generated; import com.mysema.query.types.Path; import com.mysema.query.types.path.PathInits; /** * QJobCollectorItem is a Querydsl query type for JobCollectorItem */ @Generated("com.mysema.query.codegen.EntitySerializer") public class QJobCollectorItem extends EntityPathBase<JobCollectorItem> { private static final long serialVersionUID = 134142053L; private static final PathInits INITS = PathInits.DIRECT2; public static final QJobCollectorItem jobCollectorItem = new QJobCollectorItem("jobCollectorItem"); public final QCollectorItem _super; // inherited public final QCollector collector; // inherited public final org.bson.types.QObjectId collectorId; //inherited public final StringPath description; //inherited public final BooleanPath enabled; // inherited public final org.bson.types.QObjectId id; public final StringPath instanceUrl = createString("instanceUrl"); public final StringPath jobName = createString("jobName"); public final StringPath jobUrl = createString("jobUrl"); //inherited public final NumberPath<Long> lastUpdated; //inherited public final StringPath niceName; //inherited public final MapPath<String, Object, SimplePath<Object>> options; //inherited public final BooleanPath pushed; public QJobCollectorItem(String variable) { this(JobCollectorItem.class, forVariable(variable), INITS); } public QJobCollectorItem(Path<? extends JobCollectorItem> path) { this(path.getType(), path.getMetadata(), path.getMetadata().isRoot() ? INITS : PathInits.DEFAULT); } public QJobCollectorItem(PathMetadata<?> metadata) { this(metadata, metadata.isRoot() ? INITS : PathInits.DEFAULT); } public QJobCollectorItem(PathMetadata<?> metadata, PathInits inits) { this(JobCollectorItem.class, metadata, inits); } public QJobCollectorItem(Class<? extends JobCollectorItem> type, PathMetadata<?> metadata, PathInits inits) { super(type, metadata, inits); this._super = new QCollectorItem(type, metadata, inits); this.collector = _super.collector; this.collectorId = _super.collectorId; this.description = _super.description; this.enabled = _super.enabled; this.id = _super.id; this.lastUpdated = _super.lastUpdated; this.niceName = _super.niceName; this.options = _super.options; this.pushed = _super.pushed; } }
1a36b5f5a08dfbeb041b5a3baae759acedbb117e
fc7042b34d0e7a41c83359d80b4eb9965e9f5e21
/library/wisdomsdk/src/cn/com/incito/wisdom/sdk/image/loader/assist/LRUMemoryCacheBitmapCache.java
20eb435130c4c8f1455e98b17114b75ba2f96301
[]
no_license
junetigerlee/gradle-android-demo
c6b11d1cafced0c5850b105f90a72ea7ae8a517f
acc8920f5fc1bab2b4087990070a1d0970a4c0d2
refs/heads/master
2021-01-22T07:38:53.401555
2014-11-03T08:27:07
2014-11-03T08:27:07
25,800,520
1
0
null
null
null
null
UTF-8
Java
false
false
431
java
package cn.com.incito.wisdom.sdk.image.loader.assist; import android.graphics.Bitmap; import cn.com.incito.wisdom.sdk.cache.mem.model.LRUMemoryCache; public class LRUMemoryCacheBitmapCache extends LRUMemoryCache<String, Bitmap> { public LRUMemoryCacheBitmapCache(int sizeLimit) { super(sizeLimit); } @Override protected int getSize(Bitmap value) { return value.getRowBytes() * value.getHeight(); } }
c140470d6e401ca61bd161ffc9deeb12ddd17646
2c66aceb457cd9fd11da18aac727886b30787599
/src/main/java/moe/clienthax/pixelmonbridge/api/pixelmon/EVStore.java
e54cff831d8e6ec45a6ae46dd127e8b4ef568798
[]
no_license
AwesomeJustin1/PixelmonBridge2
9050acf7458958137aa5bddb5ee4b8ed633e8025
aad95195d8fda2b47b86adc8812eeaa0d0ea6a6c
refs/heads/master
2020-03-23T08:16:01.779380
2018-07-17T16:44:25
2018-07-17T16:44:25
141,317,307
0
1
null
2018-07-17T16:42:01
2018-07-17T16:42:01
null
UTF-8
Java
false
false
819
java
package moe.clienthax.pixelmonbridge.api.pixelmon; import com.pixelmonmod.pixelmon.entities.pixelmon.stats.EVsStore; import moe.clienthax.pixelmonbridge.api.catalog.stattype.StatType; /** * Created by Justin */ public interface EVStore extends Cloneable { void randomizeMaxEVs(); void fill(int... evs); int getAvailableEvs(); int get(StatType stat); void set(StatType stat, int val); void add(StatType stat, int val); boolean berry(StatType stat); boolean vitamin(StatType stat); int[] getArray(); /** * @param store the EVStore to combine with this one * @return this */ EVStore combine(EVStore store); default EVStore clone() { EVStore store = (EVStore) new EVsStore(); store.fill(getArray()); return store; } }
6c6df4682a6b087f97fb9827182aa7c3078436f6
2791eb30be2bd1be30b2621bc87c67038db2eaa7
/src/main/java/com/ail/narad/web/rest/MessagesendersResource.java
355036ccaa619999ce84bd0c24108a53079bae89
[]
no_license
amanjaiswal92/MessageService
5bc51f95a25550feaada79b4b909b042179a9780
5d0407683b621810d20797a0fe7f2f45caa9f660
refs/heads/master
2020-01-23T21:56:57.892109
2016-11-28T10:45:38
2016-11-28T10:45:38
74,727,230
0
0
null
null
null
null
UTF-8
Java
false
false
5,753
java
package com.ail.narad.web.rest; import com.codahale.metrics.annotation.Timed; import com.ail.narad.domain.Messagesenders; import com.ail.narad.repository.MessagesendersRepository; import com.ail.narad.repository.search.MessagesendersSearchRepository; import com.ail.narad.web.rest.util.HeaderUtil; import com.ail.narad.web.rest.util.PaginationUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; 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.*; import javax.inject.Inject; import javax.validation.Valid; import java.net.URI; import java.net.URISyntaxException; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.StreamSupport; import static org.elasticsearch.index.query.QueryBuilders.*; /** * REST controller for managing Messagesenders. */ @RestController @RequestMapping("/api") public class MessagesendersResource { private final Logger log = LoggerFactory.getLogger(MessagesendersResource.class); @Inject private MessagesendersRepository messagesendersRepository; @Inject private MessagesendersSearchRepository messagesendersSearchRepository; /** * POST /messagesenderss -> Create a new messagesenders. */ @RequestMapping(value = "/messagesenderss", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Messagesenders> createMessagesenders(@Valid @RequestBody Messagesenders messagesenders) throws URISyntaxException { log.debug("REST request to save Messagesenders : {}", messagesenders); if (messagesenders.getId() != null) { return ResponseEntity.badRequest().header("Failure", "A new messagesenders cannot already have an ID").body(null); } Messagesenders result = messagesendersRepository.save(messagesenders); messagesendersSearchRepository.save(result); return ResponseEntity.created(new URI("/api/messagesenderss/" + result.getId())) .headers(HeaderUtil.createEntityCreationAlert("messagesenders", result.getId().toString())) .body(result); } /** * PUT /messagesenderss -> Updates an existing messagesenders. */ @RequestMapping(value = "/messagesenderss", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Messagesenders> updateMessagesenders(@Valid @RequestBody Messagesenders messagesenders) throws URISyntaxException { log.debug("REST request to update Messagesenders : {}", messagesenders); if (messagesenders.getId() == null) { return createMessagesenders(messagesenders); } Messagesenders result = messagesendersRepository.save(messagesenders); messagesendersSearchRepository.save(messagesenders); return ResponseEntity.ok() .headers(HeaderUtil.createEntityUpdateAlert("messagesenders", messagesenders.getId().toString())) .body(result); } /** * GET /messagesenderss -> get all the messagesenderss. */ @RequestMapping(value = "/messagesenderss", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<List<Messagesenders>> getAllMessagesenderss(Pageable pageable) throws URISyntaxException { Page<Messagesenders> page = messagesendersRepository.findAll(pageable); HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/messagesenderss"); return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK); } /** * GET /messagesenderss/:id -> get the "id" messagesenders. */ @RequestMapping(value = "/messagesenderss/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Messagesenders> getMessagesenders(@PathVariable Long id) { log.debug("REST request to get Messagesenders : {}", id); return Optional.ofNullable(messagesendersRepository.findOne(id)) .map(messagesenders -> new ResponseEntity<>( messagesenders, HttpStatus.OK)) .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND)); } /** * DELETE /messagesenderss/:id -> delete the "id" messagesenders. */ @RequestMapping(value = "/messagesenderss/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public ResponseEntity<Void> deleteMessagesenders(@PathVariable Long id) { log.debug("REST request to delete Messagesenders : {}", id); messagesendersRepository.delete(id); messagesendersSearchRepository.delete(id); return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("messagesenders", id.toString())).build(); } /** * SEARCH /_search/messagesenderss/:query -> search for the messagesenders corresponding * to the query. */ @RequestMapping(value = "/_search/messagesenderss/{query}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) @Timed public List<Messagesenders> searchMessagesenderss(@PathVariable String query) { return StreamSupport .stream(messagesendersSearchRepository.search(queryStringQuery(query)).spliterator(), false) .collect(Collectors.toList()); } }
e37de2bd3495ff1e453d533edf4d0569475124fa
19ce8c033a9cdd5de6655f1a539341b114115c79
/koozi.web/src/be/koozi/sms/SMSService.java
87fb3acab330d270e4953db22f3ec582a6c960c5
[]
no_license
liseryang/koozi
3f5ba3612e0082e53ef9bf7bbaae3d4e14a2754e
31c6e5828cd78e0097b17ede6e113f4d9d979245
refs/heads/master
2021-01-13T01:30:31.203680
2011-01-17T21:42:41
2011-01-17T21:42:41
33,606,352
0
0
null
null
null
null
UTF-8
Java
false
false
89
java
package be.koozi.sms; public interface SMSService { SMSResult sendSMS(SMS sms); }
[ "tola2000@6bd4741a-bca6-ad91-aea1-ec8b5917003e" ]
tola2000@6bd4741a-bca6-ad91-aea1-ec8b5917003e
1dc686d8b25df2ec49e5d101cafae588c044dc08
7889dd8555f12ab5ef0e499ef1bc68dc23759f0e
/app/src/main/java/com/dicoding/submission/cocktailrecipe/Views/DetailItemActivity.java
ae48287a1c1c4c34438c57993c6fc85b2619bca0
[ "Apache-2.0" ]
permissive
natanhp/CocktailRecipe
0122797f603b11853d9fdc1baa9cff3ad27cc7c2
2e41f5a80d69166200ab592959db9d364616555b
refs/heads/master
2020-07-02T16:42:01.762642
2019-08-28T01:51:09
2019-08-28T01:51:09
201,592,435
0
0
null
null
null
null
UTF-8
Java
false
false
1,901
java
package com.dicoding.submission.cocktailrecipe.Views; import android.os.Bundle; import android.widget.ImageView; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import com.bumptech.glide.Glide; import com.bumptech.glide.request.RequestOptions; import com.dicoding.submission.cocktailrecipe.MainActivity; import com.dicoding.submission.cocktailrecipe.Models.CocktailModel; import com.dicoding.submission.cocktailrecipe.R; import java.util.List; import butterknife.BindView; import butterknife.BindViews; import butterknife.ButterKnife; public class DetailItemActivity extends AppCompatActivity { @BindViews({R.id.textView_ingredients, R.id.textView_how_to}) List<TextView> textViews; @BindView(R.id.imageView_coctail) ImageView imageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail_item); ButterKnife.bind(this); CocktailModel cocktailModel = getCocktail(); setTitle(cocktailModel.getName()); setViews(cocktailModel); } private CocktailModel getCocktail() { return getIntent().getParcelableExtra(MainActivity.EXTRA_COCTAIL); } private void setViews(CocktailModel cocktailModel) { Glide.with(this) .load(cocktailModel.getUriImage()) .into(imageView); StringBuilder tempString = new StringBuilder(); for (String ingredient : cocktailModel.getIngredients()) { tempString.append(ingredient).append("\n"); } textViews.get(0).setText(tempString.toString()); tempString = new StringBuilder(); for (String howTo : cocktailModel.getHowToMake()) { tempString.append(howTo).append("\n"); } textViews.get(1).setText(tempString.toString()); } }
7b6ceadedcdfdd8387798bb7be1e17dbab092a99
cec0c2fa585c3f788fc8becf24365e56bce94368
/net/minecraft/server/Bootstrap.java
abad50c9287e979d113404cba101e84d0c0b7f6b
[]
no_license
maksym-pasichnyk/Server-1.16.3-Remapped
358f3c4816cbf41e137947329389edf24e9c6910
4d992e2d9d4ada3ecf7cecc039c4aa0083bc461e
refs/heads/master
2022-12-15T08:54:21.236174
2020-09-19T16:13:43
2020-09-19T16:13:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,015
java
/* */ package net.minecraft.server; /* */ /* */ import java.io.PrintStream; /* */ import java.util.Set; /* */ import java.util.TreeSet; /* */ import java.util.function.Function; /* */ import net.minecraft.SharedConstants; /* */ import net.minecraft.commands.Commands; /* */ import net.minecraft.commands.arguments.selector.options.EntitySelectorOptions; /* */ import net.minecraft.commands.synchronization.ArgumentTypes; /* */ import net.minecraft.core.Registry; /* */ import net.minecraft.core.dispenser.DispenseItemBehavior; /* */ import net.minecraft.locale.Language; /* */ import net.minecraft.resources.ResourceLocation; /* */ import net.minecraft.tags.StaticTags; /* */ import net.minecraft.world.effect.MobEffect; /* */ import net.minecraft.world.entity.EntityType; /* */ import net.minecraft.world.entity.ai.attributes.Attribute; /* */ import net.minecraft.world.entity.ai.attributes.DefaultAttributes; /* */ import net.minecraft.world.item.Item; /* */ import net.minecraft.world.item.alchemy.PotionBrewing; /* */ import net.minecraft.world.item.enchantment.Enchantment; /* */ import net.minecraft.world.level.GameRules; /* */ import net.minecraft.world.level.block.Block; /* */ import net.minecraft.world.level.block.ComposterBlock; /* */ import net.minecraft.world.level.block.FireBlock; /* */ import org.apache.logging.log4j.LogManager; /* */ import org.apache.logging.log4j.Logger; /* */ /* */ public class Bootstrap { /* 31 */ public static final PrintStream STDOUT = System.out; /* */ /* */ private static boolean isBootstrapped; /* 34 */ private static final Logger LOGGER = LogManager.getLogger(); /* */ /* */ public static void bootStrap() { /* 37 */ if (isBootstrapped) { /* */ return; /* */ } /* 40 */ isBootstrapped = true; /* */ /* 42 */ if (Registry.REGISTRY.keySet().isEmpty()) { /* 43 */ throw new IllegalStateException("Unable to load registries"); /* */ } /* */ /* 46 */ FireBlock.bootStrap(); /* 47 */ ComposterBlock.bootStrap(); /* */ /* 49 */ if (EntityType.getKey(EntityType.PLAYER) == null) { /* 50 */ throw new IllegalStateException("Failed loading EntityTypes"); /* */ } /* */ /* 53 */ PotionBrewing.bootStrap(); /* */ /* 55 */ EntitySelectorOptions.bootStrap(); /* */ /* 57 */ DispenseItemBehavior.bootStrap(); /* */ /* 59 */ ArgumentTypes.bootStrap(); /* */ /* 61 */ StaticTags.bootStrap(); /* */ /* 63 */ wrapStreams(); /* */ } /* */ /* */ private static <T> void checkTranslations(Iterable<T> debug0, Function<T, String> debug1, Set<String> debug2) { /* 67 */ Language debug3 = Language.getInstance(); /* 68 */ debug0.forEach(debug3 -> { /* */ String debug4 = debug0.apply(debug3); /* */ if (!debug1.has(debug4)) { /* */ debug2.add(debug4); /* */ } /* */ }); /* */ } /* */ /* */ private static void checkGameruleTranslations(final Set<String> missing) { /* 77 */ final Language language = Language.getInstance(); /* 78 */ GameRules.visitGameRuleTypes(new GameRules.GameRuleTypeVisitor() /* */ { /* */ public <T extends GameRules.Value<T>> void visit(GameRules.Key<T> debug1, GameRules.Type<T> debug2) { /* 81 */ if (!language.has(debug1.getDescriptionId())) { /* 82 */ missing.add(debug1.getId()); /* */ } /* */ } /* */ }); /* */ } /* */ /* */ public static Set<String> getMissingTranslations() { /* 89 */ Set<String> debug0 = new TreeSet<>(); /* 90 */ checkTranslations((Iterable<?>)Registry.ATTRIBUTE, Attribute::getDescriptionId, debug0); /* 91 */ checkTranslations((Iterable<?>)Registry.ENTITY_TYPE, EntityType::getDescriptionId, debug0); /* 92 */ checkTranslations((Iterable<?>)Registry.MOB_EFFECT, MobEffect::getDescriptionId, debug0); /* 93 */ checkTranslations((Iterable<?>)Registry.ITEM, Item::getDescriptionId, debug0); /* 94 */ checkTranslations((Iterable<?>)Registry.ENCHANTMENT, Enchantment::getDescriptionId, debug0); /* 95 */ checkTranslations((Iterable<?>)Registry.BLOCK, Block::getDescriptionId, debug0); /* 96 */ checkTranslations((Iterable<?>)Registry.CUSTOM_STAT, debug0 -> "stat." + debug0.toString().replace(':', '.'), debug0); /* */ /* 98 */ checkGameruleTranslations(debug0); /* 99 */ return debug0; /* */ } /* */ /* */ public static void validate() { /* 103 */ if (!isBootstrapped) { /* 104 */ throw new IllegalArgumentException("Not bootstrapped"); /* */ } /* */ /* 107 */ if (SharedConstants.IS_RUNNING_IN_IDE) { /* 108 */ getMissingTranslations().forEach(debug0 -> LOGGER.error("Missing translations: " + debug0)); /* 109 */ Commands.validate(); /* */ } /* */ /* 112 */ DefaultAttributes.validate(); /* */ } /* */ /* */ private static void wrapStreams() { /* 116 */ if (LOGGER.isDebugEnabled()) { /* 117 */ System.setErr(new DebugLoggedPrintStream("STDERR", System.err)); /* 118 */ System.setOut(new DebugLoggedPrintStream("STDOUT", STDOUT)); /* */ } else { /* 120 */ System.setErr(new LoggedPrintStream("STDERR", System.err)); /* 121 */ System.setOut(new LoggedPrintStream("STDOUT", STDOUT)); /* */ } /* */ } /* */ /* */ public static void realStdoutPrintln(String debug0) { /* 126 */ STDOUT.println(debug0); /* */ } /* */ } /* Location: C:\Users\Josep\Downloads\Decompile Minecraft\deobfuscated.jar!\net\minecraft\server\Bootstrap.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
fede2c7f62e364508876384d568e694bc16d12fc
c74ab373e1d57f1a560cebde7a4c7832fa93ee8f
/src/view/Ajouter.java
33e10ae213342bd4dc0db3c6aab1f2249d18ea31
[]
no_license
Pi2f/Comparateur
e0aa2f293649c6b86a857e8beb5bd6ad1f3de5ee
bfe725c1b2b9f84017e2efcd6ea5804b53f21ca7
refs/heads/master
2021-09-06T22:32:30.946509
2018-02-12T16:44:58
2018-02-12T16:44:58
114,120,016
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,836
java
package view; import java.awt.Dimension; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.SQLException; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import controller.ConnexionBDD; /** * @author FRANC Pierre, GIBASSIER Romain * @version 1.0 * * Panneau qui permet la modification des bières de la BDD. */ @SuppressWarnings("serial") public class Ajouter extends JPanel{ private JButton jb1; private ConnexionBDD c; public Ajouter() { JLabel aj = new JLabel("Ajouter une Bière"); aj.setFont(new Font("Dialog",Font.BOLD,20)); add(aj); JLabel[] lajout = new JLabel[9]; String[] sAjout = {"Nom" ,"Marque","Pays","Prix","Degré","Couleur","Type de fermentation","Amertume","Douceur"}; JTextField[] iajout = new JTextField[9]; jb1 = new JButton("Ajouter"); jb1.setFont(new Font("Dialog",Font.BOLD,14)); for(int i = 0; i < 9; i++) { lajout[i] = new JLabel(sAjout[i]); iajout[i] = new JTextField(); iajout[i].setMaximumSize(new Dimension(500, 30)); lajout[i].setFont(new Font("Dialog",Font.PLAIN,18)); } jb1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { try { c = new ConnexionBDD(); c.ajouter(iajout[0].getText(), iajout[1].getText(), iajout[2].getText(), iajout[3].getText(), iajout[4].getText(), iajout[5].getText(), iajout[6].getText(), iajout[7].getText(), iajout[8].getText()); c.terminer(); } catch (SQLException e) { e.printStackTrace(); } for(int i = 0; i < 9; i++) { iajout[i].setText(""); } revalidate(); } }); for(int i = 0; i < 9; i++) { add(lajout[i]); add(iajout[i]); } add(jb1); } }
4e15a8ba03cf6861e41674ea074e66277b586615
bb56865277120b8cb3e94b390933fd80a31b935d
/SIDiM/src/com/kots/sidim/android/adapter/ImovelAdapter.java
581cc5ba41430fac7eae41325b9609ba3ac1fd49
[]
no_license
tcckots/TCC-Veris
0e0fe80f892460f25e95ef321bab1bde378db728
20c3bfabfcb19b29e767f567f543a189a50f9a9e
refs/heads/master
2021-01-18T22:47:14.000655
2012-12-03T19:35:58
2012-12-03T19:35:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,365
java
package com.kots.sidim.android.adapter; import java.text.DecimalFormat; import java.util.List; import com.kots.sidim.android.R; import com.kots.sidim.android.activities.VisualizarImovelActivity; import com.kots.sidim.android.model.ImovelMobile; import com.kots.sidim.android.util.DrawableConnectionManager; import com.kots.sidim.android.util.SessionUserSidim; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; public class ImovelAdapter extends BaseAdapter { private Context context; private List<ImovelMobile> imoveis; DrawableConnectionManager drawManager; public ImovelAdapter(Context context, List<ImovelMobile> imoveis){ this.context = context; this.imoveis = imoveis; drawManager = new DrawableConnectionManager(); } @Override public int getCount() { return imoveis.size(); } @Override public Object getItem(int arg0) { return imoveis.get(arg0); } @Override public long getItemId(int arg0) { return arg0; } @Override public View getView(int arg0, View arg1, ViewGroup arg2) { // // if(arg1 != null){ // return arg1; // } // final ImovelMobile imovel = imoveis.get(arg0); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if(arg1 == null){ arg1 = inflater.inflate(R.layout.item_list, null); } TextView txtTitleContent = (TextView) arg1.findViewById(R.id.favorItemInputTitle); txtTitleContent.setText(imovel.getBairro().getNome() + ", " + imovel.getTipoImovel().getDescricao() + " - " + imovel.getDormitorios() + " Dorm"); TextView txtDescriptionContent = (TextView) arg1.findViewById(R.id.favorItemInputCity); txtDescriptionContent.setText(imovel.getCidade().getNome() + "-" + imovel.getCidade().getEstado().getUf()); DecimalFormat df = new DecimalFormat("###,###,###.00"); TextView txtPreco = (TextView) arg1.findViewById(R.id.favorItemInputPrice); String preco = ""; if(imovel.getIntencao().equals("C")){ if(imovel.getPreco().doubleValue() == 0){ preco = "Compra: Entre em contato"; } else { preco = "Compra: R$ " + df.format(imovel.getPreco().doubleValue()); } txtPreco.setText(preco); } else { if(imovel.getPreco().doubleValue() == 0){ preco = "Aluga: Entre em contato"; } else { preco = "Aluga: R$ " + df.format(imovel.getPreco().doubleValue()); } txtPreco.setText(preco); } ImageView imgPreview = (ImageView) arg1.findViewById(R.id.favorItemImgFoto); imgPreview.setImageResource(R.drawable.carregandofoto2); if(imovel.getFotos() != null & imovel.getFotos().size() > 0){ if(SessionUserSidim.images.containsKey(imovel.getFotos().get(0))){ imgPreview.setImageBitmap(SessionUserSidim.images.get(imovel.getFotos().get(0))); } else { drawManager.fetchDrawableOnThread(imovel.getFotos().get(0), imgPreview); } } RelativeLayout linearDescription = (RelativeLayout) arg1.findViewById(R.id.favorItemLayoutDesc); linearDescription.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, VisualizarImovelActivity.class); intent.putExtra("imoveldetalhes", imovel); context.startActivity(intent); } }); FrameLayout layoutPreview = (FrameLayout) arg1.findViewById(R.id.favorItemLayoutImg); layoutPreview.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(context, VisualizarImovelActivity.class); intent.putExtra("imoveldetalhes", imovel); context.startActivity(intent); } }); return arg1; } }
8fd378c14fd4b140cfb3624e163cd9b06be79f4f
5b57ac5acab8bf8340993a990ec04cca16646557
/Leetcode 099 - Recover Binary Search Tree.java
84bb837c7e703f92bf034bc2a2e779fa72e0b1c2
[]
no_license
yuweiw823/algorithm-practice
56e7b3452c9dccf1389f79fdbd72c5f15f7b91c0
7c7dc880001df37c636783812be30a9b535b9a45
refs/heads/master
2021-05-01T00:42:50.471956
2019-02-13T08:40:03
2019-02-13T08:40:03
44,027,987
4
4
null
null
null
null
UTF-8
Java
false
false
958
java
Leetcode 099 - Recover Binary Search Tree.java public class Solution { public void recoverTree(TreeNode root) { List<TreeNode> record = new ArrayList<TreeNode>(); List<TreeNode> pre = new ArrayList<TreeNode>(); pre.add(null); helper(root, record, pre); if(record.size()>0){ int temp = record.get(0).val; record.get(0).val = record.get(1).val; record.get(1).val = temp; } } public void helper(TreeNode root, List<TreeNode> record, List<TreeNode> pre){ if(root == null) return; helper(root.left, record, pre); if(pre.get(0) != null && pre.get(0).val > root.val){ if(record.size()==0){ record.add(pre.get(0)); record.add(root); }else{ record.set(1, root); } } pre.set(0, root); helper(root.right, record, pre); } }
4dae8a6edf217d8964c251417f95c1d66be8a3a5
ee02dc85904354fcd50d92dfff8dafba05ccd41f
/Arnold/src/com/arnold/server/model/base/BaseVillagerIndustryIncomeHappen.java
095551b999cccc4765ffb291eb1ce7b9f304ea2b
[]
no_license
ChasonTurner/account
7c8610ac114ad13a052b4145a0ef19784278dea8
ef26eb67976256b64621351b1c9c12402cf16e71
refs/heads/master
2021-09-12T22:53:43.057252
2018-04-22T04:22:07
2018-04-22T04:22:07
103,828,340
0
0
null
null
null
null
UTF-8
Java
false
false
1,546
java
package com.arnold.server.model.base; import com.jfinal.plugin.activerecord.Model; import com.jfinal.plugin.activerecord.IBean; /** * Generated by JFinal, do not modify this file. */ @SuppressWarnings("serial") public abstract class BaseVillagerIndustryIncomeHappen<M extends BaseVillagerIndustryIncomeHappen<M>> extends Model<M> implements IBean { public void setId(java.lang.String id) { set("id", id); } public java.lang.String getId() { return get("id"); } public void setVillagerId(java.lang.String villagerId) { set("villagerId", villagerId); } public java.lang.String getVillagerId() { return get("villagerId"); } public void setIndustryId(java.lang.String industryId) { set("industryId", industryId); } public java.lang.String getIndustryId() { return get("industryId"); } public void setIncomeTime(java.util.Date incomeTime) { set("incomeTime", incomeTime); } public java.util.Date getIncomeTime() { return get("incomeTime"); } public void setIncome(java.lang.Double income) { set("income", income); } public java.lang.Double getIncome() { return get("income"); } public void setCreateUserId(java.lang.String createUserId) { set("createUserId", createUserId); } public java.lang.String getCreateUserId() { return get("createUserId"); } public void setCreateTime(java.util.Date createTime) { set("createTime", createTime); } public java.util.Date getCreateTime() { return get("createTime"); } }
[ "Administrator@PC201605051440" ]
Administrator@PC201605051440
29218b000fa3372531fed693f914fedd4247071e
4e8fbbe30f17a92e8101f2c43d77a4dd0c951f8f
/SSM框架整合/3.Spring MVC初体验/6.SSM整合开发办公系统核心模块/源码/oa/oa_dao/src/main/java/com/imooc/oa/dao/DealRecordDao.java
d3e1b4bf99c29827c8fa2f769d6d5f62b375c442
[]
no_license
ARainyNight/TheRoadOfBaldness
d75b9c8934807ebdd26125bf72d7b6d78c6177f6
225c70090fbe6281551f9879f3ab13f56eea5138
refs/heads/master
2021-07-05T12:55:11.171062
2019-04-16T04:18:11
2019-04-16T04:18:11
148,400,416
2
0
null
null
null
null
UTF-8
Java
false
false
299
java
package com.imooc.oa.dao; import com.imooc.oa.entity.DealRecord; import org.springframework.stereotype.Repository; import java.util.List; @Repository("dealRecordDao") public interface DealRecordDao { void insert(DealRecord dealRecord); List<DealRecord> selectByClaimVoucher(int cvid); }
916add369634bd3856a1bb44e24d413284bb6da1
dd47ae2d40b0eaa2ed5679af5b545147c047e636
/common/src/main/java/com/hmdm/rest/json/LinkConfigurationsToAppRequest.java
9948df3829423d3ef20ee5dfaa234302bb4a57b7
[ "Apache-2.0" ]
permissive
rrymm/hmdm-server
f23a018373dff5aa4ca37244f432e048f2de3cc5
aadf5dfcb9f3235f46e0a3297537b5876f048abd
refs/heads/master
2020-07-28T01:03:25.588554
2019-09-05T10:00:23
2019-09-05T10:00:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,967
java
/* * * Headwind MDM: Open Source Android MDM Software * https://h-mdm.com * * Copyright (C) 2019 Headwind Solutions LLC (http://h-sms.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.hmdm.rest.json; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import java.util.List; @ApiModel(description = "A request to setup links between the single application and listed configurations") @JsonIgnoreProperties(ignoreUnknown = true) public class LinkConfigurationsToAppRequest { @ApiModelProperty("An ID of an application to link configurations to") private int applicationId; @ApiModelProperty("A list of configurations to link to application") private List<ApplicationConfigurationLink> configurations; /** * <p>Constructs new <code>LinkConfigurationsToAppRequest</code> instance. This implementation does nothing.</p> */ public LinkConfigurationsToAppRequest() { } public int getApplicationId() { return applicationId; } public void setApplicationId(int applicationId) { this.applicationId = applicationId; } public List<ApplicationConfigurationLink> getConfigurations() { return configurations; } public void setConfigurations(List<ApplicationConfigurationLink> configurations) { this.configurations = configurations; } }
c96d3d2ad54626cb1b9b8348501c1dea6f88a4b1
689c61afa1ea0535f4f81e5dc53d456e496563e9
/src/main/java/edu/gd/ccp/service/impl/VoteUserServiceImpl.java
f9263af3fda115fe0d11fbb3d7b3b21ce6d6c43d
[]
no_license
LaiJinwen/gdeduccp
a5defd04ac51d9750747f7e5e9c6721d5d7b1381
cb56a76f9f904659fcdf784a5a7f283b02d689ed
refs/heads/master
2022-12-21T00:56:39.880409
2019-05-22T03:07:47
2019-05-22T03:07:47
187,788,631
0
0
null
2022-12-16T12:00:52
2019-05-21T07:53:03
HTML
UTF-8
Java
false
false
3,377
java
package edu.gd.ccp.service.impl; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import edu.gd.ccp.dao.*; import edu.gd.ccp.entity.VoteCandidate; import edu.gd.ccp.entity.VoteResult; import edu.gd.ccp.entity.VoterPhones; import edu.gd.ccp.entity.Voters; import edu.gd.ccp.entity.Votetask; import edu.gd.ccp.service.VoteUserService; @Service("voteUserService") public class VoteUserServiceImpl implements VoteUserService { @Autowired private VotetaskMapper votetaskMapper; @Autowired private VotersMapper votersMapper; @Autowired private VoteCandidateMapper voteCandidateMapper; @Autowired private VoteResultMapper voteResultMapper; @Autowired private VoterPhonesMapper votePhonesMapper; @Override public Voters selectFromVotersByVoterId(int voterId) { // votersMapper已有方法 return votersMapper.selectByPrimaryKey(voterId); } @Override public Votetask selectFromVoteTaskByVoteTaskId(int voteTaskId) { // VotetaskMapper已有方法 return votetaskMapper.selectByPrimaryKey(voteTaskId); } @Override public List<VoteCandidate> selectFromVoteCandidateByVoteTaskId(int voteTaskId) { // TODO 自动生成的方法存根 return voteCandidateMapper.selectByVoteTaskId(voteTaskId); } @Override public VoteCandidate selectFromVoteCandidateByCandidateId(int candidateId) { // votecandidateMapper已有方法 return voteCandidateMapper.selectByPrimaryKey(candidateId); } @Override public int updateStateOnVoteResult(String voteResult, int resultId) { // TODO 自动生成的方法存根 return voteResultMapper.updateWhenSubmitResult(voteResult , resultId); } @Override public int updateStateOnVoters(int voterId) { // TODO 自动生成的方法存根 return votersMapper.updateStateOnVoters(voterId); } @Override public int insertIntoVoterPhones(VoterPhones voterPhones) { // 已有方法 return votePhonesMapper.insertSelective(voterPhones); } @Override public VoteResult selectVoteResultByPrimaryKey(Integer resultid) { // TODO Auto-generated method stub return this.voteResultMapper.selectByPrimaryKey(resultid); } //高校端获取投票任务 public List<Map> getVoteTaskByOrganizationNo( String organizationNo){ return this.votetaskMapper.getVoteTaskByOrganizationNo(organizationNo); } public Integer voteTaskCountByOrganizationNo(String organizationNo) { return this.votetaskMapper.voteTaskCountByOrganizationNo(organizationNo); } public Votetask selectByPrimaryKey(Integer votetaskid) { return this.votetaskMapper.selectByPrimaryKey(votetaskid); } //根据任务和单位获取投票任务 public Voters selectVoterByOrganizationNo(Integer voteTaskId, String organizationNo) { return this.votersMapper.selectVoterByOrganizationNo(voteTaskId, organizationNo); } //生成投票 public int insertVote(VoteResult record) { return this.voteResultMapper.insertSelective(record); } //更新投票者投票状体 public int updateVoterByPrimaryKeySelective(Voters record) { return this.votersMapper.updateByPrimaryKeySelective(record); } public int unvoteTaskCountByOrganizationNo( String organizationNo) { return this.votersMapper.unvoteTaskCountByOrganizationNo(organizationNo); } }
139ee17d66f13f9f3e153452b23b60191e18c544
a3ca3003ee87901e6e0b225a3b33db1d0751f70a
/app/src/main/java/day02/l/example/com/everywheretrip/trip/ui/main/adapter/MyCircuitAdapter.java
b30de6ce8da75030f8eb26b7b0402992b43f2f4b
[]
no_license
xiaomidic/travels
c074d691e51cfcbe5782873509d58817ffb56685
811fec4bae9a72862cbf0fd095960e510f679195
refs/heads/master
2020-05-24T01:06:04.257262
2019-05-16T13:06:23
2019-05-16T13:06:23
187,028,991
0
0
null
null
null
null
UTF-8
Java
false
false
2,847
java
package day02.l.example.com.everywheretrip.trip.ui.main.adapter; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.request.RequestOptions; import java.util.ArrayList; import day02.l.example.com.everywheretrip.R; import day02.l.example.com.everywheretrip.trip.bean.CircuitBean; public class MyCircuitAdapter extends RecyclerView.Adapter<MyCircuitAdapter.ViewHoder> { private Context context; private ArrayList<CircuitBean.ResultBean.RoutesBean> list; public MyCircuitAdapter(Context context, ArrayList<CircuitBean.ResultBean.RoutesBean> list) { this.context = context; this.list = list; } @NonNull @Override public ViewHoder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View inflate = LayoutInflater.from(context).inflate(R.layout.layout_item, null); return new ViewHoder(inflate); } @Override public void onBindViewHolder(@NonNull ViewHoder holder, int position) { holder.mGinza.setText(list.get(position).getTitle()); holder.mShop.setText(list.get(position).getIntro()); holder.mJd.setText(list.get(position).getCity()); holder.mTvPrice.setText(list.get(position).getPriceInCents()+"人购买"); //加载一张圆角图片 RoundedCorners roundedCorners = new RoundedCorners(10); RequestOptions options1 = RequestOptions.bitmapTransform(roundedCorners).override(140,100); Glide.with(context).load(list.get(position).getCardURL()).apply(options1).into(holder.mImg); } @Override public int getItemCount() { return list.size(); } public class ViewHoder extends RecyclerView.ViewHolder { ImageView mImg; TextView mGinza; TextView mShop; ImageView mImgLocation; TextView mJd; Button mBtnPrice; TextView mTvPrice; public ViewHoder(View itemView) { super(itemView); this.mImg = (ImageView) itemView.findViewById(R.id.img); this.mGinza = (TextView) itemView.findViewById(R.id.ginza); this.mShop = (TextView) itemView.findViewById(R.id.shop); this.mImgLocation = (ImageView) itemView.findViewById(R.id.img_location); this.mJd = (TextView) itemView.findViewById(R.id.jd); this.mBtnPrice = (Button) itemView.findViewById(R.id.btn_price); this.mTvPrice = (TextView) itemView.findViewById(R.id.tv_price); } } }
e7f8e13e107c5df7d2c8d256b01ff3613edb397a
c2e64846a501c690648a82e41f45cce99ed48985
/app/src/main/java/com/amanyabdalla/myappexam/PhonecallReceiver.java
78eab1b30adde15cb82b8326f85938589867879b
[]
no_license
mahmoudashrafmohamed/calllogs
42609ba5285139a942007da678e9783bacec765b
a6683630ef79b7c33c3cdcf3377537c8417171bc
refs/heads/master
2021-08-30T15:06:52.142043
2017-12-18T11:28:23
2017-12-18T11:28:23
114,632,209
0
0
null
null
null
null
UTF-8
Java
false
false
4,514
java
package com.amanyabdalla.myappexam; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.telephony.TelephonyManager; import java.util.Date; public abstract class PhonecallReceiver extends BroadcastReceiver { //The receiver will be recreated whenever android feels like it. We need a static variable to remember data between instantiations private static int lastState = TelephonyManager.CALL_STATE_IDLE; private static Date callStartTime; private static boolean isIncoming; private static String savedNumber; //because the passed incoming is only valid in ringing @Override public void onReceive(Context context, Intent intent) { //We listen to two intents. The new outgoing call only tells us of an outgoing call. We use it to get the number. if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL")) { savedNumber = intent.getExtras().getString("android.intent.extra.PHONE_NUMBER"); } else{ String stateStr = intent.getExtras().getString(TelephonyManager.EXTRA_STATE); String number = intent.getExtras().getString(TelephonyManager.EXTRA_INCOMING_NUMBER); int state = 0; if(stateStr.equals(TelephonyManager.EXTRA_STATE_IDLE)){ state = TelephonyManager.CALL_STATE_IDLE; } else if(stateStr.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)){ state = TelephonyManager.CALL_STATE_OFFHOOK; } else if(stateStr.equals(TelephonyManager.EXTRA_STATE_RINGING)){ state = TelephonyManager.CALL_STATE_RINGING; } onCallStateChanged(context, state, number); } } //Derived classes should override these to respond to specific events of interest protected abstract void onIncomingCallReceived(Context ctx, String number, Date start); protected abstract void onIncomingCallAnswered(Context ctx, String number, Date start); protected abstract void onIncomingCallEnded(Context ctx, String number, Date start, Date end); protected abstract void onOutgoingCallStarted(Context ctx, String number, Date start); protected abstract void onOutgoingCallEnded(Context ctx, String number, Date start, Date end); protected abstract void onMissedCall(Context ctx, String number, Date start); //Deals with actual events //Incoming call- goes from IDLE to RINGING when it rings, to OFFHOOK when it's answered, to IDLE when its hung up //Outgoing call- goes from IDLE to OFFHOOK when it dials out, to IDLE when hung up public void onCallStateChanged(Context context, int state, String number) { if(lastState == state){ //No change, debounce extras return; } switch (state) { case TelephonyManager.CALL_STATE_RINGING: isIncoming = true; callStartTime = new Date(); savedNumber = number; onIncomingCallReceived(context, number, callStartTime); break; case TelephonyManager.CALL_STATE_OFFHOOK: //Transition of ringing->offhook are pickups of incoming calls. Nothing done on them if(lastState != TelephonyManager.CALL_STATE_RINGING){ isIncoming = false; callStartTime = new Date(); onOutgoingCallStarted(context, savedNumber, callStartTime); } else { isIncoming = true; callStartTime = new Date(); onIncomingCallAnswered(context, savedNumber, callStartTime); } break; case TelephonyManager.CALL_STATE_IDLE: //Went to idle- this is the end of a call. What type depends on previous state(s) if(lastState == TelephonyManager.CALL_STATE_RINGING){ //Ring but no pickup- a miss onMissedCall(context, savedNumber, callStartTime); } else if(isIncoming){ onIncomingCallEnded(context, savedNumber, callStartTime, new Date()); } else{ onOutgoingCallEnded(context, savedNumber, callStartTime, new Date()); } break; } lastState = state; } }
22eabad34cbe221e96c473c388374c23a61307a4
0b2319a4c71e537a6c5dc4c8ef2224edd4996f75
/shop/src/main/java/com/java2/web/entity/AddressEntity.java
2ac9cbb3f86ca51167d2308bb4dbdd58c14ace74
[]
no_license
ZYYBOSS/1
1313dd58b8999179b43ac8e7b301ee9c86896efe
f5b259b8b3a69b43327e2b5893577fea679710a4
refs/heads/master
2020-07-01T04:57:24.375538
2017-01-08T09:23:24
2017-01-08T09:23:24
74,096,077
0
0
null
null
null
null
UTF-8
Java
false
false
1,048
java
package com.java2.web.entity; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Table(name = "address") public class AddressEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String address; @ManyToOne(fetch=FetchType.EAGER) @JoinColumn(name="user_id") //忽略某个元素,不加会死循环不停读取list @JsonIgnore private UserEntity userEntity; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public UserEntity getUser() { return userEntity; } public void setUser(UserEntity user) { this.userEntity = user; } }
f7a186a2ed58f5c6527c65a7c3909bd8dc05d42d
38541496835be423d7015c25b0002a341c287cd6
/ibk-sample-rest/src/main/java/br/com/ibk/rest/service/ContaBancariaServiceImpl.java
2e98ded3354060b78768570eb47a0945f57bf174
[]
no_license
tayron/webservice-rest-java
9387966c6ea60cfec492854c493ee659053b6df2
508c21dc49c5634e151ea4c136a7781f6d7e6b73
refs/heads/master
2020-07-03T00:29:52.473685
2016-11-19T13:40:47
2016-11-19T13:40:47
74,210,711
0
0
null
null
null
null
UTF-8
Java
false
false
2,458
java
package br.com.ibk.rest.service; import java.util.Collection; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import br.com.ibk.ds.memory.InMemoryDataSource; import br.com.ibk.v1.ebo.BancoType; import br.com.ibk.v1.ebo.ClienteType; import br.com.ibk.v1.ebo.ContaBancariaType; public class ContaBancariaServiceImpl { @GET @Path("/all") @Produces(MediaType.APPLICATION_JSON) public ContaBancariaType[] listarContaBancaria() { Collection<ContaBancariaType> contas = InMemoryDataSource.queryAll(ContaBancariaType.class); for (ContaBancariaType conta: contas) { removerReferencias(conta); } return contas.toArray(new ContaBancariaType[]{}); } @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public ContaBancariaType listarContaBancariaPorId(@PathParam("id") Integer id) { ContaBancariaType conta = InMemoryDataSource.queryById(ContaBancariaType.class, id); removerReferencias(conta); return conta; } @PUT @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response alterarContaBancaria(ContaBancariaType contabancaria) { InMemoryDataSource.update(ContaBancariaType.class, contabancaria.getCodigo(), contabancaria); return Response.ok("{\"result\":\"ok\"}").build(); } @DELETE @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public Response removerContaBancaria(@PathParam("id") Integer id) { InMemoryDataSource.delete(ContaBancariaType.class, id); return Response.ok("{\"result\":\"ok\"}").build(); } @POST @Path("/") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response inserirContaBancaria(ContaBancariaType contabancaria) { InMemoryDataSource.add(ContaBancariaType.class, contabancaria.getCodigo(), contabancaria); return Response.ok("{\"result\":\"ok\"}").build(); } private void removerReferencias(ContaBancariaType conta) { int codigoCliente = conta.getCliente().getCodigo(); ClienteType newCliente = new ClienteType(); newCliente.setCodigo(codigoCliente); conta.setCliente(newCliente); int codBanco = conta.getBanco().getCodigo(); BancoType newBanco = new BancoType(); newBanco.setCodigo(codBanco); conta.setBanco(newBanco); } }
7b7a639f13e7f60922b836ef10d6b71bc9ab8995
2e2b8aa2be295bf451aed8196d05c357b0e62950
/app/src/androidTest/java/com/bignerdranch/android/guesscolor/ExampleInstrumentedTest.java
6eb67bca601b83bb9525bf9abeb2c6e5560cab90
[]
no_license
romaaverkin/GuessColor
7a74128e55f0473755c3deed116b0e9005cb194c
3cd889d3c2d7b1a89cffefa11fb1d2b5ae474273
refs/heads/master
2021-01-01T18:09:49.340455
2017-08-02T03:33:14
2017-08-02T03:33:14
98,264,650
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package com.bignerdranch.android.guesscolor; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.bignerdranch.android.guesscolor", appContext.getPackageName()); } }
4bc79ae210245cc9c8c9083c0866ca291a6533b9
63925af7eae423692bd1bdd67956a7e1121ca1d8
/Array/src/Array/TestArray5.java
f979a5b6671925c6cdb58df0358ba9e9df8c5dd2
[]
no_license
ShreelataMK/Java-Demo-
008af6f98a2d45d9afc276ab3cf02cff099532e9
ae72c603546344ec0b3ff7ba36c4aebdd8cb3208
refs/heads/master
2022-06-18T00:31:53.280575
2020-05-09T13:59:27
2020-05-09T13:59:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
373
java
package Array; public class TestArray5 { public static void main(String[] args) { // TODO Auto-generated method stub //Declaring and initailazing 2D array int arr[][]= {{1,2,3},{2,4,5},{4,4,5}}; //print 2D array for(int i=0;i<3;i++) { for(int j=0;j<3;j++) { System.out.print(arr[i][j]+""); } System.out.println(); } } }