blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
495228aa8bf0af2fd45e5c33554b3d1ee68ba00f
8ca7fe076507eb40e6fcd935c2d7fe0fa1a64f93
/src/main/java/com/yrz/oa/core/dao/WorkLogDao.java
8fd88866758d200a0ffdb72981e60070da6b8625
[]
no_license
Unti-Artificial/yrzoa
1eee796f87e20d394398772f4d2ec3049a1d22ed
6963bc82fdbfdb9b6c0fc3e9c0b32386a6b58b2c
refs/heads/master
2020-04-12T03:31:16.066237
2019-01-07T10:40:51
2019-01-07T10:40:51
162,269,327
0
0
null
null
null
null
UTF-8
Java
false
false
293
java
package com.yrz.oa.core.dao; import com.yrz.oa.core.po.WorkLog; import java.util.List; public interface WorkLogDao { int deleteWorkLog(Integer logId); int updateWorkLog(WorkLog workLog); int addWorkLog(WorkLog workLog); List<WorkLog> selectWorkLogListByName(String user); }
b27fc541b839b5832b36facd258e2c32270d5d95
d3d236146a57dc30a3177b247cccbab37ade71c4
/src/main/java/com/dware/kafka/customerservice/service/CustomerService.java
338a9f091b1663c2916c1213a9495e874eb38221
[]
no_license
dancochran/blank-boot-service
58776c2f28d76aae37ba2f22bf49760fc251d180
be74069ddac29087038b870d8437567ac4fa15b5
refs/heads/master
2020-06-13T05:50:18.623654
2019-06-30T20:52:21
2019-06-30T20:52:21
194,559,174
0
0
null
null
null
null
UTF-8
Java
false
false
313
java
package com.dware.kafka.customerservice.service; import com.dware.kafka.customerservice.model.Customer; public interface CustomerService { Customer getCustomer(String customerId); Customer updateCustomer(Customer customer); Customer addCustomer(Customer customer); void deleteCustomer(String customerId); }
12d33d7e0cdeee7afbb044e2372b2397287e479b
737a081d8b099bd4124eb9778a5b6b3aaddbecb6
/PuffyDonut/src/main/java/services/OrderServiceImpl.java
09160e1d12413c4fb3f6470b358924d7f8fc17b0
[]
no_license
realsanya/Donuts
cc8222361f2adb2ca78230b5a8aa2c24409a0395
d41ced7f56e14abf1acff6d7755613cee1da742e
refs/heads/master
2023-01-09T08:43:57.089983
2020-11-01T20:56:21
2020-11-01T20:56:21
296,412,931
0
0
null
2020-11-01T20:56:22
2020-09-17T18:41:04
CSS
UTF-8
Java
false
false
1,167
java
package services; import models.Order; import models.Product; import models.User; import repositories.interfaces.OrderRepository; import services.interfaces.OrderService; import java.util.List; public class OrderServiceImpl implements OrderService { private OrderRepository orderRepository; public OrderServiceImpl(OrderRepository orderRepository) { this.orderRepository = orderRepository; } @Override public Order getOrderById(Integer id) { return orderRepository.findById(id); } @Override public void createOrder(Order order) { orderRepository.save(order); } @Override public Order getUserOrder(User user) { return orderRepository.getUserOrder(user); } @Override public List<Product> getAllProductsInOrder(Order order) { return orderRepository.findProducts(order); } @Override public void addProductInOrder(Order order, Product product) { orderRepository.addProduct(order, product); } @Override public void deleteProductFromOrder(Order order, Product product) { orderRepository.deleteProduct(order, product); } }
20e7ac118f3ccdf9543ff221147726ea4cdad84b
b403cdafd792810fbb939329839c53fd60178684
/GVRf/Framework/src/org/gearvrf/bulletphysics/collision/broadphase/Dbvt.java
c7f3a86e0e725e577b1a5c98fdbdd28f82a77b71
[ "Apache-2.0" ]
permissive
danke-sra/GearVRf
beaf1b375bc3c1b813a682fa5fbf0b4b0f354f77
bcec89ab037e4ca651081d771b5ec1302739db23
refs/heads/master
2020-05-29T12:22:35.796864
2016-03-08T16:16:36
2016-03-08T16:21:44
39,859,371
2
0
null
2015-08-11T21:58:26
2015-07-28T21:46:53
Java
UTF-8
Java
false
false
25,626
java
/* * Java port of Bullet (c) 2008 Martin Dvorak <[email protected]> * * Bullet Continuous Collision Detection and Physics Library * Copyright (c) 2003-2008 Erwin Coumans http://www.bulletphysics.com/ * * This software is provided 'as-is', without any express or implied warranty. * In no event will the authors be held liable for any damages arising from * the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ // Dbvt implementation by Nathanael Presson package org.gearvrf.bulletphysics.collision.broadphase; import java.util.Collections; import javax.vecmath.Vector3f; import org.gearvrf.bulletphysics.BulletGlobals; import org.gearvrf.bulletphysics.collision.broadphase.Dbvt.Node; import org.gearvrf.bulletphysics.linearmath.MiscUtil; import org.gearvrf.bulletphysics.linearmath.Transform; import org.gearvrf.bulletphysics.stack.Stack; import org.gearvrf.bulletphysics.util.IntArrayList; import org.gearvrf.bulletphysics.util.ObjectArrayList; /** * * @author jezek2 */ public class Dbvt { public static final int SIMPLE_STACKSIZE = 64; public static final int DOUBLE_STACKSIZE = SIMPLE_STACKSIZE * 2; public Node root = null; public Node free = null; public int lkhd = -1; public int leaves = 0; public /*unsigned*/ int opath = 0; public Dbvt() { } public void clear() { if (root != null) { recursedeletenode(this, root); } //btAlignedFree(m_free); free = null; } public boolean empty() { return (root == null); } public void optimizeBottomUp() { if (root != null) { ObjectArrayList<Node> leaves = new ObjectArrayList<Node>(this.leaves); fetchleaves(this, root, leaves); bottomup(this, leaves); root = leaves.getQuick(0); } } public void optimizeTopDown() { optimizeTopDown(128); } public void optimizeTopDown(int bu_treshold) { if (root != null) { ObjectArrayList<Node> leaves = new ObjectArrayList<Node>(this.leaves); fetchleaves(this, root, leaves); root = topdown(this, leaves, bu_treshold); } } public void optimizeIncremental(int passes) { if (passes < 0) { passes = leaves; } if (root != null && (passes > 0)) { Node[] root_ref = new Node[1]; do { Node node = root; int bit = 0; while (node.isinternal()) { root_ref[0] = root; node = sort(node, root_ref).childs[(opath >>> bit) & 1]; root = root_ref[0]; bit = (bit + 1) & (/*sizeof(unsigned)*/4 * 8 - 1); } update(node); ++opath; } while ((--passes) != 0); } } public Node insert(DbvtAabbMm box, Object data) { Node leaf = createnode(this, null, box, data); insertleaf(this, root, leaf); leaves++; return leaf; } public void update(Node leaf) { update(leaf, -1); } public void update(Node leaf, int lookahead) { Node root = removeleaf(this, leaf); if (root != null) { if (lookahead >= 0) { for (int i = 0; (i < lookahead) && root.parent != null; i++) { root = root.parent; } } else { root = this.root; } } insertleaf(this, root, leaf); } public void update(Node leaf, DbvtAabbMm volume) { Node root = removeleaf(this, leaf); if (root != null) { if (lkhd >= 0) { for (int i = 0; (i < lkhd) && root.parent != null; i++) { root = root.parent; } } else { root = this.root; } } leaf.volume.set(volume); insertleaf(this, root, leaf); } public boolean update(Node leaf, DbvtAabbMm volume, Vector3f velocity, float margin) { if (leaf.volume.Contain(volume)) { return false; } Vector3f tmp = Stack.alloc(Vector3f.class); tmp.set(margin, margin, margin); volume.Expand(tmp); volume.SignedExpand(velocity); update(leaf, volume); return true; } public boolean update(Node leaf, DbvtAabbMm volume, Vector3f velocity) { if (leaf.volume.Contain(volume)) { return false; } volume.SignedExpand(velocity); update(leaf, volume); return true; } public boolean update(Node leaf, DbvtAabbMm volume, float margin) { if (leaf.volume.Contain(volume)) { return false; } Vector3f tmp = Stack.alloc(Vector3f.class); tmp.set(margin, margin, margin); volume.Expand(tmp); update(leaf, volume); return true; } public void remove(Node leaf) { removeleaf(this, leaf); deletenode(this, leaf); leaves--; } public void write(IWriter iwriter) { throw new UnsupportedOperationException(); } public void clone(Dbvt dest) { clone(dest, null); } public void clone(Dbvt dest, IClone iclone) { throw new UnsupportedOperationException(); } public static int countLeaves(Node node) { if (node.isinternal()) { return countLeaves(node.childs[0]) + countLeaves(node.childs[1]); } else { return 1; } } public static void extractLeaves(Node node, ObjectArrayList<Node> leaves) { if (node.isinternal()) { extractLeaves(node.childs[0], leaves); extractLeaves(node.childs[1], leaves); } else { leaves.add(node); } } public static void enumNodes(Node root, ICollide policy) { //DBVT_CHECKTYPE policy.Process(root); if (root.isinternal()) { enumNodes(root.childs[0], policy); enumNodes(root.childs[1], policy); } } public static void enumLeaves(Node root, ICollide policy) { //DBVT_CHECKTYPE if (root.isinternal()) { enumLeaves(root.childs[0], policy); enumLeaves(root.childs[1], policy); } else { policy.Process(root); } } public static void collideTT(Node root0, Node root1, ICollide policy) { //DBVT_CHECKTYPE if (root0 != null && root1 != null) { ObjectArrayList<sStkNN> stack = new ObjectArrayList<sStkNN>(DOUBLE_STACKSIZE); stack.add(new sStkNN(root0, root1)); do { sStkNN p = stack.remove(stack.size() - 1); if (p.a == p.b) { if (p.a.isinternal()) { stack.add(new sStkNN(p.a.childs[0], p.a.childs[0])); stack.add(new sStkNN(p.a.childs[1], p.a.childs[1])); stack.add(new sStkNN(p.a.childs[0], p.a.childs[1])); } } else if (DbvtAabbMm.Intersect(p.a.volume, p.b.volume)) { if (p.a.isinternal()) { if (p.b.isinternal()) { stack.add(new sStkNN(p.a.childs[0], p.b.childs[0])); stack.add(new sStkNN(p.a.childs[1], p.b.childs[0])); stack.add(new sStkNN(p.a.childs[0], p.b.childs[1])); stack.add(new sStkNN(p.a.childs[1], p.b.childs[1])); } else { stack.add(new sStkNN(p.a.childs[0], p.b)); stack.add(new sStkNN(p.a.childs[1], p.b)); } } else { if (p.b.isinternal()) { stack.add(new sStkNN(p.a, p.b.childs[0])); stack.add(new sStkNN(p.a, p.b.childs[1])); } else { policy.Process(p.a, p.b); } } } } while (stack.size() > 0); } } public static void collideTT(Node root0, Node root1, Transform xform, ICollide policy) { //DBVT_CHECKTYPE if (root0 != null && root1 != null) { ObjectArrayList<sStkNN> stack = new ObjectArrayList<sStkNN>(DOUBLE_STACKSIZE); stack.add(new sStkNN(root0, root1)); do { sStkNN p = stack.remove(stack.size() - 1); if (p.a == p.b) { if (p.a.isinternal()) { stack.add(new sStkNN(p.a.childs[0], p.a.childs[0])); stack.add(new sStkNN(p.a.childs[1], p.a.childs[1])); stack.add(new sStkNN(p.a.childs[0], p.a.childs[1])); } } else if (DbvtAabbMm.Intersect(p.a.volume, p.b.volume, xform)) { if (p.a.isinternal()) { if (p.b.isinternal()) { stack.add(new sStkNN(p.a.childs[0], p.b.childs[0])); stack.add(new sStkNN(p.a.childs[1], p.b.childs[0])); stack.add(new sStkNN(p.a.childs[0], p.b.childs[1])); stack.add(new sStkNN(p.a.childs[1], p.b.childs[1])); } else { stack.add(new sStkNN(p.a.childs[0], p.b)); stack.add(new sStkNN(p.a.childs[1], p.b)); } } else { if (p.b.isinternal()) { stack.add(new sStkNN(p.a, p.b.childs[0])); stack.add(new sStkNN(p.a, p.b.childs[1])); } else { policy.Process(p.a, p.b); } } } } while (stack.size() > 0); } } public static void collideTT(Node root0, Transform xform0, Node root1, Transform xform1, ICollide policy) { Transform xform = Stack.alloc(Transform.class); xform.inverse(xform0); xform.mul(xform1); collideTT(root0, root1, xform, policy); } public static void collideTV(Node root, DbvtAabbMm volume, ICollide policy) { //DBVT_CHECKTYPE if (root != null) { ObjectArrayList<Node> stack = new ObjectArrayList<Node>(SIMPLE_STACKSIZE); stack.add(root); do { Node n = stack.remove(stack.size() - 1); if (DbvtAabbMm.Intersect(n.volume, volume)) { if (n.isinternal()) { stack.add(n.childs[0]); stack.add(n.childs[1]); } else { policy.Process(n); } } } while (stack.size() > 0); } } public static void collideRAY(Node root, Vector3f origin, Vector3f direction, ICollide policy) { //DBVT_CHECKTYPE if (root != null) { Vector3f normal = Stack.alloc(Vector3f.class); normal.normalize(direction); Vector3f invdir = Stack.alloc(Vector3f.class); invdir.set(1f / normal.x, 1f / normal.y, 1f / normal.z); int[] signs = new int[] { direction.x<0 ? 1:0, direction.y<0 ? 1:0, direction.z<0 ? 1:0 }; ObjectArrayList<Node> stack = new ObjectArrayList<Node>(SIMPLE_STACKSIZE); stack.add(root); do { Node node = stack.remove(stack.size() - 1); if (DbvtAabbMm.Intersect(node.volume, origin, invdir, signs)) { if (node.isinternal()) { stack.add(node.childs[0]); stack.add(node.childs[1]); } else { policy.Process(node); } } } while (stack.size() != 0); } } public static void collideKDOP(Node root, Vector3f[] normals, float[] offsets, int count, ICollide policy) { //DBVT_CHECKTYPE if (root != null) { int inside = (1 << count) - 1; ObjectArrayList<sStkNP> stack = new ObjectArrayList<sStkNP>(SIMPLE_STACKSIZE); int[] signs = new int[4 * 8]; assert (count < (/*sizeof(signs)*/128 / /*sizeof(signs[0])*/ 4)); for (int i=0; i<count; ++i) { signs[i] = ((normals[i].x >= 0) ? 1 : 0) + ((normals[i].y >= 0) ? 2 : 0) + ((normals[i].z >= 0) ? 4 : 0); } stack.add(new sStkNP(root, 0)); do { sStkNP se = stack.remove(stack.size() - 1); boolean out = false; for (int i = 0, j = 1; (!out) && (i < count); ++i, j <<= 1) { if (0 == (se.mask & j)) { int side = se.node.volume.Classify(normals[i], offsets[i], signs[i]); switch (side) { case -1: out = true; break; case +1: se.mask |= j; break; } } } if (!out) { if ((se.mask != inside) && (se.node.isinternal())) { stack.add(new sStkNP(se.node.childs[0], se.mask)); stack.add(new sStkNP(se.node.childs[1], se.mask)); } else { if (policy.AllLeaves(se.node)) { enumLeaves(se.node, policy); } } } } while (stack.size() != 0); } } public static void collideOCL(Node root, Vector3f[] normals, float[] offsets, Vector3f sortaxis, int count, ICollide policy) { collideOCL(root, normals, offsets, sortaxis, count, policy, true); } public static void collideOCL(Node root, Vector3f[] normals, float[] offsets, Vector3f sortaxis, int count, ICollide policy, boolean fullsort) { //DBVT_CHECKTYPE if (root != null) { int srtsgns = (sortaxis.x >= 0 ? 1 : 0) + (sortaxis.y >= 0 ? 2 : 0) + (sortaxis.z >= 0 ? 4 : 0); int inside = (1 << count) - 1; ObjectArrayList<sStkNPS> stock = new ObjectArrayList<sStkNPS>(); IntArrayList ifree = new IntArrayList(); IntArrayList stack = new IntArrayList(); int[] signs = new int[/*sizeof(unsigned)*8*/4 * 8]; assert (count < (/*sizeof(signs)*/128 / /*sizeof(signs[0])*/ 4)); for (int i = 0; i < count; i++) { signs[i] = ((normals[i].x >= 0) ? 1 : 0) + ((normals[i].y >= 0) ? 2 : 0) + ((normals[i].z >= 0) ? 4 : 0); } //stock.reserve(SIMPLE_STACKSIZE); //stack.reserve(SIMPLE_STACKSIZE); //ifree.reserve(SIMPLE_STACKSIZE); stack.add(allocate(ifree, stock, new sStkNPS(root, 0, root.volume.ProjectMinimum(sortaxis, srtsgns)))); do { // JAVA NOTE: check int id = stack.remove(stack.size() - 1); sStkNPS se = stock.getQuick(id); ifree.add(id); if (se.mask != inside) { boolean out = false; for (int i = 0, j = 1; (!out) && (i < count); ++i, j <<= 1) { if (0 == (se.mask & j)) { int side = se.node.volume.Classify(normals[i], offsets[i], signs[i]); switch (side) { case -1: out = true; break; case +1: se.mask |= j; break; } } } if (out) { continue; } } if (policy.Descent(se.node)) { if (se.node.isinternal()) { Node[] pns = new Node[]{se.node.childs[0], se.node.childs[1]}; sStkNPS[] nes = new sStkNPS[]{new sStkNPS(pns[0], se.mask, pns[0].volume.ProjectMinimum(sortaxis, srtsgns)), new sStkNPS(pns[1], se.mask, pns[1].volume.ProjectMinimum(sortaxis, srtsgns)) }; int q = nes[0].value < nes[1].value ? 1 : 0; int j = stack.size(); if (fullsort && (j > 0)) { /* Insert 0 */ j = nearest(stack, stock, nes[q].value, 0, stack.size()); stack.add(0); //#if DBVT_USE_MEMMOVE //memmove(&stack[j+1],&stack[j],sizeof(int)*(stack.size()-j-1)); //#else for (int k = stack.size() - 1; k > j; --k) { stack.set(k, stack.get(k - 1)); //#endif } stack.set(j, allocate(ifree, stock, nes[q])); /* Insert 1 */ j = nearest(stack, stock, nes[1 - q].value, j, stack.size()); stack.add(0); //#if DBVT_USE_MEMMOVE //memmove(&stack[j+1],&stack[j],sizeof(int)*(stack.size()-j-1)); //#else for (int k = stack.size() - 1; k > j; --k) { stack.set(k, stack.get(k - 1)); //#endif } stack.set(j, allocate(ifree, stock, nes[1 - q])); } else { stack.add(allocate(ifree, stock, nes[q])); stack.add(allocate(ifree, stock, nes[1 - q])); } } else { policy.Process(se.node, se.value); } } } while (stack.size() != 0); } } public static void collideTU(Node root, ICollide policy) { //DBVT_CHECKTYPE if (root != null) { ObjectArrayList<Node> stack = new ObjectArrayList<Node>(SIMPLE_STACKSIZE); stack.add(root); do { Node n = stack.remove(stack.size() - 1); if (policy.Descent(n)) { if (n.isinternal()) { stack.add(n.childs[0]); stack.add(n.childs[1]); } else { policy.Process(n); } } } while (stack.size() > 0); } } public static int nearest(IntArrayList i, ObjectArrayList<sStkNPS> a, float v, int l, int h) { int m = 0; while (l < h) { m = (l + h) >> 1; if (a.getQuick(i.get(m)).value >= v) { l = m + 1; } else { h = m; } } return h; } public static int allocate(IntArrayList ifree, ObjectArrayList<sStkNPS> stock, sStkNPS value) { int i; if (ifree.size() > 0) { i = ifree.get(ifree.size() - 1); ifree.remove(ifree.size() - 1); stock.getQuick(i).set(value); } else { i = stock.size(); stock.add(value); } return (i); } //////////////////////////////////////////////////////////////////////////// private static int indexof(Node node) { return (node.parent.childs[1] == node)? 1:0; } private static DbvtAabbMm merge(DbvtAabbMm a, DbvtAabbMm b, DbvtAabbMm out) { DbvtAabbMm.Merge(a, b, out); return out; } // volume+edge lengths private static float size(DbvtAabbMm a) { Vector3f edges = a.Lengths(Stack.alloc(Vector3f.class)); return (edges.x * edges.y * edges.z + edges.x + edges.y + edges.z); } private static void deletenode(Dbvt pdbvt, Node node) { //btAlignedFree(pdbvt->m_free); pdbvt.free = node; } private static void recursedeletenode(Dbvt pdbvt, Node node) { if (!node.isleaf()) { recursedeletenode(pdbvt, node.childs[0]); recursedeletenode(pdbvt, node.childs[1]); } if (node == pdbvt.root) { pdbvt.root = null; } deletenode(pdbvt, node); } private static Node createnode(Dbvt pdbvt, Node parent, DbvtAabbMm volume, Object data) { Node node; if (pdbvt.free != null) { node = pdbvt.free; pdbvt.free = null; } else { node = new Node(); } node.parent = parent; node.volume.set(volume); node.data = data; node.childs[1] = null; return node; } private static void insertleaf(Dbvt pdbvt, Node root, Node leaf) { if (pdbvt.root == null) { pdbvt.root = leaf; leaf.parent = null; } else { if (!root.isleaf()) { do { if (DbvtAabbMm.Proximity(root.childs[0].volume, leaf.volume) < DbvtAabbMm.Proximity(root.childs[1].volume, leaf.volume)) { root = root.childs[0]; } else { root = root.childs[1]; } } while (!root.isleaf()); } Node prev = root.parent; Node node = createnode(pdbvt, prev, merge(leaf.volume, root.volume, new DbvtAabbMm()), null); if (prev != null) { prev.childs[indexof(root)] = node; node.childs[0] = root; root.parent = node; node.childs[1] = leaf; leaf.parent = node; do { if (!prev.volume.Contain(node.volume)) { DbvtAabbMm.Merge(prev.childs[0].volume, prev.childs[1].volume, prev.volume); } else { break; } node = prev; } while (null != (prev = node.parent)); } else { node.childs[0] = root; root.parent = node; node.childs[1] = leaf; leaf.parent = node; pdbvt.root = node; } } } private static Node removeleaf(Dbvt pdbvt, Node leaf) { if (leaf == pdbvt.root) { pdbvt.root = null; return null; } else { Node parent = leaf.parent; Node prev = parent.parent; Node sibling = parent.childs[1 - indexof(leaf)]; if (prev != null) { prev.childs[indexof(parent)] = sibling; sibling.parent = prev; deletenode(pdbvt, parent); while (prev != null) { DbvtAabbMm pb = prev.volume; DbvtAabbMm.Merge(prev.childs[0].volume, prev.childs[1].volume, prev.volume); if (DbvtAabbMm.NotEqual(pb, prev.volume)) { prev = prev.parent; } else { break; } } return (prev != null? prev : pdbvt.root); } else { pdbvt.root = sibling; sibling.parent = null; deletenode(pdbvt, parent); return pdbvt.root; } } } private static void fetchleaves(Dbvt pdbvt, Node root, ObjectArrayList<Node> leaves) { fetchleaves(pdbvt, root, leaves, -1); } private static void fetchleaves(Dbvt pdbvt, Node root, ObjectArrayList<Node> leaves, int depth) { if (root.isinternal() && depth != 0) { fetchleaves(pdbvt, root.childs[0], leaves, depth - 1); fetchleaves(pdbvt, root.childs[1], leaves, depth - 1); deletenode(pdbvt, root); } else { leaves.add(root); } } private static void split(ObjectArrayList<Node> leaves, ObjectArrayList<Node> left, ObjectArrayList<Node> right, Vector3f org, Vector3f axis) { Vector3f tmp = Stack.alloc(Vector3f.class); MiscUtil.resize(left, 0, Node.class); MiscUtil.resize(right, 0, Node.class); for (int i=0, ni=leaves.size(); i<ni; i++) { leaves.getQuick(i).volume.Center(tmp); tmp.sub(org); if (axis.dot(tmp) < 0f) { left.add(leaves.getQuick(i)); } else { right.add(leaves.getQuick(i)); } } } private static DbvtAabbMm bounds(ObjectArrayList<Node> leaves) { DbvtAabbMm volume = new DbvtAabbMm(leaves.getQuick(0).volume); for (int i=1, ni=leaves.size(); i<ni; i++) { merge(volume, leaves.getQuick(i).volume, volume); } return volume; } private static void bottomup(Dbvt pdbvt, ObjectArrayList<Node> leaves) { DbvtAabbMm tmpVolume = new DbvtAabbMm(); while (leaves.size() > 1) { float minsize = BulletGlobals.SIMD_INFINITY; int[] minidx = new int[] { -1, -1 }; for (int i=0; i<leaves.size(); i++) { for (int j=i+1; j<leaves.size(); j++) { float sz = size(merge(leaves.getQuick(i).volume, leaves.getQuick(j).volume, tmpVolume)); if (sz < minsize) { minsize = sz; minidx[0] = i; minidx[1] = j; } } } Node[] n = new Node[] { leaves.getQuick(minidx[0]), leaves.getQuick(minidx[1]) }; Node p = createnode(pdbvt, null, merge(n[0].volume, n[1].volume, new DbvtAabbMm()), null); p.childs[0] = n[0]; p.childs[1] = n[1]; n[0].parent = p; n[1].parent = p; // JAVA NOTE: check leaves.setQuick(minidx[0], p); Collections.swap(leaves, minidx[1], leaves.size() - 1); leaves.removeQuick(leaves.size() - 1); } } private static Vector3f[] axis = new Vector3f[] { new Vector3f(1, 0, 0), new Vector3f(0, 1, 0), new Vector3f(0, 0, 1) }; private static Node topdown(Dbvt pdbvt, ObjectArrayList<Node> leaves, int bu_treshold) { if (leaves.size() > 1) { if (leaves.size() > bu_treshold) { DbvtAabbMm vol = bounds(leaves); Vector3f org = vol.Center(Stack.alloc(Vector3f.class)); ObjectArrayList[] sets = new ObjectArrayList[2]; for (int i=0; i<sets.length; i++) { sets[i] = new ObjectArrayList(); } int bestaxis = -1; int bestmidp = leaves.size(); int[][] splitcount = new int[/*3*/][/*2*/]{{0, 0}, {0, 0}, {0, 0}}; Vector3f x = Stack.alloc(Vector3f.class); for (int i=0; i<leaves.size(); i++) { leaves.getQuick(i).volume.Center(x); x.sub(org); for (int j=0; j<3; j++) { splitcount[j][x.dot(axis[j]) > 0f? 1 : 0]++; } } for (int i=0; i<3; i++) { if ((splitcount[i][0] > 0) && (splitcount[i][1] > 0)) { int midp = Math.abs(splitcount[i][0] - splitcount[i][1]); if (midp < bestmidp) { bestaxis = i; bestmidp = midp; } } } if (bestaxis >= 0) { //sets[0].reserve(splitcount[bestaxis][0]); //sets[1].reserve(splitcount[bestaxis][1]); split(leaves, sets[0], sets[1], org, axis[bestaxis]); } else { //sets[0].reserve(leaves.size()/2+1); //sets[1].reserve(leaves.size()/2); for (int i=0, ni=leaves.size(); i<ni; i++) { sets[i & 1].add(leaves.getQuick(i)); } } Node node = createnode(pdbvt, null, vol, null); node.childs[0] = topdown(pdbvt, sets[0], bu_treshold); node.childs[1] = topdown(pdbvt, sets[1], bu_treshold); node.childs[0].parent = node; node.childs[1].parent = node; return node; } else { bottomup(pdbvt, leaves); return leaves.getQuick(0); } } return leaves.getQuick(0); } private static Node sort(Node n, Node[] r) { Node p = n.parent; assert (n.isinternal()); // JAVA TODO: fix this if (p != null && p.hashCode() > n.hashCode()) { int i = indexof(n); int j = 1 - i; Node s = p.childs[j]; Node q = p.parent; assert (n == p.childs[i]); if (q != null) { q.childs[indexof(p)] = n; } else { r[0] = n; } s.parent = n; p.parent = n; n.parent = q; p.childs[0] = n.childs[0]; p.childs[1] = n.childs[1]; n.childs[0].parent = p; n.childs[1].parent = p; n.childs[i] = p; n.childs[j] = s; DbvtAabbMm.swap(p.volume, n.volume); return p; } return n; } private static Node walkup(Node n, int count) { while (n != null && (count--) != 0) { n = n.parent; } return n; } //////////////////////////////////////////////////////////////////////////// public static class Node { public final DbvtAabbMm volume = new DbvtAabbMm(); public Node parent; public final Node[] childs = new Node[2]; public Object data; public boolean isleaf() { return childs[1] == null; } public boolean isinternal() { return !isleaf(); } } /** Stack element */ public static class sStkNN { public Node a; public Node b; public sStkNN(Node na, Node nb) { a = na; b = nb; } } public static class sStkNP { public Node node; public int mask; public sStkNP(Node n, int m) { node = n; mask = m; } } public static class sStkNPS { public Node node; public int mask; public float value; public sStkNPS() { } public sStkNPS(Node n, int m, float v) { node = n; mask = m; value = v; } public void set(sStkNPS o) { node = o.node; mask = o.mask; value = o.value; } } public static class sStkCLN { public Node node; public Node parent; public sStkCLN(Node n, Node p) { node = n; parent = p; } } public static class ICollide { public void Process(Node n1, Node n2) { } public void Process(Node n) { } public void Process(Node n, float f) { Process(n); } public boolean Descent(Node n) { return true; } public boolean AllLeaves(Node n) { return true; } } public static abstract class IWriter { public abstract void Prepare(Node root, int numnodes); public abstract void WriteNode(Node n, int index, int parent, int child0, int child1); public abstract void WriteLeaf(Node n, int index, int parent); } public static class IClone { public void CloneLeaf(Node n) { } } }
c4f336ad746b058355a9bb58812930b18aa36f6d
e2d69d8f6958b4670c28930841003ad65b431a34
/EIDMRegistrationGapClient/src/gov/hhs/cms/eidm/ws/waas/domain/userprofile/ContInfoMultipleRoleType.java
7eb30444b9f6538f7628a3e96c407d6dcc044add
[]
no_license
ahossain71/ie-dev
edfc2a24d5b59db31c46fed466921bf9f64f295d
72abb4b5ccdc70e020ad8e6f1e478ba1aa1b2656
refs/heads/master
2020-04-05T00:53:49.315533
2018-11-09T04:35:23
2018-11-09T04:35:23
156,414,869
0
0
null
null
null
null
UTF-8
Java
false
false
7,764
java
package gov.hhs.cms.eidm.ws.waas.domain.userprofile; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ContInfoMultipleRoleType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ContInfoMultipleRoleType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="address" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="address2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="city" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="state" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="province" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="zipcode" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="zipcodeExtension" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="country" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="primaryPhoneNo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="primaryPhoneNoExt" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;element name="Email" type="{http://userprofile.domain.waas.ws.eidm.cms.hhs.gov}EmailType" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ContInfoMultipleRoleType", propOrder = { "address", "address2", "city", "state", "province", "zipcode", "zipcodeExtension", "country", "primaryPhoneNo", "primaryPhoneNoExt", "email" }) public class ContInfoMultipleRoleType { protected String address; protected String address2; protected String city; protected String state; protected String province; protected String zipcode; protected String zipcodeExtension; protected String country; protected String primaryPhoneNo; protected String primaryPhoneNoExt; @XmlElement(name = "Email") protected EmailType email; /** * Gets the value of the address property. * * @return * possible object is * {@link String } * */ public String getAddress() { return address; } /** * Sets the value of the address property. * * @param value * allowed object is * {@link String } * */ public void setAddress(String value) { this.address = value; } /** * Gets the value of the address2 property. * * @return * possible object is * {@link String } * */ public String getAddress2() { return address2; } /** * Sets the value of the address2 property. * * @param value * allowed object is * {@link String } * */ public void setAddress2(String value) { this.address2 = value; } /** * Gets the value of the city property. * * @return * possible object is * {@link String } * */ public String getCity() { return city; } /** * Sets the value of the city property. * * @param value * allowed object is * {@link String } * */ public void setCity(String value) { this.city = value; } /** * Gets the value of the state property. * * @return * possible object is * {@link String } * */ public String getState() { return state; } /** * Sets the value of the state property. * * @param value * allowed object is * {@link String } * */ public void setState(String value) { this.state = value; } /** * Gets the value of the province property. * * @return * possible object is * {@link String } * */ public String getProvince() { return province; } /** * Sets the value of the province property. * * @param value * allowed object is * {@link String } * */ public void setProvince(String value) { this.province = value; } /** * Gets the value of the zipcode property. * * @return * possible object is * {@link String } * */ public String getZipcode() { return zipcode; } /** * Sets the value of the zipcode property. * * @param value * allowed object is * {@link String } * */ public void setZipcode(String value) { this.zipcode = value; } /** * Gets the value of the zipcodeExtension property. * * @return * possible object is * {@link String } * */ public String getZipcodeExtension() { return zipcodeExtension; } /** * Sets the value of the zipcodeExtension property. * * @param value * allowed object is * {@link String } * */ public void setZipcodeExtension(String value) { this.zipcodeExtension = value; } /** * Gets the value of the country property. * * @return * possible object is * {@link String } * */ public String getCountry() { return country; } /** * Sets the value of the country property. * * @param value * allowed object is * {@link String } * */ public void setCountry(String value) { this.country = value; } /** * Gets the value of the primaryPhoneNo property. * * @return * possible object is * {@link String } * */ public String getPrimaryPhoneNo() { return primaryPhoneNo; } /** * Sets the value of the primaryPhoneNo property. * * @param value * allowed object is * {@link String } * */ public void setPrimaryPhoneNo(String value) { this.primaryPhoneNo = value; } /** * Gets the value of the primaryPhoneNoExt property. * * @return * possible object is * {@link String } * */ public String getPrimaryPhoneNoExt() { return primaryPhoneNoExt; } /** * Sets the value of the primaryPhoneNoExt property. * * @param value * allowed object is * {@link String } * */ public void setPrimaryPhoneNoExt(String value) { this.primaryPhoneNoExt = value; } /** * Gets the value of the email property. * * @return * possible object is * {@link EmailType } * */ public EmailType getEmail() { return email; } /** * Sets the value of the email property. * * @param value * allowed object is * {@link EmailType } * */ public void setEmail(EmailType value) { this.email = value; } }
fd0c07d738d31bcf3ed1f9a900c76ec3557b3ffe
e016d9f64f84e5cf87c000bcf2f3583b31fadfb5
/TyphoonService/src/typhoonFcst/TyphoonFcst.java
f53a866c97dc6c5a5ba7d81fa55b7afb0fdacd2c
[]
no_license
aqaqsubin/Disaster-Integrated-Database
a9c5ca6e9d9f4cbb016400f7e64b54a87809e0d8
2f4f06b2a5920fb30bf230d4349af4ddf3d2f5eb
refs/heads/master
2023-02-04T20:37:38.900186
2020-12-18T05:15:03
2020-12-18T05:15:03
317,382,156
0
0
null
2020-12-18T05:15:04
2020-12-01T00:34:01
Java
UTF-8
Java
false
false
3,390
java
package typhoonFcst; public class TyphoonFcst { private String tmAnalysis, typLoc, typDir, tmFc, typ70PrRad, typ15ed, typ25ed, typ15, typ15er, typ25, typ25er, typSeq, typSp, typPs, typWs, typLat, typLon; public TyphoonFcst() { setTmAnalysis(null); setTypLoc(null); setTypDir(null); setTmFc(null); setTypSeq(null); setTypSp(null); setTypPs(null); setTypWs(null); setTypLat(null); setTypLon(null); setTyp70PrRad(null); setTyp15ed(null); setTyp25ed(null); setTyp15(null); setTyp15er(null); setTyp25(null); setTyp25er(null); } public String getTypLoc() { return typLoc; } public void setTypLoc(String typLoc) { this.typLoc = typLoc; } public String getTypDir() { return typDir; } public void setTypDir(String typDir) { this.typDir = typDir; } public String getTmFc() { return tmFc; } public void setTmFc(String tmFc) { this.tmFc = tmFc; } public int getTypSeq() { return typSeq.equals("null") ? java.sql.Types.NULL : Integer.parseInt(typSeq); } public void setTypSeq(String typSeq) { this.typSeq = typSeq; } public double getTypSp() { return typSp.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typSp); } public void setTypSp(String typSp) { this.typSp = typSp; } public double getTypPs() { return typPs.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typPs); } public void setTypPs(String typPs) { this.typPs = typPs; } public double getTypWs() { return typWs.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typWs); } public void setTypWs(String typWs) { this.typWs = typWs; } public double getTypLat() { return typLat.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typLat); } public void setTypLat(String typLat) { this.typLat = typLat; } public double getTypLon() { return typLon.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typLon); } public void setTypLon(String typLon) { this.typLon = typLon; } public double getTyp15() { return typ15.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typ15); } public void setTyp15(String typ15) { this.typ15 = typ15; } public double getTyp25() { return typ25.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typ25); } public void setTyp25(String typ25) { this.typ25 = typ25; } public double getTyp15er() { return typ15er.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typ15er); } public void setTyp15er(String typ15er) { this.typ15er = typ15er; } public double getTyp25er() { return typ25er.equals("null") ? java.sql.Types.NULL : Double.parseDouble(typ25er); } public void setTyp25er(String typ25er) { this.typ25er = typ25er; } public String getTyp15ed() { return typ15ed.equals("null") ? null : typ15ed; } public void setTyp15ed(String typ15ed) { this.typ15ed = typ15ed; } public String getTyp25ed() { return typ25ed.equals("null") ? null : typ25ed; } public void setTyp25ed(String typ25ed) { this.typ25ed = typ25ed; } public String getTmAnalysis() { return tmAnalysis; } public void setTmAnalysis(String tmAnalysis) { this.tmAnalysis = tmAnalysis; } public double getTyp70PrRad() { return typ70PrRad.equals("null")? java.sql.Types.NULL : Double.parseDouble(typ70PrRad); } public void setTyp70PrRad(String typ70PrRad) { this.typ70PrRad = typ70PrRad; } }
d4615cf142c036daf61edfce6efa3798e2120847
6252c165657baa6aa605337ebc38dd44b3f694e2
/org.eclipse.epsilon.egl.sync/Scalability-Tests/boiler-To-Generate-1000-Files/boiler-To-Generate-1000-Files/syncregions-1000Files/BoilerActuator4703.java
29804e9a6afc57eae1405b9aafddb1e4652fa06b
[]
no_license
soha500/EglSync
00fc49bcc73f7f7f7fb7641d0561ca2b9a8ea638
55101bc781349bb14fefc178bf3486e2b778aed6
refs/heads/master
2021-06-23T02:55:13.464889
2020-12-11T19:10:01
2020-12-11T19:10:01
139,832,721
0
1
null
2019-05-31T11:34:02
2018-07-05T10:20:00
Java
UTF-8
Java
false
false
267
java
package syncregions; public class BoilerActuator4703 { public int execute(int temperatureDifference4703, boolean boilerStatus4703) { //sync _bfpnGUbFEeqXnfGWlV4703, behaviour Half Change - return temperature - targetTemperature; //endSync } }
58c4c8690ddec55cc18e54615257397045e0a0be
238e5f8b533502eefb707550d6fd040e79642001
/trashbox/src/main/java/net/spring/board/util/CustomAccessDeniedHandler.java
35ef19ff031545442ce4e4298672745a5c65ac2c
[]
no_license
youki032/portfolio
39f9455116373fdf41d89720ea7054f84b5e28a4
97104b7d9386a2e93d1d0586819f0ba54af07d00
refs/heads/master
2021-01-09T09:24:52.297337
2016-09-20T06:52:19
2016-09-20T06:52:19
68,681,503
0
0
null
null
null
null
UTF-8
Java
false
false
2,654
java
package net.spring.board.util; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.web.access.AccessDeniedHandler; public class CustomAccessDeniedHandler implements AccessDeniedHandler { protected Logger log = LogManager.getLogger(CustomAccessDeniedHandler.class); private String errorPage; @Override public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { // Ajax를 통해 들어온것인지 파악한다 String ajaxHeader = request.getHeader("X-Ajax-call"); String result = ""; response.setStatus(HttpServletResponse.SC_FORBIDDEN); response.setCharacterEncoding("UTF-8"); if(ajaxHeader == null){ // null로 받은 경우는 X-Ajax-call 헤더 변수가 없다는 의미이기 때문에 ajax가 아닌 일반적인 방법으로 접근했음을 의미한다 Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Object principal = authentication.getPrincipal(); if (principal instanceof UserDetails) { String username = ((UserDetails) principal).getUsername(); request.setAttribute("username", username); } request.setAttribute("errormsg", accessDeniedException); request.getRequestDispatcher(errorPage).forward(request, response); }else{ if("true".equals(ajaxHeader)){ // true로 값을 받았다는 것은 ajax로 접근했음을 의미한다 result = "{\"result\" : \"fail\", \"message\" : \"" + accessDeniedException.getMessage() + "\"}"; }else{ // 헤더 변수는 있으나 값이 틀린 경우이므로 헤더값이 틀렸다는 의미로 돌려준다 result = "{\"result\" : \"fail\", \"message\" : \"Access Denied(Header Value Mismatch)\"}"; } response.getWriter().print(result); response.getWriter().flush(); } } public void setErrorPage(String errorPage) { if ((errorPage != null) && !errorPage.startsWith("/")) { throw new IllegalArgumentException("errorPage must begin with '/'"); } this.errorPage = errorPage; } }
[ "jbh032@DESKTOP-1B7RHDL" ]
jbh032@DESKTOP-1B7RHDL
8975a8f400124cbc0508703c5819234c78b73ff6
6a52f260f8992f66683320411081ce0c993105d7
/Assignments/Assignment2/Assignment2/Assig2.java
c8eaf2be6024759cad04466b4e62f829e233bc0b
[]
no_license
simrangidwani/CS401
5f05587a627dc3d4ae5520dff3365e40e3340d3a
008bc2d27b538b453a0947626f24a73a3a9d3d85
refs/heads/main
2022-12-26T17:39:33.448345
2020-10-12T17:33:52
2020-10-12T17:33:52
303,465,484
0
0
null
null
null
null
UTF-8
Java
false
false
3,271
java
package assig2; import java.util.*; import java.io.*; public class Assig2 { public static void main(String[] args) throws IOException { //Scanner object Scanner inScan = new Scanner(System.in); String guess; String name; int tries = 0; boolean continue_playing = true; String keepPlaying; //introduction System.out.println("Welcome! What is your name? ('quit' to exit): "); name = inScan.nextLine(); Scramble scramble = new Scramble("words.txt"); Results result = new Results(name + "_results.txt"); String actualWord = scramble.getRealWord(); String scrambledWord = scramble.getScrambledWord(); while (continue_playing == true) { System.out.println(name + ", you have 3 guesses to get the Scrambled word! Good luck."); System.out.println(scrambledWord); System.out.println("What do you think the scrambled word is?: "); guess = inScan.nextLine(); tries = 1; while (tries < 3) { if (guess.equalsIgnoreCase(actualWord)) { System.out.println("That is correct!"); result.won(); break; } else if (guess.length() != actualWord.length()) { System.out.println("You words arent the same length"); } else { System.out.println("These are the letters you got correct"); for (int i=0; i < guess.length(); i++ ) { if (Character.toLowerCase(guess.charAt(i)) == Character.toLowerCase(actualWord.charAt(i))) { System.out.print(guess.charAt(i)); } else System.out.print("_"); } System.out.println(""); } tries++; System.out.println("Guess again: "); guess = inScan.nextLine(); } if (tries == 3) { System.out.println("You used all your guesses, sorry!"); result.lost(); } actualWord = scramble.getRealWord(); scrambledWord = scramble.getScrambledWord(); if (actualWord != null) { System.out.println("Would you like to continue playing?: "); keepPlaying = inScan.nextLine(); if (keepPlaying.equals("no")) { continue_playing = false; } } else { System.out.println("There is no more words left in the file."); continue_playing = false; } } result.save(); System.out.println(result.toString()); } }
64488c80f9c1a37eddf5c037ab5977aa6c87eaad
d555e540da3e1ba7d4fd1c6b1611fe71039c1ced
/src/MemoryGame.java
de615c38c7be18b103b9fd9837d7dfc01afada98
[]
no_license
Yao-Han/Chinese-chess
3133e74d644cc7dad7ff3079f230c413ae829407
c7832ef46914d3d84bf4bdb693d9c4c0677c2858
refs/heads/master
2016-08-12T09:15:46.814015
2016-04-08T17:22:54
2016-04-08T17:22:54
55,796,800
0
0
null
null
null
null
BIG5
Java
false
false
3,673
java
import java.awt.Container; import java.awt.GridLayout; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; /** * 記憶遊戲 */ public class MemoryGame extends JFrame { int totalclick = 0; int count = 0; int complete = 0; int press1 = -1; int press2 = -1; int[] random; JButton[] button; ImageIcon imageIcon1, imageIcon2; ImageIcon[] imageicon; Container container; Listener listener; /** * 建構子 * @param super("記憶遊戲") 父類別(JFrame)的建構方法 * @param setUI() 設定視窗元件 * @param setVisible(true) 呈現畫面 */ public MemoryGame() { super("記憶遊戲"); setUI(); setVisible(true); } /** * 設定視窗元件 * @param totalclick 紀錄總點擊數 * @param count 紀錄翻牌數 * @param complete 紀錄已配對成功之牌組 * @param press1 紀錄翻第一張牌的按鈕編號 * @param press2 紀錄翻第二張牌的按鈕編號 * @param random[] 亂數陣列 * @param button[] 按鈕陣列 * @param imageicon[] 圖片陣列 * @param listener 傾聽者 * @param Random() 產生亂數陣列的方法 */ public void setUI() { setSize(560, 410); container = getContentPane(); listener = new Listener(); this.setLayout(new GridLayout(3, 4, 10, 10)); imageicon = new ImageIcon[13]; imageicon[0] = new ImageIcon("0.gif"); for (int i = 1; i <= 6; i++) { imageicon[i] = new ImageIcon(i + ".jpg"); imageicon[i + 6] = new ImageIcon(i + ".jpg"); } Random(); button = new JButton[12]; for (int i = 0; i < button.length; i++) { button[i] = new JButton(imageicon[0]); button[i].setEnabled(true); this.add(button[i]); button[i].addMouseListener(listener); } } /** * 產生亂數陣列 * @param N 總共要產生幾個亂數 * @param temp 暫存交換的陣列值 * @return 亂數陣列 */ public int[] Random() { int N = 12; random = new int[N + 1]; for (int i = 1; i <= N; i++) random[i] = i; for (int i = 1; i <= N; i++) { int j = (int) (Math.random() * N); if (j == 0) j = 1; int tmp = random[i]; random[i] = random[j]; random[j] = tmp; } return random; } /** * Listener類別繼承MouseAdapter */ class Listener extends MouseAdapter { /** * (non-Javadoc) * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) */ public void mouseClicked(MouseEvent e) { if (press1 != -1) if (e.getSource() == button[press1]) return; if (press2 != -1) if (e.getSource() == button[press2]) return; for (int i = 0; i < button.length; i++) { if (button[i].isEnabled()) { if (e.getSource() == button[i]) { count++; totalclick++; if (count > 2) { button[press1].setIcon(imageicon[0]); button[press2].setIcon(imageicon[0]); count = 1; press1 = -1; press2 = -1; } button[i].setIcon(imageicon[random[i + 1]]); if (count == 1) { press1 = i; } if (count == 2) { press2 = i; } if (press1 != -1 && press2 != -1) { if (Math.abs(random[press1 + 1] - random[press2 + 1]) == 6) { button[press1].setEnabled(false); button[press2].setEnabled(false); press1 = -1; press2 = -1; count = 0; complete++; } } if (complete == 6) { JOptionPane.showMessageDialog(null, " 恭喜過關\n總共點擊了" + totalclick + "次" + "\n助教生日快樂!!!!"); } } } } } } }
48a07106e56a47959c5f419f9e1d9ec2179f72ac
9571ad835942c05de3f1362a519f6b0d09d745b6
/Farm Game Scorecard/src/main/java/info/curtbinder/farmgame/db/GamesTable.java
58e7d6a062d3cb63add6d13882028589923caed6
[ "MIT" ]
permissive
curtbinder/FarmGameScorecard
b2a8db24b5914ad07e42bac362022d6ff937714a
2608d06f431e78ddd51afa06a207ac6618d9f82b
refs/heads/master
2020-03-30T02:19:41.831373
2014-03-30T14:32:22
2014-03-30T14:32:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,626
java
/* * The MIT License (MIT) * * Copyright (c) 2014 by Curt Binder (http://curtbinder.info) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package info.curtbinder.farmgame.db; import android.database.sqlite.SQLiteDatabase; /** * Created by binder on 2/26/14. */ public class GamesTable { public static final String TABLE_NAME = "games"; public static final String COL_ID = "_id"; public static final String COL_DATE = "creation"; public static final String COL_NAME = "name"; public static final String CREATE_TABLE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (" + COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + COL_DATE + " TEXT NOT NULL, " + COL_NAME + " TEXT);"; // create table if not exists games (id integer primary key autoincrement // , creation text not null, name text); public static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME; public static void onCreate(SQLiteDatabase db) { //Log.d("GamesTable", "Create: " + CREATE_TABLE); db.execSQL( CREATE_TABLE ); } public static void onUpgrade ( SQLiteDatabase db, int oldVersion, int newVersion ) { // initially, just drop tables and create new_shadow ones dropTable( db ); onCreate( db ); } public static void dropTable(SQLiteDatabase db) { db.execSQL( DROP_TABLE ); } public static void onDowngrade ( SQLiteDatabase db, int oldVersion, int newVersion ) { dropTable( db ); } }
f67b2c00d2950d9f1897d5c7de0c31258f6fc550
2ad5e3fca417d0fdd144a8c856277e04e5831059
/LoanSimulation/src/fr/formation/exceptions/IllegalAmountException.java
aa0122a3549afd341ccf51432bd77f69fe2ad56e
[]
no_license
Kobaya65/LoanSimulation
f2085e9e3d19257003ff86d0af0e5834a13043cc
65bbc141d239d80776929566b0098b6c596ae47c
refs/heads/master
2020-06-24T13:06:30.286682
2019-08-25T18:06:42
2019-08-25T18:06:42
198,969,888
0
0
null
null
null
null
UTF-8
Java
false
false
310
java
package fr.formation.exceptions; /** * Amount not permitted for a loan. * * @author Philippe AMICE * */ public class IllegalAmountException extends Exception { private static final long serialVersionUID = 1L; public IllegalAmountException(String message) { super(message); } }
48b1ae3a49d416a52a27d61e8b41521d99fc86a5
cde8ff5241fcbd1c651ac83cc1adb3a1d65d8128
/Algorytmy/src/main/java/tasks/g4g/LongestWord.java
57be573b0917f1e01b45e7a36335f0f4aaf9c1b4
[]
no_license
RNiesler/kursy
cc548ea610ef1f8eface5574f45daffefabdfe0d
c08ff5e0bac6f84ffe9ce45d22577679966012d2
refs/heads/master
2018-09-04T07:12:17.541472
2018-09-03T07:30:25
2018-09-03T07:30:25
119,416,015
0
0
null
null
null
null
UTF-8
Java
false
false
989
java
package tasks.g4g; import java.util.List; import java.util.Objects; import java.util.Optional; public class LongestWord { public static Optional<String> longestWord(List<String> dictionary, String pattern) { Objects.requireNonNull(dictionary); int max = 0; String maxWord = null; for (String dictWord : dictionary) { if (dictWord.length() > max && matches(pattern, dictWord)) { max = dictWord.length(); maxWord = dictWord; } } return Optional.ofNullable(maxWord); } private static boolean matches(String pattern, String dictWord) { int patternInd = 0; int wordInd = 0; while (wordInd < dictWord.length() && patternInd < pattern.length()) { if (pattern.charAt(patternInd) == dictWord.charAt(wordInd)) { wordInd++; } patternInd++; } return wordInd == dictWord.length(); } }
3223ceb33f2e9f282572746f437f308c0ccb7f99
ef1fed1572f26b8bdd326f6922193302575ad369
/express-server/src/test/java/com/express/service/dto/ProjectAccessRequestTest.java
0924aef8aa331f641d202c249ee7700c964556f5
[]
no_license
kevendra/agileexpress
fc42e8436b93db9ee5511ea162bf9690e291a14d
d2a040da13fbc2ff5ce28a3115fc97a2e0e9d030
refs/heads/master
2021-01-20T00:58:30.242938
2011-08-16T06:44:06
2011-08-16T06:44:06
2,214,309
1
4
null
null
null
null
UTF-8
Java
false
false
514
java
package com.express.service.dto; import org.junit.Before; import org.junit.Test; import static com.express.matcher.BeanMatchers.hasValidSettersAndGettersExcluding; import static org.hamcrest.MatcherAssert.assertThat; public class ProjectAccessRequestTest { private ProjectAccessRequest request; @Before public void setUp() { request = new ProjectAccessRequest(); } @Test public void shouldSetAndGetProperties() { assertThat(request, hasValidSettersAndGettersExcluding()); } }
b97574ee9e8d8495d109187145e205da1f2002d5
1e56b956392b54b1dec28b4ecc7b62ef5046d7ef
/src/main/java/maketeams/Team.java
f3a71672a34d7b01074f02d096b7d08bd7e88f84
[]
no_license
drozdik/make-teams
2affcaacafc95140636afc5cb055d9425fc41d13
1853d17d2321d2a947b04dad77c7cde20fcdc105
refs/heads/master
2020-04-09T09:26:11.876549
2018-12-16T18:49:00
2018-12-16T18:49:00
160,233,324
0
0
null
null
null
null
UTF-8
Java
false
false
654
java
package maketeams; import java.util.ArrayList; import java.util.Collections; import java.util.List; import static java.util.stream.Collectors.toList; public class Team { private List<Member> members = new ArrayList<>(); private String name; public Team(String name) { this.name = name; } public String getName() { return name; } public List<String> getMemberNames() { return members.stream().map(Member::getName).collect(toList()); } public void addMember(Member paul) { members.add(paul); } public void removeMember(Member paul) { members.remove(paul); } }
c525b76ee4fd4936b6ec000f55411bb5548fe7a7
35b710e9bc210a152cc6cda331e71e9116ba478c
/tc-main/src/main/java/com/topcoder/web/csf/model/SubmissionType.java
54d2c72acc3ace7039fda1052a9920e68806960b
[]
no_license
appirio-tech/tc1-tcnode
d17649afb38998868f9a6d51920c4fe34c3e7174
e05a425be705aca8f530caac1da907d9a6c4215a
refs/heads/master
2023-08-04T19:58:39.617425
2016-05-15T00:22:36
2016-05-15T00:22:36
56,892,466
1
8
null
2022-04-05T00:47:40
2016-04-23T00:27:46
Java
UTF-8
Java
false
false
512
java
package com.topcoder.web.csf.model; import com.topcoder.web.common.model.Base; /** * @author dok * @version $Revision: 57814 $ Date: 2005/01/01 00:00:00 * Create Date: Jun 27, 2006 */ public class SubmissionType extends Base { public static final Integer INITIAL_CONTEST_SUBMISSION_TYPE = new Integer(1); private Integer id; private String description; public Integer getId() { return id; } public String getDescription() { return description; } }
b8bb97de333a5298e50b553f445322a3442ffdac
488597e5c445dc907a7e789283f2855bb9a8c3a6
/src/main/java/io/topiacoin/eosrpcadapter/messages/Keys.java
958827003dae08ea5000edf2afedbd0516612f07
[]
no_license
TopiaCoin/EOSRPCAdapter-Java
1dbfaec9c6bc67366abefdee5a8b2d91a74aab2c
98edd48a3f6956b49e32a649d1df8d249f9fe904
refs/heads/1.0-develop
2022-12-16T11:20:27.983705
2019-06-21T20:54:15
2019-06-21T20:54:15
139,069,499
20
10
null
2022-11-16T11:30:28
2018-06-28T21:22:11
Java
UTF-8
Java
false
false
386
java
package io.topiacoin.eosrpcadapter.messages; import java.util.List; public class Keys { public List<KeyPair> keys; public static class KeyPair{ public String publicKey; public String privateKey; public KeyPair(String publicKey, String privateKey) { this.publicKey = publicKey; this.privateKey = privateKey; } } }
6ca973b2f3d17a3c7307aa6f9eec75ce222ac6c8
3e3ec4bc396fb778507c64bbd011414dbebb5e3f
/src/main/java/com/snapengage/intergrations/custom/Application.java
58146981e01238d74278ba693b2f51a4eac4f07b
[]
no_license
sivaa/spring-boot-couchbase-elastic-search
31b57d28694d2da0eaaf5f33397a06bcdc6e377b
be4a31a51033b43a5c07eb3ae4d65f53a5069933
refs/heads/master
2020-03-11T15:25:08.391128
2018-04-18T15:31:04
2018-04-18T15:31:04
130,083,585
0
2
null
null
null
null
UTF-8
Java
false
false
441
java
package com.snapengage.intergrations.custom; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.EnableConfigurationProperties; @EnableConfigurationProperties @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
0b9fc63a45eb97ab2def757e8f349a0bf6846396
32a0bc46159ccf73c3491be6e5bb63a97b26c370
/Inicios/Repaso_bucles/Ejer10.java
158cac43cad88a3e10769786b7a0a09e2b0c96b0
[]
no_license
PMUbide/JavaDAM
c9e40ba5c0b96a1f044bc88adcf32b22f0da088b
4996f721cd0f8c3fe0ca4c78f66861914a812e9c
refs/heads/master
2023-05-08T07:07:41.243958
2021-05-28T17:55:13
2021-05-28T17:55:13
322,581,252
0
0
null
null
null
null
WINDOWS-1250
Java
false
false
788
java
import java.util.*; public class Ejer10 { public static void main(String[] args) { // TODO Auto-generated method stub // Implementa un programa Java que dibuje una pirámide de // asteriscos. El usuario debe introducir la altura de la pirámide por teclado. // Este es un ejemplo si introducimos 5: // * // *** // ***** // ******* // ********* Scanner in = new Scanner(System.in); int num=in.nextInt();; int espacios=num; for (int i = 0; i <= num; i++) { for (int espa1 = espacios; espa1 >0; espa1--) { System.out.print(" "); } for (int asterisk = 0; asterisk < (i*2 -1); asterisk++) { System.out.print("*"); } espacios--; System.out.println(); } } }
17427991fc2b94c9548b9c5fd695125f1ff1b7d6
80c48a6f42b65d2b8055ef56cc9746935256641a
/java/common/broker_connector_instances/src/main/java/com/binance/api/client/domain/event/TopOrdersEvent.java
8cfeff2cb5d079883d520ced098e531eb825b358
[]
no_license
JJJerome/alpha_avellaneda_stoikov
759cc158a3bcb9463832fd0e317cedf3f800d384
2ce85a55684337efdc8d36aafd57cd2296f8cd23
refs/heads/master
2023-05-06T00:40:33.894169
2021-05-27T06:31:19
2021-05-27T06:31:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,182
java
package com.binance.api.client.domain.event; import com.binance.api.client.constant.BinanceApiConstants; import com.binance.api.client.domain.market.OrderBookEntry; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.apache.commons.lang3.builder.ToStringBuilder; import java.util.List; /** * Top bids and asks from Partial Book Depth event */ @JsonIgnoreProperties(ignoreUnknown = true) public class TopOrdersEvent { private Long lastUpdateId; private List<OrderBookEntry> bids; private List<OrderBookEntry> asks; public Long getLastUpdateId() { return lastUpdateId; } public void setLastUpdateId(Long lastUpdateId) { this.lastUpdateId = lastUpdateId; } public List<OrderBookEntry> getBids() { return bids; } public void setBids(List<OrderBookEntry> bids) { this.bids = bids; } public List<OrderBookEntry> getAsks() { return asks; } public void setAsks(List<OrderBookEntry> asks) { this.asks = asks; } @Override public String toString() { return new ToStringBuilder(this, BinanceApiConstants.TO_STRING_BUILDER_STYLE) .append("lastUpdateId", lastUpdateId).append("bids", bids).append("asks", asks).toString(); } }
47c4d683da8af9ad89feb76ab1dc0f2f4a41bfa2
e022f5e6915dad9824ee2940f07db43c29297ea7
/app/src/main/java/com/li/education/main/mine/StudyRecordDetailsActivity.java
a6fd15d3dcade0b85ee9d904bfe9bb5010f5b7db
[]
no_license
aducation/truck
23611f1e511e010d83dcd899beab63e8ec4651b0
8498a1158ca50baa8f5c7abae677464f541e2947
refs/heads/master
2021-08-30T21:29:23.880411
2017-12-19T13:30:42
2017-12-19T13:30:42
114,768,583
0
0
null
null
null
null
UTF-8
Java
false
false
1,789
java
package com.li.education.main.mine; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.li.education.R; import com.li.education.base.BaseActivity; import com.li.education.base.bean.vo.StudyRecordVO; import com.li.education.util.UtilData; import com.li.education.util.UtilDate; /** * Created by liu on 2017/6/19. */ public class StudyRecordDetailsActivity extends BaseActivity{ private ImageView mIvBack; private TextView mTvName; private TextView mTvTimeNum; private TextView mTvStart; private TextView mTvEnd; private StudyRecordVO mVO; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_study_details); Bundle bundle = getIntent().getExtras(); mVO = (StudyRecordVO) bundle.getSerializable("vo"); initView(); } private void initView() { mIvBack = (ImageView) findViewById(R.id.iv_back); mIvBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); mTvName = (TextView) findViewById(R.id.tv_name); mTvTimeNum = (TextView) findViewById(R.id.tv_time); mTvStart = (TextView) findViewById(R.id.tv_start); mTvEnd = (TextView) findViewById(R.id.tv_end); mTvName.setText(mVO.getTypetitle()); mTvTimeNum.setText(mVO.getLongtime() + "分"); mTvStart.setText(UtilDate.format(mVO.getStarttime(),"yyyy-MM-dd HH:mm:ss")); mTvEnd.setText(UtilDate.format(mVO.getEndtime(), "yyyy-MM-dd HH:mm:ss")); } }
47dc3d05233d40e1805311c9e1db3be281cdbfc3
8bb0bf6dd773bbdecb718a9ead269144e236102b
/src/main/java/se/redmind/rmtest/web/route/api/stats/devicefail/DeviceFailResultBuilder.java
f9430a6d499f2dd66d65a46365989018b3b41519
[]
no_license
RedmindAB/RMReport
94d4fcba2f799a14b52ff82132ddade541d390ff
2b818b82314600b5b735e7aeec9e4a5b4aa7c34f
refs/heads/master
2021-03-27T13:16:16.238274
2015-06-22T13:18:23
2015-06-22T13:18:23
29,964,221
1
0
null
null
null
null
UTF-8
Java
false
false
2,238
java
package se.redmind.rmtest.web.route.api.stats.devicefail; import java.util.HashMap; import java.util.Set; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; public class DeviceFailResultBuilder { private String DEVICENAME, RESULT; private JsonArray deviceArray; private HashMap<String,Integer> totalRes; private HashMap<String,Integer> totalFail; public DeviceFailResultBuilder(JsonArray deviceArray) { this.deviceArray = deviceArray; this.totalRes = new HashMap<String,Integer>(); this.totalFail = new HashMap<String,Integer>(); this.DEVICENAME = DeviceStatusFailDAO.DEVICENAME; this.RESULT = DeviceStatusFailDAO.RESULT; } public JsonArray getResults(){ for (JsonElement deviceFail : deviceArray) { JsonObject deviceFailJson = deviceFail.getAsJsonObject(); String devicename = deviceFailJson.get(DEVICENAME).getAsString(); String result = deviceFailJson.get(RESULT).getAsString(); addResult(devicename, result); } return buildResult(); } private JsonArray buildResult(){ Set<String> keySet = totalRes.keySet(); JsonArray array = new JsonArray(); for (String devicename : keySet) { JsonObject jObj = new JsonObject(); jObj.addProperty(DEVICENAME, devicename); jObj.addProperty("total", totalRes.get(devicename)); jObj.addProperty("totalFail", totalFail.get(devicename)); array.add(jObj); } return array; } private void addResult(String devicename, String result) { addTotalRes(devicename); addTotalFail(devicename, result); } private void addTotalFail(String devicename, String result) { Integer tot = totalFail.get(devicename); boolean isFail = isFail(result); if (tot != null && isFail) { totalFail.put(devicename, (tot+1)); } else if (tot == null && isFail(result)){ totalFail.put(devicename, 1); } else if (tot == null && !isFail ){ totalFail.put(devicename, 0); } } private void addTotalRes(String devicename) { Integer tot = totalRes.get(devicename); if (tot != null) { totalRes.put(devicename, (tot+1)); } else totalRes.put(devicename, 1); } private boolean isFail(String result){ return result.equals("failure") || result.equals("error"); } }
545b6895e50af3392f106e0fbf74f3d541eb89d4
a825136dabbb159635457a945e8d9ca7bc0434e3
/app/src/main/java/com/app/haptikchat/ChatActivity.java
0b8f6fe410c6bea7b1c886abf1803304634c68ab
[]
no_license
swapnadhabadia/chatapp
b7d5c64e89eb64b4b95e9dbf4a724a27102b6b3b
232511e199fb4a6818c105b5c940653738f954fc
refs/heads/master
2021-01-17T08:22:48.728358
2017-03-29T09:02:55
2017-03-29T09:02:55
83,888,135
0
0
null
null
null
null
UTF-8
Java
false
false
1,660
java
package com.app.haptikchat; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.support.design.widget.TabLayout; import android.support.v4.view.ViewPager; import com.app.haptikchat.adapter.ChatFragmentPagerAdapter; import com.app.haptikchat.chatdetail.summary.RefreshFragmentInterface; public class ChatActivity extends FragmentActivity { TabLayout tabLayout; private ViewPager viewPager; private ChatFragmentPagerAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.chat_main); viewPager = (ViewPager) findViewById(R.id.viewpager); adapter = new ChatFragmentPagerAdapter(getSupportFragmentManager(), ChatActivity.this); viewPager.setAdapter(adapter); // Give the TabLayout the ViewPager tabLayout = (TabLayout) findViewById(R.id.tabs); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { RefreshFragmentInterface fragment = (RefreshFragmentInterface) adapter.instantiateItem(viewPager, position); if (fragment != null) { fragment.refreshData(); } } @Override public void onPageScrollStateChanged(int state) { } }); tabLayout.setupWithViewPager(viewPager); } }
13f5a7e79cce2e1caa4ca4954cd985f75da3998d
10e2e4078b3914b56dc46c97dab73eeb2606e559
/Weather-Client/src/main/java/Launcher.java
4282d48ffac50402478c1d7b438271a370fe8d5e
[]
no_license
Tuccro/Weather-Client-Server-App
d640b22eecd4840c9c7acbf51e2c99634cc8e59c
85a78da4f7be16b04c18d25a1377a3fb59550cca
refs/heads/master
2016-09-05T22:01:13.324302
2015-01-15T10:29:39
2015-01-15T10:29:39
26,785,232
0
0
null
null
null
null
UTF-8
Java
false
false
171
java
public class Launcher { public static void main(String[] args) { String []arg = new String[1]; arg[0] = "localhost"; Client.main(arg); } }
2ea52e94ab7def12e4dcb9f0c5fd85ed57474fb1
72a01861ea9f22a41366ab7dfb0b0463a66af5f3
/app/src/main/java/com/cai/chat_05/UserInforActivity.java
25c9ea252717176640c6f463591899f34de3d5f0
[]
no_license
sengeiou/chat-1
a8b6f2be1f5fbc34434f711d299761402a14c91b
9063b8df1238b6ac2a510bfdbaca6fcace20328e
refs/heads/master
2020-07-01T17:11:28.267359
2016-07-10T03:39:39
2016-07-10T03:39:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,889
java
package com.cai.chat_05; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.cai.chat_05.bean.Attachment; import com.cai.chat_05.bean.Constants; import com.cai.chat_05.bean.Friends; import com.cai.chat_05.bean.FriendsGroup; import com.cai.chat_05.bean.User; import com.cai.chat_05.cache.CacheManager; import com.cai.chat_05.utils.UIHelper; import com.cai.chat_05.view.CircularImage; import com.cai.chat_05.view.HandyTextView; import java.util.List; import butterknife.ButterKnife; import butterknife.InjectView; public class UserInforActivity extends FragmentActivity { @InjectView(R.id.user_photo) protected CircularImage photoIV; @InjectView(R.id.user_name) protected TextView nameTV; @InjectView(R.id.account) protected TextView accountTV; @InjectView(R.id.gender_tv) protected TextView genderTV; @InjectView(R.id.signature_tv) protected TextView signatureTV; @InjectView(R.id.action_button) protected Button actionButton; @InjectView(R.id.three) protected View friendGroup; private int myId; private String token; private int userId; private String type; private User user; private Friends mFriends; private FriendsGroup mFriendsGroup; private List<Friends> friends; private List<FriendsGroup> friendsGroups; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_user_infor); ButterKnife.inject(this); Intent intent = getIntent(); myId = intent.getIntExtra(Constants.INTENT_EXTRA_MY_ID, 0); userId = intent.getIntExtra(Constants.INTENT_EXTRA_USER_ID, 0); type = intent.getStringExtra(Constants.INTENT_EXTRA_USER_INFOR_TYPE); token = intent.getStringExtra(Constants.INTENT_EXTRA_TOKEN); // 获取数据 // WeisheApi.getUser(mHandler, userId); } private void initView() { switch (type) { case Constants.INTENT_EXTRA_USER_INFOR_TYPE_ADD_FRIENDS: actionButton.setText("加为好友"); actionButton.setOnClickListener(addFriends); friendGroup.setVisibility(View.GONE); break; case Constants.INTENT_EXTRA_USER_INFOR_TYPE_USERINFOR: actionButton.setText("发送消息"); actionButton.setOnClickListener(sendMessage); friendGroup.setVisibility(View.VISIBLE); friends = (List<Friends>) CacheManager.readObject(this, Friends.getCacheKey(myId)); friendsGroups = (List<FriendsGroup>) CacheManager.readObject(this, FriendsGroup.getCacheKey(myId)); TextView groupText = (TextView) friendGroup .findViewById(R.id.friends_group); if (mFriendsGroup == null) { if (friends != null && friends.size() > 0 && friendsGroups != null && friendsGroups.size() > 0) { for (Friends f : friends) { if (f.getUserId() == user.getId()) { mFriends = f; user = new User(); user.setId(mFriends.getId()); user.setName(mFriends.getName()); user.setAge(mFriends.getAge()); for (FriendsGroup fg : friendsGroups) { if (fg.getId() == f.getFriendsGroupId()) { mFriendsGroup = fg; groupText.setText(mFriendsGroup.getName()); break; } } } } } else { for (Friends f : friends) { if (f.getUserId() == user.getId()) { mFriends = f; user = new User(); user.setId(mFriends.getId()); user.setName(mFriends.getName()); user.setAge(mFriends.getAge()); } } groupText.setText("未分组"); } } else { groupText.setText(mFriendsGroup.getName()); } friendGroup.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { UIHelper.startGroupSelectorActivity(UserInforActivity.this, mFriends); } }); break; default: break; } if (user != null) { nameTV.setText(user.getName()); accountTV.setText(user.getAccount()); signatureTV.setText(user.getSignature()); switch (user.getGender()) { case User.GENDER_MALE: genderTV.setText("男"); break; case User.GENDER_FEMALE: genderTV.setText("女"); break; case User.GENDER_UNKNOWN: genderTV.setText("未知"); break; default: genderTV.setText("未知"); break; } Attachment a = JSON.parseObject(user.getAvatar(), Attachment.class); if (a != null) { photoIV.setImage(a.getGroupName(), a.getPath()); } } } private OnClickListener sendMessage = new OnClickListener() { @Override public void onClick(View v) { UIHelper.startChatActivity(UserInforActivity.this, Constants.MSG_TYPE_UU, mFriends, null, null); UserInforActivity.this.finish(); } }; private OnClickListener addFriends = new OnClickListener() { @Override public void onClick(View v) { // WeisheApi.addFriends(addFriendHandler, myId, token, userId); } }; // protected AsyncHttpResponseHandler addFriendHandler = new AsyncHttpResponseHandler() { // // @Override // public void onSuccess(int statusCode, Header[] headers, // byte[] responseBytes) { // String data = new String(responseBytes); // Result u = (Result) JSON.parseObject(data, Result.class); // if (u != null && u.isSuccess()) { // showCustomToast("添加好友请求已发出!"); // // actionButton.setEnabled(false); // actionButton.setVisibility(View.GONE); // } else { // showCustomToast("添加好友发生异常!"); // } // } // // @Override // public void onFailure(int arg0, Header[] arg1, byte[] arg2, // Throwable arg3) { // showCustomToast("添加好友发生异常!"); // // } // // }; // protected AsyncHttpResponseHandler mHandler = new AsyncHttpResponseHandler() { // // @Override // public void onSuccess(int statusCode, Header[] headers, // byte[] responseBytes) { // String data = new String(responseBytes); // User u = (User) JSON.parseObject(data, User.class); // if (u != null) { // user = u; // initView(); // } else { // showCustomToast("获取用户信息发生异常!"); // } // } // // @Override // public void onFailure(int arg0, Header[] arg1, byte[] arg2, // Throwable arg3) { // showCustomToast("获取用户信息发生异常!"); // // } // // }; /** 显示自定义Toast提示(来自String) **/ protected void showCustomToast(String text) { View toastRoot = LayoutInflater.from(this).inflate( R.layout.common_toast, null); ((HandyTextView) toastRoot.findViewById(R.id.toast_text)).setText(text); Toast toast = new Toast(this); toast.setGravity(Gravity.CENTER, 0, 0); toast.setDuration(Toast.LENGTH_SHORT); toast.setView(toastRoot); toast.show(); } }
05934d6eca1c4668e394c43e13d100460a9461f9
17c624383e5f20343d31bfb77d3d4d2e12112600
/Tugas 1/Sensor/app/src/androidTest/java/mobile/its/ac/id/sensor/ExampleInstrumentedTest.java
24061bc2d628e40096aa2d08ac02e83301c92b31
[]
no_license
hanifsudira/Pervasif-dan-Sensor
03fc74bf24020e2d1cf50733445bccf7fe3cfd44
e51a8c69129bb3430bcd975b6351d733f7bdee79
refs/heads/master
2021-01-12T12:49:36.234725
2016-11-01T23:42:46
2016-11-01T23:42:46
68,997,556
0
0
null
null
null
null
UTF-8
Java
false
false
750
java
package mobile.its.ac.id.sensor; 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("mobile.its.ac.id.sensor", appContext.getPackageName()); } }
d9a4db77808805e924caa38bb2d7f86bb4fb3f71
30b10b1c2748f538c87f75cf3d17f4950ee7126e
/src/main/java/edu/ucu/assignmenttwo/mySpring/ObjectConfigurator.java
86a600bffbe9b9005d3089a47a50d2eb61e6275c
[]
no_license
pyalex/ucu-programming
4f43a63075b38e363ffbc9e9dfd0685f7d5dc372
7132ebfc2a5727055252c7cbc6e82da218611834
refs/heads/master
2021-05-08T02:10:24.567262
2017-12-10T22:00:13
2017-12-10T22:00:13
107,975,929
0
0
null
null
null
null
UTF-8
Java
false
false
125
java
package edu.ucu.assignmenttwo.mySpring; public interface ObjectConfigurator { <T> void configure(Class<T> type, T o); }
7889bbab60e9daa40fa75343d944c353614a068b
fb220c9e0ef0898553f6da5d08bf69f10511a556
/timer/src/test/java/gmail/ichglauben/timer/AppTest.java
4292b18aa3acec9090cb2bff0124b43621167c58
[]
no_license
quauab/MyTimer
e6fe702b8c0bdb6f0ee1f07bf1490e49621eaea3
9c68c0f14b67692941d6455965c316d3f3f3ecc5
refs/heads/master
2021-01-10T04:49:55.052744
2016-03-11T21:00:14
2016-03-11T21:00:14
53,696,453
0
1
null
null
null
null
UTF-8
Java
false
false
688
java
package gmail.ichglauben.timer; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
2afc2ce052352b3a2980d8ae5d20362f6b272234
7a287567d26e3ce57c2a4eb765f1628145b61b8e
/MrFlower/src/pot/dao/android/wateringDaoAndroid.java
d7c980dea5b57e51924b42c95fe3d3eccbf08e31
[ "LicenseRef-scancode-other-permissive", "MIT", "NTP", "LicenseRef-scancode-rsa-1990", "LicenseRef-scancode-rsa-md4", "Beerware", "RSA-MD", "HPND-sell-variant", "Spencer-94", "LicenseRef-scancode-zeusbench", "metamail", "Apache-2.0" ]
permissive
lvsijian8/MrFlower_for_Web
2dce77ba11e86e2f07577dcf709f13896122da76
4f5d45ab923a100005dccff7ea575f93faca0086
refs/heads/master
2021-06-24T11:30:58.905644
2017-06-10T12:14:07
2017-06-10T13:00:19
84,523,698
0
0
null
null
null
null
UTF-8
Java
false
false
2,125
java
package pot.dao.android; import pot.util.DBConnection; import java.sql.*; import java.util.Date; /** * Created by lvsijian8 on 2017/4/16. */ public class wateringDaoAndroid { public int watering(int user_id, int pot_id, String device) { int state = 0; Connection con = null; PreparedStatement prepstmt = null; ResultSet rs = null; Timestamp now = new Timestamp(new Date().getTime()); int water = 50; String sqlFindWater = "SELECT water_ml,now_water FROM pot WHERE pot_id=?;"; String sqlUpdataWater = "UPDATE pot SET watering_time=?,now_water=? where pot_id=?;"; String sqlAddHistory = "INSERT INTO history (pot_id, user_id, device, time, handle,detail) VALUES(?,?,?,?,?,?);"; try { con = DBConnection.getDBConnection(); prepstmt = con.prepareStatement(sqlFindWater); prepstmt.setInt(1, pot_id); rs = prepstmt.executeQuery(); while (rs.next()) { water = rs.getInt("now_water") - (int) ((rs.getInt("water_ml") * 1.0) / 12.18); } if (water <= 0) state = -1; else { prepstmt = con.prepareStatement(sqlUpdataWater); prepstmt.setTimestamp(1, now); prepstmt.setInt(2, water); prepstmt.setInt(3, pot_id); if (prepstmt.executeUpdate() != 0) state = 1; else state = 0; prepstmt = con.prepareStatement(sqlAddHistory); prepstmt.setInt(1, pot_id); prepstmt.setInt(2, user_id); prepstmt.setString(3, device); prepstmt.setTimestamp(4, now); prepstmt.setString(5, "watering"); prepstmt.setString(6, "浇水完成后剩余" + water + "%"); prepstmt.executeUpdate(); } } catch (SQLException e) { e.printStackTrace(); } finally { DBConnection.closeDB(con, prepstmt, rs); } return state; } }
ce51a5aa8e98c77fc15aa26b70bd6a2dd35195a3
c7d8464a42d6288e4eb353858bf51300f5f26153
/app/src/main/java/com/example/user/majalahe_sport/entity/Majalah.java
5c175d040485ea28f5472887f479f355e352c038
[]
no_license
Widiyanto9876/MajalahE-sport
ead0e31eb12b25769435fc0d9da753dfd288cfd6
38550ca0b5ad1800f1f10359700ae65d5138e739
refs/heads/master
2020-06-11T16:15:01.743341
2019-06-27T04:04:36
2019-06-27T04:04:36
194,020,230
0
0
null
null
null
null
UTF-8
Java
false
false
835
java
package com.example.user.majalahe_sport.entity; public class Majalah { private String name, remarks, photo,detail_kode, url; public String getName(){ return name; } public void setName(String name){ this.name = name; } public String getRemarks() { return remarks; } public void setRemarks(String remarks){ this.remarks = remarks; } public String getPhoto(){ return photo; } public void setPhoto(String photo){ this.photo = photo; } public String getDetail_kode() { return detail_kode; } public void setDetail_kode(String detail_kode) { this.detail_kode = detail_kode; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } }
9a75a7478eabb2e616a32fd831fd446ddfc28fc0
1368795964d528e3f6c830e3e0c5dac26fcd4290
/mcdndsimple-sponge/src/main/java/io/musician101/mcdndsimple/sponge/gui/player/RangedBonusGUI.java
0afc092653303019d61fd2826d8bfb3391e6a531
[]
no_license
Musician101/MCDND-Simple
71d880cefb23c846ec33da223dede389d12073f1
c0cd01170ea2d944c52eef7425b6c55ae921805d
refs/heads/master
2021-01-11T03:11:32.594566
2020-04-15T09:07:34
2020-04-15T09:07:34
71,114,944
0
0
null
null
null
null
UTF-8
Java
false
false
2,940
java
package io.musician101.mcdndsimple.sponge.gui.player; import com.google.common.collect.ImmutableMap; import io.musician101.mcdndsimple.common.Dice; import io.musician101.mcdndsimple.common.character.player.MCDNDPlayer; import io.musician101.mcdndsimple.common.character.player.bonus.RangedBonus; import io.musician101.mcdndsimple.common.reference.MenuText; import io.musician101.mcdndsimple.common.reference.Messages; import io.musician101.mcdndsimple.sponge.SpongeMCDNDSimple; import io.musician101.mcdndsimple.sponge.gui.SpongeMCDNDSimpleGUI; import io.musician101.musicianlibrary.java.minecraft.sponge.SpongeTextInput; import io.musician101.musicianlibrary.java.minecraft.sponge.gui.SpongeIconBuilder; import javax.annotation.Nonnull; import org.spongepowered.api.effect.potion.PotionEffectTypes; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.event.item.inventory.ClickInventoryEvent; import org.spongepowered.api.item.ItemTypes; import org.spongepowered.api.text.Text; import org.spongepowered.api.text.format.TextColors; public class RangedBonusGUI extends SpongeMCDNDSimpleGUI { public RangedBonusGUI(@Nonnull MCDNDPlayer mcdndPlayer, @Nonnull Player player) { super(player, MenuText.RANGED_BONUSES, 9); RangedBonus rangedBonus = mcdndPlayer.getCharacterSheet().getCoreStatsTab().getBonuses().getRanged(); setButton(0, SpongeIconBuilder.of(ItemTypes.DIAMOND_SWORD, Text.of(MenuText.ATTACK_ROLLS)), ImmutableMap.of(ClickInventoryEvent.Primary.class, p -> new SpongeTextInput(SpongeMCDNDSimple.instance(), p) { @Override public void process(@Nonnull Player player, @Nonnull String s) { Dice dice = Dice.parse(s); if (dice == null) { player.sendMessage(Text.of(TextColors.RED + Messages.malformedDiceInput(s))); return; } rangedBonus.setAttack(dice); new RangedBonusGUI(mcdndPlayer, player); } })); setButton(1, SpongeIconBuilder.builder(ItemTypes.POTION).potionEffect(PotionEffectTypes.STRENGTH).name(Text.of(MenuText.DAMAGE_ROLLS)).build(), ImmutableMap.of(ClickInventoryEvent.Primary.class, p -> new SpongeTextInput(SpongeMCDNDSimple.instance(), p) { @Override public void process(@Nonnull Player player, @Nonnull String s) { Dice dice = Dice.parse(s); if (dice == null) { player.sendMessage(Text.of(TextColors.RED + Messages.malformedDiceInput(s))); return; } rangedBonus.setDamage(dice); new RangedBonusGUI(mcdndPlayer, player); } })); setButton(8, SpongeIconBuilder.of(ItemTypes.BARRIER, Text.of(MenuText.BACK)), ImmutableMap.of(ClickInventoryEvent.Primary.class, p -> new BonusesGUI(mcdndPlayer, p))); } }
45ffff495cb7a96d055999132d0857f8c8060e04
28b393c884ef0a20a9bbceb1aec57ff959f860e9
/easy-httpclient-mapper/src/main/java/com/zlatan/easy/httpclient/mapper/annotations/element/RequestEntity.java
0b2d75a5f6efccc9f3b34ac466cb5f4efea7c6c5
[]
no_license
ZlatanHe/easy-httpclient
4c1ac160affe5a5ad9ff1d483c32c342ebcbd3c1
a37a6ad831f86e513c3251e004ecd2fc286b4dd0
refs/heads/master
2020-03-15T11:20:41.664233
2018-05-14T02:20:29
2018-05-14T02:20:29
132,119,038
2
0
null
null
null
null
UTF-8
Java
false
false
298
java
package com.zlatan.easy.httpclient.mapper.annotations.element; import java.lang.annotation.*; /** * @Title: * @Description: * @Date: Created By hewei in 10/05/2018 8:45 PM */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PARAMETER}) @Documented public @interface RequestEntity { }
6f0fca55b173ab1f415b63ad2747ddd2a206f04d
7be39debec6828ed43bca0fb06459c944512bd53
/src/main/java/jgreg/internship/nii/Utils/Utils.java
8ff031a30fe2f34d1022caf954cbcd492aa4c974
[]
no_license
daimrod/csa
5485c49b82b4be55ffbbe0450530bfb3463ed72c
05b4377b5cf935a05e5245a4ec37384e0fbb1bb6
refs/heads/master
2016-09-06T08:24:50.511187
2015-03-09T06:18:18
2015-03-09T06:18:18
19,531,278
0
0
null
null
null
null
UTF-8
Java
false
false
4,046
java
// // Author:: Grégoire Jadi <[email protected]> // Copyright:: Copyright (c) 2014, Grégoire Jadi // 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. // // THIS SOFTWARE IS PROVIDED BY GRÉGOIRE JADI ``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 GRÉGOIRE JADI 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. // // The views and conclusions contained in the software and // documentation are those of the authors and should not be // interpreted as representing official policies, either expressed or // implied, of Grégoire Jadi. // package jgreg.internship.nii.Utils; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import jgreg.internship.nii.types.Token; import org.apache.commons.io.FileUtils; import org.apache.log4j.Logger; import edu.stanford.nlp.ling.CoreLabel; /** * Provide some functions. */ public class Utils { /** The Constant logger. */ private static final Logger logger = Logger.getLogger(Utils.class .getCanonicalName()); /** * Convert a List of {@link jgreg.internship.nii.types.Token} into a List of * {@link edu.stanford.nlp.ling.CoreLabel}. * * @param tokens * to convert * @return a new List */ public static List<CoreLabel> convertUIMA2STANFORD(List<Token> tokens) { return tokens.stream().map(token -> Utils.convertUIMA2STANFORD(token)) .collect(Collectors.toList()); } /** * Convert a {@link jgreg.internship.nii.types.Token} into the equivalent * Stanford JAVANLP Annotation. * * @param token * to convert to {@link edu.stanford.nlp.ling.CoreLabel} * @return a new List containing the converted objects */ public static CoreLabel convertUIMA2STANFORD(Token token) { CoreLabel ret = new CoreLabel(); ret.setBeginPosition(token.getBegin()); ret.setEndPosition(token.getEnd()); ret.setTag(token.getPOS()); ret.setWord(token.getCoveredText()); return ret; } /** * Read lines from a file. * * Lines starting with a '#' and empty lines are ignored. * * @param file * the file * @return the array list * @throws IOException * Signals that an I/O exception has occurred. */ public static ArrayList<String> readLines(File file) throws IOException { return new ArrayList<>(FileUtils.readLines(file).stream() .filter(line -> !line.startsWith("#")).map(line -> line.trim()) .filter(line -> !line.isEmpty()).collect(Collectors.toList())); } /** * Create a new ArrayList filled with an initial element. * * @param size * of the list. * @param initialElement * the initial element. * @return an array list. */ public static <T> ArrayList<T> List(int size, T initialElement) { ArrayList<T> ret = new ArrayList<>(size); for (int idx = 0; idx < size; idx++) { ret.add(idx, initialElement); } return ret; } }
b0b8486630fcd8ff1a217632acf5b53441c56604
001a1df9a4fa0933c6d52df827c3dc6b985cb2a5
/src/main/java/com/games/rockpaperscissors/RockPaperScissorsApplication.java
ff9922774193ca552a67a8f31b6f37007681c7be
[]
no_license
arshjohar/rockpaperscissors
f34c14746a90d188cdd583108865dbf88288fa1f
908850a09edf1160b2fd4daed0fd9c94a3467fd8
refs/heads/master
2021-01-13T09:17:26.300900
2016-01-19T12:45:18
2016-01-19T12:45:18
48,652,311
0
0
null
null
null
null
UTF-8
Java
false
false
1,265
java
package com.games.rockpaperscissors; import com.games.rockpaperscissors.resources.GameMatchesResource; import com.games.rockpaperscissors.resources.GameOptionsResource; import io.dropwizard.Application; import io.dropwizard.assets.AssetsBundle; import io.dropwizard.jersey.setup.JerseyEnvironment; import io.dropwizard.setup.Bootstrap; import io.dropwizard.setup.Environment; public class RockPaperScissorsApplication extends Application<RockPaperScissorsConfiguration> { public static void main(String[] args) throws Exception { new RockPaperScissorsApplication().run(args); } @Override public void initialize(Bootstrap<RockPaperScissorsConfiguration> bootstrap) { bootstrap.addBundle(new AssetsBundle("/assets", "/", "index.html")); } @Override public void run(RockPaperScissorsConfiguration rockPaperScissorsConfiguration, Environment environment) { final GameOptionsResource gameOptionsResource = new GameOptionsResource(); final GameMatchesResource gameMatchesResource = new GameMatchesResource(); final JerseyEnvironment jerseyEnvironment = environment.jersey(); jerseyEnvironment.register(gameOptionsResource); jerseyEnvironment.register(gameMatchesResource); } }
a69cb62305a8247d7e5c0303df91ac0032daa056
0205999a193bf670cd9d6e5b37e342b75f4e15b8
/spring-web/src/main/java/org/springframework/http/server/DefaultPathContainer.java
58243bbc6a13d461cb277025e4ef0feb4710cf70
[ "Apache-2.0" ]
permissive
leaderli/spring-source
18aa9a8c7c5e22d6faa6167e999ff88ffa211ba0
0edd75b2cedb00ad1357e7455a4fe9474b3284da
refs/heads/master
2022-02-18T16:34:19.625966
2022-01-29T08:56:48
2022-01-29T08:56:48
204,468,286
0
0
null
null
null
null
UTF-8
Java
false
false
9,436
java
/* * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.http.server; import org.springframework.lang.Nullable; import org.springframework.util.*; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.stream.Collectors; /** * Default implementation of {@link PathContainer}. * * @author Rossen Stoyanchev * @since 5.0 */ final class DefaultPathContainer implements PathContainer { private static final MultiValueMap<String, String> EMPTY_PARAMS = new LinkedMultiValueMap<>(); private static final PathContainer EMPTY_PATH = new DefaultPathContainer("", Collections.emptyList()); private static final Map<Character, DefaultSeparator> SEPARATORS = new HashMap<>(2); static { SEPARATORS.put('/', new DefaultSeparator('/', "%2F")); SEPARATORS.put('.', new DefaultSeparator('.', "%2E")); } private final String path; private final List<Element> elements; private DefaultPathContainer(String path, List<Element> elements) { this.path = path; this.elements = Collections.unmodifiableList(elements); } static PathContainer createFromUrlPath(String path, Options options) { if (path.equals("")) { return EMPTY_PATH; } char separator = options.separator(); DefaultSeparator separatorElement = SEPARATORS.get(separator); if (separatorElement == null) { throw new IllegalArgumentException("Unexpected separator: '" + separator + "'"); } List<Element> elements = new ArrayList<>(); int begin; if (path.length() > 0 && path.charAt(0) == separator) { begin = 1; elements.add(separatorElement); } else { begin = 0; } while (begin < path.length()) { int end = path.indexOf(separator, begin); String segment = (end != -1 ? path.substring(begin, end) : path.substring(begin)); if (!segment.equals("")) { elements.add(options.shouldDecodeAndParseSegments() ? decodeAndParsePathSegment(segment) : new DefaultPathSegment(segment, separatorElement)); } if (end == -1) { break; } elements.add(separatorElement); begin = end + 1; } return new DefaultPathContainer(path, elements); } private static PathSegment decodeAndParsePathSegment(String segment) { Charset charset = StandardCharsets.UTF_8; int index = segment.indexOf(';'); if (index == -1) { String valueToMatch = StringUtils.uriDecode(segment, charset); return new DefaultPathSegment(segment, valueToMatch, EMPTY_PARAMS); } else { String valueToMatch = StringUtils.uriDecode(segment.substring(0, index), charset); String pathParameterContent = segment.substring(index); MultiValueMap<String, String> parameters = parsePathParams(pathParameterContent, charset); return new DefaultPathSegment(segment, valueToMatch, parameters); } } private static MultiValueMap<String, String> parsePathParams(String input, Charset charset) { MultiValueMap<String, String> result = new LinkedMultiValueMap<>(); int begin = 1; while (begin < input.length()) { int end = input.indexOf(';', begin); String param = (end != -1 ? input.substring(begin, end) : input.substring(begin)); parsePathParamValues(param, charset, result); if (end == -1) { break; } begin = end + 1; } return result; } private static void parsePathParamValues(String input, Charset charset, MultiValueMap<String, String> output) { if (StringUtils.hasText(input)) { int index = input.indexOf('='); if (index != -1) { String name = input.substring(0, index); String value = input.substring(index + 1); for (String v : StringUtils.commaDelimitedListToStringArray(value)) { name = StringUtils.uriDecode(name, charset); if (StringUtils.hasText(name)) { output.add(name, StringUtils.uriDecode(v, charset)); } } } else { String name = StringUtils.uriDecode(input, charset); if (StringUtils.hasText(name)) { output.add(input, ""); } } } } static PathContainer subPath(PathContainer container, int fromIndex, int toIndex) { List<Element> elements = container.elements(); if (fromIndex == 0 && toIndex == elements.size()) { return container; } if (fromIndex == toIndex) { return EMPTY_PATH; } Assert.isTrue(fromIndex >= 0 && fromIndex < elements.size(), () -> "Invalid fromIndex: " + fromIndex); Assert.isTrue(toIndex >= 0 && toIndex <= elements.size(), () -> "Invalid toIndex: " + toIndex); Assert.isTrue(fromIndex < toIndex, () -> "fromIndex: " + fromIndex + " should be < toIndex " + toIndex); List<Element> subList = elements.subList(fromIndex, toIndex); String path = subList.stream().map(Element::value).collect(Collectors.joining("")); return new DefaultPathContainer(path, subList); } @Override public String value() { return this.path; } @Override public List<Element> elements() { return this.elements; } @Override public boolean equals(@Nullable Object other) { if (this == other) { return true; } if (!(other instanceof PathContainer)) { return false; } return value().equals(((PathContainer) other).value()); } @Override public int hashCode() { return this.path.hashCode(); } @Override public String toString() { return value(); } private static class DefaultSeparator implements Separator { private final String separator; private final String encodedSequence; DefaultSeparator(char separator, String encodedSequence) { this.separator = String.valueOf(separator); this.encodedSequence = encodedSequence; } @Override public String value() { return this.separator; } public String encodedSequence() { return this.encodedSequence; } } private static class DefaultPathSegment implements PathSegment { private final String value; private final String valueToMatch; private final char[] valueToMatchAsChars; private final MultiValueMap<String, String> parameters; /** * Constructor for decoded and parsed segments. */ DefaultPathSegment(String value, String valueToMatch, MultiValueMap<String, String> params) { this.value = value; this.valueToMatch = valueToMatch; this.valueToMatchAsChars = valueToMatch.toCharArray(); this.parameters = CollectionUtils.unmodifiableMultiValueMap(params); } /** * Constructor for segments without decoding and parsing. */ DefaultPathSegment(String value, DefaultSeparator separator) { this.value = value; this.valueToMatch = value.contains(separator.encodedSequence()) ? value.replaceAll(separator.encodedSequence(), separator.value()) : value; this.valueToMatchAsChars = this.valueToMatch.toCharArray(); this.parameters = EMPTY_PARAMS; } @Override public String value() { return this.value; } @Override public String valueToMatch() { return this.valueToMatch; } @Override public char[] valueToMatchAsChars() { return this.valueToMatchAsChars; } @Override public MultiValueMap<String, String> parameters() { return this.parameters; } @Override public boolean equals(@Nullable Object other) { if (this == other) { return true; } if (!(other instanceof PathSegment)) { return false; } return value().equals(((PathSegment) other).value()); } @Override public int hashCode() { return this.value.hashCode(); } public String toString() { return "[value='" + this.value + "']"; } } }
a3cb4580502b59dfd3878e6287162e0cf503df03
5ea31b59ab8c359601b3db7693de81cfeaaa27fb
/src/test/java/com/tequila/track/com/tequila/track/TrackingGetSercviceApplicationTests.java
eceac4113121ace542ddb5b880c6b01a90eff3bf
[]
no_license
raulguerrero-linkcode/trackinService
0c8db24c10aeb95d4cdeec664e3efdc720a5816d
318c7754c77c7c557936bea37a7c8fdfac10f6a7
refs/heads/main
2023-08-18T07:22:21.323185
2021-09-27T20:10:34
2021-09-27T20:10:34
411,027,185
0
0
null
null
null
null
UTF-8
Java
false
false
240
java
package com.tequila.track.com.tequila.track; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class TrackingGetSercviceApplicationTests { @Test void contextLoads() { } }
3019e30fdacee2446e4c0b51cc24029c69438ba1
3cd93422745cee5d890fbaacfaf1180aea42292a
/Annapurna-project-cartService/Cart-Service/Cart-Service/src/main/java/com/capgemini/CartService/entity/Product.java
a4fd30f9e184a9068dbba0480488139e672f70d0
[]
no_license
tudeore/first-project
3c371397ccbc376024660e4483cb725f0ee3a3c7
8fbb8a0c468e1b28b7827fb24a7fe5d45abb705b
refs/heads/master
2020-04-08T07:23:13.854868
2019-02-05T15:00:45
2019-02-05T15:00:45
159,137,125
0
0
null
null
null
null
UTF-8
Java
false
false
744
java
package com.capgemini.CartService.entity; public class Product { private Integer foodId; private String foodName; private double price; public Product() { super(); } public Product(Integer foodId, String foodName, double price) { super(); this.foodId = foodId; this.foodName = foodName; this.price = price; } public Integer getFoodId() { return foodId; } public void setFoodId(Integer foodId) { this.foodId = foodId; } public String getFoodName() { return foodName; } public void setFoodName(String foodName) { this.foodName = foodName; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } }
0da97b1b22f89e70cbc88dc403fc2d5f8e67942e
d6a493e357a75d2cb26dff084dfe6a88b72b7b25
/Find the month in the list/Main.java
bba6c7e2e4163340783b9aec1d6e0092cc6bb81e
[]
no_license
bsabarish/Playground
84a3c7534808003f187bbe192f32776b75909a11
5e2990ad61c2ef14d56cf4f93430af9e98ebf3e6
refs/heads/master
2020-04-14T12:44:06.719570
2019-04-29T18:35:58
2019-04-29T18:35:58
163,848,858
0
0
null
null
null
null
UTF-8
Java
false
false
869
java
import java.util.*; import java.io.*; import java.lang.*; public class Main { public static void main(String a[])throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); LinkedList<String> ll = new LinkedList<String>(); String month = br.readLine(); String[] arr = month.split(","); for(int i = 0;i<arr.length;i++) { ll.add(arr[i]); } System.out.println(ll); System.out.println("Size of the linked list: "+ll.size()); System.out.println("Is LinkedList empty? "+ll.isEmpty()); String m1 = br.readLine(); //System.out.println("Enter the month to find in the given list" +m1 = br.readLine()); System.out.println("Does LinkedList contains "+m1+"?"); System.out.println(ll.contains(m1)); } }
aa6659062e1014b3524fab415d2ff9aec12b8526
cbcc0de6f166099d54600bf5058be581f2b39faf
/src/main/java/com/sparta/advanced/dto/UserTimeDto.java
5cab1d0fbfdedc0dbd1d1237be0e59c56ac74ae9
[]
no_license
stat-kwon/hh99_spring_advanced_study
2e25634448f15a20b45a3c52cf38c635a90f3506
407f85ee3278f16695b2939dd14215f2e1b7ae39
refs/heads/main
2023-08-07T16:57:35.040973
2021-09-07T12:02:11
2021-09-07T12:02:11
383,235,142
2
0
null
null
null
null
UTF-8
Java
false
false
188
java
package com.sparta.advanced.dto; import lombok.AllArgsConstructor; import lombok.Getter; @AllArgsConstructor @Getter public class UserTimeDto { String username; long totalTime; }
9062f96cdfda65ddcbc10342cbf87f36ad87dc0d
d0fc48e23f566ef25318af6e768c678a7a9e1d41
/src/main/java/io/github/simplexdev/strike/api/events/GrenadeKillEvent.java
4a7ee869552edd6d1ba2a530f277d353fb3fdcd2
[]
no_license
SimplexDevelopment/StrikePlugin
331c9bf6a35c527bd104144c27c4516d4e85c33e
e0ff3528216deb5f88b4a6226b06aad5ef23cb07
refs/heads/master
2023-03-23T16:01:59.376136
2021-03-13T05:28:00
2021-03-13T05:28:00
344,169,824
0
0
null
null
null
null
UTF-8
Java
false
false
728
java
package io.github.simplexdev.strike.api.events; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; public class GrenadeKillEvent extends Event { private static final HandlerList handlers = new HandlerList(); private final Player killer; private final Player dead; public GrenadeKillEvent(Player killer, Player dead) { this.killer = killer; this.dead = dead; } public Player getKiller() { return this.killer; } public Player getDead() { return dead; } public HandlerList getHandlers() { return handlers; } public static HandlerList getHandlerList() { return handlers; } }
54dc3b110374afb27fce5187a743c8a503cce90f
c15ffb377d0c0a3dfe083b6729f32fe541887bdd
/src/main/java/com/example/tanks/Scenes/MyGameScene.java
4e32fc2072924b8fae34563e57657b3e8cd7bf58
[]
no_license
sinhro200/Tanks
4b13ecaec9df5270514c324c03efb9dca8e064e7
b74456f31f4556b05deb91419347876897ebc421
refs/heads/master
2023-03-16T14:23:46.813410
2022-11-13T15:50:49
2022-11-13T15:50:49
217,841,042
0
0
null
null
null
null
UTF-8
Java
false
false
2,030
java
package com.example.tanks.Scenes; import com.example.tanks.Controller.MainController; import com.example.tanks.Controller.MapController; import com.example.tanks.Model.Enums.BlockType; import com.example.tanks.Model.GameMap; import com.example.tanks.Model.MyMapConstructor; import com.example.tanks.Panes.GamePane; import com.example.tanks.Panes.GamePaneConstructor; import com.example.tanks.Utils.CodeBlockConverter; import javafx.scene.Scene; import javafx.scene.input.KeyCode; import javafx.scene.layout.Pane; import java.util.HashSet; import java.util.Set; public class MyGameScene extends Scene { private Set<KeyCode> controlKeys; GamePane gamePane; Set<KeyCode> pressedKeys; public MyGameScene(double width, double height) { super(new Pane(), width, height); CodeBlockConverter.init(); BlockType.init(); initControlKeys(); GameMap gameMap = MyMapConstructor.getMap(MyMapConstructor.MapNum.bigMap); gamePane = GamePaneConstructor.getGamePane(gameMap); MapController mapController = new MapController(gameMap,gamePane); MainController mainController = new MainController( mapController, pressedKeys ); this.setRoot(gamePane); mainController.beginAnimation(); } private void initControlKeys(){ controlKeys = new HashSet<>(); controlKeys.add(KeyCode.UP); controlKeys.add(KeyCode.DOWN); controlKeys.add(KeyCode.RIGHT); controlKeys.add(KeyCode.LEFT); controlKeys.add(KeyCode.SPACE); pressedKeys = new HashSet<>(); this.setOnKeyPressed(event -> { KeyCode code = event.getCode(); if (controlKeys.contains(code)) pressedKeys.add(code); }); this.setOnKeyReleased(event -> { KeyCode code = event.getCode(); if (controlKeys.contains(code)) pressedKeys.remove(code); pressedKeys.remove(event.getCode()); }); } }
4c89aa8396c98406382cb9657794ec4f056899ce
4d033d340a7028ad28de9a23b08d46a98d3d7887
/MVCProj13-MiniProj-StudentAcademicProfile/src/main/java/com/nil/cotroller/StudentInsertController.java
fca9c0cb86e272c80fbda56f12e426ec9af9c39e
[]
no_license
TanmayaLenka/SpringProjects
060d0ec9dc3623f930b2e371aad3c55cf32ec061
10183cc8cdba1a331429f8da85639acdb67a8396
refs/heads/master
2022-12-24T10:14:40.791387
2019-09-18T17:33:27
2019-09-18T17:33:27
201,874,615
0
0
null
2022-12-16T01:50:36
2019-08-12T06:53:14
Java
UTF-8
Java
false
false
1,587
java
package com.nil.cotroller; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.BeanUtils; import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; import com.nil.command.StudentCommand; import com.nil.dto.StudentDTO; import com.nil.service.StudentMgmtService; public class StudentInsertController extends SimpleFormController { private StudentMgmtService service; public StudentInsertController(StudentMgmtService service) { this.service = service; } @Override protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { String msg=null; StudentCommand cmd=null; StudentDTO dto=null; ModelAndView mav=null; List<StudentDTO> listDTO=null; //cast to cmd class cmd=(StudentCommand)command; //convert cmd to dto dto=new StudentDTO(); BeanUtils.copyProperties(cmd, dto); //use service msg=service.insertDetails(dto); listDTO=service.fetchDetails(); //create and use mav mav=new ModelAndView(); mav.setViewName(getSuccessView()); mav.addObject("msg", msg); mav.addObject("studentList", listDTO); return mav; } @Override protected ModelAndView handleInvalidSubmit(HttpServletRequest request, HttpServletResponse response) throws Exception { return new ModelAndView("error"); } }
[ "TanmayA@DESKTOP-MI16S9P" ]
TanmayA@DESKTOP-MI16S9P
73fe2b4dc96ceeb836c49eacd9d6b7d7a434ca9b
73d637bb0c076f8483942aab3db70db723578a65
/Week 2/Hello world/src/CodingHours.java
1e4b0d66d1ceebc5fa731279a8a6a39e145296da
[]
no_license
Pelikan91/My-First-Repo
5b7376fcffbbc11eb90447f8bb4474a89596a00d
4b194fe4912482a313bd379e87ba821a2afec85d
refs/heads/master
2023-03-17T20:47:28.464279
2021-03-18T20:28:40
2021-03-18T20:28:40
347,363,500
0
0
null
null
null
null
UTF-8
Java
false
false
185
java
public class CodingHours { public static void main(String[] args) { System.out.println("Average Green Fox attendee spent with coding in a semester is " + 17*52/6); } }
469b8bada44dae847bffe54e932e35e8afb5dc7f
8c6403626f85996779d28acaa47a73a820859691
/src/Scanner_number.java
7cd8e1b93088f588ce6272a372802a303e942833
[]
no_license
boytsovMGN/numbers
89f8ea0d36df4ca8b280f19c7e157487dfca38e2
7125708d3d07267a1ec2cf164cd6758c217f827c
refs/heads/master
2020-04-19T16:30:15.049986
2019-01-30T08:59:41
2019-01-30T08:59:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,470
java
import java.util.Scanner; /** * Программа угадывания чисел. */ public class Scanner_number { public static void main(String[] args) { int i = 0; int x = 50; int maxValue = 101; int minValue = 0; int numIter = 1; System.out.println("Загадайте число от 1 до 100"); System.out.println("Введите \"Yes\" если это так"); System.out.println("Введите b, если выше число больше"); System.out.println("Введите m, если выше число меньше"); while (i <= 10) { System.out.println("Ваше число = " + x + " ?"); Scanner scanner = new Scanner(System.in); String s = scanner.next(); if (s.equalsIgnoreCase("yes")) { System.out.println("Ваше число " + x + "!!!"); break; } else if (s.equalsIgnoreCase("b")) { minValue = x; } else if (s.equalsIgnoreCase("m")) { maxValue = x; } else { System.out.println("Неправильный ввод " + s); } x = (maxValue - minValue) / 2 + minValue; numIter++; } System.out.println("Вы легко предсказуемы за " + numIter + " шагов!"); System.out.println("GAME OVER"); } }
7771cf37ffc68e4406cdb9f8b7b750fd81f05500
4a926c7879d771a7fb77afdde6ec0631949137d3
/boot-spring-security-multiproviders/src/main/java/com/yz/security/providers/YzUsernamePasswordAuthenticationProvider.java
fac5001b797888534acca6e4d9b5e300f7954c89
[]
no_license
blinkingso/spring-cloud-parent
c0cc79618f07466acbf5ebf35955e5c18a68d850
48b551bac34ac9da030473b567da927a671668f2
refs/heads/master
2023-01-13T01:28:36.826778
2020-11-17T09:22:51
2020-11-17T09:22:51
293,816,677
0
0
null
null
null
null
UTF-8
Java
false
false
2,158
java
package com.yz.security.providers; import com.yz.pojo.authentication.UsernamePasswordAuthentication; import lombok.extern.slf4j.Slf4j; import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.password.PasswordEncoder; /** * @author andrew * @date 2020-10-15 */ @Slf4j public class YzUsernamePasswordAuthenticationProvider implements AuthenticationProvider { private final UserDetailsService userDetailsService; private final PasswordEncoder passwordEncoder; public YzUsernamePasswordAuthenticationProvider(UserDetailsService userDetailsService, PasswordEncoder passwordEncoder) { this.userDetailsService = userDetailsService; this.passwordEncoder = passwordEncoder; } @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { log.info("开始认证登陆的账户密码==>" + authentication.getClass()); String username = authentication.getName(); String password = (String) authentication.getCredentials(); UserDetails userDetails = userDetailsService.loadUserByUsername(username); if (userDetails == null) { throw new UsernameNotFoundException("用户不存在"); } if (passwordEncoder.matches(password, userDetails.getPassword())) { return new UsernamePasswordAuthentication(username, password); } throw new BadCredentialsException("用户名密码验证不通过"); } @Override public boolean supports(Class<?> authentication) { return UsernamePasswordAuthentication.class.equals(authentication); } }
4cb1ab50588b9052a33a1f98ee30bcae8844d294
6d23503378f3edce5cb1317631261d13e620472c
/Source Code/Main.java
f00efcd2639aed71ce7962b80078c2cc75f423d0
[]
no_license
vin8bit/Telephone-Directory-Management-System
7c2d324846cb3cc2430c8c93d08f4cc82f454f52
4997c84da76cf5ff680341205bb0a654463a695d
refs/heads/master
2022-08-03T11:25:35.083710
2020-05-23T08:50:50
2020-05-23T08:50:50
266,719,147
2
0
null
null
null
null
UTF-8
Java
false
false
7,971
java
import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Main extends JFrame implements ActionListener { JMenuBar m; JMenu file,customer,city,categorie,report,help; JMenuItem f1,f2; JMenuItem g1,g2,g3,g4,g5,g6,g7; JMenuItem r1,r2,r3,r4,r5,r6,r7; JMenuItem ro1; JMenuItem s1,s2,s3,s4,s5,s6,s7; JMenuItem m1,m2,m3,m4,m5,m6,m7; JMenuItem l1; JToolBar tbar; JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15; public Main() { setSize(820,660); setTitle("Telephone Directory"); setLocationRelativeTo(null); setResizable(false); JPanel p= new JPanel(); add(p); //Menu m=new JMenuBar(); file=new JMenu("File"); m.add(file); customer=new JMenu("Customer"); m.add(customer); city=new JMenu("City"); m.add(city); categorie=new JMenu("Category"); m.add(categorie); report=new JMenu("Record"); m.add(report); help=new JMenu("Help"); m.add(help); //ToolBar tbar= new JToolBar(); b1= new JButton(new ImageIcon("image/1.png")); tbar.add(b1); b1.setRolloverIcon(new ImageIcon("image/1c.png")); b1.addActionListener(this); b1.setToolTipText("New Customer"); b2= new JButton(new ImageIcon("image/2.png")); tbar.add(b2); b2.setRolloverIcon(new ImageIcon("image/2c.png")); b2.addActionListener(this); b2.setToolTipText("Update customer"); b3= new JButton(new ImageIcon("image/3.png")); tbar.add(b3); b3.setRolloverIcon(new ImageIcon("image/3c.png")); b3.addActionListener(this); b3.setToolTipText("Search customer"); b4= new JButton(new ImageIcon("image/4.png")); tbar.add(b4); b4.setRolloverIcon(new ImageIcon("image/4c.png")); b4.addActionListener(this); b4.setToolTipText("Delete customer"); b5= new JButton(new ImageIcon("image/5.png")); tbar.add(b5); b5.setRolloverIcon(new ImageIcon("image/5c.png")); b5.addActionListener(this); b5.setToolTipText("Add city code"); b6= new JButton(new ImageIcon("image/6.png")); tbar.add(b6); b6.setRolloverIcon(new ImageIcon("image/6c.png")); b6.addActionListener(this); b6.setToolTipText("Update city code"); b7= new JButton(new ImageIcon("image/3.png")); tbar.add(b7); b7.setRolloverIcon(new ImageIcon("image/3c.png")); b7.addActionListener(this); b7.setToolTipText("Search city code"); b8= new JButton(new ImageIcon("image/7.png")); tbar.add(b8); b8.setRolloverIcon(new ImageIcon("image/7c.png")); b8.addActionListener(this); b8.setToolTipText("Delete city code"); b9= new JButton(new ImageIcon("image/8.png")); tbar.add(b9); b9.setRolloverIcon(new ImageIcon("image/8c.png")); b9.addActionListener(this); b9.setToolTipText("Add new categorie"); b10= new JButton(new ImageIcon("image/9.png")); tbar.add(b10); b10.setRolloverIcon(new ImageIcon("image/9c.png")); b10.addActionListener(this); b10.setToolTipText("Update categorie"); b11= new JButton(new ImageIcon("image/3.png")); tbar.add(b11); b11.setRolloverIcon(new ImageIcon("image/3c.png")); b11.addActionListener(this); b11.setToolTipText("Search categorie"); b12= new JButton(new ImageIcon("image/7.png")); tbar.add(b12); b12.setRolloverIcon(new ImageIcon("image/7c.png")); b12.addActionListener(this); b12.setToolTipText("Delete categorie"); b13= new JButton(new ImageIcon("image/11.png")); tbar.add(b13); b13.setRolloverIcon(new ImageIcon("image/11c.png")); b13.addActionListener(this); b13.setToolTipText("Customer Record"); b14= new JButton(new ImageIcon("image/12.png")); tbar.add(b14); b14.setRolloverIcon(new ImageIcon("image/12c.png")); b14.addActionListener(this); b14.setToolTipText("City Record"); b15= new JButton(new ImageIcon("image/6.png")); tbar.add(b15); b15.setRolloverIcon(new ImageIcon("image/6c.png")); b15.addActionListener(this); b15.setToolTipText("Categorie Record"); add(tbar,BorderLayout.NORTH); //file f1=new JMenuItem("Log out",new ImageIcon("image/key.png")); file.add(f1); f1.addActionListener(this); f2=new JMenuItem("Exit",new ImageIcon("image/cancel.png")); f2.addActionListener(this); file.add(f2); //Cusotmer g1=new JMenuItem("New Customer",new ImageIcon("image/customer.png")); customer.add(g1); g1.addActionListener(this); g2=new JMenuItem("Update Customer",new ImageIcon("image/upc.png")); g2.addActionListener(this); customer.add(g2); g3=new JMenuItem("Search Customer",new ImageIcon("image/search.png")); customer.add(g3); g3.addActionListener(this); g4=new JMenuItem("Delete Customer",new ImageIcon("image/dl.png")); g4.addActionListener(this); customer.add(g4); //City r1=new JMenuItem("New STD code",new ImageIcon("image/phone.png")); city.add(r1); r1.addActionListener(this); r2=new JMenuItem("Update STD code",new ImageIcon("image/up2.png")); r2.addActionListener(this); city.add(r2); r3=new JMenuItem("Search STD code",new ImageIcon("image/search.png")); city.add(r3); r3.addActionListener(this); r4=new JMenuItem("Delete STD code",new ImageIcon("image/logo.png")); r4.addActionListener(this); city.add(r4); //Categorie s1=new JMenuItem("New Category",new ImageIcon("image/cet1.png")); categorie.add(s1); s1.addActionListener(this); s2=new JMenuItem("Update Category",new ImageIcon("image/up1.png")); s2.addActionListener(this); categorie.add(s2); s3=new JMenuItem("Search Category",new ImageIcon("image/search.png")); categorie.add(s3); s3.addActionListener(this); s4=new JMenuItem("Delete Category",new ImageIcon("image/logo.png")); s4.addActionListener(this); categorie.add(s4); //Report m1=new JMenuItem("Customer Record",new ImageIcon("image/contacts.png")); report.add(m1); m1.addActionListener(this); m2=new JMenuItem("STD Code Record",new ImageIcon("image/record2.png")); m2.addActionListener(this); report.add(m2); m3=new JMenuItem("Category Record",new ImageIcon("image/up2.png")); report.add(m3); m3.addActionListener(this); //Help ro1=new JMenuItem("Help",new ImageIcon("image/phone.png")); help.add(ro1); ro1.addActionListener(this); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e){ System.exit(0); }}); JLabel img= new JLabel(new ImageIcon("image/main.jpg")); add(img); setIconImage(new ImageIcon("image/logo.png").getImage()); setJMenuBar(m); setVisible(true); } public void actionPerformed(ActionEvent e) { if(e.getSource()==f1) { dispose(); new Login(); } if(e.getSource()==f2) { System.exit(0); } if(e.getSource()==g1||e.getSource()==b1) { new Customer(this); } if(e.getSource()==g2||e.getSource()==b2) { new UpdateCustomer(this); } if(e.getSource()==g3||e.getSource()==b3) { new SearchCustomer(this); } if(e.getSource()==g4||e.getSource()==b4) { new DeleteCustomer(this); } if(e.getSource()==r1||e.getSource()==b5) { new City(this); } if(e.getSource()==r2||e.getSource()==b6) { new UpdateCity(this); } if(e.getSource()==r3||e.getSource()==b7) { new SearchCity(this); } if(e.getSource()==r4||e.getSource()==b8) { new DeleteCity(this); } if(e.getSource()==s1||e.getSource()==b9) { new Categorie(this); } if(e.getSource()==s2||e.getSource()==b10) { new UpdateCategorie(this); } if(e.getSource()==s3||e.getSource()==b11) { new SearchCategorie(this); } if(e.getSource()==s4||e.getSource()==b12) { new DeleteCategorie(this); } if(e.getSource()==m1||e.getSource()==b13) { try{new Record1(); } catch(Exception ea){} } if(e.getSource()==m2||e.getSource()==b14) { try{new Record2(); } catch(Exception ea){} } if(e.getSource()==m3||e.getSource()==b15) { try{new Record3(); } catch(Exception ea){} } if(e.getSource()==ro1) { new Help(this); } } public static void main(String arr[]) { new Main(); } }
c1e53579f69dba28fd9f8bfe63d3b89831decd8e
2ca58177ad2b5a95a0519b31773e637618410a68
/mago3d-core/src/main/java/com/gaia3d/util/FileUtil.java
b2f72c7b37fc61003e39dab1dd83167b2572736c
[ "Apache-2.0" ]
permissive
picaosgeo/mago3d
879b6f4c7ab77793a1bd68335e28a4551beb7572
fdf109e5f34a6e8e4cb4d2f9976e91bfc1651e62
refs/heads/master
2021-10-01T15:02:47.160427
2018-02-22T05:43:27
2018-02-22T05:43:27
101,961,775
0
0
null
2017-08-31T05:11:41
2017-08-31T05:11:41
null
UTF-8
Java
false
false
9,343
java
package com.gaia3d.util; import java.io.BufferedReader; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.InputStream; import java.io.OutputStream; import java.util.Arrays; import java.util.List; import org.springframework.web.multipart.MultipartFile; import com.gaia3d.domain.FileInfo; import lombok.extern.slf4j.Slf4j; /** * TODO N중화 처리를 위해 FTP 로 다른 PM 으로 전송해 줘야 하는데.... * * 파일 처리 관련 Util * @author jeongdae * */ @Slf4j public class FileUtil { /* * TODO 대용량 엑셀 처리 관련 참조 * http://poi.apache.org/spreadsheet/how-to.html#sxssf * */ // 사용자 일괄 등록 public static final String USER_FILE_UPLOAD = "USER_FILE_UPLOAD"; // Data 일괄 등록 public static final String DATA_FILE_UPLOAD = "DATA_FILE_UPLOAD"; // Issue 등록 public static final String ISSUE_FILE_UPLOAD = "ISSUE_FILE_UPLOAD"; // 사용자 일괄 등록의 경우 허용 문서 타입 public static final String[] USER_FILE_TYPE = {"xlsx", "xls"}; // 데이터 일괄 등록 문서 타입 public static final String[] DATA_FILE_TYPE = {"xlsx", "xls", "json", "txt"}; // issue 등록의 경우 허용 문서 타입 public static final String[] ISSUE_FILE_TYPE = {"png", "jpg", "jpeg", "gif", "tiff", "xlsx", "xls", "docx", "doc", "pptx", "ppt"}; // json 파일 public static final String EXTENSION_JSON = "json"; // txt 파일 public static final String EXTENSION_TXT = "txt"; // 엑셀 처리 기본 프로그램 public static final String EXCEL_EXTENSION_XLS = "xls"; // JEXCEL이 2007버전(xlsx) 을 읽지 못하기 때문에 POI를 병행해서 사용 public static final String EXCEL_EXTENSION_XLSX = "xlsx"; // 업로더 가능한 파일 사이즈 public static final long FILE_UPLOAD_SIZE = 10000000l; // 파일 copy 시 버퍼 사이즈 public static final int BUFFER_SIZE = 8192; /** * 엑셀 파일 등록 * @param multipartFile * @param jobType * @param directory * @return */ public static FileInfo upload(MultipartFile multipartFile, String jobType, String directory) { FileInfo fileInfo = new FileInfo(); fileInfo.setJob_type(jobType); // 파일 기본 validation 체크 fileInfo = fileValidation(multipartFile, fileInfo); if(fileInfo.getError_code() != null && !"".equals(fileInfo.getError_code())) { return fileInfo; } // 파일을 upload 디렉토리로 복사 fileInfo = fileCopy(multipartFile, fileInfo, directory); return fileInfo; } /** * 업로딩 파일에 대한 기본적인 validation 체크. 이름, 확장자, 사이즈 * @param multipartFile * @param fileInfo * @return */ private static FileInfo fileValidation(MultipartFile multipartFile, FileInfo fileInfo) { // 1 파일 공백 체크 if(multipartFile == null || multipartFile.getSize() == 0l) { fileInfo.setError_code("fileinfo.invalid"); return fileInfo; } // 2 파일 이름 String fileName = multipartFile.getOriginalFilename(); if(fileName.indexOf("..") >= 0 || fileName.indexOf("/") >= 0) { // TODO File.seperator 정규 표현식이 안 먹혀서 이렇게 처리함 log.info("@@ fileName = {}", fileName); fileInfo.setError_code("fileinfo.name.invalid"); return fileInfo; } // 3 파일 확장자 String[] fileNameValues = fileName.split("\\."); if(fileNameValues.length != 2) { log.info("@@ fileNameValues.length = {}, fileName = {}", fileNameValues.length, fileName); fileInfo.setError_code("fileinfo.name.invalid"); return fileInfo; } if(fileNameValues[0].indexOf(".") >= 0 || fileNameValues[0].indexOf("..") >= 0) { log.info("@@ fileNameValues[0] = {}", fileNameValues[0]); fileInfo.setError_code("fileinfo.name.invalid"); return fileInfo; } String extension = fileNameValues[1]; List<String> extList = null; if(USER_FILE_UPLOAD.equals(fileInfo.getJob_type())) { extList = Arrays.asList(USER_FILE_TYPE); } else if(DATA_FILE_UPLOAD.equals(fileInfo.getJob_type())) { extList = Arrays.asList(DATA_FILE_TYPE); } else { extList = Arrays.asList(ISSUE_FILE_TYPE); } if(!extList.contains(extension)) { log.info("@@ extList = {}, extension = {}", extList, extension); fileInfo.setError_code("fileinfo.ext.invalid"); return fileInfo; } // 4 파일 사이즈 long fileSize = multipartFile.getSize(); if(fileSize > FILE_UPLOAD_SIZE) { fileInfo.setError_code("fileinfo.size.invalid"); return fileInfo; } fileInfo.setFile_name(fileName); fileInfo.setFile_ext(extension); return fileInfo; } /** * 파일 복사 * @param multipartFile * @param fileInfo * @param directory * @return */ private static FileInfo fileCopy(MultipartFile multipartFile, FileInfo fileInfo, String directory) { log.info("@@@@@@@@@ directory = {}", directory); // 최상위 /upload/user/ 생성 File rootDirectory = new File(directory); if(!rootDirectory.exists()) { rootDirectory.mkdir(); } // 현재년 sub 디렉토리 생성 String today = DateUtil.getToday(FormatUtil.YEAR_MONTH_DAY_TIME14); String year = today.substring(0,4); File yearDirectory = new File(directory + year); if(!yearDirectory.exists()) { yearDirectory.mkdir(); } String saveFileName = today + "_" + System.nanoTime() + "." + fileInfo.getFile_ext(); long size = 0L; try ( InputStream inputStream = multipartFile.getInputStream(); OutputStream outputStream = new FileOutputStream(yearDirectory + File.separator + saveFileName)) { int bytesRead = 0; byte[] buffer = new byte[BUFFER_SIZE]; while ((bytesRead = inputStream.read(buffer, 0, BUFFER_SIZE)) != -1) { size += bytesRead; outputStream.write(buffer, 0, bytesRead); } fileInfo.setFile_real_name(saveFileName); fileInfo.setFile_size(String.valueOf(size)); fileInfo.setFile_path(directory + year + File.separator); } catch(Exception e) { e.printStackTrace(); fileInfo.setError_code("fileinfo.copy.exception"); } return fileInfo; } /** * 특정 파일을 읽어 데몬 PID를 확인한다 (PID 존재 유무에 따라 동작 상태도 알 수 있음) * @param fileName * @return */ public static String getPIDFromFile(String fileName) { String pid = ""; try ( FileReader fileReader = new FileReader(fileName); BufferedReader bufferedReader = new BufferedReader(fileReader) ) { pid = bufferedReader.readLine(); } catch(Exception e) { e.printStackTrace(); } log.info("@@@@@@@@ fileName = {}, pid = {}", fileName, pid); return pid; } /** * 파일 IP를 읽어 옴 * @param fileName * @return */ public static String getIPFromFile(String fileName) { String ip = ""; BufferedReader bufferedReader = null; FileReader fileReader = null; try { fileReader = new FileReader(fileName); bufferedReader = new BufferedReader(fileReader); ip = bufferedReader.readLine(); bufferedReader.close(); fileReader.close(); } catch(Exception e) { e.printStackTrace(); } finally { if(bufferedReader != null) { try { bufferedReader.close(); } catch(Exception e) { e.printStackTrace(); } } if(fileReader != null) { try { fileReader.close(); } catch(Exception e) { e.printStackTrace(); } } } log.info("@@@@@@@@ fileName = {}, ip = {}", fileName, ip); return ip; } /** * pid 파일의 process가 실행 중인지 확인 * @param pid * @param DAEMON_NAME * @return */ public static boolean isProcessAlive(String pid, String DAEMON_NAME) { // 프로세스가 실행중인지를 판별 boolean isProcessAlive = false; // 프로세스 확인 후 종료 File processFile = new File("/proc" + File.separator + pid); log.info("@@@@@@@ processFile = {}, name = {}, path = {}, pathLength = {}", processFile.getName(), processFile.getAbsolutePath(), processFile.getPath(), processFile.getPath().length()); if(processFile.exists()) { // 파일 읽어서 종료 File vrrpdFile = new File("/proc" + File.separator + pid + File.separator + "status"); if(vrrpdFile.exists()) { FileReader fileReader = null; BufferedReader bufferedReader = null; String processName = null; try { fileReader = new FileReader(vrrpdFile); bufferedReader = new BufferedReader(fileReader); String line = bufferedReader.readLine(); if(line != null && !"".equals(line)) { String[] fileInfo = line.split(":"); processName = fileInfo[1].replaceAll(" ", "").trim(); } } catch(Exception e) { e.printStackTrace(); throw new RuntimeException("@@@@@@@ /proc/" + pid + " process status file read error!"); } finally { if(bufferedReader != null) { try { bufferedReader.close(); } catch(Exception e) { e.printStackTrace(); } } if(fileReader != null) { try { fileReader.close(); } catch(Exception e) { e.printStackTrace(); } } } if(DAEMON_NAME.equals(processName)) { isProcessAlive = true; } else { log.info("@@@@@@@@ processName = {}, DAEMON_NAME = {} is different", processName, DAEMON_NAME); } } else { log.info("@@@@@@@ /proc/{} process status file is not exist!", pid); } } else { log.info("@@@@@@@ /proc/{} directory is not exist", pid); } return isProcessAlive; } }
2e57257d61d1f0c2a30ec5c45269c7403aa52d3f
50f17c8162a0b603e996e95b2d73d0b9c60e27ca
/src/br/edu/uniplac/niu/controller/CategoriaController.java
0e349e915b10f8caf3247f3c6a3e3fd44a90e264
[]
no_license
niudesenvolvimento/niu
3767c1fb50c0d362a8fc86621b85b2d6f2f6f113
515802c86674e91ac824e3bf4fd2795ebddea6f0
refs/heads/master
2021-01-10T05:43:59.348388
2016-03-11T20:26:12
2016-03-11T20:26:12
50,944,038
0
0
null
null
null
null
UTF-8
Java
false
false
1,719
java
package br.edu.uniplac.niu.controller; import java.io.Serializable; import java.util.List; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; import br.edu.uniplac.niu.controller.util.JSFUtil; import br.edu.uniplac.niu.model.entity.ChamadoCategoria; import br.edu.uniplac.niu.model.service.ChamadoService; /** * Controller para gerenciar categoria de chamados * @author vitor.figueiredo * @since 08 jan 2016 */ @ManagedBean(name="categoriaController") @ViewScoped public class CategoriaController implements Serializable { @EJB ChamadoService chamadoService; private ChamadoCategoria categoria; private List<ChamadoCategoria> categorias; @PostConstruct void init() { popularCategorias(); } private void popularCategorias() { categorias = chamadoService.pesquisarChamadoCategoria(); } public void novo() { categoria = new ChamadoCategoria(); } public void editar(ChamadoCategoria categoriaSelecionada) { this.categoria = categoriaSelecionada; } public void salvar() { categoria = chamadoService.salvarChamadoCategoria(categoria); popularCategorias(); JSFUtil.addInfoMessage("Categoria salva com sucesso"); } public void remover() { chamadoService.removerChamadoCategoria(categoria); popularCategorias(); JSFUtil.addInfoMessage("Categoria removida"); } //acessores.. private static final long serialVersionUID = -4979556301781457685L; public ChamadoCategoria getCategoria() { return categoria; } public void setCategoria(ChamadoCategoria categoria) { this.categoria = categoria; } public List<ChamadoCategoria> getCategorias() { return categorias; } }
45cd450c9cc69a84fd2dee6ba301b4dd15014d8c
a5b66b7eac5d2378a972b8bbac4757f9e8d04990
/ZMPlayer2/src/main/java/zmplayer2/app/net/model/incoming/Wiki.java
d112de6b6c8be6031e42582fcba623a60c7a803e
[]
no_license
zlobne/ZMPlayer2
9190c9714b4218e897d2ecf8a5d1b15b9989011f
4757bf0c3f67715dd5e5b25396b4c0f2f6639b44
refs/heads/master
2021-01-21T13:14:29.268157
2014-08-18T08:32:02
2014-08-18T08:32:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
477
java
package zmplayer2.app.net.model.incoming; import com.google.gson.annotations.SerializedName; import zmplayer2.app.net.model.JsonKeys; /** * Created by Anton Prozorov on 25.03.14. */ public class Wiki { @SerializedName(JsonKeys.PUBLISHED) private String published; @SerializedName(JsonKeys.SUMMARY) private String summary; public String getPublished() { return published; } public String getSummary() { return summary; } }
7f22452bc055054572b03cf90a27620f77616f83
b375ed5fbd2a5063f50833e1f5b8b3d1364ca722
/src/me/adegokeobasa/dsinjava/leetcode/PascalTriangle2.java
4931c7bc6f9c566c6869da0ad95b99abec850de8
[]
no_license
rajasekharreddy-vadlathala/DSInJava
34e20ee9a5ea7abc786cc364ce7a757cdd38e9fe
070ae05d214550ab0174828b34a763e099212988
refs/heads/master
2020-04-20T10:42:47.633878
2018-03-23T11:20:21
2018-03-23T11:20:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,237
java
package me.adegokeobasa.dsinjava.leetcode; import java.util.ArrayList; import java.util.List; /** * Created by epapa on 30/01/2016. */ public class PascalTriangle2 { public static void main(String[] args) { System.out.println(new PascalTriangle2().getRow(0)); } public List<Integer> getRow(int rowIndex) { List<Integer> row = new ArrayList<>(); for (int i = 0; i <= rowIndex; i++) { if(i == 0) { row.add(1); continue; } row = getTriangleRow(row); } return row; } public List<Integer> getTriangleRow(List<Integer> previousRow) { List<Integer> row = new ArrayList<>(); // New row will have 1 more element, hence the +1 int firstElement = -1; int secondElement = 0; for(int i = 0; i < previousRow.size() + 1; i++) { int newElement = firstElement == -1 ? previousRow.get(secondElement) : secondElement == previousRow.size() ? previousRow.get(firstElement) : previousRow.get(firstElement) + previousRow.get(secondElement); firstElement++; secondElement++; row.add(newElement); } return row; } }
4c3a322fa2e75bc1954b7204a7b793f65d27109d
2430fe69becc3f122a75224a37c99b58859f1f15
/finalProject/src/main/java/com/gruptwo/finalProject/entities/User.java
af259bdebcbcb74436b05ce52bc51c2464ebf8ba
[]
no_license
MariaDG11/Java_Spring_Boot
3ae1ce993b0e2567af384f273fc9850751ea5d46
62445e88710a69f95fb7f67ba9f7ce39057c3c4e
refs/heads/master
2022-11-23T17:45:43.747576
2020-07-29T07:25:08
2020-07-29T07:25:08
283,183,424
0
0
null
null
null
null
UTF-8
Java
false
false
2,744
java
package com.gruptwo.finalProject.entities; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Transient; @Entity @Table(name="user") public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id_user") private Integer idUser; @Column (name = "name") private String name; @Column (name = "surname") private String surname; @Column (name = "age") private Integer age; //Relations with entities //Answer @OneToMany(mappedBy = "user", cascade = CascadeType.ALL) private List<Answer> answers = new ArrayList<>(); // //Survey // @ManyToMany(mappedBy = "id_user", cascade = CascadeType.ALL) // private Set<Survey> id_survey; // @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "survey_id_user") private Set<Survey> surveys; @Transient private Integer idSurvey; public Set<Survey> getSurveys() { return surveys; } public void setSurveys(Set<Survey> surveys) { this.surveys = surveys; } public User(Integer idUser, String name,String surname, Integer age, Survey surveys) { this.idUser= idUser; this.name = name; this.surname = surname; this.age= age; this.surveys = Stream.of(surveys).collect(Collectors.toSet()); this.surveys.forEach(x -> x.getSurveys().add(this)); } public User() {} //Getters y Setters public Integer getIdUser() { return idUser; } public void setIdUser(Integer idUser) { this.idUser = idUser; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public Integer getAge() { return age; } public void setAge(Integer age) { this.age = age; } public List<Answer> getAnswers() { return answers; } public void setAnswers(List<Answer> answers) { this.answers = answers; } public Integer getIdSurvey() { return idSurvey; } public void setIdSurvey(Integer idSurvey) { this.idSurvey = idSurvey; } }
749f65d01f7e24df5794fa89f7fd356277370b19
56540ad45b01b1086eb2a79099723a49a0d49347
/bbc/JavaProject/MR/438/src/ComminuteUtil.java
06681ca6667ac4855e0a64e84a4531de82e19145
[]
no_license
xicpio/bbc
6d475a9a7f487f4fd5a0fd8d2ac67dfcfade083b
c23f4336a9c48c4c07d77af93be738108ee2e1c8
refs/heads/master
2021-01-23T21:53:36.609031
2017-02-25T06:53:09
2017-02-25T06:53:09
83,112,243
1
1
null
null
null
null
GB18030
Java
false
false
2,405
java
import java.io.*; public class ComminuteUtil { // 实现文件分割方法 public void fenGe(File commFile, File untieFile, int filesize) { FileInputStream fis = null; int size = 1024 * 1024; // 用来指定分割文件要以MB为单位 try { if (!untieFile.isDirectory()) { // 如果要保存分割文件地址不是路径 untieFile.mkdirs(); // 创建该路径 } size = size * filesize; int length = (int) commFile.length(); // 获取文件大小 int num = length / size; // 获取文件大小除以MB的得数 int yu = length % size; // 获取文件大小与MB相除的余数 String newfengeFile = commFile.getAbsolutePath(); // 获取保存文件的完成路径信息 int fileNew = newfengeFile.lastIndexOf("."); String strNew = newfengeFile.substring(fileNew, newfengeFile .length()); // 截取字符串 fis = new FileInputStream(commFile); // 创建FileInputStream类对象 File[] fl = new File[num + 1]; // 创建文件数组 int begin = 0; for (int i = 0; i < num; i++) { // 循环遍历数组 fl[i] = new File(untieFile.getAbsolutePath() + "\\" + (i + 1) + strNew + ".tem"); // 指定分割后小文件的文件名 if (!fl[i].isFile()) { fl[i].createNewFile(); // 创建该文件 } FileOutputStream fos = new FileOutputStream(fl[i]); byte[] bl = new byte[size]; fis.read(bl); // 读取分割后的小文件 fos.write(bl); // 写文件 begin = begin + size * 1024 * 1024; fos.close(); // 关闭流 } if (yu != 0) { // 文件大小与指定文件分割大小相除的余数不为0 fl[num] = new File(untieFile.getAbsolutePath() + "\\" + (num + 1) + strNew + ".tem"); // 指定文件分割后数组中最后一个文件名 if (!fl[num].isFile()) { fl[num].createNewFile(); // 新建文件 } FileOutputStream fyu = new FileOutputStream(fl[num]); byte[] byt = new byte[yu]; fis.read(byt); fyu.write(byt); fyu.close(); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String[] args) { } }
382eff82a25b9a4df2f758f825e0d750e3380fc8
f1b65f6ace564ef496ae97c237763a1e282b2189
/tis-console/src/main/java/com/qlangtech/tis/manage/servlet/GlobalConfigServlet.java
c25e9af7cad204659140d2d4a5f4a8a2c853379f
[ "MIT" ]
permissive
fightingyuman/tis-solr
27b65d3e4a89612ea9087a0f260a8c0a89b7f640
8655db7c32bb88928b931e2754291deb0e4ab4db
refs/heads/master
2022-04-04T08:26:23.438875
2020-01-02T13:04:51
2020-01-02T13:04:51
258,164,459
1
0
MIT
2020-04-23T10:09:51
2020-04-23T10:09:51
null
UTF-8
Java
false
false
2,691
java
/* * The MIT License * * Copyright (c) 2018-2022, qinglangtech Ltd * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.qlangtech.tis.manage.servlet; import java.io.IOException; import java.util.HashMap; import java.util.Map; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.IOUtils; import org.json.JSONObject; import com.qlangtech.tis.manage.biz.dal.pojo.ResourceParameters; import com.qlangtech.tis.manage.biz.dal.pojo.ResourceParametersCriteria; import com.qlangtech.tis.pubhook.common.RunEnvironment; import com.qlangtech.tis.runtime.module.screen.ConfigFileParametersSet; /* * * @author 百岁([email protected]) * @date 2019年1月17日 */ public class GlobalConfigServlet extends BasicServlet { private static final long serialVersionUID = 1L; @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { final RunEnvironment runtime = RunEnvironment.getEnum(req.getParameter("runtime")); ResourceParametersCriteria criteria = new ResourceParametersCriteria(); final Map<String, String> params = new HashMap<String, String>(); for (ResourceParameters param : this.getContext().getResourceParametersDAO().selectByExample(criteria)) { params.put(param.getKeyName(), ConfigFileParametersSet.getParameterValue(param, runtime)); } resp.setContentType("text/json"); JSONObject json = new JSONObject(params); IOUtils.write(json.toString(), resp.getOutputStream()); } }
92c73266f58a8e025ff0eeacc533a31e43bea2f8
53b49c53f63c5aa9fecee65b6b44624705ea56f2
/app/src/androidTest/java/com/ch/newtinker/ExampleInstrumentedTest.java
a6404f8b536dab4f4ae4d886fe145ca65aefd473
[]
no_license
forhaodream/NewTinkerPatch
c32482ad69a2e38e3a6f9fb2d77d62299ac3d957
832fe969b7b08b90b074b0a8685abac1f2744d8f
refs/heads/master
2020-07-21T17:35:44.988031
2019-09-11T02:08:42
2019-09-11T02:08:42
206,930,431
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.ch.newtinker; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.ch.newtinker", appContext.getPackageName()); } }
c0db240b722e902f20fdd12916cf638736125667
9eea8a7ce5f7fc7c1d8076913da1dfab6a2cfa27
/src/main/java/com/stackroute/pefive/StudentSorter.java
1336094e5e9c363157b4a9403a9c023e3ce70914
[]
no_license
Pallavi82/practiceExercise5
0cd2e9e576fea908232b8717e273667a17958eb2
040790a784d26633cc3c100ec578e6980c4f0d7c
refs/heads/master
2020-05-20T19:52:42.918472
2019-05-09T05:38:42
2019-05-09T05:38:42
185,732,497
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
package com.stackroute.pefive; import java.util.Comparator; class StudentSorter implements Comparator { //StdentSorter is a class implementing from interface named Comparator StudentSorter() { } public int compare(Object o1, Object o2) { //compare function containg two object parameters Student s1 = (Student)o1; Student s2 = (Student)o2; if (s1.getAge() == s2.getAge()) { //checks if student 1 and student 2 has same age, if yes then comparison of names take place int answer = s1.getName().compareTo(s2.getName()); return answer == 0 ? s1.getID().compareTo(s2.getID()) : answer; //tertiary operator used to return the id of the student whose name is prior to the other } else { return s1.getAge() > s2.getAge() ? 1 : -1; //tertiary operator used to return the age if not same } } }
bbd329a13aa45d5dbbe63dc16727bb7c012235e4
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_c1d8b9a186f3080a690576e95af1155485da5a10/Plane/7_c1d8b9a186f3080a690576e95af1155485da5a10_Plane_t.java
be1203605990c33428fc1002c7e78002d1acc7ad
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
2,740
java
package rajawali.primitives; import rajawali.BaseObject3D; import rajawali.materials.SimpleMaterial; public class Plane extends BaseObject3D { protected float mWidth; protected float mHeight; protected int mSegmentsW; protected int mSegmentsH; public Plane() { this(1f, 1f, 3, 3); } public Plane(float width, float height, int segmentsW, int segmentsH) { super(); mWidth = width; mHeight = height; mSegmentsW = segmentsW; mSegmentsH = segmentsH; init(); } private void init() { mMaterial = new SimpleMaterial(); int i, j; int numVertices = (mSegmentsW+1) * (mSegmentsH+1); float[] vertices = new float[numVertices * 3]; float[] textureCoords = new float[numVertices * 2]; float[] normals = new float[numVertices * 3]; float[] colors = new float[numVertices * 4]; short[] indices = new short[mSegmentsW * mSegmentsH * 6]; int vertexCount = 0; int texCoordCount = 0; for (i = 0; i <= mSegmentsW; ++i) { for (j = 0; j <= mSegmentsH; ++j) { vertices[vertexCount] = ((float)i / (float)mSegmentsW - 0.5f) * mWidth; vertices[vertexCount+1] = ((float)j / (float)mSegmentsH - 0.5f) * mHeight; vertices[vertexCount+2] = 0; textureCoords[texCoordCount++] = (float)j / (float)mSegmentsW; textureCoords[texCoordCount++] = 1f - (float)i / (float)mSegmentsH; normals[vertexCount] = 0; normals[vertexCount+1] = 1; normals[vertexCount+2] = 0; vertexCount += 3; } } int colspan = mSegmentsW + 1; int indexCount = 0; for(int row = 1; row <= mSegmentsH; row++) { for (int col = 1; col <= mSegmentsW; col++) { int lr = row * colspan + col; int ll = lr - 1; int ur = lr - colspan; int ul = ur - 1; indices[indexCount++] = (short)ul; indices[indexCount++] = (short)ur; indices[indexCount++] = (short)lr; indices[indexCount++] = (short)ul; indices[indexCount++] = (short)lr; indices[indexCount++] = (short)ll; } } int numColors = numVertices * 4; for(j = 0; j < numColors; j += 4 ) { colors[ j ] = 1.0f; colors[ j + 1 ] = 1.0f; colors[ j + 2 ] = 0.0f; colors[ j + 3 ] = 1.0f; } setData(vertices, normals, textureCoords, colors, indices); } }
0ccb32f2250a8de7dc65997ef111997e76eb00dc
f0ec814efa117c0fd320384481f89557fd331207
/src/test/java/com/dialogflow/test/ProjetFactoryForTest.java
6e70bc684e7c9317ce28eeff7c179d3b0c1e2232
[]
no_license
freeekey1/immoflow-api
e39ab1d90c60942934be1046090897e587765008
bc2e55b85103997a2eb3b61c241238d1096b0a52
refs/heads/master
2021-05-11T02:57:49.588029
2018-01-28T23:18:43
2018-01-28T23:18:43
117,899,653
0
0
null
null
null
null
UTF-8
Java
false
false
316
java
package com.dialogflow.test; import com.dialogflow.bean.Projet; public class ProjetFactoryForTest { private MockValues mockValues = new MockValues(); public Projet newProjet() { Integer id = mockValues.nextInteger(); Projet projet = new Projet(); projet.setId(id.longValue()); return projet; } }
a7f866f744496c6b4dfe7700f561d7b83ae5802c
2bf1e8cd193bd17fc778c3465cc87c4ee1fe97f9
/src/test/java/runners/TestRunner.java
0829fdc28d5398f341b20ecc5543dd386d66ccdf
[]
no_license
HillaryJoe/DemoProjectTest
c7c0eb1d4994045e658c01d43912c63b910541fd
2c403f9996258ba47775ea3afdbfb36e5cbf22d6
refs/heads/master
2020-03-30T05:38:02.911471
2018-09-26T16:43:59
2018-09-26T16:43:59
150,810,578
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package runners; import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith (Cucumber.class) @CucumberOptions( features = "src/test/resources/functionalTest/EndToEndTest.feature", glue = {"stepDefinitions"}, plugin = {"pretty", "html:target/cucumber-reports","junit:target/cucumber-reports/Cucumber.xml"}, monochrome = true, strict = true, dryRun = false ) public class TestRunner { }
[ "Jose@Jose-PC" ]
Jose@Jose-PC
784082a325e5f8f42fa043b07b5c4554b6231d9a
3c1e25a0de0bcffe324dbeb9febaa3ab4af4269a
/src/main/java/spyr/actions/MeditateAction.java
2af12e4d8bc70160eec2a3367bc9fe761ad53c32
[]
no_license
admiralbolt/spyr
3dc0b0f1cf25461d9a93773d336cb631157e648b
799b1d7347859f332a7b7e09afa6d8ebe6c126ae
refs/heads/master
2020-03-28T00:19:41.253303
2019-03-10T03:34:36
2019-03-10T03:34:36
147,397,961
1
0
null
null
null
null
UTF-8
Java
false
false
2,673
java
package spyr.actions; import java.util.ArrayList; import com.megacrit.cardcrawl.actions.AbstractGameAction; import com.megacrit.cardcrawl.cards.AbstractCard; import com.megacrit.cardcrawl.core.CardCrawlGame; import com.megacrit.cardcrawl.core.Settings; import com.megacrit.cardcrawl.dungeons.AbstractDungeon; import com.megacrit.cardcrawl.localization.UIStrings; public class MeditateAction extends AbstractGameAction { public static final UIStrings UI_STRINGS = CardCrawlGame.languagePack.getUIString("spyr:meditate_action"); private int numCardsFromDeck; private ArrayList<AbstractCard> cards = new ArrayList<>(); public MeditateAction(int numCardsFromDeck, int numCardsToKeep) { this.amount = numCardsToKeep; this.numCardsFromDeck = numCardsFromDeck; this.actionType = AbstractGameAction.ActionType.CARD_MANIPULATION; this.duration = Settings.ACTION_DUR_FAST; } @Override public void update() { if (this.duration == Settings.ACTION_DUR_FAST) { // If there aren't any cards too bad! if (AbstractDungeon.player.drawPile.isEmpty()) { this.isDone = true; return; } // If there's only one card give them the card. if (AbstractDungeon.player.drawPile.size() == 1) { AbstractCard card = AbstractDungeon.player.drawPile.getTopCard(); AbstractDungeon.player.drawPile.removeCard(card); AbstractDungeon.player.hand.addToTop(card); AbstractDungeon.player.hand.refreshHandLayout(); AbstractDungeon.player.hand.applyPowers(); this.isDone = true; return; } for (int i = 0; i < Math.min(this.numCardsFromDeck, AbstractDungeon.player.drawPile.size()); ++i) { this.cards .add(AbstractDungeon.player.drawPile.group.get(AbstractDungeon.player.drawPile.size() - i - 1)); } ChooseAction.openChooseScreen(this.cards, UI_STRINGS.TEXT[0], /* allowSkip= */false); this.tickDuration(); return; } for (AbstractCard c : this.cards) { // Using the reward screen hack interacts with the codexCard. If we encounter a // card that's not our selected, move it to the discard. if (c != AbstractDungeon.cardRewardScreen.codexCard) { AbstractDungeon.player.drawPile.moveToDiscardPile(c); continue; } // Draw the card. if (AbstractDungeon.player.hand.size() == 10) { AbstractDungeon.player.drawPile.moveToDiscardPile(c); AbstractDungeon.player.createHandIsFullDialog(); continue; } AbstractDungeon.player.drawPile.removeCard(c); AbstractDungeon.player.hand.addToTop(c); AbstractDungeon.player.hand.refreshHandLayout(); AbstractDungeon.player.hand.applyPowers(); AbstractDungeon.cardRewardScreen.codexCard = null; } this.isDone = true; } }
1ed0cbfa8d687f745fd7e64426cb57883fbecb95
25fa7aaf19af1b11a40370016659eb4d630af31c
/Backend Codes/src/com/example/zootopia/ui/MailboxFragment.java
99e6f865fbbf6bca8f4ef161dfc1dbe6e27b3101
[]
no_license
jialuchen/WeDiscuz
57bb48e884ad8bff556f7865574ac125a5a4b637
4a8a6901a7c34f3ab3c1f16e809f7ab4875e5f3d
refs/heads/master
2021-01-11T22:01:10.238470
2017-01-14T00:40:15
2017-01-14T00:40:15
78,897,823
0
0
null
null
null
null
UTF-8
Java
false
false
6,579
java
package com.example.zootopia.ui; 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.ListView; import android.widget.SimpleAdapter; import com.example.zootopia.wediscuz.R; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Created by Zootopia on 4/12/16. * Linpeng Lyu (linpengl) * Yilei Chu (ychu1) * Jialu Chen (jialuc) */ public class MailboxFragment extends Fragment { private ListView friendRequestListView = null; private ListView roomInvitationListView = null; @Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { // TODO Auto-generated method stub View v = inflater.inflate(R.layout.ui_mailbox_fragment, null); // Initialize friend request list view friendRequestListView = (ListView) v.findViewById(R.id.mailbox_listView_friend_request); SimpleAdapter contactAdapter = new SimpleAdapter(this.getContext(), getCFriendRequestData(), R.layout.ui_friend_request_listview, new String[]{"name", "time"}, new int[]{R.id.friend_request_listitem_name, R.id.friend_request_listitem_time}); friendRequestListView.setAdapter(contactAdapter); friendRequestListView.setScrollContainer(false); // Initialize chatroom list view roomInvitationListView = (ListView) v.findViewById(R.id.mailbox_listView_room_invitation); SimpleAdapter chatroomAdapter = new SimpleAdapter(this.getContext(), getRoomInvitationData(), R.layout.ui_room_invitation_listview, new String[]{"name", "time"}, new int[]{R.id.room_invitation_listitem_name, R.id.room_invitation_listitem_time}); roomInvitationListView.setAdapter(chatroomAdapter); roomInvitationListView.setScrollContainer(false); return v; } /** * getContactData - return list data of friend request * * @return list of data */ private List<Map<String, Object>> getCFriendRequestData() { List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = new HashMap<String, Object>(); map.put("name", "Yilei Chu"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Linpeng Lyu"); map.put("email", "[email protected]"); map.put("image", R.mipmap.ic_launcher); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Jialu Chen"); map.put("time", "2016-4-14"); list.add(map); return list; } /** * getChatroomData - return list data of room invitation * * @return list of data */ private List<Map<String, Object>> getRoomInvitationData() { List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); Map<String, Object> map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); map = new HashMap<String, Object>(); map.put("name", "Java for Smart Phone"); map.put("time", "2016-03-11"); list.add(map); return list; } }
8b54325c89a006d2afdf8224c359f52142078ef3
b3d9e233c9be411b0e01574a25da3a7baa855065
/src/com/base/engine/renderEngine/lighting/BaseLight.java
f8be28e2b84a4092ebe5345ecfb898006bf6424b
[]
no_license
Genthorn/Wolfenstein-Clone
7983c56987efeddf9448bd40fbb6436a1d408019
3d4c4820106d239d4f4aea7ef2fa274359acbc53
refs/heads/master
2020-05-25T11:29:49.465882
2017-03-03T15:08:02
2017-03-03T15:08:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
526
java
package com.base.engine.renderEngine.lighting; import com.base.engine.utils.Vector3f; public class BaseLight { private Vector3f color; private float intensity; public BaseLight(Vector3f color, float intensity) { this.color = color; this.intensity = intensity; } public Vector3f getColor() { return color; } public void setColor(Vector3f color) { this.color = color; } public float getIntensity() { return intensity; } public void setIntensity(float intensity) { this.intensity = intensity; } }
dd72e880ee4c1459cd11753b4c3b6840b77b1099
3d79a381d5808609c430ffda901582aca2063ed5
/src/java/controller/command/LoginComand.java
265a31f36c75fceb4c90f5f82cda557fae84b5d6
[]
no_license
NakagavaDaniil/AirportCompany
9d74d5b14c1a88d2cff33d070c604a7ef45de966
60c79158d085fffe14ee19c2826fb34bf7b0a523
refs/heads/master
2020-03-24T20:49:43.666844
2018-08-01T14:08:56
2018-08-01T14:08:56
142,998,487
0
0
null
null
null
null
UTF-8
Java
false
false
564
java
package controller.command; import model.entity.User; import javax.servlet.http.HttpServletRequest; public class LoginComand implements Command { public String execute(HttpServletRequest request) { String name = request.getParameter("username"); String password = request.getParameter("password"); System.out.println(name); User user = new User(); String result = user.getUser(name,password) ? "Planes.jsp": "login.jsp" ; request.getSession().setAttribute("user", user); return result; } }
5b6f4e04050dd0716a18eeb2ec04ec0be89ccb13
76fa1e47e10d404527e323190a51a5dab221dbe0
/app/src/test/java/com/example/android_project_18_register_page/ExampleUnitTest.java
8efd1c00282b13be5608d6cd34f658512c1a4f2b
[]
no_license
ahmadkybora/android_project_18_registerpage
ad7741c6e0a87e5512338dc942c1daa9fbbd0eee
516f63ccf0f4b097ded71cf20c59f4b93b68500f
refs/heads/master
2023-08-28T02:28:39.542318
2021-08-18T09:21:00
2021-08-18T09:21:00
406,796,387
1
0
null
null
null
null
UTF-8
Java
false
false
405
java
package com.example.android_project_18_register_page; 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() { assertEquals(4, 2 + 2); } }
4e093cc59d08e27620f11bb35f6b0571036f8e50
703c083c8d152386a4dcfa5339cd72115863e762
/src/main/java/com/tw/interview/config/FeignConfiguration.java
77cda9550961a094434f80c99fbe6a09bb1d3ca7
[]
no_license
walid-haddad/interviewapp
daabe47d2e95446543687e8126afe14c996b2e54
dc7b806828352ebd5970322a54e84d7b1206a10a
refs/heads/main
2023-04-15T15:27:24.457921
2021-04-21T13:34:24
2021-04-21T13:34:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
670
java
package com.tw.interview.config; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.FeignClientsConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @Configuration @EnableFeignClients(basePackages = "com.tw.interview") @Import(FeignClientsConfiguration.class) public class FeignConfiguration { /** * Set the Feign specific log level to log client REST requests. */ @Bean feign.Logger.Level feignLoggerLevel() { return feign.Logger.Level.BASIC; } }
618d23ad47f145cfc751b631a53bf1ed9717d206
9082c8708e91b0a592fe22b2aacd41ab62f8e899
/src/jdbc/CreateCar.java
ceb14ec7fbae88c7b40f76f20e0c4d2d054282fa
[]
no_license
afiffadhlurrahman/Final-Exam-WebPro-C
5970cad8b2d37d6246208551aa7eef6de283a538
0d59e50d4d7a8628d3755d8d02643d1328de46ac
refs/heads/main
2023-01-20T13:35:55.699694
2020-11-28T16:55:48
2020-11-28T16:55:48
316,255,037
0
0
null
null
null
null
UTF-8
Java
false
false
2,457
java
package jdbc; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class CreateCar */ @WebServlet("/CreateCar") public class CreateCar extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public CreateCar() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { String name = request.getParameter("name"); String transmition = request.getParameter("transmition"); String model = request.getParameter("model"); int brandid = Integer.parseInt(request.getParameter("brand")); int cartypeid = Integer.parseInt(request.getParameter("type")); int capacity = Integer.parseInt(request.getParameter("capacity")); String fueltype = request.getParameter("fuel"); String sql = "INSERT INTO CAR(`brandid`,`cartypeid`,`carname`, `cartransmition`, `carmodeltype`,`carcapacity`,`carfueltype`) VALUES (?,?,?,?,?,?,?)"; Connection conn = new DbConnection().getConn(); PreparedStatement ps = conn.prepareStatement(sql); ps.setInt(1, brandid); ps.setInt(2, cartypeid); ps.setString(3, name); ps.setString(4, transmition); ps.setString(5, model); ps.setInt(6, capacity); ps.setString(7, fueltype); ps.executeUpdate(); RequestDispatcher rd = request.getRequestDispatcher("car.jsp"); rd.forward(request, response); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
e05fc91c982cd1a9361b9b9422212bf21d0cfd5f
78d8d00030b960ac852e39a7d3df91fd0e4cbffa
/starter-code/src/Son.java
cde5f69ef7f348caa3390c50d50f276def7048ec
[]
no_license
jackie-ho/oop-inheritance-abstraction-lab
390b049321e87f97804c925ad14283768d9a506b
03e98aa99f1eacffa9d0fe835509d13d5657a489
refs/heads/master
2020-12-07T13:37:09.610809
2016-03-21T19:25:08
2016-03-21T19:25:08
54,415,765
0
0
null
2016-03-21T19:12:53
2016-03-21T19:12:53
null
UTF-8
Java
false
false
509
java
/** * Created by JHADI on 3/21/16. */ public class Son extends Family { String name; public Son(String name) { super(name); this.name = name; } @Override public void eat() { System.out.println(name + " eating pizza."); } @Override public void goToBathroom() { System.out.println(name + " takes a 5 min shower."); } @Override public void sleep() { System.out.println(name + " goes to sleep at 2am for 5 hours."); } }
1e4491d42ed4a9abcaaaa7d3d0e56d4bc51bb77a
559af5ef9a87d658f43649740247a030729404d1
/homework/src/main/java/task08/exceptions/InvalidParamsNumberException.java
de8d4d0df2cf93a61dffc58bf650fa656853bdc2
[]
no_license
olegbaslak/tat2016
c1856c62fac2fc44815ba8f55f27520056fdd174
5765db4f9668f490d6e4a681bf9c0a7cd3595cab
refs/heads/master
2021-06-15T21:19:16.140583
2017-02-06T13:31:30
2017-02-06T13:31:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
368
java
package task08.exceptions; /** * Exception thrown if options provider has invalid number * of options -> that means user inputted incorrect data. * * @author Oleg Baslak * @version 1.0 * @since 11.10.2016 */ public class InvalidParamsNumberException extends Exception { public InvalidParamsNumberException(String message) { super(message); } }
16b1fe8a91e2f6eaa5218b7770ca81958a5a2232
68f8d6ab2d19fcc44e113075ccd5996eba2e9174
/src/main/java/com/ccc/autocompleter/HomeController.java
6b1ae31363b8b6dd4346121fb22b511836536ebc
[]
no_license
agibsonccc/autocompleter-java
3c3e1362fbbf44158cfdd24836a9253db9819994
6b6d07759cc5b7476a27b01e6a1d7b30167d27b5
refs/heads/master
2021-01-22T07:27:46.907073
2012-09-02T04:32:19
2012-09-02T04:32:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,809
java
package com.ccc.autocompleter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import com.ccc.autocompleter.service.AutoCompleterService; /** * * @author Adam Gibson * */ @Controller @RequestMapping("/autocomplete") public class HomeController { private static Logger log=LoggerFactory.getLogger(HomeController.class); @Autowired private AutoCompleterService autoCompleterService; @RequestMapping(value = "/view", method = RequestMethod.GET) public String home(Model model) { return "home"; } /** * Performs quick search relative to the query term passed in * @param word the query term to ask quick search for * @return a json response for auto complete */ @RequestMapping(value = "/nextchar", method = RequestMethod.GET) public @ResponseBody List<Map<String,String>> home(@RequestParam("q") String word) { // String c=autoCompleterService.nextCharacter(word); List<String> list=autoCompleterService.words(word); List<Map<String,String>> retList = new ArrayList<Map<String,String>>(); for(int i=0;i<list.size();i++) { Map<String,String> ret = new HashMap<String,String>(); ret.put("id",String.valueOf(i)); ret.put("value",word + list.get(i)); retList.add(ret); } if(log.isDebugEnabled()) log.debug("Returned: " + word); return retList; } }
b7a6533dda4b9f35b330655759b9d786d5b41a05
92225460ebca1bb6a594d77b6559b3629b7a94fa
/src/com/kingdee/eas/fdc/sellhouse/app/BizListEntryControllerRemote.java
14c951b5038bd3e07327ea47ead3fd6f6ad9b595
[]
no_license
yangfan0725/sd
45182d34575381be3bbdd55f3f68854a6900a362
39ebad6e2eb76286d551a9e21967f3f5dc4880da
refs/heads/master
2023-04-29T01:56:43.770005
2023-04-24T05:41:13
2023-04-24T05:41:13
512,073,641
0
1
null
null
null
null
UTF-8
Java
false
false
156
java
package com.kingdee.eas.fdc.sellhouse.app; import javax.ejb.*; public interface BizListEntryControllerRemote extends EJBObject, BizListEntryController { }
f1f65aef8a260d359dfa7fcfe79c019e8472956d
280ce9155107a41d88167818054fca9bceda796b
/jre_emul/android/platform/external/icu/android_icu4j/src/main/tests/android/icu/dev/test/stringprep/TestIDNARef.java
d5512ad311d029db0459138b8dd0ac3a5b4f68ce
[ "Apache-2.0", "BSD-3-Clause", "GPL-2.0-only", "LicenseRef-scancode-public-domain", "BSD-2-Clause", "APSL-1.0", "LGPL-2.0-or-later", "LicenseRef-scancode-proprietary-license", "GPL-1.0-or-later", "LicenseRef-scancode-generic-exception", "LicenseRef-scancode-red-hat-attribution", "ICU", "MIT", "CPL-1.0", "LicenseRef-scancode-unicode", "LicenseRef-scancode-warranty-disclaimer", "LicenseRef-scancode-other-copyleft", "NAIST-2003", "GPL-2.0-or-later", "APSL-2.0", "LicenseRef-scancode-oracle-openjdk-exception-2.0" ]
permissive
google/j2objc
bd4796cdf77459abe816ff0db6e2709c1666627c
57b9229f5c6fb9e710609d93ca49eda9fa08c0e8
refs/heads/master
2023-08-28T16:26:05.842475
2023-08-26T03:30:58
2023-08-26T03:32:25
16,389,681
5,053
1,041
Apache-2.0
2023-09-14T20:32:57
2014-01-30T20:19:56
Java
UTF-8
Java
false
false
33,640
java
/* GENERATED SOURCE. DO NOT MODIFY. */ // © 2016 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html#License /* ******************************************************************************* * Copyright (C) 2003-2010, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ package android.icu.dev.test.stringprep; import org.junit.Test; import android.icu.dev.test.TestFmwk; import android.icu.text.StringPrepParseException; import android.icu.text.UCharacterIterator; /** * @author ram * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class TestIDNARef extends TestFmwk { private StringPrepParseException unassignedException = new StringPrepParseException("",StringPrepParseException.UNASSIGNED_ERROR); @Test public void TestToUnicode() throws Exception{ try{ for(int i=0; i<TestData.asciiIn.length; i++){ // test StringBuffer toUnicode doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNAReference.DEFAULT, null); doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNAReference.ALLOW_UNASSIGNED, null); //doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNAReference.USE_STD3_RULES, null); //doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNAReference.USE_STD3_RULES|IDNAReference.ALLOW_UNASSIGNED, null); } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } @Test public void TestToASCII() throws Exception{ try{ for(int i=0; i<TestData.asciiIn.length; i++){ // test StringBuffer toUnicode doTestToASCII(new String(TestData.unicodeIn[i]),TestData.asciiIn[i],IDNAReference.DEFAULT, null); doTestToASCII(new String(TestData.unicodeIn[i]),TestData.asciiIn[i],IDNAReference.ALLOW_UNASSIGNED, null); //doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNAReference.USE_STD3_RULES, null); //doTestToUnicode(TestData.asciiIn[i],new String(TestData.unicodeIn[i]),IDNAReference.USE_STD3_RULES|IDNAReference.ALLOW_UNASSIGNED, null); } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } @Test public void TestIDNToASCII() throws Exception{ try{ for(int i=0; i<TestData.domainNames.length; i++){ doTestIDNToASCII(TestData.domainNames[i],TestData.domainNames[i],IDNAReference.DEFAULT, null); doTestIDNToASCII(TestData.domainNames[i],TestData.domainNames[i],IDNAReference.ALLOW_UNASSIGNED, null); doTestIDNToASCII(TestData.domainNames[i],TestData.domainNames[i],IDNAReference.USE_STD3_RULES, null); doTestIDNToASCII(TestData.domainNames[i],TestData.domainNames[i],IDNAReference.ALLOW_UNASSIGNED|IDNAReference.USE_STD3_RULES, null); } for(int i=0; i<TestData.domainNames1Uni.length; i++){ doTestIDNToASCII(TestData.domainNames1Uni[i],TestData.domainNamesToASCIIOut[i],IDNAReference.DEFAULT, null); doTestIDNToASCII(TestData.domainNames1Uni[i],TestData.domainNamesToASCIIOut[i],IDNAReference.ALLOW_UNASSIGNED, null); doTestIDNToASCII(TestData.domainNames1Uni[i],TestData.domainNamesToASCIIOut[i],IDNAReference.USE_STD3_RULES, null); doTestIDNToASCII(TestData.domainNames1Uni[i],TestData.domainNamesToASCIIOut[i],IDNAReference.ALLOW_UNASSIGNED|IDNAReference.USE_STD3_RULES, null); } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } @Test public void TestIDNToUnicode() throws Exception{ try{ for(int i=0; i<TestData.domainNames.length; i++){ doTestIDNToUnicode(TestData.domainNames[i],TestData.domainNames[i],IDNAReference.DEFAULT, null); doTestIDNToUnicode(TestData.domainNames[i],TestData.domainNames[i],IDNAReference.ALLOW_UNASSIGNED, null); doTestIDNToUnicode(TestData.domainNames[i],TestData.domainNames[i],IDNAReference.USE_STD3_RULES, null); doTestIDNToUnicode(TestData.domainNames[i],TestData.domainNames[i],IDNAReference.ALLOW_UNASSIGNED|IDNAReference.USE_STD3_RULES, null); } for(int i=0; i<TestData.domainNamesToASCIIOut.length; i++){ doTestIDNToUnicode(TestData.domainNamesToASCIIOut[i],TestData.domainNamesToUnicodeOut[i],IDNAReference.DEFAULT, null); doTestIDNToUnicode(TestData.domainNamesToASCIIOut[i],TestData.domainNamesToUnicodeOut[i],IDNAReference.ALLOW_UNASSIGNED, null); } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } private void doTestToUnicode(String src, String expected, int options, Object expectedException) throws Exception{ if (!IDNAReference.isReady()) { logln("Transliterator is not available on this environment. Skipping doTestToUnicode."); return; } StringBuffer inBuf = new StringBuffer(src); UCharacterIterator inIter = UCharacterIterator.getInstance(src); try{ StringBuffer out = IDNAReference.convertToUnicode(src,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertToUnicode did not return expected result with options : "+ options + " Expected: " + prettify(expected)+" Got: "+prettify(out)); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToUnicode did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !ex.equals(expectedException)){ errln("convertToUnicode did not get the expected exception for source: " + prettify(src) +" Got: "+ ex.toString()); } } try{ StringBuffer out = IDNAReference.convertToUnicode(inBuf,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertToUnicode did not return expected result with options : "+ options + " Expected: " + prettify(expected)+" Got: "+out); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToUnicode did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !ex.equals(expectedException)){ errln("convertToUnicode did not get the expected exception for source: " + prettify(src) +" Got: "+ ex.toString()); } } try{ StringBuffer out = IDNAReference.convertToUnicode(inIter,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertToUnicode did not return expected result with options : "+ options + " Expected: " + prettify(expected)+" Got: "+prettify(out)); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("Did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !ex.equals(expectedException)){ errln("Did not get the expected exception for source: " + prettify(src) +" Got: "+ ex.toString()); } } } private void doTestIDNToUnicode(String src, String expected, int options, Object expectedException) throws Exception{ if (!IDNAReference.isReady()) { logln("Transliterator is not available on this environment. Skipping doTestIDNToUnicode."); return; } StringBuffer inBuf = new StringBuffer(src); UCharacterIterator inIter = UCharacterIterator.getInstance(src); try{ StringBuffer out = IDNAReference.convertIDNToUnicode(src,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertToUnicode did not return expected result with options : "+ options + " Expected: " + prettify(expected)+" Got: "+prettify(out)); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToUnicode did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !expectedException.equals(ex)){ errln("convertToUnicode did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } try{ StringBuffer out = IDNAReference.convertIDNToUnicode(inBuf,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertToUnicode did not return expected result with options : "+ options + " Expected: " + prettify(expected)+" Got: "+out); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToUnicode did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !expectedException.equals(ex)){ errln("convertToUnicode did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } try{ StringBuffer out = IDNAReference.convertIDNToUnicode(inIter,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertToUnicode did not return expected result with options : "+ options + " Expected: " + prettify(expected)+" Got: "+prettify(out)); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("Did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !expectedException.equals(ex)){ errln("Did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } } private void doTestToASCII(String src, String expected, int options, Object expectedException) throws Exception{ if (!IDNAReference.isReady()) { logln("Transliterator is not available on this environment. Skipping doTestToASCII."); return; } StringBuffer inBuf = new StringBuffer(src); UCharacterIterator inIter = UCharacterIterator.getInstance(src); try{ StringBuffer out = IDNAReference.convertToASCII(src,options); if(!unassignedException.equals(expectedException) && expected!=null && out != null && expected!=null && out != null && !out.toString().equals(expected.toLowerCase())){ errln("convertToASCII did not return expected result with options : "+ options + " Expected: " + expected+" Got: "+out); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToASCII did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !expectedException.equals(ex)){ errln("convertToASCII did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } try{ StringBuffer out = IDNAReference.convertToASCII(inBuf,options); if(!unassignedException.equals(expectedException) && expected!=null && out != null && expected!=null && out != null && !out.toString().equals(expected.toLowerCase())){ errln("convertToASCII did not return expected result with options : "+ options + " Expected: " + expected+" Got: "+out); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToASCII did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !expectedException.equals(ex)){ errln("convertToASCII did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } try{ StringBuffer out = IDNAReference.convertToASCII(inIter,options); if(!unassignedException.equals(expectedException) && expected!=null && out != null && expected!=null && out != null && !out.toString().equals(expected.toLowerCase())){ errln("convertToASCII did not return expected result with options : "+ options + " Expected: " + expected+" Got: "+ out); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToASCII did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !expectedException.equals(ex)){ errln("convertToASCII did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } } private void doTestIDNToASCII(String src, String expected, int options, Object expectedException) throws Exception{ if (!IDNAReference.isReady()) { logln("Transliterator is not available on this environment. Skipping doTestIDNToASCII."); return; } StringBuffer inBuf = new StringBuffer(src); UCharacterIterator inIter = UCharacterIterator.getInstance(src); try{ StringBuffer out = IDNAReference.convertIDNToASCII(src,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertToIDNAReferenceASCII did not return expected result with options : "+ options + " Expected: " + expected+" Got: "+out); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToIDNAReferenceASCII did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !ex.equals(expectedException)){ errln("convertToIDNAReferenceASCII did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } try{ StringBuffer out = IDNAReference.convertIDNtoASCII(inBuf,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertToIDNAReferenceASCII did not return expected result with options : "+ options + " Expected: " + expected+" Got: "+out); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertToIDNAReferenceSCII did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !ex.equals(expectedException)){ errln("convertToIDNAReferenceSCII did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } try{ StringBuffer out = IDNAReference.convertIDNtoASCII(inIter,options); if(expected!=null && out != null && !out.toString().equals(expected)){ errln("convertIDNToASCII did not return expected result with options : "+ options + " Expected: " + expected+" Got: "+ out); } if(expectedException!=null && !unassignedException.equals(expectedException)){ errln("convertIDNToASCII did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(expectedException == null || !ex.equals(expectedException)){ errln("convertIDNToASCII did not get the expected exception for source: " +src +" Got: "+ ex.toString()); } } } @Test public void TestConformance()throws Exception{ try{ for(int i=0; i<TestData.conformanceTestCases.length;i++){ TestData.ConformanceTestCase testCase = TestData.conformanceTestCases[i]; if(testCase.expected != null){ //Test toASCII doTestToASCII(testCase.input,testCase.output,IDNAReference.DEFAULT,testCase.expected); doTestToASCII(testCase.input,testCase.output,IDNAReference.ALLOW_UNASSIGNED,testCase.expected); } //Test toUnicode //doTestToUnicode(testCase.input,testCase.output,IDNAReference.DEFAULT,testCase.expected); } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } @Test public void TestNamePrepConformance() throws Exception{ try{ NamePrepTransform namePrep = NamePrepTransform.getInstance(); if (!namePrep.isReady()) { logln("Transliterator is not available on this environment."); return; } for(int i=0; i<TestData.conformanceTestCases.length;i++){ TestData.ConformanceTestCase testCase = TestData.conformanceTestCases[i]; UCharacterIterator iter = UCharacterIterator.getInstance(testCase.input); try{ StringBuffer output = namePrep.prepare(iter,NamePrepTransform.NONE); if(testCase.output !=null && output!=null && !testCase.output.equals(output.toString())){ errln("Did not get the expected output. Expected: " + prettify(testCase.output)+ " Got: "+ prettify(output) ); } if(testCase.expected!=null && !unassignedException.equals(testCase.expected)){ errln("Did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(testCase.expected == null || !ex.equals(testCase.expected)){ errln("Did not get the expected exception for source: " +testCase.input +" Got: "+ ex.toString()); } } try{ iter.setToStart(); StringBuffer output = namePrep.prepare(iter,NamePrepTransform.ALLOW_UNASSIGNED); if(testCase.output !=null && output!=null && !testCase.output.equals(output.toString())){ errln("Did not get the expected output. Expected: " + prettify(testCase.output)+ " Got: "+ prettify(output) ); } if(testCase.expected!=null && !unassignedException.equals(testCase.expected)){ errln("Did not get the expected exception. The operation succeeded!"); } }catch(StringPrepParseException ex){ if(testCase.expected == null || !ex.equals(testCase.expected)){ errln("Did not get the expected exception for source: " +testCase.input +" Got: "+ ex.toString()); } } } }catch(java.lang.ExceptionInInitializerError e){ warnln("Could not load NamePrepTransformData"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } @Test public void TestErrorCases() throws Exception{ try{ for(int i=0; i < TestData.errorCases.length; i++){ TestData.ErrorCase errCase = TestData.errorCases[i]; if(errCase.testLabel==true){ // Test ToASCII doTestToASCII(new String(errCase.unicode),errCase.ascii,IDNAReference.DEFAULT,errCase.expected); doTestToASCII(new String(errCase.unicode),errCase.ascii,IDNAReference.ALLOW_UNASSIGNED,errCase.expected); if(errCase.useSTD3ASCIIRules){ doTestToASCII(new String(errCase.unicode),errCase.ascii,IDNAReference.USE_STD3_RULES,errCase.expected); } } if(errCase.useSTD3ASCIIRules!=true){ // Test IDNToASCII doTestIDNToASCII(new String(errCase.unicode),errCase.ascii,IDNAReference.DEFAULT,errCase.expected); doTestIDNToASCII(new String(errCase.unicode),errCase.ascii,IDNAReference.ALLOW_UNASSIGNED,errCase.expected); }else{ doTestIDNToASCII(new String(errCase.unicode),errCase.ascii,IDNAReference.USE_STD3_RULES,errCase.expected); } //TestToUnicode if(errCase.testToUnicode==true){ if(errCase.useSTD3ASCIIRules!=true){ // Test IDNToUnicode doTestIDNToUnicode(errCase.ascii,new String(errCase.unicode),IDNAReference.DEFAULT,errCase.expected); doTestIDNToUnicode(errCase.ascii,new String(errCase.unicode),IDNAReference.ALLOW_UNASSIGNED,errCase.expected); }else{ doTestIDNToUnicode(errCase.ascii,new String(errCase.unicode),IDNAReference.USE_STD3_RULES,errCase.expected); } } } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } private void doTestCompare(String s1, String s2, boolean isEqual){ if (!IDNAReference.isReady()) { logln("Transliterator is not available on this environment. Skipping doTestCompare."); return; } try{ int retVal = IDNAReference.compare(s1,s2,IDNAReference.DEFAULT); if(isEqual==true && retVal != 0){ errln("Did not get the expected result for s1: "+ prettify(s1)+ " s2: "+prettify(s2)); } retVal = IDNAReference.compare(new StringBuffer(s1), new StringBuffer(s2), IDNAReference.DEFAULT); if(isEqual==true && retVal != 0){ errln("Did not get the expected result for s1: "+ prettify(s1)+ " s2: "+prettify(s2)); } retVal = IDNAReference.compare(UCharacterIterator.getInstance(s1), UCharacterIterator.getInstance(s2), IDNAReference.DEFAULT); if(isEqual==true && retVal != 0){ errln("Did not get the expected result for s1: "+ prettify(s1)+ " s2: "+prettify(s2)); } }catch(Exception e){ e.printStackTrace(); errln("Unexpected exception thrown by IDNAReference.compare"); } try{ int retVal = IDNAReference.compare(s1,s2,IDNAReference.ALLOW_UNASSIGNED); if(isEqual==true && retVal != 0){ errln("Did not get the expected result for s1: "+ prettify(s1)+ " s2: "+prettify(s2)); } retVal = IDNAReference.compare(new StringBuffer(s1), new StringBuffer(s2), IDNAReference.ALLOW_UNASSIGNED); if(isEqual==true && retVal != 0){ errln("Did not get the expected result for s1: "+ prettify(s1)+ " s2: "+prettify(s2)); } retVal = IDNAReference.compare(UCharacterIterator.getInstance(s1), UCharacterIterator.getInstance(s2), IDNAReference.ALLOW_UNASSIGNED); if(isEqual==true && retVal != 0){ errln("Did not get the expected result for s1: "+ prettify(s1)+ " s2: "+prettify(s2)); } }catch(Exception e){ errln("Unexpected exception thrown by IDNAReference.compare"); } } @Test public void TestCompare() throws Exception{ String www = "www."; String com = ".com"; StringBuffer source = new StringBuffer(www); StringBuffer uni0 = new StringBuffer(www); StringBuffer uni1 = new StringBuffer(www); StringBuffer ascii0 = new StringBuffer(www); StringBuffer ascii1 = new StringBuffer(www); uni0.append(TestData.unicodeIn[0]); uni0.append(com); uni1.append(TestData.unicodeIn[1]); uni1.append(com); ascii0.append(TestData.asciiIn[0]); ascii0.append(com); ascii1.append(TestData.asciiIn[1]); ascii1.append(com); try{ for(int i=0;i< TestData.unicodeIn.length; i++){ // for every entry in unicodeIn array // prepend www. and append .com source.setLength(4); source.append(TestData.unicodeIn[i]); source.append(com); // a) compare it with itself doTestCompare(source.toString(),source.toString(),true); // b) compare it with asciiIn equivalent doTestCompare(source.toString(),www+TestData.asciiIn[i]+com,true); // c) compare it with unicodeIn not equivalent if(i==0){ doTestCompare(source.toString(), uni1.toString(), false); }else{ doTestCompare(source.toString(),uni0.toString(), false); } // d) compare it with asciiIn not equivalent if(i==0){ doTestCompare(source.toString(),ascii1.toString(), false); }else{ doTestCompare(source.toString(),ascii0.toString(), false); } } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } // test and ascertain // func(func(func(src))) == func(src) private void doTestChainingToASCII(String source) throws Exception { if (!IDNAReference.isReady()) { logln("Transliterator is not available on this environment. Skipping doTestChainingToASCII."); return; } StringBuffer expected; StringBuffer chained; // test convertIDNToASCII expected = IDNAReference.convertIDNToASCII(source,IDNAReference.DEFAULT); chained = expected; for(int i=0; i< 4; i++){ chained = IDNAReference.convertIDNtoASCII(chained,IDNAReference.DEFAULT); } if(!expected.toString().equals(chained.toString())){ errln("Chaining test failed for convertIDNToASCII"); } // test convertIDNToA expected = IDNAReference.convertToASCII(source,IDNAReference.DEFAULT); chained = expected; for(int i=0; i< 4; i++){ chained = IDNAReference.convertToASCII(chained,IDNAReference.DEFAULT); } if(!expected.toString().equals(chained.toString())){ errln("Chaining test failed for convertToASCII"); } } // test and ascertain // func(func(func(src))) == func(src) public void doTestChainingToUnicode(String source) throws Exception { if (!IDNAReference.isReady()) { logln("Transliterator is not available on this environment. Skipping doTestChainingToUnicode."); return; } StringBuffer expected; StringBuffer chained; // test convertIDNToUnicode expected = IDNAReference.convertIDNToUnicode(source,IDNAReference.DEFAULT); chained = expected; for(int i=0; i< 4; i++){ chained = IDNAReference.convertIDNToUnicode(chained,IDNAReference.DEFAULT); } if(!expected.toString().equals(chained.toString())){ errln("Chaining test failed for convertIDNToUnicode"); } // test convertIDNToA expected = IDNAReference.convertToUnicode(source,IDNAReference.DEFAULT); chained = expected; for(int i=0; i< 4; i++){ chained = IDNAReference.convertToUnicode(chained,IDNAReference.DEFAULT); } if(!expected.toString().equals(chained.toString())){ errln("Chaining test failed for convertToUnicode"); } } @Test public void TestChaining() throws Exception{ try{ for(int i=0; i< TestData.unicodeIn.length; i++){ doTestChainingToASCII(new String(TestData.unicodeIn[i])); } for(int i=0; i< TestData.asciiIn.length; i++){ doTestChainingToUnicode(TestData.asciiIn[i]); } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } @Test public void TestRootLabelSeparator() throws Exception{ String www = "www."; String com = ".com."; /*root label separator*/ StringBuffer source = new StringBuffer(www); StringBuffer uni0 = new StringBuffer(www); StringBuffer uni1 = new StringBuffer(www); StringBuffer ascii0 = new StringBuffer(www); StringBuffer ascii1 = new StringBuffer(www); uni0.append(TestData.unicodeIn[0]); uni0.append(com); uni1.append(TestData.unicodeIn[1]); uni1.append(com); ascii0.append(TestData.asciiIn[0]); ascii0.append(com); ascii1.append(TestData.asciiIn[1]); ascii1.append(com); try{ for(int i=0;i< TestData.unicodeIn.length; i++){ // for every entry in unicodeIn array // prepend www. and append .com source.setLength(4); source.append(TestData.unicodeIn[i]); source.append(com); // a) compare it with itself doTestCompare(source.toString(),source.toString(),true); // b) compare it with asciiIn equivalent doTestCompare(source.toString(),www+TestData.asciiIn[i]+com,true); // c) compare it with unicodeIn not equivalent if(i==0){ doTestCompare(source.toString(), uni1.toString(), false); }else{ doTestCompare(source.toString(),uni0.toString(), false); } // d) compare it with asciiIn not equivalent if(i==0){ doTestCompare(source.toString(),ascii1.toString(), false); }else{ doTestCompare(source.toString(),ascii0.toString(), false); } } }catch(java.lang.ExceptionInInitializerError ex){ warnln("Could not load NamePrepTransform data"); }catch(java.lang.NoClassDefFoundError ex){ warnln("Could not load NamePrepTransform data"); } } }
d22e66dc2d6cb1793339c1674197c6fa5be1e48c
2fe934ad19001ac2530dd9ec55065a1878f54a2f
/src/test/java/com/dirac/test/web/rest/ClientForwardControllerIT.java
700d6a899ee11c8d8f9df6a01fbd3b8f4a6dc145
[]
no_license
diracsystems/jx-test-jhipster
0d715aa5fad91138574d93d4e5e7c1af054cdccf
2fe31f719f62bfd17a3317fa27e6c22ab7da3a93
refs/heads/master
2022-12-20T00:28:45.839505
2019-09-18T20:18:59
2019-09-18T20:18:59
209,370,215
0
0
null
2022-12-16T05:05:49
2019-09-18T17:48:06
Java
UTF-8
Java
false
false
2,354
java
package com.dirac.test.web.rest; import com.dirac.test.TestjhipsterApp; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.forwardedUrl; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; /** * Integration tests for the {@link ClientForwardController} REST controller. */ @SpringBootTest(classes = TestjhipsterApp.class) public class ClientForwardControllerIT { private MockMvc restMockMvc; @BeforeEach public void setup() { ClientForwardController clientForwardController = new ClientForwardController(); this.restMockMvc = MockMvcBuilders .standaloneSetup(clientForwardController, new TestController()) .build(); } @Test public void getBackendEndpoint() throws Exception { restMockMvc.perform(get("/test")) .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.TEXT_PLAIN_VALUE)) .andExpect(content().string("test")); } @Test public void getClientEndpoint() throws Exception { ResultActions perform = restMockMvc.perform(get("/non-existant-mapping")); perform .andExpect(status().isOk()) .andExpect(forwardedUrl("/")); } @Test public void getNestedClientEndpoint() throws Exception { restMockMvc.perform(get("/admin/user-management")) .andExpect(status().isOk()) .andExpect(forwardedUrl("/")); } @RestController public static class TestController { @RequestMapping(value = "/test") public String test() { return "test"; } } }
164c8a1b98154937ec2c85c5cf1d32dc71e1e684
f2c9888939af8068c61e9eabd8eee0022f4d9634
/main/java/love/target/utils/TimerUtil.java
6f2e71a9ffd62c9e23d3e3222531b3de9a7056f6
[]
no_license
gcanal614/Target_Client
5e61b4a1a243ce4dc6a86b9e3968149333e4a031
0bb3272d723e7c5910f383d4c2d6dcda1e7d5684
refs/heads/main
2023-05-13T21:23:44.416857
2021-05-26T12:18:05
2021-05-26T12:18:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
540
java
package love.target.utils; public class TimerUtil { private long lastMS; public long getCurrentMS() { return System.nanoTime() / 1000000L; } public boolean hasReached(double milliseconds) { return (double)(this.getCurrentMS() - this.lastMS) >= milliseconds; } public void reset() { this.lastMS = this.getCurrentMS(); } public final long getElapsedTime() { return this.getCurrentMS() - this.lastMS; } public long getLastMS() { return this.lastMS; } }
11db2bc00209da172ad028af5709923d1d220495
9685627cab22194d6d1d3b62a3da012db426c436
/src/main/java/challenge/multiplystrings/MultiplyStrings.java
be6f0ca39ee2bfa3cc48ffab35f34c6e09f6dd04
[]
no_license
suiiii-rip/challenge-java202004
a77d285324dfd7ceb9ce9e8cad8b5731f560a62a
b8ed713a4cd0f5ff295526c582c2c71da62024d4
refs/heads/master
2022-12-19T23:28:04.247101
2020-05-27T01:42:03
2020-05-27T01:42:03
259,208,317
0
0
null
2020-10-13T21:32:04
2020-04-27T04:49:50
Java
UTF-8
Java
false
false
1,666
java
package challenge.multiplystrings; import java.util.ArrayList; import java.util.List; public class MultiplyStrings { public String multiply(String a, String b) { List<List<Integer>> resultMatrix = new ArrayList<>(); for (int i = a.length() - 1; i >= 0; i--) { int x = Character.getNumericValue(a.charAt(i)); List<Integer> rowResult = new ArrayList<>(); for (int k = 0; k < a.length() - i - 1; k++) { rowResult.add(0); } int overflow = 0; for (int j = b.length() - 1; j >= 0; j--) { int y = Character.getNumericValue(b.charAt(j)); int result = (x * y) + overflow; int resultDigit = result % 10; overflow = result / 10; rowResult.add(resultDigit); } rowResult.add(overflow); resultMatrix.add(rowResult); } boolean hasDigits = true; int i = 0; int overflow = 0; StringBuilder sb = new StringBuilder(); while (hasDigits) { List<Integer> columnDigits = new ArrayList<>(); boolean columnsValid = false; for (List<Integer> row : resultMatrix) { if (row.size() > i) { columnDigits.add(row.get(i)); columnsValid = true; } } int result = columnDigits.stream().reduce(0, Integer::sum) + overflow; int resultDigit = result % 10; overflow = result / 10; sb.append(resultDigit); hasDigits &= columnsValid; i++; } String resultString = sb.reverse().toString(); while (resultString.charAt(0) == '0' && resultString.length() > 1) { resultString = resultString.substring(1); } return resultString; } }
8fd401f8f6669c99232aba7b581f7c697719e8f8
c5b7e92837bc028159bd52e47977eef9273edcd9
/src/main/java/com/cis/drool_rest/models/FeeDataModel.java
00eb6e3742ac60a28b54ece11896cd467001e8b8
[]
no_license
abhaymeshram/Drools
baabc8c4ab69a9f4fe527617bf0b9e62e24356c3
fc1bcd41672f395882956c50a2f5ac8772761dea
refs/heads/master
2022-12-26T11:05:52.556140
2020-04-04T10:28:59
2020-04-04T10:28:59
90,171,634
0
1
null
2022-12-16T06:17:56
2017-05-03T16:44:29
Java
UTF-8
Java
false
false
4,052
java
package com.cis.drool_rest.models; import java.util.Date; public class FeeDataModel { private int feeType; private int parentID; private String active; private String conditional; private boolean isConditionSatisfied; private Date conditionSatisfiedDate; private String conditionDesc; private int feeStatus; private Date lastAppDate; private Date nextAppDate; private int feeFreq; private int feeStructType; private int paidBy; private int payableTo; private boolean isPassThrough; private int ractiveFee; private int rConditionalFee; private int rFeeCanBeApplied; public int getFeeType() { return feeType; } public void setFeeType(int feeType) { this.feeType = feeType; } public int getParentID() { return parentID; } public void setParentID(int parentID) { this.parentID = parentID; } public boolean isConditionSatisfied() { return isConditionSatisfied; } public void setConditionSatisfied(boolean isConditionSatisfied) { this.isConditionSatisfied = isConditionSatisfied; } public Date getConditionSatisfiedDate() { return conditionSatisfiedDate; } public void setConditionSatisfiedDate(Date conditionSatisfiedDate) { this.conditionSatisfiedDate = conditionSatisfiedDate; } public String getConditionDesc() { return conditionDesc; } public void setConditionDesc(String conditionDesc) { this.conditionDesc = conditionDesc; } public int getFeeStatus() { return feeStatus; } public void setFeeStatus(int feeStatus) { this.feeStatus = feeStatus; } public Date getLastAppDate() { return lastAppDate; } public void setLastAppDate(Date lastAppDate) { this.lastAppDate = lastAppDate; } public Date getNextAppDate() { return nextAppDate; } public void setNextAppDate(Date nextAppDate) { this.nextAppDate = nextAppDate; } public int getFeeFreq() { return feeFreq; } public void setFeeFreq(int feeFreq) { this.feeFreq = feeFreq; } public int getFeeStructType() { return feeStructType; } public void setFeeStructType(int feeStructType) { this.feeStructType = feeStructType; } public int getPaidBy() { return paidBy; } public void setPaidBy(int paidBy) { this.paidBy = paidBy; } public int getPayableTo() { return payableTo; } public void setPayableTo(int payableTo) { this.payableTo = payableTo; } public boolean isPassThrough() { return isPassThrough; } public void setPassThrough(boolean isPassThrough) { this.isPassThrough = isPassThrough; } public int getRactiveFee() { return ractiveFee; } public void setRactiveFee(int ractiveFee) { this.ractiveFee = ractiveFee; } public int getrConditionalFee() { return rConditionalFee; } public void setrConditionalFee(int rConditionalFee) { this.rConditionalFee = rConditionalFee; } public int getrFeeCanBeApplied() { return rFeeCanBeApplied; } public void setrFeeCanBeApplied(int rFeeCanBeApplied) { this.rFeeCanBeApplied = rFeeCanBeApplied; } public String getActive() { return active; } public void setActive(String active) { this.active = active; } public String getConditional() { return conditional; } public void setConditional(String conditional) { this.conditional = conditional; } @Override public String toString() { return "FeeDataModel [feeType=" + feeType + ", parentID=" + parentID + ", active=" + active + ", conditional=" + conditional + ", isConditionSatisfied=" + isConditionSatisfied + ", conditionSatisfiedDate=" + conditionSatisfiedDate + ", conditionDesc=" + conditionDesc + ", feeStatus=" + feeStatus + ", lastAppDate=" + lastAppDate + ", nextAppDate=" + nextAppDate + ", feeFreq=" + feeFreq + ", feeStructType=" + feeStructType + ", paidBy=" + paidBy + ", payableTo=" + payableTo + ", isPassThrough=" + isPassThrough + ", ractiveFee=" + ractiveFee + ", rConditionalFee=" + rConditionalFee + ", rFeeCanBeApplied=" + rFeeCanBeApplied + "]"; } }
[ "abhay@Abhay" ]
abhay@Abhay
20d22db586e32b4c7ffc2aece1d8b6f71e524f08
12b78dc1b16a55e53652ef13b6872916d5b5daea
/smsm-service-impl/src/main/java/com/smsm/service/impl/CompanyServiceImpl.java
970452c9d5f22da2c3ea76003d66717b6a15931b
[]
no_license
yangqi0224/spring-boot-web
62788b6e43ec286369d22ce83514e1178bbd25b3
6082a987d061f2c815f98ee304ebe3fa43c627fb
refs/heads/master
2020-06-15T17:41:56.522480
2019-07-05T07:00:00
2019-07-05T07:00:00
195,355,313
1
0
null
null
null
null
UTF-8
Java
false
false
2,303
java
package com.smsm.service.impl; import java.util.List; import com.smsm.mapper.CompanyMapper; import com.smsm.mapper.JobMapper; import com.smsm.mapper.ResumeMapper; import com.smsm.mapper.ToEmployMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import com.smsm.model.*; import com.smsm.service.CompanyService; @Service public class CompanyServiceImpl implements CompanyService{ @Autowired private CompanyMapper companyMapper; @Autowired private JobMapper jobMapper; @Autowired private ResumeMapper resumeMapper; @Autowired private ToEmployMapper toEmployMapper; public int insertUserInfo(User user){ return companyMapper.insertSelective1(user); } public int updateUser(User user){ return companyMapper.updateByPrimaryKey1(user); } public Company findUserInfo(String userPhone){ return companyMapper.selectByPrimaryKey1(userPhone); } @Override public int insertCompanyInfo(Company company) { return companyMapper.insertCompanyInfo(company); } @Override public int updateCompanyInfo(Company company) { return companyMapper.updateCompanyInfo(company); } @Override public Company getCompanyByUserPhone(String userPhone) { // TODO Auto-generated method stub return companyMapper.getCompanyBuUserPhone(userPhone); } @Override public Job getJobByJobName(String jobId) { // TODO Auto-generated method stub return jobMapper.getJobByJobName(jobId); } @Override public List<Company> findAllCompany() { return companyMapper.findAllCompany(); } @Override public Company selectCompanyById(String companyId) { return companyMapper.selectCompanyById(companyId); } @Override public List<Resume> selectResumesByToEmploy(String companyId) { return resumeMapper.selectResumesByToEmploy(companyId); } @Override public List<ToEmploy> selectToEmployByCompany(String companyId) { return toEmployMapper.selectToEmployByCompany(companyId); } @Override public List<ToEmploy> selectToEmployByRec(String recruitmentId) { return toEmployMapper.selectToEmployByRec(recruitmentId); } @Override public int uploadImage(String userPhone, String imgName) { return companyMapper.uploadImage(userPhone,imgName); } }
583e7f0d22475dd14fe07e06f763e18a9ee3c0e8
b41a58a245c954bcd045b697b9b214e9ee260e17
/service/src/main/java/platform/county/jiange/service/impl/GroupMemberServiceImpl.java
cd4f47bfe109ed6f5af7001ba2785b155acd5f05
[]
no_license
micklq/jiangeplatform
e98bdf48b21d5444319de779180efce2ebbcf273
550cfaa58354ef28b60b49e2899272f4193329b2
refs/heads/master
2021-01-09T20:07:31.222193
2016-08-14T15:54:46
2016-08-14T15:54:46
62,398,170
0
0
null
null
null
null
UTF-8
Java
false
false
1,030
java
package platform.county.jiange.service.impl; import javax.annotation.Resource; import org.springframework.stereotype.Service; import platform.county.jiange.data.repository.BaseRepository; import platform.county.jiange.data.repository.GroupMemberRepository; import platform.county.jiange.model.entity.GroupMember; import platform.county.jiange.service.GroupMemberService; @Service("groupMemberService") public class GroupMemberServiceImpl extends BaseServiceImpl<GroupMember, Long> implements GroupMemberService{ @Resource( name = "groupMemberRepository") GroupMemberRepository groupMemberRepository; /*@Autowired GroupMemberDAO groupMemberDAO;*/ @Resource( name = "groupMemberRepository") @Override public void setBaseRepository(BaseRepository<GroupMember, Long> baseRepository) { super.setBaseRepository(baseRepository); } /*public GroupMember findByEmail(String email){ if(email.isEmpty()){ return null; } return groupMemberDAO.findByEmail(email); }*/ }
5ca1ec8ebe2fb495feefd2e251fb1d081c5617a4
c65dbdf0f6195844f0131724536b25fad0578877
/Skripsi/Sandbox/src/Initiator.java
7d32a80edf9308a378c6ad0717e1166a026f7657
[]
no_license
torchrist11/Fire-Detection
76636b875f573b58269f8a3ef219eb59f1b6df13
f41bc23072b96e6d086cb86bed65e7eda7c5d647
refs/heads/master
2022-11-18T02:48:16.158658
2020-07-16T12:13:40
2020-07-16T12:13:40
177,826,879
0
0
null
null
null
null
ISO-8859-1
Java
false
false
3,956
java
// * // * Copyright (c) 2011., Virtenio GmbH // * All rights reserved. // * // * Commercial software license. // * Only for test and evaluation purposes. // * Use in commercial products prohibited. // * No distribution without permission by Virtenio. // * Ask Virtenio for other type of license at [email protected] // * // * Kommerzielle Softwarelizenz. // * Nur zum Test und Evaluierung zu verwenden. // * Der Einsatz in kommerziellen Produkten ist verboten. // * Ein Vertrieb oder eine Veröffentlichung in jeglicher Form ist nicht ohne Zustimmung von Virtenio erlaubt. // * Für andere Formen der Lizenz nehmen Sie bitte Kontakt mit [email protected] auf. // */ // // // ////import java.text.DateFormat; ////import java.text.SimpleDateFormat; ////import java.util.Date; // //import java.util.ArrayList; //import com.virtenio.driver.device.ADT7410; //import com.virtenio.driver.device.MPL115A2; //import com.virtenio.driver.i2c.I2C; //import com.virtenio.driver.i2c.NativeI2C; //import com.virtenio.driver.device.SHT21; //import com.virtenio.driver.gpio.GPIO; //import com.virtenio.driver.gpio.NativeGPIO; ///** // * Test den Zugriff auf den Temperatursensor ADT7410 von Analog über I2C. // * <p/> // * <b> Datenblatt des Temperatursensors: </b> <a href= // * "http://www.analog.com/static/imported-files/data_sheets/ADT7410.pdf" // * target="_blank"> // * http://www.analog.com/static/imported-files/data_sheets/ADT7410.pdf</a> // * (Stand: 29.03.2011) // */ //public class Initiator { // private NativeI2C i2c; // private ADT7410 temperatureSensor; // private SHT21 sht21; // private MPL115A2 pressureSensor; // // public void init() throws Exception { // //System.out.println("I2C(Init)"); // i2c = NativeI2C.getInstance(1); // i2c.open(I2C.DATA_RATE_400); // // //System.out.println("ADT7410(Init)" + ";" + " SHT21(Init)" + ";" + " MPL115A2(Init)"); // temperatureSensor = new ADT7410(i2c, ADT7410.ADDR_0, null, null); // temperatureSensor.open(); // temperatureSensor.setMode(ADT7410.CONFIG_MODE_CONTINUOUS); // // sht21 = new SHT21(i2c); // sht21.open(); // sht21.setResolution(SHT21.RESOLUTION_RH12_T14); // sht21.reset(); // // GPIO resetPin = NativeGPIO.getInstance(24); // GPIO shutDownPin = NativeGPIO.getInstance(12); // pressureSensor = new MPL115A2(i2c, resetPin, shutDownPin); // pressureSensor.open(); // pressureSensor.setReset(false); // pressureSensor.setShutdown(false); // // //System.out.println("Done(Init)"); // System.out.println("Start"); // } // //// public String run() throws Exception { //// init(); //// while (true) { //// try { //// //System.out.print(now.getTime()); //// //int raw = temperatureSensor.getTemperatureRaw(); //// float celsius = temperatureSensor.getTemperatureCelsius(); //// tempTemp[i]=celsius; //// System.out.print("Temperature: " + celsius + " [°C] "); //// //System.out.print("Temperature: raw=" + raw + "; " + celsius + " [°C] "); //// //// // humidity conversion //// sht21.startRelativeHumidityConversion(); //// Thread.sleep(100); //// int rawRH = sht21.getRelativeHumidityRaw(); //// float rh = SHT21.convertRawRHToRHw(rawRH); //// tempHum[i]=rh; //// System.out.print("Humidity: " + rh + " [Rh] "); //// //System.out.println("Humidity: rawRH=" + rawRH + ", RH=" + rh + " [Rh]"); //// //// pressureSensor.startBothConversion(); //// Thread.sleep(MPL115A2.BOTH_CONVERSION_TIME); //// int pressurePr = pressureSensor.getPressureRaw(); //// int tempRaw = pressureSensor.getTemperatureRaw(); //// float pressure = pressureSensor.compensate(pressurePr, tempRaw); //// System.out.println("Pressure: " + pressure); //// Thread.sleep(1000 - MPL115A2.BOTH_CONVERSION_TIME); //// //// Thread.sleep(500); //// } catch (Exception e) { //// System.out.println("error"); //// } //// } //// } // //// public static void main(String[] args) throws Exception { //// new coba().run(); //// } //}
f65ed0288e969de3aa28b155b0138a47a94a87f6
d038ffe244f034df0a021553f032919756cf0b8c
/src/com/kam/algorithms/Permutations.java
08b95fbd613fb4b70fb4f32f93d02df2447dcadb
[]
no_license
kaminasan/random-java-tools
d62b307f572731552b84c2557a15deeff7686dd8
47f5c246e70bd135c857200fca00aa6418b26524
refs/heads/master
2021-01-10T09:32:53.810298
2016-03-15T07:23:40
2016-03-15T07:23:40
52,485,637
0
0
null
null
null
null
UTF-8
Java
false
false
1,633
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 com.kam.algorithms; import java.util.ArrayList; import java.util.List; /** * * @author Blacksteath */ public class Permutations { public static void main(String[] args) { Permutations perm = new Permutations(); List<String> permutations = new ArrayList<>(); perm.permutate(permutations, "", "youarenotcool"); System.out.println(permutations.size()); } void permutate(List<String> listToUse, String current, String mutateMe){ String permutated = current; //We take the currently permutated string String toPermutate = mutateMe; for(int i = 0; i < mutateMe.length(); i++){ //This will take the currently permutated string, and then put the letter at i in it, then //we want to put each letter into the permutated list so it goes like 'A'BCD >> 'B'ACD >> 'C'ABD >> 'D'ABC, and then call the function again with the current mutation in place. This gets all the mutations after it. if(mutateMe.length() == 1){ listToUse.add(permutated+mutateMe); //if mutateMe is 1, it means we have permutated everything before it. } else{ permutate(listToUse, current + mutateMe.charAt(i), mutateMe.substring(0, i) + mutateMe.substring(i+1)); //we take the currently mutated string, pass it on } } } }
[ "Blacksteath@KamLaptop" ]
Blacksteath@KamLaptop
58794a1c25ab3499deab97b6f3e718f13caf2d49
790d540d7e06d15ad37e9ec33257907030b42070
/src/main/java/com/mingri/langhuan/cabinet/pojo/PagePojo.java
9c6ef76d1e6cf7900a618c87d1c675f17d9ce1a5
[]
no_license
ljinlin/langhuan-cabinet
33502ee78961460fec1046ac931c7061080d983b
80714f89f12953e9c7dc2fde5d91b1594da4a8bc
refs/heads/master
2022-06-26T22:57:20.274648
2020-07-06T09:37:26
2020-07-06T09:37:26
181,040,894
1
4
null
2022-06-17T03:04:15
2019-04-12T16:02:40
Java
UTF-8
Java
false
false
865
java
package com.mingri.langhuan.cabinet.pojo; public class PagePojo { /** * */ @SuppressWarnings("unused") private static final long serialVersionUID = 8798070553988740245L; private Integer pageNo; private Integer pageSize; private long total; public PagePojo() { } public PagePojo(Integer pageNo, Integer pageSize, Long total) { this.pageNo = pageNo; this.pageSize = pageSize; this.total = (total == null ? 0 : total); } public Integer getPageNo() { return pageNo; } public void setPageNo(Integer pageNo) { this.pageNo = pageNo; } public Integer getLimit() { return pageSize; } public void setLimit(Integer limit) { this.pageSize = limit; } public long getTotal() { return total; } public void setTotal(Long total) { this.total = (total == null ? 0 : total); } }
33951941d2b6e10f03d3c2c71ab9e993622dbc80
6e7f7fac4de13628898a622e63f1d38c66b4e480
/logistics-web/src/main/java/cn/kemis/tools/freemarker/FreemarkerTemplateHelper.java
b87713a108bfaa1904ba30fa7560c675e34bb781
[]
no_license
haonan333/kemis-logistics
af5a9613158ab78a27814f5733c31954273e7f2d
2989931bc71a2f960fc5b6a1e1808baf5e482fb9
refs/heads/master
2020-07-17T21:08:21.817725
2017-06-14T12:02:01
2017-06-14T12:02:01
94,324,919
0
1
null
null
null
null
UTF-8
Java
false
false
1,468
java
package cn.kemis.tools.freemarker; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; import java.io.File; import java.io.IOException; import java.io.StringWriter; import java.util.Locale; /** * * @author lty [email protected] * Created on 2016-08-10 */ public class FreemarkerTemplateHelper { //获取要写入PDF的内容 public static String getContent(String ftlPath, String ftlName, Object o) throws IOException, TemplateException { return useTemplate(ftlPath, ftlName, o); } //使用freemarker得到html内容 public static String useTemplate(String ftlPath, String ftlName, Object o) throws IOException, TemplateException { String html = null; Template tpl = getFreemarkerConfig(ftlPath).getTemplate(ftlName); StringWriter writer = new StringWriter(); tpl.process(o, writer); writer.flush(); html = writer.toString(); return html; } /** * 获取Freemarker配置 * * @param templatePath * @return * @throws IOException */ private static Configuration getFreemarkerConfig(String templatePath) throws IOException { Configuration config = new Configuration(Configuration.VERSION_2_3_23); config.setDirectoryForTemplateLoading(new File(templatePath)); config.setEncoding(Locale.CHINA, "utf-8"); return config; } }
89019153c1d419d467ee3c8d06de133422998730
8740341084e41f5b3328490f56d64f61a01fee1b
/app/src/main/java/com/isport/tracker/bluetooth/notifications/NotifService.java
074b37e7e881973ece1cef1e5420e36a9d627ad6
[]
no_license
sengeiou/ISportTracker
ecfee9e8e1fb34219e3711597038234de9dab141
88f7a7bcf2abbd3275b4d539667a396b78746e2d
refs/heads/master
2023-07-08T06:20:15.386196
2021-08-19T02:36:20
2021-08-19T02:36:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,638
java
package com.isport.tracker.bluetooth.notifications; import android.accessibilityservice.AccessibilityService; import android.app.Notification; import android.content.Context; import android.content.Intent; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; import android.view.accessibility.AccessibilityEvent; import com.isport.isportlibrary.entry.BaseDevice; import com.isport.isportlibrary.managers.NotiManager; import com.isport.tracker.BuildConfig; import com.isport.tracker.bluetooth.MainService; import com.isport.tracker.util.Constants; /** * Created by Administrator on 2017/9/28. */ public class NotifService extends AccessibilityService { private String TAG = "NotifService"; private boolean isOpen = false; /** * get state of notification service * * @param context * @return state of notification service */ public static boolean getNotificationIsRun(Context context) { /*final String service = context.getPackageName() + "/" + NotifService.class.getCanonicalName();//getPackageName() + "/" + YOURAccessibilityService.class.getCanonicalName(); AccessibilityManager accessibilityManager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); List<AccessibilityServiceInfo> accessibilityServices = accessibilityManager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_GENERIC); boolean state = false; for (AccessibilityServiceInfo info : accessibilityServices) { String tpv = info.getId(); if (tpv.equalsIgnoreCase(service)) { state = true; break; } } return state;*/ int accessibilityEnabled = 0; // TestService为对应的服务 final String service = context.getPackageName() + "/" + NotifService.class.getCanonicalName(); // com.z.buildingaccessibilityservices/android.accessibilityservice.AccessibilityService try { accessibilityEnabled = Settings.Secure.getInt(context.getApplicationContext().getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED); } catch (Settings.SettingNotFoundException e) { } TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':'); if (accessibilityEnabled == 1) { String settingValue = Settings.Secure.getString(context.getApplicationContext().getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES); // com.z.buildingaccessibilityservices/com.z.buildingaccessibilityservices.TestService if (settingValue != null) { mStringColonSplitter.setString(settingValue); while (mStringColonSplitter.hasNext()) { String accessibilityService = mStringColonSplitter.next(); if (accessibilityService.equalsIgnoreCase(service)) { return true; } } } } else { } return false; } @Override public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) { handleAccessibility(accessibilityEvent); } @Override public void onInterrupt() { } public void handleAccessibility(AccessibilityEvent event) { Log.e(TAG , "handleAccessibility "+event.getPackageName().toString()); if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) { MainService mainService = MainService.getInstance(this); if(mainService != null && mainService.getCurrentDevice() != null) { if(BuildConfig.PRODUCT.equals(Constants.PRODUCT_ACTIVA_T) && (mainService.getCurrentDevice().getDeviceType() == BaseDevice.TYPE_W307S|| mainService.getCurrentDevice().getDeviceType() == BaseDevice.TYPE_W307S_SPACE)) { return; } } NotiManager.getInstance(this).handleNotification(event.getPackageName().toString(), (Notification) event.getParcelableData()); } } @Override protected void onServiceConnected() { super.onServiceConnected(); NotiManager.getInstance(this); isOpen = true; } @Override public boolean onUnbind(Intent intent) { isOpen = false; return super.onUnbind(intent); } @Override public int onStartCommand(Intent intent, int flags, int startId) { return super.onStartCommand(intent, flags, startId); } }
a93b26306e08e2f73856648f1d518b0b835eab24
ca5004b316a642644832e0cd8ef94c29dc4acbc3
/fBReader/src/main/java/org/geometerplus/android/fbreader/tree/TreeAdapter.java
b9a72de3d662e6d235115ca4d92ff8607330e8bc
[]
no_license
dyglcc/FB_reader_androix
eebbc6868be390f2b8fecd80fb71aa8159b3b3ca
74e67bbfe84260401f19cb89b8656edcb18a1b16
refs/heads/master
2023-01-23T16:02:21.770053
2020-12-01T09:29:22
2020-12-01T09:29:22
317,485,361
5
0
null
null
null
null
UTF-8
Java
false
false
2,679
java
/* * Copyright (C) 2010-2015 FBReader.ORG Limited <[email protected]> * * 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., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ package org.geometerplus.android.fbreader.tree; import java.util.*; import android.widget.BaseAdapter; import org.geometerplus.fbreader.tree.FBTree; public abstract class TreeAdapter extends BaseAdapter { private final TreeActivity myActivity; private final List<FBTree> myItems; protected TreeAdapter(TreeActivity activity) { myActivity = activity; myItems = Collections.synchronizedList(new ArrayList<FBTree>()); activity.setListAdapter(this); } protected TreeActivity getActivity() { return myActivity; } public void remove(final FBTree item) { myActivity.runOnUiThread(new Runnable() { public void run() { myItems.remove(item); notifyDataSetChanged(); } }); } public void add(final FBTree item) { myActivity.runOnUiThread(new Runnable() { public void run() { myItems.add(item); notifyDataSetChanged(); } }); } public void add(final int index, final FBTree item) { myActivity.runOnUiThread(new Runnable() { public void run() { myItems.add(index, item); notifyDataSetChanged(); } }); } public void replaceAll(final Collection<FBTree> items, final boolean invalidateViews) { myActivity.runOnUiThread(new Runnable() { public void run() { synchronized (myItems) { myItems.clear(); myItems.addAll(items); } notifyDataSetChanged(); if (invalidateViews) { myActivity.getListView().invalidateViews(); } } }); } public int getCount() { return myItems.size(); } public FBTree getItem(int position) { return myItems.get(position); } public long getItemId(int position) { return position; } public int getIndex(FBTree item) { return myItems.indexOf(item); } public FBTree getFirstSelectedItem() { synchronized (myItems) { for (FBTree t : myItems) { if (myActivity.isTreeSelected(t)) { return t; } } } return null; } }
f793eb02b186050307bf90d3e9642ca37a07c08e
5889ada4e5e57d197091c641368c21bb6d0993d3
/src/model/statement/ReadFile.java
37056732cb811b33229ad449dd38e232b8829928
[]
no_license
danhorea2010/ToyLanguageInterpreterV1
24be55a989586557cc5631e67ae5226af6e9c419
17ea4559f0fdb129b76fcffef0c062414187807d
refs/heads/master
2023-02-22T13:44:28.909262
2021-01-24T12:36:38
2021-01-24T12:36:38
304,684,991
0
0
null
null
null
null
UTF-8
Java
false
false
2,935
java
package model.statement; import exceptions.VariableNotDeclaredException; import exceptions.VariableTypeMismatchException; import model.ProgramState; import model.adt.MyDictionary; import model.expression.Expression; import model.types.IntType; import model.types.StringType; import model.types.Type; import model.values.IntValue; import model.values.StringValue; import model.values.Value; import java.io.BufferedReader; public class ReadFile implements IStatement { private final Expression expression; private final String variableName; public ReadFile(Expression expression, String variableName){ this.expression = expression; this.variableName = variableName; } @Override public String toString() { return "readFile(" + expression + ", " + variableName + ')'; } @Override public ProgramState execute(ProgramState state) throws Exception { var symbolTable = state.getSymbolTable(); Value value = symbolTable.get(variableName); if(value == null){ throw new VariableNotDeclaredException("Variable " + variableName + " not declared\n"); } if( !value.getType().equals(new IntType())){ throw new VariableTypeMismatchException("Variable " + variableName + " must be int\n" ); } Value exprValue = expression.eval(symbolTable, state.getHeapTable()); if(!exprValue.getType().equals(new StringType())){ throw new RuntimeException("Path must be string!\n"); } StringValue stringValue = (StringValue) exprValue; var fileTable = state.getFileTable(); BufferedReader fileReader = fileTable.get(stringValue); if(fileReader == null){ throw new RuntimeException("Cannot open file " + stringValue.getValue()); } int writeValue = 0; String line = fileReader.readLine(); if(line != null){ try { writeValue = Integer.parseInt(line); }catch (NumberFormatException e) { // throw exception? writeValue = 0; } } state.getSymbolTable().put(variableName, new IntValue(writeValue)); return null; } @Override public MyDictionary<String, Type> typeCheck(MyDictionary<String, Type> typeEnvironment) throws Exception { Type type = expression.typeCheck(typeEnvironment); Type varType = typeEnvironment.get(variableName); // Variable must be an integer if(!varType.equals(new IntType())) throw new VariableTypeMismatchException("ReadFile: Variable must be an integer"); // Type must be string if(!type.equals(new StringType())) throw new VariableTypeMismatchException("ReadFile: Parameter must be a string"); return typeEnvironment; } }
d8eb6932eb8074e506ca521d8bc0a1b82f81035a
9c2d1b29b2c07285c2b07b850b25c5e5d3b17089
/src/main/java/alphacore/worldgen/biomes/BiomeCreator.java
493d334d45ac0acb0bc9288908ba407630c4424b
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
AlphaMode/AExploration
c63053688d5e3a8189cca52519a14b4add1b900f
84c21714f17f4899d00ae4d2323b70ef823e7ccf
refs/heads/master
2023-04-29T23:28:47.842293
2021-05-12T23:45:12
2021-05-12T23:45:12
338,212,150
1
1
null
null
null
null
UTF-8
Java
false
false
3,653
java
package alphacore.worldgen.biomes; import alphacore.worldgen.biomes.Features.Features; import net.minecraft.client.sound.MusicType; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnGroup; import net.minecraft.particle.ParticleTypes; import net.minecraft.sound.BiomeAdditionsSound; import net.minecraft.sound.BiomeMoodSound; import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.MathHelper; import net.minecraft.world.biome.*; import net.minecraft.world.gen.GenerationStep; import net.minecraft.world.gen.carver.ConfiguredCarvers; import net.minecraft.world.gen.feature.ConfiguredFeatures; import net.minecraft.world.gen.feature.ConfiguredStructureFeatures; import net.minecraft.world.gen.feature.DefaultBiomeFeatures; public class BiomeCreator { private static int getSkyColor(float temperature) { float f = temperature / 3.0F; f = MathHelper.clamp(f, -1.0F, 1.0F); return MathHelper.hsvToRgb(0.62222224F - f * 0.05F, 0.5F + f * 0.1F, 1.0F); } public static Biome createRadioactiveForest() { SpawnSettings spawnSettings = (new SpawnSettings.Builder()).spawn(SpawnGroup.MONSTER, new SpawnSettings.SpawnEntry(EntityType.ZOMBIFIED_PIGLIN, 1, 2, 4)).spawn(SpawnGroup.MONSTER, new SpawnSettings.SpawnEntry(EntityType.HOGLIN, 9, 3, 4)).spawn(SpawnGroup.MONSTER, new SpawnSettings.SpawnEntry(EntityType.PIGLIN, 5, 3, 4)).spawn(SpawnGroup.CREATURE, new SpawnSettings.SpawnEntry(EntityType.STRIDER, 60, 1, 2)).build(); GenerationSettings.Builder builder = (new GenerationSettings.Builder()).surfaceBuilder(NetherSurfaceBuilder.RADIOACTIVE_NYLIUM_BUILDER).structureFeature(ConfiguredStructureFeatures.RUINED_PORTAL_NETHER).carver(GenerationStep.Carver.AIR, ConfiguredCarvers.NETHER_CAVE).structureFeature(ConfiguredStructureFeatures.FORTRESS).structureFeature(ConfiguredStructureFeatures.BASTION_REMNANT).feature(GenerationStep.Feature.VEGETAL_DECORATION, ConfiguredFeatures.SPRING_LAVA); DefaultBiomeFeatures.addDefaultMushrooms(builder); builder.feature(GenerationStep.Feature.UNDERGROUND_DECORATION, ConfiguredFeatures.SPRING_OPEN).feature(GenerationStep.Feature.UNDERGROUND_DECORATION, ConfiguredFeatures.PATCH_FIRE).feature(GenerationStep.Feature.UNDERGROUND_DECORATION, ConfiguredFeatures.GLOWSTONE_EXTRA).feature(GenerationStep.Feature.UNDERGROUND_DECORATION, ConfiguredFeatures.GLOWSTONE).feature(GenerationStep.Feature.UNDERGROUND_DECORATION, ConfiguredFeatures.ORE_MAGMA).feature(GenerationStep.Feature.UNDERGROUND_DECORATION, ConfiguredFeatures.SPRING_CLOSED).feature(GenerationStep.Feature.VEGETAL_DECORATION, ConfiguredFeatures.WEEPING_VINES).feature(GenerationStep.Feature.VEGETAL_DECORATION, Features.RADIOACTIVE_FUNGI).feature(GenerationStep.Feature.VEGETAL_DECORATION, Features.RADIOACTIVE_FOREST_VEGETATION); DefaultBiomeFeatures.addNetherMineables(builder); return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.NETHER).depth(0.1F).scale(0.2F).temperature(2.0F).downfall(0.0F).effects((new BiomeEffects.Builder()).waterColor(4159204).waterFogColor(329011).fogColor(3343107).skyColor(getSkyColor(2.0F)).particleConfig(new BiomeParticleConfig(ParticleTypes.WARPED_SPORE, 0.025F)).loopSound(SoundEvents.AMBIENT_CRIMSON_FOREST_LOOP).moodSound(new BiomeMoodSound(SoundEvents.AMBIENT_CRIMSON_FOREST_MOOD, 6000, 8, 2.0D)).additionsSound(new BiomeAdditionsSound(SoundEvents.AMBIENT_CRIMSON_FOREST_ADDITIONS, 0.0111D)).music(MusicType.createIngameMusic(SoundEvents.MUSIC_NETHER_WARPED_FOREST)).build()).spawnSettings(spawnSettings).generationSettings(builder.build()).build(); } }
c82d4cd968d3b6d4652b7bb97e5edd7a6d7f7be1
97de6b7610217d4cf5fd530ba7341fc5d7b808ce
/HibernateExample/src/mthibernate/StoreData.java
edbe57f28aa46b0cdc6139d24532a36ccdc62a3a
[]
no_license
kiransai48/GitJavaWork
6885cacd53642d4fcab3bb116b755e13211a082b
12a6d428d31dfee05ecba63dea2a100fef357930
refs/heads/master
2022-12-21T19:39:51.017108
2020-02-05T08:47:19
2020-02-05T08:47:19
219,463,076
0
0
null
2022-12-15T23:28:14
2019-11-04T09:25:44
Java
UTF-8
Java
false
false
1,166
java
package mthibernate; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.boot.Metadata; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; public class StoreData { public static void main( String[] args ) { StandardServiceRegistry ssr = new StandardServiceRegistryBuilder().configure("hibernate.cfg.xml").build(); Metadata meta = new MetadataSources(ssr).getMetadataBuilder().build(); SessionFactory factory = meta.getSessionFactoryBuilder().build(); Session session = factory.openSession(); Transaction t = session.beginTransaction(); Employee e1=new Employee(); e1.setId(2); e1.setFirstName("sai"); e1.setLastName("kiran"); session.save(e1); t.commit(); System.out.println("successfully saved"); factory.close(); session.close(); } }
70af599c876a7dec96583c247993d85022d5cda2
17f3cc798db02eb809e0563858572076353f7993
/Letra_B.java
8a51f8a5e2bcf42868e2f21255f2d793322e97f3
[]
no_license
ThiagoBonette/Atividade_05
2755c64de938fa60ec9aeffb91935e8d8bb99c2d
9904d5040a210a380bbeb990df12b78f45f04257
refs/heads/master
2023-01-01T00:21:01.124458
2020-10-26T13:06:13
2020-10-26T13:06:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
453
java
package atividade_05_hamilton; import javax.swing.JOptionPane; public class Letra_B { public static void main(String[] args) { int [] valores = new int [10]; for(int i = 0; i < valores.length; i++){ valores[i] = Integer.parseInt(JOptionPane.showInputDialog("Digite um numero: ")); } for(int i = valores.length-1; i >= 0; i--){ System.out.println(valores[i]); } } }
2239d3e4135e4b46dfed2bb40e7b063f2a187d50
eb71e782cebec26969623bb5c3638d6f62516290
/src/com/rs/game/npc/combat/impl/ThornySnailCombat.java
c06d1e33bee5d57969d8a7fe768a2c49752febff
[]
no_license
DukeCharles/revision-718-server
0fe7230a4c7da8de6f7de289ef1b4baec81fbd8b
cc69a0ab6e139d5cc7e2db9a73ec1eeaf76fd6e3
refs/heads/main
2023-06-25T05:50:04.376413
2021-07-25T19:38:35
2021-07-25T19:38:35
387,924,360
0
0
null
null
null
null
UTF-8
Java
false
false
1,191
java
package com.rs.game.npc.combat.impl; import com.rs.game.Animation; import com.rs.game.Entity; import com.rs.game.Graphics; import com.rs.game.World; import com.rs.game.npc.NPC; import com.rs.game.npc.combat.CombatScript; import com.rs.game.npc.combat.NPCCombatDefinitions; import com.rs.game.npc.familiar.Familiar; public class ThornySnailCombat extends CombatScript { @Override public Object[] getKeys() { return new Object[] { 6807, 6806 }; } @Override public int attack(NPC npc, Entity target) { final NPCCombatDefinitions defs = npc.getCombatDefinitions(); Familiar familiar = (Familiar) npc; boolean usingSpecial = familiar.hasSpecialOn(); if (usingSpecial) {// priority over regular attack npc.animate(new Animation(8148)); npc.gfx(new Graphics(1385)); World.sendProjectile(npc, target, 1386, 34, 16, 30, 35, 16, 0); delayHit(npc, 1, target, getRangeHit(npc, getRandomMaxHit(npc, 80, NPCCombatDefinitions.RANGE, target))); npc.gfx(new Graphics(1387)); } else { npc.animate(new Animation(8143)); delayHit(npc, 1, target, getRangeHit(npc, getRandomMaxHit(npc, 40, NPCCombatDefinitions.RANGE, target))); } return defs.getAttackDelay(); } }
6daccbf2c46e305add8326c49d9f0d802d6bd5d4
ecf41a04c43ba48c59ff8c97c27f4eb8f19fd698
/test/qtree/CopyOfTestBGPJoinOnIndex.java
2f37a78e95ef1d42e03a083ab4f692aa22b0a1ec
[]
no_license
jumbrich/semqtree
953d9ef97a2548a7605d0f03ea3bcf3988b097d4
3ff0c71e61849ae58b6769de91d0d625e6f98829
refs/heads/master
2021-01-10T09:29:36.112128
2012-12-03T10:46:21
2012-12-03T10:46:21
36,661,383
1
0
null
null
null
null
UTF-8
Java
false
false
20,941
java
package qtree; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.net.URLDecoder; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.NavigableSet; import java.util.Set; import java.util.StringTokenizer; import java.util.TreeMap; import java.util.Vector; import junit.framework.TestCase; import org.semanticweb.hashing.CheatingSimpleHashing; import org.semanticweb.hashing.QTreeHashing; import org.semanticweb.hashing.SimpleHashing; import org.semanticweb.hashing.us.MarioHashing; import org.semanticweb.hashing.us.PrefixTreeHashing; import org.semanticweb.indexer.IndexerManager; import org.semanticweb.indexer.InsertCallback; import org.semanticweb.indexer.OnDiskQTreeIndexerFactory; import org.semanticweb.indexer.Queue; import org.semanticweb.lodq.BGPMatcher; import org.semanticweb.yars.nx.Node; import org.semanticweb.yars.nx.Nodes; import org.semanticweb.yars.nx.parser.ParseException; import org.semanticweb.yars2.index.disk.QuadStringScanIterator; import org.semanticweb.yars2.index.disk.block.NodeBlockInputStream; import org.semanticweb.yars2.rdfxml.RDFXMLParser; import com.sleepycat.collections.MapEntryParameter; import de.ilmenau.qtree.index.Bucket; import de.ilmenau.qtree.index.IntersectionInformation; import de.ilmenau.qtree.index.OnDiskOne4AllQTreeIndex; import de.ilmenau.qtree.index.QueryResultEstimation; import de.ilmenau.qtree.index.QuerySpace; import de.ilmenau.qtree.index.qtree.QTree; import de.ilmenau.qtree.index.qtree.QTreeBucket; import de.ilmenau.qtree.index.update.UpdateBucket; import de.ilmenau.qtree.util.bigmath.Space; public class CopyOfTestBGPJoinOnIndex extends TestCase { public static String DATA_DIR = "input/linked-data/"; private int DEBUG = 1; int dimMin = 0; int dimMax = 10000; // upper limit...!! boolean storeDetailedCounts = true; boolean advancedRanking = false; public void testBGP() throws Exception { long time = System.currentTimeMillis(); // System.setProperty("file.encoding","utf-8"); // System.err.println(System.getProperty("file.encoding")); File dir = new File(DATA_DIR); String[] sources = dir.list(); // QueryResultEstimation result = index.evaluateQuery(q, join, true, false); QueryResultEstimation result = index.evaluateQuery2(q, join, false, false); try{ // do the actual BGP processing Map<Node[],String> current = evaluateBgp(sources, q[0]); System.out.println("Qtree says: "+result.getBgpEstSources()[0]+" relevant sources"); File outputDir = new File("output"); File inputIDX = new File("input/spoc.idx"); OnDiskOne4AllQTreeIndex index = new OnDiskOne4AllQTreeIndex(hasher,1500,20,new int[]{dimMin,dimMin,dimMin}, new int[] {dimMax,dimMax,dimMax},storeDetailedCounts); buildOrLoad(outputDir, index, inputIDX); // String dataDir = "input/linked-data/"; // Queue queue = new Queue(new File(dataDir)); // IndexerManager manager = new IndexerManager(index, 1, queue, new OnDiskQTreeIndexerFactory()); // manager.runIndexer(); System.out.println("QTree: "+index.getQTree().getAllBuckets().size()+" buckets"); // System.out.println(index.getQTree().getStateString()); // System.exit(1); // index.getQTree().printme(); <<<<<<< .mine for (int i = 0; i < SampleQueries.QUERIES.length; i++) { Node[][] q = SampleQueries.QUERIES[i]; int[][] join = SampleQueries.QJ[i]; // for (int i = 0; i < SampleQueries.QUERIESSLOW.length; i++) { // Node[][] q = SampleQueries.QUERIESSLOW[i]; // int[][] join = SampleQueries.QJS[i]; QueryResultEstimation result = index.evaluateQuery(q, join, true, false); File f = new File("q-"+i+".ser"); FileOutputStream fos; try { fos = new FileOutputStream(f); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(result); oos.close(); fos.close(); } catch (Exception e) { e.printStackTrace(); } try{ // do the actual BGP processing Map<Node[],String> current = evaluateBgp(sources, q[0]); System.out.println("Qtree says: "+result.getBgpEstSources()[0]+" relevant sources"); for (int j = 1; j < q.length; j++) { // do the actual BGP processing Map<Node[],String> gpresults = evaluateBgp(sources, q[j]); System.out.println("Qtree says: "+result.getBgpEstSources()[j]+" relevant sources"); System.out.println("joining "+current.size()+" triples with "+gpresults.size()); current = computeJoin(current, join[j-1][0], gpresults, join[j-1][1]); System.out.println("result: "+current.size()+" triples"); ======= if (0 == current.size()) System.out.println("Empty join result."); Set<String> resSources = new HashSet<String>(); for (Map.Entry<Node[],String> nx : current.entrySet()) { // for (Node n : nx.getKey()) System.out.print(n.toN3()+" "); // System.out.println(); resSources.add(nx.getValue()); } Set<String> allResSources = new HashSet<String>(); for (String s : resSources) { StringTokenizer tok = new StringTokenizer(s,"|"); while (tok.hasMoreTokens()) allResSources.add(URLDecoder.decode(tok.nextToken(), "utf-8")); } System.out.println("Actual "+allResSources.size()+" relevant sources:"); // System.out.println("Actual "+resSources.size()+" relevant sources:"); // for (String s : resSources) { // System.out.println(s); //// System.out.println(s+" -- "+(currRelevantSources.containsKey(URLDecoder.decode(s, "utf-8"))? "ok" : "missing!")); // } ArrayList<String> rankOrderedSources = advancedRanking? result.getRelevantSourcesRankedAdvanced() : result.getRelevantSourcesRanked(); // System.out.println(rankOrderedSources); // the k values for evaluating top-k int[] topK = new int[]{10,50,100}; // to store the percentages of each top-k result set double[] topKPerc = new double[topK.length]; // handle each of the k values for (int k=0; k<topK.length; ++k) { // topKPerc[k] = computeTopKPercentage(ranked, topK[k], current); topKPerc[k] = computeTopKPercentage(rankOrderedSources, topK[k], current); } // compare the QTree ranks with the actual ranks Vector<Integer> positions = new Vector<Integer>(); double avgErr = 0.0; // avgErr = getRankError(ranked, current, positions); avgErr = getRankError(rankOrderedSources, current, positions); // check at which k we will achieve 100% of the result (i.e., contain all contributing sources) // int maxK = getMaxK(ranked, allResSources, positions); // int maxK = advancedRanking? positions.lastElement() : positions.firstElement(); int maxK = positions.lastElement(); System.out.println("all actually relevant sources in QTree's top-"+maxK+" (avg error: "+avgErr+", positions: "+positions+")"); for (int k=0; k<topK.length; ++k) { System.out.println("\ttop-"+topK[k]+" contains: "+topKPerc[k]+" of result"); } System.out.println("times:"); System.out.print("\tBGPs: "); for (long t : result.getBgpEvalTimes()) System.out.print(t+" "); System.out.println(); System.out.print("\tjoins: "); for (long t : result.getJoinEvalTimes()) System.out.print(t+" "); System.out.println(); System.out.println("\tranking: "+(advancedRanking? result.getAdvancedRankTime(): result.getRankTime())); }catch(Exception e){ e.printStackTrace(); } System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); >>>>>>> .r2359 } System.out.println("relevant "+result.getRelevantSourcesRanked().size()+" sources according to QTree:"); // for (String s : relevantSources) { // System.out.println(s); // } if (0 == current.size()) System.out.println("Empty join result."); Set<String> resSources = new HashSet<String>(); for (Map.Entry<Node[],String> nx : current.entrySet()) { // for (Node n : nx.getKey()) System.out.print(n.toN3()+" "); // System.out.println(); resSources.add(nx.getValue()); } Set<String> allResSources = new HashSet<String>(); for (String s : resSources) { StringTokenizer tok = new StringTokenizer(s,"|"); while (tok.hasMoreTokens()) allResSources.add(URLDecoder.decode(tok.nextToken(), "utf-8")); } System.out.println("Actual "+allResSources.size()+" relevant sources:"); // System.out.println("Actual "+resSources.size()+" relevant sources:"); // for (String s : resSources) { // System.out.println(s); //// System.out.println(s+" -- "+(currRelevantSources.containsKey(URLDecoder.decode(s, "utf-8"))? "ok" : "missing!")); // } ArrayList<String> rankOrderedSources = advancedRanking? result.getRelevantSourcesRankedAdvanced() : result.getRelevantSourcesRanked(); // the k values for evaluating top-k int[] topK = new int[]{10,50,100}; // to store the percentages of each top-k result set double[] topKPerc = new double[topK.length]; // handle each of the k values for (int k=0; k<topK.length; ++k) { // topKPerc[k] = computeTopKPercentage(ranked, topK[k], current); topKPerc[k] = computeTopKPercentage(rankOrderedSources, topK[k], current); } // compare the QTree ranks with the actual ranks Vector<Integer> positions = new Vector<Integer>(); double avgErr = 0.0; // avgErr = getRankError(ranked, current, positions); avgErr = getRankError(rankOrderedSources, current, positions); // check at which k we will achieve 100% of the result (i.e., contain all contributing sources) // int maxK = getMaxK(ranked, allResSources, positions); // int maxK = advancedRanking? positions.lastElement() : positions.firstElement(); int maxK = positions.lastElement(); System.out.println("all actually relevant sources in QTree's top-"+maxK+" (avg error: "+avgErr+", positions: "+positions+")"); for (int k=0; k<topK.length; ++k) { System.out.println("\ttop-"+topK[k]+" contains: "+topKPerc[k]+" of result"); } System.out.println("times:"); System.out.print("\tBGPs: "); for (long t : result.getBgpEvalTimes()) System.out.print(t+" "); System.out.println(); System.out.print("\tjoins: "); for (long t : result.getJoinEvalTimes()) System.out.print(t+" "); System.out.println(); System.out.println("\tranking: "+(advancedRanking? result.getAdvancedRankTime(): result.getRankTime())); }catch(Exception e){ e.printStackTrace(); } System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); } } private Double computeTopKPercentage(TreeMap<Double,String> ranked, int k, Map<Node[],String> resTriples) throws Exception { // this would speed up the calculation - currently, we can also check if the whole set really contains all actually relevant sources // if (topK[k]<=ranked.size()) topKPerc[k] = 1.0; // determine the top-kth key double fromKey = ranked.firstKey(); // if not, the top-kth key is the lowest (i.e., the first) in the ranked set if (k<=ranked.size()) { NavigableSet<Double> keys = ranked.descendingKeySet(); // for (int z=0; z<topK[k]-1; ++z) keys.pollFirst(); // fromKey = keys.pollFirst(); // iterate over all keys descending from the end of the set Iterator<Double> it = keys.iterator(); // skip the k-1 top keys for (int z=0; z<k-1; ++z) it.next(); // that's the top-kth key now fromKey = it.next(); } // System.out.println("tail-"+topK[k]+": "+ranked.tailMap(fromKey).size()+": "+ranked.tailMap(fromKey)); int resTriple = 0; // iterate over all result triples for (Map.Entry<Node[],String> nx : resTriples.entrySet()) { // extract the single sources contributing to the result triple StringTokenizer tok = new StringTokenizer(nx.getValue(),"|"); boolean allSourcesIncl = true; // check if all contributing sources are in the top-k sources set while (tok.hasMoreTokens() && allSourcesIncl) { if (!ranked.tailMap(fromKey).values().contains(URLDecoder.decode(tok.nextToken(), "utf-8"))) allSourcesIncl = false; } // are all contributing sources included in the top-k sources set? if (allSourcesIncl) ++resTriple; } // determine the actual percentage we could get when only using the top-k sources return (double)resTriple/(double)resTriples.size(); } private Double computeTopKPercentage(ArrayList<String> ranked, int k, Map<Node[],String> resTriples) throws Exception { // this would speed up the calculation - currently, we can also check if the whole set really contains all actually relevant sources // if (topK[k]<=ranked.size()) topKPerc[k] = 1.0; int resTriple = 0; // iterate over all result triples for (Map.Entry<Node[],String> nx : resTriples.entrySet()) { // extract the single sources contributing to the result triple StringTokenizer tok = new StringTokenizer(nx.getValue(),"|"); boolean allSourcesIncl = true; // check if all contributing sources are in the top-k sources set while (tok.hasMoreTokens() && allSourcesIncl) { String srcToken =tok.nextToken(); int pos = ranked.indexOf((URLDecoder.decode(srcToken, "utf-8"))); // if(-1 != pos && k > pos) // System.err.println("SRC:"+URLDecoder.decode(srcToken, "utf-8")+ " is in top-"+k+" rank: "+pos); if (-1 == pos || k <= pos) allSourcesIncl = false; } // are all contributing sources included in the top-k sources set? if (allSourcesIncl) ++resTriple; } System.out.println("I have resTriples "+resTriple+" out of "+resTriples.size()+" for top-k "+k); System.out.println((double)resTriple/(double)resTriples.size());// determine the actual percentage we could get when only using the top-k sources // determine the actual percentage we could get when only using the top-k sources return (double)resTriple/(double)resTriples.size(); } private Map<String,Integer> getSourceRanks(Map<Node[],String> resultTriples) throws Exception { Map<String,Double> ranks = new HashMap<String,Double>(); int tokCnt = 0; for (Map.Entry<Node[],String> nx : resultTriples.entrySet()) { StringTokenizer tok = new StringTokenizer(nx.getValue(),"|"); while (tok.hasMoreTokens()) { // we only have to count once if (0 == tokCnt) ++tokCnt; String source = URLDecoder.decode(tok.nextToken(), "utf-8"); Double cnt = ranks.get(source); if (null == cnt) cnt = 0.0; cnt += 1.0; ranks.put(source,cnt); } } TreeMap<Double,String> ranked = new TreeMap<Double, String>(); for (Map.Entry<String,Double> sources : ranks.entrySet()) { String sourceName = sources.getKey(); double cnt = sources.getValue(); // this is one approach: 30 result triples, 3 sources -> assign 10 to each source... // cnt /= (double)tokCnt; // ...actually, the cummulated one works better: 30 result triples, 3 sources -> assign 30 to each source (i.e., sum(assignment)=#restriples*#joinlevel) while (ranked.containsKey(cnt)) cnt += 0.000001; ranked.put(cnt,sourceName); } Map<String,Integer> sourceRanks = new HashMap<String,Integer>(); int cnt = 0; for (String s : ranked.values()) { sourceRanks.put(s,ranked.size()-cnt); ++cnt; } // System.out.println(ranked); return sourceRanks; } private double getRankError(TreeMap<Double,String> ranked, Map<Node[],String> resTriples, Vector<Integer> positions) throws Exception { Map<String,Integer> actRanks = getSourceRanks(resTriples); double avgErr = 0.0; int cnt = 0; int notFound = 0; System.out.print("rank errors: "); for (String s : ranked.values()) { if (advancedRanking) s = s.substring(s.indexOf('|')+1); if (actRanks.containsKey(s)) { int qtreeRank = ranked.size()-cnt; positions.add(qtreeRank); // System.out.println("QTree rank="+qtreeRank+"; actual rank="+actRanks.get(s)+"; error="+Math.abs(qtreeRank-actRanks.get(s))); System.out.print("|"+qtreeRank+"-"+actRanks.get(s)+"|; "); avgErr += Math.abs(qtreeRank-actRanks.get(s)); } else ++notFound; ++cnt; } System.out.println(); // average over only the actually contained sources avgErr /= (double)(ranked.size()-notFound); return avgErr; } private double getRankError(ArrayList<String> ranked, Map<Node[],String> resTriples, Vector<Integer> positions) throws Exception { Map<String,Integer> actRanks = getSourceRanks(resTriples); double avgErr = 0.0; int cnt = 0; int notFound = 0; System.out.print("rank errors: "); for (String s : ranked) { if (actRanks.containsKey(s)) { int qtreeRank = cnt+1; positions.add(qtreeRank); // System.out.println("QTree rank="+qtreeRank+"; actual rank="+actRanks.get(s)+"; error="+Math.abs(qtreeRank-actRanks.get(s))); System.out.print("|"+qtreeRank+"-"+actRanks.get(s)+"|; "); avgErr += Math.abs(qtreeRank-actRanks.get(s)); } else ++notFound; ++cnt; } System.out.println(); // average over only the actually contained sources avgErr /= (double)(ranked.size()-notFound); return avgErr; } public Map<Node[],String> computeJoin(Map<Node[],String> l, int lpos, Map<Node[],String> r, int rpos) { Map<Node[],String> result = new HashMap<Node[],String>(); for (Map.Entry<Node[],String> lnx : l.entrySet()) { Node ljc = lnx.getKey()[lpos]; for (Map.Entry<Node[],String> rnx : r.entrySet()) { Node rjc = rnx.getKey()[rpos]; if (ljc.equals(rjc)) { Node[] comb = new Node[lnx.getKey().length+rnx.getKey().length]; System.arraycopy(lnx.getKey(), 0, comb, 0, lnx.getKey().length); System.arraycopy(rnx.getKey(), 0, comb, lnx.getKey().length, rnx.getKey().length); // result.put(comb,"l:"+lnx.getValue()+"|r:"+rnx.getValue()); result.put(comb,lnx.getValue()+"|"+rnx.getValue()); } } } return result; } public Map<Node[],String> evaluateBgp(String[] sources, Node[] bgp) throws FileNotFoundException, ParseException, IOException { BGPMatcher m = new BGPMatcher(bgp); System.out.println("Query for " + Nodes.toN3(bgp)); Map<Node[],String> results = new HashMap<Node[],String>(); int triplesCount = 0; for (String s : sources) { String baseurl = URLDecoder.decode(s, "utf-8"); File f = new File(DATA_DIR + s); if (f.isFile()) { RDFXMLParser r = new RDFXMLParser(new FileInputStream(DATA_DIR + s), baseurl); while (r.hasNext()) { Node[] nx = r.next(); triplesCount++; if (m.match(nx)) { results.put(nx,s); // System.out.println(s+": "+Nodes.toN3(nx)); } } } } System.err.println("{TTT] parsed "+triplesCount+" triples"); return results; } private void buildOrLoad(File outputDir, OnDiskOne4AllQTreeIndex index, File inputIDX) throws IOException { outputDir.mkdirs(); File qtreeFile = new File(outputDir,index.getFileName()); if(qtreeFile.exists()){ System.err.println("[DEBUG] Found serialised version of a qtree in the output dir "+outputDir); index.loadQTreeIndex(outputDir); System.out.println(index.getLabel()); System.out.println(index.getQTree().getRoot().getCount()); System.err.println(" <---------------->\n"); // System.err.println(" stmts: "+insertCnt); System.err.println(" srcs: "+index.getNmbOfSources()); System.err.println(" index: ["+index.getLabel()+" pts: "+index.getQTree().getRoot().getCount()+" src: "+index.getNmbOfSources()+" ]"); System.out.println(" Buckets: "+index.getQTree().getAllBuckets().size()); System.out.println(" Dimension: "+index.getQTree().getNmbOfDimensions()); System.out.println(" IndexStatments: "+index.getQTree().getNmbOfIndexedItems()); // System.err.println(" insert/ms, "+(((double) insertCnt/(double)(end-time)))); } else{ System.err.println("[DEBUG] Could not found serialised version of a qtree in the output dir "+outputDir); System.err.println("[DEBUG] Building new QTree from statements in "+ inputIDX); InsertCallback c = new InsertCallback(index); NodeBlockInputStream nbis = new NodeBlockInputStream(inputIDX.getAbsolutePath()); QuadStringScanIterator iter = new QuadStringScanIterator(nbis); int count=0; while(iter.hasNext()){ //System.out.print("."); c.processStatement(iter.next()); count++; if(count%10000==0) System.err.println("DEBUG inserted "+count+" stmts"); } System.out.println("inserted "+c.insertedStatments()+" stmts"); System.err.println("[DEBUG] Serialising QTree from statements to "+ outputDir); System.out.println("Buckets: "+index.getQTree().getAllBuckets().size()); System.out.println("Dimension: "+index.getQTree().getNmbOfDimensions()); System.out.println("IndexStatments: "+index.getQTree().getNmbOfIndexedItems()); index.serialiseQTree(outputDir); } } }
61469c1fcbdb7d8dc3de0bc7c13819f0b0d2cb95
471ca47466c6defc6519abfc2c073a570dd1a05f
/src/main/java/net/xtgr/dtex/expr/Upload.java
f1d729527bfd657b43c0b53c9296b51f6d02c557
[]
no_license
netxtgr/dtex
ff8f3a475653f825ca1541d5d17d0f914faeab13
84af75213bc15533fe58ae5f623ea33849588b13
refs/heads/master
2021-07-07T11:58:54.639971
2020-09-30T04:15:32
2020-09-30T04:15:32
192,275,806
0
0
null
null
null
null
UTF-8
Java
false
false
4,487
java
/** * */ package net.xtgr.dtex.expr; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.net.SocketException; import java.nio.file.FileVisitResult; import java.nio.file.FileVisitor; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPConnectionClosedException; import org.apache.commons.net.io.CopyStreamException; import net.xtgr.dtex.expr.prof.Profile; import net.xtgr.dtex.expr.tk.Filter; /** * * @author Tiger * */ public abstract class Upload extends Transmit<Path> { protected Upload(Profile.Conf conf) throws IOException { super(conf); if (Files.notExists(Paths.get(conf.getSource()))) { Files.createDirectories(Paths.get(conf.getSource())); } } @Override public boolean upload(String local, String remote) throws SocketException, FTPConnectionClosedException, CopyStreamException, IOException { if (!fileExist(local)) { lggr.warn("'{}' isn't exist.", local); return false; } try (InputStream is = Files.newInputStream(Paths.get(local));) { client.sendCommand("OPTS UTF8", "ON"); client.setFileType(FTPClient.BINARY_FILE_TYPE); return client.storeFile(remote, is); } } @Override public boolean download(String remote, String local) throws SocketException, FTPConnectionClosedException, CopyStreamException, IOException { throw new UnsupportedOperationException("Don't support downloading."); } @Override public boolean delete(String local) throws IOException { if (!fileExist(local)) { lggr.warn("'{}' isn't exist.", local); return false; } Files.delete(Paths.get(local)); return true; } @Override public boolean rename(String from, String to) throws SocketException, IOException { if (!fileExist(from)) { lggr.warn("'{}' isn't exist.", from); return false; } Files.move(Paths.get(from), Paths.get(to)); return true; } @Override public String[] read(String local) throws SocketException, IOException { if (!fileExist(local)) throw new IOException(local + " dose not exist."); try (BufferedReader br = Files.newBufferedReader(Paths.get(local))) { ArrayList<String> tmps = new ArrayList<>(); String line; while ((line = br.readLine()) != null) tmps.add(line); return tmps.toArray(new String[tmps.size()]); } } @Override public Path[] list(String file, Filter<Path> filter) throws java.io.IOException { if (Files.notExists(Paths.get(file))) { lggr.warn("'{}' isn't exist.", file); return new Path[0]; } java.util.List<Path> result = new java.util.ArrayList<>(); Files.walkFileTree(Paths.get(file), new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { if (!Files.isSameFile(dir, Paths.get(source)) && Files.isDirectory(dir)) return FileVisitResult.SKIP_SUBTREE; return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { if (filter.accept(file)) result.add(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { throw exc; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { return FileVisitResult.CONTINUE; } }); return result.toArray(new Path[result.size()]); } @Override public boolean dirExist(String local) throws IOException { return localDirExist(local); } @Override public boolean fileExist(String local) throws IOException { return localFileExist(local); } }
19e9ff17b73c4c6c4a93189ba355436c571a371c
7f9d562dcc745719c6829944365cfc1118f54bc5
/src/main/java/com/x/shop/template/directive/ArticleCategoryParentListDirective.java
96bcf760e5d697a5e41c3e6159f9f0342ecac1d5
[]
no_license
wd1900/shop
bebec00b95286f269b8fad01151f7f9c91d26fd5
663c7e327147ec1d35aac200abd21f4deb54264f
refs/heads/master
2022-11-25T06:01:55.445633
2020-08-01T06:28:49
2020-08-01T06:28:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,259
java
package com.x.shop.template.directive; import com.x.shop.entity.ArticleCategory; import com.x.shop.service.ArticleCategoryService; import com.x.shop.util.FreemarkerUtils; import freemarker.core.Environment; import freemarker.template.TemplateDirectiveBody; import freemarker.template.TemplateException; import freemarker.template.TemplateModel; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * 模板指令 - 上级文章分类列表 * * @author progr1mmer * @date Created on 2020/2/13 */ @Component("articleCategoryParentListDirective") public class ArticleCategoryParentListDirective extends BaseDirective { /** * "文章分类ID"参数名称 */ private static final String ARTICLE_CATEGORY_ID_PARAMETER_NAME = "articleCategoryId"; /** * 变量名称 */ private static final String VARIABLE_NAME = "articleCategories"; @Resource(name = "articleCategoryServiceImpl") private ArticleCategoryService articleCategoryService; @Override @SuppressWarnings({"unchecked", "rawtypes"}) public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { Long articleCategoryId = FreemarkerUtils.getParameter(ARTICLE_CATEGORY_ID_PARAMETER_NAME, Long.class, params); ArticleCategory articleCategory = articleCategoryService.find(articleCategoryId); List<ArticleCategory> articleCategories; if (articleCategoryId != null && articleCategory == null) { articleCategories = new ArrayList<ArticleCategory>(); } else { boolean useCache = useCache(env, params); String cacheRegion = getCacheRegion(env, params); Integer count = getCount(params); if (useCache) { articleCategories = articleCategoryService.findParents(articleCategory, count, cacheRegion); } else { articleCategories = articleCategoryService.findParents(articleCategory, count); } } setLocalVariable(VARIABLE_NAME, articleCategories, env, body); } }
0c53a1981024ef457edc8688a748e854e7c42647
b7693e7a6ba1c217c17b257f56367a6c826193f2
/plugins/org.ifc4emf.metamodel.ifc/src/IFC2X3/IfcActorSelect.java
c7459e182e1422c692fa043d2afd934c8534df6b
[]
no_license
patins1/ifc4emf
6941967114f87965ea124c36b95aaedc5ef01349
ad65df3fce500e5691625d4e0906041c8c0db284
refs/heads/master
2021-01-19T10:40:16.758125
2017-09-11T02:25:57
2017-09-11T02:25:57
87,891,492
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
/** * <copyright> * </copyright> * * $Id$ */ package IFC2X3; import org.eclipse.emf.cdo.CDOObject; import org.eclipse.emf.ecore.EObject; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Ifc Actor Select</b></em>'. * <!-- end-user-doc --> * * * @see IFC2X3.IFC2X3Package#getIfcActorSelect() * @model abstract="true" * @extends CDOObject * @generated */ public interface IfcActorSelect extends CDOObject { } // IfcActorSelect
[ "patins@4fe55a55-8cb9-4820-ac24-0eeacf389520" ]
patins@4fe55a55-8cb9-4820-ac24-0eeacf389520
6c1a09c999cdb49d0a1aef240be2eaf4d630644c
f662872e4f33339a1aad1ed1daddba64c9362a5a
/src/ReadIn.java
367e78865a42199b4f8541939ba8f261d1da5602
[]
no_license
kacper97/FamilyTree
e9fffdbfdcfe49f69ab03c1726d42ebc8bfc3738
a5b564138a444c636f2be0a9242f257704748d91
refs/heads/master
2021-07-07T10:06:29.888473
2017-09-28T23:15:52
2017-09-28T23:15:52
105,208,039
0
0
null
null
null
null
UTF-8
Java
false
false
1,097
java
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class ReadIn { public static void readFile() throws IOException { BufferedReader br = new BufferedReader(new FileReader("large-database.txt")); // reads in file try { // builds a string StringBuilder sb = new StringBuilder(); String line = br.readLine(); while (line != null) { // while line is not null sb.append(line); // append line sb.append(System.lineSeparator()); // and separate line line = br.readLine(); // read line } } finally { br.close(); } } // MAIN METHOD TO SEE IF THE STRING READ IN public static void main(String[] args){ BufferedReader br = null; try { // Trying to read from rules.txt br = new BufferedReader(new FileReader("large-database.txt")); String line = br.readLine(); while (line != null){ System.out.print(line); line = br.readLine(); } } catch(IOException e){ // if the file is not found an exception is thrown e.printStackTrace(); } } }
89adad3563f3c5f643e0d7a8cec0d71fdca188b1
50590b8ddca61569c937bd8670047b15d361b32b
/DI_0318_60132299/src/main/java/CMain.java
f8745a2acee86b3afbc2d2b6aba5869e821a0528
[]
no_license
Do-Lee/SE2015_60132299
0e8227851e7b69c484f6f76c5bfa101ccfe09802
3f1624ffbfbc8a43e9c7de95f6ca201dee2b5a30
refs/heads/master
2016-09-06T03:15:25.809611
2015-06-14T11:26:14
2015-06-14T11:26:14
33,102,647
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class CMain { public static void main(String[] args) { ApplicationContext factory = new ClassPathXmlApplicationContext(new String[]{"applicationContext.xml"}); Professor professor = (Professor)factory.getBean("professor"); //아이디를 파라메터로 주면 객체생성 Lecture lecture = (Lecture)factory.getBean("lecture"); Student student = (Student)factory.getBean("student"); professor.addLecture(lecture); lecture.addStudents(student); professor.showLecture(); } }
3ce49789442b3b0735d442706d000214a7ac52ca
c62ec9e4b2683c701a69eb52b8e7c681bdff2c95
/src/main/java/com/chuan/netty/rpc/provider/RpcHelloServiceImpl.java
8172fbe2d31559f9044bec84daa248d85d6f46f6
[]
no_license
netty-demo/netty-rpc-simpe
dde5815112a03c4612780e612972eeb8a16aa2ed
072e99e00d1233e4e06b11d3e71342a671e08c31
refs/heads/master
2021-07-05T05:20:33.182861
2019-06-19T07:00:48
2019-06-19T07:00:48
192,676,729
0
0
null
2020-10-13T14:00:20
2019-06-19T06:58:35
Java
UTF-8
Java
false
false
318
java
package com.chuan.netty.rpc.provider; import com.chuan.netty.rpc.api.IRpcHelloService; /** * @author: diaoche * @review: * @date: 2019/6/18 16:38 */ public class RpcHelloServiceImpl implements IRpcHelloService { @Override public String hello(String name) { return "Hello " + name +" !" ; } }
b88fe620cee4cc6ea46b1552f6ed59b71335565a
a82cd9a4597bf1318cc8dd38c26c124ea46c33b1
/app/src/test/java/mealmarch/com/mealmarchtest/ExampleUnitTest.java
a0b69b826465e7eed71cad7334e71f7ea39fb168
[]
no_license
itscoe/MealMarch
156314fc4a65e08cfca8252b992158ae0a1f3b5e
cc499e190d1bb71c15e08807e109020dba8d15f0
refs/heads/master
2020-04-02T01:41:34.499629
2018-10-21T08:47:20
2018-10-21T08:47:20
153,869,886
1
0
null
null
null
null
UTF-8
Java
false
false
388
java
package mealmarch.com.mealmarchtest; 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() { assertEquals(4, 2 + 2); } }
2ccf55cb01cee7ba563e3d585b1b6d253ff9be84
0530fca7272be0c73987ed538357b03a870f8bfe
/app/src/main/java/cn/edu/bistu/cs/se/contact/MainActivity.java
f665b51fbe80bc532af0c77fd43487b60dbc8454
[]
no_license
MorningSandra/Contact
3118d5c0feb315b29bd948b0d6242e9ea0bc64fc
fd22f512b87f13bdb893f0ad6713042d9d53e82a
refs/heads/master
2021-06-05T02:46:47.161127
2016-09-09T01:41:44
2016-09-09T01:41:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,523
java
package cn.edu.bistu.cs.se.contact; import android.content.ContentResolver; import android.database.Cursor; import android.provider.ContactsContract; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { private final static String TAG = "MyTag"; Button button_read; private ContentResolver resolver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); resolver = this.getContentResolver(); button_read = (Button) findViewById(R.id.Read_button); //得到全部联系人 button_read.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Cursor cursor = resolver.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); while (cursor.moveToNext()) { String msg; //id String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); msg = "id:" + id; //name String name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); msg = msg + " name:" + name; //phone Cursor phoneNumbers = resolver.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" + id, null, null); while (phoneNumbers.moveToNext()) { String phoneNumber = phoneNumbers.getString(phoneNumbers.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER)); msg = msg + " phone:" + phoneNumber; } //email Cursor emails = resolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI, null, ContactsContract.CommonDataKinds.Email.CONTACT_ID + "=" + id, null, null); while (emails.moveToNext()) { String email = emails.getString(emails.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA)); msg = msg + " email:" + email; } Log.v(TAG, msg); } } }); } }
5716ce4073755d8c51352f16b50bf0430aca0cd5
e2bd39b95c43b1cfeaf995825456e0d24087f87f
/src/application/CalController.java
b8c8c3fa24f598adc4502909689857100fad405b
[]
no_license
VaridVerma/calculator-javafx
f7a136366cb33448148344efb40c9ca106fb5901
9c019fdf617349b3a1d400207648437c4c8a5530
refs/heads/master
2021-01-15T10:57:58.411436
2018-01-27T20:29:12
2018-01-27T20:29:12
99,603,763
0
0
null
null
null
null
UTF-8
Java
false
false
1,064
java
package application; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; import javafx.scene.control.Label; public class CalController { @FXML private Label result; private long n1 = 0; private String operator; private boolean start = true; private Model model = new Model(); @FXML public void processNumbers(ActionEvent event){ if(start){ result.setText(""); start = false; } String value = ((Button)event.getSource()).getText(); result.setText(result.getText()+value); } @FXML public void processOperator(ActionEvent event){ String value = ((Button)event.getSource()).getText(); if(!operator.equals("=")){ if(!operator.isEmpty()) return; operator = value; n1 = Long.parseLong(result.getText()); result.setText(""); }else{ if(operator.isEmpty()) return; long n2 = Long.parseLong(result.getText()); float output = model.calculate(n1, n2, operator); result.setText(String.valueOf(output)); operator = ""; start = true; } } }
243eb1d1b0f8c21e85f9886ed731da5c9dcc3f0b
46b6184622d3678c7249fcff3f8b67e6e1f1aee5
/src/wiko/Processors.java
dc62a02c37a8f2c8122fce9d068d91ddd6627f49
[ "WTFPL" ]
permissive
ArnonEilat/Wiko
1ca709e901bba41c4f1d9ddb5642ebc01ce520d7
104854425f3cac69cb81d7c01a999b40e4a26283
refs/heads/master
2016-08-06T22:43:05.161683
2013-04-17T11:08:28
2013-04-17T11:08:28
9,495,695
1
1
null
null
null
null
UTF-8
Java
false
false
6,528
java
package wiko; /** * Class with methods to convert one line in Wiki markup to HTML.<br> */ public final class Processors { /** * Supported Internet protocols. */ private static String[] WEB_PROTOCOLS = {"http", "ftp", "news"}; /** * Don't let anyone instantiate this class. */ private Processors() { } /** * Get one line in a Wiki markup and return it as HTML.<br> * Supported syntax: * <blockquote> * <pre> * Image [[File:path/to/image/file.jpg]] * Video [[Video:url/to/video/file]] * URL [http://www.link.com linkName]. * bold text '''bold Text''' * Italic text ''italic Text'' * </pre> * </blockquote> * @param wikiText to convert to HTML text. * @return String with HTML representation of wiki markup. */ public static String processLine(String wikiText) { // Image int indexOfFile = wikiText.indexOf("[[File:"); int endIndexOfFile = wikiText.indexOf("]]", indexOfFile + 7); while (indexOfFile != -1 && endIndexOfFile != -1) { wikiText = wikiText.substring(0, indexOfFile) +// Removes the "[[File:" processImage(wikiText.substring(indexOfFile + 7, endIndexOfFile)) + wikiText.substring(endIndexOfFile + 2);// Removes the "]]" indexOfFile = // Gets the indexes of next image wikiText.indexOf("[[File:", indexOfFile + 7); endIndexOfFile = wikiText.indexOf("]]", indexOfFile + 7); } // Video int indexOfVideo = wikiText.indexOf("[[Video:"); int endIndexOfVideo = wikiText.indexOf("]]", indexOfVideo + 8); while (indexOfVideo != -1 && endIndexOfVideo != -1) { wikiText = wikiText.substring(0, indexOfVideo) + processVideo(wikiText.substring(indexOfVideo + 8, endIndexOfVideo)) + wikiText.substring(endIndexOfVideo + 2); indexOfVideo = wikiText.indexOf("[[Video:"); endIndexOfVideo = wikiText.indexOf("]]", indexOfVideo + 8); } // URL for (int i = 0; i < WEB_PROTOCOLS.length; i++) { int index = wikiText.indexOf("[" + WEB_PROTOCOLS[i] + "://"); int endIndex = wikiText.indexOf("]", index + 1); while (index != -1 && endIndex != -1) { wikiText = wikiText.substring(0, index) + processURL(wikiText.substring(index + 1, endIndex)) + wikiText.substring(endIndex + 1); index = wikiText.indexOf("[" + WEB_PROTOCOLS[i] + "://", endIndex + 1); endIndex = wikiText.indexOf("]", index + 1); } } int countBold = 0; int indexOfApostrophe = // Use for both:Bold and Italic wikiText.indexOf("'''"); while (indexOfApostrophe != -1) { if ((countBold % 2) == 0) { wikiText = wikiText.replaceFirst("'''", "<b>"); } else { wikiText = wikiText.replaceFirst("'''", "</b>"); } countBold++; indexOfApostrophe = wikiText.indexOf("'''", indexOfApostrophe); } int countItalic = 0; indexOfApostrophe = wikiText.indexOf("''"); while (indexOfApostrophe > -1) { if ((countItalic % 2) == 0) { wikiText = wikiText.replaceFirst("''", "<i>"); } else { wikiText = wikiText.replaceFirst("''", "</i>"); } countItalic++; indexOfApostrophe = wikiText.indexOf("''", indexOfApostrophe); } wikiText = wikiText.replace("<\\/b><\\/i>", "</i></b>"); return wikiText; } /** * Gets string with URL to image and alternate text attribute(optional) * separated with vertical bar (|) and convert it to HTML image tag.<br> * E.i: * <blockquote><pre> *[[File:path/to/image/file.jpg|alt=Alternative Text]] * </blockquote></pre> will be: * <blockquote><pre> * {@literal <}img src="path/to/image/file.jpg" alt="Alternative Text"/>"; * </blockquote></pre> * @param txt Wiki markup image */ private static String processImage(String txt) { String url; String label = ""; String arr[] = txt.split("\\|"); url = arr[0] + "\""; if (arr[1].startsWith("alt=")) { label = " alt=\"" + arr[1].substring(4) + "\" "; } return "<img src=\"" + url + label + " />"; } /** * Gets string with video URL from one of the supported sites, and convert * it to HTML <tt>iframe</tt> tag which embed it.<br> * Supported web sites: * <blockquote> * <pre> * YouTube * Vimeo * DailyMotion * </pre> * </blockquote> */ private static String processVideo(String url) { String id; int startOfId; if (url.contains("youtube")) { startOfId = url.indexOf("youtube.com/"); id = url.substring(startOfId + 11); url = "http://www.youtube.com/" + id; } else if (url.contains("vimeo")) { startOfId = url.indexOf("vimeo.com/"); id = url.substring(startOfId + 10); url = "http://player.vimeo.com/" + id; } else if (url.contains("dailymotion")) { startOfId = url.indexOf("dailymotion.com/"); id = url.substring(startOfId + 16); url = "http://www.dailymotion.com/" + id; } else { return " Can only handle YouTube, DailyMotion and Vimeo URLs "; } return "<iframe width=\"480\" height=\"390\" src=\"" + url + "\" frameborder=\"0\" allowfullscreen></iframe>"; } /** * Gets string with URL and text(optional) separated with space and convert * it to HTML a tag.<br> * E.g: * <blockquote><pre> * http://www.google.com Google * will be: * {@literal <}a href="http://www.google.com">Google{@literal <}/a> * </pre></blockquote> * @param txt Wiki markup image */ private static String processURL(String txt) { int index = txt.indexOf(" "); String url = txt; String label = txt; if (index != -1) { url = txt.substring(0, index); label = txt.substring(index + 1); } return "<a href=\"" + url + "\">" + label + "</a>"; } }
0cfed8c80e8866680b60594469901e66cb077103
430f01f377bfd732114e6e2aa9fe31d8449d69fc
/dina-datamodel/src/main/java/se/nrm/dina/datamodel/Author.java
73b0d28bc30f2a537275e5f0d3dff376867ce9df
[]
no_license
idali0226/dina-web
b6eb6bc468330d258fe0f3e72a982d4477e28f8e
bba247c8421583ac3b29e0a4ff746d0295341f75
refs/heads/master
2021-01-19T00:01:35.087819
2016-05-02T08:03:28
2016-05-02T08:03:28
49,878,684
0
2
null
2016-06-09T09:08:43
2016-01-18T13:29:58
Java
UTF-8
Java
false
false
5,122
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 se.nrm.dina.datamodel; import java.util.Date; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Lob; import javax.persistence.ManyToOne; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlID; import javax.xml.bind.annotation.XmlIDREF; import javax.xml.bind.annotation.XmlRootElement; import se.nrm.dina.datamodel.util.Util; /** * * @author idali */ @Entity @Table(name = "author") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Author.findAll", query = "SELECT a FROM Author a"), @NamedQuery(name = "Author.findByAuthorID", query = "SELECT a FROM Author a WHERE a.authorID = :authorID"), @NamedQuery(name = "Author.findByOrderNumber", query = "SELECT a FROM Author a WHERE a.orderNumber = :orderNumber")}) public class Author extends BaseEntity { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "AuthorID") private Integer authorID; @Basic(optional = false) @NotNull @Column(name = "OrderNumber") private short orderNumber; @Lob @Size(max = 65535) @Column(name = "Remarks") private String remarks; @JoinColumn(name = "AgentID", referencedColumnName = "AgentID") @ManyToOne(optional = false) private Agent agentID; @JoinColumn(name = "ModifiedByAgentID", referencedColumnName = "AgentID") @ManyToOne private Agent modifiedByAgentID; @JoinColumn(name = "ReferenceWorkID", referencedColumnName = "ReferenceWorkID") @ManyToOne(optional = false) private Referencework referenceWorkID; @JoinColumn(name = "CreatedByAgentID", referencedColumnName = "AgentID") @ManyToOne private Agent createdByAgentID; public Author() { } public Author(Integer authorID) { this.authorID = authorID; } public Author(Integer authorID, Date timestampCreated, short orderNumber) { this.authorID = authorID; this.timestampCreated = timestampCreated; this.orderNumber = orderNumber; } @XmlID @XmlAttribute(name = "id") @Override public String getIdentityString() { return String.valueOf(authorID); } @XmlAttribute(name = "uuid") @Override public String getUUID() { return Util.getInstance().getURLLink(this.getClass().getSimpleName()) + authorID; } @Override public int getEntityId() { return authorID; } public Integer getAuthorID() { return authorID; } public void setAuthorID(Integer authorID) { this.authorID = authorID; } public short getOrderNumber() { return orderNumber; } public void setOrderNumber(short orderNumber) { this.orderNumber = orderNumber; } public String getRemarks() { return remarks; } public void setRemarks(String remarks) { this.remarks = remarks; } @XmlIDREF public Agent getAgentID() { return agentID; } public void setAgentID(Agent agentID) { this.agentID = agentID; } @XmlIDREF public Agent getModifiedByAgentID() { return modifiedByAgentID; } public void setModifiedByAgentID(Agent modifiedByAgentID) { this.modifiedByAgentID = modifiedByAgentID; } @XmlIDREF public Referencework getReferenceWorkID() { return referenceWorkID; } public void setReferenceWorkID(Referencework referenceWorkID) { this.referenceWorkID = referenceWorkID; } @XmlIDREF public Agent getCreatedByAgentID() { return createdByAgentID; } public void setCreatedByAgentID(Agent createdByAgentID) { this.createdByAgentID = createdByAgentID; } @Override public int hashCode() { int hash = 0; hash += (authorID != null ? authorID.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Author)) { return false; } Author other = (Author) object; return !((this.authorID == null && other.authorID != null) || (this.authorID != null && !this.authorID.equals(other.authorID))); } @Override public String toString() { return "se.nrm.dina.datamodel.Author[ authorID=" + authorID + " ]"; } }
738550fe7ec9c2d30df59ffde8c6b191a26ec70b
86404aaf2267945530f07155d1b8f3e223d34c1b
/analyse/src/functioneditor/actions/PasteAction.java
d12a29b0ee8a322bb8309ab784d93d75bd5ecc5c
[]
no_license
fbuloup/Analyse
5c5a513118620bafac646d10fe7c80d73b0e2e00
9cb908bf6bbd8b4ccdd81015140e781480d06aa5
refs/heads/master
2022-02-22T21:39:07.720641
2022-01-27T07:33:23
2022-01-27T07:33:23
156,516,992
0
0
null
null
null
null
MacCentralEurope
Java
false
false
2,359
java
/******************************************************************************* * Université d’Aix Marseille (AMU) - Centre National de la Recherche Scientifique (CNRS) * Copyright 2014 AMU-CNRS All Rights Reserved. * * These computer program listings and specifications, herein, are * the property of Université d’Aix Marseille and CNRS * shall not be reproduced or copied or used in whole or in part as * the basis for manufacture or sale of items without written permission. * For a license agreement, please contact: * <mailto: [email protected]> * * Author : Frank BULOUP * Institut des Sciences du Mouvement - [email protected] ******************************************************************************/ package functioneditor.actions; import org.eclipse.jface.action.Action; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.dnd.TextTransfer; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Text; import functioneditor.windows.FunctionsEditorComposite; import analyse.resources.IImagesKeys; import analyse.resources.ImagesUtils; import analyse.resources.Messages; public class PasteAction extends Action{ private FunctionsEditorComposite functionsEditorComposite; public PasteAction() { super(Messages.getString("matlabfunctioneditor.PasteAction.Title"), AS_PUSH_BUTTON); //$NON-NLS-1$ setAccelerator(SWT.MOD1 | 'V'); setToolTipText(Messages.getString("matlabfunctioneditor.PasteAction.Tooltip")); //$NON-NLS-1$ setImageDescriptor(ImagesUtils.getImageDescriptor(IImagesKeys.PASTE_ICON)); } @Override public void run() { Control focusedControl = Display.getDefault().getFocusControl(); if(functionsEditorComposite != null && focusedControl instanceof StyledText) functionsEditorComposite.doPaste(); else { Clipboard clipboard = new Clipboard(Display.getDefault()); String plainText = (String)clipboard.getContents(TextTransfer.getInstance()); if(focusedControl instanceof Text) ((Text)focusedControl).insert(plainText); clipboard.dispose(); } } public void setFunctionsEditorComposite(FunctionsEditorComposite functionsEditorComposite) { this.functionsEditorComposite = functionsEditorComposite; } }