blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
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
684M
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
132 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
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
aad900d6cc0616f9196a9e66a3c43f62a9871ff4
9be301d93ec7ac89295eb08592b38d01712f85cc
/coremodule/src/main/java/com/danny/coremodule/CoreActivity.java
d9f2c9dd082bc7957cc52e86ffb4d6bcd6377c30
[]
no_license
khysokhorn/reanAndroid
e9eed7931173ba7d232b62152d12e8cf5e1a449b
2b6805b906f696673533498053b6a260d5d00902
refs/heads/master
2023-06-26T17:47:03.491921
2021-08-04T07:24:08
2021-08-04T07:24:08
392,591,014
0
0
null
null
null
null
UTF-8
Java
false
false
2,417
java
package com.danny.coremodule; import android.content.IntentFilter; import android.os.Bundle; import android.util.Log; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; public abstract class CoreActivity extends AppCompatActivity implements InternetBroadcastReceiver.OnInternetConnectionChangeListener { private IntentFilter intentFilter; private InternetBroadcastReceiver receiver; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i("Activity Lifecycle", getClass().getSimpleName() + "=======> onCreate"); intentFilter = new IntentFilter(); intentFilter.addAction(InternetBroadcastReceiver.CONNECTIVITY_ACTION); receiver = new InternetBroadcastReceiver(); receiver.setOnInternetConnectionChangeListener(this); } @Override protected void onResume() { super.onResume(); Log.i("Activity Lifecycle", getClass().getSimpleName() + "=======> onResume"); registerReceiver(receiver, intentFilter); } @Override protected void onPause() { super.onPause(); Log.i("Activity Lifecycle", getClass().getSimpleName() + "=======> onPause"); unregisterReceiver(receiver); } @Override protected void onStop() { super.onStop(); Log.i("Activity Lifecycle", getClass().getSimpleName() + "=======> onStop"); } @Override protected void onStart() { super.onStart(); Log.i("Activity Lifecycle", getClass().getSimpleName() + "=======> onStart"); } @Override protected void onRestart() { super.onRestart(); Log.i("Activity Lifecycle", getClass().getSimpleName() + "=======> onRestart"); } @Override protected void onPostResume() { super.onPostResume(); Log.i("Activity Lifecycle", getClass().getSimpleName() + "=======> onPostResume"); } @Override protected void onDestroy() { super.onDestroy(); Log.i("Activity Lifecycle", getClass().getSimpleName() + "=======> onDestroy"); } @Override public void onDisconnected() { onInternetDisconnect(); } @Override public void onConnected() { onInternetConnect(); } public abstract void onInternetDisconnect(); public abstract void onInternetConnect(); }
[ "sokhornkhy88@gmail.com" ]
sokhornkhy88@gmail.com
f5e0c3ee356a6377cb51742d6f1a5027c71d526a
e45bdfe09f5abddcccbcbf44ca532729c6480123
/IDEA2020.1.1/springmvc_study/springmvc-intercept/src/main/java/com/wang/Interceptor/LJ1.java
bbcaa7537e2f8071033d943429da389a17d11386
[]
no_license
18222137497/Learning-path
71417330650c326637290cbbb9c77375a284b94f
12a415ffce3ba8528666792ad99b8c9e6f9d107f
refs/heads/master
2023-03-12T06:37:09.380592
2021-02-23T10:18:32
2021-02-23T10:18:32
303,752,409
0
0
null
null
null
null
UTF-8
Java
false
false
960
java
package com.wang.Interceptor; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class LJ1 implements HandlerInterceptor { @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.out.println("执行了拦截器-----前2"); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { System.out.println("执行了拦截器-----后2"); } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { System.out.println("执行了拦截器-----最终2"); } }
[ "67040612+18222137497@users.noreply.github.com" ]
67040612+18222137497@users.noreply.github.com
3bf4c6717c52bf7702d74bc1d58007339d2e8bdb
7a0ad5754e47917e4822ad324440f86629e13756
/dev_web/src/com/ajax/memo/MemoUpdateAction.java
9b28b08ffe0e9798097310fc96a2ff56e0997ca4
[]
no_license
ckdrmsdl9999/dev_lab
26fece29f6158531ba6dfe06df403e4f995250d2
09d4897bc627ff9a6a2558d288c897eb08cbcd2e
refs/heads/master
2021-01-25T08:02:06.311187
2017-03-03T03:20:06
2017-03-03T03:20:06
null
0
0
null
null
null
null
UHC
Java
false
false
1,355
java
package com.ajax.memo; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import com.util.Action; import com.util.ActionForward; import com.vo.MemoVO; public class MemoUpdateAction implements Action { Logger logger = Logger.getLogger(MemoSendAction.class); @Override /************************************************************************************* * 쪽지관리(보낸쪽지 수정하기 구현) * @param request, response * @return ActionForward * 응답페이지 - getSendMemoList.mem *************************************************************************************/ public ActionForward execute(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { logger.info("execute 호출 성공"); MemoLogic moLogic = new MemoLogic(); int muResult = 0; MemoVO moVO = new MemoVO(); muResult = moLogic.memoUpdate(moVO); ActionForward forward = new ActionForward(); forward.setRedirect(true); //요청에 대한 응답이 나가는 페이지 이름 혹은 XXX.mem이름 if(muResult == 1) forward.setPath("./memoUpdateSuccess.jsp"); else forward.setPath("./memoUpdateFail.jsp"); return forward; } }
[ "H@DESKTOP-A7RLDUN" ]
H@DESKTOP-A7RLDUN
d7d75bd1bfa3ff875f627a98efa098ffaf7f267d
3dbbfac39ac33d3fabec60b290118b361736f897
/leetcode/872-Leaf-Similar Trees.java
6d43cb13dfc6218f744d939c430a542cf5f9188e
[]
no_license
joshua-qa/PS
7e0a61f764f7746e6b3c693c103da06b845552b7
c49c0b377f85c483b6d274806afb0cbc534500b7
refs/heads/master
2023-05-28T15:01:28.709522
2023-05-21T04:46:29
2023-05-21T04:46:29
77,836,098
7
2
null
null
null
null
UTF-8
Java
false
false
1,094
java
// 1ms. 트리 순회법을 알고 있으면 5분 컷 /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode() {} * TreeNode(int val) { this.val = val; } * TreeNode(int val, TreeNode left, TreeNode right) { * this.val = val; * this.left = left; * this.right = right; * } * } */ class Solution { public boolean leafSimilar(TreeNode root1, TreeNode root2) { List<Integer> leaf1 = new ArrayList<>(); List<Integer> leaf2 = new ArrayList<>(); dfs(root1, leaf1); dfs(root2, leaf2); return leaf1.equals(leaf2); } private void dfs(TreeNode curr, List<Integer> leafs) { if (curr == null) { return; } if (curr.left == null && curr.right == null) { leafs.add(curr.val); return; } if (curr.left != null) { dfs(curr.left, leafs); } if (curr.right != null) { dfs(curr.right, leafs); } } }
[ "jgchoi.qa@gmail.com" ]
jgchoi.qa@gmail.com
7b2ddeb4fcae3b66c0e37f18b146c020c9b77442
119852755d9dcf604edf7d011097973e7150081e
/SSSP.java
df9ccedd1f0814488759342af1a74ef5bffefc52
[]
no_license
chupotle/Multi-Threaded-Dijkstras
6b711fedff24ac71cb5585163691587b1431f35b
ba9f2a438e0358d1db36cf47c4afa9a8b8091b70
refs/heads/master
2021-09-05T04:56:50.935263
2018-01-24T07:51:40
2018-01-24T07:51:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
40,484
java
/* SSSP.java Single-source shortest path finder. Includes a (sequential) implementation of Dijkstra's algorithm, which is O((m + n) log n). Also includes a (sequential) implementation of Delta stepping. You need to create a parallel version of this. Michael L. Scott, November 2017; based heavily on earlier incarnations of several programming projects, and on Delaunay mesh code written in 2007. */ import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import java.util.*; import java.lang.*; import java.util.concurrent.*;import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CyclicBarrier; public class SSSP { private static int n = 50; // default number of vertices private static double geom = 1.0; // default degree of geometric reality // 0 means random edge weight; 1 means fully geometric distance private static int degree = 5; // expected number of neighbors per vertex // (near the middle of the graph) private static long sd = 0; // default random number seed private static int numThreads = 0; // zero means use Dijkstra's alg; // positive means use Delta stepping public int threads_running = 0; private static final int TIMING_ONLY = 0; private static final int PRINT_EVENTS = 1; private static final int SHOW_RESULT = 2; private static final int FULL_ANIMATION = 3; private static int animate = TIMING_ONLY; // default private static final String help = "-a [0123] annimation mode:\n" + " 0 -> timing only\n" + " 1 -> print events only\n" + " 2 -> show result\n" + " 3 -> full animation\n" + "-n <number of vertices>\n" + "-d <expected vertex degree>\n" + " (for vertices near the middle of large graphs)\n" + "-g <degree of geometric realism>\n" + " (real number between 0 and 1)\n" + "-s <random number seed>\n" + "-t <number of threads>\n" + " (0 means use Dijkstra's algorithm on one thread)\n" + "-v (print this message)\n"; // Examine command-line arguments for alternative running modes. // private static void parseArgs(String[] args) { for (int i = 0; i < args.length; i++) { if (args[i].equals("-a")) { if (++i >= args.length) { System.err.print("Missing animation level\n"); } else { int an = -1; try { an = Integer.parseInt(args[i]); } catch (NumberFormatException e) { } if (an >= TIMING_ONLY && an <= FULL_ANIMATION) { animate = an; } else { System.err.printf("Animation level (%s) must be between 0 and 3.\n", args[i]); } } } else if (args[i].equals("-n")) { if (++i >= args.length) { System.err.print("Missing number of vertices\n"); } else { int np = -1; try { np = Integer.parseInt(args[i]); } catch (NumberFormatException e) { } if (np > 0) { n = np; } else { System.err.printf("Number of vertices (%s) must be positive.\n", args[i]); } } } else if (args[i].equals("-d")) { if (++i >= args.length) { System.err.print("Missing degree\n"); } else { int d = -1; try { d = Integer.parseInt(args[i]); } catch (NumberFormatException e) { } if (d > 0) { degree = d; } else { System.err.printf("Expected degree (%s) must be positive.\n", args[i]); } } } else if (args[i].equals("-g")) { if (++i >= args.length) { System.err.print("Missing geometry factor\n"); } else { double g = -1.0; try { g = Double.parseDouble(args[i]); } catch (NumberFormatException e) { } if (g >= 0 && g <= 1) { geom = g; } else { System.err.printf("Geometry factor (%s) must be between 0 and 1.\n", args[i]); } } } else if (args[i].equals("-s")) { if (++i >= args.length) { System.err.print("Missing seed\n"); } else { try { sd = Long.parseLong(args[i]); } catch (NumberFormatException e) { System.err.printf("Seed (%s) must be a long integer\n", args[i]); } } } else if (args[i].equals("-t")) { if (++i >= args.length) { System.err.print("Missing number of threads\n"); } else { int nt = -1; try { nt = Integer.parseInt(args[i]); } catch (NumberFormatException e) { } if (nt >= 0) { numThreads = nt; } else { System.err.printf("Number of threads (%s) must be nonnegative.\n", args[i]); } } } else if (args[i].equals("-v")) { System.err.print(help); System.exit(0); } else { System.err.printf("Unexpected argument: %s\n", args[i]); System.err.print(help); System.exit(1); } } } // Initialize appropriate program components for specified animation mode. // private Surface build(RootPaneContainer pane, int an) { final Coordinator c = new Coordinator(); Surface s = new Surface(n, sd, geom, degree, c, numThreads); Animation at = null; if (an == SHOW_RESULT || an == FULL_ANIMATION) { at = new Animation(s); new UI(c, s, at, sd, numThreads, pane); } final Animation a = at; if (an == PRINT_EVENTS) { s.setHooks( new Surface.EdgeRoutine() { public void run(int x1, int y1, int x2, int y2, boolean dum, long w) { System.out.printf("selected %12d %12d %12d %12d %12d\n", x1, y1, x2, y2, w); }}, new Surface.EdgeRoutine() { public void run(int x1, int y1, int x2, int y2, boolean dum, long w) { System.out.printf("unselected %12d %12d %12d %12d %12d\n", x1, y1, x2, y2, w); }}); } else if (an == FULL_ANIMATION) { Surface.EdgeRoutine er = new Surface.EdgeRoutine() { public void run(int x1, int y1, int x2, int y2, boolean dum, long w) throws Coordinator.KilledException { c.hesitate(); a.repaint(); // graphics need to be re-rendered }}; s.setHooks(er, er); } return s; } public static void main(String[] args) { parseArgs(args); SSSP me = new SSSP(); JFrame f = null; if (animate == SHOW_RESULT || animate == FULL_ANIMATION) { f = new JFrame("SSSP"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } else { System.out.printf("%d vertices, seed %d\n", n, sd); } Surface s = me.build(f, animate); s.numThreads = numThreads; if (f != null) { f.pack(); f.setVisible(true); } else { // Using terminal I/O rather than graphics. // Execute the guts of the run button handler method here. long startTime = new Date().getTime(); try { if (numThreads == 0) { s.DijkstraSolve(); } else { s.DeltaSolve(); } } catch(Coordinator.KilledException e) { } long endTime = new Date().getTime(); System.out.printf("elapsed time: %.3f seconds\n", (double) (endTime-startTime)/1000); } } } // The Worker is the thread that does the actual work of finding // shortest paths (in the animated version -- main thread does it in // the terminal I/O version). // class Worker extends Thread { private final Surface s; private final Coordinator c; private final UI u; private final Animation a; private final boolean dijkstra; // Dijkstra = !Delta // The run() method of a Java Thread is never invoked directly by // user code. Rather, it is called by the Java runtime when user // code calls start(). // // The run() method of a worker thread *must* begin by calling // c.register() and end by calling c.unregister(). These allow the // user interface (via the Coordinator) to pause and terminate // workers. Note how the worker is set up to catch KilledException. // In the process of unwinding back to here we'll cleanly and // automatically release any monitor locks. If you create new kinds // of workers (as part of a parallel solver), make sure they call // c.register() and c.unregister() properly. // public void run() { try { c.register(); if (dijkstra) { s.DijkstraSolve(); } else { s.DeltaSolve(); } c.unregister(); } catch(Coordinator.KilledException e) { } if (a != null) { // Tell the graphics event thread to unset the default // button when it gets a chance. (Threads other than the // event thread cannot safely modify the GUI directly.) a.repaint(); SwingUtilities.invokeLater(new Runnable() { public void run() { u.setDone(); } }); } } // Constructor // public Worker(Surface S, Coordinator C, UI U, Animation A, boolean D) { s = S; c = C; u = U; a = A; dijkstra = D; } } // The Surface is the SSSP world, containing all the vertices. // Vertex 0 is the source. // class Surface { // all X and Y coordinates will be in the range [0..2^28) public static final int minCoord = 0; public static final int maxCoord = 1024*1024*256; public static int numThreads; // The following 9 fields are set by the Surface constructor. private final Coordinator coord; // Not needed at present, but will need to be passed to any // newly created workers. private final int n; // number of vertices private final Vertex vertices[]; // Main array of vertices, used for partitioning and rendering. private final HashSet<Vertex> vertexHash; // Used to ensure that we never have two vertices directly on top of // each other. See Vertex.hashCode and Vertex.equals below. private final Vector<Edge> edges; private long sd = 0; private double geom; // degree of geometric realism private int degree; // desired average node degree private final Random prn; // pseudo-random number generator static int nextIndex=0; static ArrayList<ConcurrentLinkedQueue<Request>> requestQueue = new ArrayList<>(); static ArrayList<Boolean> isThreadSending = new ArrayList<>(); static ArrayList<Boolean> isFinished = new ArrayList<>(); static HashMap<Vertex, Long> vertexThreads = new HashMap<>(); static HashMap<Long, Integer> activeThreads = new HashMap<>(); private class Vertex { public final int xCoord; public final int yCoord; public Vector<Edge> neighbors; public long distToSource; public Edge predecessor; // Add a new neighbor to this vertex (called only during initialization) public void addNeighbor(Edge e) { neighbors.add(e); } // Override Object.hashCode and Object.equals. // This way two vertices are equal (and hash to the same slot in // HashSet vertexHash) if they have the same coordinates, even if they // are different objects. // public int hashCode() { return xCoord ^ yCoord; } public boolean equals(Object o) { Vertex v = (Vertex) o; // run-time type check return v.xCoord == xCoord && v.yCoord == yCoord; } // Constructor // public Vertex(int x, int y) { xCoord = x; yCoord = y; neighbors = new Vector<Edge>(); distToSource = Long.MAX_VALUE; predecessor = null; } } private class DistanceComparator implements Comparator<Vertex> { public int compare(Vertex v1, Vertex v2) { if (v1.distToSource < v2.distToSource) return -1; if (v2.distToSource < v1.distToSource) return 1; return 0; } } // In a purely offline SSSP algorithm we probably wouldn't need an // explicit edge class. Having one makes the graphics a lot more // straightforward, though. // private class Edge { public final Vertex v1; // vertices are in arbitrary order public final Vertex v2; public final int weight; private boolean selected; public void select() throws Coordinator.KilledException { selected = true; if (edgeSelectHook != null) { edgeSelectHook.run(v1.xCoord, v1.yCoord, v2.xCoord, v2.yCoord, true, Math.max(v1.distToSource, v2.distToSource)); } } public void unselect() throws Coordinator.KilledException { selected = false; if (edgeUnSelectHook != null) { edgeUnSelectHook.run(v1.xCoord, v1.yCoord, v2.xCoord, v2.yCoord, false, 0); } } public Vertex other(Vertex v) { if (v == v1) { return v2; } else { return v1; } } // Constructor // public Edge(Vertex first, Vertex second, int w) { v1 = first; v2 = second; weight = w; selected = false; } } // Signatures for things someone might want us to do with a vertex or // an edge (e.g., display it). // public interface EdgeRoutine { public void run(int x1, int y1, int x2, int y2, boolean selected, long weight) throws Coordinator.KilledException; } public interface VertexRoutine{ public void run(int x, int y); } public void forAllVertices(VertexRoutine pr) { for (Vertex v : vertices) { pr.run(v.xCoord, v.yCoord); } } public void forSource(VertexRoutine pr) { pr.run(vertices[0].xCoord, vertices[0].yCoord); } public void forAllEdges(EdgeRoutine pr) { for (Edge e : edges) { try { pr.run(e.v1.xCoord, e.v1.yCoord, e.v2.xCoord, e.v2.yCoord, e.selected, 0); } catch (Coordinator.KilledException f) { } } } // Routines to call when performing the specified operations: private static EdgeRoutine edgeSelectHook = null; private static EdgeRoutine edgeUnSelectHook = null; // The following is separate from the constructor to avoid a // circularity problem: when working in FULL_ANIMATION mode, the // Animation object needs a reference to the Surface object, and the // Surface object needs references to the hooks of the Animation object. // public void setHooks(EdgeRoutine esh, EdgeRoutine euh) { edgeSelectHook = esh; edgeUnSelectHook = euh; } // Called by the UI when it wants to reset with a new seed. // public long randomize() { sd++; reset(); return sd; } // Compute Euclidean distance between two vertices. // private int euclideanDistance(Vertex v1, Vertex v2) { double xDiff = v1.xCoord - v2.xCoord; double yDiff = v1.yCoord - v2.yCoord; return (int) Math.sqrt(xDiff * xDiff + yDiff * yDiff); } // 2-dimensional array of buckets into which to put geometrically // proximal vertices. Sadly, requires suppression of unchecked cast // warnings. (I could get around that with a an ArrayList of // ArrayLists, but that gets really messy...) // class CheckerBoard { private Object[][] cb; @SuppressWarnings("unchecked") public Vector<Vertex> get(int i, int j) { return (Vector<Vertex>)(cb[i][j]); } public CheckerBoard (int k) { cb = new Object[k][k]; // Really Vector<Vertex>, but Java erasure makes that illegal. for (int i = 0; i < k; ++i) { for (int j = 0; j < k; ++j) { cb[i][j] = new Vector<Vertex>(); } } } } // Called by the UI when it wants to start over. // public void reset() { // As a heuristic, I want to connect each vertex to about 1/4 of // its geometrically nearby vertices. So I want to choose // neighbors from a region containing about 4*degree vertices. // I divide the plane into a k x k grid, such that a 3x3 subset // has about the right number of vertices from which to choose. final int k = (int) (Math.sqrt((double)n/(double)degree) * 3 / 2); final int sw = (int) Math.ceil((double)maxCoord/(double)k); // square width; CheckerBoard cb = new CheckerBoard(k); prn.setSeed(sd); vertexHash.clear(); // empty out the set of vertices edges.clear(); // and edges for (int i = 0; i < n; i++) { Vertex v; int x; int y; do { x = Math.abs(prn.nextInt()) % maxCoord; y = Math.abs(prn.nextInt()) % maxCoord; v = new Vertex(x, y); } while (vertexHash.contains(v)); vertexHash.add(v); vertices[i] = v; cb.get(x/sw, y/sw).add(v); } vertices[0].distToSource = 0; // vertex 0 is the source // create edges for (Vertex v : vertices) { int xb = v.xCoord / sw; int yb = v.yCoord / sw; // Find 3x3 area from which to draw neighbors. int xl; int xh; int yl; int yh; if (k < 3) { xl = yl = 0; xh = yh = k-1; } else { xl = (xb == 0) ? 0 : ((xb == k-1) ? k-3 : (xb-1)); xh = (xb == 0) ? 2 : ((xb == k-1) ? k-1 : (xb+1)); yl = (yb == 0) ? 0 : ((yb == k-1) ? k-3 : (yb-1)); yh = (yb == 0) ? 2 : ((yb == k-1) ? k-1 : (yb+1)); } for (int i = xl; i <= xh; ++i) { for (int j = yl; j <= yh; ++j) { for (Vertex u : cb.get(i, j)) { if (v.hashCode() < u.hashCode() // Only choose edge from one end -- // avoid self-loops and doubled edges. && prn.nextInt() % 4 == 0) { // Invent a weight. int dist = euclideanDistance(u, v); int randWeight = Math.abs(prn.nextInt()) % (maxCoord * 2); int weight = (int) ((geom * (double)dist) + ((1.0 - geom) * (double)randWeight)); // Pick u as neighbor. Edge e = new Edge(u, v, weight); u.addNeighbor(e); v.addNeighbor(e); edges.add(e); } } } } } } // ************************* // Find shortest paths via Dijkstra's algorithm. // // Dijkstra's algorithm assumes a priority queue with a log-time decreaseKey // method, which Java's PriorityQueue class doesn't support (and can't easily // support, because it doesn't export references to its internal tree nodes. // The workaround here, due to Jackson Abascal, adds an extra distance field, // "weight," which is equal to v.distToSource when v is first inserted in the // PQ, but keeps its value even when v.distToSoure is reduced. When we want // to reduce a key, we simply insert the vertex again, and leave the old // reference in place. The old one has a weight that's worse than // v.distToSource, allowing us to skip over it. // class WeightedVertex implements Comparable<WeightedVertex> { Vertex v; long weight; public WeightedVertex(Vertex n) { v = n; weight = v.distToSource; } public int compareTo(WeightedVertex other) { if (weight < other.weight) return -1; if (weight == other.weight) return 0; return 1; } } public void DijkstraSolve() throws Coordinator.KilledException { PriorityQueue<WeightedVertex> pq = new PriorityQueue<WeightedVertex>((n * 12) / 10); // Leave some room for extra umremoved entries. vertices[0].distToSource = 0; // All other vertices still have maximal distToSource, as set by constructor. pq.add(new WeightedVertex(vertices[0])); while (!pq.isEmpty()) { WeightedVertex wv = pq.poll(); Vertex v = wv.v; if (v.predecessor != null) { v.predecessor.select(); } if (wv.weight != v.distToSource) { // This is a left-over pq entry. continue; } for (Edge e : v.neighbors) { Vertex o = e.other(v); long altDist = v.distToSource + e.weight; if (altDist < o.distToSource) { o.distToSource = altDist; o.predecessor = e; pq.add(new WeightedVertex(o)); } } } } // ************************* // Find shortest paths via Delta stepping. int numBuckets; int delta; // This is an ArrayList instead of a plain array to avoid the generic // array creation error message that stems from Java erasure. // A Request is a potential relaxation. // class Request { public Vertex v; public Edge e; // To relax a request is to consider whether the e might provide // v with a better path back to the source. // public void relax(ArrayList<LinkedHashSet<Vertex>> buckets) throws Coordinator.KilledException { Vertex o = e.other(v); long altDist = o.distToSource + e.weight; if (altDist < v.distToSource) { // Yup; better path home. buckets.get((int)((v.distToSource / delta) % numBuckets)).remove(v); v.distToSource = altDist; if (v.predecessor != null) { v.predecessor.unselect(); } v.predecessor = e; e.select(); buckets.get((int)((altDist / delta) % numBuckets)).add(v); } } public Request(Vertex V, Edge E) { v = V; e = E; } } // Return list of requests whose connecting edge weight is <= or > than delta. // LinkedList<Request> findRequests(Collection<Vertex> bucket, boolean light) { LinkedList<Request> rtn = new LinkedList<Request>(); for (Vertex v : bucket) { for (Edge e : v.neighbors) { if ((light && e.weight <= delta) || (!light && e.weight > delta)) { Vertex o = e.other(v); rtn.add(new Request(o, e)); } } } return rtn; } // Main solver routine. // public void DeltaSolve() throws Coordinator.KilledException { System.out.println("start delta solve"); numBuckets = 2 * degree; delta = maxCoord / degree; CyclicBarrier barrier = new CyclicBarrier(numThreads); // All buckets, together, cover a range of 2 * maxCoord, // which is larger than the weight of any edge, so a relaxation // will never wrap all the way around the array. DeltaHelperThread[] DHThreads = new DeltaHelperThread[numThreads]; for (int i=0; i<numThreads; i++) { DHThreads[i] = new DeltaHelperThread(numBuckets, i, barrier, numThreads); isThreadSending.add(false); isFinished.add(false); requestQueue.add(new ConcurrentLinkedQueue<Request>()); } for(int i=0; i<n; i++){ vertexThreads.put(vertices[i], DHThreads[i%numThreads].getId()); } for(int i=0; i<numThreads; i++){ activeThreads.put(DHThreads[i].getId(),i); DHThreads[i].start(); } for(int i=0; i<numThreads; i++){ try{ DHThreads[i].join(); } catch(InterruptedException e){} } System.out.println("end delta solve"); } class DeltaHelperThread extends Thread { private int index; private int thread_number; private int numBucketss; private int numThreads; private ArrayList<LinkedHashSet<Vertex>> bucketss; private CyclicBarrier barrier; private Boolean willLoop; public DeltaHelperThread(int numBuckets, int thread_number, CyclicBarrier barrier, int numThreads){ this.index = 0; this.thread_number = thread_number; this.barrier = barrier; this.numBucketss = numBuckets; this.numThreads = numThreads; this.willLoop = false; this.bucketss = new ArrayList<LinkedHashSet<Vertex>>(numBucketss); for(int i=0; i<numBuckets; i++){ bucketss.add(new LinkedHashSet<Vertex>()); } bucketss.get(0).add(vertices[0]); } public void bAwait(){ try { barrier.await(); } catch (InterruptedException e) {} catch (BrokenBarrierException e) {} } public void run(){ for(;;){ for(;;){ LinkedList<Vertex> removed = new LinkedList<Vertex>(); LinkedList<Request> requests; Boolean threadSending = false; long thisThreadID = Thread.currentThread().getId(); int thisThread = activeThreads.get(thisThreadID); isFinished.set(thisThread,false); while(bucketss.get(index).size() > 0){ requests = findRequests(bucketss.get(index),true); removed.addAll(bucketss.get(index)); bucketss.set(index, new LinkedHashSet<Vertex>()); for(Request requestt : requests){ //System.out.println("thread num " + thread_number + " req "+ requests.size()); if(vertexThreads.get(requestt.v) == thisThreadID){ try{ requestt.relax(bucketss); } catch (Coordinator.KilledException e) {} } else{ long threadId = vertexThreads.get(requestt.v); if(activeThreads.get(threadId) != null){ int thread = activeThreads.get(threadId); requestQueue.get(thread).add(requestt); } isThreadSending.set(thisThread, true); threadSending = true; } } } if(!threadSending){ isThreadSending.set(thisThread, false); } if(!willLoop){ bAwait(); } while(!requestQueue.get(thisThread).isEmpty()){ Request req = requestQueue.get(thisThread).poll(); try{ req.relax(bucketss); } catch (Coordinator.KilledException e) {} } if(!willLoop){ bAwait(); } requests = findRequests(removed, false); for(Request requestt : requests){ if(vertexThreads.get(requestt.v) == thisThreadID){ try{ requestt.relax(bucketss); } catch (Coordinator.KilledException e) {} } else{ long threadId = vertexThreads.get(requestt.v); if(activeThreads.get(threadId) != null){ int thread = activeThreads.get(threadId); requestQueue.get(thread).add(requestt); } isThreadSending.set(thisThread, true); threadSending = true; } } if(!threadSending){ isThreadSending.set(thisThread, false); } if(!willLoop){ bAwait(); } while(!requestQueue.get(thisThread).isEmpty()){ Request req = requestQueue.get(thisThread).poll(); try{ req.relax(bucketss); } catch (Coordinator.KilledException e) {} } if(!willLoop){ bAwait(); } if(bucketss.get(index).size()==0){ isFinished.set(thisThread, true); } // int bak=index; // while(bucketss.get(index).size()!=0&&index<=numBucketss){ // index++; // } // if(index<nextIndex){ // nextIndex=index; // } // index=bak; if(!willLoop){ bAwait(); } Boolean end = true; for (int i = 0; i < numThreads; i++) { end = isFinished.get(i); if (!end){ break; } } if (end) { bAwait(); break; } } willLoop=false; // if(nextIndex!=1000&&index>nextIndex){ // index=nextIndex; // } index++; //nextIndex = n; if(index>=numBucketss){ break; } } return; } } // End of Delta stepping. // ************************* // Constructor // public Surface(int N, long SD, double G, int D, Coordinator C, int numThread) { n = N; sd = SD; geom = G; degree = D; coord = C; nextIndex = n; numThreads = numThread; vertices = new Vertex[n]; vertexHash = new HashSet<Vertex>(n); edges = new Vector<Edge>(); prn = new Random(); reset(); } } // Class Animation is the one really complicated sub-pane of the user interface. // class Animation extends JPanel { private static final int width = 512; // canvas dimensions private static final int height = 512; private static final int dotsize = 6; private static final int border = dotsize; private final Surface s; // The next two routines figure out where to render the dot // for a vertex, given the size of the animation panel and the spread // of x and y values among all vertices. // private int xPosition(int x) { return (int) (((double)x) * (double)width / (double)s.maxCoord) + border; } private int yPosition(int y) { return (int) (((double)s.maxCoord - (double)y) * (double)height / ((double)s.maxCoord)) + border; } // The following method is called automatically by the graphics // system when it thinks the Animation canvas needs to be // re-displayed. This can happen because code elsewhere in this // program called repaint(), or because of hiding/revealing or // open/close operations in the surrounding window system. // public void paintComponent(final Graphics g) { final Graphics2D g2 = (Graphics2D) g; super.paintComponent(g); // clears panel s.forAllEdges(new Surface.EdgeRoutine() { public void run(int x1, int y1, int x2, int y2, boolean bold, long w) { if (bold) { g2.setPaint(Color.red); g2.setStroke(new BasicStroke(3)); } else { g2.setPaint(Color.gray); g2.setStroke(new BasicStroke(1)); } g.drawLine(xPosition(x1), yPosition(y1), xPosition(x2), yPosition(y2)); } }); s.forAllVertices(new Surface.VertexRoutine() { public void run(int x, int y) { g2.setPaint(Color.blue); g.fillOval(xPosition(x)-dotsize/2, yPosition(y)-dotsize/2, dotsize, dotsize); } }); // Distinguish source vertex: s.forSource(new Surface.VertexRoutine() { public void run(int x, int y) { g2.setPaint(Color.green); g.fillOval(xPosition(x)-dotsize, yPosition(y)-dotsize, dotsize*2, dotsize*2); g2.setPaint(Color.black); g2.setStroke(new BasicStroke(2)); g.drawOval(xPosition(x)-dotsize, yPosition(y)-dotsize, dotsize*2, dotsize*2); } }); } // UI needs to call this routine when vertex locations have changed. // public void reset() { repaint(); // Tell graphics system to re-render. } // Constructor // public Animation(Surface S) { setPreferredSize(new Dimension(width+border*2, height+border*2)); setBackground(Color.white); setForeground(Color.black); s = S; reset(); } } // Class UI is the user interface. It displays a Surface canvas above // a row of buttons and a row of statistics. Actions (event handlers) // are defined for each of the buttons. Depending on the state of the // UI, either the "run" or the "pause" button is the default (highlighted in // most window systems); it will often self-push if you hit carriage return. // class UI extends JPanel { private final Coordinator coordinator; private final Surface surface; private final Animation animation; private final JRootPane root; private static final int externalBorder = 6; private static final int stopped = 0; private static final int running = 1; private static final int paused = 2; private static final int done = 3; private int state = stopped; private long elapsedTime = 0; private long startTime; private final JLabel time = new JLabel("time: 0"); public void updateTime() { Date d = new Date(); elapsedTime += (d.getTime() - startTime); time.setText(String.format("time: %d.%03d", elapsedTime/1000, elapsedTime%1000)); } public void setDone() { root.setDefaultButton(null); updateTime(); state = done; }; // Constructor // public UI(Coordinator C, Surface S, Animation A, long SD, int NT, RootPaneContainer pane) { final UI ui = this; coordinator = C; surface = S; animation = A; final JPanel buttons = new JPanel(); // button panel final JButton runButton = new JButton("Run"); final JButton pauseButton = new JButton("Pause"); final JButton resetButton = new JButton("Reset"); final JButton randomizeButton = new JButton("Randomize"); final JButton quitButton = new JButton("Quit"); final JPanel stats = new JPanel(); // statistics panel final JLabel seed = new JLabel("seed: " + SD + " "); runButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (state == stopped) { state = running; root.setDefaultButton(pauseButton); Worker w = new Worker(surface, coordinator, ui, animation, NT == 0); Date d = new Date(); startTime = d.getTime(); w.start(); } else if (state == paused) { state = running; root.setDefaultButton(pauseButton); Date d = new Date(); startTime = d.getTime(); coordinator.toggle(); } } }); pauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (state == running) { updateTime(); state = paused; root.setDefaultButton(runButton); coordinator.toggle(); } } }); resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { state = stopped; coordinator.stop(); root.setDefaultButton(runButton); surface.reset(); animation.reset(); elapsedTime = 0; time.setText("time: 0"); } }); randomizeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { state = stopped; coordinator.stop(); root.setDefaultButton(runButton); long v = surface.randomize(); animation.reset(); seed.setText("seed: " + v + " "); elapsedTime = 0; time.setText("time: 0"); } }); quitButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); // Put the buttons into the button panel: buttons.setLayout(new FlowLayout()); buttons.add(runButton); buttons.add(pauseButton); buttons.add(resetButton); buttons.add(randomizeButton); buttons.add(quitButton); // Put the labels into the statistics panel: stats.add(seed); stats.add(time); // Put the Surface canvas, the button panel, and the stats // label into the UI: setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(externalBorder, externalBorder, externalBorder, externalBorder)); add(A); add(buttons); add(stats); // Put the UI into the Frame: pane.getContentPane().add(this); root = getRootPane(); root.setDefaultButton(runButton); } }
[ "tcchu97@gmail.com" ]
tcchu97@gmail.com
b1ec86b9c0ec8caa2b8f16a20d2225f609d8e177
60ed365682f1af0a6712c897929e189604c7b80b
/Cosmo.Core/src/com/cosmo/ui/controls/FormControl.java
869cb13ed0eb4bc300678fae71266f873d18e533
[]
no_license
gllortc/cosmo-framework-java
88b1da6b72eec97f257e871ea3c12096978bcc15
ffd2a463ee33a296cd7a7d63d92118d087b1b2fa
refs/heads/master
2020-04-13T11:41:17.595067
2015-05-28T11:20:57
2015-05-28T11:20:57
32,355,224
0
0
null
null
null
null
ISO-8859-1
Java
false
false
21,676
java
package com.cosmo.ui.controls; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Iterator; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import com.cosmo.Cosmo; import com.cosmo.Workspace; import com.cosmo.orm.InvalidMappingException; import com.cosmo.orm.OrmFactory; import com.cosmo.orm.annotations.CormObject; import com.cosmo.orm.annotations.CormObjectField; import com.cosmo.ui.controls.FormButton.ButtonType; import com.cosmo.ui.templates.TemplateControl; import com.cosmo.util.FormData; import com.cosmo.util.StringUtils; /** * Implementa un formulario representable en una página de Cosmo. * * @author Gerard Llort */ public class FormControl extends Control { /** Control Type Unique ID */ private static final String CTUID = "CosmoUiCtrlForm"; private static final String CPART_HEADER = "form-head"; private static final String CPART_GROUP_HEADER = "form-fieldset-head"; private static final String CPART_FIELD_CONTROL = "form-control"; private static final String CPART_FIELD_OPTION = "form-option"; private static final String CPART_FIELD_TEXTAREA = "form-textarea"; private static final String CPART_GROUP_FOOTER = "form-fieldset-footer"; private static final String CPART_FOOTER = "form-footer"; private static final String CPART_BUTTONS = "form-buttons"; private static final String TAG_TITLE = "FTITLE"; private static final String TAG_DESCRIPTION = "FDESC"; private static final String TAG_CONTROL = "FCONTROL"; private static final String TAG_CONTROL_NAME = "CTRL-NAME"; private static final String TAG_LABEL = "FLABEL"; private static final String TAG_BUTTONS = "FBUTTONS"; private static final String TAG_FORM_NAME = "FNAME"; private static final String TAG_FORM_METHOD = "FMETHOD"; // Declaración de variables internas private String title; private String description; private String name; private String actionUrl; private boolean hasCaptcha; private ArrayList<FormFieldset> groups; private ArrayList<FormFieldHidden> hidden; private ArrayList<FormButton> buttons; //============================================== // Contructors //============================================== /** * Contructor de la clase {@link FormControl}. * * @param workspace Una instancia de {@link Workspace} que representa el espacio de aplicación actual. * @param id Identificador único del control en la página. */ public FormControl(Workspace workspace, String id) { super(workspace, id); initialize(); } //============================================== // Properties //============================================== /** * Devuelve un identificador único del tipo de control. */ @Override public String getControlTypeId() { return FormControl.CTUID; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getActionUrl() { return actionUrl; } public void setActionUrl(String actionUrl) { this.actionUrl = actionUrl; } /** * Indica si el formulario contiene un campo CAPTCHA. */ public boolean haveCaptcha() { return this.hasCaptcha; } //============================================== // Methods //============================================== /** * Agrega un nuevo grupo de campos al formulario. * * @param group Una instancia de {@link FormFieldset} que representa el grupo y que contiene los campos. */ public void addGroup(FormFieldset group) { // Agrega el grupo al formulario groups.add(group); } /** * Agrega un nuevo grupo de campos al formulario a partir de un clase Cosmo ORM. * * @param ormClass Una instancia de un objeto Cosmo ORM (CORM). * * @throws InvalidMappingException */ public void addGroup(Class<?> ormClass) throws InvalidMappingException { CormObject ct; CormObjectField cfg; FormFieldset group; // Comprueba que sea un objeto CORM ct = ormClass.getAnnotation(CormObject.class); if (ct == null) { throw new InvalidMappingException("No CormObject annotation detected on POJO class."); } // Obtiene las propiedades de la clase y las mapea al formulario this.name = ct.formName(); // Obtiene la lista de campos y los mapea a un grupo group = new FormFieldset(""); group.setTitle(ct.title()); group.setDescription(ct.description()); for (Method method : ormClass.getMethods()) { cfg = method.getAnnotation(CormObjectField.class); if (cfg != null && !cfg.isAutogenerated()) { if (cfg.fieldClass() == FormFieldText.class) { group.addField(new FormFieldText(cfg.dbTableColumn(), cfg.label())); } else if (cfg.fieldClass() == FormFieldTextArea.class) { group.addField(new FormFieldTextArea(cfg.dbTableColumn(), cfg.label())); } else if (cfg.fieldClass() == FormFieldInteger.class) { group.addField(new FormFieldInteger(cfg.dbTableColumn(), cfg.label())); } else if (cfg.fieldClass() == FormFieldNumber.class) { group.addField(new FormFieldNumber(cfg.dbTableColumn(), cfg.label())); } else if (cfg.fieldClass() == FormFieldDate.class) { group.addField(new FormFieldDate(cfg.dbTableColumn(), cfg.label())); } else if (cfg.fieldClass() == FormFieldBoolean.class) { group.addField(new FormFieldBoolean(cfg.dbTableColumn(), cfg.label())); } else if (cfg.fieldClass() == FormFieldList.class) { group.addField(new FormFieldList(cfg.dbTableColumn(), cfg.label(), getWorkspace().getProperties().getDataProperties().getDataList(cfg.list()))); } else if (cfg.fieldClass() == FormFieldCaptcha.class) { group.addField(new FormFieldCaptcha(cfg.dbTableColumn(), cfg.label())); } } } this.addGroup(group); // Agrega un botón de envio de datos this.addButton(new FormButton("cmdAcceopt", "Enviar", ButtonType.Submit)); } /** * Agrega un nuevo grupo de campos al formulario a partir de un clase Cosmo ORM. * * @param ormClass Una instancia de un objeto Cosmo ORM (CORM). * * @throws InvalidMappingException * @throws InvocationTargetException * @throws IllegalAccessException * @throws IllegalArgumentException */ public void addGroup(Object data) throws InvalidMappingException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { CormObject ct; CormObjectField cfg; FormFieldset group; // Comprueba si el objeto proporcionado es un objeto CORM válido if (!OrmFactory.isValidCormObject(data.getClass())) { throw new InvalidMappingException(data.getClass() + " is not a CORM object."); } // Obtiene las propiedades de la clase y las mapea al formulario ct = data.getClass().getAnnotation(CormObject.class); this.name = ct.formName(); // Obtiene la lista de campos y los mapea a un grupo group = new FormFieldset(""); group.setTitle(ct.title()); group.setDescription(ct.description()); for (Method method : data.getClass().getMethods()) { cfg = method.getAnnotation(CormObjectField.class); if (cfg != null && !cfg.isAutogenerated()) { if (cfg.fieldClass() == FormFieldText.class) { FormFieldText fld = new FormFieldText(cfg.dbTableColumn(), cfg.label()); fld.setValue(method.invoke(data)); group.addField(fld); } else if (cfg.fieldClass() == FormFieldTextArea.class) { FormFieldTextArea fld = new FormFieldTextArea(cfg.dbTableColumn(), cfg.label()); fld.setValue(method.invoke(data)); group.addField(fld); } else if (cfg.fieldClass() == FormFieldInteger.class) { FormFieldInteger fld = new FormFieldInteger(cfg.dbTableColumn(), cfg.label()); fld.setValue(method.invoke(data)); group.addField(fld); } else if (cfg.fieldClass() == FormFieldNumber.class) { FormFieldNumber fld = new FormFieldNumber(cfg.dbTableColumn(), cfg.label()); fld.setValue(method.invoke(data)); group.addField(fld); } else if (cfg.fieldClass() == FormFieldList.class) { FormFieldList fld = new FormFieldList(cfg.dbTableColumn(), cfg.label()); fld.setList(getWorkspace().getProperties().getDataProperties().getDataList(cfg.list())); fld.setValue(method.invoke(data)); group.addField(fld); } else if (cfg.fieldClass() == FormFieldBoolean.class) { FormFieldBoolean fld = new FormFieldBoolean(cfg.dbTableColumn(), cfg.label()); fld.setValue(method.invoke(data)); group.addField(fld); } else if (cfg.fieldClass() == FormFieldDate.class) { FormFieldDate fld = new FormFieldDate(cfg.dbTableColumn(), cfg.label()); fld.setValue(method.invoke(data)); group.addField(fld); } else if (cfg.fieldClass() == FormFieldCaptcha.class) { FormFieldCaptcha fld = new FormFieldCaptcha(cfg.dbTableColumn(), cfg.label()); fld.setValue(method.invoke(data)); group.addField(fld); } } } this.addGroup(group); // Agrega un botón de envio de datos this.addButton(new FormButton("cmdAcceopt", "Enviar", ButtonType.Submit)); } /** * Agrega un campo oculto al formulario. * * @param field Una instancia de {@link FormFieldHidden} que contiene los datos del campo. */ public void addHiddenValue(FormFieldHidden field) { hidden.add(field); } /** * Agrega un botón de control al formulario. * * @param button Una instancia de {@link FormButton} que contiene los datos del botón. */ public void addButton(FormButton button) { buttons.add(button); } /** * Actualiza el valor de un campo del formulario. * * @param name Nombre (único) del campo. * @param value Valor a establecer. * * @throws FieldNotFoundException */ public void setFieldValue(HttpServletRequest request, String name, String value) throws FieldNotFoundException { FormField field; FormData data = null; // Obtiene el contenedor de valores data = (FormData) request.getSession().getAttribute(this.getSessionControlDataKey()); // Si no estaba definido, lo crea if (data == null) { data = new FormData(this.getId()); } // Almacena el valor y se asegura que el campo exista for (FormFieldset group : this.groups) { Iterator<FormField> it = group.getFields(); while (it.hasNext()) { field = it.next(); if (field.getName().equals(name)) { data.addParameterValue(name, value); return; } } } // Si no ha encontrado el campo, lanza excepción throw new FieldNotFoundException(); } /** * Almacena los valores del formulario en la sesión del usuario. * * @param request Una instancia de {@link HttpServletRequest} que contiene el contexto de la llamada. * * @return Una instancia de {@link FormData} que contiene los datos del formulario. */ public FormData setFormValues(HttpServletRequest request) { FormField field; FormData data = new FormData(this.getId()); for (FormFieldset group : this.groups) { Iterator<FormField> it = group.getFields(); while (it.hasNext()) { field = it.next(); data.addParameterValue(field.getName(), request.getParameter(field.getName())); } } // Almacena los valores en la sessión request.getSession().setAttribute(this.getSessionControlDataKey(), data); return data; } /** * Renderiza el control y genera el código XHTML de representación. * * @return Devuelve una cadena en formato XHTML que representa el control. */ @Override public String render() { String xhtml; String xitem; FormField field; TemplateControl ctrl; Iterator<FormField> it; // Si no tiene grupos, no representa el control if (groups.isEmpty()) { return "<-- FormControl placeholder (void) -->\n"; } // Obtiene la plantilla y la parte del control ctrl = getWorkspace().getTemplate().getControl(FormControl.CTUID); // Genera la cabecera del formulario xhtml = ""; xitem = ctrl.getElement(CPART_HEADER); xitem = Control.replaceTag(xitem, TAG_TITLE, this.getTitle()); xitem = Control.replaceTag(xitem, TAG_DESCRIPTION, this.getDescription()); xitem = Control.replaceTag(xitem, TAG_FORM_NAME, this.getName()); xitem = Control.replaceTag(xitem, TAG_FORM_METHOD, "POST"); xhtml += xitem; for (FormFieldHidden hfield : this.hidden) { xhtml += hfield.render(getWorkspace()) + "\n"; } for (FormFieldset group : this.groups) { xitem = ctrl.getElement(CPART_GROUP_HEADER); xitem = Control.replaceTag(xitem, TAG_TITLE, group.getTitle()); xitem = Control.replaceTag(xitem, TAG_DESCRIPTION, group.getDescription()); xhtml += xitem; it = group.getFields(); while (it.hasNext()) { field = it.next(); if (field instanceof FormFieldText) { xitem = ctrl.getElement(CPART_FIELD_CONTROL); xitem = Control.replaceTag(xitem, TAG_CONTROL, field.render(getWorkspace())); xitem = Control.replaceTag(xitem, TAG_LABEL, ((FormFieldText) field).getLabel()); xitem = Control.replaceTag(xitem, TAG_DESCRIPTION, ((FormFieldText) field).getDescription()); xitem = Control.replaceTag(xitem, TAG_CONTROL_NAME, ((FormFieldText) field).getName()); xhtml += xitem; } else if (field instanceof FormFieldTextArea) { xitem = ctrl.getElement(CPART_FIELD_TEXTAREA); xitem = Control.replaceTag(xitem, TAG_CONTROL, field.render(getWorkspace())); xitem = Control.replaceTag(xitem, TAG_LABEL, ((FormFieldTextArea) field).getLabel()); xitem = Control.replaceTag(xitem, TAG_DESCRIPTION, ((FormFieldTextArea) field).getDescription()); xitem = Control.replaceTag(xitem, TAG_CONTROL_NAME, ((FormFieldTextArea) field).getName()); xhtml += xitem; } else if (field instanceof FormFieldInteger) { xitem = ctrl.getElement(CPART_FIELD_CONTROL); xitem = Control.replaceTag(xitem, TAG_CONTROL, field.render(getWorkspace())); xitem = Control.replaceTag(xitem, TAG_LABEL, ((FormFieldInteger) field).getLabel()); xitem = Control.replaceTag(xitem, TAG_DESCRIPTION, ((FormFieldInteger) field).getDescription()); xitem = Control.replaceTag(xitem, TAG_CONTROL_NAME, ((FormFieldInteger) field).getName()); xhtml += xitem; } else if (field instanceof FormFieldBoolean) { xitem = ctrl.getElement(CPART_FIELD_OPTION); xitem = Control.replaceTag(xitem, TAG_CONTROL, field.render(getWorkspace())); xitem = Control.replaceTag(xitem, TAG_LABEL, ((FormFieldBoolean) field).getLabel()); xitem = Control.replaceTag(xitem, TAG_DESCRIPTION, ((FormFieldBoolean) field).getDescription()); xitem = Control.replaceTag(xitem, TAG_CONTROL_NAME, ((FormFieldBoolean) field).getName()); xhtml += xitem; } else if (field instanceof FormFieldDate) { xitem = ctrl.getElement(CPART_FIELD_CONTROL); xitem = Control.replaceTag(xitem, TAG_CONTROL, field.render(getWorkspace())); xitem = Control.replaceTag(xitem, TAG_LABEL, ((FormFieldDate) field).getLabel()); xitem = Control.replaceTag(xitem, TAG_DESCRIPTION, ((FormFieldDate) field).getDescription()); xitem = Control.replaceTag(xitem, TAG_CONTROL_NAME, ((FormFieldDate) field).getName()); xhtml += xitem; } else if (field instanceof FormFieldList) { xitem = ctrl.getElement(CPART_FIELD_CONTROL); xitem = Control.replaceTag(xitem, TAG_CONTROL, field.render(getWorkspace())); xitem = Control.replaceTag(xitem, TAG_LABEL, ((FormFieldList) field).getLabel()); xitem = Control.replaceTag(xitem, TAG_DESCRIPTION, ((FormFieldList) field).getDescription()); xitem = Control.replaceTag(xitem, TAG_CONTROL_NAME, ((FormFieldList) field).getName()); xhtml += xitem; } } xitem = ctrl.getElement(CPART_GROUP_FOOTER); xhtml += xitem; } xitem = ctrl.getElement(CPART_BUTTONS); xitem = Control.replaceTag(xitem, TAG_BUTTONS, getButtonsXhtml(getWorkspace().getServerSession())); xhtml += xitem; xitem = ctrl.getElement(CPART_FOOTER); xitem = Control.replaceTag(xitem, TAG_FORM_NAME, this.name); xhtml += xitem; return xhtml; } /** * Convierte la instancia en una cadena de texto. */ @Override public String toString() { StringBuilder str = new StringBuilder(); str.append("<div id=\"").append(this.getId()).append("\">").append("\n"); str.append(" <h2>").append(this.title).append("</h2>").append("\n"); if (!this.title.equals("")) { str.append(" <p>").append(this.description).append("</p>").append("\n"); } str.append(" <form id=\"").append(this.name).append("\" name=\"").append(this.name).append("\" action=\"").append(this.actionUrl).append("\" method=\"post\">").append("\n"); for (FormFieldHidden field : this.hidden) { str.append(field.render(getWorkspace())).append("\n"); } for (FormFieldset group : this.groups) { str.append(group.render(getWorkspace())).append("\n"); } if (!this.buttons.isEmpty()) { str.append(" <div id=\"").append(this.getId()).append("btn\">").append("\n"); for (FormButton button : this.buttons) { str.append(button.render(getWorkspace())).append("\n"); } str.append(" </div>").append("\n"); } str.append(" </form>").append("\n"); str.append("</div>").append("\n"); return str.toString(); } //============================================== // Private members //============================================== /** * Inicializa la instancia. */ private void initialize() { this.title = StringUtils.EMPTY; this.description = StringUtils.EMPTY; this.name = StringUtils.EMPTY; this.actionUrl = StringUtils.EMPTY; this.hasCaptcha = false; this.groups = new ArrayList<FormFieldset>(); this.hidden = new ArrayList<FormFieldHidden>(); this.buttons = new ArrayList<FormButton>(); // Agrega un campo oculto con el indicador de envío de formulario (para detectar POSTs) this.hidden.add(new FormFieldHidden(Cosmo.KEY_UI_FORM_ACTION, Cosmo.TOKEN_UI_FORM_POSTBACK)); } /** * Obtiene el código XHTML correspondiente a los botones del formulario. */ private String getButtonsXhtml(HttpSession session) { String btns = StringUtils.EMPTY; for (FormButton button : this.buttons) { btns += button.render(getWorkspace()) + "&nbsp;&nbsp;"; } return btns; } }
[ "gllortc@gmail.com@aa0a416d-39ab-07c1-7aa7-9644586876c2" ]
gllortc@gmail.com@aa0a416d-39ab-07c1-7aa7-9644586876c2
840bfb135bfb21dc811e431f70e4049972118dd2
78856c64cf77742436d7a496b867f6c1b5267134
/src/main/java/fr/df/muscu/api/service/SerieService.java
c6a9857131b62e2cbc7e7e30c2dbb90a09a1dbde
[]
no_license
Marms/MuscuAPI
367ad9db7ce31869f531511e2186e3f7e98eea1e
67345b189c301f9fae301fe36f6117ba591fe7e8
refs/heads/master
2021-01-12T17:06:01.707876
2017-11-18T09:08:38
2017-11-18T09:08:38
71,498,760
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package fr.df.muscu.api.service; import java.util.List; import fr.df.muscu.api.model.Seance; import fr.df.muscu.api.model.Serie; /** * @author Florent */ public interface SerieService { Serie save(Serie se) ; List<Serie> list(); Serie find (Integer id); void delete(Serie serie); void delete(Integer id); }
[ "delmotteflorent@sfr.fr" ]
delmotteflorent@sfr.fr
cd2c11b2a009871b76522fc6809f2eb2d7eb1653
bc639d15bcc35b6e58f97ca02bee2dc66eba894b
/src/com/vmware/vim25/ArrayOfHostPortGroupPort.java
1358b3f57edf30c4ab64fb75db3248438a295109
[ "BSD-3-Clause" ]
permissive
benn-cs/vijava
db473c46f1a4f449e52611055781f9cfa921c647
14fd6b5d2f1407bc981b3c56433c30a33e8d74ab
refs/heads/master
2021-01-19T08:15:17.194988
2013-07-11T05:17:08
2013-07-11T05:17:08
7,495,841
1
0
null
null
null
null
UTF-8
Java
false
false
2,151
java
/*================================================================================ Copyright (c) 2012 Steve Jin. All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * 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. * Neither the name of VMware, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================================================*/ package com.vmware.vim25; /** * @author Steve Jin (http://www.doublecloud.org) * @version 5.1 */ public class ArrayOfHostPortGroupPort { public HostPortGroupPort[] HostPortGroupPort; public HostPortGroupPort[] getHostPortGroupPort() { return this.HostPortGroupPort; } public HostPortGroupPort getHostPortGroupPort(int i) { return this.HostPortGroupPort[i]; } public void setHostPortGroupPort(HostPortGroupPort[] HostPortGroupPort) { this.HostPortGroupPort=HostPortGroupPort; } }
[ "sjin2008@3374d856-466b-4dc9-8cc5-e1e8506a9ea1" ]
sjin2008@3374d856-466b-4dc9-8cc5-e1e8506a9ea1
a9d52687abbd2d511720081f6aab001e03de9564
473b21c8216f7c7c2c481e1e1df6a5d632236730
/app/src/main/java/com/zxb/xmap/remote/route/WalkRouteActivity.java
d7741eccba196e573d542185f4961bd4e4d0bd28
[]
no_license
somezhao1990/AMap3DDemo
cbdd0c21b307c7c1eeb34af6f07790d79dbb959a
018933827cfcf6df6a54bb5985b025434139687e
refs/heads/master
2021-01-20T16:50:38.428258
2017-06-01T23:56:31
2017-06-01T23:56:31
90,851,211
0
0
null
null
null
null
UTF-8
Java
false
false
7,911
java
package com.zxb.xmap.remote.route; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.RelativeLayout; import android.widget.TextView; import com.amap.api.maps.AMap; import com.amap.api.maps.AMap.InfoWindowAdapter; import com.amap.api.maps.AMap.OnInfoWindowClickListener; import com.amap.api.maps.AMap.OnMapClickListener; import com.amap.api.maps.AMap.OnMarkerClickListener; import com.amap.api.maps.MapView; import com.amap.api.maps.model.BitmapDescriptorFactory; import com.amap.api.maps.model.LatLng; import com.amap.api.maps.model.Marker; import com.amap.api.maps.model.MarkerOptions; import com.amap.api.services.core.AMapException; import com.amap.api.services.core.LatLonPoint; import com.amap.api.services.route.BusRouteResult; import com.amap.api.services.route.DriveRouteResult; import com.amap.api.services.route.RideRouteResult; import com.amap.api.services.route.RouteSearch; import com.amap.api.services.route.RouteSearch.OnRouteSearchListener; import com.amap.api.services.route.RouteSearch.WalkRouteQuery; import com.amap.api.services.route.WalkPath; import com.amap.api.services.route.WalkRouteResult; import com.zxb.xmap.remote.R; import com.zxb.xmap.remote.util.AMapUtil; import com.zxb.xmap.remote.util.ToastUtil; import overlay.WalkRouteOverlay; /** * 步行路径规划 示例 */ public class WalkRouteActivity extends Activity implements OnMapClickListener, OnMarkerClickListener, OnInfoWindowClickListener, InfoWindowAdapter, OnRouteSearchListener { private AMap aMap; private MapView mapView; private Context mContext; private RouteSearch mRouteSearch; private WalkRouteResult mWalkRouteResult; private LatLonPoint mStartPoint = new LatLonPoint(39.942295, 116.335891);//起点,116.335891,39.942295 private LatLonPoint mEndPoint = new LatLonPoint(39.995576, 116.481288);//终点,116.481288,39.995576 private final int ROUTE_TYPE_WALK = 3; private RelativeLayout mBottomLayout, mHeadLayout; private TextView mRotueTimeDes, mRouteDetailDes; private ProgressDialog progDialog = null;// 搜索时进度条 @Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.route_activity); mContext = this.getApplicationContext(); mapView = (MapView) findViewById(R.id.route_map); mapView.onCreate(bundle);// 此方法必须重写 init(); setfromandtoMarker(); searchRouteResult(ROUTE_TYPE_WALK, RouteSearch.WalkDefault); } private void setfromandtoMarker() { aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mStartPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.start))); aMap.addMarker(new MarkerOptions() .position(AMapUtil.convertToLatLng(mEndPoint)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.end))); } /** * 初始化AMap对象 */ private void init() { if (aMap == null) { aMap = mapView.getMap(); } registerListener(); mRouteSearch = new RouteSearch(this); mRouteSearch.setRouteSearchListener(this); mBottomLayout = (RelativeLayout) findViewById(R.id.bottom_layout); mHeadLayout = (RelativeLayout) findViewById(R.id.routemap_header); mHeadLayout.setVisibility(View.GONE); mRotueTimeDes = (TextView) findViewById(R.id.firstline); mRouteDetailDes = (TextView) findViewById(R.id.secondline); } /** * 注册监听 */ private void registerListener() { aMap.setOnMapClickListener(WalkRouteActivity.this); aMap.setOnMarkerClickListener(WalkRouteActivity.this); aMap.setOnInfoWindowClickListener(WalkRouteActivity.this); aMap.setInfoWindowAdapter(WalkRouteActivity.this); } @Override public View getInfoContents(Marker arg0) { // TODO Auto-generated method stub return null; } @Override public View getInfoWindow(Marker arg0) { // TODO Auto-generated method stub return null; } @Override public void onInfoWindowClick(Marker arg0) { // TODO Auto-generated method stub } @Override public boolean onMarkerClick(Marker arg0) { // TODO Auto-generated method stub return false; } @Override public void onMapClick(LatLng arg0) { // TODO Auto-generated method stub } /** * 开始搜索路径规划方案 */ public void searchRouteResult(int routeType, int mode) { if (mStartPoint == null) { ToastUtil.show(mContext, "定位中,稍后再试..."); return; } if (mEndPoint == null) { ToastUtil.show(mContext, "终点未设置"); } showProgressDialog(); final RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo( mStartPoint, mEndPoint); if (routeType == ROUTE_TYPE_WALK) {// 步行路径规划 WalkRouteQuery query = new WalkRouteQuery(fromAndTo, mode); mRouteSearch.calculateWalkRouteAsyn(query);// 异步路径规划步行模式查询 } } @Override public void onBusRouteSearched(BusRouteResult result, int errorCode) { } @Override public void onDriveRouteSearched(DriveRouteResult result, int errorCode) { } @Override public void onWalkRouteSearched(WalkRouteResult result, int errorCode) { dissmissProgressDialog(); aMap.clear();// 清理地图上的所有覆盖物 if (errorCode == AMapException.CODE_AMAP_SUCCESS) { if (result != null && result.getPaths() != null) { if (result.getPaths().size() > 0) { mWalkRouteResult = result; final WalkPath walkPath = mWalkRouteResult.getPaths() .get(0); WalkRouteOverlay walkRouteOverlay = new WalkRouteOverlay( this, aMap, walkPath, mWalkRouteResult.getStartPos(), mWalkRouteResult.getTargetPos()); walkRouteOverlay.removeFromMap(); walkRouteOverlay.addToMap(); walkRouteOverlay.zoomToSpan(); mBottomLayout.setVisibility(View.VISIBLE); int dis = (int) walkPath.getDistance(); int dur = (int) walkPath.getDuration(); String des = AMapUtil.getFriendlyTime(dur)+"("+AMapUtil.getFriendlyLength(dis)+")"; mRotueTimeDes.setText(des); mRouteDetailDes.setVisibility(View.GONE); mBottomLayout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(mContext, WalkRouteDetailActivity.class); intent.putExtra("walk_path", walkPath); intent.putExtra("walk_result", mWalkRouteResult); startActivity(intent); } }); } else if (result != null && result.getPaths() == null) { ToastUtil.show(mContext, R.string.no_result); } } else { ToastUtil.show(mContext, R.string.no_result); } } else { ToastUtil.showerror(this.getApplicationContext(), errorCode); } } /** * 显示进度框 */ private void showProgressDialog() { if (progDialog == null) progDialog = new ProgressDialog(this); progDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); progDialog.setIndeterminate(false); progDialog.setCancelable(true); progDialog.setMessage("正在搜索"); progDialog.show(); } /** * 隐藏进度框 */ private void dissmissProgressDialog() { if (progDialog != null) { progDialog.dismiss(); } } /** * 方法必须重写 */ @Override protected void onResume() { super.onResume(); mapView.onResume(); } /** * 方法必须重写 */ @Override protected void onPause() { super.onPause(); mapView.onPause(); } /** * 方法必须重写 */ @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mapView.onSaveInstanceState(outState); } /** * 方法必须重写 */ @Override protected void onDestroy() { super.onDestroy(); mapView.onDestroy(); } @Override public void onRideRouteSearched(RideRouteResult arg0, int arg1) { // TODO Auto-generated method stub } }
[ "赵锡彬" ]
赵锡彬
26549c821f6b5e4dc42d6e67161e40169c14b2e5
d13e942b46aeb2c88b726aa438b987770eaba116
/Development of online data-driven monitoring methodologies and piloting analytical and monitoring tools by the State Audit Service of Ukraine/Public Dashboard/Back-End/src/main/java/com/datapath/sasu/integration/prozorro/tendering/containers/AwardAPI.java
641f1516d6d64d7591e97c122c0692f5f0b76f19
[]
no_license
EBRD-ProzorroA7-RiskIndicators-SASU/Ukraine-Development-of-online-data-driven-monitoring-methodologies-and-piloting-analytical-tools
7f01956b454cfb8f2fa7821e713898068c3db81f
2a67c467c878e57f1ee81aef3b49f409bd8e2658
refs/heads/main
2023-06-18T23:18:28.367265
2021-07-13T18:22:10
2021-07-13T18:22:10
333,778,176
0
0
null
2021-01-28T14:09:57
2021-01-28T14:09:56
null
UTF-8
Java
false
false
200
java
package com.datapath.sasu.integration.prozorro.tendering.containers; import lombok.Data; @Data public class AwardAPI { private String id; private Value value; private String status; }
[ "eduard.david9@gmail.com" ]
eduard.david9@gmail.com
a338eedc0ce1543f423d6667ba615fadc16b9adf
7dc6bf17c5acc4a5755063a3ffc0c86f4b6ad8c3
/java_decompiled_from_smali/com/google/android/gms/maps/a/e.java
4dc9204d2be38289db8f9d80122cd8844410a864
[]
no_license
alecsandrudaj/mobileapp
183dd6dc5c2fe8ab3aa1f21495d4221e6f304965
b1b4ad337ec36ffb125df8aa1d04c759c33c418a
refs/heads/master
2023-02-19T18:07:50.922596
2021-01-07T15:30:44
2021-01-07T15:30:44
300,325,195
0
0
null
2020-11-19T13:26:25
2020-10-01T15:18:57
Smali
UTF-8
Java
false
false
15,018
java
package com.google.android.gms.maps.a; import android.location.Location; import android.os.Binder; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; import com.google.ads.AdSize; import com.google.android.gms.b.f; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.CircleOptions; import com.google.android.gms.maps.model.GroundOverlayOptions; import com.google.android.gms.maps.model.MarkerOptions; import com.google.android.gms.maps.model.PolygonOptions; import com.google.android.gms.maps.model.PolylineOptions; import com.google.android.gms.maps.model.TileOverlayOptions; import com.google.android.gms.maps.model.a.a; import com.google.android.gms.maps.model.a.g; import com.google.android.gms.maps.model.a.j; import com.google.android.gms.maps.model.a.m; import com.google.android.gms.maps.model.a.p; import com.google.android.gms.maps.model.a.s; public abstract class e extends Binder implements d { public static d a(IBinder iBinder) { if (iBinder == null) { return null; } IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); return (queryLocalInterface == null || !(queryLocalInterface instanceof d)) ? new f(iBinder) : (d) queryLocalInterface; } public boolean onTransact(int i, Parcel parcel, Parcel parcel2, int i2) { boolean z = false; IBinder iBinder = null; float b; int f; boolean g; switch (i) { case com.google.android.gms.e.MapAttrs_cameraBearing /*1*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); CameraPosition a = a(); parcel2.writeNoException(); if (a != null) { parcel2.writeInt(1); a.writeToParcel(parcel2, 1); return true; } parcel2.writeInt(0); return true; case com.google.android.gms.e.MapAttrs_cameraTargetLat /*2*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); b = b(); parcel2.writeNoException(); parcel2.writeFloat(b); return true; case com.google.android.gms.e.MapAttrs_cameraTargetLng /*3*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); b = c(); parcel2.writeNoException(); parcel2.writeFloat(b); return true; case com.google.android.gms.e.MapAttrs_cameraTilt /*4*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(f.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case com.google.android.gms.e.MapAttrs_cameraZoom /*5*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); b(f.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case com.google.android.gms.e.MapAttrs_uiCompass /*6*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(f.a(parcel.readStrongBinder()), x.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case com.google.android.gms.e.MapAttrs_uiRotateGestures /*7*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(f.a(parcel.readStrongBinder()), parcel.readInt(), x.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case com.google.android.gms.e.MapAttrs_uiScrollGestures /*8*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); d(); parcel2.writeNoException(); return true; case com.google.android.gms.e.MapAttrs_uiTiltGestures /*9*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a a2 = a(parcel.readInt() != 0 ? PolylineOptions.CREATOR.createFromParcel(parcel) : null); parcel2.writeNoException(); if (a2 != null) { iBinder = a2.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case com.google.android.gms.e.MapAttrs_uiZoomControls /*10*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); p a3 = a(parcel.readInt() != 0 ? PolygonOptions.CREATOR.createFromParcel(parcel) : null); parcel2.writeNoException(); if (a3 != null) { iBinder = a3.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case com.google.android.gms.e.MapAttrs_uiZoomGestures /*11*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); m a4 = a(parcel.readInt() != 0 ? MarkerOptions.CREATOR.createFromParcel(parcel) : null); parcel2.writeNoException(); if (a4 != null) { iBinder = a4.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case com.google.android.gms.e.MapAttrs_useViewLifecycle /*12*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); j a5 = a(parcel.readInt() != 0 ? GroundOverlayOptions.CREATOR.createFromParcel(parcel) : null); parcel2.writeNoException(); if (a5 != null) { iBinder = a5.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case com.google.android.gms.e.MapAttrs_zOrderOnTop /*13*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); s a6 = a(parcel.readInt() != 0 ? TileOverlayOptions.CREATOR.createFromParcel(parcel) : null); parcel2.writeNoException(); if (a6 != null) { iBinder = a6.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case 14: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); e(); parcel2.writeNoException(); return true; case 15: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); f = f(); parcel2.writeNoException(); parcel2.writeInt(f); return true; case 16: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(parcel.readInt()); parcel2.writeNoException(); return true; case 17: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); g = g(); parcel2.writeNoException(); if (g) { f = 1; } parcel2.writeInt(f); return true; case 18: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); if (parcel.readInt() != 0) { z = true; } a(z); parcel2.writeNoException(); return true; case 19: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); g = h(); parcel2.writeNoException(); if (g) { f = 1; } parcel2.writeInt(f); return true; case 20: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); g = b(parcel.readInt() != 0); parcel2.writeNoException(); if (g) { f = 1; } parcel2.writeInt(f); return true; case 21: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); g = i(); parcel2.writeNoException(); if (g) { f = 1; } parcel2.writeInt(f); return true; case 22: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); if (parcel.readInt() != 0) { z = true; } c(z); parcel2.writeNoException(); return true; case 23: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); Location j = j(); parcel2.writeNoException(); if (j != null) { parcel2.writeInt(1); j.writeToParcel(parcel2, 1); return true; } parcel2.writeInt(0); return true; case 24: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(h.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 25: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); s k = k(); parcel2.writeNoException(); if (k != null) { iBinder = k.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case 26: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); p l = l(); parcel2.writeNoException(); if (l != null) { iBinder = l.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case 27: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(ag.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 28: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(ap.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 29: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(as.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 30: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(av.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 31: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(ay.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case AdSize.LANDSCAPE_AD_HEIGHT /*32*/: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(aj.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 33: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(ad.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 34: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); com.google.android.gms.b.e m = m(); parcel2.writeNoException(); if (m != null) { iBinder = m.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case 35: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); g a7 = a(parcel.readInt() != 0 ? CircleOptions.CREATOR.createFromParcel(parcel) : null); parcel2.writeNoException(); if (a7 != null) { iBinder = a7.asBinder(); } parcel2.writeStrongBinder(iBinder); return true; case 36: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(be.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 37: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(bb.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 38: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(bh.a(parcel.readStrongBinder()), f.a(parcel.readStrongBinder())); parcel2.writeNoException(); return true; case 39: parcel.enforceInterface("com.google.android.gms.maps.internal.IGoogleMapDelegate"); a(parcel.readInt(), parcel.readInt(), parcel.readInt(), parcel.readInt()); parcel2.writeNoException(); return true; case 1598968902: parcel2.writeString("com.google.android.gms.maps.internal.IGoogleMapDelegate"); return true; default: return super.onTransact(i, parcel, parcel2, i2); } } }
[ "rgosa@bitdefender.com" ]
rgosa@bitdefender.com
3ebee193c6d8687a4974fab63c55afa1d385267a
7bdef87f254d832513226328115eb0058bf24258
/NorthPeopleJob/src/com/hyd/northpj/service/interfaces/AnalysisServiceInterface.java
bfcb43979f2071e8d10cefd8bb2e12b29310661b
[]
no_license
NPeopleGroup/NRPeople
421fa55508982714a0f918ecff12e416b6c3f2ce
48b95f9370caf92ceedf0d72fbce800b64cd8740
refs/heads/master
2021-01-13T01:44:43.364515
2015-07-07T10:25:01
2015-07-07T10:25:01
35,520,660
1
0
null
null
null
null
GB18030
Java
false
false
1,098
java
package com.hyd.northpj.service.interfaces; import java.util.ArrayList; import java.util.Date; import com.hyd.northpj.entity.User; public interface AnalysisServiceInterface { /** * 查询时间段内的一组用户 * * @param beginDate * @param endDate * @return 一组用户 * @throws Exception */ public ArrayList<User> getUserList(Date beginDate, Date endDate) throws Exception; /** * 查询时间段内的用户的得分情况 * * @param beginDate * @param endDate * @return 得分情况(一组<分数,成绩>对,例如:120,11,125,8,130,4) * @throws Exception */ public ArrayList<String> analyzeUsersByScore(Date beginDate, Date endDate) throws Exception; /** * 查询时间段内的用户的办理进度情况 * * @param beginDate * @param endDate * @return 进度情况(一组<进度,成绩>对,例如:申请,11,正在办理,8,成功,4) * @throws Exception */ public ArrayList<String> analyzeUsersByProgress(Date beginDate, Date endDate) throws Exception; }
[ "xiangyanglai@126.com" ]
xiangyanglai@126.com
c4b6c9039d7a154e5476546da594d1d74cd601b0
3183c6de4ab409c03043b1c9c131313e3d542ce6
/app/src/main/java/com/serloman/popularmovies/movieDetails/FullMovieDetailsFragment.java
a0e6536bfd5d530a376906fd3e4fc96a1e4a1c57
[]
no_license
Serloman/Android-Developer-Nanodegree-Project-2-Popular-Movies-P2
d5721fc13206781fe13ccee39819c013d5c26f18
bf23010c99044a9f8381f5faaabc0a7266a0b3a3
refs/heads/master
2021-01-01T16:29:38.858530
2015-07-30T21:35:44
2015-07-30T21:35:44
39,721,677
3
0
null
null
null
null
UTF-8
Java
false
false
2,236
java
package com.serloman.popularmovies.movieDetails; import android.os.Bundle; import android.os.Parcelable; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.serloman.popularmovies.R; import com.serloman.popularmovies.cast.CastFragment; import com.serloman.popularmovies.models.ParcelableDiscoverMovie; import com.serloman.popularmovies.reviews.ReviewsFragment; import com.serloman.themoviedb_api.models.Movie; /** * Created by Serloman on 28/07/2015. */ public class FullMovieDetailsFragment extends Fragment { public final static String ARG_MOVIE = "ARG_MOVIE"; public static FullMovieDetailsFragment newInstance(Movie movie){ FullMovieDetailsFragment fragment = new FullMovieDetailsFragment(); Bundle args = new Bundle(); args.putParcelable(ARG_MOVIE, new ParcelableDiscoverMovie(movie)); fragment.setArguments(args); return fragment; } public FullMovieDetailsFragment() { } @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.full_movie_fragment, container, false); return rootView; } @Override public void onStart() { super.onStart(); initDetails(); initCast(); initReviews(); } private void initDetails(){ MovieDetailsFragment details = MovieDetailsFragment.newInstance(getMovie()); updateFragment(details, R.id.fullMovieDetails); } private void initReviews(){ ReviewsFragment reviews = ReviewsFragment.newInstance(getMovie()); updateFragment(reviews, R.id.fullMovieReviews); } private void initCast(){ CastFragment cast = CastFragment.newInstance(getMovie()); updateFragment(cast, R.id.fullMovieCast); } private void updateFragment(Fragment fragment, int layoutId){ getChildFragmentManager().beginTransaction().replace(layoutId, fragment).commit(); } private Movie getMovie(){ return getArguments().getParcelable(ARG_MOVIE); } }
[ "serloman@gmail.com" ]
serloman@gmail.com
922820e59960793bcf9dcced84cb1daad91f6a6c
bbca12983a7c9559dd69af5376c8e4c9f5bfbe65
/app/src/main/java/kz/rzaripov/ps_client/json_class/get_domains_list_answer.java
e725944095d56d9b113dd092cf6c57b6e4729d7f
[]
no_license
rzaripov1990/ps_client
ee4780721be27c3f822d47fcf90416f2e337b57f
4d3fb48453d495ef822f0a8507f3a0214ab13caf
refs/heads/master
2021-05-15T07:47:12.545264
2017-11-04T17:12:00
2017-11-04T17:12:00
109,512,362
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
package kz.rzaripov.ps_client.json_class; /** * Created by ZuBy on 29.10.2017. */ public class get_domains_list_answer { public String domain; public String expirydate; public String status; }
[ "rzaripov1990@gmail.com" ]
rzaripov1990@gmail.com
ce3ad9318857517e469b2b368babe009799644e4
dda81b93a12e0695dc1c85a6a8ca3785f2e36e23
/spigot/work/decompile-93a89a75/net/minecraft/server/BiomeJungle.java
d6bbb01a949ee23aef6c0bb928819cced68209fa
[]
no_license
skychwang/MindCraft
a4a8a337738b884af6ecc65c133b314418757a7d
48923ed1c2b9fbc807a61619cc17001312082b83
refs/heads/master
2023-07-20T14:36:48.872240
2021-09-07T20:00:04
2021-09-07T20:00:04
336,148,107
2
0
null
null
null
null
UTF-8
Java
false
false
2,962
java
package net.minecraft.server; public final class BiomeJungle extends BiomeBase { public BiomeJungle() { super((new BiomeBase.a()).a(WorldGenSurface.G, WorldGenSurface.v).a(BiomeBase.Precipitation.RAIN).a(BiomeBase.Geography.JUNGLE).a(0.1F).b(0.2F).c(0.95F).d(0.9F).a(4159204).b(329011).a((String) null)); this.a(WorldGenerator.JUNGLE_TEMPLE, (WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.e); this.a(WorldGenerator.MINESHAFT, (WorldGenFeatureConfiguration) (new WorldGenMineshaftConfiguration(0.004D, WorldGenMineshaft.Type.NORMAL))); this.a(WorldGenerator.STRONGHOLD, (WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.e); BiomeDecoratorGroups.a(this); BiomeDecoratorGroups.c(this); BiomeDecoratorGroups.d(this); BiomeDecoratorGroups.f(this); BiomeDecoratorGroups.g(this); BiomeDecoratorGroups.h(this); BiomeDecoratorGroups.l(this); BiomeDecoratorGroups.r(this); BiomeDecoratorGroups.C(this); BiomeDecoratorGroups.V(this); BiomeDecoratorGroups.I(this); BiomeDecoratorGroups.Z(this); BiomeDecoratorGroups.aa(this); BiomeDecoratorGroups.am(this); BiomeDecoratorGroups.ac(this); BiomeDecoratorGroups.ap(this); this.a(EnumCreatureType.CREATURE, new BiomeBase.BiomeMeta(EntityTypes.SHEEP, 12, 4, 4)); this.a(EnumCreatureType.CREATURE, new BiomeBase.BiomeMeta(EntityTypes.PIG, 10, 4, 4)); this.a(EnumCreatureType.CREATURE, new BiomeBase.BiomeMeta(EntityTypes.CHICKEN, 10, 4, 4)); this.a(EnumCreatureType.CREATURE, new BiomeBase.BiomeMeta(EntityTypes.COW, 8, 4, 4)); this.a(EnumCreatureType.CREATURE, new BiomeBase.BiomeMeta(EntityTypes.PARROT, 40, 1, 2)); this.a(EnumCreatureType.CREATURE, new BiomeBase.BiomeMeta(EntityTypes.PANDA, 1, 1, 2)); this.a(EnumCreatureType.CREATURE, new BiomeBase.BiomeMeta(EntityTypes.CHICKEN, 10, 4, 4)); this.a(EnumCreatureType.AMBIENT, new BiomeBase.BiomeMeta(EntityTypes.BAT, 10, 8, 8)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.SPIDER, 100, 4, 4)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.ZOMBIE, 95, 4, 4)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.ZOMBIE_VILLAGER, 5, 1, 1)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.SKELETON, 100, 4, 4)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.CREEPER, 100, 4, 4)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.SLIME, 100, 4, 4)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.ENDERMAN, 10, 1, 4)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.WITCH, 5, 1, 1)); this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.OCELOT, 2, 1, 1)); } }
[ "sky.wang@yahoo.com" ]
sky.wang@yahoo.com
1bb31edf27df7a1d3ecc5ea3759f7584196f650f
010bba12ba3beec185f8344cdd90a3f88c92fb58
/programmers/src/level2/VisitLength2.java
f92d9e7e6ed755b6de4eef33bca7193bfa392d83
[]
no_license
SongHae8640/Algorithm
993ffbf7b4a5806c7b2246c3b519499c6126b923
ecb8c12d07c559e699b89e8a6c0f07013e13bcb3
refs/heads/master
2022-02-13T01:00:57.996835
2022-01-17T23:34:39
2022-01-17T23:34:39
221,455,578
0
0
null
null
null
null
UTF-8
Java
false
false
2,497
java
package level2; public class VisitLength2 { public int solution(String dirs) { //격자판 - xy 축이 모두 짝수이면 점, 둘중 하나만 짝수이면 선 //지나간 선은 1, 지나가지 않은 선은 0 int [][] gridPlate = new int[21][21]; int xAxis = 10; int yAxis = 10; for (int i = 0 ; i <dirs.length() ; i++){ char command = dirs.charAt(i); if((command =='U') && (yAxis + 2 <= 20)){ //위로 이동 gridPlate[xAxis][yAxis+1]++; yAxis+=2; }else if((command =='D') && (yAxis -2 >= 0)){ //아래로 이동 gridPlate[xAxis][yAxis-1]++; yAxis-=2; }else if((command =='R') && (xAxis +2 <= 20)){ //오른쪽으로 이동 gridPlate[xAxis+1][yAxis]++;; xAxis+=2; }else if ((command =='L') && (xAxis -2 >= 0)){ //왼쪽으로 이동 gridPlate[xAxis-1][yAxis]++; xAxis-=2; } } return getLineCount(gridPlate); } private int getLineCount(int[][] gridPlate) { int lineCount = 0; for (int x = 0 ; x < gridPlate.length ; x++){ for(int y = 0 ; y < gridPlate[x].length ; y++ ){ if(gridPlate[x][y] != 0){ lineCount++; } } } return lineCount; } } /** * * 방문 길이 * https://programmers.co.kr/learn/courses/30/lessons/49994 * * 정확성 테스트 * 테스트 1 〉 통과 (0.05ms, 74.3MB) * 테스트 2 〉 통과 (0.05ms, 76.9MB) * 테스트 3 〉 통과 (0.05ms, 79MB) * 테스트 4 〉 통과 (0.06ms, 73.5MB) * 테스트 5 〉 통과 (0.08ms, 75.5MB) * 테스트 6 〉 통과 (0.06ms, 70MB) * 테스트 7 〉 통과 (0.05ms, 78.4MB) * 테스트 8 〉 통과 (0.06ms, 77.4MB) * 테스트 9 〉 통과 (0.03ms, 77.3MB) * 테스트 10 〉 통과 (0.04ms, 68.7MB) * 테스트 11 〉 통과 (0.03ms, 74MB) * 테스트 12 〉 통과 (0.05ms, 73.6MB) * 테스트 13 〉 통과 (0.06ms, 77.7MB) * 테스트 14 〉 통과 (0.05ms, 75.2MB) * 테스트 15 〉 통과 (0.04ms, 73.7MB) * 테스트 16 〉 통과 (0.08ms, 76.5MB) * 테스트 17 〉 통과 (0.08ms, 70.6MB) * 테스트 18 〉 통과 (0.07ms, 72.1MB) * 테스트 19 〉 통과 (0.11ms, 84.7MB) * 테스트 20 〉 통과 (0.08ms, 74.8MB) * 채점 결과 * 정확성: 100.0 * 합계: 100.0 / 100.0 * * */
[ "thdgo456@gmail.com" ]
thdgo456@gmail.com
941d089975f5f7037cb65d6f094de73984ce59c3
52fb067b0f2a2efd03058755ff8d2659f8290ac2
/app/src/main/java/android_network/hetnet/vpn_service/ServiceTileFilter.java
da0d8424db2231aeb9cd1b2e1e7b5f752d113f0e
[]
no_license
lanking520/HetNet
31fa1924b515089b92d896633ce11fbbab64878e
43287340e53570daf69c64505e86ecffa6b64178
refs/heads/master
2021-01-12T01:18:02.299211
2017-05-14T22:15:52
2017-05-14T22:15:52
70,446,041
0
0
null
2016-10-10T02:48:00
2016-10-10T02:47:59
null
UTF-8
Java
false
false
2,619
java
package android_network.hetnet.vpn_service; /* This file is part of NetGuard. NetGuard is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NetGuard 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 NetGuard. If not, see <http://www.gnu.org/licenses/>. Copyright 2015-2017 by Marcel Bokhorst (M66B) */ import android.annotation.TargetApi; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.preference.PreferenceManager; import android.service.quicksettings.Tile; import android.service.quicksettings.TileService; import android.util.Log; @TargetApi(Build.VERSION_CODES.N) public class ServiceTileFilter extends TileService implements SharedPreferences.OnSharedPreferenceChangeListener { private static final String TAG = "NetGuard.TileFilter"; public void onStartListening() { Log.i(TAG, "Start listening"); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.registerOnSharedPreferenceChangeListener(this); update(); } @Override public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if ("filter".equals(key)) update(); } private void update() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean filter = prefs.getBoolean("filter", false); Tile tile = getQsTile(); if (tile != null) { tile.setState(filter ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE); tile.updateTile(); } } public void onStopListening() { Log.i(TAG, "Stop listening"); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.unregisterOnSharedPreferenceChangeListener(this); } public void onClick() { Log.i(TAG, "Click"); if (true) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); prefs.edit().putBoolean("filter", !prefs.getBoolean("filter", false)).apply(); ServiceSinkhole.reload("tile", this); } } }
[ "lanking520@gmail.com" ]
lanking520@gmail.com
27718b04c0cb868151d7b9025b1cc95f135723f9
562112f15c396095bf6a54a197980449def5848b
/src/main/java/com/agile/dao/interfaces/UserGroupDao.java
4a8bb79bb435490d496b9cb54aac5df074d4f1c1
[ "Apache-2.0" ]
permissive
xuanspace/SpringAgile
52507c7610554a47eeba0e83d8a2b70b94eeb28e
f4adacd93a305498d4b9102280c87c36bd5be8dc
refs/heads/master
2021-09-13T13:21:12.487488
2018-04-30T15:01:22
2018-04-30T15:01:22
115,268,268
0
0
null
null
null
null
UTF-8
Java
false
false
300
java
/* * Copyright (C) 2016-2017 Spring Agile. All rights reserved. * Licensed under the Apache License, Version 2.0 */ package com.agile.dao.interfaces; import com.agile.model.UserGroup; import com.agile.framework.persistence.IBaseDao; public interface UserGroupDao extends IBaseDao<UserGroup>{ }
[ "linweixuan@gmail.com" ]
linweixuan@gmail.com
474874d8e15c6cbc917496ea9d21d6e99eea519d
de9c5d5a1dee46b3c18883a836e132e6dccdeedd
/src/main/java/Repositories/VehiculoRepository.java
42c283d9d014ac4c7d555996b4ae949284ab8c80
[]
no_license
sbbruno17/javaTest
7009ae26bbff309c716a3361ab60106d7847b0e5
5d6e0cc18f82685d33610a701ca5c01aa550a409
refs/heads/master
2022-11-27T17:00:34.011072
2020-08-07T13:13:06
2020-08-07T13:13:06
285,833,734
0
0
null
null
null
null
UTF-8
Java
false
false
63
java
package Repositories; public interface VehiculoRepository { }
[ "bbruno.sgb@gmail.com" ]
bbruno.sgb@gmail.com
5b7137a7e8ab9b91823c107987d13314b2cf10d3
b2d511ddbcf00140a87c7afe6fac9640502bd1e3
/application/model/src/main/java/by/vbalanse/model/psychologist/WithWhomWorks.java
64dd479a1862701d575f3afffa88827b36949d5a
[]
no_license
vasilinka/vbalanse
b6b9296ad78a2eeed02262b908beef98591438d2
a33c17c8a249b9b8ad6c3f55fdc84a5a5dd6d9ec
refs/heads/master
2021-09-03T04:39:03.478807
2018-01-05T16:26:29
2018-01-05T16:26:29
114,117,396
0
2
null
2017-12-29T08:07:38
2017-12-13T12:21:35
JavaScript
UTF-8
Java
false
false
1,122
java
package by.vbalanse.model.psychologist; import by.vbalanse.model.common.AbstractManagedEntity; import javax.persistence.Column; import javax.persistence.Entity; import javax.validation.constraints.NotNull; /** * writeme: Should be the description of the class * * @author <a href="v.terehova@itision.com">Vasilina Terehova</a> */ @Entity(name = WithWhomWorks.TABLE_NAME) public class WithWhomWorks extends AbstractManagedEntity { public static final String TABLE_NAME = "psy_personal_threrapy_name"; private static final String COLUMN_TITLE = "title_"; private static final String COLUMN_CODE = "code_"; @NotNull @Column(name = COLUMN_TITLE) private String title; @NotNull @Column(name = COLUMN_CODE) private String code; public WithWhomWorks() { } public WithWhomWorks(String title, String code) { this.title = title; this.code = code; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } }
[ "4vasilinka@gmail.com" ]
4vasilinka@gmail.com
82eb491ea2801b43b7419eab3712fe5e7feb2c10
2e7fae5a260e8a8718f3ae11a837fbc576eaf4f2
/src/animals/utils/Inputer.java
2e05ee014c73798b035c8bc14ac2cd421d08ee9c
[]
no_license
ksnortum/guess-the-animal
cc78abed5b75e2fe505d26bd7544985b15c82636
0f0df5c3ac4bb6b895efe0fe14e680163d1c8ca8
refs/heads/main
2023-03-13T04:34:12.619892
2021-03-08T22:18:28
2021-03-08T22:18:28
345,696,394
0
0
null
null
null
null
UTF-8
Java
false
false
1,517
java
package animals.utils; import java.util.*; public class Inputer { private static final Scanner SCANNER = new Scanner(System.in); private static final Random random = new Random(); private static final ResourceBundle messagesBundle = PropertiesUtils.getMessagesBundle(); private static final List<String> clarifyingPhrase = Arrays.asList(messagesBundle.getString("ask.again").split("\f")); public static String nextString(String prompt, boolean useLineSeparator) { if (!prompt.isBlank()) { if (useLineSeparator) { prompt = String.format("%s%n", prompt); } System.out.print(prompt); } return SCANNER.nextLine(); } public static String nextString(String prompt) { return nextString(prompt, true); } public static boolean nextYesNo(String prompt) { String response = nextString(prompt); while(!LanguageRules.isYes(response) && !LanguageRules.isNo(response)) { prompt = clarifyingPhrase.get(random.nextInt(clarifyingPhrase.size())); response = nextString(prompt); } return LanguageRules.isYes(response); } public static void pause(String prompt) { nextString(prompt); } public static int nextInt(String prompt) { if (!prompt.isBlank()) { System.out.print(prompt); } int response = SCANNER.nextInt(); SCANNER.nextLine(); return response; } }
[ "knute@snortum.net" ]
knute@snortum.net
bb88811d381f303e706b699a99d7f012a9a384ba
7f3376d74b84ca55d9a9f52c641aca9b52a8ffc6
/cas_paste/src/main/java/org/jasig/cas/ticket/registry/support/JpaLockingStrategy.java
2814342fcd5bd2056aff01c325e33d00e8eea7f5
[]
no_license
iswangyj/casserver
4027376ffd70fd167566cc9dae27cb0ac100dd84
1773b1cbbe027c1dfc25781cb8d7196975dcd7bb
refs/heads/master
2020-03-30T01:41:21.691250
2018-09-27T13:35:52
2018-09-27T13:35:52
150,588,014
0
0
null
null
null
null
UTF-8
Java
false
false
5,883
java
package org.jasig.cas.ticket.registry.support; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.transaction.annotation.Transactional; import javax.persistence.*; import javax.validation.constraints.NotNull; import java.util.Calendar; import java.util.Date; /** * @author SxL * Created on 9/25/2018 4:56 PM. */ public class JpaLockingStrategy implements LockingStrategy { public static final int DEFAULT_LOCK_TIMEOUT = 3600; @NotNull @PersistenceContext protected EntityManager entityManager; private final Logger logger = LoggerFactory.getLogger(this.getClass()); @NotNull private String applicationId; @NotNull private String uniqueId; private int lockTimeout = 3600; public JpaLockingStrategy() { } public void setApplicationId(String id) { this.applicationId = id; } public void setUniqueId(String id) { this.uniqueId = id; } public void setLockTimeout(int seconds) { if (seconds < 0) { throw new IllegalArgumentException("Lock timeout must be non-negative."); } else { this.lockTimeout = seconds; } } @Transactional( readOnly = false ) @Override public boolean acquire() { JpaLockingStrategy.Lock lock; try { lock = (JpaLockingStrategy.Lock)this.entityManager.find(JpaLockingStrategy.Lock.class, this.applicationId, LockModeType.PESSIMISTIC_WRITE); } catch (PersistenceException var4) { this.logger.debug("{} failed querying for {} lock.", new Object[]{this.uniqueId, this.applicationId, var4}); return false; } boolean result = false; if (lock != null) { Date expDate = lock.getExpirationDate(); if (lock.getUniqueId() == null) { this.logger.debug("{} trying to acquire {} lock.", this.uniqueId, this.applicationId); result = this.acquire(this.entityManager, lock); } else if (expDate != null && (new Date()).after(expDate)) { this.logger.debug("{} trying to acquire expired {} lock.", this.uniqueId, this.applicationId); result = this.acquire(this.entityManager, lock); } } else { this.logger.debug("Creating {} lock initially held by {}.", this.applicationId, this.uniqueId); result = this.acquire(this.entityManager, new JpaLockingStrategy.Lock()); } return result; } @Transactional( readOnly = false ) @Override public void release() { JpaLockingStrategy.Lock lock = (JpaLockingStrategy.Lock)this.entityManager.find(JpaLockingStrategy.Lock.class, this.applicationId, LockModeType.PESSIMISTIC_WRITE); if (lock != null) { String owner = lock.getUniqueId(); if (this.uniqueId.equals(owner)) { lock.setUniqueId((String)null); lock.setExpirationDate((Date)null); this.logger.debug("Releasing {} lock held by {}.", this.applicationId, this.uniqueId); this.entityManager.persist(lock); } else { throw new IllegalStateException("Cannot release lock owned by " + owner); } } } @Transactional( readOnly = true ) public String getOwner() { JpaLockingStrategy.Lock lock = (JpaLockingStrategy.Lock)this.entityManager.find(JpaLockingStrategy.Lock.class, this.applicationId); return lock != null ? lock.getUniqueId() : null; } @Override public String toString() { return this.uniqueId; } private boolean acquire(EntityManager em, JpaLockingStrategy.Lock lock) { lock.setUniqueId(this.uniqueId); if (this.lockTimeout > 0) { Calendar cal = Calendar.getInstance(); cal.add(13, this.lockTimeout); lock.setExpirationDate(cal.getTime()); } else { lock.setExpirationDate((Date)null); } boolean success = false; try { if (lock.getApplicationId() != null) { em.merge(lock); } else { lock.setApplicationId(this.applicationId); em.persist(lock); } success = true; } catch (PersistenceException var5) { success = false; if (this.logger.isDebugEnabled()) { this.logger.debug("{} could not obtain {} lock.", new Object[]{this.uniqueId, this.applicationId, var5}); } else { this.logger.info("{} could not obtain {} lock.", this.uniqueId, this.applicationId); } } return success; } @Entity @Table( name = "locks" ) public static class Lock { @Id @Column( name = "application_id" ) private String applicationId; @Column( name = "unique_id" ) private String uniqueId; @Temporal(TemporalType.TIMESTAMP) @Column( name = "expiration_date" ) private Date expirationDate; public Lock() { } public String getApplicationId() { return this.applicationId; } public void setApplicationId(String applicationId) { this.applicationId = applicationId; } public String getUniqueId() { return this.uniqueId; } public void setUniqueId(String uniqueId) { this.uniqueId = uniqueId; } public Date getExpirationDate() { return this.expirationDate; } public void setExpirationDate(Date expirationDate) { this.expirationDate = expirationDate; } } }
[ "iswangyj@yeah.net" ]
iswangyj@yeah.net
c058500808e35950de37b274ab155a6c42a8a5fe
f3ec3cf39e7087cde4715a29283893f4144974eb
/src/main/java/rest/App.java
f61b8479e4f25a5772ad68fcb6ad1ce5ed4e3f91
[]
no_license
luke-c/RentalCarsCodingTest
10b85aa5e26e20f6ed8c26ac8fe3a25a9a76be48
4563a04955608c14f836c785105bf5ca2580e713
refs/heads/master
2021-01-20T03:12:33.296403
2017-04-26T17:45:00
2017-04-26T17:45:00
89,509,493
0
0
null
null
null
null
UTF-8
Java
false
false
2,458
java
package rest; import java.io.IOException; import java.net.InetSocketAddress; import java.net.URI; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.ext.RuntimeDelegate; import com.sun.net.httpserver.HttpHandler; import com.sun.net.httpserver.HttpServer; /** * Created by luke_c on 26/04/2017. */ // Code taken from https://github.com/jersey/jersey/tree/2.24/examples/helloworld-pure-jax-rs public class App { static HttpServer startServer() throws IOException { // create a new server listening at port 8080 final HttpServer server = HttpServer.create(new InetSocketAddress(getBaseURI().getPort()), 0); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { server.stop(0); } })); // create a handler wrapping the JAX-RS application HttpHandler handler = RuntimeDelegate.getInstance().createEndpoint(new JaxRsApplication(), HttpHandler.class); // map JAX-RS handler to the server root server.createContext(getBaseURI().getPath(), handler); // start the server server.start(); return server; } public static void main(String[] args) throws IOException, InterruptedException { System.out.println("RentalCars RESTful Application"); startServer(); System.out.println("Application started.\n" + "Try accessing one of the following:\n" + getBaseURI() + "rentalcars/price\n" + getBaseURI() + "rentalcars/specification\n" + getBaseURI() + "rentalcars/rating\n" + getBaseURI() + "rentalcars/score"); Thread.currentThread().join(); } private static int getPort(int defaultPort) { final String port = System.getProperty("jersey.config.test.container.port"); if (null != port) { try { return Integer.parseInt(port); } catch (NumberFormatException e) { System.out.println("Value of jersey.config.test.container.port property" + " is not a valid positive integer [" + port + "]." + " Reverting to default [" + defaultPort + "]."); } } return defaultPort; } public static URI getBaseURI() { return UriBuilder.fromUri("http://localhost/").port(getPort(8080)).build(); } }
[ "lukecasey94@gmail.com" ]
lukecasey94@gmail.com
981e2cb03d37667181e5610f2fa733acd4f1f00e
7f4bf47a3863cb0028cb225e9241ac576979b82d
/RdbAssistant/src/main/java/net/cattaka/rdbassistant/jspf/core/JspfException.java
14fcf5b71857663a67fc75788c6eb2cf4edb5f62
[ "BSD-3-Clause", "Apache-2.0", "BSD-2-Clause", "ANTLR-PD" ]
permissive
cattaka/RdbAssistant
c3f7173e3cc5da235fb397b092bde26019014a8e
aa4a4ca9b22d435f0a0e47d6be93b17cc618483f
refs/heads/master
2021-07-01T22:43:09.469488
2020-10-14T01:02:19
2020-10-14T01:02:19
22,362,182
2
1
null
2020-10-14T01:02:21
2014-07-29T00:12:00
Java
UTF-8
Java
false
false
2,105
java
/* * Copyright (c) 2009, Takao Sumitomo * All rights reserved. * * Redistribution and use in source and binary forms, * with or without modification, are permitted provided * that the following conditions are met: * * * Redistributions of source code must retain the * above copyright notice, this list of conditions * and the following disclaimer. * * 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 THE COPYRIGHT HOLDERS AND * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * 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. */ /* * $Id: JspfException.java 232 2009-08-01 07:06:41Z cattaka $ */ package net.cattaka.rdbassistant.jspf.core; public class JspfException extends Exception { private static final long serialVersionUID = 1L; public JspfException() { super(); } public JspfException(String message, Throwable cause) { super(message, cause); } public JspfException(String message) { super(message); } public JspfException(Throwable cause) { super(cause); } }
[ "cattaka.net@gmail.com@4abaf870-a9f9-8e59-304d-5252f5ea09fa" ]
cattaka.net@gmail.com@4abaf870-a9f9-8e59-304d-5252f5ea09fa
37db5bd5fc1b2ddd6ea60b160cafcff2118fe90d
dd0023fa194c2d1900ff09ba34920181d5c78555
/src/com/acl/controller/log_out_Servlet.java
ff60ee267a52a7529315ca9e2c6612894381a512
[]
no_license
VimukthiRajapaksha/AccessControlLoginDemo
2500503044229a0d16d6b5223a69903b4095b1df
964bd7b3ae90ed16a4d9a59ba4514c6aac6e7d6a
refs/heads/master
2020-03-29T01:22:29.827139
2018-10-04T04:34:13
2018-10-04T04:34:13
149,385,686
0
0
null
null
null
null
UTF-8
Java
false
false
1,176
java
package com.acl.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; /** * Servlet implementation class log_out_Servlet */ @WebServlet("/logout") public class log_out_Servlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("logout get called"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("logout post called"); request.getSession().removeAttribute("bean"); request.getSession().removeAttribute("uname"); request.getSession().removeAttribute("roleId"); request.getSession().removeAttribute("page"); request.getSession().removeAttribute("ub"); request.getSession().removeAttribute("roles"); request.getSession().invalidate(); response.sendRedirect(request.getContextPath() + "/index.jsp"); } }
[ "vimukthi.rajapaksha@my.sliit.lk" ]
vimukthi.rajapaksha@my.sliit.lk
b767203e87f39c80a364c2ca2b4b8817563059ae
98c9ff510b396b4e879ca3ddce1f65c0adc618b5
/src/CTAMapper/CTALocation.java
d8ee5bf119666e71ddacc75d546881273183f72a
[]
no_license
George-Poulos/CTA-Mapper
7a40ef4f63c7f96a27e4682a0c4d2f9105fbbd28
8ecd0abb8b36db176f22ffd202fd5b33dc8cb912
refs/heads/master
2021-01-12T10:14:03.083085
2016-12-13T20:29:01
2016-12-13T20:29:01
76,391,980
0
0
null
null
null
null
UTF-8
Java
false
false
6,721
java
package CTAMapper; /** * This project takes information from CTA API and plots the current locations of every train on every line * * @author George Poulos * @version 1.0 */ import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.io.*; import java.math.BigDecimal; import java.util.LinkedList; import org.openstreetmap.gui.jmapviewer.*; import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; public class CTALocation { public static String BLUE_LINE = ""; public static String RED_LINE = ""; public static String BROWN_LINE = ""; public static String GREEN_LINE = ""; public static String ORANGE_LINE = ""; public static String PURPLE_LINE = ""; public static String PINK_LINE = ""; public static String YELLOW_LINE = ""; public static void setAPI(){ File fin = new File("src/CTA-API.txt"); FileInputStream fis = null; try { fis = new FileInputStream(fin); } catch (FileNotFoundException e) { e.printStackTrace(); } //Construct BufferedReader from InputStreamReader BufferedReader br = new BufferedReader(new InputStreamReader(fis)); try { BLUE_LINE = br.readLine(); RED_LINE = br.readLine(); BROWN_LINE = br.readLine(); GREEN_LINE = br.readLine(); ORANGE_LINE = br.readLine(); PURPLE_LINE = br.readLine(); PINK_LINE = br.readLine(); YELLOW_LINE = br.readLine(); } catch (IOException e) { e.printStackTrace(); } } public static void main(String args[]) throws Exception { JMapViewer map = new JMapViewer() { @Override public String getToolTipText(MouseEvent e) { ICoordinate c = getPosition(e.getX(),e.getY()); return c.getLat()+ " " + c.getLon(); } }; setAPI(); JFrame frame = new JFrame(); frame.setTitle("CTA Train Mapper"); frame.setSize(1280,720); map.setDisplayToFitMapMarkers(); map.setZoomContolsVisible(false); frame.add(map); frame.setVisible(true); boolean isValid = true; while(isValid){ getLocations(map,BLUE_LINE,"Blue"); getLocations(map,RED_LINE,"Red"); getLocations(map,BROWN_LINE,"Brown"); getLocations(map,GREEN_LINE,"Green"); getLocations(map,ORANGE_LINE,"Orange"); getLocations(map,PURPLE_LINE,"Purple"); getLocations(map,PINK_LINE,"Pink"); getLocations(map,YELLOW_LINE,"Yellow"); map.setDisplayToFitMapMarkers(); Thread.sleep(5000); map.removeAllMapMarkers(); } } private static void getLocations(JMapViewer map, String URL, String line){ CTAHandler tmp = new CTAHandler(); LinkedList<BigDecimal> latData = new LinkedList<>(); LinkedList<BigDecimal> lonData = new LinkedList<>(); LinkedList<String>runData = new LinkedList<>(); LinkedList<String>directionsList = new LinkedList<>(); tmp.parser(URL, latData, lonData, runData,directionsList); for(int i = 0; i < latData.size(); i++) { System.out.println("AT: " + runData.get(i) + " --> Lat : " + latData.get(i) + " Lon : " + lonData.get(i)); if (latData.get(i).doubleValue() == 0 && lonData.get(i).doubleValue() == 0){ } else{ MapMarkerDot marker = new MapMarkerDot( new Coordinate(latData.get(i).doubleValue(), lonData.get(i).doubleValue())); Style style = marker.getStyle(); switch (line) { case "Blue": style.setColor(Color.blue); if(Integer.parseInt(directionsList.get(i)) == 5){ style.setColor(Color.black);} style.setBackColor(Color.blue); break; case "Red": style.setColor(Color.red); if(Integer.parseInt(directionsList.get(i)) == 5){ style.setColor(Color.black);} style.setBackColor(Color.red); break; case "Brown": style.setColor(new Color(156, 93, 82)); if(Integer.parseInt(directionsList.get(i)) == 5){ style.setColor(Color.black);} style.setBackColor(new Color(156, 93, 82)); break; case "Green": style.setColor(Color.green); if(Integer.parseInt(directionsList.get(i)) == 5){ style.setColor(Color.black);} style.setBackColor(Color.green); break; case "Orange": style.setColor(Color.orange); if(Integer.parseInt(directionsList.get(i)) == 5){ style.setColor(Color.black);} style.setBackColor(Color.orange); break; case "Purple": style.setColor(new Color(186, 85, 211)); if(Integer.parseInt(directionsList.get(i)) == 5){ style.setColor(Color.black);} style.setBackColor(new Color(186, 85, 211)); break; case "Pink": style.setColor(Color.pink); if(Integer.parseInt(directionsList.get(i)) == 5){ style.setColor(Color.black);} style.setBackColor(Color.pink); break; case "Yellow": style.setColor(Color.yellow); if(Integer.parseInt(directionsList.get(i)) == 5){ style.setColor(Color.black);} style.setBackColor(Color.yellow); break; } map.addMapMarker(marker); } } System.out.println("--------------End " + line + " Line-------------" ); // print SOAP Response } }
[ "Georgepoulos5@gmail.com" ]
Georgepoulos5@gmail.com
c3fcefb5110d6cd530fedc3df353c3d69193438b
dbaa6469e758ebfa313a2e6799598470c8fe77a1
/assessment/src/main/java/com/mediscreen/mediscreenapp/assessment/exception/RestServiceTransmitException.java
ee0386c33d783597dafae26d2c3fc37f13ad5679
[]
no_license
ClementDv/OpCl-JAVA-P9
dba11a75b881c8fade766794eef708cbd974d8f8
4062a210d698e96c8ea4fa0149ab8a61256fbfad
refs/heads/master
2023-07-02T12:08:44.224781
2021-07-28T14:07:18
2021-07-28T14:07:18
375,366,295
1
1
null
2021-07-23T16:49:47
2021-06-09T13:32:00
Java
UTF-8
Java
false
false
518
java
package com.mediscreen.mediscreenapp.assessment.exception; import lombok.Getter; @Getter public class RestServiceTransmitException extends RuntimeException { private String errorResponse; public RestServiceTransmitException() { } public RestServiceTransmitException(String errorResponse) { this.errorResponse = errorResponse; } public RestServiceTransmitException(String message, String errorResponse) { super(message); this.errorResponse = errorResponse; } }
[ "p.clement777@gmail.com" ]
p.clement777@gmail.com
44d0e1b89b7e9d8cc90c60cc242a6aa7d38a469e
9ee004cd4f2ca3360948a03ffea37851beba9636
/GSCMobile/src/arm/developer/gsportmobile/utility/BookHelper.java
bda9d3517088a52b45ef22aa6cdbe3987b7cd464
[]
no_license
damnedivan/GSCMobile
922aa9304c4baf2a94d9b3409446299678026b87
b363fb50b51f27f5d85c0aea8f61730fb9e23fa7
refs/heads/master
2020-05-09T22:32:26.188993
2013-07-12T12:49:36
2013-07-12T12:49:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
687
java
package arm.developer.gsportmobile.utility; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.telephony.SmsManager; public class BookHelper { public static void sendSMS(Context context, String phoneNo, String message) { String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent(SENT), 0); PendingIntent deliveredPI = PendingIntent.getBroadcast(context, 0, new Intent(DELIVERED), 0); SmsManager sms = SmsManager.getDefault(); sms.sendTextMessage(phoneNo, null, message, sentPI, deliveredPI); } }
[ "tivanoedwin@gmail.com" ]
tivanoedwin@gmail.com
e86770476a3a081f49e2b63a19dd2046c921b05f
e0918c93dca0479f5ee6df3e78ea93e0dae1c540
/04_実装/テストコード/ModeTest.java
4b18f2ee828386f47b8b50fe04fc6dd95507f47a
[]
no_license
IshikawaAyaka/Repitition4
b3090a6a93e3a1a8e20394bee8b594d9218e62ca
8fd38491b5fdc15e819c15c8ab00d387edf003b9
refs/heads/master
2022-10-22T04:08:43.083999
2020-06-15T05:55:11
2020-06-15T05:55:11
271,671,927
0
0
null
null
null
null
UTF-8
Java
false
false
675
java
package typingGame; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import org.junit.Test; public class ModeTest extends EasyMode{ Mode e; @Test public void test1_1() { e = new EasyModeStab(); // 実行 e.setAnswer(); boolean test_1_1 = e.judge("1234567"); // 検証 assertThat(test_1_1, is(true)); // (必要であれば)後処理 System.out.println(""); } @Test public void test1_2() { e = new EasyMode(); // 実行 e.setAnswer(); boolean test_1_2 = e.judge("1111111"); // 検証 assertThat(test_1_2, is(false)); // (必要であれば)後処理 System.out.println(""); } }
[ "a-yoshitomi@cresco.co.jp" ]
a-yoshitomi@cresco.co.jp
beffb11ecb6b7ff21179556ee91f2f7c97fa9303
f97d91e69c2fd1f6b8c3c3cd9e662f180ffb5d32
/smbms/src/cn/pb/smbms/dao/DaoFactory.java
5574d7482b5fafd2c9c6a3d805a16128839fa2f2
[]
no_license
liuyabo11/smbms
abdf075d9e930f49d7acc9981be165b043ec865f
05c38952b6baec1abd7040cf1dfbe58b22db30a6
refs/heads/master
2021-01-19T14:49:21.041897
2017-08-21T07:50:00
2017-08-21T07:50:00
100,926,770
3
1
null
null
null
null
UTF-8
Java
false
false
1,031
java
package cn.pb.smbms.dao; /** * Dao层的工厂 因为只需创建一个 使用单例 * * @author Administrator * */ public class DaoFactory { // 私有化本对象 private static DaoFactory daoFactory; // 私有化构造 private DaoFactory() { } /** * 静态代码块 创建dao工厂实例 */ static { if (daoFactory == null) { synchronized (DaoFactory.class) { if (daoFactory == null) { daoFactory = new DaoFactory(); } } } } /** * 提供接口供外部访问 工厂模式 根据service层传过来的参数,获取相应daoImpl对象 */ public static CommentDao getDaoImpl(String daoImpl) { // 实例化commentDao CommentDao commentDao = null; if ("userDaoImpl".equals(daoImpl)) { // commentDao=new UserDaoImpl(); } else if ("billDaoImpl".equals(daoImpl)) { // commentDao=new BillDaoImpl(); } else if ("providerDaoImpl".equals(daoImpl)) { // commentDao=new ProviderDaoImpl(); } return commentDao; } }
[ "1014418619@qq.com" ]
1014418619@qq.com
f3a86a65cfac0de838e7e3aac1e147a1db266327
4d6c87b92af9aad1dcbb85220cc4f852068983b8
/src/worldfoodgame/model/EnumContinentNames.java
7e608e8f5baff78591cafa60030e2eae881e4460
[]
no_license
jjones203/PizzaPartyPresident
505a33ebeac82a4579afbc01af2d423af314eb57
6e328d2cdac52e4cb34d267435d600c1982346c9
refs/heads/master
2021-01-12T20:27:48.189168
2015-05-07T00:57:12
2015-05-07T00:57:12
33,828,625
0
0
null
null
null
null
UTF-8
Java
false
false
1,188
java
package worldfoodgame.model; /** * Holds names of continent groups; use when reading csv and initializing continents * @author jessica */ public enum EnumContinentNames { N_AMERICA, S_AMERICA, EUROPE, AFRICA, OCEANIA, ASIA, MIDDLE_EAST; public String toString() { String name = name(); String retString; switch (name) { case "N_AMERICA": retString = "North America"; break; case "S_AMERICA": retString = "South America"; break; case "MIDDLE_EAST": retString = "Middle East"; break; default: String substring = name.substring(1).toLowerCase(); retString = name.charAt(0)+substring; break; } return retString; } /** * Get enum value from string; use when parsing csv. * @param string string representing continent name * @return corresponding enum value */ public static EnumContinentNames findContinentName(String string) { for (EnumContinentNames continentName:EnumContinentNames.values()) { if (continentName.toString().equalsIgnoreCase(string)) return continentName; } return null; } }
[ "JJONES203@UNM.EDU" ]
JJONES203@UNM.EDU
3ec8ae79bc71a669a1f0b8f55935163849677a4c
939768bc793510deefdbb3db10c6116c02275020
/src/main/java/org/silnith/browser/model/NavigationListener.java
4f344f19ac263a1859576aa6cf22ed774efbcd97
[]
no_license
silnith/responsive-browser
87229ffeabebb4cd21657b5178efcd3af19105fe
8951c43ac45d35a32c2e2e8b6645166ef2ef9180
refs/heads/master
2021-01-10T03:52:07.535073
2016-01-29T20:13:12
2016-01-29T20:13:12
50,687,823
0
0
null
null
null
null
UTF-8
Java
false
false
1,277
java
package org.silnith.browser.model; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.MalformedURLException; import java.net.URL; import org.silnith.browser.ui.NavigationPanel; public class NavigationListener implements ActionListener { private final BrowsingContext browsingContext; private final NavigationPanel navigationPanel; public NavigationListener(final BrowsingContext browsingContext, final NavigationPanel navigationPanel) { super(); this.browsingContext = browsingContext; this.navigationPanel = navigationPanel; } @Override public void actionPerformed(final ActionEvent event) { assert EventQueue.isDispatchThread(); navigationPanel.clearErrors(); final String location = event.getActionCommand(); try { final URL url = new URL(location); final NavigationRequest navigationRequest = new NavigationRequest(url); browsingContext.startNewNavigation(navigationRequest); } catch (final MalformedURLException e) { navigationPanel.showError(e); } } }
[ "silnith@gmail.com" ]
silnith@gmail.com
33006c6117a64be7465464cc6a48a5fc15eca196
973ae40f2d3e2faba81155d3ec61c0f858e7017d
/mobile/src/main/java/com/shadow/manga/listeners/RecyclerEndlessOnScollListener.java
681825c79cbdad76c44cbabe0b78d974e5fef056
[]
no_license
ShaneRich5/manga-app-android
879ac17a77b9f74fa18c207c18e7a9d77e549a69
b19854300c68651e807e3dac18c3e78d8af117ed
refs/heads/master
2016-08-05T11:28:17.997742
2015-05-18T16:57:27
2015-05-18T16:57:27
35,646,893
0
0
null
null
null
null
UTF-8
Java
false
false
1,577
java
package com.shadow.manga.listeners; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; /** * Created by Shane on 5/18/2015. */ public abstract class RecyclerEndlessOnScollListener extends RecyclerView.OnScrollListener{ private int previousTotal = 0; private boolean loading = true; private int visibleThreshold = 5; private int firstVisibleItem, visibleItemCount, totalItemCount; private int currentPage = 0; private LinearLayoutManager mLinearLayoutManager; public RecyclerEndlessOnScollListener(LinearLayoutManager mLinearLayoutManager) { this.mLinearLayoutManager = mLinearLayoutManager; } @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); visibleItemCount = recyclerView.getChildCount(); totalItemCount = mLinearLayoutManager.getItemCount(); firstVisibleItem = mLinearLayoutManager.findFirstVisibleItemPosition(); if (loading) { if (totalItemCount > previousTotal) { loading = false; previousTotal = totalItemCount; } } if (!loading && (totalItemCount - visibleItemCount) <= (firstVisibleItem + visibleThreshold)) { // End has been reached // Do something currentPage++; onLoadMore(currentPage); loading = true; } } public abstract void onLoadMore(int currentPage); }
[ "shane.richards121@gmail.com" ]
shane.richards121@gmail.com
9c1fa0864f0b834823f9d55dad4389fb30763735
0c395d3f0bd3831069be16d5234ec3f4ab3d5eac
/app/src/main/java/com/tcl/myapplication/view/AudioPlayerActivity.java
0db573445d190cb5c8251dd7a7c2ed7dd7cc63b7
[]
no_license
lishiwei/IflySoundDemo
90e64fb0af6592a0369b7b7320d2a61d271bb9fb
6992498fbd97b078cc74d6517d043abfa2d88032
refs/heads/master
2020-04-06T04:42:47.738588
2017-04-07T10:36:53
2017-04-07T10:36:53
82,886,404
0
0
null
2017-03-01T09:27:18
2017-02-23T05:05:53
Java
UTF-8
Java
false
false
3,289
java
package com.tcl.myapplication.view; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import com.androidkun.xtablayout.XTabLayout; import com.tcl.myapplication.R; import com.tcl.myapplication.adapter.MainPageAdapter; import com.tcl.myapplication.util.DensityUtils; import butterknife.Bind; import butterknife.ButterKnife; public class AudioPlayerActivity extends FragmentActivity { private static final String TAG = AudioPlayerActivity.class.getSimpleName(); @Bind(R.id.xTablayout) XTabLayout mIndicator; @Bind(R.id.main_pager) ViewPager mViewPager; FragmentPagerAdapter mFragmentPagerAdapter; @Bind(R.id.activity_audio_player) LinearLayout mActivityAudioPlayer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_audio_player); View decorView = getWindow().getDecorView(); // Hide both the navigation bar and the status bar. // SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as // a general rule, you should design your app to hide the status bar whenever you // hide the navigation bar. int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar | View.SYSTEM_UI_FLAG_IMMERSIVE; decorView.setSystemUiVisibility(uiOptions); ButterKnife.bind(this); initViews(); loadData(); } private void loadData() { } private void initViews() { LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams((DensityUtils.getScreenWidth() - DensityUtils.dp2px(60)), ViewGroup.LayoutParams.MATCH_PARENT); layoutParams.gravity = Gravity.CENTER; layoutParams.topMargin = (int) getResources().getDimension(R.dimen.viewPage_marginTop); mViewPager.setLayoutParams(layoutParams); mFragmentPagerAdapter = new MainPageAdapter(this, getSupportFragmentManager()); mViewPager.setAdapter(mFragmentPagerAdapter); mIndicator.setupWithViewPager(mViewPager); mViewPager.setOffscreenPageLimit(4); findViewById(R.id.activity_audio_player).setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { return mViewPager.dispatchTouchEvent(event); } }); //切记去掉硬件加速 mViewPager.setPageTransformer(false, new ZoomInPageTransform(), View.LAYER_TYPE_NONE); // MyPageTransform myPageTransform = new MyPageTransform(mViewPager); // ShadowTransformer shadowTransformer = new ShadowTransformer(mViewPager, (MainPageAdapter) mFragmentPagerAdapter,true); // mViewPager.addOnPageChangeListener(shadowTransformer); } }
[ "294357228@qq.com" ]
294357228@qq.com
a2b3b0a3e7c4b33d9a842e8eed292ee439e4068b
4e3fc9d43725db30e97c8ca80d41741850d43013
/MozuAndroidInStoreAssistant/app/src/main/java/com/mozu/mozuandroidinstoreassistant/app/models/authentication/UserAuthenticationFailed.java
a4a91b448c4c623d46c73ff27b9b4d72afffeec6
[ "MIT" ]
permissive
dhootha/MozuAndroidInStoreAssistant
ae73bfd26e3fee18963b706f10ebe7b1899b8efa
039d4e1d3a9a243fb3258a389df47314c9124cf8
refs/heads/master
2021-01-13T12:54:18.611620
2015-10-14T19:10:01
2015-10-14T19:10:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
package com.mozu.mozuandroidinstoreassistant.app.models.authentication; public class UserAuthenticationFailed extends UserNotAuthenticatedNoAuthTicket { public UserAuthenticationFailed(UserAuthenticationStateMachine stateMachine) { super(stateMachine); } @Override public boolean isErrorState() { return true; } }
[ "matt_wear@volusion.com" ]
matt_wear@volusion.com
ca144f834160c61631953be323a947467d9e86bf
58f9ed107e610a612af459d8231fbe97dd0c814f
/src/main/java/com/ht/extra/pojo/comm/PhamDict.java
52dfd3d91ac9c2d92a86698fc856a65823275a6e
[]
no_license
tangguoqiang/htwebExtra
3bee6434a87e9333d80eeb391f80dfb72178675d
ca9d50a66586905d5164f6087b7778f233a1fd13
refs/heads/master
2020-03-15T13:13:57.645083
2018-08-22T12:54:44
2018-08-22T12:54:44
132,161,700
0
0
null
null
null
null
UTF-8
Java
false
false
2,441
java
package com.ht.extra.pojo.comm; public class PhamDict { private String phamStdCode; private String phamName; private String phamSpec; private String phamUnit; private String phamForm; private String toxicologyProperty; private Long stdDose; private String materialProperty; private Integer dividePackDose; private String conditionOfStorage; public String getPhamStdCode() { return phamStdCode; } public void setPhamStdCode(String phamStdCode) { this.phamStdCode = phamStdCode == null ? null : phamStdCode.trim(); } public String getPhamName() { return phamName; } public void setPhamName(String phamName) { this.phamName = phamName == null ? null : phamName.trim(); } public String getPhamSpec() { return phamSpec; } public void setPhamSpec(String phamSpec) { this.phamSpec = phamSpec == null ? null : phamSpec.trim(); } public String getPhamUnit() { return phamUnit; } public void setPhamUnit(String phamUnit) { this.phamUnit = phamUnit == null ? null : phamUnit.trim(); } public String getPhamForm() { return phamForm; } public void setPhamForm(String phamForm) { this.phamForm = phamForm == null ? null : phamForm.trim(); } public String getToxicologyProperty() { return toxicologyProperty; } public void setToxicologyProperty(String toxicologyProperty) { this.toxicologyProperty = toxicologyProperty == null ? null : toxicologyProperty.trim(); } public Long getStdDose() { return stdDose; } public void setStdDose(Long stdDose) { this.stdDose = stdDose; } public String getMaterialProperty() { return materialProperty; } public void setMaterialProperty(String materialProperty) { this.materialProperty = materialProperty == null ? null : materialProperty.trim(); } public Integer getDividePackDose() { return dividePackDose; } public void setDividePackDose(Integer dividePackDose) { this.dividePackDose = dividePackDose; } public String getConditionOfStorage() { return conditionOfStorage; } public void setConditionOfStorage(String conditionOfStorage) { this.conditionOfStorage = conditionOfStorage == null ? null : conditionOfStorage.trim(); } }
[ "ttang11@its.jnj.com" ]
ttang11@its.jnj.com
1d52227d157b9c90e75c2424639c53d7277f3dea
1209f282172e15505a2ed352ab9a6d1aafac54e3
/app/src/main/java/com/scaleablesolutions/crm_aurhentication_sample_using_soap/MainActivity.java
d9b7f6e923f49de325b5a2df2f709e1c820c929e
[]
no_license
Scaleable-solutions/Connecting-Android-apps-to-Dynamics-CRM-using-SOAP-endpoint
71f6ca2b5d0042f75461c2e3320653d92aabfff1
ab43f33a7559a22b018ba47c5e0094c1e37ba9bb
refs/heads/master
2021-01-15T15:16:25.545833
2016-01-06T12:27:45
2016-01-06T12:27:45
48,979,798
0
0
null
null
null
null
UTF-8
Java
false
false
3,732
java
package com.scaleablesolutions.crm_aurhentication_sample_using_soap; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.Toast; import com.scaleablesolutions.crm_aurhentication_sample_using_soap.CRM.CRMAuthHeader; import com.scaleablesolutions.crm_aurhentication_sample_using_soap.CRMTask.CRMAuthenticationTask; import com.scaleablesolutions.crm_aurhentication_sample_using_soap.CRMTask.UserInfoTask; import com.scaleablesolutions.crm_aurhentication_sample_using_soap.CRMTask.WhoAmITask; import com.scaleablesolutions.crm_aurhentication_sample_using_soap.Helper.LocalStorage; public class MainActivity extends AppCompatActivity implements View.OnClickListener, WhoAmITask.WhoAmIResponse, UserInfoTask.UserInfoResponse { EditText et_domain, et_username, et_password; Button btn_submit; LocalStorage storage; RelativeLayout relativeLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); et_domain = (EditText) findViewById(R.id.et_domain); et_username = (EditText) findViewById(R.id.et_username); et_password = (EditText) findViewById(R.id.et_password); btn_submit = (Button) findViewById(R.id.btn_submit); btn_submit.setOnClickListener(this); storage = new LocalStorage(getApplicationContext()); relativeLayout = (RelativeLayout)findViewById(R.id.rl_progressbar); } private void showProgressBar(){ et_domain.setEnabled(false); et_username.setEnabled(false); et_password.setEnabled(false); relativeLayout.setVisibility(View.VISIBLE); } private void hideProgressBar(){ et_domain.setEnabled(true); et_username.setEnabled(true); et_password.setEnabled(true); relativeLayout.setVisibility(View.GONE); } @Override public void onClick(View v) { showProgressBar(); storage.saveOrganizationURL(et_domain.getText().toString()); CRMAuthenticationTask task = new CRMAuthenticationTask(new CRMAuthenticationTask.CRMAuthResponse() { @Override public void processFinish(CRMAuthHeader output) { storage.saveCRMAuthHeader(output.getHeader()); storage.saveExpireTime(output.getExpire()); WhoAmITask whoAmITask = new WhoAmITask(MainActivity.this, getApplicationContext()); whoAmITask.execute(); } @Override public void credentialError(String error) { hideProgressBar(); Toast.makeText(MainActivity.this, "error", Toast.LENGTH_LONG).show(); } }, getApplicationContext()); task.execute(et_domain.getText().toString(), et_username.getText().toString(), et_password.getText().toString()); } @Override public void whoAmIProcessFinish(String id) { UserInfoTask userInfoTask = new UserInfoTask(this, getApplicationContext()); userInfoTask.execute(id); } @Override public void userInfoProcessFinish(String fullName) { Intent intent = new Intent(this, NameActivity.class); intent.putExtra("fullname", fullName); startActivity(intent); hideProgressBar(); } }
[ "aamir@scaleablesolutions.com" ]
aamir@scaleablesolutions.com
bbcb2d9c4b4f880dce427a14e758e69712bc4bdf
53df0c694bcc0033ec13841a714268a0767cf60b
/src/writerr/Main.java
3b35c209d01e41954a3f9280bbbc4e65a5e077d9
[]
no_license
Cannarozzo/Writer-functor-in-Java
e09a89e54b7493d5b62850bc67009f37eb72bcbe
cec217146e8a169f9c42c26440af4f489cd1c84f
refs/heads/master
2020-07-11T07:58:30.312754
2019-08-26T13:42:49
2019-08-26T13:42:49
204,483,879
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
package writerr; import java.util.function.Function; @SuppressWarnings("unchecked") public class Main { public static <T, R> void main(String[] args) { Peixe p = new Peixe<Integer, Integer, Integer>(); Function<Integer, Writerr> f = a -> new Writerr(a, "log"); Function<Writerr, Integer> g = b -> (Integer)b.getA(); Function<Integer, Integer> h = x -> g.compose(f).apply(x); System.out.println(h.apply(4)); Function<Boolean, Writerr<Boolean>> notW = x -> x == true ? p.retorno(x) : new Writerr<Boolean>(x,"not"); Function<Integer, Writerr<Boolean>> is_even = x -> new Writerr<Boolean>( x % 2 == 0 ? true : false, "even"); Function<Integer, Writerr<Boolean>> is_odd = x -> p.peixe(is_even,notW,x); System.out.println(is_odd.apply(4)); } }
[ "felipe.cannarozzo@gmail.com" ]
felipe.cannarozzo@gmail.com
7f75d39c7799b36b557b2ee1e9674f550d1f20a2
9b56c1a7ff68cec78d2d469242dc396fc9fd7b02
/bin/platform/bootstrap/gensrc/de/hybris/platform/impex/model/exp/ImpExExportMediaModel.java
1c2b40e1824501846f10bef9b47014f9175e4874
[]
no_license
noiz23/TourHy
e32f411786c140e08b977dbe89f912061f47ce7f
8379099898362e7c697c6ef22ae988c85e41eae3
refs/heads/master
2020-04-11T08:14:00.193050
2019-01-03T10:15:13
2019-01-03T10:15:13
161,634,988
0
0
null
null
null
null
UTF-8
Java
false
false
3,629
java
/* * ---------------------------------------------------------------- * --- WARNING: THIS FILE IS GENERATED AND WILL BE OVERWRITTEN! --- * --- Generated at Dec 31, 2018 5:45:51 AM --- * ---------------------------------------------------------------- * * [y] hybris Platform * * Copyright (c) 2000-2016 SAP SE * All rights reserved. * * This software is the confidential and proprietary information of SAP * Hybris ("Confidential Information"). You shall not disclose such * Confidential Information and shall use it only in accordance with the * terms of the license agreement you entered into with SAP Hybris. * */ package de.hybris.platform.impex.model.exp; import de.hybris.platform.catalog.model.CatalogVersionModel; import de.hybris.platform.core.model.ItemModel; import de.hybris.platform.impex.model.ImpExMediaModel; import de.hybris.platform.servicelayer.model.ItemModelContext; /** * Generated model class for type ImpExExportMedia first defined at extension impex. */ @SuppressWarnings("all") public class ImpExExportMediaModel extends ImpExMediaModel { /**<i>Generated model type code constant.</i>*/ public final static String _TYPECODE = "ImpExExportMedia"; /** * <i>Generated constructor</i> - Default constructor for generic creation. */ public ImpExExportMediaModel() { super(); } /** * <i>Generated constructor</i> - Default constructor for creation with existing context * @param ctx the model context to be injected, must not be null */ public ImpExExportMediaModel(final ItemModelContext ctx) { super(ctx); } /** * <i>Generated constructor</i> - Constructor with all mandatory attributes. * @deprecated Since 4.1.1 Please use the default constructor without parameters * @param _catalogVersion initial attribute declared by type <code>ImpExMedia</code> at extension <code>catalog</code> * @param _code initial attribute declared by type <code>Media</code> at extension <code>core</code> * @param _linesToSkip initial attribute declared by type <code>ImpExMedia</code> at extension <code>impex</code> * @param _removeOnSuccess initial attribute declared by type <code>ImpExMedia</code> at extension <code>impex</code> */ @Deprecated public ImpExExportMediaModel(final CatalogVersionModel _catalogVersion, final String _code, final int _linesToSkip, final boolean _removeOnSuccess) { super(); setCatalogVersion(_catalogVersion); setCode(_code); setLinesToSkip(_linesToSkip); setRemoveOnSuccess(_removeOnSuccess); } /** * <i>Generated constructor</i> - for all mandatory and initial attributes. * @deprecated Since 4.1.1 Please use the default constructor without parameters * @param _catalogVersion initial attribute declared by type <code>ImpExMedia</code> at extension <code>catalog</code> * @param _code initial attribute declared by type <code>Media</code> at extension <code>core</code> * @param _linesToSkip initial attribute declared by type <code>ImpExMedia</code> at extension <code>impex</code> * @param _owner initial attribute declared by type <code>Item</code> at extension <code>core</code> * @param _removeOnSuccess initial attribute declared by type <code>ImpExMedia</code> at extension <code>impex</code> */ @Deprecated public ImpExExportMediaModel(final CatalogVersionModel _catalogVersion, final String _code, final int _linesToSkip, final ItemModel _owner, final boolean _removeOnSuccess) { super(); setCatalogVersion(_catalogVersion); setCode(_code); setLinesToSkip(_linesToSkip); setOwner(_owner); setRemoveOnSuccess(_removeOnSuccess); } }
[ "ruben.echeverri" ]
ruben.echeverri
323f48611fea4b90304480ff7a88d769db039d44
dc9d908f5a9e34baae2fd916011cd24f2b3d2741
/ConquerYo/app/src/main/java/com/conquer/elspet/conqueryo/mvp/model/api/cache/CommonCache.java
0f6cc5e165649a087a488bc641bed4fdb58ee7bf
[]
no_license
elspet/ConquerYo
16232f7d41bf0f775d0ac1b351853b4d483498de
4d1a93361dd3a3b12192679e3124664344d896a1
refs/heads/master
2020-11-29T14:51:19.987064
2017-04-07T11:47:21
2017-04-07T11:47:21
87,491,823
0
0
null
null
null
null
UTF-8
Java
false
false
655
java
package com.conquer.elspet.conqueryo.mvp.model.api.cache; import android.database.Observable; import com.conquer.elspet.conqueryo.mvp.model.entity.User; import java.util.List; import java.util.concurrent.TimeUnit; import io.rx_cache.DynamicKey; import io.rx_cache.EvictProvider; import io.rx_cache.LifeCache; import io.rx_cache.Reply; /** * Created by jess on 8/30/16 13:53 * Contact with jess.yan.effort@gmail.com */ public interface CommonCache { @LifeCache(duration = 2, timeUnit = TimeUnit.MINUTES) Observable<Reply<List<User>>> getUsers(Observable<List<User>> oUsers, DynamicKey idLastUserQueried, EvictProvider evictProvider); }
[ "466092956@qq.com" ]
466092956@qq.com
a953e58ef7e7855d8394c15d73157810a1206683
628a5037ac56c736c4d5f101ce51f648dcabfa3c
/projects/TicTacToe/java/src/tictactoe/GameResult.java
4c10cb6849953bde6d600a23673e943b56396255
[]
no_license
mohanmca/course
c5c58f93fbae3c09eddffaef5111870d685c5bdf
804aaf5aecd93d3def632f32245b2c0eb88a68a8
refs/heads/master
2021-01-17T23:02:27.834256
2015-07-21T07:06:17
2015-07-21T07:06:17
40,645,738
1
0
null
2015-08-13T07:46:05
2015-08-13T07:46:05
null
UTF-8
Java
false
false
1,140
java
package tictactoe; import fj.F; import fj.data.Option; import static fj.data.Option.some; import static tictactoe.Player.Player1; import static tictactoe.Player.Player2; public enum GameResult { Player1Wins, Player2Wins, Draw; public boolean isWin() { return this == Player1Wins || this == Player2Wins; } public boolean isDraw() { return !isWin(); } public Option<Player> winner() { return this == Player1Wins ? some(Player1) : this == Player2Wins ? some(Player2) : Option.<Player>none(); } public <X> X strictFold(final X player1Wins, final X player2Wins, final X draw) { return this == Player1Wins ? player1Wins : this == Player2Wins ? player2Wins : draw; } @Override public String toString() { return winner().option("draw", new F<Player, String>() { @Override public String f(final Player p) { return p.toString() + " wins"; } }); } public static GameResult win(final Player p) { return p == Player1 ? Player1Wins : Player2Wins; } }
[ "tmorris@tmorris.net" ]
tmorris@tmorris.net
a7a4202c79176149cabe64f7d7252b3b1d6fb397
e3cb50f4c0cda9326774575d5a958bd283b93769
/app/src/androidTest/java/heinke/hsmontagens/ExampleInstrumentedTest.java
19564f7236e4c3a99b9942225fd5448df3fc755b
[]
no_license
robsonheinke/ordemServico
d9d67142ae5152c39b629ef6c95487b54c71b27a
8cc0c10dea6db9c867db5f82db3ea9b3a8f5dd6b
refs/heads/master
2021-05-06T01:14:42.174715
2018-01-03T14:02:04
2018-01-03T14:02:04
114,426,104
0
0
null
null
null
null
UTF-8
Java
false
false
737
java
package heinke.hsmontagens; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("heinke.hsmontagens", appContext.getPackageName()); } }
[ "robsonheinke@hotmail.com" ]
robsonheinke@hotmail.com
b1041c03667d4f5f375cc56789bbf90ea8de6d87
ae9d72e8e4493ec5baa492db35eaf148357975ae
/servlet/api/src/test/java/javax/servlet/http/TestHttpFilter.java
46796a6eaf9b63ba045757e13c9917456c1b8644
[ "BSD-3-Clause" ]
permissive
PratesLab/piranha
49d00804dbeaa233c619bbeaf45a723fbb2feb3b
1b03e72752aee4a70e5ce5ba90a938d9937ac851
refs/heads/master
2023-01-14T01:45:50.312653
2020-08-13T14:25:14
2020-08-13T14:25:14
287,337,057
0
0
BSD-3-Clause
2020-11-22T21:14:14
2020-08-13T17:09:00
null
UTF-8
Java
false
false
2,508
java
/* * Copyright (c) 2002-2020 Manorrock.com. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package javax.servlet.http; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; /** * A Test HttpFilter. * * @author Manfred Riem (mriem@manorrock.com) */ public class TestHttpFilter extends HttpFilter { /** * Constructor. */ public TestHttpFilter() { } /** * Do filter. * * @param request the request. * @param response the response. * @param chain the filter chain. * @throws IOException when an I/O error occurs. * @throws ServletException when a Servlet error occurs. */ @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { throw new UnsupportedOperationException("Not supported yet."); } }
[ "mriem@manorrock.com" ]
mriem@manorrock.com
f06bfa94053111e70b2a22938ffae29b8b4bc8ae
473fc28d466ddbe9758ca49c7d4fb42e7d82586e
/app/src/main/java/com/syd/source/aosp/external/mockftpserver/tags/2.0-rc1/MockFtpServer/src/test/java/org/mockftpserver/core/util/PortParserTest.java
ee3e60e39347af39540a3287eed3bd8cf5f3fc35
[ "Apache-2.0" ]
permissive
lz-purple/Source
a7788070623f2965a8caa3264778f48d17372bab
e2745b756317aac3c7a27a4c10bdfe0921a82a1c
refs/heads/master
2020-12-23T17:03:12.412572
2020-01-31T01:54:37
2020-01-31T01:54:37
237,205,127
4
2
null
null
null
null
UTF-8
Java
false
false
4,229
java
/* * Copyright 2008 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mockftpserver.core.util; import org.apache.log4j.Logger; import org.mockftpserver.core.CommandSyntaxException; import org.mockftpserver.test.AbstractTest; import java.net.InetAddress; import java.net.UnknownHostException; /** * Tests for the PortParser class * * @author Chris Mair * @version $Revision$ - $Date$ */ public final class PortParserTest extends AbstractTest { private static final Logger LOG = Logger.getLogger(PortParserTest.class); private static final String[] PARAMETERS = new String[]{"192", "22", "250", "44", "1", "206"}; private static final String[] PARAMETERS_INSUFFICIENT = new String[]{"7", "29", "99", "11", "77"}; private static final int PORT = (1 << 8) + 206; private static final InetAddress HOST = inetAddress("192.22.250.44"); /** * Test the parseHost() method * * @throws java.net.UnknownHostException */ public void testParseHost() throws UnknownHostException { InetAddress host = PortParser.parseHost(PARAMETERS); assertEquals("InetAddress", HOST, host); } /** * Test the parsePortNumber() method */ public void testParsePortNumber() { int portNumber = PortParser.parsePortNumber(PARAMETERS); assertEquals("portNumber", PORT, portNumber); } /** * Test the parseHost() method, passing in null * * @throws java.net.UnknownHostException */ public void testParseHost_Null() throws UnknownHostException { try { PortParser.parseHost(null); fail("Expected CommandSyntaxException"); } catch (CommandSyntaxException expected) { LOG.info("Expected: " + expected); } } /** * Test the parseHost() method, passing in a String[] with not enough parameters * * @throws java.net.UnknownHostException */ public void testParseHost_InsufficientParameters() throws UnknownHostException { try { PortParser.parseHost(PARAMETERS_INSUFFICIENT); fail("Expected CommandSyntaxException"); } catch (CommandSyntaxException expected) { LOG.info("Expected: " + expected); } } /** * Test the parsePortNumber() method, passing in null * * @throws java.net.UnknownHostException */ public void testParsePortNumber_Null() throws UnknownHostException { try { PortParser.parsePortNumber(null); fail("Expected CommandSyntaxException"); } catch (CommandSyntaxException expected) { LOG.info("Expected: " + expected); } } /** * Test the parsePortNumber() method, passing in a String[] with not enough parameters * * @throws java.net.UnknownHostException */ public void testParsePortNumber_InsufficientParameters() throws UnknownHostException { try { PortParser.parsePortNumber(PARAMETERS_INSUFFICIENT); fail("Expected CommandSyntaxException"); } catch (CommandSyntaxException expected) { LOG.info("Expected: " + expected); } } /** * Test convertHostAndPortToStringOfBytes() method */ public void testConvertHostAndPortToStringOfBytes() throws UnknownHostException { int port = (23 << 8) + 77; InetAddress host = InetAddress.getByName("196.168.44.55"); String result = PortParser.convertHostAndPortToCommaDelimitedBytes(host, port); LOG.info("result=" + result); assertEquals("result", "196,168,44,55,23,77", result); } }
[ "997530783@qq.com" ]
997530783@qq.com
b021eda9aa5659eae5766ba049e8461a0b9ef6eb
4d5f3c54f25823cd2d5d475531f5bbfd1795627d
/src/main/java/com/ny/dao/CardOut3MDao.java
91afd258c00ce1ec55aabcc7b0d34ce0f2d2507e
[]
no_license
NYfor2017/CreditItem
bbe955297ddd800e8f6a7989f4a53d94e56dea66
462033fd65421b3af5c51b491be3a360ffd43f77
refs/heads/master
2020-03-24T07:05:41.874342
2018-09-07T07:33:20
2018-09-07T07:33:20
142,132,277
0
0
null
null
null
null
GB18030
Java
false
false
968
java
package com.ny.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.ny.entity.CardOut3M; /** * CardOut3的Dao类 * @author N.Y * */ public interface CardOut3MDao { /** * 获取用户三个月的支出信息 * @param user_id * @return */ List<CardOut3M> getOwnCardOut3M(@Param("user_id")int user_id); /** * 添加支出信息 * @param out_3m_time * @param out_3m_amount * @param user_id * @return */ int addCardOut3M(@Param("out_3m_time")int out_3m_time, @Param("out_3m_amount")int out_3m_amount, @Param("user_id")int user_id); /** * 更新支出信息 * @param out_3m_id * @param out_3m_time * @param out_3m_amount * @return */ int updateCardOut3M(@Param("out_3m_id")int out_3m_id,@Param("out_3m_time")int out_3m_time, @Param("out_3m_amount")int out_3m_amount); /** * 删除支出信息 * @param out_3m_id * @return */ int deleteCardOut3M(@Param("out_3m_id")int out_3m_id); }
[ "897095558@qq.com" ]
897095558@qq.com
ca250fb88198251a108c7f6cfbb544c9edbd3875
cec1602d23034a8f6372c019e5770773f893a5f0
/sources/kotlin/annotation/MustBeDocumented.java
ee7e765dcda24abdaf2d9fd1530a00677fb12651
[]
no_license
sengeiou/zeroner_app
77fc7daa04c652a5cacaa0cb161edd338bfe2b52
e95ae1d7cfbab5ca1606ec9913416dadf7d29250
refs/heads/master
2022-03-31T06:55:26.896963
2020-01-24T09:20:37
2020-01-24T09:20:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
668
java
package kotlin.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import kotlin.Metadata; @Target({ElementType.ANNOTATION_TYPE}) @Target(allowedTargets = {AnnotationTarget.ANNOTATION_CLASS}) @Metadata(bv = {1, 0, 2}, d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0010\u001b\n\u0000\b‡\u0002\u0018\u00002\u00020\u0001B\u0000¨\u0006\u0002"}, d2 = {"Lkotlin/annotation/MustBeDocumented;", "", "kotlin-runtime"}, k = 1, mv = {1, 1, 8}) @Retention(RetentionPolicy.RUNTIME) /* compiled from: Annotations.kt */ public @interface MustBeDocumented { }
[ "johan@sellstrom.me" ]
johan@sellstrom.me
1f5441f9f69ba9a40b75651eb6ef18ba8258f0dd
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/10/10_b81967dae9cec51ea794e7bbfc70497ec48b9183/B2bHelper/10_b81967dae9cec51ea794e7bbfc70497ec48b9183_B2bHelper_s.java
132f7b9974675794a4f29982e51e2860edd9a6f9
[]
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
14,880
java
// ======================================================================== // Copyright 2012 NEXCOM Systems // ------------------------------------------------------------------------ // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ======================================================================== package org.cipango.server; import java.text.ParseException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import javax.servlet.ServletException; import javax.servlet.sip.Address; import javax.servlet.sip.B2buaHelper; import javax.servlet.sip.ServletParseException; import javax.servlet.sip.SipServletMessage; import javax.servlet.sip.SipServletRequest; import javax.servlet.sip.SipServletResponse; import javax.servlet.sip.SipSession; import javax.servlet.sip.SipURI; import javax.servlet.sip.TooManyHopsException; import javax.servlet.sip.UAMode; import javax.servlet.sip.ar.SipApplicationRoutingDirective; import org.cipango.server.session.ApplicationSession; import org.cipango.server.session.Session; import org.cipango.server.session.SessionManager; import org.cipango.server.transaction.ClientTransaction; import org.cipango.server.transaction.ServerTransaction; import org.cipango.server.util.ContactAddress; import org.cipango.sip.AddressImpl; import org.cipango.sip.SipHeader; public class B2bHelper implements B2buaHelper { private static final B2bHelper __instance = new B2bHelper(); public static B2bHelper getInstance() { return __instance; } @Override public SipServletRequest createCancel(SipSession sipSession) { if (sipSession == null) throw new NullPointerException("SipSession is null"); Session session = ((SessionManager.SipSessionIf) sipSession).getSession(); for (ClientTransaction tx : session.getClientTransactions()) { if (tx.getRequest().isInitial()) return tx.getRequest().createCancel(); } return null; } @Override public SipServletRequest createRequest(SipServletRequest origRequest) { SipRequest srcRequest = (SipRequest) origRequest; ApplicationSession appSession = srcRequest.appSession(); AddressImpl local = (AddressImpl) srcRequest.from().clone(); local.setParameter(AddressImpl.TAG, appSession.newUASTag()); AddressImpl remote = (AddressImpl) srcRequest.to().clone(); remote.removeParameter(AddressImpl.TAG); String callId = appSession.newCallId(); Session session = appSession.createUacSession(callId, local, remote); session.setHandler(appSession.getContext().getServletHandler() .getDefaultServlet()); SipRequest request = session.getUa().createRequest(srcRequest); request.setRoutingDirective(SipApplicationRoutingDirective.CONTINUE, srcRequest); return request; } @Override public SipServletRequest createRequest(SipServletRequest origRequest, boolean linked, Map<String, List<String>> headerMap) throws IllegalArgumentException, TooManyHopsException { if (origRequest == null) throw new NullPointerException("Original request is null"); if (!origRequest.isInitial()) throw new IllegalArgumentException( "Original request is not initial"); int mf = origRequest.getMaxForwards(); if (mf == 0) throw new TooManyHopsException( "Max-Forwards of original request is equal to 0"); SipRequest request = (SipRequest) createRequest(origRequest); addHeaders(request, headerMap); if (linked) linkRequest((SipRequest) origRequest, request); return request; } @Override public SipServletRequest createRequest(SipSession sipSession, SipServletRequest origRequest, Map<String, List<String>> headerMap) throws IllegalArgumentException { if (sipSession == null) throw new NullPointerException("SipSession is null"); if (!sipSession.getApplicationSession().equals(origRequest.getApplicationSession())) throw new IllegalArgumentException("SipSession " + sipSession + " does not belong to same application session as original request"); SipSession linkedSession = getLinkedSession(origRequest.getSession()); if (linkedSession != null && !linkedSession.equals(sipSession)) throw new IllegalArgumentException("Original request is already linked to another sipSession"); if (getLinkedSipServletRequest(origRequest) != null) throw new IllegalArgumentException("Original request is already linked to another request"); Session session = ((SessionManager.SipSessionIf) sipSession).getSession(); SipRequest srcRequest = (SipRequest) origRequest; SipRequest request = (SipRequest) session.getUa().createRequest(srcRequest); addHeaders(request, headerMap); linkRequest(srcRequest, request); return request; } @Override public SipServletResponse createResponseToOriginalRequest(SipSession sipSession, int status, String reason) { if (sipSession == null) throw new NullPointerException("SipSession is null"); if (!sipSession.isValid()) throw new IllegalArgumentException("SipSession " + sipSession + " is not valid"); Session session = ((SessionManager.SipSessionIf) sipSession).getSession(); Iterator<Session> it = findCloneSessions(session).iterator(); while (it.hasNext()) { Session session2 = (Session) it.next(); for (ServerTransaction tx : session2.getServerTransactions()) { SipRequest request = tx.getRequest(); if (request.isInitial()) { if (!session2.equals(session)) { if (status >= 300) throw new IllegalStateException("Cannot send response with status" + status + " since final response has already been sent"); SipResponse response = new SipResponse(request, status, reason); response.setSession(session); return response; } else { return request.createResponse(status, reason); } } } } return null; } @Override public SipSession getLinkedSession(SipSession sipSession) { if (sipSession == null) throw new NullPointerException("SipSession is null"); if (!sipSession.isValid()) throw new IllegalArgumentException("SipSession " + sipSession + " is not valid"); return ((SessionManager.SipSessionIf) sipSession).getSession().getLinkedSession(); } @Override public SipServletRequest getLinkedSipServletRequest(SipServletRequest request) { return ((SipRequest) request).getLinkedRequest(); } @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public List<SipServletMessage> getPendingMessages(SipSession sipSession, UAMode mode) { if (sipSession == null) throw new NullPointerException("SipSession is null"); if (!sipSession.isValid()) throw new IllegalArgumentException("SipSession " + sipSession + " is not valid"); Session session = ((SessionManager.SipSessionIf) sipSession).getSession(); if (session.isProxy()) throw new IllegalArgumentException("SipSession " + session + " is proxy"); if (session.getUa() == null) session.createUA(mode); List<SipServletMessage> messages = new ArrayList<SipServletMessage>(); if (mode == UAMode.UAS) { for (ServerTransaction tx : session.getServerTransactions()) { if (!tx.getRequest().isCommitted()) messages.add(tx.getRequest()); } } else { for (ClientTransaction tx : session.getClientTransactions()) { if (!tx.isCompleted()) messages.add(tx.getRequest()); } } messages.addAll(session.getUa().getUncommitted2xx(mode)); messages.addAll(session.getUa().getUncommitted1xx(mode)); Collections.sort(messages, new Comparator() { public int compare(Object message1, Object message2) { long cseq1 = ((SipMessage) message1).getCSeq().getNumber(); long cseq2 = ((SipMessage) message2).getCSeq().getNumber(); return (int) (cseq1 - cseq2); } }); return messages; } @Override public void linkSipSessions(SipSession sipSession1, SipSession sipSession2) { Session session1 = ((SessionManager.SipSessionIf) sipSession1).getSession(); Session session2 = ((SessionManager.SipSessionIf) sipSession2).getSession(); checkNotTerminated(session1); checkNotTerminated(session2); Session linked1 = session1.getLinkedSession(); if (linked1 != null && !linked1.equals(session2)) throw new IllegalArgumentException("SipSession " + sipSession1 + " is already linked to " + linked1); Session linked2 = session2.getLinkedSession(); if (linked2 != null && !linked2.equals(session1)) throw new IllegalArgumentException("SipSession " + sipSession2 + " is already linked to " + linked2); session1.setLinkedSession(session2); session2.setLinkedSession(session1); } @Override public void unlinkSipSessions(SipSession sipSession) { if (sipSession == null) throw new NullPointerException("SipSession is null"); Session session = ((SessionManager.SipSessionIf) sipSession).getSession(); checkNotTerminated(session); Session linked = session.getLinkedSession(); if (linked == null) throw new IllegalArgumentException("SipSession " + session + " has no linked SipSession"); linked.setLinkedSession(null); session.setLinkedSession(null); } protected void addHeaders(SipRequest request, Map<String, List<String>> headerMap) { if (headerMap != null) { for (Entry<String, List<String>> entry : headerMap.entrySet()) { String name = SipHeader.getFormattedName(entry.getKey()); SipHeader header = SipHeader.CACHE.get(name); if (header != null && header.isSystem()) { if (header == SipHeader.FROM || header == SipHeader.TO) { List<String> l = entry.getValue(); if (l.size() > 0) { try { Address address = new AddressImpl(l.get(0), true); mergeFromTo(address, request.getFields().getField(header).asAddress()); } catch (ServletException e) { throw new IllegalArgumentException("Invalid " + header + " header ", e); } catch (ParseException e) { throw new IllegalArgumentException("Invalid address ", e); } } } else if (header == SipHeader.ROUTE && request.isInitial()) { request.getFields().remove(SipHeader.ROUTE.asString()); for (String route : entry.getValue()) { request.getFields().addString(SipHeader.ROUTE.asString(), route, false); } } else { throw new IllegalArgumentException("Header " + name + " is system."); } } else if (header != null && header == SipHeader.CONTACT) { List<String> contacts = entry.getValue(); if (contacts.size() > 0) { try { AddressImpl contact = (AddressImpl) request .getFields().getField(header).asAddress(); if (contact != null) { try { AddressImpl source = new AddressImpl(contacts.get(0), true); mergeContact(source, contact); } catch (ParseException e) { throw new IllegalArgumentException( "Invalid Contact header: " + contacts.get(0)); } } else if (request.isRegister()) request.getFields().add( SipHeader.CONTACT.asString(), new AddressImpl(contacts.get(0)), false); } catch (ServletParseException e) { throw new IllegalArgumentException( "Invalid Contact header: " + contacts.get(0)); } } } else { request.getFields().remove(name); for (String value : entry.getValue()) { request.getFields().addString(name, value, false); } } } } } private void checkNotTerminated(Session session) { if (session.isTerminated()) throw new IllegalArgumentException("SipSession " + session + " is terminated"); } private static List<Session> findCloneSessions(Session session) { Iterator<?> it = session.appSession().getSessions("sip"); List<Session> l = new ArrayList<Session>(); while (it.hasNext()) { Session sipSession = (Session) it.next(); if (sipSession.getRemoteParty().equals(session.getRemoteParty()) && sipSession.getCallId().equals(session.getCallId())) l.add(sipSession); } return l; } private void linkRequest(SipRequest request1, SipRequest request2) { request1.setLinkedRequest(request2); request2.setLinkedRequest(request1); linkSipSessions(request1.session(), request2.session()); } public static void mergeContact(Address src, Address dest) throws ServletParseException { SipURI srcUri = (SipURI) src.getURI(); SipURI destUri = (SipURI) dest.getURI(); String user = srcUri.getUser(); if (user != null) destUri.setUser(user); Iterator<String> it = srcUri.getHeaderNames(); while (it.hasNext()) { String name = it.next(); destUri.setHeader(name, srcUri.getHeader(name)); } it = srcUri.getParameterNames(); while (it.hasNext()) { String name = it.next(); if (!ContactAddress.isReservedUriParam(name)) destUri.setParameter(name, srcUri.getParameter(name)); } String displayName = src.getDisplayName(); if (displayName != null) dest.setDisplayName(displayName); it = src.getParameterNames(); while (it.hasNext()) { String name = it.next(); dest.setParameter(name, src.getParameter(name)); } } private static void mergeFromTo(Address src, Address dest) { dest.setURI(src.getURI()); dest.setDisplayName(src.getDisplayName()); List<String> params = new ArrayList<String>(); Iterator<String> it = src.getParameterNames(); while (it.hasNext()) params.add(it.next()); it = dest.getParameterNames(); while (it.hasNext()) params.add(it.next()); for (String param : params) { if (!param.equalsIgnoreCase(AddressImpl.TAG)) dest.setParameter(param, src.getParameter(param)); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
46a197e2234e2f4da9ae94a2bd6c2b110d56aeeb
0f920aa82bb4ea5ff3cc78432525ef9232272ad5
/src/main/java/com/motows/tenant/util/MdcTaskDecorator.java
ccda37f5aaac65fc4b0d58fcc970af655332dc44
[]
no_license
sureshgit4u/tenant-develop
6116ddd1984e8b4e0b4d5a25648b136b8efa79d1
52cdf14d106b55f974b971729011300a1ae84af5
refs/heads/master
2023-05-09T12:18:08.835100
2021-06-06T14:03:19
2021-06-06T14:03:19
356,560,981
0
0
null
null
null
null
UTF-8
Java
false
false
1,325
java
package com.motows.tenant.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.core.task.TaskDecorator; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import java.util.Map; public class MdcTaskDecorator implements TaskDecorator { private final static Logger LOG = LoggerFactory.getLogger(MdcTaskDecorator.class); @Override public Runnable decorate(Runnable runnable) { // Right now: Web thread context ! // (Grab the current thread MDC data) Map<String, String> contextMap = MDC.getCopyOfContextMap(); final RequestAttributes reqAtt = RequestContextHolder.getRequestAttributes(); // final SecurityContext securityContext = SecurityContextHolder.getContext(); return () -> { try { // Right now: @Async thread context ! // (Restore the Web thread context's MDC data) MDC.setContextMap(contextMap); RequestContextHolder.setRequestAttributes(reqAtt); // SecurityContextHolder.setContext(securityContext); runnable.run(); } finally { MDC.clear(); } }; } }
[ "sureshmail4u@gmail.com" ]
sureshmail4u@gmail.com
b100856abf01f391960a7de76f1d7f58bde3c387
a803976462e4c4094db2834d82edeb9ee9b9abaa
/TestServlet/src/com/anka/fcm/FCMPushNotification.java
d1fc1ba8a0e7d3278aa4b37bb6c5fd2aee51514a
[]
no_license
GovindCoding/bdo-code
a1f78ed70eb85f89fda7acc3cb0e3ad6d3fd563f
b3aadb8cd12467a35d5579a6cf7e4d7ac1b41f68
refs/heads/master
2021-10-09T15:44:55.481709
2018-12-31T07:06:49
2018-12-31T07:06:49
113,535,615
0
0
null
null
null
null
UTF-8
Java
false
false
289
java
package com.anka.fcm; public class FCMPushNotification { public static void main(String[] args) { // TODO Auto-generated method stub try { PushNotification.pushFCMNotification(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "govindeak@gmail.com" ]
govindeak@gmail.com
f7f141aae7e5b718ed66dbe70d12f54bcc888d43
492015ccca08e88cac0fc89af8fdd043411af619
/DixitaWedsHarsh/app/src/androidTest/java/com/dixitawedsharsh/ExampleInstrumentedTest.java
2d453ba0b91e938a8658f32213d0eefc8800a584
[]
no_license
adityashah27/Android-Projects
c16d82f10ef0afecbe1150fe4974c754739ce1dc
0e1d814649b39e764fb1be43b8fd1b3637900171
refs/heads/master
2021-08-23T03:55:13.238999
2017-12-03T03:23:09
2017-12-03T03:23:09
112,895,675
0
0
null
null
null
null
UTF-8
Java
false
false
742
java
package com.dixitawedsharsh; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.dixitawedsharsh", appContext.getPackageName()); } }
[ "aditya.bs@somaiya.edu" ]
aditya.bs@somaiya.edu
ef14ffb70b2396208ab0c7f335333448868d0dc9
467487f90942539a95cd12a09bc9baa7641e52d0
/src/main/java/com/github/jwenjian/springboot/starter/fastdfs/FastDfsManager.java
18c12943cbecc9303c82da87cbfd508fd0e9f754
[ "Apache-2.0" ]
permissive
jwenjian/spring-boot-starter-fastdfs
9fb770848d469e56ec91476259b9bc80ab1c390b
0a44f7e5b2e1d149ad87b8dcc7e585289d306ffa
refs/heads/master
2020-03-15T15:00:04.889624
2018-06-01T08:16:45
2018-06-01T08:16:45
132,202,135
2
0
null
null
null
null
UTF-8
Java
false
false
1,330
java
package com.github.jwenjian.springboot.starter.fastdfs; import org.csource.fastdfs.*; /** * A manager(wrapper) of original fastdfs client. * * @author jwenjian */ public class FastDfsManager { private TrackerClient trackerClient; private TrackerServer trackerServer; private StorageServer storageServer; private StorageClient1 storageClient1; /** * Constructor * * @param trackerClient Initialized tracker client instance * @param trackerServer Initialized tracker server instance * @param storageServer Initialized storage server instance * @param storageClient1 Initialized storage client1 instance */ FastDfsManager(TrackerClient trackerClient, TrackerServer trackerServer, StorageServer storageServer, StorageClient1 storageClient1) { this.trackerClient = trackerClient; this.trackerServer = trackerServer; this.storageServer = storageServer; this.storageClient1 = storageClient1; } public TrackerClient getTrackerClient() { return trackerClient; } public TrackerServer getTrackerServer() { return trackerServer; } public StorageServer getStorageServer() { return storageServer; } public StorageClient1 getStorageClient1() { return storageClient1; } }
[ "1639301503@qq.com" ]
1639301503@qq.com
fc46a77399c74e35089d87e7ee4b71f7ef715af3
75e7d1a3ab7e6bf8e9305827aebb787cd6ed94e6
/study/thinkinjava/src/main/java/thinkinjava/containers/SlowMap.java
4f6798372c092a4d4b5e33a2696a9164e23ac278
[ "Apache-2.0" ]
permissive
nickshang/study
9f3f8c9b4bfe72a67b54aed24973e9bb941b603a
49afda86aa3a816a21d998a8456106a6d78d7cf5
refs/heads/master
2021-01-22T10:59:36.107512
2018-03-01T14:57:24
2018-03-01T14:57:24
102,343,161
0
0
null
null
null
null
UTF-8
Java
false
false
1,807
java
package thinkinjava.containers;//: containers/SlowMap.java // A Map implemented with ArrayLists. import net.mindview.util.Countries; import java.util.*; public class SlowMap<K,V> extends AbstractMap<K,V> { private List<K> keys = new ArrayList<K>(); private List<V> values = new ArrayList<V>(); public V put(K key, V value) { V oldValue = get(key); // The old value or null if(!keys.contains(key)) { keys.add(key); values.add(value); } else values.set(keys.indexOf(key), value); return oldValue; } public V get(Object key) { // key is type Object, not K if(!keys.contains(key)) return null; return values.get(keys.indexOf(key)); } public Set<Entry<K,V>> entrySet() { Set<Entry<K,V>> set= new HashSet<Entry<K,V>>(); Iterator<K> ki = keys.iterator(); Iterator<V> vi = values.iterator(); while(ki.hasNext()) set.add(new MapEntry<K,V>(ki.next(), vi.next())); return set; } public static void main(String[] args) { SlowMap<String,String> m= new SlowMap<String,String>(); m.putAll(Countries.capitals(15)); System.out.println(m); System.out.println(m.get("BULGARIA")); System.out.println(m.entrySet()); } } /* Output: {CAMEROON=Yaounde, CHAD=N'djamena, CONGO=Brazzaville, CAPE VERDE=Praia, ALGERIA=Algiers, COMOROS=Moroni, CENTRAL AFRICAN REPUBLIC=Bangui, BOTSWANA=Gaberone, BURUNDI=Bujumbura, BENIN=Porto-Novo, BULGARIA=Sofia, EGYPT=Cairo, ANGOLA=Luanda, BURKINA FASO=Ouagadougou, DJIBOUTI=Dijibouti} Sofia [CAMEROON=Yaounde, CHAD=N'djamena, CONGO=Brazzaville, CAPE VERDE=Praia, ALGERIA=Algiers, COMOROS=Moroni, CENTRAL AFRICAN REPUBLIC=Bangui, BOTSWANA=Gaberone, BURUNDI=Bujumbura, BENIN=Porto-Novo, BULGARIA=Sofia, EGYPT=Cairo, ANGOLA=Luanda, BURKINA FASO=Ouagadougou, DJIBOUTI=Dijibouti] *///:~
[ "ssj00@163.com" ]
ssj00@163.com
bd1c280f32b3125628e4d4a609cc587b5455b1a7
2e007171683616881b62eb3f1db8b271dc3284d1
/axinfu-model/src/main/java/modellib/thrift/payment/QuickPayMethod.java
e5e318e8143fb9ad871a36c1bf0be944f97e2a95
[ "Apache-2.0" ]
permissive
ZcrPro/axinfu
cc85856cefbd4b2050566d2d18f611e664facd9d
66fc7c6df4c6ea8a8a01a0008d5165eb6e53f09a
refs/heads/master
2020-03-20T08:45:38.205203
2018-07-09T01:56:39
2018-07-09T01:56:39
127,858,246
0
0
null
null
null
null
UTF-8
Java
false
false
362
java
package modellib.thrift.payment; import java.io.Serializable; import java.util.List; /** * Created by zcrprozcrpro on 2017/8/1. */ public class QuickPayMethod implements Serializable { public String merchant_code; public String channel; public String promotion_hint; public String assistance_hint; public List<String> supported_banks; }
[ "zcrpro@gmail.com" ]
zcrpro@gmail.com
951c019c97cb947b500b2a788dded0418dc504c4
9259bb523e4f2085ca0ae3be84ff3ce861875b9a
/common/java/core/net/i2p/client/datagram/I2PDatagramDissector.java
945043ea6c145ade9fb7f8c0331fac40ddd1bbb8
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
permissive
PDAHubbard/Nightweb
8f607bd48cf72dd7221a3093fc10bac4b53fed88
7966ab2bcb87ea92abd6741f6184885afbad6fee
refs/heads/master
2021-01-22T12:12:22.346366
2013-11-26T20:35:57
2013-11-26T20:35:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,991
java
package net.i2p.client.datagram; /* * free (adj.): unencumbered; not under the control of others * Written by human in 2004 and released into the public domain * with no warranty of any kind, either expressed or implied. * It probably won't make your computer catch on fire, or eat * your children, but it might. Use at your own risk. * */ import java.io.ByteArrayInputStream; import java.io.IOException; import net.i2p.I2PAppContext; import net.i2p.crypto.DSAEngine; import net.i2p.crypto.SHA256Generator; import net.i2p.data.DataFormatException; import net.i2p.data.Destination; import net.i2p.data.Hash; import net.i2p.data.Signature; import net.i2p.util.Log; /** * Class for dissecting I2P repliable datagrams, checking the authenticity of * the sender. Note that objects of this class are NOT THREAD SAFE! * * @author human */ public final class I2PDatagramDissector { private static final int DGRAM_BUFSIZE = 32768; private final DSAEngine dsaEng = DSAEngine.getInstance(); private final SHA256Generator hashGen = SHA256Generator.getInstance(); private Hash rxHash; private Signature rxSign; private Destination rxDest; private final byte[] rxPayload = new byte[DGRAM_BUFSIZE]; private int rxPayloadLen; private boolean valid; /** * Crate a new I2P repliable datagram dissector. */ public I2PDatagramDissector() { // nop } /** * Load an I2P repliable datagram into the dissector. * Does NOT verify the signature. * * @param dgram non-null I2P repliable datagram to be loaded * * @throws DataFormatException If there's an error in the datagram format */ public void loadI2PDatagram(byte[] dgram) throws DataFormatException { ByteArrayInputStream dgStream = new ByteArrayInputStream(dgram); // set invalid(very important!) this.valid = false; try { rxDest = new Destination(); rxSign = new Signature(); // read destination rxDest.readBytes(dgStream); // read signature rxSign.readBytes(dgStream); // read payload rxPayloadLen = dgStream.read(rxPayload); // calculate the hash of the payload this.rxHash = hashGen.calculateHash(rxPayload, 0, rxPayloadLen); assert this.hashGen.calculateHash(this.extractPayload()).equals(this.rxHash); } catch (IOException e) { Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramDissector.class); log.error("Caught IOException - INCONSISTENT STATE!", e); } catch(AssertionError e) { Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramDissector.class); log.error("Assertion failed!", e); } //_log.debug("Datagram payload size: " + rxPayloadLen + "; content:\n" // + HexDump.dump(rxPayload, 0, rxPayloadLen)); } /** * Get the payload carried by an I2P repliable datagram (previously loaded * with the loadI2PDatagram() method), verifying the datagram signature. * * @return A byte array containing the datagram payload * * @throws I2PInvalidDatagramException if the signature verification fails */ public byte[] getPayload() throws I2PInvalidDatagramException { this.verifySignature(); return this.extractPayload(); } /** * Get the sender of an I2P repliable datagram (previously loaded with the * loadI2PDatagram() method), verifying the datagram signature. * * @return The Destination of the I2P repliable datagram sender * * @throws I2PInvalidDatagramException if the signature verification fails */ public Destination getSender() throws I2PInvalidDatagramException { this.verifySignature(); return this.extractSender(); } /** * Extract the hash of the payload of an I2P repliable datagram (previously * loaded with the loadI2PDatagram() method), verifying the datagram * signature. * @return The hash of the payload of the I2P repliable datagram * @throws I2PInvalidDatagramException if the signature verification fails */ public Hash getHash() throws I2PInvalidDatagramException { // make sure it has a valid signature this.verifySignature(); return this.extractHash(); } /** * Extract the payload carried by an I2P repliable datagram (previously * loaded with the loadI2PDatagram() method), without verifying the * datagram signature. * * @return A byte array containing the datagram payload */ public byte[] extractPayload() { byte[] retPayload = new byte[this.rxPayloadLen]; System.arraycopy(this.rxPayload, 0, retPayload, 0, this.rxPayloadLen); return retPayload; } /** * Extract the sender of an I2P repliable datagram (previously loaded with * the loadI2PDatagram() method), without verifying the datagram signature. * * @return The Destination of the I2P repliable datagram sender */ public Destination extractSender() { if (this.rxDest == null) return null; Destination retDest = new Destination(); try { retDest.fromByteArray(this.rxDest.toByteArray()); } catch (DataFormatException e) { Log log = I2PAppContext.getGlobalContext().logManager().getLog(I2PDatagramDissector.class); log.error("Caught DataFormatException", e); return null; } return retDest; } /** * Extract the hash of the payload of an I2P repliable datagram (previously * loaded with the loadI2PDatagram() method), without verifying the datagram * signature. * @return The hash of the payload of the I2P repliable datagram */ public Hash extractHash() { return this.rxHash; } /** * Verify the signature of this datagram (previously loaded with the * loadI2PDatagram() method) * @throws I2PInvalidDatagramException if the signature is invalid */ public void verifySignature() throws I2PInvalidDatagramException { // first check if it already got validated if(this.valid) return; if (rxSign == null || rxSign.getData() == null || rxDest == null || rxDest.getSigningPublicKey() == null) throw new I2PInvalidDatagramException("Datagram not yet read"); // now validate if (!this.dsaEng.verifySignature(rxSign, rxHash.getData(), rxDest.getSigningPublicKey())) throw new I2PInvalidDatagramException("Incorrect I2P repliable datagram signature"); // set validated this.valid = true; } }
[ "zsoakes@gmail.com" ]
zsoakes@gmail.com
13b32ec30288f4db4fed244aa932960599a2fcf0
a94d20a6346d219c84cc97c9f7913f1ce6aba0f8
/felles/felles/db/src/main/java/no/nav/vedtak/felles/db/doc/model/Kodeverk.java
25de69a8ce1366deb7a4a6f377c8763c086dbcfa
[ "MIT" ]
permissive
junnae/spsak
3c8a155a1bf24c30aec1f2a3470289538c9de086
ede4770de33bd896d62225a9617b713878d1efa5
refs/heads/master
2020-09-11T01:56:53.748986
2019-02-06T08:14:42
2019-02-06T08:14:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,365
java
package no.nav.vedtak.felles.db.doc.model; import io.github.swagger2markup.markup.builder.MarkupDocBuilder; import io.github.swagger2markup.markup.builder.MarkupTableColumn; import javax.sql.DataSource; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; public class Kodeverk implements MarkupOutput { public static final String KODEVERK_PK_SPEC = System.getProperty("doc.plugin.jdbc.kodeverk.pk", "KODE"); public static final Set<String> KODEVERK_UNNTAK_KOLONNER = toList( System.getProperty("doc.plugin.jdbc.kodeverk.kolonne.unntak", "ENDRET_AV, OPPRETTET_AV, ENDRET_TID, OPPRETTET_TID")); private Table table; private Set<String> unntakKolonner = KODEVERK_UNNTAK_KOLONNER; public Kodeverk(Table table) { this.table = table; } @Override public void apply(int sectionLevel, MarkupDocBuilder doc) { doc.sectionTitleLevel(sectionLevel + 1, table.getName().toUpperCase()); if (!table.isErDelTabell()) table.writeTableComment(doc); List<MarkupTableColumn> columnSpecs = new ArrayList<>(); for (Column c : table.getColumnsExcept(unntakKolonner)) { columnSpecs.add(new MarkupTableColumn(c.getName()).withHeaderColumn(c.isPrimaryKey())); } final List<java.util.List<String>> cells = new ArrayList<>(); final AtomicInteger i = new AtomicInteger(); table.getRows().forEach(c -> { if (i.incrementAndGet() >= 1) { // skipper første rad, inneholder kun headere cells.add(c); } }); if (cells.isEmpty()) { cells.add(Collections.nCopies(columnSpecs.size(), "")); } doc.tableWithColumnSpecs(columnSpecs, cells); } public static Set<String> toList(String property) { Set<String> list = new HashSet<>(); try (@SuppressWarnings("resource") Scanner scanner = new Scanner(property).useDelimiter(",\\s*");) { while (scanner.hasNext()) { list.add(scanner.next()); } return list; } } public static void readReferenceData(JdbcModel jdbcModel, DataSource ds) throws SQLException { try (Connection c = ds.getConnection()) { for (Table table : jdbcModel.getTables()) { if (table.isKodeverk() || table.isKodeliste()) { List<Column> selectColumns = table.getColumnsExcept(KODEVERK_UNNTAK_KOLONNER); readRows(c, table, selectColumns.stream().map(col -> col.getName()).collect(Collectors.toList())); } } } } static void readRows(Connection c, Table table, List<String> selectColumns) throws SQLException { int numRows = 0; try (PreparedStatement ps = c .prepareStatement("select " + String.join(", ", selectColumns) + " from " + table.getName()); ResultSet rs = ps.executeQuery(); ) { while (rs.next()) { numRows++; List<String> row = new ArrayList<>(); for (int i = 0; i < selectColumns.size(); i++) { String column = selectColumns.get(i); String value = rs.getString(column); row.add(value); } if (table.isKodeliste()) { Optional<List<String>> filteredRow = filterKodelisteRow(selectColumns, row); if (filteredRow.isPresent()) { table.addRow(filteredRow.get(), false); } } else { table.addRow(row, false); System.out.println(row); } } } if (numRows > 0) { table.addRow(selectColumns, true); } } private static Optional<List<String>> filterKodelisteRow(List<String> selectColumns, List<String> row) { int colIndex = selectColumns.indexOf("KODEVERK"); if ("POSTSTED".equalsIgnoreCase(row.get(colIndex))) { return Optional.empty(); } return Optional.of(row); } }
[ "roy.andre.gundersen@nav.no" ]
roy.andre.gundersen@nav.no
5aca0aa6df808413e8eb4e3975c9094ebf287433
0d431ef258e784a3f7ffde1004d96a0056ff1313
/src/main/zahlensysteme/Zahlensysteme.java
28c2b77efcacfb050d8b3aff0535f6591c6b8e9d
[]
no_license
geopeter91/Uebung3
f40349f746692d481a8fa24f707bee05c53b2eb9
edc9337684e855f496d2e17ba39cb44c1c336aeb
refs/heads/master
2020-03-19T09:31:27.997375
2018-06-06T09:23:43
2018-06-06T09:23:43
136,296,375
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,159
java
package main.zahlensysteme; public class Zahlensysteme { public void start() { System.out.println("\n__START ZAHLENSYSTEME__"); int myDec = 42; String myBin = "101010"; String myHex = "2a"; String dToB = decToBin(myDec); System.out.println("Die Dezimalzahl "+myDec+" in Binärform: "+dToB); int bToD = binToDec(myBin); System.out.println("Die Dezimalzahl "+myBin+" in Hexadezimal: "+bToD); String dToH = decToHexa(myDec); System.out.println("Die Dezimalzahl "+myDec+" in Hexadezimal: "+dToH); int hToD = hexToDec(myHex); System.out.println("Die Hexadezimalzahl "+myHex+" in Dezimal: "+hToD); String bToH = binToHex(myBin); System.out.println("Die Binärzahl "+myBin+" in Hexadezimal: "+bToH); } public String decToBin(int a) { return Integer.toBinaryString(a); } public int binToDec(String a) { return Integer.parseInt(a, 2); } public String decToHexa(int a) { return Integer.toString(a, 16); } public int hexToDec(String a) { return Integer.parseInt(a, 16); } public String binToHex(String a) { int dec = binToDec(a); String bin = decToHexa(dec); return bin; } }
[ "s72210@beuth-hochschule.de" ]
s72210@beuth-hochschule.de
b802e153168236995cea59df38db64fc2f5094ab
33c61ac9f51fb9d7479db7cf5ca80375dd881311
/mybatis-generator-pluginsplus/src/main/java/xyz/vsl/mybatis/generator/pluginsplus/BiPredicate.java
30d3a6bdc26e9dc68b316d9535e2994763381bcd
[ "BSD-3-Clause" ]
permissive
bapleliu/mybatis-generator-pluginsplus
86ed597c47ec4e68dbe197db8eb9b987fad535a0
16c4ddf19bb0b25fc1b432124867cbb7e66c8286
refs/heads/master
2021-01-21T20:56:16.971983
2017-05-25T01:17:50
2017-05-25T01:17:50
92,290,529
0
0
null
2017-05-24T12:35:33
2017-05-24T12:35:33
null
UTF-8
Java
false
false
398
java
package xyz.vsl.mybatis.generator.pluginsplus; /** * Backport of java.util.function.BiPredicate * @author Vladimir Lokhov */ interface BiPredicate<T,U> { public BiPredicate<T, U> and(final BiPredicate<? super T, ? super U> other); public BiPredicate<T, U> or(final BiPredicate<? super T, ? super U> other); public BiPredicate<T, U> negate(); public boolean test(T t, U u); }
[ "vsl1978@gmail.com" ]
vsl1978@gmail.com
bcccd3aafe5847661050515345ec441a42aea917
065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be
/eclipseswt_cluster/25704/tar_0.java
964eebdfa904a6bb05335b278dd17a81f622bd2e
[]
no_license
martinezmatias/GenPat-data-C3
63cfe27efee2946831139747e6c20cf952f1d6f6
b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4
refs/heads/master
2022-04-25T17:59:03.905613
2020-04-15T14:41:34
2020-04-15T14:41:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
38,621
java
/******************************************************************************* * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.program; import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.internal.*; import org.eclipse.swt.internal.gnome.*; import org.eclipse.swt.internal.cde.*; import org.eclipse.swt.internal.gtk.*; import org.eclipse.swt.widgets.*; import java.io.*; import java.util.*; /** * Instances of this class represent programs and * their associated file extensions in the operating * system. * * @see <a href="http://www.eclipse.org/swt/snippets/#program">Program snippets</a> * @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> */ public final class Program { String name = ""; //$NON-NLS-1$ String command; String iconPath; Display display; /* Gnome & GIO specific * true if command expects a URI * false if expects a path */ boolean gnomeExpectUri; static long /*int*/ modTime; static Hashtable mimeTable; static long /*int*/ cdeShell; static final String[] CDE_ICON_EXT = { ".m.pm", ".l.pm", ".s.pm", ".t.pm" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ static final String[] CDE_MASK_EXT = { ".m_m.bm", ".l_m.bm", ".s_m.bm", ".t_m.bm" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ static final String DESKTOP_DATA = "Program_DESKTOP"; //$NON-NLS-1$ static final String ICON_THEME_DATA = "Program_GNOME_ICON_THEME"; //$NON-NLS-1$ static final String PREFIX_HTTP = "http://"; //$NON-NLS-1$ static final String PREFIX_HTTPS = "https://"; //$NON-NLS-1$ static final int DESKTOP_UNKNOWN = 0; static final int DESKTOP_GNOME = 1; static final int DESKTOP_GIO = 2; static final int DESKTOP_CDE = 3; static final int PREFERRED_ICON_SIZE = 16; /** * Prevents uninitialized instances from being created outside the package. */ Program() { } /* Determine the desktop for the given display. */ static int getDesktop(final Display display) { if (display == null) return DESKTOP_UNKNOWN; Integer desktopValue = (Integer)display.getData(DESKTOP_DATA); if (desktopValue != null) return desktopValue.intValue(); int desktop = DESKTOP_UNKNOWN; /* Get the list of properties on the root window. */ long /*int*/ xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default()); long /*int*/ rootWindow = OS.XDefaultRootWindow(xDisplay); int[] numProp = new int[1]; long /*int*/ propList = OS.XListProperties(xDisplay, rootWindow, numProp); long /*int*/ [] property = new long /*int*/ [numProp[0]]; if (propList != 0) { OS.memmove(property, propList, (property.length * OS.PTR_SIZEOF)); OS.XFree(propList); } /* * Feature in Linux Desktop. There is currently no official way to * determine whether the Gnome window manager or gnome-vfs is * available. Earlier versions including Red Hat 9 and Suse 9 provide * a documented Gnome specific property on the root window * WIN_SUPPORTING_WM_CHECK. This property is no longer supported in newer * versions such as Fedora Core 2. * The workaround is to simply check that the window manager is a * compliant one (property _NET_SUPPORTING_WM_CHECK) and to attempt to load * our native library that depends on gnome-vfs. * * Note: GIO is used when available instead of gnome-vfs. */ if (desktop == DESKTOP_UNKNOWN) { byte[] gnomeName = Converter.wcsToMbcs(null, "_NET_SUPPORTING_WM_CHECK", true); long /*int*/ gnome = OS.XInternAtom(xDisplay, gnomeName, true); if (gnome != OS.None) { /* Check for the existence of libgio libraries first */ byte[] buffer; int flags = OS.RTLD_LAZY; if (OS.IsAIX) { buffer = Converter.wcsToMbcs(null, "libgio-2.0.a(libgio-2.0.so.0)", true); flags |= OS.RTLD_MEMBER; } else if (OS.IsHPUX) { buffer = Converter.wcsToMbcs(null, "libgio-2.0.so", true); } else { buffer = Converter.wcsToMbcs(null, "libgio-2.0.so.0", true); } long /*int*/ libgio = OS.dlopen(buffer, flags); if (libgio != 0) { buffer = Converter.wcsToMbcs(null, "g_app_info_launch_default_for_uri", true); long /*int*/ g_app_info_launch_default_for_uri = OS.dlsym(libgio, buffer); if (g_app_info_launch_default_for_uri != 0) { desktop = DESKTOP_GIO; } OS.dlclose(libgio); } if (desktop == DESKTOP_UNKNOWN && gnome_init()) { desktop = DESKTOP_GNOME; long /*int*/ icon_theme = GNOME.gnome_icon_theme_new(); display.setData(ICON_THEME_DATA, new LONG(icon_theme)); display.addListener(SWT.Dispose, new Listener() { public void handleEvent(Event event) { LONG gnomeIconTheme = (LONG)display.getData(ICON_THEME_DATA); if (gnomeIconTheme == null) return; display.setData(ICON_THEME_DATA, null); /* * Note. gnome_icon_theme_new uses g_object_new to allocate the * data it returns. Use g_object_unref to free the pointer it returns. */ if (gnomeIconTheme.value != 0) OS.g_object_unref(gnomeIconTheme.value); } }); } } } /* * On CDE, the atom below may exist without DTWM running. If the atom * below is defined, the CDE database exists and the available * applications can be queried. */ if (desktop == DESKTOP_UNKNOWN) { byte[] cdeName = Converter.wcsToMbcs(null, "_DT_SM_PREFERENCES", true); long /*int*/ cde = OS.XInternAtom(xDisplay, cdeName, true); for (int index = 0; desktop == DESKTOP_UNKNOWN && index < property.length; index++) { if (property[index] == OS.None) continue; /* do not match atoms that do not exist */ if (property[index] == cde && cde_init(display)) desktop = DESKTOP_CDE; } } display.setData(DESKTOP_DATA, new Integer(desktop)); return desktop; } boolean cde_execute(String fileName) { /* Use the character encoding for the default locale */ byte[] action = Converter.wcsToMbcs(null, command, true); byte[] fileArg = Converter.wcsToMbcs(null, fileName, true); long /*int*/ ptr = OS.g_malloc(fileArg.length); OS.memmove(ptr, fileArg, fileArg.length); DtActionArg args = new DtActionArg(); args.argClass = CDE.DtACTION_FILE; args.name = ptr; long actionID = CDE.DtActionInvoke(cdeShell, action, args, 1, null, null, null, 1, 0, 0); OS.g_free(ptr); return actionID != 0; } static String cde_getAction(String dataType) { String action = null; String actions = cde_getAttribute(dataType, CDE.DtDTS_DA_ACTION_LIST); if (actions != null) { int index = actions.indexOf("Open"); if (index != -1) { action = actions.substring(index, index + 4); } else { index = actions.indexOf(","); action = index != -1 ? actions.substring(0, index) : actions; } } return action; } static String cde_getAttribute(String dataType, String attrName) { /* Use the character encoding for the default locale */ byte[] dataTypeBuf = Converter.wcsToMbcs(null, dataType, true); byte[] attrNameBuf = Converter.wcsToMbcs(null, attrName, true); byte[] optNameBuf = null; long /*int*/ attrValue = CDE.DtDtsDataTypeToAttributeValue(dataTypeBuf, attrNameBuf, optNameBuf); if (attrValue == 0) return null; int length = OS.strlen(attrValue); byte[] attrValueBuf = new byte[length]; OS.memmove(attrValueBuf, attrValue, length); CDE.DtDtsFreeAttributeValue(attrValue); /* Use the character encoding for the default locale */ return new String(Converter.mbcsToWcs(null, attrValueBuf)); } static Hashtable cde_getDataTypeInfo() { Hashtable dataTypeInfo = new Hashtable(); int index; long /*int*/ dataTypeList = CDE.DtDtsDataTypeNames(); if (dataTypeList != 0) { /* For each data type name in the list */ index = 0; long /*int*/ [] dataType = new long /*int*/ [1]; OS.memmove(dataType, dataTypeList + (index++ * 4), 4); while (dataType[0] != 0) { int length = OS.strlen(dataType[0]); byte[] dataTypeBuf = new byte[length]; OS.memmove(dataTypeBuf, dataType[0], length); /* Use the character encoding for the default locale */ String dataTypeName = new String(Converter.mbcsToWcs(null, dataTypeBuf)); /* The data type is valid if it is not an action, and it has an extension and an action. */ String extension = cde_getExtension(dataTypeName); if (!CDE.DtDtsDataTypeIsAction(dataTypeBuf) && extension != null && cde_getAction(dataTypeName) != null) { Vector exts = new Vector(); exts.addElement(extension); dataTypeInfo.put(dataTypeName, exts); } OS.memmove(dataType, dataTypeList + (index++ * 4), 4); } CDE.DtDtsFreeDataTypeNames(dataTypeList); } return dataTypeInfo; } static String cde_getExtension(String dataType) { String fileExt = cde_getAttribute(dataType, CDE.DtDTS_DA_NAME_TEMPLATE); if (fileExt == null || fileExt.indexOf("%s.") == -1) return null; int dot = fileExt.indexOf("."); return fileExt.substring(dot); } /** * CDE - Get Image Data * * This method returns the image data of the icon associated with * the data type. Since CDE supports multiple sizes of icons, several * attempts are made to locate an icon of the desired size and format. * CDE supports the sizes: tiny, small, medium and large. The best * search order is medium, large, small and then tiny. Althoug CDE supports * colour and monochrome bitmaps, only colour icons are tried. (The order is * defined by the cdeIconExt and cdeMaskExt arrays above.) */ ImageData cde_getImageData() { // TODO return null; } static String cde_getMimeType(String extension) { String mimeType = null; Hashtable mimeInfo = cde_getDataTypeInfo(); if (mimeInfo == null) return null; Enumeration keys = mimeInfo.keys(); while (mimeType == null && keys.hasMoreElements()) { String type = (String)keys.nextElement(); Vector mimeExts = (Vector)mimeInfo.get(type); for (int index = 0; index < mimeExts.size(); index++){ if (extension.equals(mimeExts.elementAt(index))) { mimeType = type; break; } } } return mimeType; } static Program cde_getProgram(Display display, String mimeType) { String command = cde_getAction(mimeType); if (command == null) return null; Program program = new Program(); program.display = display; program.name = mimeType; program.command = command; program.iconPath = cde_getAttribute(program.name, CDE.DtDTS_DA_ICON); return program; } static boolean cde_init(Display display) { try { Library.loadLibrary("swt-cde"); } catch (Throwable e) { return false; } /* Use the character encoding for the default locale */ CDE.XtToolkitInitialize(); long /*int*/ xtContext = CDE.XtCreateApplicationContext (); long /*int*/ xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default()); byte[] appName = Converter.wcsToMbcs(null, "CDE", true); byte[] appClass = Converter.wcsToMbcs(null, "CDE", true); long /*int*/ [] argc = new long /*int*/ [] {0}; CDE.XtDisplayInitialize(xtContext, xDisplay, appName, appClass, 0, 0, argc, 0); long /*int*/ widgetClass = CDE.topLevelShellWidgetClass (); cdeShell = CDE.XtAppCreateShell (appName, appClass, widgetClass, xDisplay, null, 0); CDE.XtSetMappedWhenManaged (cdeShell, false); CDE.XtResizeWidget (cdeShell, 10, 10, 0); CDE.XtRealizeWidget (cdeShell); boolean initOK = CDE.DtAppInitialize(xtContext, xDisplay, cdeShell, appName, appName); if (initOK) CDE.DtDbLoad(); return initOK; } static boolean cde_isExecutable(String fileName) { byte [] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true); return OS.access(fileNameBuffer, OS.X_OK) == 0; //TODO find the content type of the file and check if it is executable } static String[] parseCommand(String cmd) { Vector args = new Vector(); int sIndex = 0; int eIndex; while (sIndex < cmd.length()) { /* Trim initial white space of argument. */ while (sIndex < cmd.length() && Compatibility.isWhitespace(cmd.charAt(sIndex))) { sIndex++; } if (sIndex < cmd.length()) { /* If the command is a quoted string */ if (cmd.charAt(sIndex) == '"' || cmd.charAt(sIndex) == '\'') { /* Find the terminating quote (or end of line). * This code currently does not handle escaped characters (e.g., " a\"b"). */ eIndex = sIndex + 1; while (eIndex < cmd.length() && cmd.charAt(eIndex) != cmd.charAt(sIndex)) eIndex++; if (eIndex >= cmd.length()) { /* The terminating quote was not found * Add the argument as is with only one initial quote. */ args.addElement(cmd.substring(sIndex, eIndex)); } else { /* Add the argument, trimming off the quotes. */ args.addElement(cmd.substring(sIndex + 1, eIndex)); } sIndex = eIndex + 1; } else { /* Use white space for the delimiters. */ eIndex = sIndex; while (eIndex < cmd.length() && !Compatibility.isWhitespace(cmd.charAt(eIndex))) eIndex++; args.addElement(cmd.substring(sIndex, eIndex)); sIndex = eIndex + 1; } } } String[] strings = new String[args.size()]; for (int index =0; index < args.size(); index++) { strings[index] = (String)args.elementAt(index); } return strings; } /** * GNOME 2.4 - Execute the program for the given file. */ boolean gnome_execute(String fileName) { byte[] mimeTypeBuffer = Converter.wcsToMbcs(null, name, true); long /*int*/ ptr = GNOME.gnome_vfs_mime_get_default_application(mimeTypeBuffer); byte[] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true); long /*int*/ uri = GNOME.gnome_vfs_make_uri_from_input_with_dirs(fileNameBuffer, GNOME.GNOME_VFS_MAKE_URI_DIR_CURRENT); long /*int*/ list = OS.g_list_append(0, uri); int result = GNOME.gnome_vfs_mime_application_launch(ptr, list); GNOME.gnome_vfs_mime_application_free(ptr); OS.g_free(uri); OS.g_list_free(list); return result == GNOME.GNOME_VFS_OK; } /** * GNOME 2.4 - Launch the default program for the given file. */ static boolean gnome_launch(String fileName) { byte[] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true); long /*int*/ uri = GNOME.gnome_vfs_make_uri_from_input_with_dirs(fileNameBuffer, GNOME.GNOME_VFS_MAKE_URI_DIR_CURRENT); int result = GNOME.gnome_vfs_url_show(uri); OS.g_free(uri); return (result == GNOME.GNOME_VFS_OK); } /** * GNOME - Get Image Data * */ ImageData gnome_getImageData() { if (iconPath == null) return null; try { return new ImageData(iconPath); } catch (Exception e) {} return null; } static String gnome_getMimeType(String extension) { String mimeType = null; String fileName = "swt" + extension; byte[] extensionBuffer = Converter.wcsToMbcs(null, fileName, true); long /*int*/ typeName = GNOME.gnome_vfs_mime_type_from_name(extensionBuffer); if (typeName != 0) { int length = OS.strlen(typeName); if (length > 0) { byte [] buffer = new byte[length]; OS.memmove(buffer, typeName, length); mimeType = new String(Converter.mbcsToWcs(null, buffer)); } } return mimeType; } static Program gnome_getProgram(Display display, String mimeType) { Program program = null; byte[] mimeTypeBuffer = Converter.wcsToMbcs(null, mimeType, true); long /*int*/ ptr = GNOME.gnome_vfs_mime_get_default_application(mimeTypeBuffer); if (ptr != 0) { program = new Program(); program.display = display; program.name = mimeType; GnomeVFSMimeApplication application = new GnomeVFSMimeApplication(); GNOME.memmove(application, ptr, GnomeVFSMimeApplication.sizeof); if (application.command != 0) { int length = OS.strlen(application.command); if (length > 0) { byte[] buffer = new byte[length]; OS.memmove(buffer, application.command, length); program.command = new String(Converter.mbcsToWcs(null, buffer)); } } program.gnomeExpectUri = application.expects_uris == GNOME.GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS; int length = OS.strlen(application.id); byte[] buffer = new byte[length + 1]; OS.memmove(buffer, application.id, length); LONG gnomeIconTheme = (LONG)display.getData(ICON_THEME_DATA); long /*int*/ icon_name = GNOME.gnome_icon_lookup(gnomeIconTheme.value, 0, null, buffer, 0, mimeTypeBuffer, GNOME.GNOME_ICON_LOOKUP_FLAGS_NONE, null); long /*int*/ path = 0; if (icon_name != 0) path = GNOME.gnome_icon_theme_lookup_icon(gnomeIconTheme.value, icon_name, PREFERRED_ICON_SIZE, null, null); if (path != 0) { length = OS.strlen(path); if (length > 0) { buffer = new byte[length]; OS.memmove(buffer, path, length); program.iconPath = new String(Converter.mbcsToWcs(null, buffer)); } OS.g_free(path); } if (icon_name != 0) OS.g_free(icon_name); GNOME.gnome_vfs_mime_application_free(ptr); } return program != null && program.command != null ? program : null; } static boolean gnome_init() { try { return GNOME.gnome_vfs_init(); } catch (Throwable e) { return false; } } static boolean gnome_isExecutable(String fileName) { /* check if the file is executable */ byte [] fileNameBuffer = Converter.wcsToMbcs(null, fileName, true); if (!GNOME.gnome_vfs_is_executable_command_string(fileNameBuffer)) return false; /* check if the mime type is executable */ long /*int*/ uri = GNOME.gnome_vfs_make_uri_from_input(fileNameBuffer); long /*int*/ mimeType = GNOME.gnome_vfs_get_mime_type(uri); OS.g_free(uri); byte[] exeType = Converter.wcsToMbcs (null, "application/x-executable", true); //$NON-NLS-1$ boolean result = GNOME.gnome_vfs_mime_type_get_equivalence(mimeType, exeType) != GNOME.GNOME_VFS_MIME_UNRELATED; if (!result) { byte [] shellType = Converter.wcsToMbcs (null, "application/x-shellscript", true); //$NON-NLS-1$ result = GNOME.gnome_vfs_mime_type_get_equivalence(mimeType, shellType) == GNOME.GNOME_VFS_MIME_IDENTICAL; } return result; } /** * Finds the program that is associated with an extension. * The extension may or may not begin with a '.'. Note that * a <code>Display</code> must already exist to guarantee that * this method returns an appropriate result. * * @param extension the program extension * @return the program or <code>null</code> * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when extension is null</li> * </ul> */ public static Program findProgram(String extension) { return findProgram(Display.getCurrent(), extension); } /* * API: When support for multiple displays is added, this method will * become public and the original method above can be deprecated. */ static Program findProgram(Display display, String extension) { if (extension == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); if (extension.length() == 0) return null; if (extension.charAt(0) != '.') extension = "." + extension; int desktop = getDesktop(display); String mimeType = null; switch (desktop) { case DESKTOP_GIO: mimeType = gio_getMimeType(extension); break; case DESKTOP_GNOME: mimeType = gnome_getMimeType(extension); break; case DESKTOP_CDE: mimeType = cde_getMimeType(extension); break; } if (mimeType == null) return null; Program program = null; switch (desktop) { case DESKTOP_GIO: program = gio_getProgram(display, mimeType); break; case DESKTOP_GNOME: program = gnome_getProgram(display, mimeType); break; case DESKTOP_CDE: program = cde_getProgram(display, mimeType); break; } return program; } /** * Answer all program extensions in the operating system. Note * that a <code>Display</code> must already exist to guarantee * that this method returns an appropriate result. * * @return an array of extensions */ public static String[] getExtensions() { return getExtensions(Display.getCurrent()); } /* * API: When support for multiple displays is added, this method will * become public and the original method above can be deprecated. */ static String[] getExtensions(Display display) { int desktop = getDesktop(display); Hashtable mimeInfo = null; switch (desktop) { case DESKTOP_GIO: return gio_getExtensions(); case DESKTOP_GNOME: break; case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break; } if (mimeInfo == null) return new String[0]; /* Create a unique set of the file extensions. */ Vector extensions = new Vector(); Enumeration keys = mimeInfo.keys(); while (keys.hasMoreElements()) { String mimeType = (String)keys.nextElement(); Vector mimeExts = (Vector)mimeInfo.get(mimeType); for (int index = 0; index < mimeExts.size(); index++){ if (!extensions.contains(mimeExts.elementAt(index))) { extensions.addElement(mimeExts.elementAt(index)); } } } /* Return the list of extensions. */ String[] extStrings = new String[extensions.size()]; for (int index = 0; index < extensions.size(); index++) { extStrings[index] = (String)extensions.elementAt(index); } return extStrings; } /** * Answers all available programs in the operating system. Note * that a <code>Display</code> must already exist to guarantee * that this method returns an appropriate result. * * @return an array of programs */ public static Program[] getPrograms() { return getPrograms(Display.getCurrent()); } /* * API: When support for multiple displays is added, this method will * become public and the original method above can be deprecated. */ static Program[] getPrograms(Display display) { int desktop = getDesktop(display); Hashtable mimeInfo = null; switch (desktop) { case DESKTOP_GIO: return gio_getPrograms(display); case DESKTOP_GNOME: break; case DESKTOP_CDE: mimeInfo = cde_getDataTypeInfo(); break; } if (mimeInfo == null) return new Program[0]; Vector programs = new Vector(); Enumeration keys = mimeInfo.keys(); while (keys.hasMoreElements()) { String mimeType = (String)keys.nextElement(); Program program = null; switch (desktop) { case DESKTOP_CDE: program = cde_getProgram(display, mimeType); break; } if (program != null) programs.addElement(program); } Program[] programList = new Program[programs.size()]; for (int index = 0; index < programList.length; index++) { programList[index] = (Program)programs.elementAt(index); } return programList; } ImageData gio_getImageData() { if (iconPath == null) return null; ImageData data = null; long /*int*/ icon_theme =OS.gtk_icon_theme_get_default(); byte[] icon = Converter.wcsToMbcs (null, iconPath, true); long /*int*/ gicon = OS.g_icon_new_for_string(icon, null); if (gicon != 0) { long /*int*/ gicon_info = OS.gtk_icon_theme_lookup_by_gicon (icon_theme, gicon, 16/*size*/, 0); if (gicon_info != 0) { long /*int*/ pixbuf = OS.gtk_icon_info_load_icon(gicon_info, null); if (pixbuf != 0) { int stride = OS.gdk_pixbuf_get_rowstride(pixbuf); long /*int*/ pixels = OS.gdk_pixbuf_get_pixels(pixbuf); int height = OS.gdk_pixbuf_get_height(pixbuf); int width = OS.gdk_pixbuf_get_width(pixbuf); boolean hasAlpha = OS.gdk_pixbuf_get_has_alpha(pixbuf); byte[] srcData = new byte[stride * height]; OS.memmove(srcData, pixels, srcData.length); OS.g_object_unref(pixbuf); if (hasAlpha) { PaletteData palette = new PaletteData(0xFF000000, 0xFF0000, 0xFF00); data = new ImageData(width, height, 32, palette, 4, srcData); data.bytesPerLine = stride; int s = 3, a = 0; byte[] alphaData = new byte[width*height]; for (int y=0; y<height; y++) { for (int x=0; x<width; x++) { alphaData[a++] = srcData[s]; srcData[s] = 0; s+=4; } } data.alphaData = alphaData; } else { PaletteData palette = new PaletteData(0xFF0000, 0xFF00, 0xFF); data = new ImageData(width, height, 24, palette, 4, srcData); data.bytesPerLine = stride; } } OS.gtk_icon_info_free(gicon_info); } OS.g_object_unref(gicon); } return data; } static Hashtable gio_getMimeInfo() { long /*int*/ mimeDatabase = 0, fileInfo = 0; /* * The file 'globs' contain the file extensions * associated to the mime-types. Each line that has * to be parsed corresponds to a different extension * of a mime-type. The template of such line is - * application/pdf:*.pdf */ byte[] buffer = Converter.wcsToMbcs (null, "/usr/share/mime/globs", true); mimeDatabase = OS.g_file_new_for_path (buffer); long /*int*/ fileInputStream = OS.g_file_read (mimeDatabase, 0, 0); try { if (fileInputStream != 0) { long /*int*/ [] modTimestamp = new long /*int*/ [2]; buffer = Converter.wcsToMbcs (null, "*", true); fileInfo = OS.g_file_query_info(mimeDatabase, buffer, 0, 0, 0); OS.g_file_info_get_modification_time(fileInfo, modTimestamp); if (modTime != 0 && modTimestamp[0] == modTime) { return mimeTable; } else { mimeTable = new Hashtable(); modTime = modTimestamp[0]; long /*int*/ reader = OS.g_data_input_stream_new (fileInputStream); long /*int*/ [] length = new long /*int*/ [1]; if (reader != 0) { long /*int*/ linePtr = OS.g_data_input_stream_read_line (reader, length, 0, 0); while (linePtr != 0) { byte[] lineBytes = new byte[(int) length[0]]; OS.memmove(lineBytes, linePtr, (int) length[0]); String line = new String (Converter.mbcsToWcs (null, lineBytes)); int separatorIndex = line.indexOf (':'); if (separatorIndex > 0) { Vector mimeTypes = new Vector (); String mimeType = line.substring (0, separatorIndex); String extensionFormat = line.substring (separatorIndex+1); int extensionIndex = extensionFormat.indexOf ("."); if (extensionIndex > 0) { String extension = extensionFormat.substring (extensionIndex); if (mimeTable.containsKey (extension)) { /* * If mimeType already exists, it is required to update * the existing key (mime-type) with the new extension. */ Vector value = (Vector) mimeTable.get (extension); mimeTypes.addAll (value); } mimeTypes.add (mimeType); mimeTable.put (extension, mimeTypes); } } OS.g_free(linePtr); linePtr = OS.g_data_input_stream_read_line (reader, length, 0, 0); } } if (reader != 0) OS.g_object_unref (reader); return mimeTable; } } return null; } finally { if (fileInfo != 0) OS.g_object_unref(fileInfo); if (fileInputStream != 0) OS.g_object_unref(fileInputStream); if (mimeDatabase != 0) OS.g_object_unref (mimeDatabase); } } static String gio_getMimeType(String extension) { String mimeType = null; Hashtable h = gio_getMimeInfo(); if (h != null && h.containsKey(extension)) { Vector mimeTypes = (Vector) h.get(extension); mimeType = (String) mimeTypes.get(0); } return mimeType; } static Program gio_getProgram(Display display, String mimeType) { Program program = null; byte[] mimeTypeBuffer = Converter.wcsToMbcs (null, mimeType, true); long /*int*/ application = OS.g_app_info_get_default_for_type (mimeTypeBuffer, false); if (application != 0) { program = gio_getProgram(display, application); } return program; } static Program gio_getProgram (Display display, long /*int*/ application) { Program program = new Program(); program.display = display; int length; byte[] buffer; long /*int*/ applicationName = OS.g_app_info_get_name (application); if (applicationName != 0) { length = OS.strlen (applicationName); if (length > 0) { buffer = new byte [length]; OS.memmove (buffer, applicationName, length); program.name = new String (Converter.mbcsToWcs (null, buffer)); } } long /*int*/ applicationCommand = OS.g_app_info_get_executable (application); if (applicationCommand != 0) { length = OS.strlen (applicationCommand); if (length > 0) { buffer = new byte [length]; OS.memmove (buffer, applicationCommand, length); program.command = new String (Converter.mbcsToWcs (null, buffer)); } } program.gnomeExpectUri = OS.g_app_info_supports_uris(application); long /*int*/ icon = OS.g_app_info_get_icon(application); if (icon != 0) { long /*int*/ icon_name = OS.g_icon_to_string(icon); if (icon_name != 0) { length = OS.strlen(icon_name); if (length > 0) { buffer = new byte[length]; OS.memmove(buffer, icon_name, length); program.iconPath = new String(Converter.mbcsToWcs(null, buffer)); } OS.g_free(icon_name); } OS.g_object_unref(icon); } return program.command != null ? program : null; } static Program[] gio_getPrograms(Display display) { long /*int*/ applicationList = OS.g_app_info_get_all (); long /*int*/ list = applicationList; Program program; Vector programs = new Vector(); while (list != 0) { long /*int*/ application = OS.g_list_data(list); if (application != 0) { //TODO: Should the list be filtered or not? // if (OS.g_app_info_should_show(application)) { program = gio_getProgram(display, application); if (program != null) programs.addElement(program); // } } list = OS.g_list_next(list); } if (applicationList != 0) OS.g_list_free(applicationList); Program[] programList = new Program[programs.size()]; for (int index = 0; index < programList.length; index++) { programList[index] = (Program)programs.elementAt(index); } return programList; } static boolean gio_isExecutable(String fileName) { byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true); if (OS.g_file_test(fileNameBuffer, OS.G_FILE_TEST_IS_DIR)) return false; if (!OS.g_file_test(fileNameBuffer, OS.G_FILE_TEST_IS_EXECUTABLE)) return false; long /*int*/ file = OS.g_file_new_for_path (fileNameBuffer); boolean result = false; if (file != 0) { byte[] buffer = Converter.wcsToMbcs (null, "*", true); //$NON-NLS-1$ long /*int*/ fileInfo = OS.g_file_query_info(file, buffer, 0, 0, 0); if (fileInfo != 0) { long /*int*/ contentType = OS.g_file_info_get_content_type(fileInfo); if (contentType != 0) { byte[] exeType = Converter.wcsToMbcs (null, "application/x-executable", true); //$NON-NLS-1$ result = OS.g_content_type_is_a(contentType, exeType); if (!result) { byte [] shellType = Converter.wcsToMbcs (null, "application/x-shellscript", true); //$NON-NLS-1$ result = OS.g_content_type_equals(contentType, shellType); } } OS.g_object_unref(fileInfo); } OS.g_object_unref (file); } return result; } /** * GNOME 2.4 - Launch the default program for the given file. */ static boolean gio_launch(String fileName) { boolean result = false; byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true); long /*int*/ file = OS.g_file_new_for_commandline_arg (fileNameBuffer); if (file != 0) { long /*int*/ uri = OS.g_file_get_uri (file); if (uri != 0) { result = OS.g_app_info_launch_default_for_uri (uri, 0, 0); OS.g_free(uri); } OS.g_object_unref (file); } return result; } /** * GIO - Execute the program for the given file. */ boolean gio_execute(String fileName) { boolean result = false; byte[] commandBuffer = Converter.wcsToMbcs (null, command, true); byte[] nameBuffer = Converter.wcsToMbcs (null, name, true); long /*int*/ application = OS.g_app_info_create_from_commandline(commandBuffer, nameBuffer, gnomeExpectUri ? OS.G_APP_INFO_CREATE_SUPPORTS_URIS : OS.G_APP_INFO_CREATE_NONE, 0); if (application != 0) { byte[] fileNameBuffer = Converter.wcsToMbcs (null, fileName, true); long /*int*/ file = 0; if (fileName.length() > 0) { if (OS.g_app_info_supports_uris (application)) { file = OS.g_file_new_for_uri (fileNameBuffer); } else { file = OS.g_file_new_for_path (fileNameBuffer); } } long /*int*/ list = 0; if (file != 0) list = OS.g_list_append (0, file); result = OS.g_app_info_launch (application, list, 0, 0); if (list != 0) { OS.g_list_free (list); OS.g_object_unref (file); } OS.g_object_unref (application); } return result; } static String[] gio_getExtensions() { Hashtable mimeInfo = gio_getMimeInfo(); if (mimeInfo == null) return new String[0]; /* Create a unique set of the file extensions. */ Vector extensions = new Vector(); Enumeration keys = mimeInfo.keys(); while (keys.hasMoreElements()) { String extension = (String)keys.nextElement(); extensions.add(extension); } /* Return the list of extensions. */ String [] extStrings = new String[extensions.size()]; for (int index = 0; index < extensions.size(); index++) { extStrings[index] = (String)extensions.elementAt(index); } return extStrings; } static boolean isExecutable(Display display, String fileName) { switch(getDesktop(display)) { case DESKTOP_GIO: return gio_isExecutable(fileName); case DESKTOP_GNOME: return gnome_isExecutable(fileName); case DESKTOP_CDE: return false; //cde_isExecutable() } return false; } /** * Launches the operating system executable associated with the file or * URL (http:// or https://). If the file is an executable then the * executable is launched. Note that a <code>Display</code> must already * exist to guarantee that this method returns an appropriate result. * * @param fileName the file or program name or URL (http:// or https://) * @return <code>true</code> if the file is launched, otherwise <code>false</code> * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when fileName is null</li> * </ul> */ public static boolean launch(String fileName) { return launch(Display.getCurrent(), fileName, null); } /** * Launches the operating system executable associated with the file or * URL (http:// or https://). If the file is an executable then the * executable is launched. The program is launched with the specified * working directory only when the <code>workingDir</code> exists and * <code>fileName</code> is an executable. * Note that a <code>Display</code> must already exist to guarantee * that this method returns an appropriate result. * * @param fileName the file name or program name or URL (http:// or https://) * @param workingDir the name of the working directory or null * @return <code>true</code> if the file is launched, otherwise <code>false</code> * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when fileName is null</li> * </ul> * * @since 3.6 */ public static boolean launch (String fileName, String workingDir) { return launch(Display.getCurrent(), fileName, workingDir); } /* * API: When support for multiple displays is added, this method will * become public and the original method above can be deprecated. */ static boolean launch (Display display, String fileName, String workingDir) { if (fileName == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); if (workingDir != null && isExecutable(display, fileName)) { try { Compatibility.exec (new String [] {fileName}, null, workingDir); return true; } catch (IOException e) { return false; } } switch (getDesktop (display)) { case DESKTOP_GIO: if (gio_launch (fileName)) return true; case DESKTOP_GNOME: if (gnome_launch (fileName)) return true; default: int index = fileName.lastIndexOf ('.'); if (index != -1) { String extension = fileName.substring (index); Program program = Program.findProgram (display, extension); if (program != null && program.execute (fileName)) return true; } String lowercaseName = fileName.toLowerCase (); if (lowercaseName.startsWith (PREFIX_HTTP) || lowercaseName.startsWith (PREFIX_HTTPS)) { Program program = Program.findProgram (display, ".html"); //$NON-NLS-1$ if (program == null) { program = Program.findProgram (display, ".htm"); //$NON-NLS-1$ } if (program != null && program.execute (fileName)) return true; } break; } /* If the above launch attempts didn't launch the file, then try with exec().*/ try { Compatibility.exec (new String [] {fileName}, null, workingDir); return true; } catch (IOException e) { return false; } } /** * Compares the argument to the receiver, and returns true * if they represent the <em>same</em> object using a class * specific comparison. * * @param other the object to compare with this object * @return <code>true</code> if the object is the same as this object and <code>false</code> otherwise * * @see #hashCode() */ public boolean equals(Object other) { if (this == other) return true; if (!(other instanceof Program)) return false; Program program = (Program)other; return display == program.display && name.equals(program.name) && command.equals(program.command); } /** * Executes the program with the file as the single argument * in the operating system. It is the responsibility of the * programmer to ensure that the file contains valid data for * this program. * * @param fileName the file or program name * @return <code>true</code> if the file is launched, otherwise <code>false</code> * * @exception IllegalArgumentException <ul> * <li>ERROR_NULL_ARGUMENT when fileName is null</li> * </ul> */ public boolean execute(String fileName) { if (fileName == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); int desktop = getDesktop(display); switch (desktop) { case DESKTOP_GIO: return gio_execute(fileName); case DESKTOP_GNOME: return gnome_execute(fileName); case DESKTOP_CDE: return cde_execute(fileName); } return false; } /** * Returns the receiver's image data. This is the icon * that is associated with the receiver in the operating * system. * * @return the image data for the program, may be null */ public ImageData getImageData() { switch (getDesktop(display)) { case DESKTOP_GIO: return gio_getImageData(); case DESKTOP_GNOME: return gnome_getImageData(); case DESKTOP_CDE: return cde_getImageData(); } return null; } /** * Returns the receiver's name. This is as short and * descriptive a name as possible for the program. If * the program has no descriptive name, this string may * be the executable name, path or empty. * * @return the name of the program */ public String getName() { return name; } /** * Returns an integer hash code for the receiver. Any two * objects that return <code>true</code> when passed to * <code>equals</code> must return the same value for this * method. * * @return the receiver's hash * * @see #equals(Object) */ public int hashCode() { return name.hashCode() ^ command.hashCode() ^ display.hashCode(); } /** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the program */ public String toString() { return "Program {" + name + "}"; } }
[ "375833274@qq.com" ]
375833274@qq.com
85337297864c77701e7b0621837b6f02f805b399
07a25c4283d5e95b5ff81d7a561c9532e3a828ce
/app/src/main/java/com/ustc/wsn/mobileData/bean/Filter/LPF.java
2d40bcc4b0d5226efef4236dcf0ca683e54fcab1
[]
no_license
halostorm/MobileData
338d01214e4452eda26a53ff92bd47178d2cbfe9
ed98656e0e5d0b31a4310d01722373a6a830a099
refs/heads/master
2021-10-27T20:14:40.008272
2018-06-04T05:31:50
2018-06-04T05:31:50
109,242,804
5
2
null
null
null
null
UTF-8
Java
false
false
3,719
java
package com.ustc.wsn.mobileData.bean.Filter; /** * Created by halo on 2018/1/20. */ /* * Simple Linear Acceleration * Copyright (C) 2013, Kaleb Kircher - Boki Software, Kircher Engineering, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * An implementation of the Wikipedia low-pass filter. The Wikipedia LPF, is an * IIR single-pole implementation. The coefficient, a (alpha), can be adjusted * based on the sample period of the sensor to produce the desired time constant * that the filter will act on. It takes a simple form of y[i] = y[i] + alpha * * (x[i] - y[i]). Alpha is defined as alpha = dt / (timeConstant + dt);) where * the time constant is the length of signals the filter should act on and dt is * the sample period (1/frequency) of the sensor. * * * @author Kaleb * @see http://en.wikipedia.org/wiki/Low-pass_filter * @version %I%, %G% */ public class LPF implements LowPassFilter { private boolean alphaStatic = false; // Constants for the low-pass filters private float timeConstant = 0.18f; private float alpha = 0.1f; private float dt = 0; // Timestamps for the low-pass filters private float timestamp = System.nanoTime(); private float timestampOld = System.nanoTime(); private int count = 0; // Gravity and linear accelerations components for the // Wikipedia low-pass filter private float[] output = new float[] { 0, 0, 0 }; // Raw accelerometer data private float[] input = new float[] { 0, 0, 0 }; /** * Add a sample. * * @param acceleration * The acceleration data. * @return Returns the output of the filter. */ public float[] addSamples(float[] acceleration) { // Get a local copy of the sensor values System.arraycopy(acceleration, 0, this.input, 0, acceleration.length); if (!alphaStatic) { timestamp = System.nanoTime(); // Find the sample period (between updates). // Convert from nanoseconds to seconds dt = 1 / (count / ((timestamp - timestampOld) / 1000000000.0f)); // Calculate Wikipedia low-pass alpha alpha = dt / (timeConstant + dt); } count++; if (count > 5) { // Update the Wikipedia filter // y[i] = y[i] + alpha * (x[i] - y[i]) output[0] = output[0] + alpha * (this.input[0] - output[0]); output[1] = output[1] + alpha * (this.input[1] - output[1]); output[2] = output[2] + alpha * (this.input[2] - output[2]); } return output; } /** * Indicate if alpha should be static. * * @param alphaStatic * A static value for alpha */ public void setAlphaStatic(boolean alphaStatic) { this.alphaStatic = alphaStatic; } /** * Set static alpha. * * @param alpha * The value for alpha, 0 < alpha <= 1 */ public void setAlpha(float alpha) { this.alpha = alpha; } }
[ "2524416894@qq.com" ]
2524416894@qq.com
941829b6932ca783275f9fa3945660004c014a02
13cbb329807224bd736ff0ac38fd731eb6739389
/java/nio/ByteBufferAsCharBufferL.java
5cf5f37e919cd410baa7c50a774b9a70f43cf2db
[]
no_license
ZhipingLi/rt-source
5e2537ed5f25d9ba9a0f8009ff8eeca33930564c
1a70a036a07b2c6b8a2aac6f71964192c89aae3c
refs/heads/master
2023-07-14T15:00:33.100256
2021-09-01T04:49:04
2021-09-01T04:49:04
401,933,858
0
0
null
null
null
null
UTF-8
Java
false
false
3,671
java
package java.nio; class ByteBufferAsCharBufferL extends CharBuffer { protected final ByteBuffer bb; protected final int offset; ByteBufferAsCharBufferL(ByteBuffer paramByteBuffer) { super(-1, 0, paramByteBuffer.remaining() >> 1, paramByteBuffer.remaining() >> 1); this.bb = paramByteBuffer; int i = capacity(); limit(i); int j = position(); assert j <= i; this.offset = j; } ByteBufferAsCharBufferL(ByteBuffer paramByteBuffer, int paramInt1, int paramInt2, int paramInt3, int paramInt4, int paramInt5) { super(paramInt1, paramInt2, paramInt3, paramInt4); this.bb = paramByteBuffer; this.offset = paramInt5; } public CharBuffer slice() { int i = position(); int j = limit(); assert i <= j; int k = (i <= j) ? (j - i) : 0; int m = (i << 1) + this.offset; assert m >= 0; return new ByteBufferAsCharBufferL(this.bb, -1, 0, k, k, m); } public CharBuffer duplicate() { return new ByteBufferAsCharBufferL(this.bb, markValue(), position(), limit(), capacity(), this.offset); } public CharBuffer asReadOnlyBuffer() { return new ByteBufferAsCharBufferRL(this.bb, markValue(), position(), limit(), capacity(), this.offset); } protected int ix(int paramInt) { return (paramInt << 1) + this.offset; } public char get() { return Bits.getCharL(this.bb, ix(nextGetIndex())); } public char get(int paramInt) { return Bits.getCharL(this.bb, ix(checkIndex(paramInt))); } char getUnchecked(int paramInt) { return Bits.getCharL(this.bb, ix(paramInt)); } public CharBuffer put(char paramChar) { Bits.putCharL(this.bb, ix(nextPutIndex()), paramChar); return this; } public CharBuffer put(int paramInt, char paramChar) { Bits.putCharL(this.bb, ix(checkIndex(paramInt)), paramChar); return this; } public CharBuffer compact() { int i = position(); int j = limit(); assert i <= j; int k = (i <= j) ? (j - i) : 0; ByteBuffer byteBuffer1 = this.bb.duplicate(); byteBuffer1.limit(ix(j)); byteBuffer1.position(ix(0)); ByteBuffer byteBuffer2 = byteBuffer1.slice(); byteBuffer2.position(i << 1); byteBuffer2.compact(); position(k); limit(capacity()); discardMark(); return this; } public boolean isDirect() { return this.bb.isDirect(); } public boolean isReadOnly() { return false; } public String toString(int paramInt1, int paramInt2) { if (paramInt2 > limit() || paramInt1 > paramInt2) throw new IndexOutOfBoundsException(); try { int i = paramInt2 - paramInt1; char[] arrayOfChar = new char[i]; CharBuffer charBuffer1 = CharBuffer.wrap(arrayOfChar); CharBuffer charBuffer2 = duplicate(); charBuffer2.position(paramInt1); charBuffer2.limit(paramInt2); charBuffer1.put(charBuffer2); return new String(arrayOfChar); } catch (StringIndexOutOfBoundsException stringIndexOutOfBoundsException) { throw new IndexOutOfBoundsException(); } } public CharBuffer subSequence(int paramInt1, int paramInt2) { int i = position(); int j = limit(); assert i <= j; i = (i <= j) ? i : j; int k = j - i; if (paramInt1 < 0 || paramInt2 > k || paramInt1 > paramInt2) throw new IndexOutOfBoundsException(); return new ByteBufferAsCharBufferL(this.bb, -1, i + paramInt1, i + paramInt2, capacity(), this.offset); } public ByteOrder order() { return ByteOrder.LITTLE_ENDIAN; } } /* Location: D:\software\jd-gui\jd-gui-windows-1.6.3\rt.jar!\java\nio\ByteBufferAsCharBufferL.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.0.7 */
[ "michael__lee@yeah.net" ]
michael__lee@yeah.net
0e066e7fbbe5239b7124509b4e4c63955ad3211e
3f8ab2b9ba5ff3ab8d05517304ad981dec2c0dde
/app/src/main/java/com/ibotn/ibotncamera2/utils/DevicePath.java
1d5b2c2f7b6e0e53ee6b35ae7623032682df2459
[]
no_license
adai12388/IbotnCameraRelease2
981b0e72d9ea7b8c347a6d4468a70f7479dacbbe
461971db91e1b40ffe63b06046d8a73e19a565b8
refs/heads/master
2020-03-22T21:18:28.567498
2018-09-25T07:02:33
2018-09-25T07:02:33
140,675,827
0
0
null
null
null
null
UTF-8
Java
false
false
7,173
java
package com.ibotn.ibotncamera2.utils; import android.content.Context; import android.os.Environment; import android.os.StatFs; import android.os.storage.StorageManager; import android.text.TextUtils; import java.io.File; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; //import android.util.Log; /* * @author lizihao@actions-semi.com * 设备,sd,u盘等路径工具类 */ public class DevicePath { private static DevicePath instance; private static ArrayList<String> totalDevicesList; private static final String TAG = DevicePath.class.getSimpleName(); private DevicePath(Context context) { /////////// // totalDevicesList = new ArrayList<String>(); // StorageManager stmg = (StorageManager) context.getSystemService(context.STORAGE_SERVICE); // String[] list = stmg.getVolumePaths();//DevicePath使用了classes.jar中的方法getVolumePaths有问题 // for(int i = 0; i < list.length; i++) // { // totalDevicesList.add(list[i]); // } /////////// ///////// //totalDevicesList = (ArrayList<String>) getStoragePaths(context); //////// } public static DevicePath getInstance(Context context) { if (instance == null) { synchronized (DevicePath.class) { if (instance == null) { instance = new DevicePath(context); } } } //记得每次都需要重新获取 设备路径 列表。解决u盘移除后,但数据还在。 totalDevicesList = (ArrayList<String>) getStoragePaths(context); return instance; } /** * @param cxt * @return 各个设备存储路径集合 */ public static List<String> getStoragePaths(Context cxt) { ArrayList<String> pathsList = new ArrayList<String>(); /*if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.GINGERBREAD) { StringBuilder sb = new StringBuilder(); try { pathsList.addAll(new SdCardFetcher().getStoragePaths(new FileReader("/proc/mounts"), sb)); } catch (FileNotFoundException e) { e.printStackTrace(); File externalFolder = Environment.getExternalStorageDirectory(); if (externalFolder != null) { pathsList.add(externalFolder.getAbsolutePath()); } } } else {}*/ StorageManager storageManager = (StorageManager) cxt.getSystemService(Context.STORAGE_SERVICE); try { Method method = StorageManager.class.getDeclaredMethod("getVolumePaths"); method.setAccessible(true); Object result = method.invoke(storageManager); if (result != null && result instanceof String[]) { String[] pathes = (String[]) result; StatFs statFs; for (String path : pathes) { if (!TextUtils.isEmpty(path) && new File(path).exists()) { statFs = new StatFs(path); if (statFs.getBlockCount() * statFs.getBlockSize() != 0) { pathsList.add(path); LogUtils.d(TAG, ">>>>>>getStoragePaths()>>>path:" + path); } } } } } catch (Exception e) { e.printStackTrace(); File externalFolder = Environment.getExternalStorageDirectory(); if (externalFolder != null) { pathsList.add(externalFolder.getAbsolutePath()); } } // return pathsList.toArray(new String[pathsList.size()]); return pathsList; } public String getSdStoragePath() { String path = "none"; for (int i = 0; i < totalDevicesList.size(); i++) { if (!totalDevicesList.get(i).equals(Environment.getExternalStorageDirectory().getPath())) { if (totalDevicesList.get(i).contains("sd")) { path = totalDevicesList.get(i); return path; } } } return path; } /** * 获取内置sd卡目录 * * @return */ public String getInterStoragePath() { return Environment.getExternalStorageDirectory().getPath(); } @SuppressWarnings("deprecation") public String getUsbStoragePath(Context context) { String path = ""; totalDevicesList = (ArrayList<String>) getStoragePaths(context); for (int i = 0; i < totalDevicesList.size(); i++) { if (!totalDevicesList.get(i).equals(Environment.getExternalStorageDirectory().getPath())) { if (totalDevicesList.get(i).contains("host")) { final String tempPath = totalDevicesList.get(i); //检查USB存储设备总空间大小 if (!TextUtils.isEmpty(tempPath) && new File(tempPath).exists()) { final StatFs statFs = new StatFs(tempPath); if (statFs.getBlockCount() * statFs.getBlockSize() != 0) { return tempPath; } else { return ""; } } else { return ""; } } } } return path; } public boolean isExistUsbStoragePath(Context context) { LogUtils.d(TAG, ">>>>>>isExistUsbStoragePath()>>>:" + TextUtils.isEmpty(getUsbStoragePath(context))); /*ThreadUtils.runOnUiThread(new Runnable() { @Override public void run() { ToastUtil.show(MyApplication.getInstance(), "" + TextUtils.isEmpty(getUsbStoragePath()), 1); } });*/ return !TextUtils.isEmpty(getUsbStoragePath(context)); } public boolean hasMultiplePartition(String dPath) { try { File file = new File(dPath); String minor = null; String major = null; for (int i = 0; i < totalDevicesList.size(); i++) { if (dPath.equals(totalDevicesList.get(i))) { String[] list = file.list(); for (int j = 0; j < list.length; j++) { int lst = list[j].lastIndexOf("_"); if (lst != -1 && lst != (list[j].length() - 1)) { major = list[j].substring(0, lst); minor = list[j].substring(lst + 1, list[j].length()); try { Integer.valueOf(major); Integer.valueOf(minor); } catch (NumberFormatException e) { return false; } } else { return false; } } return true; } } return false; } catch (Exception e) { //Log.e(TAG, "hasMultiplePartition() exception e"); return false; } } }
[ "window_binyi@ibotn.com" ]
window_binyi@ibotn.com
7bfc91e3c63658cf04f1610271cea17e465e770e
b66a1d6ccbd16a2d57baa9a16d14c25f62929d20
/src/java/Action/ActionResult.java
90cc82bb0ede288478dc9e289cf0b490cb710243
[]
no_license
myothuzarwin/CameraOnlineShopping
e74b0fbd717a1d8dd11d8f5c3f636f4f30b6402f
c1ca85ad0fc96e9442c350473b977a81bcaf78c9
refs/heads/master
2021-01-15T15:06:02.685783
2017-08-08T14:59:22
2017-08-08T14:59:22
99,703,061
0
0
null
null
null
null
UTF-8
Java
false
false
604
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 Action; /** * * @author myothuzar */ public class ActionResult { public static final String SUCCESS = "success"; public static final String NONE = "none"; public static final String ERROR = "error"; public static final String INPUT = "input"; public static final String LOGIN = "login"; public static final String FAIL = "fail"; public static final String FORWARD = "forward"; }
[ "myothuzarwin2015@gmail.com" ]
myothuzarwin2015@gmail.com
f5ed611e931c6fc74553587a47cb0541d0c9f1e0
5427850ebc9ed0dd8f1660f7cfaee69e42738d31
/src/main/java/com/github/muktiharahap/migjabar/security/SecurityUtils.java
eacaeb14d65d77adb773e6979412b9c6d5476c94
[]
no_license
BulkSecurityGeneratorProject/migjabar
f48caeac1c8d2f738900a5d31e050e48e16753ed
b9f385e6b4c09f1a4e84637599c4adb4cca7dafb
refs/heads/master
2022-12-14T19:14:50.494623
2017-12-20T15:14:03
2017-12-20T15:14:08
296,583,458
0
0
null
2020-09-18T10:01:26
2020-09-18T10:01:25
null
UTF-8
Java
false
false
2,601
java
package com.github.muktiharahap.migjabar.security; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; /** * @author mukti on 10/11/2017. */ public final class SecurityUtils { private SecurityUtils() { } /** * Get the login of the current user. * * @return the login of the current user */ public static String getCurrentUserLogin() { SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); String userName = null; if (authentication != null) { if (authentication.getPrincipal() instanceof UserDetails) { UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); userName = springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { userName = (String) authentication.getPrincipal(); } } return userName; } /** * Check if a user is authenticated. * * @return true if the user is authenticated, false otherwise */ public static boolean isAuthenticated() { SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); if (authentication != null) { return authentication.getAuthorities().stream() .noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS)); } return false; } /** * If the current user has a specific authority (security role). * <p> * The name of this method comes from the isUserInRole() method in the Servlet API * * @param authority the authority to check * @return true if the current user has the authority, false otherwise */ public static boolean isCurrentUserInRole(String authority) { SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); if (authentication != null) { return authentication.getAuthorities().stream() .anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority)); } return false; } }
[ "skylae.mukti@gmail.com" ]
skylae.mukti@gmail.com
a3c84183d2f49abdea88cda36033a033515776c7
3abc52034effb91beb0e72d8e693dc4d7df27e39
/src/main/java/io/depa/model/Context.java
788eabcc4bf5515c5b87dc3e12bdbacab753ade8
[]
no_license
artemiokost/spring-web-server
c6c2aebfcb3fffdeac903a606977072e6d18a45e
bf5eddc09fe34784196cbacf581c6acb63a46270
refs/heads/master
2021-09-26T15:19:40.946142
2018-10-31T10:31:22
2018-10-31T10:31:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,519
java
package io.depa.model; import javax.persistence.*; import java.util.ArrayList; import java.util.List; /** * Simple JavaBean object that represents Context for {@link Post}. * * @author Artem Kostritsa * @version 1.0 */ @Entity @Table(name = "context") public class Context { @Id @Column(unique = true) @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; @Column(nullable = false, unique = true) private String name; @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "tagId", nullable = false, unique = true) private Tag tag; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinTable(name = "contextPost", joinColumns = @JoinColumn(name = "contextId"), inverseJoinColumns = @JoinColumn(name = "postId")) private List<Post> posts = new ArrayList<>(); public Context() {} public Context(String name) { this.name = name; this.tag = new Tag(name); } public int getId() { return id; } public String getName() { return name; } public Tag getTag() { return tag; } public List<Post> getPosts() { return posts; } public void setId(int id) { this.id = id; } public void setName(String name) { this.name = name; } public void setTag(Tag tag) { this.tag = tag; } public void setPosts(List<Post> posts) { this.posts = posts; } }
[ "artemletter@gmail.com" ]
artemletter@gmail.com
1cab160e386dc59d71ba1370a742d903ce71079c
42f93c0174cf1e00b54c4d98ccfa25fd5d3d659d
/app/src/main/java/com/bsw/mydemo/zxing/decoding/InactivityTimer.java
585efb08783f9106bf9f36926968b59acf6a72da
[]
no_license
BanShouWeng/MyDemo
2c0bf24f7a15d45351ec7edc2e56c9b2b37fd1bf
c2690fb84a6e32e43597c352bee5720211b6c248
refs/heads/master
2022-11-15T12:19:10.322486
2020-07-08T02:13:24
2020-07-08T02:13:24
110,081,779
0
0
null
null
null
null
UTF-8
Java
false
false
2,100
java
/* * Copyright (C) 2010 ZXing 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.bsw.mydemo.zxing.decoding; import android.app.Activity; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; /** * Finishes an activity after a period of inactivity. */ public final class InactivityTimer { private static final int INACTIVITY_DELAY_SECONDS = 5 * 60; private final ScheduledExecutorService inactivityTimer = Executors.newSingleThreadScheduledExecutor(new DaemonThreadFactory()); private final Activity activity; private ScheduledFuture<?> inactivityFuture = null; public InactivityTimer(Activity activity) { this.activity = activity; onActivity(); } public void onActivity() { cancel(); inactivityFuture = inactivityTimer.schedule(new FinishListener(activity), INACTIVITY_DELAY_SECONDS, TimeUnit.SECONDS); } private void cancel() { if (inactivityFuture != null) { inactivityFuture.cancel(true); inactivityFuture = null; } } public void shutdown() { cancel(); inactivityTimer.shutdown(); } private static final class DaemonThreadFactory implements ThreadFactory { public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable); thread.setDaemon(true); return thread; } } }
[ "leiming@zxycloud.com" ]
leiming@zxycloud.com
82a36f7d90d536cf55c9d7dd65fbdfcceb6ecd3f
7443cad6728a78e81ff18dfe95349044129c47b4
/src/skylight-commons-core/src/main/java/br/skylight/commons/plugin/annotations/ExtensionPointsInjection.java
68cc45a14d40a0c83aa1e2c33b9a88c6c5b556c3
[ "MIT" ]
permissive
nibbleshift/skylight-uas
c78e022248a81e635f6ae13bc7fa9a7569eb29ec
d9be7a377ebd25bbf00aac857309a310d5121255
refs/heads/master
2021-05-21T03:48:19.477508
2020-04-02T18:12:01
2020-04-02T18:12:01
252,528,996
0
1
MIT
2020-04-02T17:59:33
2020-04-02T17:59:32
null
UTF-8
Java
false
false
675
java
package br.skylight.commons.plugin.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD,ElementType.FIELD}) public @interface ExtensionPointsInjection { /** * Create new extension point instances for each point of injection. * If the injected element is inside a Service implementation or a ManagedMember, a * singleton instance will be used because those elements are singleton too. * Defaults to true. */ boolean createNewInstances() default true; }
[ "flaviostutz@gmail.com" ]
flaviostutz@gmail.com
800780d48f08e8eaf992004fceb53ae97ee07745
6251091f5622727965a5b372480a20e4ee19c11a
/app/src/main/java/com/example/mad/MainActivity2.java
23321772ed2ec3c349efc2af0128fd9e4c1258fc
[]
no_license
wishva8/MAD
1983259dd20fded5da447190adc0b5ca34bcdf0e
0f418feaaf024dd1cfc625b695c0f026757369f6
refs/heads/master
2022-12-29T05:55:49.148974
2020-10-04T04:06:38
2020-10-04T04:06:38
288,084,691
1
1
null
2020-10-04T04:06:39
2020-08-17T04:40:20
Java
UTF-8
Java
false
false
330
java
package com.example.mad; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class MainActivity2 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); } }
[ "vibushitha99@gamil.com" ]
vibushitha99@gamil.com
1aa1301d5bf47012af920e9e5f2cc4fc90aef952
a3d55436c17f67856c3a7cd2bee27930ee664c2f
/FrameWork/src/main/java/dataProvider/DataProviderInput.java
9634426f9d706967acb4fd99bd41b4fd64ee997d
[]
no_license
LakshminarayananG/Page-Factory
b6508f3b3959f66d6d15127cd9717841c03fb574
6d48f48f759f355cbde89403edbe3ab5c2d3ce13
refs/heads/master
2021-01-20T04:58:14.071365
2019-11-08T09:18:16
2019-11-08T09:18:16
101,402,488
1
0
null
null
null
null
UTF-8
Java
false
false
1,736
java
package dataProvider; import java.io.File; import java.io.FileInputStream; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class DataProviderInput extends AbstractDataProvider { @SuppressWarnings("deprecation") public static String[][] getAllSheetData(String sheetName) { String[][] data = null; try { File src=new File("./DataInput/"+sheetName+".xlsx"); FileInputStream fis = new FileInputStream(src); XSSFWorkbook workbook = new XSSFWorkbook(fis); XSSFSheet sheet = workbook.getSheetAt(0); // get the number of rows int rowCount = sheet.getLastRowNum(); // get the number of columns int columnCount = sheet.getRow(0).getLastCellNum(); data = new String[rowCount][columnCount]; // loop through the rows for(int i=1; i <rowCount+1; i++){ try { XSSFRow row = sheet.getRow(i); for(int j=0; j <columnCount; j++){ // loop through the columns try { String cellValue = ""; try{ if(row.getCell(j).getCellType() == 1) cellValue = row.getCell(j).getStringCellValue(); else if(row.getCell(j).getCellType() == 0) cellValue = ""+row.getCell(j).getNumericCellValue(); }catch(NullPointerException e){ } data[i-1][j] = cellValue; // add to the data array } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } //fis.close(); workbook.close(); } catch (Exception e) { e.printStackTrace(); } return data; } }
[ "lakshnarayanan7@gmail.com" ]
lakshnarayanan7@gmail.com
53fe09ace8095199cb9b70ffee47b43dbb497aed
4ec5b9a03e80e98fc5497a37afc72c54d43e8d81
/src/com/yjgs/bll/ibll/IAdviceManageBll.java
40a15aa31cd033ff79cf3479158224c341dc2f64
[]
no_license
ManfredHu/YJGS
ddfec64b1cabe22c2a03c968d46c28bf5767e337
0fd216455c4171c51e689915da0cb8425b64d497
refs/heads/master
2021-01-10T17:03:29.067802
2016-03-17T14:11:39
2016-03-17T14:11:39
50,172,922
0
0
null
null
null
null
UTF-8
Java
false
false
754
java
package com.yjgs.bll.ibll; import java.util.ArrayList; import com.yjgs.dcl.Advice; public interface IAdviceManageBll { /** * 获取建议反馈列表总页数 * * @return 返回总页数 */ public int getSumOfPage(); /** * 加载具体页码的建议反馈 * * @param fPage 页码 * @return 建议反馈信息集合 */ public ArrayList<Advice> loadAdvices(int fPage); /** * 回复建议反馈 * * @param fReply 回复的内容 * @return 是否回复成功 */ public boolean replyAdvice(Advice fReply); /** * 批量删除建议反馈 * * @param fAdvices 需要删除的建议反馈集合 * @return 返回是否删除成功 */ public boolean deleteAdvices(ArrayList<Advice> fAdvices); }
[ "manfredHuFE@gmail.com" ]
manfredHuFE@gmail.com
eb82d9eacf1c9ba61aa557d6392a4b7216eaabcd
762c6acbbd4d7169fcb44f643af4777cac3bd568
/src/com/ximei/tiny/tools/DBFField.java
2878ca387e7e3966de76f2a552e2ca751eb19665
[]
no_license
MrYangWen/GASXM2020-11-11
9099de56ad99d76a1835f0db729717aa00548f57
1f3ddde91b772bd4f7193828107562b2ce0d2e8f
refs/heads/master
2023-01-08T00:48:17.171236
2020-11-11T03:25:32
2020-11-11T03:25:32
311,852,344
0
0
null
null
null
null
UTF-8
Java
false
false
3,835
java
package com.ximei.tiny.tools; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; public class DBFField { public static final byte FIELD_TYPE_C = 67; public static final byte FIELD_TYPE_L = 76; public static final byte FIELD_TYPE_N = 78; public static final byte FIELD_TYPE_F = 70; public static final byte FIELD_TYPE_D = 68; public static final byte FIELD_TYPE_M = 77; byte[] fieldName = new byte[11]; byte dataType; int reserv1; int fieldLength; byte decimalCount; short reserv2; byte workAreaId; short reserv3; byte setFieldsFlag; byte[] reserv4 = new byte[7]; byte indexFieldFlag; int nameNullIndex = 0; protected static DBFField createField(DataInput in) throws IOException { DBFField field = new DBFField(); byte t_byte = in.readByte(); if (t_byte == 13) { return null; } in.readFully(field.fieldName, 1, 10); field.fieldName[0] = t_byte; for (int i = 0; i < field.fieldName.length; i++) { if (field.fieldName[i] == 0) { field.nameNullIndex = i; break; } } field.dataType = in.readByte(); field.reserv1 = Utils.readLittleEndianInt(in); field.fieldLength = in.readUnsignedByte(); field.decimalCount = in.readByte(); field.reserv2 = Utils.readLittleEndianShort(in); field.workAreaId = in.readByte(); field.reserv2 = Utils.readLittleEndianShort(in); field.setFieldsFlag = in.readByte(); in.readFully(field.reserv4); field.indexFieldFlag = in.readByte(); return field; } protected void write(DataOutput out) throws IOException { out.write(this.fieldName); out.write(new byte[11 - this.fieldName.length]); out.writeByte(this.dataType); out.writeInt(0); out.writeByte(this.fieldLength); out.writeByte(this.decimalCount); out.writeShort(0); out.writeByte(0); out.writeShort(0); out.writeByte(0); out.write(new byte[7]); out.writeByte(0); } public String getName() { return new String(this.fieldName, 0, this.nameNullIndex); } public byte getDataType() { return this.dataType; } public int getFieldLength() { return this.fieldLength; } public int getDecimalCount() { return this.decimalCount; } /** @deprecated */ public void setFieldName(String value) { setName(value); } public void setName(String value) { if (value == null) { throw new IllegalArgumentException("Field name cannot be null"); } if ((value.length() == 0) || (value.length() > 10)) { throw new IllegalArgumentException("Field name should be of length 0-10"); } this.fieldName = value.getBytes(); this.nameNullIndex = this.fieldName.length; } public void setDataType(byte value) { switch (value) { case 68: this.fieldLength = 8; case 67: case 70: case 76: case 77: case 78: this.dataType = value; break; case 69: case 71: case 72: case 73: case 74: case 75: default: throw new IllegalArgumentException("Unknown data type"); } } public void setFieldLength(int value) { if (value <= 0) { throw new IllegalArgumentException("Field length should be a positive number"); } if (this.dataType == 68) { throw new UnsupportedOperationException("Cannot do this on a Date field"); } this.fieldLength = value; } public void setDecimalCount(int value) { if (value < 0) { throw new IllegalArgumentException("Decimal length should be a positive number"); } if (value > this.fieldLength) { throw new IllegalArgumentException("Decimal length should be less than field length"); } this.decimalCount = ((byte)value); } }
[ "1397675719yw" ]
1397675719yw
a11960a9ae5d9b285bde57390bef2e232b48e199
ef8b1b9f01e9932cb876f3356b7c3b8ff36a3d6c
/android/app/src/main/java/com/addressbook/MainApplication.java
c87483eee88d202a0c54a2308624922cb41547e5
[]
no_license
filipebotti/address-book
dec00d86d05e79aae81f5c2c98c57927d0062727
5d2d3df151de08bf248c808cea5154fc1c42000c
refs/heads/master
2023-01-12T14:38:31.572905
2020-03-11T05:18:57
2020-03-11T05:18:57
246,481,344
0
0
null
2023-01-05T09:41:47
2020-03-11T05:18:03
JavaScript
UTF-8
Java
false
false
2,373
java
package com.addressbook; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; import com.reactlibrary.MyContactsPackage; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); // packages.add(new MyContactsPackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this); // Remove this line if you don't want Flipper enabled } /** * Loads Flipper in React Native templates. * * @param context */ private static void initializeFlipper(Context context) { if (BuildConfig.DEBUG) { try { /* We use reflection here to pick up the class that initializes Flipper, since Flipper library is not available in release mode */ Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
[ "filipebotti@hotmail.com" ]
filipebotti@hotmail.com
b5373896fb3418d9dfdf143655787cf779453475
30ce04cd1a54c58217c90e140b820ead5f2c35a8
/G53DIAMulti-src/src/uk/ac/nott/cs/g53dia/multidemo/sharedTankerMethods.java
94981eab8d39261c283e638ddf6cb4a77928eeeb
[ "TCL" ]
permissive
Kuldr/G53DIA-Code
70fea765186df3c74fbb88e848bf6464da3a5139
13f152cfaefd9188e9819aed5322f01542ca2abc
refs/heads/master
2020-06-24T05:13:49.050993
2018-03-28T21:20:04
2018-03-28T21:20:04
198,858,599
0
0
null
null
null
null
UTF-8
Java
false
false
14,090
java
package uk.ac.nott.cs.g53dia.multidemo; import uk.ac.nott.cs.g53dia.multilibrary.*; import java.util.Random; public class sharedTankerMethods { /* This class is refactored methods of other components used by the other tankers to avoid code duplication */ //Takes a Coordinate and converts it into a Environment Index public static int coordToEnvIndex(int c, int size) { int zero = size; int index = zero + c; return index; } //Takes a View index and converts into a Coordinate public static int viewIndexToCoord(int disRelToTanker, int tankerPos) { int coord = tankerPos + disRelToTanker; return coord; } //Randomly generates a diagonal direction for a tanker to travel in public static int newDiagonalDirection(Random r) { //Note this can randomly generate the same diagonal as previous //Loop until chosen a diagonal while(true){ int randInt = r.nextInt(8); switch (randInt) { case MoveAction.NORTH: case MoveAction.SOUTH: case MoveAction.EAST: case MoveAction.WEST: break; case MoveAction.NORTHEAST: case MoveAction.NORTHWEST: case MoveAction.SOUTHEAST: case MoveAction.SOUTHWEST: //If its any of the diagonals return it return randInt; } } } //Calculates if the tanker has enough fuel to get to the point, then to the fuel pump with out running out of fuel public static Boolean isPointFurtherThanFuel(int envIndexX, int envIndexY, int envFuelX, int envFuelY, int tankerX, int tankerY, int fuelLevel, int size) { int distanceToPoint = distanceToPointFromCurrentPos(envIndexX, envIndexY, tankerX, tankerY, size); int distanceFromPointToFuel = distanceBetweenPoints(envIndexX, envIndexY, envFuelX, envFuelY); int totalDistance = distanceToPoint + distanceFromPointToFuel; if( fuelLevel <= Math.ceil(totalDistance*1.0015+1) ) { return true; } return false; } //Calculates the distance between the current position to a point public static int distanceToPointFromCurrentPos(int envIndexX, int envIndexY, int tankerX, int tankerY, int size) { return distanceBetweenPoints(envIndexX, envIndexY, coordToEnvIndex(tankerX, size), coordToEnvIndex(tankerY, size)); } //Calculates the distance between 2 points private static int distanceBetweenPoints(int envIndexX1, int envIndexY1, int envIndexX2, int envIndexY2) { int dx = Math.abs(envIndexX1 - envIndexX2); int dy = Math.abs(envIndexY1 - envIndexY2); if( dx >= dy ){ return dx; } else { return dy; } } //Calculates which direction will get the tanker closest to its destination and returns that move direction public static int directionToMoveTowards(int envIndexX, int envIndexY, int tankerX, int tankerY, int size) { int dx = envIndexX - coordToEnvIndex(tankerX, size); int dy = envIndexY - coordToEnvIndex(tankerY, size); int move = 0; if( dx < 0 && dy > 0 ){ move = MoveAction.NORTHWEST; } else if ( dx == 0 && dy > 0 ){ move = MoveAction.NORTH; } else if ( dx > 0 && dy > 0 ){ move = MoveAction.NORTHEAST; } else if ( dx < 0 && dy == 0 ){ move = MoveAction.WEST; } else if ( dx > 0 && dy == 0 ){ move = MoveAction.EAST; } else if ( dx < 0 && dy < 0 ){ move = MoveAction.SOUTHWEST; } else if ( dx == 0 && dy < 0 ){ move = MoveAction.SOUTH; } else if ( dx > 0 && dy < 0 ) { move = MoveAction.SOUTHEAST; } return move; } //Class to contain data for a point in the environment representation public static class distanceToEnvRep{ public distanceToEnvRep(int distance, int envX, int envY) { this.distance = distance; this.envX = envX; this.envY = envY; } int distance; int envX; int envY; } //Although these 3 methods are similar as instanceof requires a compile time reference // and you can't create cells to pass as objects to test against they have to be separate //Checks all points in the environment representation (memory) to find the closest fuelpump to the tanker public static distanceToEnvRep findClosestFuelPump(Cell[][] envRep, int tankerX, int tankerY, int size) { distanceToEnvRep closest = null; for(int x = 0; x < envRep.length; x++){ for(int y = 0; y < envRep[x].length; y++) { if( envRep[x][y] instanceof FuelPump){ if( closest == null ){ closest = new distanceToEnvRep(distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size), x, y); } else if ( closest.distance > distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size) ){ closest = new distanceToEnvRep(distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size), x, y); } } } } return closest; } //Checks all points in the environment representation (memory) to find the closest well to the tanker public static distanceToEnvRep findClosestWell(Cell[][] envRep, int tankerX, int tankerY, int size) { distanceToEnvRep closest = null; for(int x = 0; x < envRep.length; x++){ for(int y = 0; y < envRep[x].length; y++) { if( envRep[x][y] instanceof Well){ if( closest == null ){ closest = new distanceToEnvRep(distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size), x, y); } else if ( closest.distance > distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size) ){ closest = new distanceToEnvRep(distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size), x, y); } } } } return closest; } //Checks all points in the environment representation (memory) to find the closest station with a task to the tanker public static distanceToEnvRep findClosestTask(Cell[][] envRep, int tankerX, int tankerY, int size) { distanceToEnvRep closest = null; for (int x = 0; x < envRep.length; x++) { for (int y = 0; y < envRep[x].length; y++) { if (envRep[x][y] instanceof Station) { Station s = (Station) envRep[x][y]; if (s.getTask() != null) { //Only want to find stations with a task if( closest == null ){ closest = new distanceToEnvRep(distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size), x, y); } else if ( closest.distance > distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size) ){ closest = new distanceToEnvRep(distanceToPointFromCurrentPos(x, y, tankerX, tankerY, size), x, y); } } } } } return closest; } //Calculates which how to update the x coord of the tanker based upon the movement if successful public static int updateTankerXPos(int moveDirection) { switch (moveDirection) { case MoveAction.EAST: case MoveAction.NORTHEAST: case MoveAction.SOUTHEAST: return 1; case MoveAction.WEST: case MoveAction.NORTHWEST: case MoveAction.SOUTHWEST: return -1; default: return 0; //Move action is either invalid so won't move or X doesn't change } } //Calculates which how to update the y coord of the tanker based upon the movement if successful public static int updateTankerYPos(int moveDirection) { switch (moveDirection) { case MoveAction.NORTH: case MoveAction.NORTHEAST: case MoveAction.NORTHWEST: return 1; case MoveAction.SOUTH: case MoveAction.SOUTHEAST: case MoveAction.SOUTHWEST: return -1; default: return 0; //Move action is either invalid so won't move or Y doesn't change } } //Updates relevant cells in the environment representation based upon the tankers current view public static Cell[][] updateEnvRep(Cell[][] envRep, Cell[][] view, int tankerX, int tankerY, int size){ int tankerPosInView = view.length/2; for (int x = 0; x<view.length; x++) { for (int y = 0; y<view[x].length; y++) { int xCoord = coordToEnvIndex(viewIndexToCoord(x-tankerPosInView, tankerX), size); int yCoord = coordToEnvIndex(viewIndexToCoord(tankerPosInView-y, tankerY), size); if( xCoord < envRep.length && xCoord >= 0 && yCoord < envRep.length && yCoord >= 0 ) { if( envRep[xCoord][yCoord] == null || envRep[xCoord][yCoord] instanceof Station ) { //If xCoord and yCoord are in the range update the view envRep[xCoord][yCoord] = view[x][y]; } } } } return envRep; } //Initialises an environment representation public static Cell[][] envRepSetup(int size) { //Create a view array of the whole environment Cell[][] envRep = new Cell[2*size+1][2*size+1]; // Generate initial environment for (int x = -size; x <= size; x++) { for (int y = -size; y <= size; y++) { envRep[coordToEnvIndex(x, size)][coordToEnvIndex(y, size)] = null; } } return envRep; } // Check if there is enough fuel to get to the nearest fuel pump so long as you are not on a fuel pump public static boolean checkMoveToFuelPump(distanceToEnvRep closestFuelPump, int fuelLevel, Cell currentCell) { return closestFuelPump != null && fuelLevel <= Math.ceil(closestFuelPump.distance*1.0015+1)//1.0015 allows for accounting for failure rate && !(currentCell instanceof FuelPump); } // Check if you are on a fuel pump and you have less than max fuel public static boolean checkRefuel(int fuelLevel, Cell currentCell) { return currentCell instanceof FuelPump && fuelLevel < Tanker.MAX_FUEL; } // Check if you are on a station, the station has a task and you have capacity to store the waste public static boolean checkCollectWaste(int wasteCapacity, Cell currentCell) { return currentCell instanceof Station && ((Station) currentCell).getTask() != null && wasteCapacity > 0; } // Check if there is a nearby station with a task, you have waste capacity // and you have enough fuel to get to the station and to the next fuel pump w/o running out public static boolean checkMoveToStationWTask(distanceToEnvRep closestStationWTask, int wasteCapacity, distanceToEnvRep closestFuelPump, int tankerX, int tankerY, int fuelLevel, int size) { return closestStationWTask != null && wasteCapacity > 0 && !isPointFurtherThanFuel(closestStationWTask.envX, closestStationWTask.envY, closestFuelPump.envX, closestFuelPump.envY, tankerX, tankerY, fuelLevel, size); } // Check if you are on a well and there is waste to get rid of public static boolean checkDisposeWaste(Cell currentCell, int wasteLevel) { return currentCell instanceof Well && wasteLevel > 0; } // Check if there is a nearby well, you have waste to get rid of // and you have enough fuel to get to the well and to the next fuel pump w/o running out public static boolean checkMoveToWell(distanceToEnvRep closestWell, int wasteLevel, distanceToEnvRep closestFuelPump, int tankerX, int tankerY, int fuelLevel, int size ) { return closestWell != null && wasteLevel > 0 && !isPointFurtherThanFuel(closestWell.envX, closestWell.envY, closestFuelPump.envX, closestFuelPump.envY, tankerX, tankerY, fuelLevel, size); } // Check if the nearest station with a task is nearer than the nearest well public static boolean checkStationCloserWell(distanceToEnvRep closestStationWTask, distanceToEnvRep closestWell) { return closestStationWTask != null && closestWell != null && closestStationWTask.distance <= closestWell.distance; } // Check if at max waste capacity and then aim to get rid of it if possible public static boolean checkAtWasteCapacity(int wasteCapacity, distanceToEnvRep closestWell, distanceToEnvRep closestFuelPump, int tankerX, int tankerY, int fuelLevel, int size) { return wasteCapacity <= 0 && closestWell != null && !isPointFurtherThanFuel(closestWell.envX, closestWell.envY, closestFuelPump.envX, closestFuelPump.envY, tankerX, tankerY, fuelLevel, size); } // Check if there is more waste at the station than there is waste capacity // As the task will never have more than the max waste capacity you can't have stations that are forever ignored public static boolean checkCapacityIsGETask(distanceToEnvRep closestStationWTask, int wasteCapacity, Cell[][] envRep) { return closestStationWTask != null && wasteCapacity >= ((Station) envRep[closestStationWTask.envX][closestStationWTask.envY]).getTask().getWasteRemaining(); } }
[ "kuldrgames@gmail.com" ]
kuldrgames@gmail.com
3c037717c934b8dbe9a63cf93b64d10031b7cd56
3ed5e75bef21da3cc84fa12e7ac2aa365c83091a
/jboot-admin-base/src/main/java/io/jboot/admin/base/common/ErrorResult.java
f7d18631e88e32eb1361c9dfff64bfaa87e2e3db
[ "Apache-2.0" ]
permissive
whmnoe4j/jboot-admin
7fb985df8bec31bf2879d3aa93a8c27e20902977
ce1982e570b42b37ddbd70aad259e2d73670ecf5
refs/heads/master
2020-03-15T20:57:16.530889
2018-05-04T02:45:25
2018-05-04T02:45:25
132,344,848
0
1
Apache-2.0
2018-05-06T14:12:58
2018-05-06T14:12:57
null
UTF-8
Java
false
false
876
java
package io.jboot.admin.base.common; import java.io.Serializable; /** * 错误返回 * @author Rlax * */ public class ErrorResult implements Serializable { public final static Integer NORMAL_ERROR = 0; public final static Integer VALIDATOR_ERROR = 1; public final static Integer BUSINESS_ERROR = 2; public final static Integer FALL_BACK_ERROR = 100; public final static Integer SYSTEM_ERROR = 500; private Integer code; private String msg; public ErrorResult() { } public ErrorResult(Integer code, String msg) { this.code = code; this.msg = msg; } public Integer getCode() { return code; } public void setCode(Integer code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } }
[ "popkids@qq.com" ]
popkids@qq.com
2f5db209bdab222196e5464d09422fecc2cb1df6
71e6797c3cb112c893cff06205fb9c3bec81b480
/src/main/java/com/fin/moblibrary/domain/Book.java
952e5e100968e8c13cdc17f2b8ffeb5ff8157c0b
[]
no_license
KatherineJY/MobileLibrary
ba03c789c769c0c905337f094bb3165e448f8a7a
1d6b71c3c09e254456bfc5e6400463994d1eb115
refs/heads/master
2021-09-02T12:24:22.113446
2018-01-02T15:35:20
2018-01-02T15:35:20
115,312,224
0
0
null
null
null
null
UTF-8
Java
false
false
1,028
java
package com.fin.moblibrary.domain; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; /** * @author KatherineJY * Book类 * 表示具体的某一本书 */ @Entity public class Book { private Integer id; private Integer bookCategoryId; private Integer libraryId; private boolean borrow; private boolean save; @Id @GeneratedValue public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getBookCategoryId() { return bookCategoryId; } public void setBookCategoryId(Integer bookCategoryId) { this.bookCategoryId = bookCategoryId; } public Integer getLibraryId() { return libraryId; } public void setLibraryId(Integer libraryId) { this.libraryId = libraryId; } public boolean isBorrow() { return borrow; } public void setBorrow(boolean borrow) { this.borrow = borrow; } public boolean isSave() { return save; } public void setSave(boolean save) { this.save = save; } }
[ "kellymayliu@163.com" ]
kellymayliu@163.com
05279d81dc38eb593a4601ad40092fe835087495
7558fcb794b0364b5e9043060ba513bd5155f425
/.SHP/SHP-Bean/ejbModule/Bean/WeatherBean.java
4c34e48bb91245ec6c86aa183234b87bb27a8a36
[]
no_license
Veganizer/Spezielle-Gebiete-zum-Softwareengineering
b855a98294e1b5e9aadf4122fea99e32e3819774
4fd61f09a964b88704747d14cb8a44b554791792
refs/heads/master
2021-06-18T21:41:45.081450
2017-07-10T08:36:29
2017-07-10T08:36:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
774
java
package Bean; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.ejb.Schedule; import javax.ejb.Singleton; import javax.ejb.Startup; import com.arcusweather.forecastio.Weather; import Interface.AutomationBeanRemote; import Interface.HomeBeanRemote; @Singleton @Startup public class WeatherBean { @EJB AutomationBeanRemote mb; @EJB HomeBeanRemote hb; @PostConstruct public void initIt() { onTimeout(); } /** * will be called every 30 minutes and executes the createWeather method */ @Schedule(second = "1", minute = "*/5", hour = "*") public void onTimeout() { Weather w = new Weather(hb.getSystemConfig().getLatitude(),hb.getSystemConfig().getLogitude()); mb.publish("/wetter", w.getWeatherName()); } }
[ "jowieweb@gmail.com" ]
jowieweb@gmail.com
fe374ac4f2b1f3a64496e57bd537e9dc2a139889
badd32f6c68ad1103b78edac873a475b2888febf
/src/main/java/com/bootdo/common/dao/ScoreDao.java
fa19595c0e930353ec0d16568b40d7d82373814c
[]
no_license
alwaysfaith/boot-mini
5159c7d092545869ff5b34280b07601fc1e5ca3c
ece04ae6002dc08298f63aa6572db0fcd6253db8
refs/heads/master
2022-11-05T18:04:40.523925
2019-08-14T06:54:34
2019-08-14T06:54:34
164,089,817
0
0
null
2022-10-12T20:22:09
2019-01-04T09:53:15
JavaScript
UTF-8
Java
false
false
565
java
package com.bootdo.common.dao; import com.bootdo.common.domain.ScoreDO; import java.util.List; import java.util.Map; import org.apache.ibatis.annotations.Mapper; /** * * @author chglee * @email 1992lcg@163.com * @date 2019-01-04 14:59:46 */ @Mapper public interface ScoreDao { ScoreDO get(Long betId); List<ScoreDO> list(Map<String, Object> map); int count(Map<String, Object> map); int save(ScoreDO score); int update(ScoreDO score); int remove(Long bet_id); int batchRemove(Long[] betIds); int batchSave(List<ScoreDO> score); }
[ "XinCai@sf-express.com" ]
XinCai@sf-express.com
e79c5ef32340825753c9e12f50dab30e4e9f1897
7b1296b08eea87ee84af01fff736d6dafd5b1599
/LetterCombinationsOfAPhoneNumber.java
230bfef53ef5a46c073153a8fb97d8edb67d1658
[]
no_license
YingZong887/Leetcode-Java
63634eccee53965d49206b1439c305c530b189c0
151cbb1e1ae75992ba118473f1408f0e34f80744
refs/heads/master
2021-01-10T14:34:56.140394
2015-12-27T01:16:22
2015-12-27T01:16:22
46,536,954
1
0
null
null
null
null
UTF-8
Java
false
false
1,236
java
import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class LetterCombinationsOfAPhoneNumber { public List<String> letterCombinations(String digits) { List<String> result = new ArrayList<String>(); if(digits == null || digits.length() == 0) { return result; } HashMap<Character, char[]> map = new HashMap<Character, char[]>(); map.put('0', new char[]{}); map.put('1', new char[]{}); map.put('2', new char[]{'a', 'b', 'c'}); map.put('3', new char[]{'d', 'e', 'f'}); map.put('4', new char[]{'g', 'h', 'i'}); map.put('5', new char[]{'j', 'k', 'l'}); map.put('6', new char[]{'m', 'n', 'o'}); map.put('7', new char[]{'p', 'q', 'r', 's'}); map.put('8', new char[]{'t', 'u', 'v'}); map.put('9', new char[]{'w', 'x', 'y', 'z'}); StringBuilder sb = new StringBuilder(); helperBT(map, result, sb, digits); return result; } private void helperBT(HashMap<Character, char[]> map, List<String> result, StringBuilder sb, String digits) { if(sb.length() == digits.length()) { result.add(sb.toString()); return; } for(char c : map.get(digits.charAt(sb.length()))) { sb.append(c); helperBT(map, result, sb, digits); sb.deleteCharAt(sb.length() - 1); } } }
[ "yz887@cornell.edu" ]
yz887@cornell.edu
a7d74d1e4a4e9b221a4501a950e084f213eafb7c
2395cbc10266cfc5e2cf172fda3d4af4855ababa
/chapter05/self-test/Average/Average.java
f5aa583486b5d57c5b1e4c26065a7155f0659116
[]
no_license
ChristopherDuggan/JavaBeginnersGuide
941965e26d2e67c855e376010adc7ff85bde4730
13a9da6d342d012a9d7924d015783756df9001c5
refs/heads/master
2020-09-16T08:43:35.644462
2020-01-28T23:43:15
2020-01-28T23:43:15
223,715,692
0
0
null
null
null
null
UTF-8
Java
false
false
282
java
class Average { public static void main(String args[]) { double[] arr = {12, 43, 2, 38, 129, 30, 84, 3, 8, 567}; int sum = 0; for(double d : arr) sum += d; double avg = sum/arr.length; System.out.println("the average of the numbers is: " + avg); } }
[ "chris@Christophers-MacBook-Air.local" ]
chris@Christophers-MacBook-Air.local
c181db58a5921f650cf068225011a7ae530da901
54e9e08ca046936652301d6d723a3e0ae4ba3b70
/srv/samhsa-srv/src/main/java/org/everydaymatters/samhsa/rules/Responder.java
d171e29a50e2aa0e0b851411b11fe34c8c11a5e6
[ "CC-BY-3.0" ]
permissive
edmMyLifeMatters/MyLifeMatters
88d407e89777fa8ae56ed080ec8c06f04eefcdfd
64513731d21f2359df2902630302610365e58c99
refs/heads/master
2020-02-26T15:19:58.603373
2013-08-09T20:39:03
2013-08-09T20:39:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,841
java
/* MyLifeMatters Copyright (c) 2013 by Netsmart Technologies, Inc. This work is licensed under the Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/. */ package org.everydaymatters.samhsa.rules; import com.mongodb.MongoClient; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.servlet.ServletContext; import org.everydaymatters.samhsa.srv.ApplicationContext; import org.everydaymatters.samhsa.srv.PushNotifier; public class Responder { public static final String ATTR_SMTP_HOST = "smtp-host"; public static final String ATTR_SMTP_PORT = "smtp-port"; public static final String ATTR_SMTP_AUTH = "smtp-auth"; public static final String ATTR_SMTP_TLS = "smtp-tls"; public static final String ATTR_SMTP_USER = "smtp-user"; public static final String ATTR_SMTP_PASSWD = "smtp-passwd"; public static final String ATTR_MAIL_NAME = "mail-name"; public static final String ATTR_MAIL_FROM = "mail-from"; protected ServletContext application; protected MongoClient mongo; protected String dbName; protected String smtpHost; protected Integer smtpPort; protected boolean smtpAuth; protected boolean smtpTls; protected String smtpUser; protected String smtpPasswd; protected String mailName; protected String mailFrom; protected PushNotifier notifier; public Responder() { initResponder(); } public Responder( ServletContext application ) { initResponder(); setApplication( application ); } private void initResponder() { mongo = null; dbName = null; mailName = null; } public void setApplication( ServletContext application ) { this.application = application; smtpHost = application.getInitParameter( ATTR_SMTP_HOST ); smtpPort = new Integer( application.getInitParameter( ATTR_SMTP_PORT ) ); smtpAuth = Boolean.parseBoolean( application.getInitParameter( ATTR_SMTP_AUTH ) ); smtpTls = Boolean.parseBoolean( application.getInitParameter( ATTR_SMTP_TLS ) ); smtpUser = application.getInitParameter( ATTR_SMTP_USER ); smtpPasswd = application.getInitParameter( ATTR_SMTP_PASSWD ); mailName = application.getInitParameter( ATTR_MAIL_NAME ); mailFrom = application.getInitParameter( ATTR_MAIL_FROM ); this.notifier = ApplicationContext.getNotifier( application ); } public void setMongoConfig( MongoClient mongo, String dbName ) { this.mongo = mongo; this.dbName = dbName; } public PushNotifier getNotifier() { return notifier; } public void sendMessage( String addrTo, String subject, String body ) { /*DEBUG*/System.out.println( "sendMessage() "+addrTo ); Properties props = new Properties(); props.put( "mail.smtp.auth", ""+smtpAuth ); props.put( "mail.smtp.starttls.enable", ""+smtpTls ); props.put( "mail.smtp.host", smtpHost ); props.put( "mail.smtp.port", smtpPort.toString() ); Session session = Session.getInstance( props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication( smtpUser, smtpPasswd ); } } ); try { /*DEBUG*/System.out.println( "Preparing message for "+addrTo ); Message message = new MimeMessage( session ); message.setFrom( new InternetAddress( mailFrom ) ); message.setRecipients( Message.RecipientType.TO, InternetAddress.parse( addrTo ) ); message.setSubject( subject ); message.setText( body ); /*DEBUG*/System.out.println( "Sending message to "+addrTo ); Transport.send( message ); /*DEBUG*/System.out.println( "Done" ); } catch ( MessagingException e ) { e.printStackTrace(); throw new RuntimeException( e ); } } public void log( String message ) { if ( application!=null ) { application.log( message ); } else { System.out.println( message ); } } }
[ "edmMyLifeMatters@gmail.com" ]
edmMyLifeMatters@gmail.com
26b0871245cdbd5559d75b77a71e18a51a6254c4
e888e108602bed150fee49cbe49ed7faff5089a2
/src/main/java/com/jiuzhe/hotel/entity/SkuDetail.java
f0ea1bbf48c388cd0aaaa51e94653849c384fbee
[]
no_license
sinyears-xw/hotel
0ad98e5b05140f64d64f320078b4e6628cb3cad7
919fddfca55bae131593944cb4aece9428e57757
refs/heads/master
2022-03-30T22:07:29.906062
2020-01-19T13:13:39
2020-01-19T13:13:39
219,424,177
0
0
null
null
null
null
UTF-8
Java
false
false
7,199
java
package com.jiuzhe.hotel.entity; import java.util.List; import java.util.Map; /** * @Description:点击图标返回给前台的酒店详情 * @author:郑鹏宇 * @date: 2018/4/9 */ public class SkuDetail { /** * 酒店id */ private String id; /** * 酒店名称 */ private String skuName; /** * 日期价格对应表 */ private Map<String, Integer> datePrices; /** * 照片集合 */ private String urls; /** * 经度 */ private Integer lng; /** * 维度 */ private Integer lat; /** * 地址 */ private String address; /** * 默认价格(单价) */ private Integer defPrice; /** * 默认状态 */ private Integer defStatus; /** * 押金 */ private Integer roomBond; /** * 商户id */ private String merchantId; /** * 房间类型 */ private String roomType; /** * 无线 */ private Integer wifi; /** * 卧室数 */ private Integer bedroomNum; /** * 洗手间数 */ private Integer toiletNum; /** * 房号 */ private String roomNo; /** * 床位数 */ private Integer bedNum; /** * 详情 */ private String remark; /** * 价格日期(段) */ private List DatePriceList; /** * 照片合集 */ private List<String> imgs; /** * 城市名 */ private String cityName; /** * 区 */ private String area; private Integer score; private String storeId; private String layoutId; private String layName; private Integer layWifi; private Integer layBedroom; private Integer layBed; private Integer layToilet; private String laypicList; private Integer laycount; /** * 门店照片 */ private String storePic; public String getStorePic() { return storePic; } public void setStorePic(String storePic) { this.storePic = storePic; } public String getReceptionPic() { return receptionPic; } public void setReceptionPic(String receptionPic) { this.receptionPic = receptionPic; } /** * 前台照片 */ private String receptionPic; public String getStoreId() { return storeId; } public void setStoreId(String storeId) { this.storeId = storeId; } public String getLayoutId() { return layoutId; } public void setLayoutId(String layoutId) { this.layoutId = layoutId; } public String getLayName() { return layName; } public void setLayName(String layName) { this.layName = layName; } public Integer getLayWifi() { return layWifi; } public void setLayWifi(Integer layWifi) { this.layWifi = layWifi; } public Integer getLayBedroom() { return layBedroom; } public void setLayBedroom(Integer layBedroom) { this.layBedroom = layBedroom; } public Integer getLayBed() { return layBed; } public void setLayBed(Integer layBed) { this.layBed = layBed; } public Integer getLayToilet() { return layToilet; } public void setLayToilet(Integer layToilet) { this.layToilet = layToilet; } public String getLaypicList() { return laypicList; } public void setLaypicList(String laypicList) { this.laypicList = laypicList; } public Integer getLaycount() { return laycount; } public void setLaycount(Integer laycount) { this.laycount = laycount; } public Integer getScore() { return score; } public void setScore(Integer score) { this.score = score; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } public String getArea() { return area; } public void setArea(String area) { this.area = area; } public List<String> getImgs() { return imgs; } public void setImgs(List<String> imgs) { this.imgs = imgs; } public List getDatePriceList() { return DatePriceList; } public void setDatePriceList(List datePriceList) { DatePriceList = datePriceList; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public Integer getDefStatus() { return defStatus; } public String getRoomNo() { return roomNo; } public void setRoomNo(String roomNo) { this.roomNo = roomNo; } public Integer getBedNum() { return bedNum; } public void setBedNum(Integer bedNum) { this.bedNum = bedNum; } public void setDefStatus(Integer defStatus) { this.defStatus = defStatus; } public String getMerchantId() { return merchantId; } public void setMerchantId(String merchantId) { this.merchantId = merchantId; } public Integer getRoomBond() { return roomBond; } public void setRoomBond(Integer roomBond) { this.roomBond = roomBond; } public String getUrls() { return urls; } public void setUrls(String urls) { this.urls = urls; } public Map<String, Integer> getDatePrices() { return datePrices; } public void setDatePrices(Map<String, Integer> datePrices) { this.datePrices = datePrices; } public String getSkuName() { return skuName; } public void setSkuName(String skuName) { this.skuName = skuName; } public Integer getDefPrice() { return defPrice; } public void setDefPrice(Integer defPrice) { this.defPrice = defPrice; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getRoomType() { return roomType; } public void setRoomType(String roomType) { this.roomType = roomType; } public Integer getWifi() { return wifi; } public void setWifi(Integer wifi) { this.wifi = wifi; } public Integer getBedroomNum() { return bedroomNum; } public void setBedroomNum(Integer bedroomNum) { this.bedroomNum = bedroomNum; } public Integer getToiletNum() { return toiletNum; } public void setToiletNum(Integer toiletNum) { this.toiletNum = toiletNum; } public Integer getLng() { return lng; } public void setLng(Integer lng) { this.lng = lng; } public Integer getLat() { return lat; } public void setLat(Integer lat) { this.lat = lat; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } }
[ "zhengpy@gooalgene.com" ]
zhengpy@gooalgene.com
c61ec8ca3c19b9e4124310b3560c53d341310fe0
698c9eeb05a22b9a7bb4e2bf5f2204b872da6275
/trackstacking/src/main/java/top/wangruns/trackstacking/controller/LoginController.java
95aab3350002017d47962ddf76daaf08d1ed6260
[ "MIT" ]
permissive
musicRecSys/musicRec
63383206e8f3c236a3cd4385a970b0e482216326
8d81a7c8accd69997f0afe2d19f2024ec2b61433
refs/heads/master
2022-12-22T15:20:54.863448
2019-11-11T12:14:22
2019-11-11T12:14:22
220,964,326
0
0
MIT
2022-12-16T08:45:27
2019-11-11T11:16:57
Java
UTF-8
Java
false
false
1,283
java
package top.wangruns.trackstacking.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.alibaba.fastjson.JSONObject; import top.wangruns.trackstacking.model.User; import top.wangruns.trackstacking.service.UserService; import top.wangruns.trackstacking.utils.ReturnMsg; @Controller public class LoginController { @Autowired private UserService userService; @PostMapping(value = "login.do",produces = "text/html;charset=UTF-8") @ResponseBody public String login(HttpServletRequest request, User u) { boolean isUserExisted=userService.findLogin(u); if(!isUserExisted) { return ReturnMsg.msg(HttpServletResponse.SC_BAD_REQUEST, "帐号或密码错误"); }else { request.getSession().setAttribute("user", u); request.getSession().setAttribute("isHasPrivilege", userService.isHasPrivilege(request)); return ReturnMsg.msg(HttpServletResponse.SC_OK, JSONObject.toJSON(u).toString()); } } }
[ "821725353@qq.com" ]
821725353@qq.com
93eaebd196a144e2743854ff24eb20c7984e6e49
ba54f5ad6ffdf84e52d4e6918d6938dbd40ceaa3
/app/src/main/java/apps/firmanmujahidin/com/iakbeginner/About.java
78f4d59ffea7bda55e13879cfd0fbfd8b1dd551d
[]
no_license
ladycaesar/IAKBeginner
10ad70069876c482a2eb435c35568e0175145b9d
41b21e61ee0e06134def76c8a328f9daa1b72a08
refs/heads/master
2021-01-21T16:28:28.906563
2017-05-20T13:25:24
2017-05-20T13:25:24
91,878,828
0
0
null
null
null
null
UTF-8
Java
false
false
367
java
package apps.firmanmujahidin.com.iakbeginner; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; /** * Created by Ladydeeyy on 5/20/2017. */ public class About extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about); } }
[ "sevikalady@gmail.com" ]
sevikalady@gmail.com
d2707a9ef880d9f97dd85d78c4340dcf1eb1a84a
420f88201bdb924338647f14da7b2271f1abc64d
/src/main/java/com/lauta/model/Scalene.java
d859c4ee4ac1160fa4f1f8d8533f1b66892c7d5f
[]
no_license
DavidLauta/FlexionCodeReview
e06666c89fcb6c9605fd80f9487543e3cbfd2666
8c420b06b04337df22121b1524244b5c79d10e15
refs/heads/Develop
2021-01-22T19:44:50.179273
2017-03-17T07:09:46
2017-03-17T07:09:46
85,239,836
0
0
null
2017-03-17T07:15:32
2017-03-16T20:42:45
Java
UTF-8
Java
false
false
588
java
/* * Source code copyright David Lauta * All rights reserved */ package com.lauta.model; /** * This class represents a Triangle where none of the sides are equal length * @author Dave */ public class Scalene extends BaseT implements Triangle{ public Scalene(double sideA, double sideB, double sideC){ super(); setSides(sideA, sideB, sideC); } @Override public String getName(){ String name = "The triangle with the sides " + getSideA() + " " + getSideB() +" " + getSideC() +", is a Scalene triangle"; return name; } }
[ "lautad@gate.net" ]
lautad@gate.net
9ce04551e7ca21c26221289719321932c30692dd
6e2657898326cb0cfec4c62973db10469bbd0aec
/app/src/main/java/com/media2359/acpdemo/env/ImageUtils.java
81e3d2efa3d5fb4225868887694ccdd23a1a0425
[]
no_license
khoi-nguyen-2359/TensorFlowDemo
5f422b0089e8067e9a75f62f2befeb386fb63dbb
9b5c136040e33a0779ef50b4aeb095c7b128e42b
refs/heads/master
2021-05-03T07:16:32.319914
2018-02-07T05:13:19
2018-02-07T05:13:19
120,605,595
0
0
null
null
null
null
UTF-8
Java
false
false
11,691
java
/* Copyright 2015 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ package com.media2359.acpdemo.env; import android.graphics.Bitmap; import android.graphics.Matrix; import android.os.Environment; import java.io.File; import java.io.FileOutputStream; /** * Utility class for manipulating images. **/ public class ImageUtils { @SuppressWarnings("unused") private static final Logger LOGGER = new Logger(); static { try { System.loadLibrary("acp_demo"); } catch (UnsatisfiedLinkError e) { LOGGER.w("Native library not found, native RGB -> YUV conversion may be unavailable."); } } /** * Utility method to compute the allocated size in bytes of a YUV420SP image * of the given dimensions. */ public static int getYUVByteSize(final int width, final int height) { // The luminance plane requires 1 byte per pixel. final int ySize = width * height; // The UV plane works on 2x2 blocks, so dimensions with odd size must be rounded up. // Each 2x2 block takes 2 bytes to encode, one each for U and V. final int uvSize = ((width + 1) / 2) * ((height + 1) / 2) * 2; return ySize + uvSize; } /** * Saves a Bitmap object to disk for analysis. * * @param bitmap The bitmap to save. */ public static void saveBitmap(final Bitmap bitmap) { saveBitmap(bitmap, "preview.png"); } /** * Saves a Bitmap object to disk for analysis. * * @param bitmap The bitmap to save. * @param filename The location to save the bitmap to. */ public static void saveBitmap(final Bitmap bitmap, final String filename) { final String root = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "tensorflow"; LOGGER.i("Saving %dx%d bitmap to %s.", bitmap.getWidth(), bitmap.getHeight(), root); final File myDir = new File(root); if (!myDir.mkdirs()) { LOGGER.i("Make dir failed"); } final String fname = filename; final File file = new File(myDir, fname); if (file.exists()) { file.delete(); } try { final FileOutputStream out = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 99, out); out.flush(); out.close(); } catch (final Exception e) { LOGGER.e(e, "Exception!"); } } // This value is 2 ^ 18 - 1, and is used to clamp the RGB values before their ranges // are normalized to eight bits. static final int kMaxChannelValue = 262143; // Always prefer the native implementation if available. private static boolean useNativeConversion = true; public static void convertYUV420SPToARGB8888( byte[] input, int width, int height, int[] output) { if (useNativeConversion) { try { ImageUtils.convertYUV420SPToARGB8888(input, output, width, height, false); return; } catch (UnsatisfiedLinkError e) { LOGGER.w( "Native YUV420SP -> RGB implementation not found, falling back to Java implementation"); useNativeConversion = false; } } // Java implementation of YUV420SP to ARGB8888 converting final int frameSize = width * height; for (int j = 0, yp = 0; j < height; j++) { int uvp = frameSize + (j >> 1) * width; int u = 0; int v = 0; for (int i = 0; i < width; i++, yp++) { int y = 0xff & input[yp]; if ((i & 1) == 0) { v = 0xff & input[uvp++]; u = 0xff & input[uvp++]; } output[yp] = YUV2RGB(y, u, v); } } } private static int YUV2RGB(int y, int u, int v) { // Adjust and check YUV values y = (y - 16) < 0 ? 0 : (y - 16); u -= 128; v -= 128; // This is the floating point equivalent. We do the conversion in integer // because some Android devices do not have floating point in hardware. // nR = (int)(1.164 * nY + 2.018 * nU); // nG = (int)(1.164 * nY - 0.813 * nV - 0.391 * nU); // nB = (int)(1.164 * nY + 1.596 * nV); int y1192 = 1192 * y; int r = (y1192 + 1634 * v); int g = (y1192 - 833 * v - 400 * u); int b = (y1192 + 2066 * u); // Clipping RGB values to be inside boundaries [ 0 , kMaxChannelValue ] r = r > kMaxChannelValue ? kMaxChannelValue : (r < 0 ? 0 : r); g = g > kMaxChannelValue ? kMaxChannelValue : (g < 0 ? 0 : g); b = b > kMaxChannelValue ? kMaxChannelValue : (b < 0 ? 0 : b); return 0xff000000 | ((r << 6) & 0xff0000) | ((g >> 2) & 0xff00) | ((b >> 10) & 0xff); } public static void convertYUV420ToARGB8888( byte[] yData, byte[] uData, byte[] vData, int width, int height, int yRowStride, int uvRowStride, int uvPixelStride, int[] out) { if (useNativeConversion) { try { convertYUV420ToARGB8888( yData, uData, vData, out, width, height, yRowStride, uvRowStride, uvPixelStride, false); return; } catch (UnsatisfiedLinkError e) { LOGGER.w( "Native YUV420 -> RGB implementation not found, falling back to Java implementation"); useNativeConversion = false; } } int yp = 0; for (int j = 0; j < height; j++) { int pY = yRowStride * j; int pUV = uvRowStride * (j >> 1); for (int i = 0; i < width; i++) { int uv_offset = pUV + (i >> 1) * uvPixelStride; out[yp++] = YUV2RGB( 0xff & yData[pY + i], 0xff & uData[uv_offset], 0xff & vData[uv_offset]); } } } /** * Converts YUV420 semi-planar data to ARGB 8888 data using the supplied width and height. The * input and output must already be allocated and non-null. For efficiency, no error checking is * performed. * * @param input The array of YUV 4:2:0 input data. * @param output A pre-allocated array for the ARGB 8:8:8:8 output data. * @param width The width of the input image. * @param height The height of the input image. * @param halfSize If true, downsample to 50% in each dimension, otherwise not. */ private static native void convertYUV420SPToARGB8888( byte[] input, int[] output, int width, int height, boolean halfSize); /** * Converts YUV420 semi-planar data to ARGB 8888 data using the supplied width * and height. The input and output must already be allocated and non-null. * For efficiency, no error checking is performed. * * @param y * @param u * @param v * @param uvPixelStride * @param width The width of the input image. * @param height The height of the input image. * @param halfSize If true, downsample to 50% in each dimension, otherwise not. * @param output A pre-allocated array for the ARGB 8:8:8:8 output data. */ private static native void convertYUV420ToARGB8888( byte[] y, byte[] u, byte[] v, int[] output, int width, int height, int yRowStride, int uvRowStride, int uvPixelStride, boolean halfSize); /** * Converts YUV420 semi-planar data to RGB 565 data using the supplied width * and height. The input and output must already be allocated and non-null. * For efficiency, no error checking is performed. * * @param input The array of YUV 4:2:0 input data. * @param output A pre-allocated array for the RGB 5:6:5 output data. * @param width The width of the input image. * @param height The height of the input image. */ private static native void convertYUV420SPToRGB565( byte[] input, byte[] output, int width, int height); /** * Converts 32-bit ARGB8888 image data to YUV420SP data. This is useful, for * instance, in creating data to feed the classes that rely on raw camera * preview frames. * * @param input An array of input pixels in ARGB8888 format. * @param output A pre-allocated array for the YUV420SP output data. * @param width The width of the input image. * @param height The height of the input image. */ private static native void convertARGB8888ToYUV420SP( int[] input, byte[] output, int width, int height); /** * Converts 16-bit RGB565 image data to YUV420SP data. This is useful, for * instance, in creating data to feed the classes that rely on raw camera * preview frames. * * @param input An array of input pixels in RGB565 format. * @param output A pre-allocated array for the YUV420SP output data. * @param width The width of the input image. * @param height The height of the input image. */ private static native void convertRGB565ToYUV420SP( byte[] input, byte[] output, int width, int height); /** * Returns a transformation matrix from one reference frame into another. * Handles cropping (if maintaining aspect ratio is desired) and rotation. * * @param srcWidth Width of source frame. * @param srcHeight Height of source frame. * @param dstWidth Width of destination frame. * @param dstHeight Height of destination frame. * @param applyRotation Amount of rotation to apply from one frame to another. * Must be a multiple of 90. * @param maintainAspectRatio If true, will ensure that scaling in x and y remains constant, * cropping the image if necessary. * @return The transformation fulfilling the desired requirements. */ public static Matrix getTransformationMatrix( final int srcWidth, final int srcHeight, final int dstWidth, final int dstHeight, final int applyRotation, final boolean maintainAspectRatio) { final Matrix matrix = new Matrix(); if (applyRotation != 0) { if (applyRotation % 90 != 0) { LOGGER.w("Rotation of %d % 90 != 0", applyRotation); } // Translate so center of image is at origin. matrix.postTranslate(-srcWidth / 2.0f, -srcHeight / 2.0f); // Rotate around origin. matrix.postRotate(applyRotation); } // Account for the already applied rotation, if any, and then determine how // much scaling is needed for each axis. final boolean transpose = (Math.abs(applyRotation) + 90) % 180 == 0; final int inWidth = transpose ? srcHeight : srcWidth; final int inHeight = transpose ? srcWidth : srcHeight; // Apply scaling if necessary. if (inWidth != dstWidth || inHeight != dstHeight) { final float scaleFactorX = dstWidth / (float) inWidth; final float scaleFactorY = dstHeight / (float) inHeight; if (maintainAspectRatio) { // Scale by minimum factor so that dst is filled completely while // maintaining the aspect ratio. Some image may fall off the edge. final float scaleFactor = Math.max(scaleFactorX, scaleFactorY); matrix.postScale(scaleFactor, scaleFactor); } else { // Scale exactly to fill dst from src. matrix.postScale(scaleFactorX, scaleFactorY); } } if (applyRotation != 0) { // Translate back from origin centered reference to destination frame. matrix.postTranslate(dstWidth / 2.0f, dstHeight / 2.0f); } return matrix; } }
[ "akhoi90@gmail.com" ]
akhoi90@gmail.com
94b1cacfefa26dbdfd26ef44c99938315b669a90
8397330f51db7b70f812b13013004ba0362bac01
/src/main/java/org/cytoscape/analyzer/tasks/RemoveSelfLoopsTask.java
1c6a8e0d728101cdf43db6b0712614c25043a071
[]
no_license
cytoscape/analyzer
ffc3af8f53520d283c7ffcbab60729103acefddb
ef8d1146b2a78a7e9a38cfa3ebba2475a5c26b34
refs/heads/master
2023-09-05T21:53:55.190587
2022-01-07T02:01:14
2022-01-07T02:01:14
167,079,989
0
1
null
2020-10-13T11:44:43
2019-01-22T22:54:52
Java
UTF-8
Java
false
false
3,275
java
package org.cytoscape.analyzer.tasks; /* * #%L * Cytoscape NetworkAnalyzer Impl (network-analyzer-impl) * $Id:$ * $HeadURL:$ * %% * Copyright (C) 2006 - 2013 * Max Planck Institute for Informatics, Saarbruecken, Germany * The Cytoscape Consortium * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation, either version 2.1 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 Lesser Public License for more details. * * You should have received a copy of the GNU General Lesser Public * License along with this program. If not, see * <http://www.gnu.org/licenses/lgpl-2.1.html>. * #L% */ import java.awt.Frame; import java.awt.event.ActionEvent; import java.util.Arrays; import java.util.List; import org.cytoscape.analyzer.util.CyNetworkUtils; import org.cytoscape.application.CyApplicationManager; import org.cytoscape.application.swing.CySwingApplication; import org.cytoscape.model.CyNetwork; import org.cytoscape.model.CyNetworkManager; import org.cytoscape.work.AbstractTask; import org.cytoscape.work.Tunable; import org.cytoscape.work.ObservableTask; import org.cytoscape.work.TaskMonitor; import org.cytoscape.work.json.JSONResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Action handler for the menu item &quot;Remove Self-loops&quot;. * * @author Yassen Assenov * @author Sven-Eric Schelhorn */ public class RemoveSelfLoopsTask extends AbstractTask implements ObservableTask { private static final Logger logger = LoggerFactory.getLogger(RemoveSelfLoopsTask.class); public static String SM_REMSELFLOOPS = " self-loop(s) removed from "; @Tunable(description="Network to remove the self loops from", required=true) public CyNetwork network; private String[] networkNames; private int[] removedLoops; /** * Initializes a new instance of <code>RemoveSelfLoopsTask</code>. */ public RemoveSelfLoopsTask() { } @Override public void run(TaskMonitor taskMonitor) { networkNames = new String[1]; removedLoops = new int[1]; if (network != null) { removedLoops[0] = CyNetworkUtils.removeSelfLoops(network); } } @Override public List<Class<?>> getResultClasses() { return Arrays.asList(String.class, JSONResult.class); } @Override public <R> R getResults(Class<? extends R> type) { String r = constructReport(removedLoops, SM_REMSELFLOOPS, networkNames); if (type.isAssignableFrom(JSONResult.class)) { JSONResult res = () -> { String str = "{\"network\":"+network.getSUID()+","; str += "\"removed\":"+removedLoops[0]+"}"; return str; }; return (R) res; } return (R)r; } private String constructReport(int[] removedLoops, String s, String[] networkNames) { String report = ""; for (int index = 0; index < removedLoops.length; index++) report += removedLoops[index]+s+networkNames[index]+"\n"; return report; } }
[ "scooter@cgl.ucsf.edu" ]
scooter@cgl.ucsf.edu
bfc99862ec0db32adb20f38641db82632db5261e
675b99783f99a4addc203a01a0f82632abf5bd3c
/LaTaxiDriver/app/src/main/java/com/guvi/gt/lataxidriver/activity/DriverDocumentsActivity.java
01b5a51938a1a00bb9cdf85e11c357cdbc357dc9
[]
no_license
Dummyurl/guvi
479723735dddec274b9f0f3757d53a9976339949
304ad375a5b8b38e32629f8a1fd978d88ee0d5bb
refs/heads/master
2020-04-10T09:19:34.737798
2018-01-17T04:30:10
2018-01-17T04:30:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
20,056
java
package com.guvi.gt.lataxidriver.activity; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.Snackbar; import android.util.Log; import android.view.HapticFeedbackConstants; import android.view.View; import android.widget.ImageView; import com.google.gson.Gson; import java.util.HashMap; import com.guvi.gt.lataxidriver.R; import com.guvi.gt.lataxidriver.app.App; import com.guvi.gt.lataxidriver.config.Config; import com.guvi.gt.lataxidriver.listeners.DocumentStatusListener; import com.guvi.gt.lataxidriver.model.DocumentBean; import com.guvi.gt.lataxidriver.model.DocumentStatusBean; import com.guvi.gt.lataxidriver.net.DataManager; import com.guvi.gt.lataxidriver.util.AppConstants; public class DriverDocumentsActivity extends BaseAppCompatNoDrawerActivity { private static final String TAG = "DriverDocA"; private static final int REQUEST_DRIVER_LICENCE = 0; private static final int REQUEST_POLICE_CLEARANCE_CERTIFICATE = 1; private static final int REQUEST_FITNESS_CERTIFICATE = 2; private static final int REQUEST_VEHICLE_REGISTRATION = 3; private static final int REQUEST_VEHICLE_PERMIT = 4; private static final int REQUEST_COMMERCIAL_INSURANCE = 5; private static final int REQUEST_TAX_RECEIPT = 6; private ImageView ivDriverLicenceNext; private ImageView ivDriverLicenceSaved; private ImageView ivPoliceClearanceCertificateNext; private ImageView ivPoliceClearanceCertificateSaved; private ImageView ivFitnessCertificateNext; private ImageView ivFitnessCertificateSaved; private ImageView ivVehicleRegistrationNext; private ImageView ivVehicleRegistrationSaved; private ImageView ivVehiclePermitNext; private ImageView ivVehiclePermitSaved; private ImageView ivCommercialInsuranceNext; private ImageView ivCommercialInsuranceSaved; private ImageView ivTaxReceiptNext; private ImageView ivTaxReceiptSaved; private View.OnClickListener snackBarRefreshOnClickListener; private boolean isDriverLicenceUploaded; private boolean isPoliceClearanceCertificateUploaded; private boolean isFitnessCertificateUploaded; private boolean isVehicleRegistrationUploaded; private boolean isVehiclePermitUploaded; private boolean isCommercialInsuranceUploaded; private boolean isTaxReceiptUploaded; private DocumentStatusBean documentStatusBean; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_driver_documents); initViews(); getSupportActionBar().setTitle(R.string.label_documents); getSupportActionBar().setDisplayShowTitleEnabled(true); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_DRIVER_LICENCE && resultCode == RESULT_OK) { isDriverLicenceUploaded = true; ivDriverLicenceNext.setVisibility(View.GONE); ivDriverLicenceSaved.setVisibility(View.VISIBLE); } if (requestCode == REQUEST_POLICE_CLEARANCE_CERTIFICATE && resultCode == RESULT_OK) { isPoliceClearanceCertificateUploaded = true; ivPoliceClearanceCertificateNext.setVisibility(View.GONE); ivPoliceClearanceCertificateSaved.setVisibility(View.VISIBLE); } if (requestCode == REQUEST_FITNESS_CERTIFICATE && resultCode == RESULT_OK) { isFitnessCertificateUploaded = true; ivFitnessCertificateNext.setVisibility(View.GONE); ivFitnessCertificateSaved.setVisibility(View.VISIBLE); } if (requestCode == REQUEST_VEHICLE_REGISTRATION && resultCode == RESULT_OK) { isVehicleRegistrationUploaded = true; ivVehicleRegistrationNext.setVisibility(View.GONE); ivVehicleRegistrationSaved.setVisibility(View.VISIBLE); } if (requestCode == REQUEST_VEHICLE_PERMIT && resultCode == RESULT_OK) { isVehiclePermitUploaded = true; ivVehiclePermitNext.setVisibility(View.GONE); ivVehiclePermitSaved.setVisibility(View.VISIBLE); } if (requestCode == REQUEST_COMMERCIAL_INSURANCE && resultCode == RESULT_OK) { isCommercialInsuranceUploaded = true; ivCommercialInsuranceNext.setVisibility(View.GONE); ivCommercialInsuranceSaved.setVisibility(View.VISIBLE); } if (requestCode == REQUEST_TAX_RECEIPT && resultCode == RESULT_OK) { isTaxReceiptUploaded = true; ivTaxReceiptNext.setVisibility(View.GONE); ivTaxReceiptSaved.setVisibility(View.VISIBLE); } } @Override protected void onResume() { super.onResume(); if (documentStatusBean == null) { setProgressScreenVisibility(true, true); getData(false); } else { getData(true); } } private void getData(boolean isSwipeRefreshing) { swipeView.setRefreshing(isSwipeRefreshing); if (App.isNetworkAvailable()) { fetchDocumentStatus(); } else { Snackbar.make(coordinatorLayout, AppConstants.NO_NETWORK_AVAILABLE, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.btn_retry, snackBarRefreshOnClickListener).show(); } } private void initViews() { snackBarRefreshOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); // mVibrator.vibrate(25); setProgressScreenVisibility(true, true); getData(false); } }; ivDriverLicenceNext = (ImageView) findViewById(R.id.iv_driver_docuements_driver_license_next); ivDriverLicenceSaved = (ImageView) findViewById(R.id.iv_driver_docuements_driver_license_saved); ivPoliceClearanceCertificateNext = (ImageView) findViewById(R.id.iv_driver_docuements_police_clearance_certificate_next); ivPoliceClearanceCertificateSaved = (ImageView) findViewById(R.id.iv_driver_docuements_police_clearance_certificate_saved); ivFitnessCertificateNext = (ImageView) findViewById(R.id.iv_driver_docuements_fitness_certificate_next); ivFitnessCertificateSaved = (ImageView) findViewById(R.id.iv_driver_docuements_fitness_certificate_saved); ivVehicleRegistrationNext = (ImageView) findViewById(R.id.iv_driver_docuements_vehicle_registration_next); ivVehicleRegistrationSaved = (ImageView) findViewById(R.id.iv_driver_docuements_vehicle_registration_saved); ivVehiclePermitNext = (ImageView) findViewById(R.id.iv_driver_docuements_vehicle_permit_next); ivVehiclePermitSaved = (ImageView) findViewById(R.id.iv_driver_docuements_vehicle_permit_saved); ivCommercialInsuranceNext = (ImageView) findViewById(R.id.iv_driver_docuements_commercial_insurance_next); ivCommercialInsuranceSaved = (ImageView) findViewById(R.id.iv_driver_docuements_commercial_insurance_saved); ivTaxReceiptNext = (ImageView) findViewById(R.id.iv_driver_docuements_tax_receipt_next); ivTaxReceiptSaved = (ImageView) findViewById(R.id.iv_driver_docuements_tax_receipt_saved); } private void fetchDocumentStatus() { HashMap<String, String> urlParams = new HashMap<>(); urlParams.put("auth_token", Config.getInstance().getAuthToken()); DataManager.fetchDocumentStatus(urlParams, new DocumentStatusListener() { @Override public void onLoadCompleted(DocumentStatusBean documentStatusBeanWS) { documentStatusBean = documentStatusBeanWS; populateDocumentStatus(); } @Override public void onLoadFailed(String error) { swipeView.setRefreshing(false); setProgressScreenVisibility(true, false); Snackbar.make(coordinatorLayout, error, Snackbar.LENGTH_INDEFINITE) .setAction(R.string.btn_retry, snackBarRefreshOnClickListener).show(); if (App.getInstance().isDemo()) { setProgressScreenVisibility(false, false); } } }); } private void populateDocumentStatus() { for (DocumentBean bean : documentStatusBean.getDocuments()) { Log.i(TAG, "populateDocumentStatus: DocumentBean : " + new Gson().toJson(bean)); if (bean.getType() == AppConstants.DOCUMENT_TYPE_DRIVER_LICENCE) { if (bean.isUploaded() || (bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_PENDING_APPROVAL && bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_APPROVED)) { isDriverLicenceUploaded = true; ivDriverLicenceNext.setVisibility(View.GONE); ivDriverLicenceSaved.setVisibility(View.VISIBLE); } else { isDriverLicenceUploaded = false; ivDriverLicenceNext.setVisibility(View.VISIBLE); ivDriverLicenceSaved.setVisibility(View.GONE); } } else if (bean.getType() == AppConstants.DOCUMENT_TYPE_POLICE_CLEARANCE_CERTIFICATE) { if (bean.isUploaded() || (bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_PENDING_APPROVAL && bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_APPROVED)) { isPoliceClearanceCertificateUploaded = true; ivPoliceClearanceCertificateNext.setVisibility(View.GONE); ivPoliceClearanceCertificateSaved.setVisibility(View.VISIBLE); } else { isPoliceClearanceCertificateUploaded = false; ivPoliceClearanceCertificateNext.setVisibility(View.VISIBLE); ivPoliceClearanceCertificateSaved.setVisibility(View.GONE); } } else if (bean.getType() == AppConstants.DOCUMENT_TYPE_FITNESS_CERTIFICATE) { if (bean.isUploaded() || (bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_PENDING_APPROVAL && bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_APPROVED)) { isFitnessCertificateUploaded = true; ivFitnessCertificateNext.setVisibility(View.GONE); ivFitnessCertificateSaved.setVisibility(View.VISIBLE); } else { isFitnessCertificateUploaded = false; ivFitnessCertificateNext.setVisibility(View.VISIBLE); ivFitnessCertificateSaved.setVisibility(View.GONE); } } else if (bean.getType() == AppConstants.DOCUMENT_TYPE_VEHICLE_REGISTRATION) { if (bean.isUploaded() || (bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_PENDING_APPROVAL && bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_APPROVED)) { isVehicleRegistrationUploaded = true; ivVehicleRegistrationNext.setVisibility(View.GONE); ivVehicleRegistrationSaved.setVisibility(View.VISIBLE); } else { isVehicleRegistrationUploaded = false; ivVehicleRegistrationNext.setVisibility(View.VISIBLE); ivVehicleRegistrationSaved.setVisibility(View.GONE); } } else if (bean.getType() == AppConstants.DOCUMENT_TYPE_VEHICLE_PERMIT) { if (bean.isUploaded() || (bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_PENDING_APPROVAL && bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_APPROVED)) { isVehiclePermitUploaded = true; ivVehiclePermitNext.setVisibility(View.GONE); ivVehiclePermitSaved.setVisibility(View.VISIBLE); } else { isVehiclePermitUploaded = false; ivVehiclePermitNext.setVisibility(View.VISIBLE); ivVehiclePermitSaved.setVisibility(View.GONE); } } else if (bean.getType() == AppConstants.DOCUMENT_TYPE_COMMERCIAL_INSURANCE) { if (bean.isUploaded() || (bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_PENDING_APPROVAL && bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_APPROVED)) { isCommercialInsuranceUploaded = true; ivCommercialInsuranceNext.setVisibility(View.GONE); ivCommercialInsuranceSaved.setVisibility(View.VISIBLE); } else { isCommercialInsuranceUploaded = false; ivCommercialInsuranceNext.setVisibility(View.VISIBLE); ivCommercialInsuranceSaved.setVisibility(View.GONE); } } else if (bean.getType() == AppConstants.DOCUMENT_TYPE_TAX_RECEIPT) { if (bean.isUploaded() || (bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_PENDING_APPROVAL && bean.getDocumentStatus() == AppConstants.DOCUMENT_STATUS_APPROVED)) { isTaxReceiptUploaded = true; ivTaxReceiptNext.setVisibility(View.GONE); ivTaxReceiptSaved.setVisibility(View.VISIBLE); } else { isTaxReceiptUploaded = false; ivTaxReceiptNext.setVisibility(View.VISIBLE); ivTaxReceiptSaved.setVisibility(View.GONE); } } } swipeView.setRefreshing(false); setProgressScreenVisibility(false, false); } public void onDriverDocumentsDriverLicenseClick(View view) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); //mVibrator.vibrate(25); startActivityForResult(new Intent(DriverDocumentsActivity.this, DocumentUploadActivity.class) .putExtra("type", AppConstants.DOCUMENT_TYPE_DRIVER_LICENCE), REQUEST_DRIVER_LICENCE); } public void onDriverDocumentsPoliceClearanceCertificateClick(View view) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); //mVibrator.vibrate(25); startActivityForResult(new Intent(DriverDocumentsActivity.this, DocumentUploadActivity.class) .putExtra("type", AppConstants.DOCUMENT_TYPE_POLICE_CLEARANCE_CERTIFICATE), REQUEST_POLICE_CLEARANCE_CERTIFICATE); } public void onDriverDocumentsFitnessCertificateClick(View view) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); //mVibrator.vibrate(25); startActivityForResult(new Intent(DriverDocumentsActivity.this, DocumentUploadActivity.class) .putExtra("type", AppConstants.DOCUMENT_TYPE_FITNESS_CERTIFICATE), REQUEST_FITNESS_CERTIFICATE); } public void onDriverDocumentsVehicleRegistrationClick(View view) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); //mVibrator.vibrate(25); startActivityForResult(new Intent(DriverDocumentsActivity.this, DocumentUploadActivity.class) .putExtra("type", AppConstants.DOCUMENT_TYPE_VEHICLE_REGISTRATION), REQUEST_VEHICLE_REGISTRATION); } public void onDriverDocumentsVehiclePermitClick(View view) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); //mVibrator.vibrate(25); startActivityForResult(new Intent(DriverDocumentsActivity.this, DocumentUploadActivity.class) .putExtra("type", AppConstants.DOCUMENT_TYPE_VEHICLE_PERMIT), REQUEST_VEHICLE_PERMIT); } public void onDriverDocumentsCommercialInsuranceClick(View view) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); //mVibrator.vibrate(25); startActivityForResult(new Intent(DriverDocumentsActivity.this, DocumentUploadActivity.class) .putExtra("type", AppConstants.DOCUMENT_TYPE_COMMERCIAL_INSURANCE), REQUEST_COMMERCIAL_INSURANCE); } public void onDriverDocumentsTaxReceiptClick(View view) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); //mVibrator.vibrate(25); startActivityForResult(new Intent(DriverDocumentsActivity.this, DocumentUploadActivity.class) .putExtra("type", AppConstants.DOCUMENT_TYPE_TAX_RECEIPT), REQUEST_TAX_RECEIPT); } public void onDriverDocumentsSubmitClick(View view) { view.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); //mVibrator.vibrate(25); if (collectDriverDocuments()) { startActivity(new Intent(DriverDocumentsActivity.this, ProfilePhotoUploadActivity.class)); finish(); } else { Snackbar.make(coordinatorLayout, R.string.message_upload_all_the_required_document, Snackbar.LENGTH_SHORT) .setAction(R.string.btn_refresh, snackBarRefreshOnClickListener).show(); } } private boolean collectDriverDocuments() { if (!isDriverLicenceUploaded) { Snackbar.make(coordinatorLayout, R.string.message_please_upload_driver_licence, Snackbar.LENGTH_LONG) .setAction(R.string.btn_dismiss, snackBarDismissOnClickListener).show(); return false; } if (!isPoliceClearanceCertificateUploaded) { Snackbar.make(coordinatorLayout, R.string.message_please_upload_police_clearance_certificate, Snackbar.LENGTH_LONG) .setAction(R.string.btn_dismiss, snackBarDismissOnClickListener).show(); return false; } if (!isFitnessCertificateUploaded) { Snackbar.make(coordinatorLayout, R.string.message_please_upload_fitness_certificate, Snackbar.LENGTH_LONG) .setAction(R.string.btn_dismiss, snackBarDismissOnClickListener).show(); return false; } if (!isVehicleRegistrationUploaded) { Snackbar.make(coordinatorLayout, R.string.message_please_upload_vehicle_registration, Snackbar.LENGTH_LONG) .setAction(R.string.btn_dismiss, snackBarDismissOnClickListener).show(); return false; } if (!isVehiclePermitUploaded) { Snackbar.make(coordinatorLayout, R.string.message_please_upload_vehicle_permit, Snackbar.LENGTH_LONG) .setAction(R.string.btn_dismiss, snackBarDismissOnClickListener).show(); return false; } if (!isCommercialInsuranceUploaded) { Snackbar.make(coordinatorLayout, R.string.message_please_upload_commercial_insurance, Snackbar.LENGTH_LONG) .setAction(R.string.btn_dismiss, snackBarDismissOnClickListener).show(); return false; } if (!isTaxReceiptUploaded) { Snackbar.make(coordinatorLayout, R.string.message_please_upload_tax_receipt, Snackbar.LENGTH_LONG) .setAction(R.string.btn_dismiss, snackBarDismissOnClickListener).show(); return false; } return true; } }
[ "moytho@hotmail.com" ]
moytho@hotmail.com
581d6cb734ba53c0bd70f2398c63710a57c1eba0
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/JacksonDatabind-110/com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers/BBC-F0-opt-20/16/com/fasterxml/jackson/databind/deser/impl/JavaUtilCollectionsDeserializers_ESTest.java
eb7f081aef85dc29d867d43a10cf06b56069ce47
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
8,104
java
/* * This file was automatically generated by EvoSuite * Fri Oct 22 02:47:36 GMT 2021 */ package com.fasterxml.jackson.databind.deser.impl; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.runtime.EvoAssertions.*; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.Module; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectReader; import com.fasterxml.jackson.databind.deser.BeanDeserializerFactory; import com.fasterxml.jackson.databind.deser.DefaultDeserializationContext; import com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.node.TextNode; import com.fasterxml.jackson.databind.ser.DefaultSerializerProvider; import com.fasterxml.jackson.databind.type.MapLikeType; import com.fasterxml.jackson.databind.type.ResolvedRecursiveType; import com.fasterxml.jackson.databind.type.TypeBindings; import com.fasterxml.jackson.databind.type.TypeFactory; import java.sql.SQLClientInfoException; import java.util.concurrent.atomic.AtomicReference; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class JavaUtilCollectionsDeserializers_ESTest extends JavaUtilCollectionsDeserializers_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! // try { JavaUtilCollectionsDeserializers.findForMap(defaultDeserializationContext_Impl0, (JavaType) null); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers", e); // } } @Test(timeout = 4000) public void test1() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); JsonFactory jsonFactory0 = new JsonFactory(); DefaultSerializerProvider.Impl defaultSerializerProvider_Impl0 = new DefaultSerializerProvider.Impl(); ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0, defaultSerializerProvider_Impl0, defaultDeserializationContext_Impl0); Class<SimpleModule> class0 = SimpleModule.class; ObjectReader objectReader0 = objectMapper0.readerFor(class0); TypeFactory typeFactory0 = objectReader0.getTypeFactory(); Class<Module> class1 = Module.class; MapLikeType mapLikeType0 = typeFactory0.constructMapLikeType(class0, class1, class0); SQLClientInfoException sQLClientInfoException0 = new SQLClientInfoException(); AtomicReference<Throwable> atomicReference0 = new AtomicReference<Throwable>(sQLClientInfoException0); defaultDeserializationContext_Impl0.hasValueDeserializerFor(mapLikeType0, atomicReference0); // Undeclared exception! // try { JavaUtilCollectionsDeserializers.findForMap(defaultDeserializationContext_Impl0, (JavaType) null); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers", e); // } } @Test(timeout = 4000) public void test2() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); // Undeclared exception! // try { JavaUtilCollectionsDeserializers.findForCollection(defaultDeserializationContext_Impl0, (JavaType) null); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers", e); // } } @Test(timeout = 4000) public void test3() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); JsonFactory jsonFactory0 = new JsonFactory(); DefaultSerializerProvider.Impl defaultSerializerProvider_Impl0 = new DefaultSerializerProvider.Impl(); ObjectMapper objectMapper0 = new ObjectMapper(jsonFactory0, defaultSerializerProvider_Impl0, defaultDeserializationContext_Impl0); Class<SimpleModule> class0 = SimpleModule.class; ObjectReader objectReader0 = objectMapper0.readerFor(class0); TypeFactory typeFactory0 = objectReader0.getTypeFactory(); Class<Module> class1 = Module.class; MapLikeType mapLikeType0 = typeFactory0.constructMapLikeType(class0, class1, class0); SQLClientInfoException sQLClientInfoException0 = new SQLClientInfoException(); AtomicReference<Throwable> atomicReference0 = new AtomicReference<Throwable>(sQLClientInfoException0); defaultDeserializationContext_Impl0.hasValueDeserializerFor(mapLikeType0, atomicReference0); // Undeclared exception! // try { JavaUtilCollectionsDeserializers.findForCollection(defaultDeserializationContext_Impl0, (JavaType) null); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("com.fasterxml.jackson.databind.deser.impl.JavaUtilCollectionsDeserializers", e); // } } @Test(timeout = 4000) public void test4() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); Class<TextNode> class0 = TextNode.class; TypeBindings typeBindings0 = TypeBindings.emptyBindings(); ResolvedRecursiveType resolvedRecursiveType0 = new ResolvedRecursiveType(class0, typeBindings0); JsonDeserializer<?> jsonDeserializer0 = JavaUtilCollectionsDeserializers.findForMap(defaultDeserializationContext_Impl0, resolvedRecursiveType0); assertNull(jsonDeserializer0); } @Test(timeout = 4000) public void test5() throws Throwable { BeanDeserializerFactory beanDeserializerFactory0 = BeanDeserializerFactory.instance; DefaultDeserializationContext.Impl defaultDeserializationContext_Impl0 = new DefaultDeserializationContext.Impl(beanDeserializerFactory0); Class<TextNode> class0 = TextNode.class; TypeBindings typeBindings0 = TypeBindings.emptyBindings(); ResolvedRecursiveType resolvedRecursiveType0 = new ResolvedRecursiveType(class0, typeBindings0); JsonDeserializer<?> jsonDeserializer0 = JavaUtilCollectionsDeserializers.findForCollection(defaultDeserializationContext_Impl0, resolvedRecursiveType0); assertNull(jsonDeserializer0); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
d84cfd6138306ae46076f144a65c41114ad1bb39
34b0056b3e6ab71e814a91382eb44d664c7d1014
/src/main/java/dbd/hackaton/mymechanic/spring/domain/Garage.java
d29f899caafd54efd865a65b77c0df81442aeecf
[]
no_license
davidalbert/vivatech-hackathon-2018
b300cd8ede56e27cb652a76aa6ddbbd0bc656676
ff7ab17eaa7dc3da6930a0f7e189f00db269f43d
refs/heads/master
2020-03-18T16:14:51.394839
2018-05-26T11:27:28
2018-05-26T11:27:28
134,955,402
0
0
null
null
null
null
UTF-8
Java
false
false
1,181
java
package dbd.hackaton.mymechanic.spring.domain; import java.util.ArrayList; import java.util.Date; import java.util.List; 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.Index; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import org.springframework.format.annotation.DateTimeFormat; @Entity //@Table( // indexes = { // @Index(columnList = "event_time"), // @Index(columnList = "average_age"), // @Index(columnList = "woman_ratio"), // @Index(columnList = "average_woman_age"), // @Index(columnList = "interesting_woman_count") // } // ) public class Garage { public static final int ATTENDING_COUNT_MINIMUM=3; public static final int CAPACITY_MINIMUM=6; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; }
[ "david.albert@prestomarket.com" ]
david.albert@prestomarket.com
e4bde8f83005c54ee4eb2c6612b608e9c5de12c2
4fe3aa0d5c6d25088cb679414431aace2d1c2ee6
/src/main/java/ch/ethz/idsc/tensor/pdf/HypergeometricDistribution.java
1597afacc46b5415599301ba1d7de88524bfd9ee
[]
no_license
shyding/tensor
8959d4a821418042ae61925b45cda2c9bf451cec
dc9b421b4f6542dd4568649c6cc989873ac4942a
refs/heads/master
2023-03-17T13:03:44.651851
2019-11-17T08:45:11
2019-11-17T08:45:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,656
java
// code by jph package ch.ethz.idsc.tensor.pdf; import ch.ethz.idsc.tensor.RationalScalar; import ch.ethz.idsc.tensor.RealScalar; import ch.ethz.idsc.tensor.Scalar; import ch.ethz.idsc.tensor.alg.Binomial; /** Quote from Mathematica: * "A hypergeometric distribution gives the distribution of the number of successes * in N draws from a population of size m_n containing n successes." * * <p>inspired by * <a href="https://reference.wolfram.com/language/ref/HypergeometricDistribution.html">HypergeometricDistribution</a> */ public class HypergeometricDistribution extends EvaluatedDiscreteDistribution implements VarianceInterface { /** see the Mathematica documentation of HypergeometricDistribution * * @param N number of draws * @param n number of successes * @param m_n population size * @return */ public static Distribution of(int N, int n, int m_n) { // (0 < N && N <= m_n && 0 <= n && n <= m_n) if (N <= 0 || m_n < N || n < 0 || m_n < n) throw new IllegalArgumentException(String.format("N=%d n=%d m_n=%d", N, n, m_n)); return new HypergeometricDistribution(N, n, m_n); } // --- private final int N; private final int n; private final int m_n; private final int m; private final Binomial binomial_n; private final Binomial binomial_m; private final Binomial binomial_m_n; private HypergeometricDistribution(int N, int n, int m_n) { this.N = N; this.n = n; this.m_n = m_n; this.m = m_n - n; binomial_n = Binomial.of(n); binomial_m = Binomial.of(m); binomial_m_n = Binomial.of(m_n); inverse_cdf_build(Math.min(N, n)); } @Override // from MeanInterface public Scalar mean() { return RealScalar.of(N).multiply(RationalScalar.of(n, m_n)); } @Override // from VarianceInterface public Scalar variance() { // ((mpn - n) n (mpn - N) N) / ((-1 + mpn) mpn^2) Scalar rd1 = RationalScalar.of(m_n - n, m_n); Scalar rd2 = RationalScalar.of(m_n - N, m_n); // ( n N) / (-1 + mpn) Scalar rd3 = RationalScalar.of(N, m_n - 1); // ( n ) Scalar rd4 = RationalScalar.of(n, 1); return rd1.multiply(rd2).multiply(rd3).multiply(rd4); } @Override // from DiscreteDistribution public int lowerBound() { return 0; } @Override // from AbstractDiscreteDistribution protected Scalar protected_p_equals(int i) { return i <= N && i <= n // ? binomial_n.over(i).multiply(binomial_m.over(N - i)).divide(binomial_m_n.over(N)) : RealScalar.ZERO; } @Override // from Object public String toString() { return String.format("%s[%d, %d, %d]", getClass().getSimpleName(), N, n, m_n); } }
[ "jan.hakenberg@gmail.com" ]
jan.hakenberg@gmail.com
979258f17111b14700fde0fc359e4da309ffbcf0
be8e617b0a5a4ab0d637b3309b4a4c2454ff0183
/src/test/java/com/eaglesakura/android/rx/ResultCollectionTest.java
140cd96370e56935ababfdfff8b56a727506bcc1
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
eaglesakura/rxandroid-support
786ed57855f124354e79b19e64c45dd28c6a2390
80f1e7ff0b0f9ef1f974b0de89a2d39c4dd6fb48
refs/heads/v2.0.x
2021-01-24T10:28:41.155721
2017-03-19T11:59:46
2017-03-19T11:59:46
52,934,386
3
1
null
2017-03-19T11:59:47
2016-03-02T04:41:49
Java
UTF-8
Java
false
false
1,020
java
package com.eaglesakura.android.rx; import org.junit.Test; import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; public class ResultCollectionTest { void stringMethod(String value) { assertEquals(value, "test"); } void intMethod(Integer value) { assertEquals(value, Integer.valueOf(123)); } void arrayMethod(List value) { assertNotNull(value); } @Test public void 特定型でputとgetができる() { ResultCollection collection = new ResultCollection().put("test").put(123); intMethod(collection.get(Integer.class)); stringMethod(collection.get(String.class)); } @Test public void 自動の型マッチが行える() { ResultCollection collection = new ResultCollection().put(new ArrayList<>()).put("test"); arrayMethod(collection.as(ArrayList.class)); stringMethod(collection.as(String.class)); } }
[ "eaglesakura@SQUALL.local" ]
eaglesakura@SQUALL.local
5d1d7edab3250d5447c2f51292e4c08a6c7877a7
2c859cb5aa801b7e92cf2a835a2535878828a63f
/IdeaProjects/MyProject/src/TestBank.java
bd82ca668fde01034abe6b2f97da67fb1481bcf5
[]
no_license
Kal009/pageObjectModel
5fd15d7ae8337211ab7321ce44672b908bfb7c17
d29da6e08bccde18a4bd60cae5b8239db22ce790
refs/heads/master
2020-03-11T15:19:32.084963
2018-04-19T15:42:35
2018-04-19T15:42:35
130,080,894
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
/** * Created by Trupesh on 20/04/2017. */ public class TestBank { public static void main(String[] args){ Bank B1 = new Bank1(); Bank B2 = new Bank2(); System.out.println(B1.rate()); System.out.println(B2.rate()); } }
[ "kal_ghinaiya@yahoo.co.in" ]
kal_ghinaiya@yahoo.co.in
75d7c66777027b444c9eb48b7f927f19dc50fa71
f22e90a3a51f3b1b9cbbc8478550d6f7853cc829
/app/src/test/java/com/zj/dp/ExampleUnitTest.java
a4fcc631751ac972bf143a51e9b41fa4b080eae3
[]
no_license
zj614android/designPattern
afeb9547cb6018b489c477c037891382568e947f
3573e23c3c5c7fca3503d0c9ee0c6e768df6a356
refs/heads/master
2021-10-20T09:19:53.975169
2019-02-27T06:41:49
2019-02-27T06:41:49
117,074,363
1
0
null
null
null
null
UTF-8
Java
false
false
387
java
package com.zj.dp; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "2807738720@qq.com" ]
2807738720@qq.com
2f57175f5094430b027d89ac24aa35db4f7225fe
fb9aadedc65478e9bff4d6b4d5a58234e0d8a088
/gui/SubmitLabelManipulationTask.java
f6edb9cd545ce84ce53e82daa5aab112ecbb39cb
[]
no_license
ctuu/ThinkingInJava
80dbfa57bb8e074fb06d00b7d6f4caa21a59b383
51d5e188fe17459631fa9a85ace6048a619c425b
refs/heads/master
2021-01-21T12:30:35.569385
2017-12-16T03:04:49
2017-12-16T03:04:49
102,073,285
0
0
null
null
null
null
UTF-8
Java
false
false
562
java
import javax.swing.*; import java.util.concurrent.*; public class SubmitLabelManipulationTask { public static void main(String[] args) throws Exception { JFrame frame = new JFrame("Hello Swing"); final JLabel label = new JLabel("A Label"); frame.add(label); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300,100); frame.setVisible(true); TimeUnit.SECONDS.sleep(1); SwingUtilities.invokeLater(new Runnable(){ public void run() { label.setText("Hey! This is Different!"); } }); } }
[ "ct.liuu@gmail.com" ]
ct.liuu@gmail.com
e851f7d1c655d5ea37a4976468b0becabc26af90
27b8f14e7afdac2f1fb762ef4c7ad3345319df4d
/Gift/Jalebi.java
c923d1c1821504301eec3c8fecfa63e60f29f511
[]
no_license
Avinash9565/NewYearGift
ca614c35162ccc1866f4db63d2a8fca14597b15b
461e2dfe0f52adfbff65eacaf3f61b0d9e36b0eb
refs/heads/master
2021-01-01T07:41:25.528606
2020-02-09T09:24:57
2020-02-09T09:24:57
239,176,393
0
0
null
2020-10-13T19:23:08
2020-02-08T17:47:08
Java
UTF-8
Java
false
false
303
java
public class Jalebi extends Desserts { float jalebi_cost; float jalebi_weight; Kazuburfi(String a,float b.float c){ super(a); this.jalebi_cost=b; this.jalebi_weight=c; } public float cost(){ float c=jalebii_cost*jalebi_weight; return c } }
[ "ponduriavinash@gmail.com" ]
ponduriavinash@gmail.com
c8d2bce2d9ea1232601753020ed04d928020907d
1f19aec2ecfd756934898cf0ad2758ee18d9eca2
/u-1/u-11/u-11-111/u-11-111-f3816.java
cc3bfd5b58576fefdfd3dcd087163cab6155412b
[]
no_license
apertureatf/perftest
f6c6e69efad59265197f43af5072aa7af8393a34
584257a0c1ada22e5486052c11395858a87b20d5
refs/heads/master
2020-06-07T17:52:51.172890
2019-06-21T18:53:01
2019-06-21T18:53:01
193,039,805
0
0
null
null
null
null
UTF-8
Java
false
false
106
java
mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117 1835596267927
[ "jenkins@khan.paloaltonetworks.local" ]
jenkins@khan.paloaltonetworks.local
b6ad5ed7d4cd8c33b27f831dd2cc611f7d0ddbc8
d9fa3d00858a3b6e08bd9995097c683a52a103d9
/java/Atena/src/main/java/com/hugo/atena/controler/enums/TipoDespesa.java
33fa87a84e9022d60e6ccfb72fe6fcc932775355
[]
no_license
hugoharoldo/remote_git
7d2f51c00347337664f61f68538d81b18e3047d2
fcb1f590258cc033dbbe5d47d60c05a8f8d3118c
refs/heads/master
2023-08-09T11:05:50.881108
2020-08-09T17:31:16
2020-08-09T17:31:16
157,298,578
0
0
null
2023-07-20T01:57:06
2018-11-13T00:55:22
Java
UTF-8
Java
false
false
2,443
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.hugo.atena.controler.enums; import com.hugo.atena.utils.HNumber; /** * * @author hugo */ public enum TipoDespesa { //Limpeza de caixa de água, manutenção no portão, coisas de manutenção SEM_INVESTIMENTO(1, "Sem investimento"), //Chamada de capital, pintura, obra COM_INVESTIMENTO(2, "Com investimento"); private int tipo; private String descricao; private TipoDespesa(int tipo, String descricao) { this.tipo = tipo; this.descricao = descricao; } /** * @return the tipo */ public int getTipo() { return tipo; } /** * @param tipo the tipo to set */ public void setTipo(int tipo) { this.tipo = tipo; } /** * @return the descricao */ public String getDescricao() { return descricao; } /** * @param descricao the descricao to set */ public void setDescricao(String descricao) { this.descricao = descricao; } public String toString() { return getDescricao(); } public static TipoDespesa get(int tipo) { if (tipo == 2) { return COM_INVESTIMENTO; } else { return SEM_INVESTIMENTO; } } public HNumber valorParticipacao(TamanhoApartamento td, double valorDespesa) throws Exception { double fator; if (null == this) { throw new Exception("Tipo de apartamento não cadastrado"); } else { switch (this) { case COM_INVESTIMENTO: if (td == TamanhoApartamento.GRANDE) { fator = 11.2975; } else { fator = 12.8998; } break; case SEM_INVESTIMENTO: if (td == TamanhoApartamento.GRANDE) { fator = 11.5241; } else { fator = 15.3911; } break; default: throw new Exception("Tipo de apartamento não cadastrado"); } } return new HNumber((fator * valorDespesa) / 100); } }
[ "hugoharoldo@gmail.com" ]
hugoharoldo@gmail.com
082eede4cf6b7be9e697c855edb10895693f233c
256355d624d56633a21dc9cb64758ee5545cbd7d
/src/main/java/Parser.java
640d0776b6b9c71a4563299304b76a72f4713cb5
[]
no_license
Zdwasserman/HurtLocker
96fdf09c26830deb3c8096dffb4021e9d8977cf5
d6763857a96a0dd220da99381e1449de7baeffaa
refs/heads/master
2021-01-11T04:39:52.960388
2016-10-19T19:21:16
2016-10-19T19:21:16
71,144,932
0
0
null
2016-10-17T14:06:04
2016-10-17T14:06:04
null
UTF-8
Java
false
false
7,376
java
import java.security.Key; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; /** * Created by zacharywasserman on 10/17/16. */ public class Parser { ArrayList<Food> foods = new ArrayList(); ArrayList<ArrayList<String>> listOfPrices = new ArrayList(); HashMap<String, Integer> milkPrices = new LinkedHashMap<String, Integer>(); HashMap<String, Integer> breadPrices = new HashMap<String, Integer>(); HashMap<String, Integer> cookiePrices = new HashMap<String, Integer>(); HashMap<String, Integer> applePrices = new HashMap<String, Integer>(); HashMap<String, Integer> allFood = new HashMap<String, Integer>(); int errors = 0; int counter = 0; public String[] splitRaw(String str) { String[] data = str.split("##"); return data; } public ArrayList<String[]> splitData(String[] data) { ArrayList foodlist = new ArrayList(); for(String str: data) { String[] sliced2 = str.split(";|:|,|@|^|%|!|/*/"); foodlist.add(sliced2); } return foodlist; } public void createFood(ArrayList<String[]> foodlist) { for (String[] foodData : foodlist) { Food food = new Food(); food.name = foodData[1]; food.price = foodData[3]; food.type = foodData[5]; food.experation = foodData[7]; if(food.name.equals("")||food.price.equals("")||food.type.equals("")||food.experation.equals("")) { errors++; } foods.add(food); } } public void fixNames(ArrayList<Food> foods) { for(Food food : foods) { if(food.getName().matches("(?i)(m[a-z][a-z]k)")) { food.setName("Milk"); } if(food.getName().matches("(?i)(ap[a-z][a-z][a-z]s)")) { food.setName("Apples"); } if(food.getName().matches("(?i)(c[o0][o0]kies)")) { food.setName("Cookies"); } if(food.getName().matches("(?i)(b[a-z][a-z][a-z]d)")) { food.setName("Bread"); } } } public void combineFoodList(ArrayList<Food> foods) { for (Food food : foods) { if(food.getName().equals("Milk") && !food.getPrice().equals("")) { if(allFood.containsKey(food.getName())) { allFood.put(food.getName(), allFood.get(food.getName())+1); } else { allFood.put(food.getName(), 1); } } if(food.getName().equals("Cookies")) { if(allFood.containsKey(food.getName())) { allFood.put(food.getName(), allFood.get(food.getName())+1); } else { allFood.put(food.getName(), 1); } } if(food.getName().equals("Apples")) { if(allFood.containsKey(food.getName())) { allFood.put(food.getName(), allFood.get(food.getName())+1); } else { allFood.put(food.getName(), 1); } } if(food.getName().equals("Bread")) { if(allFood.containsKey(food.getName())) { allFood.put(food.getName(), allFood.get(food.getName())+1); } else { allFood.put(food.getName(), 1); } } } } public void getPrices(ArrayList<Food> foods) { for(Food food: foods) { if(food.getName().equals("Milk") && !food.getPrice().equals("")) { if(milkPrices.containsKey(food.getPrice())) { milkPrices.put(food.getPrice(), milkPrices.get(food.getPrice())+1); } else { milkPrices.put(food.getPrice(), 1); } } if(food.getName().equals("Cookies")) { if(cookiePrices.containsKey(food.getPrice())) { cookiePrices.put(food.getPrice(), cookiePrices.get(food.getPrice())+1); } else { cookiePrices.put(food.getPrice(), 1); } } if(food.getName().equals("Apples")) { if(applePrices.containsKey(food.getPrice())) { applePrices.put(food.getPrice(), applePrices.get(food.getPrice())+1); } else { applePrices.put(food.getPrice(), 1); } } if(food.getName().equals("Bread")) { if(breadPrices.containsKey(food.getPrice())) { breadPrices.put(food.getPrice(), breadPrices.get(food.getPrice())+1); } else { breadPrices.put(food.getPrice(), 1); } } } } public void displayData() { System.out.println("name: Milk seen: " +allFood.get("Milk")+ " times"); System.out.println("============= ============= "); for(String price: milkPrices.keySet()) { System.out.println("Price: "+price+" seen: "+ milkPrices.get(price)+ " times"); System.out.println("------------- -------------"); } System.out.println(""); System.out.println("name: Bread seen: " +allFood.get("Bread")+ " times"); System.out.println("============= ============= "); for(String price: breadPrices.keySet()) { System.out.println("Price: "+price+" seen: "+ breadPrices.get(price)+" times"); System.out.println("------------- -------------"); } this.counter = 0; System.out.println(""); System.out.println("name: Cookies seen: " +allFood.get("Cookies")+" times"); System.out.println("============= ============= "); for(String price: cookiePrices.keySet()) { System.out.println("Price: "+price+" seen: "+ cookiePrices.get(price)+" times"); System.out.println("------------- -------------"); } System.out.println(""); System.out.println("name: Apples seen: " +allFood.get("Apples")+" times"); System.out.println("============= ============= "); for(String price: applePrices.keySet()) { System.out.println("Price: "+price+" seen: "+ applePrices.get(price)+" times"); System.out.println("------------- -------------"); } System.out.println(""); System.out.println("Errors seen: "+errors+" times"); } }
[ "Zdwasserman@gmail.com" ]
Zdwasserman@gmail.com
e0aad832a9c36565c5f420e9609d8efd26fb903f
c28dee75feaedd7101b0dd31e289ffca9cbf65ea
/src/main/java/com/blogspot/jesfre/recipes/services/ImageService.java
018b4933e932fa93ad30ed37cdf3ecd299bec056
[ "Unlicense" ]
permissive
jesfre/recipes
c3d074abe94a19480f676ebd66e73d2f03cb29e9
ba195769cd6c0869024561ef33dc2b07ff8e0aac
refs/heads/master
2020-04-25T02:26:57.485060
2019-05-22T10:09:04
2019-05-22T10:09:04
172,438,241
0
0
null
null
null
null
UTF-8
Java
false
false
198
java
package com.blogspot.jesfre.recipes.services; import org.springframework.web.multipart.MultipartFile; public interface ImageService { void saveImageFile(Long recipeId, MultipartFile file); }
[ "jesfre.gy@gmail.com" ]
jesfre.gy@gmail.com
24498246b6510fdc7f8956d1db03b94ae1011c73
54aab5a0bd09d9e2860125a8935cdf301ec00dbb
/src/main/java/DataCleaner.java
1048c45966726bad009620d8370f7c25af639bb9
[]
no_license
ZhouDavid/Basis-of-Big-Data
728db5aa8562d2afc55b7126c6d8a45e815aae71
f780632a035213b20b0e3d3b11847057a0e4a2ce
refs/heads/master
2021-01-12T01:02:59.725409
2017-01-08T14:36:55
2017-01-08T14:36:55
78,337,433
0
0
null
null
null
null
UTF-8
Java
false
false
4,619
java
import com.jcraft.jsch.ConfigRepository; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.lib.MultipleTextOutputFormat; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; import java.io.*; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Vector; /** * Created by Administrator on 2017/1/4. */ public class DataCleaner { public String InfoPath = "E:\\BusPredict\\raw_data\\apInfo"; public static Map<String,BusInfoRecord> busInfoRecordMap = new HashMap<String, BusInfoRecord>(); public void ReadFile()throws Exception{ /* 将busInfo文件中的车辆信息读入busInforRecords中 */ File file = new File(InfoPath); FileInputStream fs = new FileInputStream(file); InputStreamReader reader = new InputStreamReader(fs,"utf8"); BufferedReader bufferedReader = new BufferedReader(reader); String line; while((line = bufferedReader.readLine())!=null){ String attrs[] = line.split(",",-1); BusInfoRecord bir = new BusInfoRecord(attrs); busInfoRecordMap.put(bir.md5_mac,bir); } // for(int i = 0;i<busInfoRecords.size();i++){ // System.err.println(busInfoRecords.get(i).md5_mac); // } } public static class RawRecordMapper extends Mapper<Object,Text,Text,Text>{ public String parseTime(String time){ String[] ttime = new String[6]; ttime[0] = time.substring(0,4); ttime[1] = time.substring(4,6); ttime[2] = time.substring(6,8); ttime[3] = time.substring(8,10); ttime[4] = time.substring(10,12); ttime[5]= time.substring(12,14); String result = ""; for(int i = 0;i<ttime.length;i++){ result+=ttime[i]+","; } return result; } public String busNameSearch(String mac){ if(busInfoRecordMap.containsKey(mac)){ return busInfoRecordMap.get(mac).busName; } else return null; } public void map(Object key,Text value,Context context)throws IOException,InterruptedException{ String line = new String(value.getBytes(),0,value.getLength(),"utf8"); if(line.length()>10){ String[] attrs = line.split(",",-1); String md5_mac = attrs[2]; String busName = busNameSearch(md5_mac); if(busName!=null){ if(busName.length()>0) { String rest = md5_mac + "," + parseTime(attrs[0]) + attrs[4] + "," + attrs[5] + "," + attrs[6] + "," + attrs[7] + "," + attrs[8]; Text txt = new Text(rest); context.write(new Text(busName), txt); } } } } } public static class RawRecordReducer extends Reducer<Text,Text,Text,Text>{ @Override public void reduce(Text key, Iterable<Text>values,Context context)throws IOException,InterruptedException{ for(Text value:values){ context.write(key,value); } } } public static void main(String args[])throws Exception{ DataCleaner cleaner = new DataCleaner(); cleaner.ReadFile();//info信息读入 //Mapreduce 配置准备 System.setProperty("hadoop.home.dir", "D:\\hadoop-3.0.0-alpha1"); Configuration conf = new Configuration(); conf.set("mapred.textoutputformat.ignoreseparator","true"); conf.set("mapred.textoutputformat.separator",","); Job job = new Job(conf,"cleanData"); job.setJarByClass(DataCleaner.class); job.setMapperClass(DataCleaner.RawRecordMapper.class); // job.setCombinerClass(BusPredict.Reduce.class); job.setReducerClass(DataCleaner.RawRecordReducer.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); FileInputFormat.addInputPath(job,new Path(args[0])); FileOutputFormat.setOutputPath(job, new Path(args[1])); System.exit(job.waitForCompletion(true) ? 0 : 1); } }
[ "zjybox@126.com" ]
zjybox@126.com
ece330388ea4a7315be7f871f8cd8d566b1cbc42
772b3b3a9e0c6a2f1981f5871448849e1a5de23c
/app/src/main/java/ulyne/com/reservedforfanwei/MainActivity.java
85d58ac573b7f7b29392791f0e02674656cb592a
[]
no_license
fanerwei222/Android
20cbfe45d0a800703b054095fa03aea73d65eb64
f41af239bedc1cdf6070d727fef4a6d27a6fe159
refs/heads/master
2021-01-19T10:00:23.315633
2017-04-11T08:05:59
2017-04-11T08:05:59
87,809,110
1
0
null
null
null
null
UTF-8
Java
false
false
340
java
package ulyne.com.reservedforfanwei; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "fanerwei222@163.com" ]
fanerwei222@163.com