blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
b186802a17f3d0715a343bbe4c75cfb600e0c5c4
962674d896a41cde90302e0f1ccf6a21d07ef66c
/src/Assignments/TreeNode.java
d0ea913e15941d5f8727eb8ef8d110997cbf3850
[]
no_license
xiao81/CodingPractice
1ddb26a539098455f733eb3211c31e6481050a7c
35ed322e30f865ad6004047ffb9254181b6cde69
refs/heads/master
2021-07-11T00:43:35.675714
2017-10-08T20:05:55
2017-10-08T20:05:55
89,489,142
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
package Assignments; public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } }
4757a971fdf1ea51c22a48c757bb1cb370311521
7fede2399201defba94c10ac5d6dc90a4eb8c323
/src/lc1/CGH/Locreader.java
333df3cca5b177f950745af6e7beb39ffb6fb6a2
[]
no_license
lachlancoin/polyhap2
ad17fe4e671779cb22db6eb121260372d4da1f56
49fbcb46ec4a8b4812a12cd7ce18de35ecdb8698
refs/heads/master
2020-04-02T08:51:40.006520
2018-10-23T05:13:15
2018-10-23T05:13:15
154,264,540
0
0
null
null
null
null
UTF-8
Java
false
false
21,097
java
/* */ package lc1.CGH; /* */ /* */ import com.braju.format.Format; /* */ import java.io.PrintWriter; /* */ import java.util.ArrayList; /* */ import java.util.Arrays; /* */ import java.util.Collection; /* */ import java.util.Collections; /* */ import java.util.HashMap; /* */ import java.util.Iterator; /* */ import java.util.List; /* */ import java.util.Map; /* */ import java.util.Set; /* */ import java.util.SortedSet; /* */ import java.util.TreeSet; /* */ import java.util.logging.Logger; /* */ import lc1.dp.data.collection.LikelihoodDataCollection; /* */ /* */ /* */ public class Locreader /* */ { /* */ public final long lengthLimit; /* */ LikelihoodDataCollection dc; /* */ final String name; /* 25 */ public SortedSet<String> keys = new TreeSet(); /* */ /* */ public SortedSet<Integer> probes; /* 28 */ private Map<String, List<Location>> deletions = new HashMap(); /* 29 */ private Map<String, List<Location>> amplifications = new HashMap(); /* */ /* 31 */ public void sort() { for (Iterator<List<Location>> it = this.deletions.values().iterator(); it.hasNext();) { /* 32 */ Collections.sort((List)it.next()); /* */ } /* 34 */ for (Iterator<List<Location>> it = this.amplifications.values().iterator(); it.hasNext();) { /* 35 */ Collections.sort((List)it.next()); /* */ } /* */ } /* */ /* */ public Integer[] detected(Locreader loc1, int overlp, PrintWriter out1) /* */ { /* 41 */ out1.println("how many does " + this.name + " find of " + loc1.name + " predictions"); /* 42 */ boolean[] del = { false, true }; /* 43 */ Integer[] res = { Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0) }; /* 44 */ for (int i = 0; i < del.length; i++) { /* 45 */ for (Iterator<String> it = loc1.keys.iterator(); it.hasNext();) { /* 46 */ detected(loc1, (String)it.next(), del[i], res, overlp, out1); /* */ } /* */ } /* 49 */ return res; /* */ } /* */ /* 52 */ public void printDetails(PrintWriter out1, Location loc, String name) { if (this.dc != null) { /* 53 */ if (name.equals("")) {} /* */ /* */ /* */ /* */ /* */ /* 59 */ out1.println(this.name); /* 60 */ List<Double> l = new ArrayList(); /* 61 */ List<Integer> l1 = new ArrayList(); /* 62 */ List<Integer> l2 = new ArrayList(); /* 63 */ List<Double> b = new ArrayList(); /* 64 */ double[] max = this.dc.getR(loc, l, l1, l2, b, name); /* 65 */ if (max == null) return; /* 66 */ StringBuffer sb = new StringBuffer(); /* 67 */ StringBuffer sb1 = new StringBuffer(); /* 68 */ for (int i = 0; i < l.size(); i++) { /* 69 */ sb.append("%7.3f "); /* */ } /* 71 */ for (int i = 0; i < l.size(); i++) { /* 72 */ sb1.append("%7i "); /* */ } /* 74 */ out1.println("max " + max[0] + " " + max[1]); /* 75 */ out1.println(Format.sprintf(sb.toString(), l.toArray())); /* 76 */ if (b.size() > 0) out1.println(Format.sprintf(sb.toString(), b.toArray())); /* 77 */ out1.println(Format.sprintf(sb1.toString(), l1.toArray())); /* 78 */ out1.println(Format.sprintf(sb1.toString(), l2.toArray())); /* */ } /* */ } /* */ /* */ public void detected(Locreader loc1, String key, boolean del, Integer[] res, int overlapNoProbes, PrintWriter out1) { /* 83 */ List<Location> map1 = del ? (List)this.deletions.get(key) : (List)this.amplifications.get(key); /* 84 */ List<Location> dectable = new ArrayList(); /* 85 */ SortedSet<Integer> detectableProbes = new TreeSet(); /* 86 */ SortedSet<Integer> detectedProbes = new TreeSet(); /* 87 */ detectable(loc1, key, del, dectable, detectableProbes, overlapNoProbes); /* 88 */ List<Location> detected = new ArrayList(); /* 89 */ for (int i = 0; i < dectable.size(); i++) { /* 90 */ Location loc = (Location)dectable.get(i); /* 91 */ if (map1 != null) { /* 92 */ for (int j = 0; j < map1.size(); j++) { /* 93 */ Location loc_1 = (Location)map1.get(j); /* */ /* 95 */ if (loc.overlaps(loc_1) >= 0.0D) { /* 96 */ detectedProbes.addAll(noPosIn(loc.getOverlap(loc_1))); /* 97 */ detected.add(loc); /* 98 */ out1.println("detected " + loc + " " + loc_1); /* 99 */ printDetails(out1, loc, loc.name()); /* 100 */ loc1.printDetails(out1, loc, loc.name()); /* 101 */ break; /* */ } /* */ } /* */ } /* */ /* 106 */ out1.println("not detected " + loc); /* 107 */ printDetails(out1, loc, loc.name()); /* 108 */ loc1.printDetails(out1, loc, loc.name()); /* */ } /* */ /* 111 */ int tmp312_311 = 0; Integer[] tmp312_309 = res;tmp312_309[tmp312_311] = Integer.valueOf(tmp312_309[tmp312_311].intValue() + detected.size()); int /* 112 */ tmp332_331 = 1; Integer[] tmp332_329 = res;tmp332_329[tmp332_331] = Integer.valueOf(tmp332_329[tmp332_331].intValue() + dectable.size()); int /* 113 */ tmp352_351 = 2; Integer[] tmp352_349 = res;tmp352_349[tmp352_351] = Integer.valueOf(tmp352_349[tmp352_351].intValue() + detectedProbes.size()); int /* 114 */ tmp372_371 = 3; Integer[] tmp372_369 = res;tmp372_369[tmp372_371] = Integer.valueOf(tmp372_369[tmp372_371].intValue() + detectableProbes.size()); /* */ /* */ /* */ /* 118 */ out1.flush(); /* */ } /* */ /* */ /* */ /* */ public void detectable(Locreader loc1, String key, boolean del, List<Location> detecable, SortedSet<Integer> detectableProbes, int overlapNoProbes) /* */ { /* 125 */ List<Location> map2 = del ? (List)loc1.deletions.get(key) : (List)loc1.amplifications.get(key); /* 126 */ if (map2 == null) return; /* 127 */ for (int i = 0; i < map2.size(); i++) { /* 128 */ Location loc = (Location)map2.get(i); /* 129 */ SortedSet<Integer> noPos = noPosIn((Location)map2.get(i)); /* 130 */ if ((noPos != null) && (noPos.size() >= overlapNoProbes)) { /* 131 */ detecable.add(loc); /* 132 */ detectableProbes.addAll(noPos); /* */ } /* */ } /* */ } /* */ /* */ public SortedSet<Integer> noPosIn(Location loc) { /* 138 */ SortedSet<Integer> tail = this.probes.tailSet(Integer.valueOf((int)loc.min)); /* 139 */ if (tail == null) return null; /* 140 */ return tail.headSet(Integer.valueOf((int)loc.max + 1)); /* */ } /* */ /* */ public int number() { /* 144 */ int num = 0; /* 145 */ for (Iterator<String> it = this.keys.iterator(); it.hasNext();) { /* 146 */ num += number((String)it.next()); /* */ } /* 148 */ return num; /* */ } /* */ /* */ public int number(String st) { /* 152 */ List<Location> loc = (List)this.deletions.get(st); /* 153 */ List<Location> loc2 = (List)this.amplifications.get(st); /* 154 */ int num = loc == null ? 0 : loc.size(); /* 155 */ num += (loc2 == null ? 0 : loc2.size()); /* 156 */ return num; /* */ } /* */ /* 159 */ public int number(String st, int noCop) { List<Location> loc = noCop == 0 ? (List)this.deletions.get(st) : (List)this.amplifications.get(st); /* 160 */ return loc == null ? 0 : loc.size(); /* */ } /* */ /* */ public long totalSize(String key) { /* 164 */ long size = 0L; /* 165 */ for (Iterator<Location> it = iterator(key); it.hasNext();) { /* 166 */ size += ((Location)it.next()).size(); /* */ } /* 168 */ return size; /* */ } /* */ /* 171 */ public long totalSize(String key, int nocop) { long size = 0L; /* 172 */ for (Iterator<Location> it = iterator(key, nocop); it.hasNext();) { /* 173 */ size += ((Location)it.next()).size(); /* */ } /* 175 */ return size; /* */ } /* */ /* 178 */ public long[] getTotal() { long[] res = new long[2]; /* 179 */ for (Iterator<Location> it = iterator(); it.hasNext();) { /* 180 */ Location loc = (Location)it.next(); /* 181 */ if (loc.noCop() == 0) res[0] += loc.max - loc.min; else /* 182 */ res[1] += loc.max - loc.min; /* */ } /* 184 */ return res; /* */ } /* */ /* 187 */ public Location getFirst(String name) { Location loc1 = getFirst(0, name); /* 188 */ Location loc2 = getFirst(2, name); /* 189 */ if (loc1 == null) return loc2; /* 190 */ if (loc2 == null) return loc1; /* 191 */ return loc1.compareTo(loc2) < 0 ? loc1 : loc2; /* */ } /* */ /* 194 */ public Location getFirst() { SortedSet<Location> l = new TreeSet(); /* 195 */ for (Iterator<String> it = this.keys.iterator(); it.hasNext();) { /* 196 */ Location loc = getFirst((String)it.next()); /* 197 */ if (loc != null) l.add(loc); /* */ } /* 199 */ return (Location)l.first(); /* */ } /* */ /* 202 */ public Location getLast() { SortedSet<Location> l = new TreeSet(); /* 203 */ for (Iterator<String> it = this.keys.iterator(); it.hasNext();) { /* 204 */ Location loc = getLast((String)it.next()); /* 205 */ if (loc != null) l.add(loc); /* */ } /* 207 */ return (Location)l.last(); /* */ } /* */ /* 210 */ public Location getLast(String name) { Location loc1 = getLast(0, name); /* 211 */ Location loc2 = getLast(2, name); /* 212 */ if (loc1 == null) return loc2; /* 213 */ if (loc2 == null) return loc1; /* 214 */ return loc1.compareTo(loc2) > 0 ? loc1 : loc2; /* */ } /* */ /* */ public Location getFirst(int noCop, String nm) { /* 218 */ if (noCop == 0) return ((List)this.deletions.get(nm)).size() > 0 ? (Location)((List)this.deletions.get(nm)).get(0) : null; /* 219 */ return ((List)this.amplifications.get(nm)).size() > 0 ? (Location)((List)this.amplifications.get(nm)).get(0) : null; /* */ } /* */ /* 222 */ public Location getLast(int noCop, String name) { if (noCop == 0) return ((List)this.deletions.get(name)).size() > 0 ? (Location)((List)this.deletions.get(name)).get(((List)this.deletions.get(name)).size() - 1) : null; /* 223 */ return ((List)this.amplifications.get(name)).size() > 0 ? (Location)((List)this.amplifications.get(name)).get(((List)this.amplifications.get(name)).size() - 1) : null; /* */ } /* */ /* 226 */ public void addAll(Locreader loc1) { for (Iterator<Location> it = loc1.iterator(); it.hasNext();) /* 227 */ add(new Location((Location)it.next())); /* */ } /* */ /* */ public void addAll(Iterator<Location> it) { /* 231 */ while (it.hasNext()) /* 232 */ add((Location)it.next()); /* */ } /* */ /* */ public Locreader(long lengthLim, String name) { /* 236 */ this.lengthLimit = lengthLim; /* 237 */ this.name = name; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ int getMax() /* */ { /* 249 */ return (int)getLast().max; /* */ } /* */ /* */ /* */ /* 254 */ int getMin() { return (int)getFirst().min; } /* */ /* */ void printPlotCode(PrintWriter pw, int i) { /* 257 */ int maxo = getMax(); /* 258 */ int mino = getMin(); /* */ /* 260 */ Iterator<Location> it = iterator(); /* 261 */ if (it.hasNext()) { /* 262 */ ((Location)it.next()).plotCode(pw, i == 0, mino, maxo, i); /* 263 */ while (it.hasNext()) { /* 264 */ ((Location)it.next()).plotCode(pw, false, 0, maxo, i); /* */ } /* */ } /* */ } /* */ /* */ public void merge(double frac) /* */ { /* 271 */ Logger.global.info("merging "); /* */ /* 273 */ for (Iterator<String> it = this.keys.iterator(); it.hasNext();) { /* 274 */ String nm = (String)it.next(); /* 275 */ merge(0, nm, frac); /* 276 */ merge(2, nm, frac); /* */ } /* 278 */ Logger.global.info("finished merging "); /* */ } /* */ /* */ public void mergeNames() /* */ { /* 283 */ int[] ind = { 0, 2 }; /* 284 */ for (int j = 0; j < ind.length; j++) { /* 285 */ int i = ind[j]; /* 286 */ Map<String, List<Location>> m = i == 2 ? this.amplifications : this.deletions; /* 287 */ List<Location> list = new ArrayList(); /* */ /* 289 */ for (Iterator<String> it = m.keySet().iterator(); it.hasNext();) { /* 290 */ String key = (String)it.next(); /* 291 */ List<Location> loc = (List)m.get(key); /* 292 */ for (Iterator<Location> it1 = loc.iterator(); it1.hasNext();) { /* 293 */ Location loc1 = (Location)it1.next(); /* 294 */ loc1.setName(""); /* 295 */ list.add(loc1); /* 296 */ it1.remove(); /* */ } /* 298 */ if (loc.size() == 0) { it.remove(); /* */ } /* */ } /* */ /* 302 */ m.put("", list); /* 303 */ Collections.sort(list); /* */ } /* 305 */ this.keys.clear(); /* 306 */ this.keys.add(""); /* */ } /* */ /* */ public void merge(int noCop, String name, double frac) { /* 310 */ List<Location> ss = noCop == 0 ? (List)this.deletions.get(name) : (List)this.amplifications.get(name); /* 311 */ if (ss.size() == 0) return; /* 312 */ Location loc = (Location)ss.get(0); /* 313 */ long st = -2147483648L; /* 314 */ while (loc != null) { /* 315 */ if (loc.min < st) throw new RuntimeException("!!"); /* 316 */ st = loc.min; /* */ /* 318 */ Location nxt = growRight(loc, name, frac); /* 319 */ loc = nxt; /* */ } /* */ } /* */ /* */ public void removeWithObsLessThan(int thresh) /* */ { /* 325 */ for (Iterator<Location> it = iterator(); it.hasNext();) { /* 326 */ if (((Location)it.next()).noObs.size() < thresh) it.remove(); /* */ } /* */ } /* */ /* */ public Location growRight(Location loc, String name, double frac) { /* 331 */ if (loc == null) throw new RuntimeException("!!"); /* 332 */ List<Location> abs = loc.noCop() == 0 ? (List)this.deletions.get(name) : (List)this.amplifications.get(name); /* */ /* 334 */ int index = abs.indexOf(loc); /* 335 */ Iterator<Location> it = abs.subList(index + 1, abs.size()).iterator(); /* 336 */ Location loc1 = null; /* */ /* 338 */ while (it.hasNext()) { /* 339 */ loc1 = (Location)it.next(); /* 340 */ double overl = loc.overlaps(loc1); /* 341 */ if (overl >= 0.0D) { /* 342 */ if (overl >= frac * Math.min(loc.size(), loc1.size())) /* */ { /* 344 */ loc.min = Math.min(loc.min, loc1.min); /* 345 */ loc.max = Math.max(loc.max, loc1.max); /* 346 */ loc.incrObs(loc1); /* 347 */ it.remove(); /* */ } /* */ } else /* 350 */ return (Location)abs.get(index + 1); /* */ } /* 352 */ return null; /* */ } /* */ /* */ /* */ public void add(Location loc) /* */ { /* 358 */ if (loc.size() > this.lengthLimit) /* */ { /* */ /* 361 */ throw new RuntimeException(loc); /* */ } /* 363 */ this.keys.add(loc.name()); /* 364 */ Map<String, List<Location>> m1 = loc.noCop() == 0 ? this.deletions : this.amplifications; /* 365 */ if (!m1.containsKey(loc.name())) { /* 366 */ this.deletions.put(loc.name(), new ArrayList()); /* 367 */ this.amplifications.put(loc.name(), new ArrayList()); /* */ } /* 369 */ List<Location> abs = (List)m1.get(loc.name()); /* */ /* 371 */ abs.add(loc); /* */ } /* */ /* */ public Iterator<Location> iterator() /* */ { /* 376 */ final Iterator<String> it = this.keys.iterator(); /* 377 */ new Iterator() /* */ { /* */ Iterator<Location> current; /* */ /* */ Iterator<Location> prev; /* */ /* */ private void getNextIt() /* */ { /* 385 */ while ((it.hasNext()) && ((this.current == null) || (!this.current.hasNext()))) /* 386 */ this.current = Locreader.this.iterator((String)it.next()); /* */ } /* */ /* */ public boolean hasNext() { /* 390 */ return (this.current != null) && (this.current.hasNext()); /* */ } /* */ /* */ public Location next() { /* 394 */ Location res = (Location)this.current.next(); /* 395 */ this.prev = this.current; /* 396 */ if (!this.current.hasNext()) getNextIt(); /* 397 */ return res; /* */ } /* */ /* */ public void remove() { /* 401 */ this.prev.remove(); /* */ } /* */ }; /* */ } /* */ /* */ /* */ public Iterator<Location> iterator(String name) /* */ { /* 409 */ Collection<Location> del = (Collection)this.deletions.get(name); /* 410 */ if (del == null) del = (Collection)Arrays.asList(new Location[0]); /* 411 */ Collection<Location> ampl = (Collection)this.amplifications.get(name); /* 412 */ if (ampl == null) ampl = (Collection)Arrays.asList(new Location[0]); /* 413 */ final Iterator<Location> it1 = del.iterator(); /* 414 */ final Iterator<Location> it2 = ampl.iterator(); /* 415 */ new Iterator() { /* 416 */ boolean use1 = true; /* */ /* 418 */ public boolean hasNext() { return (it1.hasNext()) || (it2.hasNext()); } /* */ /* */ public Location next() /* */ { /* 422 */ if (!this.use1) return (Location)it2.next(); /* 423 */ if (it1.hasNext()) { return (Location)it1.next(); /* */ } /* 425 */ this.use1 = false; /* 426 */ return (Location)it2.next(); /* */ } /* */ /* */ public void remove() /* */ { /* 431 */ if (this.use1) it1.remove(); else { /* 432 */ it2.remove(); /* */ } /* */ } /* */ }; /* */ } /* */ /* 438 */ public List<Location> get(String name, int noCop) { return noCop == 0 ? (List)this.deletions.get(name) : (List)this.amplifications.get(name); } /* */ /* */ public Iterator<Location> iterator(String name, int noCop) { /* 441 */ Collection<Location> del = get(name, noCop); /* */ /* 443 */ if (del == null) return Arrays.asList(new Location[0]).iterator(); /* 444 */ return del.iterator(); /* */ } /* */ /* 447 */ public void thin(int thres) { for (Iterator<Location> it = iterator(); it.hasNext();) { /* 448 */ Location nxt = (Location)it.next(); /* 449 */ if (nxt.noObs.size() < thres) it.remove(); /* */ } /* */ } /* */ /* */ public List<Integer> getLocs() { /* 454 */ List<Integer> l = new ArrayList(); /* 455 */ for (Iterator<Location> it = iterator(); it.hasNext();) { /* 456 */ Location lo = (Location)it.next(); /* 457 */ if (lo.min != lo.max) throw new RuntimeException("!!"); /* 458 */ l.add(Integer.valueOf((int)lo.min)); /* */ } /* 460 */ return l; /* */ } /* */ /* 463 */ public Location overlaps(Location li, int thresh) { for (Iterator<Location> it = iterator(); it.hasNext();) { /* 464 */ Location loc = (Location)it.next(); /* 465 */ if (loc.overlaps(li) > thresh) return loc; /* */ } /* 467 */ return null; /* */ } /* */ /* */ /* */ public Location contains(int pos, int thresh) /* */ { /* 473 */ for (Iterator<Location> it = iterator(); it.hasNext();) { /* 474 */ Location loc = (Location)it.next(); /* 475 */ if (loc.overlaps(pos) > thresh) return loc; /* */ } /* 477 */ return null; /* */ } /* */ /* */ public void setChr(String chr) /* */ { /* 482 */ for (Iterator<Location> it = iterator(); it.hasNext();) { /* 483 */ Location loc = (Location)it.next(); /* 484 */ loc.chr = chr; /* */ } /* */ } /* */ /* */ public void restrict() /* */ { /* 490 */ for (Iterator<Location> it = iterator(); it.hasNext();) { /* 491 */ Location loc = (Location)it.next(); /* 492 */ SortedSet<Integer> ss = noPosIn(loc); /* 493 */ if (ss.size() > 0) { /* 494 */ loc.min = ((Integer)ss.first()).intValue(); /* 495 */ loc.max = ((Integer)ss.last()).intValue(); /* */ } /* */ } /* */ } /* */ } /* Location: /home/lachlan/Work/polyHap2/polyHap2.jar!/lc1/CGH/Locreader.class * Java compiler version: 5 (49.0) * JD-Core Version: 0.7.1 */
cf47ed76c0b55c17ea746b2aba4c0960d5353d02
150f9e5e3cb64682dbd07135d623f4445fc9b42c
/JavaOop/src/B12/Tuyen.java
417825b1b3720191d9a8927b112c7cff399bc209
[]
no_license
nguyenductrung001/JavaOop30
0104ca8ce74d757b0e6cb636b67d8191263cdf75
13edc1ae9cb1866bb5e8e146fa4a40bcd3dd46e5
refs/heads/main
2023-09-04T01:14:36.192066
2021-10-15T16:05:24
2021-10-15T16:05:24
413,275,009
0
0
null
null
null
null
UTF-8
Java
false
false
1,979
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 B12; import java.util.Scanner; /** * * @author Administrator */ public class Tuyen { private static int number = 100; private int maTuyen ; private String khoangCach; private String diemDung; public Tuyen() { super(); this.maTuyen = number++; } public Tuyen(int maTuyen, String khoangCach, String diemDung) { this.maTuyen = maTuyen; this.khoangCach = khoangCach; this.diemDung = diemDung; } public static int getNumber() { return number; } public static void setNumber(int number) { Tuyen.number = number; } public int getMaTuyen() { return maTuyen; } public void setMaTuyen(int maTuyen) { this.maTuyen = maTuyen; } public String getKhoangCach() { return khoangCach; } public void setKhoangCach(String khoangCach) { this.khoangCach = khoangCach; } public String getDiemDung() { return diemDung; } public void setDiemDung(String diemDung) { this.diemDung = diemDung; } @Override public String toString() { return "Tuyen{" + "maTuyen=" + maTuyen + ", khoangCach=" + khoangCach + ", diemDung=" + diemDung + '}'; } public void xemThongTinTuyen() { System.out.println("Mã Tuyến :"+maTuyen+" "+"Khoảng cách :"+khoangCach+" "+ "Điểm dừng :"+diemDung); } public String viewData() { return "Mã Tuyến :"+maTuyen+" "+"Khoảng cách :"+khoangCach+" "+ "Điểm dừng :"+diemDung; } public void nhapTuyen() { Scanner sc = new Scanner(System.in); System.out.println("Nhập Khoảng cách :"); this.khoangCach = sc.nextLine(); System.out.println("Nhập điểm dừng:"); this.diemDung = sc.nextLine(); } }
8fa0e7d4bd435856c99c81f2f05d32de0597a40d
4e04f37a378bcb6a7cc09e33c65734327a53f60e
/src/com/webjjang/notice/controller/NoticeController.java
31e11fbfb2fee1905149f6a6f44854647ab41e56
[]
no_license
KimMinSik0915/ServletProject
c139a85c8e24ef35e0ba30404d6156d3929ec15f
30eee3fe861443a83da688d199ff3eaa68d7f424
refs/heads/master
2023-03-20T07:05:03.777278
2021-03-18T08:40:32
2021-03-18T08:40:32
348,177,551
0
0
null
null
null
null
UTF-8
Java
false
false
5,326
java
package com.webjjang.notice.controller; import java.util.List; import javax.servlet.http.HttpServletRequest; import com.webjjang.main.controller.Beans; import com.webjjang.main.controller.Controller; import com.webjjang.main.controller.ExeService; import com.webjjang.notice.vo.NoticeVO; import com.webjjang.util.PageObject; import com.webjjang.util.filter.AuthorityFilter; public class NoticeController implements Controller { private final String MODULE = "notice"; private String jspInfo = null; @Override public String execute(HttpServletRequest request) throws Exception { System.out.println("NoticeController.execute() : 실행"); // 페이지 처리를 한다 PageObject pageObject = PageObject.getInstance(request); request.setAttribute("pageObject", pageObject); // URL에 맞는 처리(switch-case) switch (AuthorityFilter.url) { // 공지사항 보기 case "/" + MODULE + "/list.do" : System.out.println("notice [module} : " + MODULE); list(request, pageObject); jspInfo = MODULE + "/list"; break; case "/" + MODULE + "/view.do" : view(request); jspInfo = MODULE + "/view"; break; // 공지사항 쓰기 Form case "/" + MODULE + "/writeForm.do" : jspInfo = MODULE + "/writeForm"; break; // 공지사항 쓰기 case "/" + MODULE + "/write.do" : write(request); jspInfo = "redirect:list.do?page=1&perPageNum=" + pageObject.getPerPageNum(); break; // 공지사항 수정 Form case "/" + MODULE + "/updateForm.do" : updateForm(request); jspInfo = MODULE + "/updateForm"; break; // 공지사항 수정 case "/" + MODULE + "/update.do" : long no = update(request); jspInfo = "redirect:list.do?no=" + no + "page=1&perPageNum=" + pageObject.getPerPageNum(); break; case "/" + MODULE + "/delete.do" : delete(request); jspInfo = "redirect:list.do?page=1&perPageNum=" + pageObject.getPerPageNum(); break; default: throw new Exception("페이지 오류 404 : 존재하지 않는 페이지 입니다."); } return jspInfo; } // 공지사항 리스트 private void list(HttpServletRequest request, PageObject pageObject) throws Exception { @SuppressWarnings("unchecked") List<NoticeVO> list = (List<NoticeVO>) ExeService.execute(Beans.get(AuthorityFilter.url), pageObject); request.setAttribute("list", list); } // 공지사항 보기 private void view(HttpServletRequest request) throws Exception { // 넘어오는 데이터 : no, NOticeVO 에서 String strNo = request.getParameter("no"); long no = Long.parseLong(strNo); System.out.println("NoticeController.view() : " + no); NoticeVO vo = (NoticeVO)ExeService.execute(Beans.get(AuthorityFilter.url), no); request.setAttribute("vo", vo); } // 공지사항 수정 private void write(HttpServletRequest request) throws Exception { // 넘어오는 데이터 받아오기 String title = request.getParameter("title"); String content = request.getParameter("content"); String startDate = request.getParameter("startDate"); String endDate = request.getParameter("endDate"); // vo객체에 저장한다. NoticeVO vo = new NoticeVO(); vo.setTitle(title); vo.setContent(content); vo.setStartDate(startDate); vo.setEndDate(endDate); // vo객체 data 확인 System.out.println("/Notice/write.jsp [vo] : " + vo); // DB에 데이터 저장 : JSP(controller) - NoticeWriteService - NoticeDAO - Notice Table - INSERT ExeService.execute(Beans.get(AuthorityFilter.url), vo); } // 공지 수정 private void updateForm(HttpServletRequest request) throws Exception { NoticeVO vo = (NoticeVO)ExeService.execute(Beans.get("/notice/view.do"), Long.parseLong(request.getParameter("no"))); vo.setStartDate(vo.getStartDate().replace(".", "-")); vo.setEndDate(vo.getEndDate().replace(".", "-")); request.setAttribute("vo", vo); } private long update(HttpServletRequest request) throws Exception { long no = Long.parseLong(request.getParameter("no")); NoticeVO vo = new NoticeVO(); vo.setNo(no); vo.setTitle(request.getParameter("title")); vo.setContent(request.getParameter("content")); vo.setStartDate(request.getParameter("startDate")); vo.setEndDate(request.getParameter("endDate")); int result = (int) ExeService.execute(Beans.get(AuthorityFilter.url), vo); if(result < 1) { throw new Exception("공지 수정 오류 : 존재하지 않는 글은 수정할 수 없습니다."); } return Long.parseLong(request.getParameter("no")); } private void delete(HttpServletRequest request) throws Exception { int result = (int) ExeService.execute(Beans.get(AuthorityFilter.url), Long.parseLong(request.getParameter("no"))); if(result < 1) { throw new Exception("공지 삭제 오류 : 존재하지 않는 글은 삭제 할 수 없습니다."); } } }
[ "EZEN@DESKTOP-IPG2JCP" ]
EZEN@DESKTOP-IPG2JCP
fe9816ee86f6d76fe947f53274235ce0528f4dea
9016af752c91e6c14f488942c91a5944cb7dcb73
/javaSwing/src/javaswing/RadioButtonAndJList/JListwithListener.java
dc37a1057ba634ebf5fcd937e6a117f6336d76c4
[]
no_license
mijanur-rahman-40/all-about-JAVA
f025cbeec968dadef5d50712f1a5333776849d53
bc37e9284f64d958aaae66b767e486af83b60f4d
refs/heads/master
2023-02-10T14:39:43.752609
2021-01-13T13:51:53
2021-01-13T13:51:53
329,322,264
1
0
null
null
null
null
UTF-8
Java
false
false
1,751
java
package javaswing.RadioButtonAndJList; import java.awt.Color; import java.awt.Container; import javax.swing.JFrame; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class JListwithListener extends JFrame{ JScrollPane scroll; String[] colorsname = {"black", "blue", "red", "white","yellow", "green", "orange"}; Color[] colors = {Color.black,Color.blue,Color.red,Color.white, Color.yellow,Color.green,Color.orange }; JFrame frame; JPanel panel; JList list; JListwithListener() { Container c = this.getContentPane(); c.setLayout(null); c.setBackground(Color.green); panel = new JPanel(); list = new JList(colorsname); list.setVisibleRowCount(4); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); scroll = new JScrollPane(list); //scroll.setBounds(10,100,150,100); panel.add(scroll); panel.setBounds(3,3,377,555); panel.setBackground(Color.pink); c.add(panel); list.addListSelectionListener(new ListSelectionListener(){ @Override public void valueChanged(ListSelectionEvent e) { panel.setBackground(colors[list.getSelectedIndex()]); } }); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(0, 0, 400, 600); setTitle(" JListwithListener "); setVisible(true); } public static void main(String[] args) { JListwithListener jc = new JListwithListener(); } }
ad634a69dade43b8618829cafd30354ddb2b16ed
d5bc4cd1bee28469efb1d91af07d9fa7a571cd64
/src/main/java/com/diviso/graeshoppe/offer/service/dto/OfferDayDTO.java
4a8b8d37ab805d689855b54e00b6b2eac6caf3aa
[]
no_license
DivisoSofttech/offer
1c7f337ded055e057e93fb3b6b1861820f7e5fd5
a2aec3a16248b4dafb072a89aa967f9a599de7d9
refs/heads/master
2022-12-12T16:13:06.758853
2020-02-13T05:08:15
2020-02-13T05:08:15
201,175,392
0
2
null
2022-12-04T07:05:04
2019-08-08T04:03:04
Java
UTF-8
Java
false
false
1,381
java
package com.diviso.graeshoppe.offer.service.dto; import java.io.Serializable; import java.util.Objects; /** * A DTO for the OfferDay entity. */ public class OfferDayDTO implements Serializable { private Long id; private String day; private Long offerId; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getDay() { return day; } public void setDay(String day) { this.day = day; } public Long getOfferId() { return offerId; } public void setOfferId(Long offerId) { this.offerId = offerId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } OfferDayDTO offerDayDTO = (OfferDayDTO) o; if (offerDayDTO.getId() == null || getId() == null) { return false; } return Objects.equals(getId(), offerDayDTO.getId()); } @Override public int hashCode() { return Objects.hashCode(getId()); } @Override public String toString() { return "OfferDayDTO{" + "id=" + getId() + ", day='" + getDay() + "'" + ", offer=" + getOfferId() + "}"; } }
119e8a78fd8fe3b2a02dcb78a20a056c400b8b93
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/MATH-61b-2-25-Single_Objective_GGA-WeightedSum-BasicBlockCoverage-opt/org/apache/commons/math/distribution/PoissonDistributionImpl_ESTest_scaffolding.java
d78fd1f78747e6af4ac3395d28c6d0a1973db0ec
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
7,178
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Oct 26 22:24:02 UTC 2021 */ package org.apache.commons.math.distribution; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class PoissonDistributionImpl_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.apache.commons.math.distribution.PoissonDistributionImpl"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(PoissonDistributionImpl_ESTest_scaffolding.class.getClassLoader() , "org.apache.commons.math.random.JDKRandomGenerator", "org.apache.commons.math.exception.NumberIsTooSmallException", "org.apache.commons.math.distribution.ChiSquaredDistribution", "org.apache.commons.math.MathException", "org.apache.commons.math.exception.NonMonotonousSequenceException", "org.apache.commons.math.distribution.ContinuousDistribution", "org.apache.commons.math.distribution.WeibullDistribution", "org.apache.commons.math.util.FastMath", "org.apache.commons.math.random.RandomAdaptorTest$ConstantGenerator", "org.apache.commons.math.util.MathUtils", "org.apache.commons.math.distribution.IntegerDistribution", "org.apache.commons.math.ConvergenceException", "org.apache.commons.math.exception.NotStrictlyPositiveException", "org.apache.commons.math.random.Well19937c", "org.apache.commons.math.distribution.PoissonDistribution", "org.apache.commons.math.random.Well19937a", "org.apache.commons.math.distribution.WeibullDistributionImpl", "org.apache.commons.math.analysis.UnivariateRealFunction", "org.apache.commons.math.distribution.PascalDistribution", "org.apache.commons.math.special.Gamma$1", "org.apache.commons.math.distribution.GammaDistribution", "org.apache.commons.math.util.ContinuedFraction", "org.apache.commons.math.distribution.Distribution", "org.apache.commons.math.random.RandomGenerator", "org.apache.commons.math.exception.MathIllegalArgumentException", "org.apache.commons.math.distribution.FDistributionImpl", "org.apache.commons.math.distribution.NormalDistribution", "org.apache.commons.math.distribution.SaddlePointExpansion", "org.apache.commons.math.distribution.HypergeometricDistributionImpl", "org.apache.commons.math.exception.MathIllegalNumberException", "org.apache.commons.math.MathRuntimeException", "org.apache.commons.math.distribution.BinomialDistribution", "org.apache.commons.math.distribution.ZipfDistributionImpl", "org.apache.commons.math.MathRuntimeException$1", "org.apache.commons.math.MathRuntimeException$2", "org.apache.commons.math.MathRuntimeException$3", "org.apache.commons.math.MathRuntimeException$4", "org.apache.commons.math.random.AbstractRandomGenerator", "org.apache.commons.math.random.Well44497b", "org.apache.commons.math.MathRuntimeException$5", "org.apache.commons.math.random.Well44497a", "org.apache.commons.math.MathRuntimeException$6", "org.apache.commons.math.distribution.NormalDistributionImpl", "org.apache.commons.math.MathRuntimeException$7", "org.apache.commons.math.MathRuntimeException$8", "org.apache.commons.math.MathRuntimeException$10", "org.apache.commons.math.MathRuntimeException$9", "org.apache.commons.math.MathRuntimeException$11", "org.apache.commons.math.distribution.ExponentialDistribution", "org.apache.commons.math.distribution.GammaDistributionImpl", "org.apache.commons.math.distribution.AbstractIntegerDistribution", "org.apache.commons.math.random.RandomData", "org.apache.commons.math.distribution.HasDensity", "org.apache.commons.math.random.MersenneTwister", "org.apache.commons.math.random.AbstractWell", "org.apache.commons.math.distribution.HypergeometricDistribution", "org.apache.commons.math.special.Erf", "org.apache.commons.math.random.RandomDataImpl", "org.apache.commons.math.distribution.BetaDistributionImpl", "org.apache.commons.math.distribution.PascalDistributionImpl", "org.apache.commons.math.exception.NumberIsTooLargeException", "org.apache.commons.math.distribution.BetaDistribution", "org.apache.commons.math.distribution.CauchyDistributionImpl", "org.apache.commons.math.MaxIterationsExceededException", "org.apache.commons.math.distribution.CauchyDistribution", "org.apache.commons.math.special.Gamma", "org.apache.commons.math.distribution.FDistribution", "org.apache.commons.math.exception.util.Localizable", "org.apache.commons.math.random.Well1024a", "org.apache.commons.math.random.Well512a", "org.apache.commons.math.FunctionEvaluationException", "org.apache.commons.math.distribution.TDistribution", "org.apache.commons.math.distribution.ExponentialDistributionImpl", "org.apache.commons.math.distribution.DiscreteDistribution", "org.apache.commons.math.distribution.BinomialDistributionImpl", "org.apache.commons.math.random.TestRandomGenerator", "org.apache.commons.math.random.BitsStreamGenerator", "org.apache.commons.math.distribution.TDistributionImpl", "org.apache.commons.math.distribution.AbstractContinuousDistribution", "org.apache.commons.math.exception.util.LocalizedFormats", "org.apache.commons.math.distribution.PoissonDistributionImpl", "org.apache.commons.math.distribution.ChiSquaredDistributionImpl", "org.apache.commons.math.random.RandomAdaptor", "org.apache.commons.math.distribution.ZipfDistribution", "org.apache.commons.math.distribution.AbstractDistribution" ); } }
dbcf603937b45ad7e517cadeb5475c4f370cdcb2
83959e6624e6b3e4f3824171f115ef8de1f96848
/hsbank_cms/src/com/thinkgem/jeesite/modules/api/frame/generator/obj/API.java
0ea060523fa5e965f2e85f35d6fbf57e226795c6
[]
no_license
cash2one/ionic
6deefa2c62b644745b08f03a69db8efdd11dd9d4
be29386e5e9fdbbde66dd636c72454eed3720919
refs/heads/master
2020-05-23T22:45:09.813492
2016-11-08T03:01:04
2016-11-08T03:01:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package com.thinkgem.jeesite.modules.api.frame.generator.obj; import java.util.Map; /** * Created by 万端瑞 on 2016/5/19. */ public class API extends APIObjectNode { private String dataNodePath; public API(String dataNodePath){ this.dataNodePath = dataNodePath; } public API(Map<String,Object> api){ this.putAll(api); } public API putDataChildNode(String path, Object apiNode){ this.putNodeWithObject(dataNodePath+"."+path,apiNode); return this; } public void putDataNode(Object apiNode){ this.putNodeWithObject(dataNodePath,apiNode); } }
f448767f2b9c9a48f962cd71b256bf92ce99234c
dd7cbae4897e43dab393d06f6fffece448feab30
/PosNeg.java
8b94384e5c1ef89c46938f8a14bc711aeaa9b56e
[]
no_license
NaveenaCSE/Hello
700744c79ab33935fd99c2821b8e2981a648266e
381f1fc598b6b267c3812bb1158d3e2ceaba2cf5
refs/heads/master
2021-01-20T20:21:53.325465
2016-08-12T17:02:50
2016-08-12T17:02:50
65,081,247
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package Logical1; import java.util.Scanner; public class PosNeg { public static void main(String[] args) { Scanner s=new Scanner(System.in); int n=s.nextInt(); if(n>0) { System.out.println("Postive"); } else if(n<0) { System.out.println("Negative"); } else { System.out.println("Zero"); } } }
8c395514375d7697bd698b28253f8e6494671e2a
6f9b25e426a8a09eefe8581f3d2634cc8bffdf9e
/swing4_window_oop/PersonWindow.java
2a97d984ff9fdc924dcf7b796bd0443a18e9a2be
[]
no_license
elec139621/27.06.2021
201a0ea2255e2130e1673849df5756175f05b3a1
31bb06647e88e69eff12ad33e4869e71a2c1250d
refs/heads/main
2023-06-05T04:06:03.111855
2021-06-27T13:18:43
2021-06-27T13:18:43
380,660,629
0
0
null
null
null
null
UTF-8
Java
false
false
1,199
java
package swing4; import javax.swing.JFrame; import javax.swing.JLabel; public class PersonWindow { protected JLabel m_id_label; protected JLabel m_name_label; protected JLabel m_address_label; protected JLabel m_height_label; protected JFrame m_frame; public PersonWindow(Person p) { super(); m_frame = new JFrame(); m_frame.setLayout(null); m_frame.setSize(300, 400); m_frame.setTitle(p.m_name); m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); m_frame.setResizable(false); m_frame.setVisible(true); m_id_label = createLabel("".format("id: %d", p.getM_id()), 50); m_name_label = createLabel("".format("name: %s", p.getM_name()), 100); m_address_label = createLabel("".format("address: %s", p.getM_address()), 150); m_height_label = createLabel("".format("height: %f", p.getM_height()), 200); m_frame.add(m_id_label); m_frame.add(m_name_label); m_frame.add(m_address_label); m_frame.add(m_height_label); } private JLabel createLabel(String text, int yAxis) { JLabel temp_label = new JLabel(text, JLabel.PROPERTIES); temp_label.setBounds(50, yAxis, 150, 100); return temp_label; } }
22eaf8674d3136212fc501c05dac47e6124ea16b
0e7f18f5c03553dac7edfb02945e4083a90cd854
/target/classes/jooqgen/.../src/main/java/com/br/sp/posgresdocker/model/jooq/pg_catalog/routines/TxidCurrentSnapshot.java
98f8088ab63a44544498fd709ebc04c9d5067586
[]
no_license
brunomathidios/PostgresqlWithDocker
13604ecb5506b947a994cbb376407ab67ba7985f
6b421c5f487f381eb79007fa8ec53da32977bed1
refs/heads/master
2020-03-22T00:54:07.750044
2018-07-02T22:20:17
2018-07-02T22:20:17
139,271,591
0
0
null
null
null
null
UTF-8
Java
false
true
1,630
java
/* * This file is generated by jOOQ. */ package com.br.sp.posgresdocker.model.jooq.pg_catalog.routines; import com.br.sp.posgresdocker.model.jooq.pg_catalog.PgCatalog; import javax.annotation.Generated; import org.jooq.Parameter; import org.jooq.impl.AbstractRoutine; /** * @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using <deprecationOnUnknownTypes/> in your code generator configuration. */ @java.lang.Deprecated @Generated( value = { "http://www.jooq.org", "jOOQ version:3.11.2" }, comments = "This class is generated by jOOQ" ) @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class TxidCurrentSnapshot extends AbstractRoutine<Object> { private static final long serialVersionUID = -1688016493; /** * @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using <deprecationOnUnknownTypes/> in your code generator configuration. */ @java.lang.Deprecated public static final Parameter<Object> RETURN_VALUE = createParameter("RETURN_VALUE", org.jooq.impl.DefaultDataType.getDefaultDataType("\"pg_catalog\".\"txid_snapshot\""), false, false); /** * Create a new routine call instance */ public TxidCurrentSnapshot() { super("txid_current_snapshot", PgCatalog.PG_CATALOG, org.jooq.impl.DefaultDataType.getDefaultDataType("\"pg_catalog\".\"txid_snapshot\"")); setReturnParameter(RETURN_VALUE); } }
515ee419713ac309e070302abc665b83d6f3d47f
16c47353da26311e1b37cc8f59b6bd6e0b89b950
/extensions/hazelcast/runtime/src/main/java/org/apache/camel/quarkus/component/hazelcast/runtime/HazelcastSubstitutions.java
920a3be0dd37853aa4642a344f72b9de6fa25036
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
apache/camel-quarkus
8776c1d97941d3eceb58d889d7cbb6a2e7bfcf8e
038810b4144fd834460fb65a1e9c701590aab9d1
refs/heads/main
2023-09-01T17:54:31.555282
2023-09-01T10:24:09
2023-09-01T13:44:23
193,065,376
236
196
Apache-2.0
2023-09-14T17:29:35
2019-06-21T08:55:25
Java
UTF-8
Java
false
false
1,692
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.quarkus.component.hazelcast.runtime; import com.hazelcast.config.Config; import com.hazelcast.core.Hazelcast; import com.hazelcast.core.HazelcastInstance; import com.oracle.svm.core.annotate.Substitute; import com.oracle.svm.core.annotate.TargetClass; public class HazelcastSubstitutions { } /** * Force usage of Hazelcast client */ @TargetClass(Hazelcast.class) final class Target_Hazelcast { @Substitute public static HazelcastInstance newHazelcastInstance(Config config) { throw new UnsupportedOperationException( "Hazelcast node mode is not supported. Please use client mode."); } @Substitute public static HazelcastInstance getOrCreateHazelcastInstance(Config config) { throw new UnsupportedOperationException( "Hazelcast node mode is not supported. Please use client mode."); } }
3a74d717d804e42479414cfc91956a0835eaaaa8
916f422c8ce79f629849c422d8e656f8dee6e6af
/app/src/main/java/developers/apus/abecedario/actividades/SplashActivity.java
e638333e72aaa438b367b4376d06db33020db8ee
[]
no_license
miguelpiza93/abc
dab8603c19139382fa1f5a4bf6cb106b7b6a6976
6d45be03dfa9a06a2fcf4e83519ca0f73b797088
refs/heads/master
2021-01-22T10:50:54.750032
2017-02-20T00:44:18
2017-02-20T00:44:18
53,363,611
0
0
null
null
null
null
UTF-8
Java
false
false
1,379
java
package developers.apus.abecedario.actividades; import android.app.Activity; import android.graphics.Color; import android.graphics.PorterDuff; import android.media.MediaPlayer; import android.os.Bundle; import android.util.Log; import android.view.Window; import android.widget.ProgressBar; import android.widget.Toast; import developers.apus.abecedario.R; import developers.apus.abecedario.constantes.ImagenesId; import developers.apus.abecedario.constantes.SonidosId; import developers.apus.abecedario.utilidades.Splash; public class SplashActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_splash); try { ProgressBar p1 = (ProgressBar)findViewById(R.id.progressBarSplash); p1.getIndeterminateDrawable().setColorFilter(getResources().getColor(R.color.colorAccent), PorterDuff.Mode.SRC_IN); } catch (Exception e) { } new Thread(new Runnable() { public void run() { ImagenesId.init(); SonidosId.init(); } }).start(); int tiempo = 3000; // en milisegundos Splash.mostrarSplash(tiempo, this, MainActivity.class); } }
650efd071e3499b8c58451470a51c4ac184ed4f0
4769e4b9b92d5845fbc444c81de6d257b096e6f8
/src/com/ccic/test/ThreadTest.java
8d2a06196f0c6af33db3a9cfa2459b472698d0b8
[]
no_license
JacksonHuang2019/MyNote
02a0d2ea975574d01ddea07154943d32b5a6a291
bae81cfc66e199e2efa33ace4cdb692596f54c98
refs/heads/master
2020-08-09T17:05:36.130284
2020-04-14T04:33:31
2020-04-14T04:33:31
214,128,696
1
0
null
null
null
null
UTF-8
Java
false
false
730
java
package com.ccic.test; /** * @Author :hzs * @Date :Created in 17:55 2019/11/12 * @Description : * Modified By : * @Version : **/ public class ThreadTest extends Thread { private final static int DEFAULT_VALUE = 100; private int maxValue = 0; private String threadName = ""; public ThreadTest(String threadName) { this(threadName,DEFAULT_VALUE); } public ThreadTest(String threadName, int defaultValue) { this.maxValue = defaultValue; this.threadName = threadName; } @Override public void run(){ int i = 0; while (maxValue > i ){ i ++; System.out.println("Thread:"+threadName + " : "+i ); } } }
5000c91e9af061cb4c20dac36e248756bc1fc2ad
7a30394458e2e34e905a828c2a6e4d5eca6a9f54
/src/main/java/ml/wonwoo/zookeepermanager/converter/CreateModeConverter.java
5c106c8bb7d6f9ae0432d6c054ccd5584acc65a8
[]
no_license
wonwoo/zookeeper-manager
e67d026e959a53e55a05cd04ad044e810e0e8fad
b778eb1b342b98fd4a999ef8a64a901b828e20ac
refs/heads/master
2020-03-22T11:27:36.812879
2018-07-18T11:02:15
2018-07-18T11:02:15
139,971,997
1
0
null
null
null
null
UTF-8
Java
false
false
576
java
package ml.wonwoo.zookeepermanager.converter; import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.springframework.core.convert.converter.Converter; import org.springframework.stereotype.Component; @Component public class CreateModeConverter implements Converter<String, CreateMode> { @Override public CreateMode convert(String source) { try { return CreateMode.fromFlag(Integer.valueOf(source)); } catch (KeeperException e) { throw new IllegalArgumentException("createMode not converter", e); } } }
e48d34298cdc743900e35da9d26ce476d52e15cd
4fa232f72e8c865b80926b18bcd79ab3f6d808c9
/app/src/main/java/com/sunfusheng/gank/model/GankItem.java
f2fc2972701aa69e8b54994c7101e127bbd3c74d
[]
no_license
xinlongyang/RxGank
9b5280e269cfc270166082ac6525f04991fa7077
75685ee0226b2f2db33419d6bef8ea627b7d815b
refs/heads/master
2021-01-15T18:40:52.391903
2017-06-18T04:19:06
2017-06-18T04:19:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,615
java
package com.sunfusheng.gank.model; import android.os.Parcel; import android.os.Parcelable; import java.util.ArrayList; /** * Created by sunfusheng on 2017/1/17. */ public class GankItem implements Parcelable { public String _id; public String type; public String desc; public String who; public String url; public ArrayList<String> images; public String createdAt; public String publishedAt; public GankItem() { } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(this._id); dest.writeString(this.type); dest.writeString(this.desc); dest.writeString(this.who); dest.writeString(this.url); dest.writeStringList(this.images); dest.writeString(this.createdAt); dest.writeString(this.publishedAt); } protected GankItem(Parcel in) { this._id = in.readString(); this.type = in.readString(); this.desc = in.readString(); this.who = in.readString(); this.url = in.readString(); this.images = in.createStringArrayList(); this.createdAt = in.readString(); this.publishedAt = in.readString(); } public static final Creator<GankItem> CREATOR = new Creator<GankItem>() { @Override public GankItem createFromParcel(Parcel source) { return new GankItem(source); } @Override public GankItem[] newArray(int size) { return new GankItem[size]; } }; }
c72d3a924c8d2c4f75719257bd28d04376ac7ac5
30cd177c5c4f240e5753eb63910d4f5b648f0ac7
/app/src/main/java/com/example/lenovo/contentprovider/MapDbHelper.java
a9294e8ad79d1edf8804aa83b390ab47a64ec83c
[]
no_license
yvsriram/content-provider-sample
05574c7bf138a4ad2b56f239e4f9c07aa3893404
3fcbc74210d465af928823e462fa87ce271b24c4
refs/heads/master
2020-03-29T02:22:46.611456
2017-06-17T19:24:15
2017-06-17T19:24:15
94,644,251
0
0
null
null
null
null
UTF-8
Java
false
false
1,266
java
package com.example.lenovo.contentprovider; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; /** * Created by lenovo on 15/6/17. */ public class MapDbHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "mapDb.db"; private static final int VERSION = 1; MapDbHelper(Context context){ super(context, DATABASE_NAME, null, VERSION); } @Override public void onCreate(SQLiteDatabase db) { final String CREATE_TABLE = "CREATE TABLE " + MapDbContract.MapEntry.TABLE_NAME + " (" + MapDbContract.MapEntry._ID + " INTEGER PRIMARY KEY, " + MapDbContract.MapEntry.COLUMN_LATITUDE + " DOUBLE NOT NULL, " + MapDbContract.MapEntry.COLUMN_LONGITUDE + " DOUBLE NOT NULL, " + MapDbContract.MapEntry.COLUMN_NAME + " TEXT NOT NULL, " + MapDbContract.MapEntry.COLUMN_TYPE + " TEXT NOT NULL);"; db.execSQL(CREATE_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + MapDbContract.MapEntry.TABLE_NAME); onCreate(db); } }
3aa134f17541601b8d071df707a99f83a9734340
7c0fcd18d049b79ecbb41f7828a4f3c2e03aaf03
/Seance_groupesDAO.java
b1c1cdc72fb5ebc43e1c38bf9adaef0d481cf2af
[]
no_license
laureboulet/projetjava
a86cf8eaed929e9f76f9ef99f51010613cbad0ea
3b0c908b19c87f6e46306387cc14122c59d700b6
refs/heads/master
2022-10-02T05:54:02.970394
2020-06-07T21:52:57
2020-06-07T21:52:57
266,556,603
0
0
null
2020-06-07T21:52:59
2020-05-24T14:21:13
Java
UTF-8
Java
false
false
4,969
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 modele; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; /** * * @author laure et clemence */ public class Seance_groupesDAO extends DAO<Seance_groupes>{ /** * on crée un objet seance groupe dans la bbd a partir d'une seance et d'un groupe * @param se * @param gr * @return */ public Seance_groupes createS(Seance se, Groupe gr) { Seance_groupes obj = new Seance_groupes(); try { PreparedStatement prepare = this.connect .prepareStatement("INSERT INTO seance_groupes (Id_seance, Id_groupe) VALUES(?,?)"); prepare.setInt(1, se.getId()); prepare.setInt(2, gr.getId()); prepare.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } return obj; } /** * on met a jour une seance groupe (souvent le groupe pour une seance) * @param obj * @return */ public Seance_groupes update(Seance_groupes obj) { Seance_groupes se = new Seance_groupes(); ResultSet result = null; try { PreparedStatement prepare = this.connect .prepareStatement("SELECT * FROM seance_groupe WHERE Id_seance=? AND Id_groupe = ? "); prepare.setInt(1, obj.getId_seance()); prepare.setInt(2, obj.getId_groupe()); result=prepare.executeQuery(); while(result.next()){ se.setId_seance(result.getInt(1)); se.setId_groupe(result.getInt(2)); } }catch(SQLException e){ e.printStackTrace(); } return se; } /** * on supprime un objet seance_groupes (un element de la table) * @param obj */ public void delete(Seance_groupes obj) { try{ PreparedStatement prepare = this.connect .prepareStatement("DELETE FROM seance_groupes WHERE Id_seance =? AND Id_groupe=?"); prepare.setInt(1, obj.getId_seance()); prepare.setInt(2, obj.getId_groupe()); prepare.executeUpdate (); }catch(SQLException e){ e.printStackTrace(); } } /** * on recupère la liste des seances pour un groupe donné * @param groupe * @return */ public List<Seance_groupes> find(int groupe){ List<Seance_groupes> obj= new ArrayList<>(); ResultSet result = null; try { PreparedStatement prepare = this.connect .prepareStatement("SELECT * FROM seance_groupes WHERE Id_groupe =?"); prepare.setInt(1, groupe); result=prepare.executeQuery(); Seance_groupes seance = null; while(result.next()){ seance = new Seance_groupes(); seance.setId_seance(result.getInt(1)); seance.setId_groupe(result.getInt(2)); obj.add(seance); } }catch(SQLException e){ e.printStackTrace(); } return obj; } /** * on recupère un objet Seance_groupes et toutes ses données à partir de son idee de seance * @param id * @return */ public Seance_groupes findS(int id) { Seance_groupes obj = new Seance_groupes(); ResultSet result = null; //obligation de mettre sous le format date spécial sql try { PreparedStatement prepare = this.connect .prepareStatement("SELECT * FROM seance_groupes WHERE Id_seance=? "); prepare.setInt(1, id); result=prepare.executeQuery(); while(result.next()){ obj.setId_seance(result.getInt(1)); obj.setId_groupe(result.getInt(2)); } //System.out.println(obj.getId()); }catch(SQLException e){ e.printStackTrace(); } return obj; } @Override public Seance_groupes create(Seance_groupes obj) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
8562a649b46e34a81751575bdde1542f3f6ac233
e955f58a7dcb93a3f37d4fe70110da380aeb9693
/src/main/java/schwarz/numbers/sdng/models/NumberCounter.java
c3f3cb82659d702a2f6cd20fba41e7c6241efbad
[]
no_license
sit-mindshift/distributed-numbergenerator
bb006bd6a3391f18ba3b41e5d8da3aad3bac0a32
86943ad44282b4214ad9a455a583ed3a94993452
refs/heads/master
2023-02-04T11:54:11.271623
2020-12-17T08:37:16
2020-12-17T08:37:16
319,157,929
1
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package schwarz.numbers.sdng.models; import org.springframework.cloud.gcp.data.datastore.core.mapping.Entity; import org.springframework.data.annotation.Id; import java.time.LocalDateTime; @Entity public class NumberCounter { @Id private Long id; private NumberType numberType; private Long currentNumber; private LocalDateTime lastModification; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public NumberType getNumberType() { return numberType; } public void setNumberType(NumberType numberType) { this.numberType = numberType; } public Long getCurrentNumber() { return currentNumber; } public void setCurrentNumber(Long currentNumber) { this.currentNumber = currentNumber; } public LocalDateTime getLastModification() { return lastModification; } public void setLastModification(LocalDateTime lastModification) { this.lastModification = lastModification; } }
cfdfa6a66c64c6109a54fa57bdcde61ed5485534
ff1e00383772e658b06fcd0173bc25e4aad21d4e
/Kachitoritai/src/main/java/eiffle/PandaMeiyaReykaSuki/http/VoteResponse.java
eadeedcb97cfe14c2693e49bdda337ff4fdc0e1c
[]
no_license
Aninomist/Choose-your-project
2354d8c8f9b90b08d01e477cf85d1d98134d9a2d
10599970c06a2c4df74c3b8ce1be1501738868a4
refs/heads/master
2023-02-10T09:30:52.097187
2021-01-05T19:54:11
2021-01-05T19:54:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
383
java
package eiffle.PandaMeiyaReykaSuki.http; public class VoteResponse { public final String response; public final int httpCode; public VoteResponse(String s, int code) { this.response = s; this.httpCode = code; } public VoteResponse(String s) { this.response = s; this.httpCode = 200; } public String toString() { return "VoteResponse(" + response + ")"; } }
ee4350bdf9a62a0a96faf9677b80eedf218feb9e
7c4c796ed3008392862734172659e8545e79279e
/DataBuild-Core/src/main/java/com/github/linkkou/databulid/utils/ClassUtils.java
c80f8d18d1205f449579b2a7f662a86380f52dbd
[ "MIT" ]
permissive
Link-Kou/Plugin-DataBulid
8af12cbba43e191bc073ca21d2eb92a24fa38ee9
e171f64d854b4d084bf373f37d347426c2156a53
refs/heads/master
2021-07-09T09:41:34.457958
2020-11-06T08:47:23
2020-11-06T08:47:23
212,978,442
1
0
null
null
null
null
UTF-8
Java
false
false
5,200
java
package com.github.linkkou.databulid.utils; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.util.List; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.*; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.ElementFilter; import java.util.ArrayList; import java.util.regex.Pattern; /** * 类工具 * * @author lk * @version 1.0 * @date 2019/10/2 18:08Regex */ public class ClassUtils { /** * 获取class类型 * * @param typeMirror 方法对象 * @return Type.ClassType */ public static Type.ClassType getClassType(TypeMirror typeMirror) { Type.ClassType returnType = (Type.ClassType) typeMirror; return returnType; } /** * 获取class的完整路径 * * @param typeMirror 方法对象 * @return Type.ClassType */ public static String getClassTypePath(TypeMirror typeMirror) { final Type.ClassType classType = getClassType(typeMirror); return classType.tsym.type.toString(); } /** * 获取泛型类 * * @param typeMirror 方法对象 */ public static List<Type> getClassGenerics(TypeMirror typeMirror) { final Type.ClassType classType = getClassType(typeMirror); final List<Type> typeArguments = classType.getTypeArguments(); return typeArguments; } /** * 是否为泛型 * * @param typeMirror 方法对象 */ public static boolean isClassGenerics(TypeMirror typeMirror) { final List<Type> classGenerics = getClassGenerics(typeMirror); return classGenerics.size() > 0; } /** * 获取到类的所有的公开的方法 * * @param processingEnv 解析 * @param classType 类 * @return */ public static ArrayList<ExecutableElement> getClassAllMembersByPublic(ProcessingEnvironment processingEnv, Type.ClassType classType) { final ArrayList<ExecutableElement> executableElements = new ArrayList<ExecutableElement>(); final TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(classType.tsym.toString()); if (typeElement != null) { java.util.List<? extends Element> allMembers = processingEnv.getElementUtils().getAllMembers(typeElement); java.util.List<? extends Element> methods = ElementFilter.methodsIn(allMembers); for (Element method : methods) { ExecutableElement executableElement = (ExecutableElement) method; if (executableElement.getModifiers().contains(Modifier.PUBLIC)) { executableElements.add(executableElement); } } } return executableElements; } /** * 获取到类的所有的方法 * * @param processingEnv 解析 * @param classType 类 * @return */ public static ArrayList<ExecutableElement> getClassAllMembers(ProcessingEnvironment processingEnv, Type.ClassType classType) { final ArrayList<ExecutableElement> executableElements = new ArrayList<ExecutableElement>(); final TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(classType.tsym.toString()); if (typeElement != null) { java.util.List<? extends Element> allMembers = processingEnv.getElementUtils().getAllMembers(typeElement); java.util.List<? extends Element> methods = ElementFilter.methodsIn(allMembers); for (Element method : methods) { ExecutableElement executableElement = (ExecutableElement) method; executableElements.add(executableElement); } } return executableElements; } /** * 获取到类的所有的公开的方法并且更具正则表达式匹配 * * @param processingEnv 解析 * @param classType 类型 * @param pattern 表达式 * @return */ public static ArrayList<ExecutableElement> getClassAllMembersByPublicAndName(ProcessingEnvironment processingEnv, Type.ClassType classType, Pattern pattern) { final ArrayList<ExecutableElement> executableElements = new ArrayList<ExecutableElement>(); final TypeElement typeElement = processingEnv.getElementUtils().getTypeElement(classType.tsym.toString()); if (typeElement != null) { java.util.List<? extends Element> allMembers = processingEnv.getElementUtils().getAllMembers(typeElement); java.util.List<? extends Element> methods = ElementFilter.methodsIn(allMembers); for (Element method : methods) { ExecutableElement executableElement = (ExecutableElement) method; if (executableElement.getModifiers().contains(Modifier.PUBLIC)) { //判断方法的参数数量 executableElement.getParameters().size() == parameters if (pattern.matcher(executableElement.getSimpleName()).matches()) { executableElements.add(executableElement); } } } } return executableElements; } }
a3282a6538547e6a3506f3d520934a62b4eefef2
5b7864fa349705f5b841e15bcd46b2eeafe32316
/src/model/entities/Invoice.java
dbf72c8d54ea305347b9adf259d7b1ce4ce98e89
[]
no_license
samversiane/interface1
1db54cc3b98b2a88103e7882926c1419ba077f08
c04be3d32fa7dd672cb42479b3b3345c5a9c0375
refs/heads/master
2023-02-25T08:42:55.256234
2021-01-26T01:04:13
2021-01-26T01:04:13
332,263,691
0
0
null
null
null
null
UTF-8
Java
false
false
568
java
package model.entities; public class Invoice { private Double basicPayment; private Double tax; public Invoice() { } public Invoice(Double basicPayment, Double tax) { this.basicPayment = basicPayment; this.tax = tax; } public Double getBasicPayment() { return basicPayment; } public void setBasicPayment(Double basicPayment) { this.basicPayment = basicPayment; } public Double getTax() { return tax; } public void setTax(Double tax) { this.tax = tax; } public Double getTotalPayment() { return getBasicPayment() + getTax(); } }
7d73f5df00730d1e6f4b97dc8a15ea63776c46eb
909313f9295d578a0fdc1358bca836934ca60352
/src/No221/Dynamic_221.java
bdef70f1895f9009bc6bb28a3c85841a8ce37ea2
[]
no_license
BUhdh951018/LeetCode
d41fe21ce95894d1139c2471a21073197f5ab20a
60e66e52975a81d2687a2b2179636cdd0bf540e1
refs/heads/master
2023-04-15T06:26:17.894262
2023-04-10T11:49:39
2023-04-10T11:49:39
252,291,413
0
0
null
null
null
null
UTF-8
Java
false
false
619
java
package No221; public class Dynamic_221 { public int maximalSquare(char[][] matrix) { int cols = matrix.length; int rows = cols > 0 ? matrix[0].length : 0; int ans = 0; int[][] dp = new int[cols + 1][rows + 1]; for (int i = 1; i <= cols; i++) { for (int j = 1; j <= rows; j++) { if (matrix[i - 1][j - 1] == '1') { dp[i][j] = Math.min(Math.min(dp[i][j - 1], dp[i - 1][j]), dp[i - 1][j - 1]) + 1; ans = Math.max(ans, dp[i][j]); } } } return ans * ans; } }
5ec0232b7206d9a5517430735a8ca4d296244bbd
9d9ed07951d58baae3c759923dd14f6fd659af8f
/src/main/java/me/matamor/pruebas/tema11/ejercicio5/GeneradorItem.java
7f43ac41798aca8469b90b7ff6fcfb497d6e837a
[]
no_license
MaTaMoR/Pruebas
8e40346a9d002ee6f26cae4fa9ee00c5be277864
af95c23b70ed232588e69dd985038e1a509c7e04
refs/heads/master
2023-05-02T07:46:32.634588
2021-05-25T14:45:20
2021-05-25T14:45:20
364,664,490
0
0
null
null
null
null
UTF-8
Java
false
false
576
java
package me.matamor.pruebas.tema11.ejercicio5; import me.matamor.pruebas.lib.Generador; import me.matamor.pruebas.lib.Randomizer; public class GeneradorItem implements Generador<Item> { private Material randomMaterial() { Material[] materiales = Material.values(); return materiales[Randomizer.randomInt(0, materiales.length - 1)]; } @Override public Item generar() { Material material = randomMaterial(); int cantidad = Randomizer.randomInt(1, material.getStackSize()); return new Item(material, cantidad); } }
42b09a54a5773fae42e40459f07915729b634492
b7f3edb5b7c62174bed808079c3b21fb9ea51d52
/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantPeekHeightCoordinator.java
a9dfca8e739a83b5b20af36fb27130e0e387c412
[ "BSD-3-Clause" ]
permissive
otcshare/chromium-src
26a7372773b53b236784c51677c566dc0ad839e4
64bee65c921db7e78e25d08f1e98da2668b57be5
refs/heads/webml
2023-03-21T03:20:15.377034
2020-11-16T01:40:14
2020-11-16T01:40:14
209,262,645
18
21
BSD-3-Clause
2023-03-23T06:20:07
2019-09-18T08:52:07
null
UTF-8
Java
false
false
7,778
java
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.autofill_assistant; import android.content.Context; import android.view.View; import androidx.annotation.IntDef; import org.chromium.base.Callback; import org.chromium.chrome.autofill_assistant.R; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.EmptyBottomSheetObserver; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Coordinator responsible for setting the peek mode and computing the peek height of the AA bottom * sheet content. */ class AssistantPeekHeightCoordinator { interface Delegate { /** Set whether only actions and suggestions should be shown below the progress bar. */ void setShowOnlyCarousels(boolean showOnlyCarousels); /** Called when the peek height changed. */ void onPeekHeightChanged(); } /** * The peek mode allows to set what components are visible when the sheet is in the peek * (minimized) state. This is the java version of the ConfigureViewport::PeekMode enum in * //components/autofill_assistant/browser/service.proto. DO NOT change this without adapting * that proto enum. */ @IntDef({PeekMode.UNDEFINED, PeekMode.HANDLE, PeekMode.HANDLE_HEADER, PeekMode.HANDLE_HEADER_CAROUSELS}) @Retention(RetentionPolicy.SOURCE) @interface PeekMode { int UNDEFINED = 0; /** Only show the swipe handle. */ int HANDLE = 1; /** * Show the swipe handle, header (status message, poodle, profile icon) and progress bar. */ int HANDLE_HEADER = 2; /** Show swipe handle, header, progress bar, suggestions and actions. */ int HANDLE_HEADER_CAROUSELS = 3; } private final View mToolbarView; private final Delegate mDelegate; private final BottomSheetController mBottomSheetController; private final int mToolbarHeightWithoutPaddingBottom; private final int mDefaultToolbarPaddingBottom; private final int mChildrenVerticalSpacing; private int mPeekHeight; private @PeekMode int mPeekMode = PeekMode.UNDEFINED; private int mHeaderHeight; private int mActionsHeight; AssistantPeekHeightCoordinator(Context context, Delegate delegate, BottomSheetController bottomSheetController, View toolbarView, View headerView, View actionsView, @PeekMode int initialMode) { mToolbarView = toolbarView; mDelegate = delegate; mBottomSheetController = bottomSheetController; mToolbarHeightWithoutPaddingBottom = context.getResources().getDimensionPixelSize( R.dimen.autofill_assistant_toolbar_vertical_padding) + context.getResources().getDimensionPixelSize( R.dimen.autofill_assistant_toolbar_swipe_handle_height); mDefaultToolbarPaddingBottom = context.getResources().getDimensionPixelSize( R.dimen.autofill_assistant_toolbar_vertical_padding); mChildrenVerticalSpacing = context.getResources().getDimensionPixelSize( R.dimen.autofill_assistant_bottombar_vertical_spacing); // Show only actions if we are in the peek state and peek mode is HANDLE_HEADER_CAROUSELS. mBottomSheetController.addObserver(new EmptyBottomSheetObserver() { @Override public void onSheetStateChanged(int newState) { maybeShowOnlyCarousels(); } }); // Listen for height changes in the header and carousel to make sure we always have the // correct peek height. mHeaderHeight = headerView.getHeight(); mActionsHeight = actionsView.getHeight(); listenForHeightChange(headerView, this::onHeaderHeightChanged); listenForHeightChange(actionsView, this::onActionsHeightChanged); setPeekMode(initialMode); } private void onHeaderHeightChanged(int height) { mHeaderHeight = height; updateToolbarPadding(); } private void onActionsHeightChanged(int height) { mActionsHeight = height; updateToolbarPadding(); } private void maybeShowOnlyCarousels() { mDelegate.setShowOnlyCarousels( mBottomSheetController.getSheetState() == BottomSheetController.SheetState.PEEK && mPeekMode == PeekMode.HANDLE_HEADER_CAROUSELS); } /** Call {@code callback} with new height of {@code view} when it changes. */ private void listenForHeightChange(View view, Callback<Integer> callback) { view.addOnLayoutChangeListener( (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { int newHeight = bottom - top; if (newHeight != oldBottom - oldTop) { callback.onResult(newHeight); } }); } /** * Set the peek mode. If the peek height changed because of this call, * Delegate#onPeekHeightChanged() will be called. */ void setPeekMode(@PeekMode int peekMode) { if (peekMode == PeekMode.UNDEFINED) { throw new IllegalArgumentException("Setting UNDEFINED peek mode is not allowed."); } if (peekMode == mPeekMode) return; mPeekMode = peekMode; updateToolbarPadding(); maybeShowOnlyCarousels(); } /** Return the current peek height. */ int getPeekHeight() { return mPeekHeight; } /** Return the current peek mode. */ int getPeekMode() { return mPeekMode; } /** * Adapt the padding top of the toolbar such that header and carousel are visible if desired. */ private void updateToolbarPadding() { int toolbarPaddingBottom; switch (mPeekMode) { case PeekMode.HANDLE: toolbarPaddingBottom = mDefaultToolbarPaddingBottom; break; case PeekMode.HANDLE_HEADER: toolbarPaddingBottom = mHeaderHeight; break; case PeekMode.HANDLE_HEADER_CAROUSELS: toolbarPaddingBottom = mHeaderHeight; if (mActionsHeight > 0) { toolbarPaddingBottom += mActionsHeight; } // We decrease the artificial padding we add to the toolbar by 1 pixel to make sure // that toolbarHeight < contentHeight. This way, when the user swipes the sheet from // bottom to top, the sheet will enter the SCROLL state and we will show the details // and PR, which will allow the user to swipe the whole sheet up with all content // shown. An alternative would be to allow toolbarHeight == contentHeight and try to // detect swipe/touch events on the sheet, but this alternative is more complex and // feels less safe than the current workaround. toolbarPaddingBottom -= 1; break; default: throw new IllegalStateException("Unsupported PeekMode: " + mPeekMode); } mToolbarView.setPadding(mToolbarView.getPaddingLeft(), mToolbarView.getPaddingTop(), mToolbarView.getPaddingRight(), toolbarPaddingBottom); int newHeight = mToolbarHeightWithoutPaddingBottom + toolbarPaddingBottom; if (mPeekHeight != newHeight) { mPeekHeight = newHeight; mDelegate.onPeekHeightChanged(); } } }
3d3e6f44cf37bf4a5296d5be5489d6d3e3e59a43
1d36438ea8ff2f4242a51f33e24504f11ea289ad
/app/src/main/java/com/example/ptmarketing04/pruebalogin/DevuelveJSON.java
8addf593664e9487e159b738fdf49f2f519f8015
[]
no_license
NalyLas/PruebaLogin
45006ad14dce51d9109e9477791ec3dd98ce97a3
1285914447f8028f47cd98fc031a4446f9a04922
refs/heads/master
2021-01-19T21:08:31.345338
2017-04-19T15:23:42
2017-04-19T15:23:42
88,611,658
0
0
null
null
null
null
UTF-8
Java
false
false
5,308
java
package com.example.ptmarketing04.pruebalogin; /** * Created by Natalia on 21/01/2017. */ import android.util.Log; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; public class DevuelveJSON { private HttpURLConnection conn; public static final int CONNECTION_TIMEOUT = 15 * 1000; public JSONArray sendRequest(String link, HashMap<String, String> values) throws JSONException { JSONArray jArray = null; try { URL url = new URL(link); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(CONNECTION_TIMEOUT); conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); conn.connect(); if (values != null) { OutputStream os = conn.getOutputStream(); OutputStreamWriter osWriter = new OutputStreamWriter(os, "UTF-8"); BufferedWriter writer = new BufferedWriter(osWriter); writer.write(getPostData(values)); writer.flush(); writer.close(); os.close(); } if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { InputStream is = conn.getInputStream(); InputStreamReader isReader = new InputStreamReader(is, "UTF-8"); BufferedReader reader = new BufferedReader(isReader); String result = ""; String line = null; StringBuilder sb = new StringBuilder(); while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result = sb.toString(); try { jArray = new JSONArray(result); return jArray; } catch (JSONException e) { Log.e("ERROR => ", "Error convirtiendo los datos a JSON : " + e.toString()); e.printStackTrace(); return null; } } } catch (MalformedURLException e) { } catch (IOException e) { } return jArray; } public JSONObject sendDMLRequest(String link, HashMap<String, String> values) throws JSONException { JSONObject jobject=null; try { URL url = new URL(link); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(CONNECTION_TIMEOUT); conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); conn.connect(); if (values != null) { OutputStream os = conn.getOutputStream(); OutputStreamWriter osWriter = new OutputStreamWriter(os, "UTF-8"); BufferedWriter writer = new BufferedWriter(osWriter); writer.write(getPostData(values)); writer.flush(); writer.close(); os.close(); } if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { BufferedReader r = new BufferedReader(new InputStreamReader(conn.getInputStream())); StringBuilder result = new StringBuilder(); String line; while ((line = r.readLine()) != null) { result.append(line); } try { jobject = new JSONObject(result.toString()); return jobject; } catch (JSONException e) { Log.e("ERROR => ", "Error convirtiendo los datos a JSON222 : " + e.toString()); e.printStackTrace(); return null; } } } catch (MalformedURLException e) { } catch (IOException e) { e.getMessage(); } return jobject; } public String getPostData(HashMap<String, String> values) { StringBuilder builder = new StringBuilder(); boolean first = true; for (Map.Entry<String, String> entry : values.entrySet()) { if (first) first = false; else builder.append("&"); try { builder.append(URLEncoder.encode(entry.getKey(), "UTF-8")); builder.append("="); builder.append(URLEncoder.encode(entry.getValue(), "UTF-8")); } catch (UnsupportedEncodingException e) {} } return builder.toString(); } }
3806c3997c2d95507b240c95741b23fd0a4f1003
9fdff32dddb2f61b99fb0d6fea7b7b70b404b2b2
/src/main/java/com/crm/service/lqm/impl/ImpHomePageService.java
555938acd540b202318295c11ac4547779220795
[]
no_license
git-lbw/CRM
b998a62f722d2a92feeca4e0db8d6f38aa8648c5
d990c6b21998730ed5dd86bb63d28b808d38e332
refs/heads/master
2023-04-14T22:35:23.538064
2021-04-12T11:48:50
2021-04-12T11:48:50
353,866,632
2
0
null
null
null
null
UTF-8
Java
false
false
1,483
java
package com.crm.service.lqm.impl; import com.crm.dao.lqm.HomePageDao; import com.crm.entities.*; import com.crm.service.lqm.HomePageService; import com.crm.vo.lqm.HomeLinkManVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; @Service public class ImpHomePageService implements HomePageService { @Resource private HomePageDao homePageDao; @Override public List<Customer> NewCustomerData() { return homePageDao.NewCustomerData(); } @Override public List<HomeLinkManVo> NewContactData() { return homePageDao.NewContactData(); } @Override public List<SalesLeads> NewOpportunityData() { return homePageDao.NewOpportunityData(); } @Override public List<Clue> NewClueData() { return homePageDao.NewClueData(); } @Override public List<Orders> NewSalesOrderData() { return homePageDao.NewSalesOrderData(); } @Override public List<Orders> NewSalesData() { return homePageDao.NewSalesData(); } @Override public List<Activity> CreateActivity() { return homePageDao.CreateActivity(); } @Override public List<Clue> getNoFollowClue() { return homePageDao.getNoFollowClue(); } @Override public List<Customer> getNoFollowCustomer() { return homePageDao.getNoFollowCustomer(); } }
[ "" ]
61dfacc039b1d3e65678396e3782e9ac13caa519
029b2c249faf892f045c269736ebddcec3f6e79a
/src/main/java/com/agile/engine/cuffaro/service/IAccountBalanceService.java
13cd6885c66a5cb012fa39ea153c8490d894588a
[]
no_license
cuffahd/agileEngine
7a154d7dc361d49e98192afd60f48397ab8008f2
24ead4082ec096459a9b6f6868e3288884ab992a
refs/heads/master
2023-02-03T13:46:59.515917
2020-12-27T01:41:46
2020-12-27T01:41:46
287,410,507
0
0
null
null
null
null
UTF-8
Java
false
false
185
java
package com.agile.engine.cuffaro.service; import com.agile.engine.cuffaro.dto.AccountBalanceDTO; public interface IAccountBalanceService { AccountBalanceDTO getAccountBalance(); }
6606d0679f4b89b82c05690690b25061e88aeb3f
94aaedc4bdce634930a1457a3def3037eff5269b
/src/test/java/de/saxsys/skill2cypher/parser/SkillParserTest.java
0c7ef04779eb8ac1f45eea81e9cd7e1f0dca136f
[]
no_license
mab/skill2cypher
5d7c8575cb93ecc6f02530b3a8463f94191d2e64
2bc03afc58d3ccc88317ca29467791d781c4f88c
refs/heads/master
2016-09-05T19:58:37.633322
2014-06-27T12:19:20
2014-06-27T12:19:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package de.saxsys.skill2cypher.parser; import static org.junit.Assert.assertEquals; import org.junit.Test; import de.saxsys.skill2cypher.model.Skill; import de.saxsys.skill2cypher.model.SkillLevel; import de.saxsys.skill2cypher.parser.SkillParser; public class SkillParserTest { @Test public void testExtractSkillForMacOsProfessionell() { SkillParser parser = new SkillParser(); Skill skill = parser.extractSkill("Betriebssysteme", "Mac OS X (P)"); Skill expected = new Skill("Betriebssysteme", "Mac OS X", SkillLevel.Professionell); assertEquals(expected, skill); } }
e97b304d189f5852f82badf77a6ec87eed91a9a4
669c9a1705f96fc42fc062a5dab8789dbdd87ad6
/src/com/java2/object/Poker2.java
dd6ab1d0a7af6af74b1bf49bdaeb5226b9b71eef
[]
no_license
linyoyo97/myproject
9fd76f399fdc434389d681e1109cd9ce902b94d6
ded2c56c9a6f40290e56630ad40b3db4d38a77be
refs/heads/master
2020-03-12T12:45:04.891480
2018-06-27T04:09:19
2018-06-27T04:09:19
127,639,723
0
0
null
null
null
null
UTF-8
Java
false
false
589
java
package com.java2.object; import java.util.ArrayList; import java.util.Collections; import java.util.Random; public class Poker2 { Random random = new Random(); String flowers = "SHDC"; ArrayList<String> card = new ArrayList<>(); public Poker2() { for (int i = 0; i < 52; i++) { card.add((i%13)+1 +""+ flowers.charAt(i / 13)); }} public void shuffle() { Collections.shuffle(card); //arraylist 亂數分發 } public void show() { for (int i = 0; i < 52; i++) { System.out.print(card.get(i)+ " "); if ((i + 1) % 13 == 0) { System.out.println(); } }}}
590cc818d8df704870a5ef49a8792944b6c3d0a3
f769262075317b62991725fe456060dd48b5f0a2
/opt/eeweb3/src/org/jpos/ee/menu/MenuNode.java
7b3e7d985b37f18c2f83bb647f8b46d5e8a9cd27
[]
no_license
resza/bsmkorea
cc7967dc094bd372ba735c88a8bb247aa3496dac
983e35e5a0b52a663c294156f5d686f52a8d5bf7
refs/heads/master
2021-01-23T13:49:19.244348
2015-07-06T03:40:34
2015-07-06T03:40:34
37,500,069
0
1
null
null
null
null
UTF-8
Java
false
false
9,570
java
/* * jPOS Project [http://jpos.org] * Copyright (C) 2000-2007 Alejandro P. Revilla * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package org.jpos.ee.menu; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.jdom.Element; import org.jpos.ee.BLException; import org.jpos.ee.Permission; import org.jpos.ee.User; /** * This class represents a menu tree. * * @author alcarraz * */ public class MenuNode implements Serializable, Iterable<MenuNode> { /*FIXME should implement Composite Pattern?*/ /** * children elements */ private SortedSet<MenuNode> children; /** * what to display? */ private String display; /** * name to be accessed */ private String name; /** * url to load when clicked */ private String url; /** * type of node (Separator, subtitle) */ private String nodeType; /** * weight */ private int weight; final static protected Pattern P = Pattern.compile("([^/]*)/(.*)"); final static protected Comparator<MenuNode> COMPARATOR = new Comparator<MenuNode>(){ public int compare(MenuNode o1, MenuNode o2) { int w1 = o1.getWeight(), w2 = o2.getWeight(); if (w1 != w2) return w1 - w2; String n1 = o1.getName(), n2 = o2.getName(); if (n1 == null && n2 == null) return 0; else if (n1 == null) return -1; else if (n2 == null) return 1; else return n1.compareTo(n2); } }; /** * Which permissions are able to see this menu? */ private Set<String> permissions; public MenuNode() { super(); setChildren(new TreeSet<MenuNode>(COMPARATOR)); permissions = new HashSet<String>(); } /** * @param display * @param name * @param url * @param nodeType * @param weight * @param permissions */ public MenuNode(String display, String name, String url, String nodeType, int weight, Set<String> permissions) { this(); this.display = display; this.name = name; this.url = url; this.nodeType = nodeType; this.weight = weight; this.permissions = new HashSet<String>(permissions); } /** * @return the url */ public String getUrl() { return url; } /** * @param url the url to set */ public void setUrl(String url) { this.url = url; } /** * @param children the children to set */ public void setChildren(SortedSet<MenuNode> children) { this.children = children; } /** * @return the children */ public SortedSet<MenuNode> getChildren() { return children; } /** * @return the display */ public String getDisplay() { if (display != null) return display; if (name != null) return name; return null; } /** * @param display the display to set */ public void setDisplay(String display) { this.display = display; } /** * @return the name */ public String getName() { if (name != null) return name; if (display != null) return display; return null; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the weight */ protected int getWeight() { return weight; } /** * @param weight the weight to set */ protected void setWeight(int weight) { this.weight = weight; } public void addChild(MenuNode child){ children.add(child); } /** * Builds the Menu given by xml in tree. * For examples look at modules/eeweb3/cfg/menus * * @param tree jDom Element with a representation of the xml */ public void build(Element tree){ nodeType = tree.getName(); //quickfix for handling separators display = tree.getAttributeValue("display"); name = tree.getAttributeValue("name",display); url = tree.getAttributeValue("url"); weight = Integer.parseInt(tree.getAttributeValue("weight","0")); String permsAsString = tree.getAttributeValue("permissions"); if (permsAsString !=null) addPermissions(Arrays.asList(permsAsString.split("[, ]"))); int nextWeight = 0; for (Object o : tree.getChildren()) { Element e = (Element)o; MenuNode child = new MenuNode(); //propagate permissions to descendents, what other meaning could //have a permission defined in an internal node? //note that this only apply to nodes defined in the same xml //nodes added later by a module will have their own permissions //defined //FIXME: Don't know if this is the best way to do this but is the // easier to start :) child.addPermissions(permissions); child.build(e); //if weight not defined increment the last one if (child.getWeight() == 0) child.setWeight(nextWeight++); else nextWeight = child.getWeight(); addChild(child); } } /** * * @param name * @return * @throws BLException if node does not exists */ public MenuNode getChild(String name) throws BLException{ for (MenuNode node : children) { if (name.equals(node.getName())){ return node; } } throw new BLException("node not found " + name); } /** * Handy method to quicly get access to a node by path. * This let other modules to put sub menus without navigating all the path. * @param path Desired path separated by slashes (/) * @return The node given by the path * @throws BLException if node not found in given path */ public MenuNode getNodeByPath(String path ) throws BLException{ Matcher m = P.matcher(path); if (m.matches()){ try { return getChild(m.group(1)).getNodeByPath(m.group(2)); } catch(BLException e) {//quick fix to show the real path in the exception throw new BLException("Node not found in path " + path + " of menu " + getName()); } } else { return getChild(path); } } /** * * @return an iterator to iterate over children in the order given by order */ public Iterator<MenuNode> iterator(){ return children.iterator(); } /** * * @return count of direct children */ public int size(){ return children.size(); } /** * Create permission set if it still hasn't be done. * FIXME: This isn't the best name. Is it? */ protected void initPerms(){ if (permissions == null) permissions = new HashSet<String>(); } protected void addPermissions(Collection<String> perms){ initPerms(); permissions.addAll(perms); } public boolean hasPermission(User u){ if (permissions.isEmpty()) return true; for (Object o: u.getPermissions()){ if (permissions.contains(((Permission)o).getName())) return true; } return false; } public MenuNode prune(User u){ MenuNode pruned = new MenuNode(display, name, url, nodeType, weight, permissions); for (MenuNode child : this){ MenuNode prunedChild = child.prune(u); if (prunedChild != null) pruned.addChild(prunedChild); } if (pruned.getChildren().size() == 0 && !hasPermission(u)) return null; pruned.addPermissions(permissions); return pruned; } /** * @return the nodeType */ public String getNodeType() { return nodeType; } /** * @param nodeType the nodeType to set */ public void setNodeType(String nodeType) { this.nodeType = nodeType; } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { return "[type= " + nodeType + ", name=" + name + ", weight="+weight+"]" ; } }
53bb7419cafff2ccb2cfb24b495cf747dc93ef50
7e50cefee4abdedf6b7b193c4e0ef1d7fbaf3653
/src/Obj_Contabilidad/Obj_Orden_De_Gasto.java
51120fdcf4686a1c8d5bb1d8275c36ec5d0c8c75
[]
no_license
zurdo153/SCOI
f46a44fe2ea1fd7f7e71f38b9d74e372df4bb1fd
bb600c4e52b2ef676c1f503308473341a472fbee
refs/heads/master
2021-03-19T17:03:25.430525
2019-04-04T02:16:26
2019-04-04T02:16:26
18,498,167
0
2
null
null
null
null
UTF-8
Java
false
false
3,960
java
package Obj_Contabilidad; import java.sql.SQLException; import Conexiones_SQL.BuscarSQL; import Conexiones_SQL.Cargar_Combo; import Conexiones_SQL.GuardarSQL; public class Obj_Orden_De_Gasto { int folio=0; int folio_usuario_solicito=0; float total_gasto=0; int cantidad_de_correos=0; int folio_servicio=0; String plazo=""; String establecimiento_solicito=""; String cod_prv=""; String tipo_proveedor=""; String descripcion_gasto=""; String Guardar_actualizar=""; String correos=""; String concepto_gasto=""; String tipo=""; String forma_de_pago=""; String cheque=""; public String getCheque() { return cheque; } public void setCheque(String cheque) { this.cheque = cheque; } public String getPlazo() { return plazo; } public void setPlazo(String plazo) { this.plazo = plazo; } public String getForma_de_pago() { return forma_de_pago; } public void setForma_de_pago(String forma_de_pago) { this.forma_de_pago = forma_de_pago; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public int getFolio_servicio() { return folio_servicio; } public void setFolio_servicio(int folio_servicio) { this.folio_servicio = folio_servicio; } public String getConcepto_gasto() { return concepto_gasto; } public void setConcepto_gasto(String concepto_gasto) { this.concepto_gasto = concepto_gasto; } Object[][] tabla_obj =null; public Object[][] getTabla_obj() { return tabla_obj; } public void setTabla_obj(Object[][] tabla_obj) { this.tabla_obj = tabla_obj; } public int getFolio() { return folio; } public void setFolio(int folio) { this.folio = folio; } public int getFolio_usuario_solicito() { return folio_usuario_solicito; } public void setFolio_usuario_solicito(int folio_usuario_solicito) { this.folio_usuario_solicito = folio_usuario_solicito; } public float getTotal_gasto() { return total_gasto; } public void setTotal_gasto(float total_gasto) { this.total_gasto = total_gasto; } public int getCantidad_de_correos() { return cantidad_de_correos; } public void setCantidad_de_correos(int cantidad_de_correos) { this.cantidad_de_correos = cantidad_de_correos; } public String getEstablecimiento_solicito() { return establecimiento_solicito; } public void setEstablecimiento_solicito(String establecimiento_solicito) { this.establecimiento_solicito = establecimiento_solicito; } public String getCod_prv() { return cod_prv; } public void setCod_prv(String cod_prv) { this.cod_prv = cod_prv; } public String getTipo_proveedor() { return tipo_proveedor; } public void setTipo_proveedor(String tipo_proveedor) { this.tipo_proveedor = tipo_proveedor; } public String getDescripcion_gasto() { return descripcion_gasto; } public void setDescripcion_gasto(String descripcion_gasto) { this.descripcion_gasto = descripcion_gasto; } public String getGuardar_actualizar() { return Guardar_actualizar; } public void setGuardar_actualizar(String guardar_actualizar) { Guardar_actualizar = guardar_actualizar; } public String getCorreos() { return correos; } public void setCorreos(String correos) { this.correos = correos; } public String[] Combo_Cuentas() { try { return new Cargar_Combo().Combos("estatusorden"); } catch (SQLException e) { e.printStackTrace(); } return null; } public String[] Cuentas_Gastos_Edo_Resultados() { try { return new Cargar_Combo().Combos("Cuentas_Gastos_Edo_Resultados"); } catch (SQLException e) { e.printStackTrace(); } return null; } public Obj_Orden_De_Gasto GuardarActualizar(){ return new GuardarSQL().Guardar_Solicitud_Orden_De_Gasto(this); } public String[][] consulta_orden_de_gasto(int folio_orden_gasto){ return new BuscarSQL().Tabla_Orden_Gasto(folio_orden_gasto); } public boolean validacion_existe (String folio){ return new BuscarSQL().Validaciones("EOP",folio,""); } }
8992f197e917a93420c7836b81b43b70513ba076
99380e534cf51b9635fafeec91a740e8521e3ed8
/examplejdbc/src/main/java/com/jolbox/bonecp/ConnectionTesterThread.java
7c6ee9207a8de355afc590f27187be862af8abc9
[]
no_license
khodabakhsh/cxldemo
d483c634e41bb2b6d70d32aff087da6fd6985d3f
9534183fb6837bfa11d5cad98489fdae0db526f1
refs/heads/master
2021-01-22T16:53:27.794334
2013-04-20T01:44:18
2013-04-20T01:44:18
38,994,185
1
0
null
null
null
null
UTF-8
Java
false
false
6,334
java
/** * Copyright 2010 Wallace Wadge * * 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.jolbox.bonecp; import java.sql.SQLException; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Periodically sends a keep-alive statement to idle threads * and kills off any connections that have been unused for a long time (or broken). * @author wwadge * */ public class ConnectionTesterThread implements Runnable { /** Connections used less than this time ago are not keep-alive tested. */ private long idleConnectionTestPeriodInMs; /** Max no of ms to wait before a connection that isn't used is killed off. */ private long idleMaxAgeInMs; /** Partition being handled. */ private ConnectionPartition partition; /** Scheduler handle. **/ private ScheduledExecutorService scheduler; /** Handle to connection pool. */ private BoneCP pool; /** If true, we're operating in a LIFO fashion. */ private boolean lifoMode; /** Logger handle. */ private static Logger logger = LoggerFactory.getLogger(ConnectionTesterThread.class); /** Constructor * @param connectionPartition partition to work on * @param scheduler Scheduler handler. * @param pool pool handle * @param idleMaxAgeInMs Threads older than this are killed off * @param idleConnectionTestPeriodInMs Threads that are idle for more than this time are sent a keep-alive. * @param lifoMode if true, we're running under a lifo fashion. */ protected ConnectionTesterThread(ConnectionPartition connectionPartition, ScheduledExecutorService scheduler, BoneCP pool, long idleMaxAgeInMs, long idleConnectionTestPeriodInMs, boolean lifoMode){ this.partition = connectionPartition; this.scheduler = scheduler; this.idleMaxAgeInMs = idleMaxAgeInMs; this.idleConnectionTestPeriodInMs = idleConnectionTestPeriodInMs; this.pool = pool; this.lifoMode = lifoMode; } /** Invoked periodically. */ public void run() { ConnectionHandle connection = null; long tmp; try { long nextCheckInMs = this.idleConnectionTestPeriodInMs; if (this.idleMaxAgeInMs > 0){ if (this.idleConnectionTestPeriodInMs == 0){ nextCheckInMs = this.idleMaxAgeInMs; } else { nextCheckInMs = Math.min(nextCheckInMs, this.idleMaxAgeInMs); } } int partitionSize= this.partition.getAvailableConnections(); long currentTimeInMs = System.currentTimeMillis(); // go thru all partitions for (int i=0; i < partitionSize; i++){ // grab connections one by one. connection = this.partition.getFreeConnections().poll(); if (connection != null){ connection.setOriginatingPartition(this.partition); // check if connection has been idle for too long (or is marked as broken) if (connection.isPossiblyBroken() || ((this.idleMaxAgeInMs > 0) && (this.partition.getAvailableConnections() >= this.partition.getMinConnections() && System.currentTimeMillis()-connection.getConnectionLastUsedInMs() > this.idleMaxAgeInMs))){ // kill off this connection - it's broken or it has been idle for too long closeConnection(connection); continue; } // check if it's time to send a new keep-alive test statement. if (this.idleConnectionTestPeriodInMs > 0 && (currentTimeInMs-connection.getConnectionLastUsedInMs() > this.idleConnectionTestPeriodInMs) && (currentTimeInMs-connection.getConnectionLastResetInMs() >= this.idleConnectionTestPeriodInMs)) { // send a keep-alive, close off connection if we fail. if (!this.pool.isConnectionHandleAlive(connection)){ closeConnection(connection); continue; } // calculate the next time to wake up tmp = this.idleConnectionTestPeriodInMs; if (this.idleMaxAgeInMs > 0){ // wake up earlier for the idleMaxAge test? tmp = Math.min(tmp, this.idleMaxAgeInMs); } } else { // determine the next time to wake up (connection test time or idle Max age?) tmp = this.idleConnectionTestPeriodInMs-(currentTimeInMs - connection.getConnectionLastResetInMs()); long tmp2 = this.idleMaxAgeInMs - (currentTimeInMs-connection.getConnectionLastUsedInMs()); if (this.idleMaxAgeInMs > 0){ tmp = Math.min(tmp, tmp2); } } if (tmp < nextCheckInMs){ nextCheckInMs = tmp; } if (this.lifoMode){ // we can't put it back normally or it will end up in front again. if (!((LIFOQueue<ConnectionHandle>)connection.getOriginatingPartition().getFreeConnections()).offerLast(connection)){ connection.internalClose(); } } else { this.pool.putConnectionBackInPartition(connection); } Thread.sleep(20L); // test slowly, this is not an operation that we're in a hurry to deal with (avoid CPU spikes)... } } // throw it back on the queue this.scheduler.schedule(this, nextCheckInMs, TimeUnit.MILLISECONDS); } catch (Exception e) { if (this.scheduler.isShutdown()){ logger.debug("Shutting down connection tester thread."); } else { logger.error("Connection tester thread interrupted", e); } } } /** Closes off this connection * @param connection to close */ private void closeConnection(ConnectionHandle connection) { if (connection != null) { try { connection.internalClose(); } catch (SQLException e) { logger.error("Destroy connection exception", e); } finally { this.pool.postDestroyConnection(connection); } } } }
4b3b8ac8ce38d2c9fd6002832449232422cf620c
1db6ade4ef392939b7bbd267be08e57bf2d1e33c
/problems/src/main/java/com/andreytim/jafar/problems/sortsearch/P713_SerialNumbers.java
ed7977e7c29e85be66973d0dae912997b57f03e1
[ "MIT" ]
permissive
andreytim/jafar
8dd59d5260f454e206625c9324aca2dd9bd8a243
524125481eac2a39a30f20f738e69486f61c2e87
refs/heads/master
2021-01-01T17:58:19.292545
2015-04-30T14:26:11
2015-04-30T14:26:11
22,888,888
0
1
null
null
null
null
UTF-8
Java
false
false
1,564
java
package com.andreytim.jafar.problems.sortsearch; import java.util.Arrays; import java.util.Comparator; /** * TopCoder: * Single Round Match 366 Round 1 - Division II, Level One * http://community.topcoder.com/stat?c=problem_statement&pm=8171 * * Created by shpolsky on 27.11.14. */ public class P713_SerialNumbers { public String[] sortSerials(String[] serialNumbers) { Arrays.sort(serialNumbers, new Comparator<String>() { @Override public int compare(String s1, String s2) { if (s1.length() != s2.length()) return s1.length() - s2.length(); else { int sum1 = 0, sum2 = 0; for (int i = 0; i < s1.length(); i++) { if (Character.isDigit(s1.charAt(i))) sum1 += (s1.charAt(i) - '0'); if (Character.isDigit(s2.charAt(i))) sum2 += (s2.charAt(i) - '0'); } if (sum1 != sum2) { return sum1 - sum2; } else { return s1.compareTo(s2); } } } }); return serialNumbers; } public static void test(String ... serialNumbers) { System.out.printf("Input: %s;\nResult: %s\n", Arrays.toString(serialNumbers), Arrays.toString(new P713_SerialNumbers().sortSerials(serialNumbers))); } public static void main(String[] args) { test("3UH6TEJOAILR1KQNEJ2E7L2BVC", "PI3GISQAJODABD4NIC9NPZ5YBX"); } }
f191367fe4ca43da7eb9c1ae5c458627a60eeb02
e1033a9d3851de78409bbcf6ca9d9e299ebb251e
/JavaProject/src/accessmodifier/test/DifferetPackageTester.java
e8d78cb2a082707a2a110d6c8b9eaaf81c1e4b38
[]
no_license
ravurirajesh777/java
b6ca70c3bbdc06b33d0dbdf297b3735ce3f3e359
02741f6a8654cde50abe05f054da414125365dca
refs/heads/master
2023-03-22T20:12:39.370720
2021-03-04T02:24:03
2021-03-04T02:24:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
971
java
package accessmodifier.test; import accessmodifier.*; public class DifferetPackageTester { public static void main(String[] args) { //PublicClass.main(null); PublicClass p = new PublicClass(); System.out.println(p.publicInt); //System.out.println(p.de);//default instance variables are not visible outside the package //System.out.println(p.);//protected instance variables are visible only to the child or with in the same package //System.out.println(p.l);//private variables are visible only with in the same class p.publicMethod(); //p.defaultMethod();//default methods are not visible outside the package //p.protectedMethod();//protected methods are visible only to the child or with in the same package //p.privateMethod();//private methods are visible only with in the same class } public void nonStaticMethod(PublicClass p1) { PublicClass p = new PublicClass(); //System.out.println(p1.k); //System.out.println(p.k); } }
b1bae341bbec456da44441b39b3d6d5c235af473
cbc514690dec7a7f342def0fa1ec3855c8760611
/project-web/project-web-service/src/main/java/com/project/web/service/LoginService.java
a173153b03bc40ae68463770a51c55403c4af557
[]
no_license
sengeiou/project-2
7e0806cf39edc2472c18d7a198eeb7fb5e33892f
97a95cee92f0048df13bac2d12c7d0e87f686fe3
refs/heads/master
2021-09-10T17:44:09.649856
2018-03-30T10:33:07
2018-03-30T10:33:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
package com.project.web.service; import com.project.sdk.common.ExecuteResult; import com.project.sdk.export.dto.user.UserExportDto; /** * Created by Administrator on 2017/9/10. */ public interface LoginService { public ExecuteResult<UserExportDto> login(UserExportDto userExportDto); }
d73658122a691c6e09478032d2077a976b578755
8fe036da0e8910e730c8d08004f40de9a9ef381c
/source/Apollo/Apollo/src/com/andrew/apolloMod/ui/fragments/grid/ArtistsFragment.java
6e983526f1487547cabb17ab8a4f2a43d1d84499
[ "MIT" ]
permissive
liufeiit/itmarry
6a16c879a6d442fae3b32e49a5f3bab978a5f073
9d48eac9ebf02d857658b3c9f70dab2321a3362b
refs/heads/master
2021-01-23T17:19:02.717779
2014-07-19T10:32:31
2014-07-19T10:32:31
20,555,997
1
0
null
null
null
null
UTF-8
Java
false
false
8,855
java
/** * */ package com.andrew.apolloMod.ui.fragments.grid; import android.app.Fragment; import android.app.LoaderManager.LoaderCallbacks; import android.content.BroadcastReceiver; import android.content.Context; import android.content.CursorLoader; import android.content.Intent; import android.content.IntentFilter; import android.content.Loader; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.BaseColumns; import android.provider.MediaStore.Audio; import android.provider.MediaStore.Audio.ArtistColumns; import android.view.*; import android.view.ContextMenu.ContextMenuInfo; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import com.andrew.apolloMod.R; import com.andrew.apolloMod.activities.TracksBrowser; import com.andrew.apolloMod.cache.ImageInfo; import com.andrew.apolloMod.cache.ImageProvider; import com.andrew.apolloMod.helpers.utils.ApolloUtils; import com.andrew.apolloMod.helpers.utils.MusicUtils; import com.andrew.apolloMod.service.ApolloService; import com.andrew.apolloMod.ui.adapters.ArtistAdapter; import static com.andrew.apolloMod.Constants.*; /** * @author Andrew Neal * @Note This is the first tab */ public class ArtistsFragment extends Fragment implements LoaderCallbacks<Cursor>, OnItemClickListener { // Adapter private ArtistAdapter mArtistAdapter; // GridView private GridView mGridView; // Cursor private Cursor mCursor; // Options private final int PLAY_SELECTION = 0; private final int ADD_TO_PLAYLIST = 1; private final int SEARCH = 2; // Artist ID private String mCurrentArtistId; // Album ID private String mCurrentAlbumId; // Audio columns public static int mArtistIdIndex, mArtistNameIndex, mArtistNumAlbumsIndex; public ArtistsFragment() { } public ArtistsFragment(Bundle bundle) { setArguments(bundle); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // ArtistAdapter mArtistAdapter = new ArtistAdapter(getActivity(), R.layout.gridview_items, null, new String[] {}, new int[] {}, 0); mGridView.setOnCreateContextMenuListener(this); mGridView.setOnItemClickListener(this); mGridView.setAdapter(mArtistAdapter); mGridView.setTextFilterEnabled(true); // Important! getLoaderManager().initLoader(0, null, this); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.gridview, container, false); mGridView = ((GridView)root.findViewById(R.id.gridview)); return root; } @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { String[] projection = { BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS }; Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI; String sortOrder = Audio.Artists.DEFAULT_SORT_ORDER; return new CursorLoader(getActivity(), uri, projection, null, null, sortOrder); } @Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { // Check for database errors if (data == null) { return; } mArtistIdIndex = data.getColumnIndexOrThrow(BaseColumns._ID); mArtistNameIndex = data.getColumnIndexOrThrow(ArtistColumns.ARTIST); mArtistNumAlbumsIndex = data.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_ALBUMS); mArtistAdapter.changeCursor(data); mCursor = data; } @Override public void onLoaderReset(Loader<Cursor> loader) { if (mArtistAdapter != null) mArtistAdapter.changeCursor(null); } @Override public void onSaveInstanceState(Bundle outState) { outState.putAll(getArguments() != null ? getArguments() : new Bundle()); super.onSaveInstanceState(outState); } @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { tracksBrowser(id); } /** * @param id */ private void tracksBrowser(long id) { String artistName = mCursor.getString(mArtistNameIndex); String artistNulAlbums = mCursor.getString(mArtistNumAlbumsIndex); Bundle bundle = new Bundle(); bundle.putString(MIME_TYPE, Audio.Artists.CONTENT_TYPE); bundle.putString(ARTIST_KEY, artistName); bundle.putString(NUMALBUMS, artistNulAlbums); bundle.putLong(BaseColumns._ID, id); ApolloUtils.setArtistId(artistName, id, ARTIST_ID, getActivity()); Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClass(getActivity(), TracksBrowser.class); intent.putExtras(bundle); getActivity().startActivity(intent); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { menu.add(0, PLAY_SELECTION, 0, getResources().getString(R.string.play_all)); menu.add(0, ADD_TO_PLAYLIST, 0, getResources().getString(R.string.add_to_playlist)); menu.add(0, SEARCH, 0, getResources().getString(R.string.search)); mCurrentArtistId = mCursor.getString(mArtistIdIndex); mCurrentAlbumId = mCursor.getString(mCursor.getColumnIndexOrThrow(BaseColumns._ID)); menu.setHeaderView(setHeaderLayout()); super.onCreateContextMenu(menu, v, menuInfo); } @Override public boolean onContextItemSelected(MenuItem item) { switch (item.getItemId()) { case PLAY_SELECTION: { long[] list = mCurrentArtistId != null ? MusicUtils.getSongListForArtist( getActivity(), Long.parseLong(mCurrentArtistId)) : MusicUtils .getSongListForAlbum(getActivity(), Long.parseLong(mCurrentAlbumId)); MusicUtils.playAll(getActivity(), list, 0); break; } case ADD_TO_PLAYLIST: { Intent intent = new Intent(INTENT_ADD_TO_PLAYLIST); long[] list = mCurrentArtistId != null ? MusicUtils.getSongListForArtist( getActivity(), Long.parseLong(mCurrentArtistId)) : MusicUtils .getSongListForAlbum(getActivity(), Long.parseLong(mCurrentAlbumId)); intent.putExtra(INTENT_PLAYLIST_LIST, list); getActivity().startActivity(intent); break; } case SEARCH: { MusicUtils.doSearch(getActivity(), mCursor, mArtistNameIndex); break; } default: break; } return super.onContextItemSelected(item); } /** * Update the list as needed */ private final BroadcastReceiver mMediaStatusReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (mGridView != null) { mArtistAdapter.notifyDataSetChanged(); } } }; @Override public void onStart() { super.onStart(); IntentFilter filter = new IntentFilter(); filter.addAction(ApolloService.META_CHANGED); filter.addAction(ApolloService.PLAYSTATE_CHANGED); getActivity().registerReceiver(mMediaStatusReceiver, filter); } @Override public void onStop() { getActivity().unregisterReceiver(mMediaStatusReceiver); super.onStop(); } /** * @return A custom ContextMenu header */ public View setHeaderLayout() { // Get artist name final String artistName = mCursor.getString(mArtistNameIndex); // Inflate the header View LayoutInflater inflater = getActivity().getLayoutInflater(); View header = inflater.inflate(R.layout.context_menu_header, null, false); // Artist image final ImageView mHanderImage = (ImageView)header.findViewById(R.id.header_image); ImageInfo mInfo = new ImageInfo(); mInfo.type = TYPE_ARTIST; mInfo.size = SIZE_THUMB; mInfo.source = SRC_FIRST_AVAILABLE; mInfo.data = new String[]{ artistName}; ImageProvider.getInstance(getActivity()).loadImage( mHanderImage, mInfo ); // Set artist name TextView headerText = (TextView)header.findViewById(R.id.header_text); headerText.setText(artistName); headerText.setBackgroundColor(getResources().getColor(R.color.transparent_black)); return header; } }
1ca279cc519711c76d15635d1bc34c6c9f4d8788
4391e27fe38d7fa18c6d902cbfd60e4670a93ddb
/app/src/main/java/com/example/androidcourse/Country.java
cfb8237991d55702c4fdd3b6dc9595f3d1312030
[]
no_license
ShowYoungg/CountryList
cf443d094b846c71c1d7167967be9550cef23ea0
1b7ba24579429a562618a4956631aaef809cd079
refs/heads/master
2023-02-10T19:32:22.957893
2021-01-07T17:49:12
2021-01-07T17:49:12
325,779,247
0
0
null
null
null
null
UTF-8
Java
false
false
1,346
java
package com.example.androidcourse; public class Country { //Variables private String name; private int flag; private String countryDescription; private String currency; //This is an empty constructor public Country (){ this.name = name; this.flag = flag; this.countryDescription = countryDescription; this.currency = currency; } //This is the constructor public Country( String name, int flag, String countryDescription, String currency){ this.name = name; this.flag = flag; this.countryDescription = countryDescription; this.currency = currency; } //These methods are needed to get country names or country id that represent flag public String getCountryName() { return name;} public int getCountryFlag() { return flag;} public String getCountryDescription() {return countryDescription;} public String getCurrency() {return currency;} //These methods are needed to set the country name and flag public void setCountryName(String name){this.name = name;} public void setCountryFlag(int flag) {this.flag = flag;} public void setCountryDescription(String countryDescription) {this.countryDescription = countryDescription;} public void setCurrency(String currency) {this.currency = currency;} }
cd911401da43997babd0e0e1d4263d3d48ce226d
63baf71ef2d41b13f48384318e3d96e5bb187b94
/encapsulation/Example/TestingEncapsulation.java
547c6bf89e5bd29243e5d84d0c02259bad999f74
[]
no_license
DeepakRaval/Object-Orianted-Programming
1a571879179b227cea54e24ab9a30d7d88ac5037
7d1e87e78a4357c86b7195583389edc562be9e0b
refs/heads/master
2023-03-17T20:11:00.592695
2021-03-12T11:19:35
2021-03-12T11:19:35
346,338,028
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
package encapsulation.Example; public class TestingEncapsulation { public static void main (String [] args){ ExampleOfEncapsulation e1 = new ExampleOfEncapsulation(); e1.setA(5); e1.setB("Ram"); System.out.println(e1.getA() +" "+ e1.getB()); } }
79b7bd276107829a8138acb0d29c92b6946331b7
a6a94ad4e1f4b232598f22aa9d92eefc03c557bd
/src/java/phenote/datamodel/PhenotypeCharacterI.java
c18583525699517135e13b5e687f2e04ce605786
[]
no_license
cmungall/desktop-phenote
0272597c76c71984de678ba9dde5d56cc5cecc6a
26b72d9121071695ba5609011a57bc39d1283e68
refs/heads/master
2021-01-09T20:30:29.530062
2014-05-12T16:49:23
2014-05-12T16:49:23
60,292,165
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
package phenote.datamodel; import org.obo.datamodel.OBOClass; public interface PhenotypeCharacterI { public OBOClass getEntity(); public void setEntity(OBOClass term); public OBOClass getQuality(); public void setQuality(OBOClass term); public OBOClass getAdditionalEntity(); public void setAdditionalEntity(OBOClass term); public boolean hasCount(); public int getCount(); public void setCount(int count); public boolean hasMeasurement(); public float getMeasurement(); public void setMeasurement(float measurement); public OBOClass getUnit(); public void setUnit(OBOClass term); public String getDescription(); public void setDescription(String desc); public static interface PhenotypeCharacterFactory { public PhenotypeCharacterI newPhenotypeCharacter(); } }
cfae938085c2b8e6cee123677911bf4fcab2b42f
f75a7ff100fcb210d2e33c876a6a9c6317c0a396
/commons/commons.api/src/main/java/io/usa/doraemon/commons/api/common/utils/ITransportProvider.java
a251b8e6da18437e0170261f6c9045195fc22672
[ "Apache-2.0" ]
permissive
Hero-Rambo/Doraemon
9fe38bafd4b2c0d177669ffac80675df8ce89f11
ec094ed0df4765facd9864b168716c36fdb8b66b
refs/heads/master
2021-01-12T16:28:28.694945
2016-09-25T13:42:13
2016-09-25T13:42:13
69,154,214
0
0
null
null
null
null
UTF-8
Java
false
false
171
java
package io.usa.doraemon.commons.api.common.utils; /** * * @author Rambo * */ public interface ITransportProvider { String getType(); int getPort(); }
749b45917b1002381f1856bf20d8cfca3b9f328c
7bbc806193820f39f846d6381d10366f187e3dfc
/dps/WEB-INF/src/pstk/action/PStk211Action.java
c1cb135ccc909660ab398f1a9099e3aa3d9c785f
[]
no_license
artmalling/artmalling
fc45268b7cf566a2bc2de0549581eeb96505968a
0dd2d495d0354a38b05f7986bfb572d7d7dd1b08
refs/heads/master
2020-03-07T07:55:07.111863
2018-03-30T06:51:35
2018-03-30T06:51:35
127,362,251
0
0
null
2018-03-30T01:05:05
2018-03-30T00:45:52
null
UTF-8
Java
false
false
4,553
java
/* * Copyright (c) 2010 한국후지쯔. All rights reserved. * * This software is the confidential and proprietary information of 한국후지쯔. * 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 한국후지쯔 */ package pstk.action; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import kr.fujitsu.ffw.control.ActionForm; import kr.fujitsu.ffw.control.ActionForward; import kr.fujitsu.ffw.control.ActionMapping; import kr.fujitsu.ffw.control.DispatchAction; import kr.fujitsu.ffw.control.cfg.svc.shift.GauceHelper2; import kr.fujitsu.ffw.control.cfg.svc.shift.MultiInput; import org.apache.log4j.Logger; import pstk.dao.PStk211DAO; import com.gauce.GauceDataSet; import common.vo.SessionInfo; /** * <p>백화점영업관리> 재고수불> 재고실사> 단품별재고실사집계표</p> * * @created on 1.0, 2010/05/04 * @created by 이재득 * * @modified on * @modified by * @caused by */ public class PStk211Action extends DispatchAction { /* * Java Pattern 에서 지원하는 logger를 사용할 수 있도록 객체를 선언 */ private Logger logger = Logger.getLogger(PStk208Action.class); /** * <p>페이지를 로드한다.</p> * */ public ActionForward list(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String strGoTo = form.getParam("goTo"); // 분기할곳 try { GauceHelper2.initialize(form, request, response); } catch (Exception e) { e.printStackTrace(); logger.error("", e); } return mapping.findForward(strGoTo); } /** * <p> * 품번별재고실사집계표현황을 조회 한다. * </p> * */ public ActionForward searchMaster(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { List list = null; GauceHelper2 helper = null; GauceDataSet dSet = null; PStk211DAO dao = null; String strGoTo = form.getParam("goTo"); // 분기할곳 try { dao = new PStk211DAO(); helper = new GauceHelper2(request, response, form); dSet = helper.getDataSet("DS_IO_MASTER"); helper.setDataSetHeader(dSet, "H_SEL_MASTER"); list = dao.searchMaster(form); helper.setListToDataset(list, dSet); } catch (Exception e) { logger.error("", e); helper.writeException("GAUCE", "002", e.getMessage()); } finally { helper.close(dSet); } return mapping.findForward(strGoTo); } /** * <p> * Detail정보를 조회 한다. * </p> * */ public ActionForward searchDetail(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { List list = null; GauceHelper2 helper = null; GauceDataSet dSet = null; PStk211DAO dao = null; String strGoTo = form.getParam("goTo"); // 분기할곳 try { dao = new PStk211DAO(); helper = new GauceHelper2(request, response, form); dSet = helper.getDataSet("DS_IO_DETAIL"); helper.setDataSetHeader(dSet, "H_SEL_DETAIL"); list = dao.searchDetail(form); helper.setListToDataset(list, dSet); } catch (Exception e) { logger.error("", e); helper.writeException("GAUCE", "002", e.getMessage()); } finally { helper.close(dSet); } return mapping.findForward(strGoTo); } /** * <p> * 품번에따른 재고실사 조회한다. * </p> * */ public ActionForward searchPbnStk(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { List list = null; GauceHelper2 helper = null; GauceDataSet dSet = null; PStk211DAO dao = null; String strGoTo = form.getParam("goTo"); // 분기할곳 try { dao = new PStk211DAO(); helper = new GauceHelper2(request, response, form); dSet = helper.getDataSet("DS_O_PBNSTK"); helper.setDataSetHeader(dSet, "H_SEL_PBNSTK"); list = dao.searchPbnStk(form); helper.setListToDataset(list, dSet); } catch (Exception e) { logger.error("", e); helper.writeException("GAUCE", "002", e.getMessage()); } finally { helper.close(dSet); } return mapping.findForward(strGoTo); } }
[ "HP@HP-PC0000a" ]
HP@HP-PC0000a
fb16e42fa6a8a83fa3577345cbef4d17039b9412
de039114109e0b8afa0f900e7317456dda282524
/app/src/test/java/com/example/musketeers/geofencingdemo/ExampleUnitTest.java
6a849f52514f8ca7ba26d0f3120343a7f3f21c57
[]
no_license
Nithesh-Wayne/geofencingdemo
737b9ed71bdf666da74b4ecb75933841c6ecd225
e5f9f781793b8b244e13a1f744d9ca27b4e109bd
refs/heads/master
2021-09-10T05:36:13.153537
2018-03-21T06:04:35
2018-03-21T06:04:35
126,130,743
0
0
null
null
null
null
UTF-8
Java
false
false
415
java
package com.example.musketeers.geofencingdemo; 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); } }
24e4d716859465353a41279bcc630bf80f2b2362
663482c0601fd48447cc922d121ab7995ae80310
/Tests/KnightTest.java
4ee58df6abacabebb36cb7a715a9605b553d6d1f
[]
no_license
NabeelJava902/Virtual-Chess
a02d43d02b8e9ab406880e2b64a0047b82d31d47
b1d287c6c2aca0a8627b4c7c0121ff0d4875a854
refs/heads/master
2021-12-21T21:19:07.610050
2021-12-18T06:49:04
2021-12-18T06:49:04
192,261,974
0
0
null
null
null
null
UTF-8
Java
false
false
1,306
java
import Board.gameGrid; import Pieces.Knight; import Pieces.pieceTypes; import Utils.pieceUtil; import java.util.List; import static Pieces.Alliance.WHITE; public class KnightTest { public static void main(String[] args){ canMoveTest(); } private static void newLocTest(){ final Knight knight = new Knight(32, WHITE, pieceTypes.KNIGHT); List<Integer> newLocs = knight.getLegalMoves(new gameGrid()); for (int newLoc : newLocs){ System.out.print(newLoc + ", "); } } private static void canMoveTest(){ //test by make result false gameGrid g = new gameGrid(); g.emptyPiecesGrid.get(22).pieceType = pieceTypes.KNIGHT; g.emptyPiecesGrid.get(15).pieceType = pieceTypes.KNIGHT; g.emptyPiecesGrid.get(17).pieceType = pieceTypes.KNIGHT; g.emptyPiecesGrid.get(26).pieceType = pieceTypes.KNIGHT; g.emptyPiecesGrid.get(38).pieceType = pieceTypes.KNIGHT; g.emptyPiecesGrid.get(47).pieceType = pieceTypes.KNIGHT; g.emptyPiecesGrid.get(49).pieceType = pieceTypes.KNIGHT; g.emptyPiecesGrid.get(42).pieceType = pieceTypes.KNIGHT; final Knight knight = new Knight(32, WHITE, pieceTypes.KNIGHT); System.out.println(pieceUtil.canMove(knight, g)); } }
9b849c57abe24d2b19fde7f24e59018dbb10d247
addc16cc6d0e10bf98db89b195072cc477f080f4
/demoJpa/src/main/java/com/vn/validation/ReportFormValidatorImpl.java
052d4c0ce1f90ee654783b7fab9cc0589e554236
[]
no_license
duyetnguyendinh19/DuAn2
47667bac0b7e5809f74e0e0f165b48a9d0d0207f
5a57635069d30bc502fa573352ad6fc1e9c593b2
refs/heads/master
2022-12-22T21:50:58.218841
2019-12-14T02:10:17
2019-12-14T02:10:17
212,962,898
1
0
null
2022-12-16T10:32:16
2019-10-05T07:46:49
CSS
UTF-8
Java
false
false
1,984
java
package com.vn.validation; import java.util.regex.Pattern; import org.springframework.stereotype.Service; import org.springframework.validation.Errors; import org.springframework.validation.Validator; import com.vn.jpa.Report; import com.vn.validation.service.ReportFormValidator; @Service(value="reportFormValidator") public class ReportFormValidatorImpl implements Validator, ReportFormValidator { int INDEX = -1; @Override public void validateReportForm(Object var1, Errors var2) { INDEX = 1; this.validate(var1, var2); } @Override public boolean supports(Class<?> clazz) { return Report.class.equals(clazz); } @Override public void validate(Object target, Errors errors) { Report report = (Report) target; if (this.isBlank(report.getName())) { errors.reject("name", "Không được để trống tên !"); } if (this.isBlank(report.getOpinion())) { errors.reject("opinion", "Không được để trống ý kiến !"); } this.emailValidate(report.getEmail(),errors); if(INDEX == 1) { if (this.isBlank(report.getMobile())) { errors.reject("mobile", "Không được để trống số điện thoại !"); } if (this.isBlank(report.getProblem())) { errors.reject("problem", "Không được để trống vấn đề !"); } } } @Override public void validateReportFormInFooter(Object var1, Errors var2) { INDEX = 2; this.validate(var1, var2); } private boolean isBlank(String string) { return string == null || string.trim().isEmpty(); } private void emailValidate(String email, Errors errors) { String emailPattern = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; Pattern pattern = Pattern.compile(emailPattern); if (this.isBlank(email)) { errors.reject("email", "Không được để trống Email !"); } else if (!pattern.matcher(email.trim()).matches()) { errors.reject("email", "Email không đúng định dạng !"); } } }
090ac4d2059dce69decdf079eaf4567f21601325
fbe06e9322e7f8d82732fd8c04250181f9b6ef78
/android/app/src/main/java/com/harsh/MainApplication.java
2e57f8cb5be8372f26d3d3f4f5d241f2da95b397
[]
no_license
aditya-k-m/Grihfoo_Customer_UI
7d2561fe0ff1ecdd789aa6fa1b66cb54f58edd52
07eb8798b85e7dead5ccb22435e6434c7d49bf4e
refs/heads/test
2023-01-09T14:28:08.677376
2020-11-05T16:23:28
2020-11-05T16:23:28
285,267,292
0
0
null
2020-11-05T16:23:29
2020-08-05T11:23:57
JavaScript
UTF-8
Java
false
false
2,593
java
package com.harsh; import android.app.Application; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; 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()); 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, getReactNativeHost().getReactInstanceManager()); } /** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */ private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { 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.harsh.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }
03d97934a4fca2c2577471ef51113a8398339858
8819f2da81c029fcefc41b3b9ae1087b8572daa3
/src/main/wsdl/eu/x_road/us_folk_v3/producer/NameAndDateOfBirthParam.java
ce0ca618cf525352bbf0bb0562861ef458033776
[ "MIT" ]
permissive
folk-api/folk-v3-api
7ab308122286f652c35ad846f43c1ccf5bbdc114
7a0406bbe8c6ab651741a00dc73e789a32c73fdf
refs/heads/master
2021-12-03T09:40:34.456369
2021-07-09T16:11:09
2021-07-09T16:11:09
239,578,562
0
0
null
null
null
null
UTF-8
Java
false
false
2,247
java
package eu.x_road.us_folk_v3.producer; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * &lt;p&gt;Java class for NameAndDateOfBirthParam complex type. * * &lt;p&gt;The following schema fragment specifies the expected content contained within this class. * * &lt;pre&gt; * &amp;lt;complexType name="NameAndDateOfBirthParam"&amp;gt; * &amp;lt;complexContent&amp;gt; * &amp;lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&amp;gt; * &amp;lt;sequence&amp;gt; * &amp;lt;element name="name" type="{http://us-folk-v3.x-road.eu/producer}NameParam"/&amp;gt; * &amp;lt;element name="dateOfBirth" type="{http://www.w3.org/2001/XMLSchema}string"/&amp;gt; * &amp;lt;/sequence&amp;gt; * &amp;lt;/restriction&amp;gt; * &amp;lt;/complexContent&amp;gt; * &amp;lt;/complexType&amp;gt; * &lt;/pre&gt; * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "NameAndDateOfBirthParam", propOrder = { "name", "dateOfBirth" }) public class NameAndDateOfBirthParam { @XmlElement(required = true) protected NameParam name; @XmlElement(required = true) protected String dateOfBirth; /** * Gets the value of the name property. * * @return * possible object is * {@link NameParam } * */ public NameParam getName() { return name; } /** * Sets the value of the name property. * * @param value * allowed object is * {@link NameParam } * */ public void setName(NameParam value) { this.name = value; } /** * Gets the value of the dateOfBirth property. * * @return * possible object is * {@link String } * */ public String getDateOfBirth() { return dateOfBirth; } /** * Sets the value of the dateOfBirth property. * * @param value * allowed object is * {@link String } * */ public void setDateOfBirth(String value) { this.dateOfBirth = value; } }
6577778427d74b72fc0d54e10a74ef64cc470111
b060e57889f95b3f5971ef2bdf025ec8bd2b519e
/821. Shortest Distance to a Character.java
0a3ce54f56069d1795f56c596a3493633aad45bd
[]
no_license
Pudding124/LeetCode
ac90143a1c2095115cfab38cfabc2def0b71dc1d
d86360b4e2f80b6e2694a34cb6c862f36b395844
refs/heads/main
2023-08-02T06:52:01.144295
2021-09-13T13:59:24
2021-09-13T13:59:24
313,808,404
0
0
null
null
null
null
UTF-8
Java
false
false
1,526
java
class Solution { public int[] shortestToChar(String s, char c) { /* * 先將所有尋找的詞彙定義為 0,其餘都是 -1 * 之後從 0 開始往旁邊擴散到 -1 的地方,依序將擴展數字變大 * 最後當全部都不是 -1 後,即可回傳結果 */ int[] result = new int[s.length()]; for(int i = 0;i<result.length;i++) { result[i] = -1; } int index = s.indexOf(String.valueOf(c)); while(index >= 0) { result[index] = 0; index = s.indexOf(String.valueOf(c), index + 1); } int count = 0; while(true) { boolean flag = true; for(int i = 0;i<result.length;i++) { /* * 當前值為 -1 時,查看前後是否有非 -1,且為當前可被擴展之數字(避免持續變大) * 就可以將 -1 轉為被擴展數字 +1 */ if(result[i] == -1) { if((i-1) >= 0 && result[i-1] != -1 && result[i-1] == count) { result[i] = result[i-1]+1; flag = false; } else if((i+1) < result.length && result[i+1] != -1 && result[i+1] == count) { result[i] = result[i+1]+1; flag = false; } } } count++; if(flag) break; } return result; } }
bfdfdccb16193e99acbda48059073e46bfeee52b
b62cfc01b1eff2efb3068628f0c7666f7e8df3d8
/src/main/java/org/upiita/spring/controladores/LoginControlador.java
5ee1a2b2dcb8ce4491b8219ddf87d6a282a3054f
[]
no_license
shomares/blog_spring
e31c3cabbfe5d63d381b79e364bc5abc92d3eeb5
aa9be8eb3e31e3c710eacd9361ecb0bd9859bca6
refs/heads/master
2021-01-20T11:35:51.562027
2014-07-05T17:49:15
2014-07-05T17:49:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,162
java
package org.upiita.spring.controladores; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.upiita.spring.formas.FormaSession; @Controller //@Scope ("request") public class LoginControlador { @Autowired private FormaSession formaSesion; @RequestMapping(value="/login") public String login(@RequestParam(required = false) Boolean errorLogin, Model modelo, HttpSession sesion){ System.out.println("LOGIN ENTRANDO"); modelo.addAttribute("errorLogin", errorLogin); sesion.setAttribute("variable", 10); formaSesion.setItemsComprados(10); return "login"; } @RequestMapping(value="/error403") public String error403(Authentication authentication, Model modelo) { System.out.println("Nombre: " + authentication.getName()); modelo.addAttribute("email", authentication.getName()); return "error-403"; } }
8cb0464c5b31b6d52ddec1942e89dac460bddebb
235600e95ea0c095acb3c7c6a464aebc250d34af
/app/src/main/java/com/ndroidlite/player/loader/SortedLongCursor.java
fca2a6b714b673f4cae6495e3bb26869ba8fcdfb
[]
no_license
Androlite/Player
ce6bebb63f86bb6668bfafa0098bd9ae5ba8562c
a7eb996624f9eca36e0c4b3bfbc48604bd26270b
refs/heads/master
2020-12-02T18:18:13.209223
2017-12-08T11:38:42
2017-12-08T11:38:42
96,511,054
0
0
null
null
null
null
UTF-8
Java
false
false
5,199
java
package com.ndroidlite.player.loader;/* * Copyright (C) 2014 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.database.AbstractCursor; import android.database.Cursor; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; /** * This cursor basically wraps a song cursor and is given a list of the order of the ids of the * contents of the cursor. It wraps the Cursor and simulates the internal cursor being sorted * by moving the point to the appropriate spot */ public class SortedLongCursor extends AbstractCursor { // cursor to wrap private final Cursor mCursor; // the map of external indices to internal indices private ArrayList<Integer> mOrderedPositions; // this contains the ids that weren't found in the underlying cursor private ArrayList<Long> mMissingIds; // this contains the mapped cursor positions and afterwards the extra ids that weren't found private HashMap<Long, Integer> mMapCursorPositions; /** * @param cursor to wrap * @param order the list of unique ids in sorted order to display * @param columnName the column name of the id to look up in the internal cursor */ public SortedLongCursor(final Cursor cursor, final long[] order, final String columnName) { mCursor = cursor; mMissingIds = buildCursorPositionMapping(order, columnName); } /** * This function populates mOrderedPositions with the cursor positions in the order based * on the order passed in * * @param order the target order of the internal cursor * @return returns the ids that aren't found in the underlying cursor */ @NonNull private ArrayList<Long> buildCursorPositionMapping(@Nullable final long[] order, final String columnName) { ArrayList<Long> missingIds = new ArrayList<>(); mOrderedPositions = new ArrayList<>(mCursor.getCount()); mMapCursorPositions = new HashMap<>(mCursor.getCount()); final int idPosition = mCursor.getColumnIndex(columnName); if (mCursor.moveToFirst()) { // first figure out where each of the ids are in the cursor do { mMapCursorPositions.put(mCursor.getLong(idPosition), mCursor.getPosition()); } while (mCursor.moveToNext()); // now create the ordered positions to map to the internal cursor given the // external sort order for (int i = 0; order != null && i < order.length; i++) { final long id = order[i]; if (mMapCursorPositions.containsKey(id)) { mOrderedPositions.add(mMapCursorPositions.get(id)); mMapCursorPositions.remove(id); } else { missingIds.add(id); } } mCursor.moveToFirst(); } return missingIds; } /** * @return the list of ids that weren't found in the underlying cursor */ public ArrayList<Long> getMissingIds() { return mMissingIds; } /** * @return the list of ids that were in the underlying cursor but not part of the ordered list */ @NonNull public Collection<Long> getExtraIds() { return mMapCursorPositions.keySet(); } @Override public void close() { mCursor.close(); super.close(); } @Override public int getCount() { return mOrderedPositions.size(); } @Override public String[] getColumnNames() { return mCursor.getColumnNames(); } @Override public String getString(int column) { return mCursor.getString(column); } @Override public short getShort(int column) { return mCursor.getShort(column); } @Override public int getInt(int column) { return mCursor.getInt(column); } @Override public long getLong(int column) { return mCursor.getLong(column); } @Override public float getFloat(int column) { return mCursor.getFloat(column); } @Override public double getDouble(int column) { return mCursor.getDouble(column); } @Override public boolean isNull(int column) { return mCursor.isNull(column); } @Override public boolean onMove(int oldPosition, int newPosition) { if (newPosition >= 0 && newPosition < getCount()) { mCursor.moveToPosition(mOrderedPositions.get(newPosition)); return true; } return false; } }
37db77d1a467204207c68afe748617655f78da60
b16855879f38378a2d1cb3e5b66697e6b2fa582a
/src/map/Map.java
70f84057c3ac2b014330cd38a63076add94e714f
[]
no_license
dDevTech/SpaceGame2D
a447ba5af501312b3b4f33bd46251a8923bcebea
4922dc0cc4d457bfbbe72da7c0252deda082ca0f
refs/heads/master
2020-03-16T03:24:45.551358
2018-10-03T16:36:05
2018-10-03T16:36:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,583
java
package map; import java.awt.Color; import java.awt.Graphics; import constants.Constants; import enemigos.Enemigo; import enemigos.EnemigoEspecial; import ia.IAGenerator; import juegoEspacio.GameHandler; import juegoEspacio.Ventana; import mapGenerator.Vec2; public class Map { int widthMap; int heightMap; int initialX; int initialY; public Map() { } public void pintarMapa(Graphics g) { int variacionSizeespecial = 5; int espacio = 20; int contador = 0; int sizePixels = 2; int sizeEnemies = 1; widthMap = (GameHandler.getVentana().getPanelActual().ladrillosMapa .get(GameHandler.getVentana().getPanelActual().ladrillosMapa.size() - 1).x) * sizePixels + sizePixels; heightMap = (GameHandler.getVentana().getPanelActual().ladrillosMapa .get(GameHandler.getVentana().getPanelActual().ladrillosMapa.size() - 1).y) * sizePixels + sizePixels; initialX = Ventana.screenSize.width - widthMap - espacio; initialY = espacio; g.setColor(Color.BLACK); g.fillRect(initialX, initialY, widthMap - 2, heightMap - 2); for (Vec2 v : GameHandler.getVentana().getPanelActual().ladrillosMapa) { g.setColor(v.c); if (v.isEspecial()) { g.fillOval(initialX + v.x * sizePixels - variacionSizeespecial / 2, initialY + v.y * sizePixels, sizePixels + variacionSizeespecial, sizePixels + variacionSizeespecial); } else { g.fillRect(initialX + v.x * sizePixels - variacionSizeespecial / 2, initialY + v.y * sizePixels, sizePixels, sizePixels); } contador++; } // Marco // NO FUNCIONA - rango de vista aparecer los enemigos // g.drawLine((int)(IAGenerator.mainPlayer.getX() - Ventana.screenSize.width / // 2), 20, // (int)(IAGenerator.mainPlayer.getX() - Ventana.screenSize.width / 2), 1060); // g.drawLine((int)(IAGenerator.mainPlayer.getX() + Ventana.screenSize.width / // 2), 20, // (int)(IAGenerator.mainPlayer.getX() + Ventana.screenSize.width / 2), 1060); // if ((IAGenerator.mainPlayer.getX() - Ventana.screenSize.width / 2 < e.getX() // && (IAGenerator.mainPlayer.getX() + Ventana.screenSize.width / 2) > // e.getX())) { for (Enemigo e : GameHandler.getVentana().getPanelActual().enemigos) { dibujarEnemigoEnMapa(e, initialX, initialY, sizePixels, widthMap, heightMap, sizeEnemies, g); } dibujarCamara(g, initialX, initialY, sizePixels, widthMap, heightMap); } public void dibujarEnemigoEnMapa(Enemigo e, int initialX, int initialY, int sizePixels, int widthMap, int heightMap, int sizeEnemies, Graphics g) { if (e instanceof EnemigoEspecial) { EnemigoEspecial ee = (EnemigoEspecial) e; for (Enemigo eee : ee.hijos) { g.setColor(eee.getC()); g.fillRect( (int) (initialX + GameHandler.getVentana().getPanelActual().enemigosMapa.get(e).x + eee.getAncho() * sizePixels + e.getVx() / widthMap), (int) (initialY + GameHandler.getVentana().getPanelActual().enemigosMapa.get(e).y * sizePixels + e.getVy() / heightMap), (int) (sizeEnemies), (int) (sizeEnemies)); } } else { g.setColor(e.getC()); g.fillRect( (int) (initialX + GameHandler.getVentana().getPanelActual().enemigosMapa.get(e).x * sizePixels + e.getVx() / widthMap), (int) (initialY + GameHandler.getVentana().getPanelActual().enemigosMapa.get(e).y * sizePixels + e.getVy() / heightMap), (int) (sizeEnemies), (int) (sizeEnemies)); } } public void dibujarCamara(Graphics g, int initialX, int initialY, int sizePixels, int widthMap, int heightMap) { float visibleMapX = Ventana.screenSize.width / (float) Constants.sizeBlocks * sizePixels; float visibleMapY = Ventana.screenSize.height / (float) Constants.sizeBlocks * sizePixels; float xMapPlayer = (initialX + (int) (sizePixels * (IAGenerator.mainPlayer.realXPlayerCoordinate / ((float) Constants.sizeBlocks))) + (IAGenerator.mainPlayer.getX()) / (float) Constants.sizeBlocks * sizePixels - visibleMapX / 2f); float yMapPlayer = (initialY + (int) (sizePixels * (IAGenerator.mainPlayer.realYPlayerCoordinate / ((float) Constants.sizeBlocks))) + (IAGenerator.mainPlayer.getY()) / (float) Constants.sizeBlocks * sizePixels - visibleMapY / 2f); float widthMapPlayer = 3;// not real float heightMapPlayer = 3;// not real g.setColor(Color.gray); g.drawRect((int) xMapPlayer, (int) yMapPlayer, (int) visibleMapX, (int) visibleMapY); g.setColor(Color.WHITE); g.fillOval((int) (xMapPlayer + visibleMapX / 2 - widthMapPlayer / 2), (int) (yMapPlayer + visibleMapY / 2 - heightMapPlayer / 2), (int) widthMapPlayer, (int) heightMapPlayer); } }
7bd89e1e28f1927547d09aa7b0db8cac853341af
57e451b7a1338dc26016fe9fb32abd512e99ccfb
/src/main/java/com/stocks/technical/core/api/quandl/java/query/MetadataQuery.java
4b5c0b0b703635afdcfc866ced0d71d96c9fa7e7
[]
no_license
IvanNikolaychuk/expert-octo-parakeet
ee13a743fc09d7183c8eb69973fff53ba08e267c
d765c89c3944d33ded74b597ee81c8585960439c
refs/heads/master
2021-01-09T05:36:26.820287
2017-09-22T04:37:34
2017-09-22T04:37:34
80,801,688
0
0
null
null
null
null
UTF-8
Java
false
false
684
java
package com.stocks.technical.core.api.quandl.java.query; import com.google.common.collect.ImmutableMap; import java.util.Map; import static com.google.common.base.Preconditions.checkNotNull; /** * Represents a MetadataQuery to get metadata about * a Quandl dataset. * * @author Michael Diamond * @since 2014-6-6 */ public class MetadataQuery implements Query { private final String qCode; /*package*/ public MetadataQuery(String qCode) { this.qCode = checkNotNull(qCode); } public String getQCode() { return qCode; } @Override public Map<String, String> getParameterMap() { return ImmutableMap.of(); } }
ada557c6e818ec4850c9f33c803eab8508fb2a51
43c1102f8fc4807c21b3907aad4d5b67927775e0
/IdeaProjects/Week1day3_4/src/Author.java
0445543d08b9a9f9166793d6d7cc5477777e0f74
[]
no_license
cb-surendra/SERVLETS
1a158481660ba002450b21e99460b9d161ec5c58
9f5af2a2ce2690f9d4cccc1bee1a0ef02a6e9939
refs/heads/master
2022-12-15T08:46:11.821638
2019-07-23T10:32:57
2019-07-23T10:32:57
197,553,212
0
0
null
2022-12-10T22:50:33
2019-07-18T09:12:22
Java
UTF-8
Java
false
false
586
java
public class Author { String name; String email; char gender; public Author(String name, String email, char gender) { this.name = name; this.email = email; this.gender = gender; } public String getName() { return name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public char getGender() { return gender; } public String toDisplay(){ return this.name + " " + this.gender + " at " + this.email; } }
[ "surendra.p@chargebee" ]
surendra.p@chargebee
84fa03d5d8738b850831bc8f3e66f18cf67d6228
41f3226ef7d8b7ef0eea049b1c81e0c7d133baea
/app/build/generated/source/buildConfig/androidTest/debug/com/marix/ekonomnoclub/test/BuildConfig.java
9189199668d80282d12ddeb6749e82c834e06195
[]
no_license
lolMatrix/svetofor
03a5a6d9d4e762c1699235563382f15b8d7cfb7b
fef5afc408d1ea39fe8a7df2b9e16428a37ea86d
refs/heads/master
2020-12-19T03:26:05.050282
2020-01-22T15:53:01
2020-01-22T15:53:01
235,606,303
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
/** * Automatically generated file. DO NOT MODIFY */ package com.marix.ekonomnoclub.test; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.marix.ekonomnoclub.test"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
badf7ac3af82ceaa4a5993a09e5c5f1202f836eb
f4cf913a318c103c5b4ccfe98cda30edfb0cee25
/hanjin/src/com/hanjin/dao/GwMailMailCountDAO.java
d2b8e1c3c8ece8b73ab6fab5ca5844c723a0afd6
[]
no_license
aberde/aberdevine
5a7304df207b056ab971631f3253f051ab3ba3b5
c1f247eaada64b538c8688fb5a39da24bb76489e
refs/heads/master
2022-12-22T22:25:11.928400
2019-10-27T13:24:48
2019-10-27T13:24:48
43,434,091
0
0
null
2022-12-16T00:48:56
2015-09-30T13:21:07
PLSQL
UHC
Java
false
false
1,324
java
package com.hanjin.dao; import java.net.URLEncoder; import java.util.Map; import com.hanjin.bean.GwMailMailCountBean; import com.hanjin.cmm.HanjinServerURL; import com.hanjin.cmm.ReadXml; import com.hanjin.cmm.URLConnection; public class GwMailMailCountDAO { /** * GW Mail 읽지 않은 메일수 * @param MailId 사용자아이디 * @param MailPassword 사용자비밀번호 * @return 읽지 않은 메일수 * @throws Exception */ public GwMailMailCountBean getGwMailMailCount(String MailId, String MailPassword) throws Exception { GwMailMailCountBean bean = new GwMailMailCountBean(); String url = HanjinServerURL.GW_MAIL_MAILCOUNT_URL; String data = "MailId=" + URLEncoder.encode(MailId, "UTF-8") + "&MailPassword=" + URLEncoder.encode(MailPassword, "UTF-8") + "&ServerVersion=Exchange2010" + "&ServiceUrl=" + URLEncoder.encode("http://exchange.hanjin.com/ews/exchange.asmx", "UTF-8") + "&BoxName=InBox" + "&function=MailCount"; Map<String, String> retValue = URLConnection.getURLConnection(url, data, ""); GwMailMailCountBean.Result result = new GwMailMailCountBean.Result(); result = (GwMailMailCountBean.Result)ReadXml.getStringXMLtoObject(retValue.get("responseText"), result); bean.setResult(result); return bean; } }
1aa3ccebeda51d801466a78889efa8efdeb3f5c2
0eb2efa85aa9b9920fbfff268afc4c5a67fcabe0
/jack/javabase/src/main/java/com/tntcpu/javabase/tij/concurrency/example/SingleThreadExecutor.java
1c105af470a7c4b3b060789aa446b8bb0182dcc1
[]
no_license
tntcpu/firefly
2b8dcc9a1829792a6351487ef3db4dadd9e281df
56e2b978ad60e8059c69aba50b28cfddc0234b4f
refs/heads/master
2022-07-01T20:12:03.429208
2020-03-14T13:06:15
2020-03-14T13:06:15
187,453,522
1
0
null
2022-06-17T02:49:52
2019-05-19T08:46:03
Java
UTF-8
Java
false
false
466
java
package com.tntcpu.javabase.tij.concurrency.example; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; /** * @program: firefly * @description: * @author: ZhangZhentao * @create: 2019-07-24 **/ public class SingleThreadExecutor { public static void main(String[] args) { ExecutorService exec = Executors.newSingleThreadExecutor(); for (int i = 0; i < 5; i++) { exec.execute(new LiftOff()); } exec.shutdown(); } }
384dc8fc9b9a8c2220774ffb8ccb77044a02b28b
f1f6ea355b8c41bdaa4dfc563a13a901e6dbc64f
/src/main/java/br/com/zupacademy/caio/casadocodigo/controller/LivroBuscarController.java
187d8c50e57aef030e4cde82a68c4602434ffd58
[ "Apache-2.0" ]
permissive
zcaiobs/orange-talents-04-template-casa-do-codigo
4fe9a9ddbae143dd1d64e5daef12695a5ee5c504
bb9a12709a977cc2195c46bfecd46895083c4b47
refs/heads/main
2023-04-23T23:38:57.492053
2021-05-06T23:52:08
2021-05-06T23:52:08
360,521,672
0
0
Apache-2.0
2021-04-22T13:04:48
2021-04-22T13:04:48
null
UTF-8
Java
false
false
1,926
java
package br.com.zupacademy.caio.casadocodigo.controller; import br.com.zupacademy.caio.casadocodigo.domain.LivroDetalhesResponse; import br.com.zupacademy.caio.casadocodigo.domain.LivroListarResponse; import br.com.zupacademy.caio.casadocodigo.exception.ExeceptionNotFound; import br.com.zupacademy.caio.casadocodigo.repository.LivroRepository; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.format.annotation.NumberFormat; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @RestController @RequestMapping("/api") public class LivroBuscarController { private final Logger logger = LoggerFactory.getLogger(LivroBuscarController.class); private final LivroRepository livroRepository; LivroBuscarController(LivroRepository livroRepository) { this.livroRepository = livroRepository; } @GetMapping("/livros") @Cacheable(value = "listarLivros") public ResponseEntity<Page<LivroListarResponse>> listar(@PageableDefault Pageable pageable) { return ResponseEntity.ok().body(LivroListarResponse.converter(livroRepository.findAll(pageable))); } @GetMapping("/livros/{id}") @Cacheable(value = "exibirLivro") public ResponseEntity<?> exibirDetalhes(@PathVariable @NumberFormat Long id) throws ExeceptionNotFound { var livro = livroRepository.findById(id).orElseThrow(ExeceptionNotFound::new); return ResponseEntity.ok().body(LivroDetalhesResponse.converter(livro)); } }
d4e56c536ec128bb333ef652f5aedbc6bfd54936
25633f4b75e8f9ab9e5d713aa01c46d63158e86e
/src/main/java/com/controller/MedicineController.java
2a2b995defb6870304164b4b46e1d30a5fcd436a
[]
no_license
deveshsheth/HealthAssistAPI
2adfebe8c6d3bbed9c10879a34a6560362ca6a75
897e32be4d2b6a4dfa42a841317e761f0a45f4b4
refs/heads/master
2023-04-14T21:03:59.490089
2021-04-19T02:17:59
2021-04-19T02:17:59
302,955,881
0
0
null
null
null
null
UTF-8
Java
false
false
2,735
java
package com.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import com.bean.MedicineBean; import com.bean.ResponseBean; import com.dao.MedicineDao; @CrossOrigin @RestController public class MedicineController { @Autowired MedicineDao medicineDao; @PostMapping("/addMedicine") public ResponseBean<MedicineBean> addMedicine(@RequestBody MedicineBean medicineBean){ medicineDao.addMedicine(medicineBean); ResponseBean<MedicineBean> responseBean = new ResponseBean<>(); responseBean.setData(medicineBean); responseBean.setMsg("Medicine Added!!"); responseBean.setStatus(200); return responseBean; } @GetMapping("/listMedicine") public ResponseBean<List<MedicineBean>> listMedicine(){ List<MedicineBean> medicineBean = medicineDao.listMedicine(); ResponseBean<List<MedicineBean>> responseBean = new ResponseBean<>(); responseBean.setData(medicineBean); responseBean.setMsg("Medicine List!!"); responseBean.setStatus(200); return responseBean; } @PutMapping("/updateMedicine") public ResponseBean<MedicineBean> updateMedicine(@RequestBody MedicineBean medicineBean){ medicineDao.updateMedicine(medicineBean); ResponseBean<MedicineBean> responseBean = new ResponseBean<>(); responseBean.setData(medicineBean); responseBean.setMsg("Medicine Updated!!"); responseBean.setStatus(200); return responseBean; } @GetMapping("/getMedicine/{medicineid}") public ResponseBean<MedicineBean> getUser(@PathVariable("medicineid") int medicineid, MedicineBean bean) { ResponseBean<MedicineBean> responseBean = new ResponseBean<>(); bean = medicineDao.getMedicineById(medicineid); responseBean.setData(bean); responseBean.setMsg("Single Medicine Return"); responseBean.setStatus(200); return responseBean; } @DeleteMapping("/deleteMedicine/{medicineid}") public ResponseBean<MedicineBean> deleteMedicine(@PathVariable("medicineid") int medicineid){ medicineDao.deleteMedicine(medicineid); ResponseBean<MedicineBean> responseBean = new ResponseBean<>(); responseBean.setMsg("Medicine Deleted!!"); responseBean.setStatus(200); return responseBean; } }
0def6dc1d1f5773d8ed73a612987561a36cfd6e9
fd6ea9ed877f8161ec1873254b19078ba3e53e43
/autoflash/autoflash/rpc/slice/DepotQueryConditionHolder.java
36e4fc298cedd2c9d2936fcaea9e18af54a01f0c
[]
no_license
chaitanyawagle/autoflash
d0a56f5c4528d3078fe3b79732657798a2399b6d
142353e88d3fb26fe903244fc9b87e87e598596b
refs/heads/master
2021-01-01T04:25:16.125412
2016-10-01T04:50:36
2016-10-01T04:50:36
56,135,662
0
0
null
null
null
null
UTF-8
Java
false
false
673
java
// ********************************************************************** // // Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** // Ice version 3.2.1 package autoflash.rpc.slice; public final class DepotQueryConditionHolder { public DepotQueryConditionHolder() { } public DepotQueryConditionHolder(DepotQueryCondition value) { this.value = value; } public DepotQueryCondition value; }
[ "fankaicn@3d12cfbe-d23c-0410-a93a-b1ce904c0fb3" ]
fankaicn@3d12cfbe-d23c-0410-a93a-b1ce904c0fb3
f469a43add8164ab919760f77d6cfbf229e7c8ab
620b7ba03ec676053a185cb695adc2c333027ac6
/src/main/java/com/QuickStartFrame/management/util/DateUtil.java
f86b4b8cc94b6eedcda5f1a4e9d1fa431b242d36
[ "Apache-2.0" ]
permissive
fyg0424/quickStartFrame
dc3e00303c9dfc0ae259e8cce35be27d4fd0acb2
644d62f45217580ae80b3ce6b274a228b7890d10
refs/heads/master
2020-07-27T14:42:34.934842
2017-04-26T14:06:45
2017-04-26T14:06:45
67,107,338
1
1
null
null
null
null
UTF-8
Java
false
false
2,270
java
package com.QuickStartFrame.management.util; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import org.apache.log4j.Logger; public class DateUtil { private static final Logger logger = Logger.getLogger(DateUtil.class); private static final String[] WEEKDAYS_CN = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; private static final String[] WEEKDAYS_EN = {"sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"}; public static String getENWeekDay() { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); int w = cal.get(Calendar.DAY_OF_WEEK) - 1; if (w < 0) w = 0; return WEEKDAYS_EN[w]; } public static String getCNWeekDay() { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); int w = cal.get(Calendar.DAY_OF_WEEK) - 1; if (w < 0) w = 0; return WEEKDAYS_CN[w]; } public static String getCurrentHour() { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); return String.valueOf(cal.get(Calendar.HOUR_OF_DAY)); } public static String getBeforeOneHour() { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); return String.valueOf(cal.get(Calendar.HOUR_OF_DAY) == 0 ? 23 : cal.get(Calendar.HOUR_OF_DAY) - 1); } public static String formatDate(Date date) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String format = sdf.format(date); return format; } public static int computeElapsetime(String departureTime, String arrivalTime) { int elapsetime = 0; try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date departureDate = sdf.parse(departureTime); Date arrivalDate = sdf.parse(arrivalTime); elapsetime = (int)(arrivalDate.getTime() - departureDate.getTime()) / (1000 * 60); } catch (Exception e) { logger.warn("时间转换异常", e); } return elapsetime; } public static void main(String[] args) { String departureTime = "2016-03-27 12:00:00:00"; String arrivalTime = "2016-03-27 15:10:00:12"; System.out.println(computeElapsetime(departureTime, arrivalTime)); } }
ada5fa2dc2bbf81aacdcb33fc7d8d6c6ae866861
5af72d63b2e430514c31e0d0124430b5534d7b83
/demo/src/main/java/com/example/demo/mutilpletask/example/SaveProcessor.java
70522daf81fb9feb34d5c9f002d3b06dbee0cf2f
[]
no_license
chonger2017/mystudy
0024dee0ccd8da453c3301420d2f02e16e89743f
4c65c81dd7c67343508f3ede9a1334b086303e87
refs/heads/master
2022-07-11T16:19:27.016855
2020-12-22T16:21:22
2020-12-22T16:21:22
187,059,541
0
0
null
null
null
null
UTF-8
Java
false
false
698
java
package com.example.demo.mutilpletask.example; import java.util.concurrent.LinkedBlockingQueue; public class SaveProcessor extends Thread implements RequestProcessor { LinkedBlockingQueue<Request> linkedBlockingQueue = new LinkedBlockingQueue<>(); @Override public void run() { while (true){ try { Request request = linkedBlockingQueue.take(); System.out.println("save data : "+ request.getName()); } catch (InterruptedException e) { e.printStackTrace(); } } } @Override public void processorRequest(Request request) { linkedBlockingQueue.add(request); } }
0a8455331d6493e7cc3c1c236aa83584488e6426
c088468b08ae9eba30a9b050beb985c3775caaf0
/ee_t03_pilasycolas/src/ee_t03_pilasycolas/ListaLigada.java
8a308a7fa11e47b34601eaf7059fb14034edbd38
[]
no_license
5h33n/ee_t03_pilasycolas
22c5f5ffff91b58d02dcd186bb0f36bd3b553fa1
22ad97105e142796655187515468d3e9b32f02e2
refs/heads/master
2021-01-17T17:11:28.404296
2016-09-28T15:08:51
2016-09-28T15:08:51
68,670,931
0
0
null
null
null
null
ISO-8859-1
Java
false
false
2,511
java
package ee_t03_pilasycolas; /** * Esta clase se encarga de generar y gestionar listas ligadas de un tipo dado * @author Oscar Eduardo López Guzmán (Sheen) * 22/09/2016 * @param <T> Tipo de dato que definirá de qué tipo será la lista ligada */ public class ListaLigada<T>{ /** * Se crea una varíable inicio de tipo nodo */ private Nodo<T> inicio; /** * Getter de inicio * @return Devuelve un dato de tipo nodo */ public Nodo<T> getInicio(){ return inicio; } /** * Setter de Inicio * @param inicio de tipo nodo */ public void setInicio(Nodo<T> inicio){ this.inicio=inicio; } /** * Método que recorre los elementos de una lista ligada dada * @param n es un nodo auxiliar */ public void recorrer(Nodo<T> n){ if(n!=null){ System.out.println(n.getDato()+"-->"); recorrer(n.getSiguiente()); }else{ System.out.println("."); } } /** * Este método inserta un dato, en un nodo al inicio de la lista ligada * @param dato El dato que se insertará */ public void insertaInicio(T dato){ Nodo<T> n=new Nodo<T>(dato); n.setSiguiente(inicio); inicio=n; } /** * Este método inserta un dato, en un nodo al inicio de la lista ligada * @param dato El dato que se insertará */ public void insertaFinal(T dato){ Nodo<T> n = new Nodo<T>(dato); Nodo<T> aux=inicio; while(aux.getSiguiente()!=null){ aux=aux.getSiguiente(); } aux.setSiguiente(n); } /** * Este metodo, inserta un dato antes de otro especificado * @param r el dato antes del cual se insertará * @param dato el dato que se insertará */ public void insertaAntesDe(T r,T dato){ Nodo<T> n=new Nodo<T>(dato); Nodo<T> aux=inicio; Nodo<T> aux2=inicio; while(aux.getSiguiente()!=null){ if(aux==inicio && aux.getDato().equals(r)){ this.insertaInicio(dato); } aux=aux.getSiguiente(); if(aux.getDato().equals(r)){ aux2.setSiguiente(n); n.setSiguiente(aux); }else{ aux2=aux; } } } /** * Método toString modificado */ public String toString(){ String s=""; Nodo<T> n=inicio; while(n!=null){ s+=(n.getDato()+" -->"); n=n.getSiguiente(); }s+="."; return s; } }
e978e4e579029e0a0a47c4f8d32e49a783d9848c
c822930d117304feb320841397580ed4ada94251
/library-demonstrate/src/main/java/com/example/demonstrate/DialogPage.java
0bf846264db697364aec6f0d89b006d409ebe697
[]
no_license
AsaLynn/TestWeek0404
a4bfb3fa467ad5bdd8ca880f20b6d2b83e1532d0
d6f59dcc8f4c625a54d830f927101631b537f8a3
refs/heads/master
2022-01-08T11:39:02.758502
2019-07-06T02:37:53
2019-07-06T02:37:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,909
java
package com.example.demonstrate; import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; /** * Created by think on 2018/3/8. */ public class DialogPage implements DialogInterface.OnClickListener { private Activity mActivity; private String[] items; protected static DialogPage mDialogPage; private OnDialogItemListener mOnPageItemListener; private OnDialogItemNorListener mOnDialogItemNorListener; protected DialogPage() { } public static DialogPage getInstance() { if (null == mDialogPage) { synchronized (DialogPage.class) { if (null == mDialogPage) { mDialogPage = new DialogPage(); } } } return mDialogPage; } @Override public void onClick(DialogInterface dialog, int which) { if (null == mOnPageItemListener) { DemonstrateUtil.showLogResult("未设置对话框列表监听!!!"); return; } if (mOnPageItemListener.getStartActivity(which) == null) { DemonstrateUtil.showToastResult(mOnPageItemListener.getActivity(), "请设置要跳转的Activity!!!"); return; } mOnPageItemListener .getActivity() .startActivity(new Intent(mOnPageItemListener.getActivity(), mOnPageItemListener.getStartActivity(which))); } public interface OnDialogItemListener { Activity getActivity(); String getTitle(); Class<?> getStartActivity(int which); int getDialogListId(); } public void setOnDialogItemListener(OnDialogItemListener listener) { mOnPageItemListener = listener; if (null == mOnPageItemListener) { return; } if (mOnPageItemListener.getActivity() == null) { return; } if (null == items) { items = mOnPageItemListener.getActivity().getResources().getStringArray(mOnPageItemListener.getDialogListId());/*R.array.items*/ } DialogUtil.showListDialog(mOnPageItemListener.getActivity(), mOnPageItemListener.getTitle(), items, mDialogPage); } public void setOnDialogItemNorListener(Activity activity, OnDialogItemNorListener listener) { mOnDialogItemNorListener = listener; if (null == mOnDialogItemNorListener) { return; } DialogUtil.showListDialog(activity, mOnDialogItemNorListener.titile(), mOnDialogItemNorListener.items(), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { mOnDialogItemNorListener.listDialog(which); } }); } public interface OnDialogItemNorListener { void listDialog(int which); String titile(); String[] items(); } }
3b9ef97bc1967cb015db9cbb2556ed203a657d04
d88db7eb347ed65338a038a3da9a79ddb7fe4eac
/src/de/webis/speller/Speller.java
101c098717c68dfa1b8227c0f9f9c22a8c943dc8
[]
no_license
webis-de/SIGIR-17
6363c5e1ee993e831f240afa8847c5860b92072e
f8f6bd3ad7727be64dea4eaaca57531227fe7dac
refs/heads/master
2021-06-23T15:38:18.010877
2019-12-09T17:11:43
2019-12-09T17:11:43
93,525,214
4
2
null
null
null
null
UTF-8
Java
false
false
2,024
java
package de.webis.speller; import java.util.List; import java.util.Map; /** * An adaptable base class for spell algorithms. */ public abstract class Speller { public abstract String getSpellTag(); public abstract Map<String, Double> spell(String query); /** * Builds all possible combinations of corrections for each word of a query. * @param candidates possible corrections for each word of a query such that * its index matches the position of this word in a query * @param results list of resulting combinations * @param depth parameter for recursion, initialize with 0 * @param current parameter for recursion, initialize with empty string * @param length wanted number of words of the resulting combinations */ protected void aggregateCandidates(List<List<String>> candidates, List<String> results, int depth, String current, int length){ if(depth == candidates.size()){ if(current.trim().split(" ").length >= length) results.add(current.trim().toLowerCase()); return; } for(int i=0; i < candidates.get(depth).size(); ++i){ aggregateCandidates(candidates, results, depth +1, current +" " +candidates.get(depth).get(i), length); } } /** * Normalizes the given confidences that they add up to 1. * @param confidences map of corrections and their confidences to normalize * @return normalized map of corrections and their confidences */ protected Map<String, Double> normalize(Map<String, Double> confidences){ Double sum = 0.0; for(Map.Entry<String, Double> entry: confidences.entrySet()){ sum += entry.getValue(); } for(Map.Entry<String, Double> entry: confidences.entrySet()){ entry.setValue(entry.getValue() / sum); } return confidences; } public abstract void flush(); public abstract void close(); }
52b4e74969a0de40a92cf620381f30e6f316459f
ce6410b9428ac0562eba698284f0337e5e2cdbb2
/appdemo/src/main/java/com/qiyei/appdemo/activity/ViewPagerTestActivity.java
0b6a5a39ccde284699d86f4a38b356507523aea8
[]
no_license
xioawuxioawu/EssayJoke
6a1a8f1b8b3011eef6793df51b9ebf6262bf223b
c11cce16dc15c88b54c344d3baa47101297d60ee
refs/heads/master
2021-05-15T09:56:20.755132
2017-10-18T13:35:07
2017-10-18T13:35:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,532
java
package com.qiyei.appdemo.activity; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TextView; import com.qiyei.framework.activity.BaseSkinActivity; import com.qiyei.framework.titlebar.CommonTitleBar; import com.qiyei.sdk.log.LogManager; import com.qiyei.sdk.util.ToastUtil; import com.qiyei.sdk.view.ColorTrackTextView; import com.qiyei.sdk.view.IndicatorView.IndicatorAdapter; import com.qiyei.sdk.view.IndicatorView.IndicatorView; import java.util.ArrayList; import java.util.List; import com.qiyei.appdemo.R; import com.qiyei.appdemo.fragment.ItemFragment; public class ViewPagerTestActivity extends BaseSkinActivity { private static final String TAG = ViewPagerTestActivity.class.getSimpleName(); private String[] items = {"直播", "推荐", "视频", "图片", "段子", "精华","段友秀", "同城", "游戏"}; //private String[] items = {"直播", "推荐", "视频"}; private IndicatorView mIndicatorView;// 变成通用的 //private List<ColorTrackTextView> mIndicators; private List<TextView> mIndicators; private ViewPager mViewPager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initContentView(); initData(); initView(); } @Override protected void initContentView() { setContentView(R.layout.activity_view_pager_test); } @Override protected void initView() { CommonTitleBar commonNavigationBar = new CommonTitleBar.Builder(this) .setTitle("主界面") .setRightText("投稿") .setRightClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ToastUtil.showLongToast("点击了右边"); } }) .build(); mIndicatorView = (IndicatorView) findViewById(R.id.indicator_view); mViewPager = (ViewPager) findViewById(R.id.view_pager); initViewPager(); } @Override protected void initData() { mIndicators = new ArrayList<>(); //initIndicator(); } @Override public void onClick(View v) { } /** * 初始化ViewPager */ private void initViewPager() { mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) { @Override public Fragment getItem(int position) { return ItemFragment.newInstance(items[position]); } @Override public int getCount() { return items.length; } @Override public void destroyItem(ViewGroup container, int position, Object object) { } }); // 监听ViewPager的滚动 mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { //滚动的过程中会不断的回掉 LogManager.e("TAG", "position --> " + position + " positionOffset --> " + positionOffset + " positionOffsetPixels --> " + positionOffsetPixels); // ColorTrackTextView left = mIndicators.get(position); // left.setDirection(ColorTrackTextView.Direction.RIGHT_TO_LEFT); // left.setCurrentProgress(1-positionOffset); // // try{ // ColorTrackTextView right = mIndicators.get(position+1); // right.setDirection(ColorTrackTextView.Direction.LEFT_TO_RIGHT); // right.setCurrentProgress(positionOffset); // }catch (Exception e){ // e.printStackTrace(); // } } @Override public void onPageSelected(int position) { // 选中毁掉 } @Override public void onPageScrollStateChanged(int state) { } }); mIndicatorView.setAdapter(new IndicatorAdapter(){ @Override public int getCount() { return items.length ; } @Override public View getView(int position, ViewGroup parent) { TextView colorTrackTextView = new TextView(ViewPagerTestActivity.this); colorTrackTextView.setWidth(400); // 设置颜色 colorTrackTextView.setTextSize(14); colorTrackTextView.setGravity(Gravity.CENTER); // colorTrackTextView.setChangeColor(Color.RED); colorTrackTextView.setText(items[position]); colorTrackTextView.setTextColor(Color.BLACK); colorTrackTextView.setBackgroundColor(Color.BLUE); int padding = 20; colorTrackTextView.setPadding(padding,padding,padding,padding); // mIndicators.add(colorTrackTextView); return colorTrackTextView; } @Override public void highLightIndicator(View view) { TextView textView = (TextView) view; textView.setTextColor(Color.RED); LogManager.d(TAG,"highLightIndicator,textView:" + Color.RED); } @Override public void restoreIndicator(View view) { TextView textView = (TextView) view; textView.setTextColor(Color.BLACK); LogManager.d(TAG,"restoreIndicator,textView:" + Color.BLACK); } @Override public View getBottomTrackView() { View view = new View(ViewPagerTestActivity.this); FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(300,50); view.setLayoutParams(params); view.setBackgroundColor(Color.GREEN); return view; } },mViewPager); } /** * 初始化可变色的指示器 */ private void initIndicator() { for (int i = 0; i < items.length; i++) { // 动态添加颜色跟踪的TextView LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.weight = 1; //params.setMargins(20,0,0,0); ColorTrackTextView colorTrackTextView = new ColorTrackTextView(this); // 设置颜色 colorTrackTextView.setTextSize(20); colorTrackTextView.setGravity(Gravity.CENTER); colorTrackTextView.setBackgroundColor(Color.BLUE); colorTrackTextView.setChangeColor(Color.RED); colorTrackTextView.setWidth(400 ); colorTrackTextView.setText(items[i]); colorTrackTextView.setLayoutParams(params); // 把新的加入LinearLayout容器 //mIndicatorView.addView(colorTrackTextView); // 加入集合 mIndicators.add(colorTrackTextView); } } }
8c7e147f318069f978f737c71e5de0667ebb3522
5401ac71a75c6d5e0d1c4063e2f042ce7381fb02
/src/main/java/cn/weforward/product/weforward/ProductServiceCodes.java
ea1d3da882d43d1c147cf6dd830ed3ec707bad24
[]
no_license
lightsx1/ljh_wf_product
b728d6ba002962dd14174bbf303c5019b5fd03d7
8044a40c261cb9fbbee6a0c923f47d0ed7d7d65e
refs/heads/master
2023-01-03T20:27:32.244472
2020-10-29T07:32:27
2020-10-29T07:32:27
308,250,497
0
0
null
null
null
null
UTF-8
Java
false
false
1,075
java
package cn.weforward.product.weforward; import org.springframework.stereotype.Component; import cn.weforward.product.TradeException; import cn.weforward.product.exception.InsufficientException; import cn.weforward.protocol.StatusCode; import cn.weforward.protocol.client.execption.MicroserviceException; import cn.weforward.protocol.support.CommonServiceCodes; /** * 产品异常码 * * @author daibo * */ @Component public class ProductServiceCodes extends CommonServiceCodes { private final static StatusCode CODE_TRADEEXCEPTION = new StatusCode(MicroserviceException.CUSTOM_CODE_START, "交易异常"); private final static StatusCode CODE_INSUFFICIENTEXCEPTION = new StatusCode( MicroserviceException.CUSTOM_CODE_START + 1, "库存不足"); static { append(CODE_TRADEEXCEPTION, CODE_INSUFFICIENTEXCEPTION); } /** * 获取错误码 * * @param e * @return */ public static int getCode(TradeException e) { if (e instanceof InsufficientException) { return CODE_INSUFFICIENTEXCEPTION.code; } return CODE_TRADEEXCEPTION.code; } }
19d487f16fab3c5f72a64f2116410b1e4fcbfe50
605de50e85d2077315a4c3ba7fbf68e8a435b55a
/array.java
b6dd1e9a71b570afb7f534eac607cc3c2926356b
[]
no_license
ritwik-pandey/Data-structure
a67014e852d9d9dddbff3b73e9c1d0a2358d7a37
0fa7e3815831e4d5e069f96b7b0ff03913b383d4
refs/heads/main
2023-04-09T20:15:52.634609
2021-04-17T21:58:22
2021-04-17T21:58:22
358,928,012
0
0
null
null
null
null
UTF-8
Java
false
false
2,456
java
import java.util.*; class array{ Scanner in = new Scanner(System.in); int[] array; int N; public static void main(String[] args){ array obj = new array(); obj.create(); int WantToContinue = 1; Scanner in1 = new Scanner(System.in); do{ System.out.println("\nEnter 1 to create a new array"); System.out.println("Enter 2 to write"); System.out.println("Enter 3 to edit the data in array"); System.out.println("Enter 4 to display the data in array"); System.out.println("Enter 5 to insert a data in array"); System.out.println("Enter 6 to see the size"); System.out.println("Enter 7 to exit"); int choice = in1.nextInt(); switch(choice){ case 1: obj.create(); break; case 2: obj.write(); break; case 3: obj.edit(); break; case 4: obj.display(); break; case 5: obj.insert(); break; case 6: obj.size(); break; case 7: obj.exit(); break; default: System.out.println("Invalid choice"); } System.out.println("\nPress 1 to continue anything else to exit"); WantToContinue = in1.nextInt(); }while(WantToContinue == 1); } void create(){ System.out.println("Enter the size of the array"); N = in.nextInt(); array = new int[N]; display(); } void write(){ System.out.println("Input:"); for(int i = 0 ; i < N ; ++i){ array[i] = in.nextInt(); } display(); } void display(){ for(int i = 0 ; i < N ; ++i){ System.out.print(array[i] + " "); } } void edit(){ System.out.println("Enter the index number"); int index = in.nextInt(); if(index > N){ System.out.println("Out of bounds"); return; } System.out.println("Enter the new data"); array[index - 1] = in.nextInt(); display(); } void insert(){ System.out.println("Enter the index number to insert"); int index = in.nextInt(); if(index > N){ System.out.println("Out of bounds"); return; } int arraycopy[] = new int [N]; for(int i = 0 ; i < N ; ++i){ arraycopy[i] = array[i]; } N = N + 1; array = new int [N]; System.out.println("Enter your data"); int data = in.nextInt(); for(int i = 0 ; i < N - 1 ; ++i){ array[i] = arraycopy[i]; } for(int i = N - 1; i > index ; --i ){ array[i] = array[i - 1]; } array[index] = data; display(); } void size(){ System.out.println(N); } void exit(){ System.out.println("Thanks for using"); System.exit(0); } }
66a52c08be06350ab221224e04acf13e938793eb
2794b849f9367f2a6343f4754d629345be9c864d
/src/GMAssignment1/analysis/surfaceAnalysis/Genus.java
af00716c3ba5c605acbdd92433f580f0ae842f68
[]
no_license
idazozo/GMAssignment
b4d1902875472b998b4fbc8f9402d4d07eb3696f
1de3ce9ce002fa6a9b269402e2763291841a9e71
refs/heads/master
2021-05-29T02:03:02.242079
2015-05-26T23:52:02
2015-05-26T23:52:02
36,126,789
0
0
null
null
null
null
UTF-8
Java
false
false
1,044
java
package GMAssignment1.analysis.surfaceAnalysis; import GMAssignment1.analysis.ModelAnalysis; import GMAssignment1.analysis.Statistics; import jv.geom.PgElementSet; import jv.project.PgJvxSrc; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; /** * Created by admin on 26/5/15. */ public class Genus implements ModelAnalysis<Integer>{ @Override public Statistics<Integer> getStatistics(PgElementSet geom) { int faceCount, edgeCount, verticesCount, genusCount; faceCount = geom.getElements().length; verticesCount = geom.getVertices().length; edgeCount = geom.getNumEdges(); genusCount = (2-verticesCount+edgeCount-faceCount) / 2; Map<Integer, List<Integer>> genus = new HashMap<>(1); List<Integer> genusList = new LinkedList<>(); genusList.add(genusCount); genus.put(0, genusList); return new Statistics<> (genus); } @Override public String getName() { return "Genus"; } }
bdf8fb48fda1fa52423cb1bb9016c2b10177102f
e7c15db85171c8c0119d6f96a08359c4dbd1ce1f
/springstandaloneapp/src/test/java/test/standaloneapp/AppTest.java
28b82d5d0bbccd97087bcf86b8f53ebbfa377c57
[]
no_license
pkarjun/standaloneapp
41da6c5a16a02cc23a7172d8dc4fd8edbccbcd9b
a0a3b4f38a2e6db81ad732c434a81df36e427596
refs/heads/master
2022-06-16T12:32:40.628873
2020-02-04T11:20:54
2020-02-04T11:20:54
238,155,091
0
0
null
2022-05-25T06:52:58
2020-02-04T08:12:39
Java
UTF-8
Java
false
false
646
java
package test.standaloneapp; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; /** * Unit test for simple App. */ public class AppTest extends TestCase { /** * Create the test case * * @param testName name of the test case */ public AppTest( String testName ) { super( testName ); } /** * @return the suite of tests being tested */ public static Test suite() { return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ public void testApp() { assertTrue( true ); } }
645313d8516d8b340fb7fff3cb2992a0f007d73d
9541ba533815c298f5e38223ddb2a812ff976cef
/src/ATCAutomation/src/uk/ac/nottingham/psyja2/ATCAutomation/tests/GridNode.java
58a6c850144266c2dcf700e17ec0da31b5e82da4
[]
no_license
JoshArgent/AutonomousAirTrafficControl
e84d59c0a1ce9f458687956f9e564c430338ac48
fbc2ab04c9717276b4339d10efd21d1c225c1aa0
refs/heads/master
2020-06-03T02:42:58.003857
2019-06-11T16:04:51
2019-06-11T16:04:51
191,401,267
0
0
null
null
null
null
UTF-8
Java
false
false
1,692
java
package uk.ac.nottingham.psyja2.ATCAutomation.tests; import java.util.ArrayList; import uk.ac.nottingham.psyja2.ATCAutomation.PathFinding.AStar; import uk.ac.nottingham.psyja2.ATCAutomation.PathFinding.Node; public class GridNode extends Node { public int x; public int y; public GridNode(int x, int y) { this.x = x; this.y = y; } @Override public double getHeuristicTo(Node node) { if(this.equals(node)) { return 1; } // Use manhatten distance GridNode gridNode = (GridNode) node; int xDif = Math.abs(gridNode.x - x); int yDif = Math.abs(gridNode.y - y); return xDif + yDif; } @Override public double getCostTo(Node node) { return getHeuristicTo(node); } @Override public String toString() { return "(" + x + ", " + y + ")"; } /* * Builds an AStar graph data structure from a int bitmap * 0's = nodes * >0 = walls */ public static GridNode[][] buildGraphFromGrid(AStar graph, int[][] grid) { GridNode[][] nodes = new GridNode[grid.length][grid[0].length]; for(int y = 0; y < grid.length; y++) { for(int x = 0; x < grid[y].length; x++) { if(grid[y][x] == 0) { nodes[y][x] = new GridNode(x, y); ArrayList<Node> connected = new ArrayList<>(); if(y - 1 >= 0 && x - 1 >= 0 && nodes[y-1][x] != null && nodes[y][x-1] != null) { connected.add(nodes[y-1][x]); connected.add(nodes[y][x-1]); } else if(y - 1 >= 0 && nodes[y-1][x] != null) { connected.add(nodes[y-1][x]); } else if(x - 1 >= 0 && nodes[y][x-1] != null) { connected.add(nodes[y][x-1]); } graph.addNode(nodes[y][x], connected); } } } return nodes; } }
80008497927f742c6c446446d2ee5ede5fa26493
a07753e644b6f6b80936a065483986c07e3f3777
/src/main/java/com/example/Test/dto/vacancyDto/UpdateVacancyDto.java
7c8d016237077e08afed1768cd7c819fd2bbde8f
[]
no_license
rysbekovaroza25/roza_r_k
42d9d52c74c777b2076847cda66517f3dda1a0f1
96096b14d98169b0993d6fc68adfe39a434c5d68
refs/heads/main
2023-07-18T08:46:55.602518
2021-08-27T19:52:28
2021-08-27T19:52:28
399,342,660
0
0
null
null
null
null
UTF-8
Java
false
false
427
java
package com.example.Test.dto.vacancyDto; import com.example.Test.enums.Requirement; import lombok.Data; import org.jetbrains.annotations.NotNull; import java.util.List; @Data public class UpdateVacancyDto { @NotNull private Long id; @NotNull private String position; @NotNull private String title; @NotNull private String description; @NotNull private List<Requirement> requirement; }
4796f6bf7589daa9ea8d65a32f865d9bc41fc1d9
f515e287525c2c159f8772e31c16fe68cd1f8782
/operators/URShift.java
3226fccd435dac9ee06377cd42c59ef508b03fb4
[]
no_license
laughfing/thinkinjava4th
535ef94b55919907ed6f2c761dff91186576043d
185a043d2a8392bd52976e3ec475b86a2a862f1a
refs/heads/master
2022-07-16T09:11:30.449544
2020-05-12T03:07:53
2020-05-12T03:07:53
261,368,039
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package Operators; public class URShift { public static void main(String[] args) { int i = -1; System.out.println(Integer.toBinaryString(i)); i >>>= 10; System.out.println(Integer.toBinaryString(i)); long l = -1; System.out.println(Long.toBinaryString(l)); l >>>= 10; System.out.println(Long.toBinaryString(l)); short s = -1; System.out.println(Integer.toBinaryString(s)); s>>>=10; System.out.println(Integer.toBinaryString(s)); byte b = -1; System.out.println(Integer.toBinaryString(b)); b>>>=10; System.out.println(Integer.toBinaryString(b)); b = -1; System.out.println(Integer.toBinaryString(b)); System.out.println(Integer.toBinaryString(b>>>10)); } }
2c246d6c53bd5a82d534453df1df17fe73a2ba80
77b388840d766bafb560c581c18b5810af99247e
/total/src/main/java/top/hiccup/jdk/container/jdk5/concurrent/ExecutorCompletionService.java
f43dd165293a0ed61063e9d3cec17b2b9743a892
[]
no_license
hiccup234/misc
859753fdbcc6ce2bf48608f6c711efc23c1e803a
262f7abb84f3a329d8b049f4ff2488ac0a061825
refs/heads/master
2023-06-23T07:20:09.060177
2022-03-24T05:41:06
2022-03-24T05:41:06
185,379,177
1
2
null
2023-06-14T22:21:27
2019-05-07T10:26:15
Java
UTF-8
Java
false
false
5,223
java
/* * @(#)ExecutorCompletionService.java 1.1 04/02/09 * * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package top.hiccup.jdk.container.jdk5.concurrent; /** * A {@link CompletionService} that uses a supplied {@link Executor} * to execute tasks. This class arranges that submitted tasks are, * upon completion, placed on a queue accessible using <tt>take</tt>. * The class is lightweight enough to be suitable for transient use * when processing groups of tasks. * * <p> * * <b>Usage Examples.</b> * * Suppose you have a set of solvers for a certain problem, each * returning a value of some type <tt>Result</tt>, and would like to * run them concurrently, processing the results of each of them that * return a non-null value, in some method <tt>use(Result r)</tt>. You * could write this as: * * <pre> * void solve(Executor e, Collection&lt;Callable&lt;Result&gt;&gt; solvers) * throws InterruptedException, ExecutionException { * CompletionService&lt;Result&gt; ecs = new ExecutorCompletionService&lt;Result&gt;(e); * for (Callable&lt;Result&gt; s : solvers) * ecs.submit(s); * int n = solvers.size(); * for (int i = 0; i &lt; n; ++i) { * Result r = ecs.take().get(); * if (r != null) * use(r); * } * } * </pre> * * Suppose instead that you would like to use the first non-null result * of the set of tasks, ignoring any that encounter exceptions, * and cancelling all other tasks when the first one is ready: * * <pre> * void solve(Executor e, Collection&lt;Callable&lt;Result&gt;&gt; solvers) * throws InterruptedException { * CompletionService&lt;Result&gt; ecs = new ExecutorCompletionService&lt;Result&gt;(e); * int n = solvers.size(); * List&lt;Future&lt;Result&gt;&gt; futures = new ArrayList&lt;Future&lt;Result&gt;&gt;(n); * Result result = null; * try { * for (Callable&lt;Result&gt; s : solvers) * futures.add(ecs.submit(s)); * for (int i = 0; i &lt; n; ++i) { * try { * Result r = ecs.take().get(); * if (r != null) { * result = r; * break; * } * } catch(ExecutionException ignore) {} * } * } * finally { * for (Future&lt;Result&gt; f : futures) * f.cancel(true); * } * * if (result != null) * use(result); * } * </pre> */ public class ExecutorCompletionService<V> implements CompletionService<V> { private final Executor executor; private final BlockingQueue<Future<V>> completionQueue; /** * FutureTask extension to enqueue upon completion */ private class QueueingFuture extends FutureTask<V> { QueueingFuture(Callable<V> c) { super(c); } QueueingFuture(Runnable t, V r) { super(t, r); } protected void done() { completionQueue.add(this); } } /** * Creates an ExecutorCompletionService using the supplied * executor for base task execution and a * {@link LinkedBlockingQueue} as a completion queue. * @param executor the executor to use * @throws NullPointerException if executor is <tt>null</tt> */ public ExecutorCompletionService(Executor executor) { if (executor == null) throw new NullPointerException(); this.executor = executor; this.completionQueue = new LinkedBlockingQueue<Future<V>>(); } /** * Creates an ExecutorCompletionService using the supplied * executor for base task execution and the supplied queue as its * completion queue. * @param executor the executor to use * @param completionQueue the queue to use as the completion queue * normally one dedicated for use by this service * @throws NullPointerException if executor or completionQueue are <tt>null</tt> */ public ExecutorCompletionService(Executor executor, BlockingQueue<Future<V>> completionQueue) { if (executor == null || completionQueue == null) throw new NullPointerException(); this.executor = executor; this.completionQueue = completionQueue; } public Future<V> submit(Callable<V> task) { if (task == null) throw new NullPointerException(); QueueingFuture f = new QueueingFuture(task); executor.execute(f); return f; } public Future<V> submit(Runnable task, V result) { if (task == null) throw new NullPointerException(); QueueingFuture f = new QueueingFuture(task, result); executor.execute(f); return f; } public Future<V> take() throws InterruptedException { return completionQueue.take(); } public Future<V> poll() { return completionQueue.poll(); } public Future<V> poll(long timeout, TimeUnit unit) throws InterruptedException { return completionQueue.poll(timeout, unit); } }
47718ed63c909a3761c5eaec5c74912f7d934c2a
385fbfd70cb9ce85cd04ae49f8da96536f679d03
/src/com/domain/Expense.java
576b28805fc74c38f8110beed57640d3769a4ddc
[]
no_license
turalf/LivingPlan
a6c7c86965970a2f3b7a98cc5c293b2b30cc6607
05911957dc4368fd174b52453dabe4eee659894b
refs/heads/master
2020-03-24T23:36:35.721950
2014-08-04T07:34:19
2014-08-04T07:34:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
703
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.domain; /** * * @author Tural */ public class Expense { private User user; private Category expenseCategory; public User getUser() { return user; } public Category getExpenseCategory() { return expenseCategory; } public void setUser(User user) { this.user = user; } public void setExpenseCategory(Category expenseCategory) { this.expenseCategory = expenseCategory; } }
7023faa85ca4e5b0b9a02428a27e52dd871fd314
0f2b07c9a670123c0f273225a75ffa29e5d3bc0f
/CallLogQuery/src/test/java/Cluster/CallLog/util/test.java
a3581722648575b0a2c4c5af096d9f21cb39ae37
[]
no_license
fangzhimeng/CallLogSytem
5b54c8780ff29b59751ed16d47f947f42fdc09f2
5a4eae205915011270e32fa74afc469c8300777b
refs/heads/master
2022-12-30T20:31:59.544408
2018-12-04T03:20:51
2018-12-04T03:20:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
54
java
package Cluster.CallLog.util; public class test { }
8269333baa56029fb08c996a293a5c40592416be
79bf3cacdf99e3a5674363f9036f5041f5412a0f
/Calendar/src/com/weiqun/customcalendar/CustomCalendar.java
0edc07742c6ae1c99e6c20c395805adaf4043fd2
[]
no_license
weimcgrady91/GN_Travel
9cc0987c35a66130ecc83a020ae0de2fbe88baf1
e69b5814ac1b8de57828b1641a694483ec10b495
refs/heads/master
2021-01-19T22:29:39.626097
2015-11-26T06:11:51
2015-11-26T06:11:51
37,298,429
0
0
null
null
null
null
UTF-8
Java
false
false
26,322
java
package com.weiqun.customcalendar; import static java.util.Calendar.DATE; import static java.util.Calendar.DAY_OF_MONTH; import static java.util.Calendar.DAY_OF_WEEK; import static java.util.Calendar.HOUR_OF_DAY; import static java.util.Calendar.MILLISECOND; import static java.util.Calendar.MINUTE; import static java.util.Calendar.MONTH; import static java.util.Calendar.SECOND; import static java.util.Calendar.YEAR; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import android.annotation.SuppressLint; import android.content.Context; import android.os.Parcelable; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.AttributeSet; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.weiqun.customcalendar.MonthCellDescriptor.RangeState; public class CustomCalendar extends LinearLayout { private Context context; private View wei_Calendar; private TextView tv_title; private LinearLayout ll_weekTitle; private DateFormat monthNameFormat; private DateFormat weekdayNameFormat; @SuppressLint("NewApi") public CustomCalendar(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public CustomCalendar(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; wei_Calendar = LayoutInflater.from(context).inflate(R.layout.calendar, this, true); } public CustomCalendar(Context context) { super(context); } @Override protected void onFinishInflate() { super.onFinishInflate(); RelativeLayout rl_title = (RelativeLayout) wei_Calendar.findViewById(R.id.rl_title); rl_title.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub } }); tv_title = (TextView) wei_Calendar.findViewById(R.id.tv_title); ll_weekTitle = (LinearLayout) findViewById(R.id.ll_weekTitle); ll_weekTitle.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub } }); // mVerticalViewPager = (VerticalViewPager) wei_Calendar.findViewById(R.id.pager); mVerticalViewPager = (ViewPager) wei_Calendar.findViewById(R.id.pager); } private Locale locale; private Calendar minCal; private Calendar maxCal; private Calendar monthCounter; private SelectionMode selectionMode; final List<MonthDescriptor> months = new ArrayList<MonthDescriptor>(); final List<MonthCellDescriptor> selectedCells = new ArrayList<MonthCellDescriptor>(); final List<MonthCellDescriptor> highlightedCells = new ArrayList<MonthCellDescriptor>(); final List<Calendar> selectedCals = new ArrayList<Calendar>(); final List<Calendar> highlightedCals = new ArrayList<Calendar>(); private final List<List<List<MonthCellDescriptor>>> cells = new ArrayList<List<List<MonthCellDescriptor>>>(); private boolean displayOnly; private Calendar today; private OnDateSelectedListener dateListener; private DateSelectableFilter dateConfiguredListener; private OnInvalidDateSelectedListener invalidDateListener = new DefaultOnInvalidDateSelectedListener(); final MonthView.Listener listener = new CellClickedListener(); // private CalendarAdapter calendarAdapter; private CalendarAdapter calendarAdapter; private List<MonthView> lists; // private VerticalViewPager mVerticalViewPager; private ViewPager mVerticalViewPager; public enum SelectionMode { /** * Only one date will be selectable. If there is already a selected date * and you select a new one, the old date will be unselected. */ SINGLE, /** * Multiple dates will be selectable. Selecting an already-selected date * will un-select it. */ MULTIPLE, /** * Allows you to select a date range. Previous selections are cleared * when you either: * <ul> * <li>Have a range selected and select another date (even if it's in * the current range).</li> * <li>Have one date selected and then select an earlier date.</li> * </ul> */ RANGE } public void hitTitle(boolean flag) { if(flag) tv_title.setVisibility(View.GONE); else tv_title.setVisibility(View.VISIBLE); } public CustomCalendar initCalendar(Date minDate, Date maxDate) { today = Calendar.getInstance(); int firstDayOfWeek = today.getFirstDayOfWeek(); for (int offset = 0; offset < 7; offset++) { today.set(Calendar.DAY_OF_WEEK, firstDayOfWeek + offset); final TextView textView = (TextView) ll_weekTitle.getChildAt(offset); textView.setText(getDayOfWeek(today)); } // Make sure that all calendar instances use the same locale. this.locale = Locale.getDefault(); today = Calendar.getInstance(locale); minCal = Calendar.getInstance(locale); maxCal = Calendar.getInstance(locale); monthCounter = Calendar.getInstance(locale); monthNameFormat = new SimpleDateFormat(getContext().getString( R.string.month_name_format), locale); for (MonthDescriptor month : months) { month.setLabel(monthNameFormat.format(month.getDate())); } weekdayNameFormat = new SimpleDateFormat(getContext().getString( R.string.day_name_format), locale); this.selectionMode = SelectionMode.SINGLE; // Clear out any previously-selected dates/cells. selectedCals.clear(); selectedCells.clear(); highlightedCells.clear(); // Clear previous state. cells.clear(); months.clear(); minCal.setTime(minDate); maxCal.setTime(maxDate); setMidnight(minCal); setMidnight(maxCal); displayOnly = false; // maxDate is exclusive: bump back to the previous day so if maxDate is // the first of a month, // we don't accidentally include that month in the view. maxCal.add(MINUTE, -1); // Now iterate between minCal and maxCal and build up our list of months // to show. monthCounter.setTime(minCal.getTime()); final int maxMonth = maxCal.get(MONTH); final int maxYear = maxCal.get(YEAR); while ((monthCounter.get(MONTH) <= maxMonth // Up to, including the // month. || monthCounter.get(YEAR) < maxYear) // Up to the year. && monthCounter.get(YEAR) < maxYear + 1) { // But not > next yr. Date date = monthCounter.getTime(); MonthDescriptor month = new MonthDescriptor( monthCounter.get(MONTH), monthCounter.get(YEAR), date, monthNameFormat.format(date)); cells.add(getMonthCells(month, monthCounter)); months.add(month); monthCounter.add(MONTH, 1); } // Log.e("weiqun12345", "months.size()" + months.size()); // Log.e("weiqun12345", "============================month=================="); // for(MonthDescriptor month : months) { // Log.e("weiqun12345", "month=" + month.toString()); // } // // Log.e("weiqun12345", "============================month=================="); // // Log.e("weiqun12345", "cells.size()" + cells.size()); // for(int i=0;i<cells.size();i++) { // Log.e("weiqun12345", "====month start======"); // List<List<MonthCellDescriptor>> list1 = cells.get(i); // for(int ii=0;ii<list1.size();ii++) { // List<MonthCellDescriptor> list2 = list1.get(ii); // for(int iii=0;iii<list2.size();iii++) { // Log.e("weiqun12345", list2.get(iii).toString()); // } // Log.e("weiqun12345", "row end"); // } // Log.e("weiqun12345", "===month end======"); // } lists = new ArrayList<MonthView>(); LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); for(int index=0;index<months.size();index++) { MonthView monthView = MonthView.create(null, inflater, weekdayNameFormat, listener, today); monthView.init(months.get(index), cells.get(index), displayOnly); lists.add(monthView); } calendarAdapter = new CalendarAdapter(); mVerticalViewPager.setAdapter(calendarAdapter); tv_title.setText(lists.get(0).title); // mVerticalViewPager.setOnPageChangeListener(new VerticalViewPager.OnPageChangeListener() { // // @Override // public void onPageSelected(int position) { // // TODO Auto-generated method stub // tv_title.setText(lists.get(position).title); // } // // @Override // public void onPageScrolled(int position, float positionOffset, // int positionOffsetPixels) { // // TODO Auto-generated method stub // // } // // @Override // public void onPageScrollStateChanged(int state) { // // TODO Auto-generated method stub // // } // }); mVerticalViewPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int position) { tv_title.setText(lists.get(position).title); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); return this; } public class CalendarAdapter extends android.support.v4.view.PagerAdapter { private LayoutInflater inflater; List<MonthView> viewLists = new ArrayList<MonthView>(); Map<Integer,View> maps = new HashMap<Integer,View>(); public CalendarAdapter(List<MonthView> lists) { viewLists = lists; } public CalendarAdapter(){ inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public void destroyItem(View arg0, int position, Object arg2) { // ((com.weiqun.customcalendar.VerticalViewPager)arg0).removeView(maps.get(position)); ((android.support.v4.view.ViewPager)arg0).removeView(maps.get(position)); } @Override public void finishUpdate(View arg0) { } @Override public int getCount() { return months.size(); // return lists.size(); } @Override public Object instantiateItem(View arg0, int position) { MonthView monthView = MonthView.create(null, inflater,weekdayNameFormat, listener, today); monthView.init(months.get(position), cells.get(position),displayOnly); maps.put(position, monthView); // ((com.weiqun.customcalendar.VerticalViewPager)arg0).addView(monthView); ((android.support.v4.view.ViewPager)arg0).addView(monthView); return monthView; // ((com.weiqun.customcalendar.VerticalViewPager)arg0).addView(lists.get(position)); // return lists.get(position); } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == arg1; } @Override public void restoreState(Parcelable arg0, ClassLoader arg1) { } @Override public Parcelable saveState() { return null; } @Override public void startUpdate(View arg0) { } @Override public int getItemPosition(Object object) { return POSITION_NONE; } } // public class CalendarAdapter extends com.weiqun.customcalendar.PagerAdapter { // private LayoutInflater inflater; // // List<MonthView> viewLists = new ArrayList<MonthView>(); // Map<Integer,View> maps = new HashMap<Integer,View>(); // public CalendarAdapter(List<MonthView> lists) // { // viewLists = lists; // } // public CalendarAdapter(){ // // inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // } // // @Override // public void destroyItem(View arg0, int position, Object arg2) { // ((com.weiqun.customcalendar.VerticalViewPager)arg0).removeView(maps.get(position)); // } // // @Override // public void finishUpdate(View arg0) { // // } // // @Override // public int getCount() { // return months.size(); //// return lists.size(); // } // // @Override // public Object instantiateItem(View arg0, int position) { // // MonthView monthView = MonthView.create(null, inflater,weekdayNameFormat, listener, today); // monthView.init(months.get(position), cells.get(position),displayOnly); // maps.put(position, monthView); // ((com.weiqun.customcalendar.VerticalViewPager)arg0).addView(monthView); // return monthView; //// ((com.weiqun.customcalendar.VerticalViewPager)arg0).addView(lists.get(position)); //// return lists.get(position); // // } // // @Override // public boolean isViewFromObject(View arg0, Object arg1) { // return arg0 == arg1; // } // // @Override // public void restoreState(Parcelable arg0, ClassLoader arg1) { // // } // // @Override // public Parcelable saveState() { // return null; // } // // @Override // public void startUpdate(View arg0) { // // } // // @Override // public int getItemPosition(Object object) { // return POSITION_NONE; // } // // } private List<List<MonthCellDescriptor>> getMonthCells(MonthDescriptor month, Calendar startCal) { Calendar cal = Calendar.getInstance(locale); cal.setTime(startCal.getTime()); List<List<MonthCellDescriptor>> cells = new ArrayList<List<MonthCellDescriptor>>(); cal.set(DAY_OF_MONTH, 1); int firstDayOfWeek = cal.get(DAY_OF_WEEK); int offset = cal.getFirstDayOfWeek() - firstDayOfWeek; if (offset > 0) { offset -= 7; } cal.add(Calendar.DATE, offset); Calendar minSelectedCal = minDate(selectedCals); Calendar maxSelectedCal = maxDate(selectedCals); while ((cal.get(MONTH) < month.getMonth() + 1 || cal.get(YEAR) < month .getYear()) // && cal.get(YEAR) <= month.getYear()) { List<MonthCellDescriptor> weekCells = new ArrayList<MonthCellDescriptor>(); cells.add(weekCells); for (int c = 0; c < 7; c++) { Date date = cal.getTime(); boolean isCurrentMonth = cal.get(MONTH) == month.getMonth(); boolean isSelected = isCurrentMonth && containsDate(selectedCals, cal); boolean isSelectable = isCurrentMonth && betweenDates(cal, minCal, maxCal) && isDateSelectable(date); boolean isToday = sameDate(cal, today); boolean isHighlighted = containsDate(highlightedCals, cal); int value = cal.get(DAY_OF_MONTH); MonthCellDescriptor.RangeState rangeState = MonthCellDescriptor.RangeState.NONE; if (selectedCals.size() > 1) { if (sameDate(minSelectedCal, cal)) { rangeState = MonthCellDescriptor.RangeState.FIRST; } else if (sameDate(maxDate(selectedCals), cal)) { rangeState = MonthCellDescriptor.RangeState.LAST; } else if (betweenDates(cal, minSelectedCal, maxSelectedCal)) { rangeState = MonthCellDescriptor.RangeState.MIDDLE; } } weekCells.add(new MonthCellDescriptor(date, isCurrentMonth, isSelectable, isSelected, isToday, isHighlighted, value, rangeState)); cal.add(DATE, 1); } } if(cells.size() == 5) { List<MonthCellDescriptor> weekCells = new ArrayList<MonthCellDescriptor>(); cells.add(weekCells); for (int c = 0; c < 7; c++) { Date date = cal.getTime(); boolean isCurrentMonth = cal.get(MONTH) == month.getMonth(); boolean isSelected = isCurrentMonth && containsDate(selectedCals, cal); boolean isSelectable = isCurrentMonth && betweenDates(cal, minCal, maxCal) && isDateSelectable(date); boolean isToday = sameDate(cal, today); boolean isHighlighted = containsDate(highlightedCals, cal); int value = cal.get(DAY_OF_MONTH); MonthCellDescriptor.RangeState rangeState = MonthCellDescriptor.RangeState.NONE; weekCells.add(new MonthCellDescriptor(date, isCurrentMonth, isSelectable, isSelected, isToday, isHighlighted, value, rangeState)); cal.add(DATE, 1); } } return cells; } static void setMidnight(Calendar cal) { cal.set(HOUR_OF_DAY, 0); cal.set(MINUTE, 0); cal.set(SECOND, 0); cal.set(MILLISECOND, 0); } private static boolean containsDate(List<Calendar> selectedCals, Calendar cal) { for (Calendar selectedCal : selectedCals) { if (sameDate(cal, selectedCal)) { return true; } } return false; } private static Calendar minDate(List<Calendar> selectedCals) { if (selectedCals == null || selectedCals.size() == 0) { return null; } Collections.sort(selectedCals); return selectedCals.get(0); } private static Calendar maxDate(List<Calendar> selectedCals) { if (selectedCals == null || selectedCals.size() == 0) { return null; } Collections.sort(selectedCals); return selectedCals.get(selectedCals.size() - 1); } private static boolean sameDate(Calendar cal, Calendar selectedDate) { return cal.get(MONTH) == selectedDate.get(MONTH) && cal.get(YEAR) == selectedDate.get(YEAR) && cal.get(DAY_OF_MONTH) == selectedDate.get(DAY_OF_MONTH); } private static boolean betweenDates(Calendar cal, Calendar minCal, Calendar maxCal) { final Date date = cal.getTime(); return betweenDates(date, minCal, maxCal); } static boolean betweenDates(Date date, Calendar minCal, Calendar maxCal) { final Date min = minCal.getTime(); return (date.equals(min) || date.after(min)) // >= minCal && date.before(maxCal.getTime()); // && < maxCal } private static boolean sameMonth(Calendar cal, MonthDescriptor month) { return (cal.get(MONTH) == month.getMonth() && cal.get(YEAR) == month .getYear()); } private boolean isDateSelectable(Date date) { return dateConfiguredListener == null || dateConfiguredListener.isDateSelectable(date); } public void setOnDateSelectedListener(OnDateSelectedListener listener) { dateListener = listener; } /** * Set a listener to react to user selection of a disabled date. * * @param listener * the listener to set, or null for no reaction */ public void setOnInvalidDateSelectedListener( OnInvalidDateSelectedListener listener) { invalidDateListener = listener; } /** * Set a listener used to discriminate between selectable and unselectable * dates. Set this to disable arbitrary dates as they are rendered. * <p> * Important: set this before you call {@link #init(Date, Date)} methods. If * called afterwards, it will not be consistently applied. */ public void setDateSelectableFilter(DateSelectableFilter listener) { dateConfiguredListener = listener; } /** * Interface to be notified when a new date is selected or unselected. This * will only be called when the user initiates the date selection. If you * call {@link #selectDate(Date)} this listener will not be notified. * * @see #setOnDateSelectedListener(OnDateSelectedListener) */ public interface OnDateSelectedListener { void onDateSelected(Date date); void onDateUnselected(Date date); } /** * Interface to be notified when an invalid date is selected by the user. * This will only be called when the user initiates the date selection. If * you call {@link #selectDate(Date)} this listener will not be notified. * * @see #setOnInvalidDateSelectedListener(OnInvalidDateSelectedListener) */ public interface OnInvalidDateSelectedListener { void onInvalidDateSelected(Date date); } /** * Interface used for determining the selectability of a date cell when it * is configured for display on the calendar. * * @see #setDateSelectableFilter(DateSelectableFilter) */ public interface DateSelectableFilter { boolean isDateSelectable(Date date); } private class DefaultOnInvalidDateSelectedListener implements OnInvalidDateSelectedListener { @Override public void onInvalidDateSelected(Date date) { // Toast.makeText(getContext(), "无效的日期", // Toast.LENGTH_SHORT).show(); } } private class CellClickedListener implements MonthView.Listener { @Override public void handleClick(MonthCellDescriptor cell) { Date clickedDate = cell.getDate(); if (!betweenDates(clickedDate, minCal, maxCal) || !isDateSelectable(clickedDate)) { if (invalidDateListener != null) { invalidDateListener.onInvalidDateSelected(clickedDate); } } else { boolean wasSelected = doSelectDate(clickedDate, cell); if (dateListener != null) { if (wasSelected) { dateListener.onDateSelected(clickedDate); } else { dateListener.onDateUnselected(clickedDate); } } } } } private boolean doSelectDate(Date date, MonthCellDescriptor cell) { Calendar newlySelectedCal = Calendar.getInstance(locale); newlySelectedCal.setTime(date); // Sanitize input: clear out the hours/minutes/seconds/millis. setMidnight(newlySelectedCal); // Clear any remaining range state. for (MonthCellDescriptor selectedCell : selectedCells) { selectedCell.setRangeState(RangeState.NONE); } switch (selectionMode) { case RANGE: if (selectedCals.size() > 1) { // We've already got a range selected: clear the old one. clearOldSelections(); } else if (selectedCals.size() == 1 && newlySelectedCal.before(selectedCals.get(0))) { // We're moving the start of the range back in time: clear the // old start date. clearOldSelections(); } break; case MULTIPLE: date = applyMultiSelect(date, newlySelectedCal); break; case SINGLE: clearOldSelections(); break; default: throw new IllegalStateException("Unknown selectionMode " + selectionMode); } if (date != null) { // Select a new cell. if (selectedCells.size() == 0 || !selectedCells.get(0).equals(cell)) { selectedCells.add(cell); cell.setSelected(true); } selectedCals.add(newlySelectedCal); if (selectionMode == SelectionMode.RANGE && selectedCells.size() > 1) { // Select all days in between start and end. Date start = selectedCells.get(0).getDate(); Date end = selectedCells.get(1).getDate(); selectedCells.get(0).setRangeState( MonthCellDescriptor.RangeState.FIRST); selectedCells.get(1).setRangeState( MonthCellDescriptor.RangeState.LAST); for (List<List<MonthCellDescriptor>> month : cells) { for (List<MonthCellDescriptor> week : month) { for (MonthCellDescriptor singleCell : week) { if (singleCell.getDate().after(start) && singleCell.getDate().before(end) && singleCell.isSelectable()) { singleCell.setSelected(true); singleCell .setRangeState(MonthCellDescriptor.RangeState.MIDDLE); selectedCells.add(singleCell); } } } } } } // // Update the adapter. validateAndUpdate(); return date != null; } private void validateAndUpdate() { calendarAdapter.notifyDataSetChanged(); } private void clearOldSelections() { for (MonthCellDescriptor selectedCell : selectedCells) { // De-select the currently-selected cell. selectedCell.setSelected(false); } selectedCells.clear(); selectedCals.clear(); } private Date applyMultiSelect(Date date, Calendar selectedCal) { for (MonthCellDescriptor selectedCell : selectedCells) { if (selectedCell.getDate().equals(date)) { // De-select the currently-selected cell. selectedCell.setSelected(false); selectedCells.remove(selectedCell); date = null; break; } } for (Calendar cal : selectedCals) { if (sameDate(cal, selectedCal)) { selectedCals.remove(cal); break; } } return date; } public void withSelectedDates(Date selectedDates) { this.withSelectedDates(Arrays.asList(selectedDates)); } public void withSelectedDates( Collection<Date> selectedDates) { if (selectionMode == SelectionMode.SINGLE && selectedDates.size() > 1) { throw new IllegalArgumentException( "SINGLE mode can't be used with multiple selectedDates"); } if (selectedDates != null) { for (Date date : selectedDates) { selectDate(date); } } // scrollToSelectedDates(); validateAndUpdate(); // return this; } public boolean selectDate(Date date) { validateDate(date); MonthCellWithMonthIndex monthCellWithMonthIndex = getMonthCellWithIndexByDate(date); if (monthCellWithMonthIndex == null || !isDateSelectable(date)) { return false; } boolean wasSelected = doSelectDate(date, monthCellWithMonthIndex.cell); // if (wasSelected) { // scrollToSelectedMonth(monthCellWithMonthIndex.monthIndex); // } return wasSelected; } /** Hold a cell with a month-index. */ private static class MonthCellWithMonthIndex { public MonthCellDescriptor cell; public int monthIndex; public MonthCellWithMonthIndex(MonthCellDescriptor cell, int monthIndex) { this.cell = cell; this.monthIndex = monthIndex; } } /** Return cell and month-index (for scrolling) for a given Date. */ private MonthCellWithMonthIndex getMonthCellWithIndexByDate(Date date) { int index = 0; Calendar searchCal = Calendar.getInstance(locale); searchCal.setTime(date); Calendar actCal = Calendar.getInstance(locale); for (List<List<MonthCellDescriptor>> monthCells : cells) { for (List<MonthCellDescriptor> weekCells : monthCells) { for (MonthCellDescriptor actCell : weekCells) { actCal.setTime(actCell.getDate()); if (sameDate(actCal, searchCal) && actCell.isSelectable()) { return new MonthCellWithMonthIndex(actCell, index); } } } index++; } return null; } private void validateDate(Date date) { if (date == null) { throw new IllegalArgumentException( "Selected date must be non-null."); } if (date.getTime() == 0) { throw new IllegalArgumentException( "Selected date must be non-zero. " + date); } if (date.before(minCal.getTime()) || date.after(maxCal.getTime())) { throw new IllegalArgumentException(String.format( "SelectedDate must be between minDate and maxDate." + "%nminDate: %s%nmaxDate: %s%nselectedDate: %s", minCal.getTime(), maxCal.getTime(), date)); } } public String getDayOfWeek(Calendar c) { int wd = c.get(Calendar.DAY_OF_WEEK); String x = ""; switch (wd) { case 1: x = "日"; break; case 2: x = "一"; break; case 3: x = "二"; break; case 4: x = "三"; break; case 5: x = "四"; break; case 6: x = "五"; break; case 7: x = "六"; break; } return x; } }
87f75795a48747f3e57e0e1d24db4004e5d90949
bb45ca5f028b841ca0a08ffef60cedc40090f2c1
/app/src/main/java/com/MCWorld/module/topic/k$25.java
55c730598e2c33f1f366eb0582f0b36b9a44b290
[]
no_license
tik5213/myWorldBox
0d248bcc13e23de5a58efd5c10abca4596f4e442
b0bde3017211cc10584b93e81cf8d3f929bc0a45
refs/heads/master
2020-04-12T19:52:17.559775
2017-08-14T05:49:03
2017-08-14T05:49:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,108
java
package com.MCWorld.module.topic; import com.MCWorld.data.topic.TopicItem; import com.MCWorld.framework.base.http.io.Response.Listener; import com.MCWorld.framework.base.notification.EventNotifyCenter; import com.MCWorld.module.h; import com.MCWorld.module.w; /* compiled from: TopicModule2 */ class k$25 implements Listener<w> { final /* synthetic */ k aCN; final /* synthetic */ TopicItem aCQ; final /* synthetic */ boolean aCR; k$25(k this$0, TopicItem topicItem, boolean z) { this.aCN = this$0; this.aCQ = topicItem; this.aCR = z; } public /* synthetic */ void onResponse(Object obj) { a((w) obj); } public void a(w info) { if (info == null || !info.isSucc()) { EventNotifyCenter.notifyEvent(h.class, h.aru, new Object[]{Boolean.valueOf(false), info, Long.valueOf(this.aCQ.getPostID()), Boolean.valueOf(this.aCR)}); return; } EventNotifyCenter.notifyEvent(h.class, h.aru, new Object[]{Boolean.valueOf(true), info, Long.valueOf(this.aCQ.getPostID()), Boolean.valueOf(this.aCR)}); } }
b7e1caafcf11adcf9cf0697f7cf7708996e10609
77db23f59017969667b6ecab95ef206b5f511394
/League_of_OOP_Game/src/player/Rogue.java
a385575d034b5d48108e9297c56b0847f1bab781
[]
no_license
vladmosessohn/League-of-OOP-Game
f4e0e6fdf86bed93ffcc82719de0a340bd7f5606
062eadb11afb210d5dc5ac1ca9d15c109f5a54a6
refs/heads/master
2022-12-28T05:48:28.654093
2020-09-02T12:50:37
2020-09-02T12:50:37
292,281,640
0
0
null
null
null
null
UTF-8
Java
false
false
59
java
package player; public class Rogue extends Player { }
14dc9293fc55b1fe900f2c6c7df0bfe8dacb3a67
45baee642709732ad9f3843fa14fe00b876626a7
/account-service/src/main/java/wsz/accountservice/repository/AccountDAO.java
dbffb0ac9969dfe23f5b178f24f901a73a23c2df
[]
no_license
BeHappyWsz/seataDemo
06d5c1d73ea938839f851e5438dcfc0f906e1d03
88a61cb4ea21bb990124c3c9a6f0d02fe7dbfcc6
refs/heads/master
2023-07-03T10:46:43.429366
2021-08-08T11:50:35
2021-08-08T11:50:35
393,945,007
0
0
null
null
null
null
UTF-8
Java
false
false
68
java
package wsz.accountservice.repository; public class AccountDAO { }
821dc06b2bb5a8f38047629b36f80a981cc271a2
51c4b2c3cbdf860fd90a60c30b4a33a2f3f9859a
/src/main/java/com/ha/tn/ktebi/services/impl/UserServiceImpl.java
67215ac8df79677c531cfde80672941e16e1a879
[]
no_license
HabibaAbderrahim/Book-managment
6641960aa90ab4bf9e0784f194edaf7b35f67519
6239e4b89fd77bef18300fb1a9951203614976ac
refs/heads/master
2023-06-15T12:19:14.934254
2021-07-16T11:20:58
2021-07-16T11:20:58
385,979,417
0
0
null
null
null
null
UTF-8
Java
false
false
73
java
package com.ha.tn.ktebi.services.impl; public class UserServiceImpl { }
416aa33663db1ec8d8f9d3d7df71bbdf5fcc9a54
6207a4baa2084251bb9d46fdaef3cb14d22d01fe
/app/src/main/java/com/nghicv/rotatebutton/RotateButton.java
93de40d40a3415c6fd11d01dff3ab58e82193e54
[]
no_license
Nghicv/rotate_button
8e5ccfedd1f09a8bf41ca30d95694e1b7f97d490
ec4ef22974ec008b59c3f148d3c118edf2913e56
refs/heads/master
2021-01-23T22:23:23.615351
2017-02-25T11:08:19
2017-02-25T11:08:19
83,125,958
0
1
null
null
null
null
UTF-8
Java
false
false
2,854
java
package com.nghicv.rotatebutton; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.util.AttributeSet; import android.view.View; /** * Created by nghic on 2/18/2017. */ public class RotateButton extends View { private Bitmap mBitmap; private float mAngel; public RotateButton(Context context) { super(context); } public RotateButton(Context context, AttributeSet attrs) { super(context, attrs); loadBitmap(); } public RotateButton(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public RotateButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if (mBitmap == null) { return; } int desiredWidth = mBitmap.getWidth(); int desireHeight = mBitmap.getHeight(); int widthMode = MeasureSpec.getMode(widthMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int width; int height; switch (widthMode) { case MeasureSpec.EXACTLY: width = widthSize; break; case MeasureSpec.AT_MOST: width = Math.min(desiredWidth, widthSize); break; default: width = desiredWidth; break; } switch (heightMode) { case MeasureSpec.EXACTLY: height = heightSize; break; case MeasureSpec.AT_MOST: height = Math.min(desireHeight, heightSize); break; default: height = desireHeight; break; } setMeasuredDimension(width, height); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Matrix matrix = new Matrix(); /*matrix.postTranslate(-mBitmap.getWidth()/2, -mBitmap.getHeight()/2); matrix.postRotate(mAngel); matrix.postTranslate(getWidth()/2, getHeight()/2);*/ matrix.setRotate(mAngel, getWidth()/2, getHeight()/2); canvas.drawBitmap(mBitmap, matrix, null); } private void loadBitmap() { mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable .ic_chevron_double_down_grey600_36dp); } public void setAngel(float angel) { mAngel = angel; invalidate(); } }
00c4898e9635da4a700e28de555ba9861e3807c4
ec10221f1f718bf1a4608b9516f69b92073844eb
/buchungservice/src/main/java/com/microservice/buchungservice/shareddomain/model/FlugResponseDTO.java
cc632e3357472225a8426a31dfe0bf4873e7bb48
[]
no_license
Skikru/FLY-APP
812d61fe6e1410284cba5b6cf92ac5ec07f54166
48735cac76999b063237a809a73baa59411d1cc2
refs/heads/master
2023-04-25T13:52:45.221437
2021-05-12T03:57:31
2021-05-12T03:57:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
328
java
package com.microservice.buchungservice.shareddomain.model; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor public class FlugResponseDTO { String flugnummer; String flugdatum; String startflughafen; String zielflughafen; }
[ "If62634321" ]
If62634321
9ca1bfe979135b29e87ea0f2de7853abc243220d
082e26b011e30dc62a62fae95f375e4f87d9e99c
/docs/weixin_7.0.4_source/反编译源码/未反混淆/src/main/java/com/tencent/mm/wallet_core/ui/formview/WalletFormView.java
36e666b26c61474f451a9483b246a6f995b63ec6
[]
no_license
xsren/AndroidReverseNotes
9631a5aabc031006e795a112b7ac756a8edd4385
9202c276fe9f04a978e4e08b08e42645d97ca94b
refs/heads/master
2021-04-07T22:50:51.072197
2019-07-16T02:24:43
2019-07-16T02:24:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
29,666
java
package com.tencent.mm.wallet_core.ui.formview; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.Typeface; import android.text.Editable; import android.text.InputFilter; import android.text.InputFilter.LengthFilter; import android.text.SpannableString; import android.text.SpannedString; import android.text.TextWatcher; import android.text.method.KeyListener; import android.text.method.NumberKeyListener; import android.text.method.PasswordTransformationMethod; import android.text.style.AbsoluteSizeSpan; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnFocusChangeListener; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; import com.google.android.gms.common.api.Api.BaseClientBuilder; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.R; import com.tencent.mm.pluginsdk.ui.wallet.WalletIconImageView; import com.tencent.mm.sdk.platformtools.ab; import com.tencent.mm.sdk.platformtools.ag; import com.tencent.mm.sdk.platformtools.bo; import com.tencent.mm.wallet_core.ui.WalletBaseUI; import com.tencent.mm.wallet_core.ui.e; import com.tenpay.android.wechat.TenpaySecureEditText; import java.lang.reflect.Field; import junit.framework.Assert; public final class WalletFormView extends LinearLayout implements OnFocusChangeListener { public TenpaySecureEditText Aih; private a Aii; private com.tencent.mm.wallet_core.ui.formview.a.a Aij; private com.tencent.mm.wallet_core.ui.formview.a.b Aik; private int Ail; private int Aim; private int Ain; private int Aio; @Deprecated private int Aip; private int Aiq; private int Air; private TextView iDT; private int pIA; private String pIB; private int pIC; private String pID; private int pIE; private int pIF; private String pIG; private int pIH; private int pII; private int pIJ; private boolean pIK; private boolean pIL; private boolean pIM; private int pIN; private int pIO; private int pIP; private TextView pIl; private WalletIconImageView pIn; private TextView pIo; private OnFocusChangeListener pIq; private OnClickListener pIr; private int pIu; private String pIv; private int pIw; private String pIx; private int pIy; private int pIz; public interface a { void hY(boolean z); } public interface b extends a { } static /* synthetic */ void i(WalletFormView walletFormView) { AppMethodBeat.i(49458); walletFormView.cew(); AppMethodBeat.o(49458); } public WalletFormView(Context context, AttributeSet attributeSet, int i) { boolean z = false; super(context, attributeSet); AppMethodBeat.i(49412); this.iDT = null; this.pIl = null; this.Aih = null; this.pIn = null; this.pIo = null; this.Aii = null; this.pIq = null; this.pIr = null; this.Aij = null; this.Aik = null; this.pIu = -1; this.Ail = this.pIu; this.Aim = 100; this.pIv = ""; this.pIw = 0; this.pIx = ""; this.pIy = 8; this.pIz = -1; this.pIA = 4; this.pIB = ""; this.pIC = 8; this.pID = ""; this.Ain = -1; this.pIE = 19; this.pIF = R.color.w4; this.pIG = ""; this.Aio = 0; this.pIH = BaseClientBuilder.API_PRIORITY_OTHER; this.pII = 1; this.pIJ = R.drawable.uv; this.pIK = true; this.pIL = false; this.pIM = true; this.pIN = 1; this.pIO = 5; this.pIP = R.color.t_; this.Aip = 0; this.Aiq = 0; this.Air = 0; TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, com.tencent.mm.plugin.wxpay.a.a.WalletFormAttrs, i, 0); this.pIu = obtainStyledAttributes.getResourceId(4, this.pIu); int resourceId = obtainStyledAttributes.getResourceId(6, 0); if (resourceId != 0) { this.pIv = context.getString(resourceId); } this.pIz = obtainStyledAttributes.getResourceId(7, this.pIz); resourceId = obtainStyledAttributes.getResourceId(8, 0); if (resourceId != 0) { this.pIB = context.getString(resourceId); } this.pIA = obtainStyledAttributes.getInteger(10, this.pIA); this.pIw = obtainStyledAttributes.getInteger(11, this.pIw); this.pIC = obtainStyledAttributes.getInteger(12, this.pIC); this.pIy = obtainStyledAttributes.getInteger(13, this.pIy); resourceId = obtainStyledAttributes.getResourceId(14, 0); if (resourceId != 0) { this.pIx = context.getString(resourceId); } resourceId = obtainStyledAttributes.getResourceId(15, 0); if (resourceId != 0) { this.pID = context.getString(resourceId); } this.Ain = obtainStyledAttributes.getDimensionPixelSize(16, -1); this.pIE = obtainStyledAttributes.getInteger(17, this.pIE); this.pIF = obtainStyledAttributes.getColor(18, this.pIF); resourceId = obtainStyledAttributes.getResourceId(19, 0); if (resourceId != 0) { this.pIG = context.getString(resourceId); } this.Aio = obtainStyledAttributes.getInt(20, this.Aio); this.pIH = obtainStyledAttributes.getInteger(21, this.pIH); this.pII = obtainStyledAttributes.getInteger(22, this.pII); this.pIJ = obtainStyledAttributes.getResourceId(23, this.pIJ); this.pIK = obtainStyledAttributes.getBoolean(24, this.pIK); this.pIL = obtainStyledAttributes.getBoolean(26, this.pIL); this.pIM = obtainStyledAttributes.getBoolean(24, this.pIM); this.pIN = obtainStyledAttributes.getInteger(0, this.pIN); this.pIO = obtainStyledAttributes.getInteger(1, this.pIO); this.Aim = obtainStyledAttributes.getInteger(28, this.Aim); this.pIP = obtainStyledAttributes.getInteger(27, this.pIP); this.Ail = obtainStyledAttributes.getResourceId(5, this.Ail); this.Aip = obtainStyledAttributes.getInteger(30, 0); this.Aiq = obtainStyledAttributes.getInteger(3, -1); if (this.Aip == 1 && this.Aiq == -1) { this.Aiq = 4; } this.Air = obtainStyledAttributes.getResourceId(2, 0); obtainStyledAttributes.recycle(); if (this.pIu > 0) { z = true; } Assert.assertTrue(z); setOrientation(1); if (bo.isNullOrNil(this.pIv) || this.pIv.length() <= 6) { inflate(context, this.pIu, this); } else { inflate(context, this.Ail, this); } this.iDT = (TextView) findViewById(R.id.dc); this.pIl = (TextView) findViewById(R.id.da); this.Aih = (TenpaySecureEditText) findViewById(R.id.d6); this.pIn = (WalletIconImageView) findViewById(R.id.d_); this.pIo = (TextView) findViewById(R.id.db); AppMethodBeat.o(49412); } public WalletFormView(Context context, AttributeSet attributeSet) { this(context, attributeSet, -1); } public final void setTitleText(String str) { AppMethodBeat.i(49413); this.pIv = str; dOR(); AppMethodBeat.o(49413); } public final void dOP() { AppMethodBeat.i(49414); if (this.Aih != null) { this.Aih.setPadding(0, 0, 0, 0); } AppMethodBeat.o(49414); } public final void set3DesValStr(String str) { AppMethodBeat.i(49415); if (this.Aih != null && (this.Aik == null || !this.Aik.d(this, str))) { this.Aih.set3DesEncrptData(str); setSelection(getInputLength()); } AppMethodBeat.o(49415); } public final String getMD5Value() { AppMethodBeat.i(49416); String nullAsNil = bo.nullAsNil(this.Aih.getText().toString()); if (this.Aik != null && this.Aik.cev()) { nullAsNil = this.Aik.e(this, nullAsNil); } nullAsNil = ag.ck(nullAsNil); AppMethodBeat.o(49416); return nullAsNil; } public final void setImeOptions(int i) { AppMethodBeat.i(49417); if (this.Aih != null) { this.Aih.setImeOptions(i); } AppMethodBeat.o(49417); } public final void setInputType(int i) { AppMethodBeat.i(49418); if (this.Aih != null) { this.Aih.setInputType(i); } AppMethodBeat.o(49418); } public final void setText(String str) { AppMethodBeat.i(49419); if (this.Aih != null && (this.Aik == null || !this.Aik.c(this, str))) { this.Aih.setText(str); this.Aih.setSelection(getInputLength()); } AppMethodBeat.o(49419); } public final void setInputEnable(boolean z) { AppMethodBeat.i(49420); if (this.Aih != null) { this.Aih.setEnabled(z); } AppMethodBeat.o(49420); } @SuppressLint({"ResourceType"}) public final void setContentTextColorRes(int i) { AppMethodBeat.i(49421); this.pIF = i; if (this.Aih != null) { this.Aih.setTextColor(getResources().getColor(this.pIF)); } AppMethodBeat.o(49421); } public final void setContentTextColor(int i) { AppMethodBeat.i(49422); if (this.Aih != null) { this.Aih.setTextColor(i); } AppMethodBeat.o(49422); } private void cew() { AppMethodBeat.i(49423); if (this.pIn != null && !bo.isNullOrNil(getText()) && this.Aih != null && this.Aih.isEnabled() && this.Aih.isClickable() && this.Aih.isFocusable() && this.Aih.isFocused()) { this.pIn.setToClearState(new OnClickListener() { public final void onClick(View view) { AppMethodBeat.i(49411); WalletFormView.this.cey(); AppMethodBeat.o(49411); } }); AppMethodBeat.o(49423); } else if (this.pIn != null) { this.pIn.dlG(); AppMethodBeat.o(49423); } else { ab.v("MicroMsg.WalletFormView", "hy: no info iv"); AppMethodBeat.o(49423); } } public final a getInputValidChangeListener() { return this.Aii; } public final boolean dOQ() { AppMethodBeat.i(49424); if (this.Aih != null) { boolean isFocusable = this.Aih.isFocusable(); AppMethodBeat.o(49424); return isFocusable; } AppMethodBeat.o(49424); return false; } /* Access modifiers changed, original: protected|final */ public final void onAttachedToWindow() { AppMethodBeat.i(49425); super.onAttachedToWindow(); AppMethodBeat.o(49425); } /* Access modifiers changed, original: protected|final */ public final void onDetachedFromWindow() { AppMethodBeat.i(49426); super.onDetachedFromWindow(); AppMethodBeat.o(49426); } /* Access modifiers changed, original: protected|final */ public final void onFinishInflate() { AppMethodBeat.i(49427); super.onFinishInflate(); dOR(); if (getPrefilledTv() != null) { getPrefilledTv().setText(this.pIx); getPrefilledTv().setVisibility(this.pIy); } if (getInfoIv() != null) { getInfoIv().setImageResource(this.pIz); getInfoIv().setVisibility(this.pIA); } if (getTipsTv() != null) { getTipsTv().setText(this.pIB); getTipsTv().setVisibility(this.pIC); } Context context = getContext(); if (this.Aih != null) { if (this.Aiq >= 0) { this.Aih.setTypeface(Typeface.createFromAsset(context.getAssets(), e.QQ(this.Aiq))); } if (this.Ain == -1) { this.Aih.setHint(this.pID); } else { SpannableString spannableString = new SpannableString(this.pID + " "); spannableString.setSpan(new d(this.Ain), 0, spannableString.length() - 2, 33); spannableString.setSpan(new AbsoluteSizeSpan((int) this.Aih.getTextSize(), false), spannableString.length() - 2, spannableString.length(), 33); this.Aih.setHint(new SpannedString(spannableString)); } this.Aih.setGravity(this.pIE); this.Aih.setTextColor(this.pIF); setText(this.pIG); b.a(this.Aih, this.Aio); this.Aih.setBackgroundResource(this.pIJ); this.Aih.setEnabled(this.pIK); this.Aih.setFocusable(this.pIM); this.Aih.setClickable(this.pIL); this.Aih.setHintTextColor(this.pIP); setImeOptions(this.pIO); setInputType(this.pIN); this.Aih.addTextChangedListener(new TextWatcher() { private boolean pIR = false; public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } public final void afterTextChanged(Editable editable) { AppMethodBeat.i(49410); boolean asa = WalletFormView.this.asa(); if (WalletFormView.this.Aii != null) { if (asa != this.pIR) { WalletFormView.this.Aii.hY(asa); this.pIR = WalletFormView.this.asa(); } if ((WalletFormView.this.Aii instanceof b) && asa) { WalletFormView.this.Aii; } } WalletFormView.i(WalletFormView.this); AppMethodBeat.o(49410); } }); this.Aih.setOnFocusChangeListener(this); try { if (!bo.gW(this.Air, 0)) { Field declaredField = TextView.class.getDeclaredField("mCursorDrawableRes"); declaredField.setAccessible(true); declaredField.set(this.Aih, Integer.valueOf(this.Air)); } } catch (Exception e) { ab.e("MicroMsg.WalletFormView", "set textCursorDrawable fail!!"); } } cew(); if (this.Aih != null) { if (this.pIN == 2) { this.Aih.setKeyListener(new NumberKeyListener() { public final int getInputType() { return 3; } /* Access modifiers changed, original: protected|final */ public final char[] getAcceptedChars() { return new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; } }); } else if (this.pIN == 4) { this.Aih.setKeyListener(new NumberKeyListener() { public final int getInputType() { return 1; } /* Access modifiers changed, original: protected|final */ public final char[] getAcceptedChars() { return new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'x', 'X'}; } }); } else if (this.pIN == 128) { this.Aih.setTransformationMethod(PasswordTransformationMethod.getInstance()); this.Aih.setKeyListener(new NumberKeyListener() { public final int getInputType() { return 18; } /* Access modifiers changed, original: protected|final */ public final char[] getAcceptedChars() { return new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'}; } }); this.Aih.setRawInputType(18); } else if (this.pIN == 3) { this.Aih.setKeyListener(new NumberKeyListener() { public final int getInputType() { return 3; } /* Access modifiers changed, original: protected|final */ public final char[] getAcceptedChars() { return new char[]{'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-'}; } }); } else { this.Aih.setInputType(this.pIN); } if (this.pIH != -1) { this.Aih.setFilters(new InputFilter[]{new LengthFilter(this.pIH)}); } } AppMethodBeat.o(49427); } public final void setHint(CharSequence charSequence) { AppMethodBeat.i(49428); if (this.Aih != null) { if (this.Ain == -1) { this.Aih.setHint(charSequence); AppMethodBeat.o(49428); return; } SpannableString spannableString = new SpannableString(charSequence); spannableString.setSpan(new AbsoluteSizeSpan(this.Ain, false), 0, spannableString.length(), 33); this.Aih.setHint(new SpannedString(spannableString)); } AppMethodBeat.o(49428); } public final void setContentClickable(boolean z) { AppMethodBeat.i(49429); if (this.Aih != null) { this.Aih.setClickable(z); } AppMethodBeat.o(49429); } public final void setContentFocusable(boolean z) { AppMethodBeat.i(49430); if (this.Aih != null) { this.Aih.setFocusable(z); } AppMethodBeat.o(49430); } public final void setContentEnabled(boolean z) { AppMethodBeat.i(49431); if (this.Aih != null) { this.Aih.setEnabled(z); } AppMethodBeat.o(49431); } public final void setFilterChar(char[] cArr) { } public final void setOnEditorActionListener(OnEditorActionListener onEditorActionListener) { AppMethodBeat.i(49432); this.Aih.setOnEditorActionListener(onEditorActionListener); AppMethodBeat.o(49432); } /* Access modifiers changed, original: protected|final */ @SuppressLint({"WrongCall"}) public final void onMeasure(int i, int i2) { AppMethodBeat.i(49433); if (this.Aij == null || !this.Aij.dOT()) { super.onMeasure(i, i2); } AppMethodBeat.o(49433); } public final boolean onInterceptTouchEvent(MotionEvent motionEvent) { AppMethodBeat.i(49434); if (this.Aij != null && this.Aij.dOU()) { AppMethodBeat.o(49434); return true; } else if (this.Aih != null && b(this.Aih, motionEvent) && !this.Aih.isClickable()) { ab.d("MicroMsg.WalletFormView", "hy: click on content but content is not clickable. whole view perform click"); AppMethodBeat.o(49434); return true; } else if (b(this.pIn, motionEvent) && motionEvent.getAction() == 1) { ab.d("MicroMsg.WalletFormView", "hy: click on info iv"); cew(); this.pIn.performClick(); AppMethodBeat.o(49434); return true; } else { AppMethodBeat.o(49434); return false; } } private boolean b(View view, MotionEvent motionEvent) { AppMethodBeat.i(49435); if (view == null || view.getVisibility() != 0) { AppMethodBeat.o(49435); return false; } else if (dt(view).contains((int) motionEvent.getX(), (int) motionEvent.getY())) { AppMethodBeat.o(49435); return true; } else { AppMethodBeat.o(49435); return false; } } private Rect l(View view, Rect rect) { if (view == this.pIn) { rect.left -= 50; rect.right += 50; rect.top -= 25; rect.bottom += 25; } return rect; } private Rect dt(View view) { AppMethodBeat.i(49436); if (view != null) { Rect rect = new Rect(); view.getHitRect(rect); rect = l(view, rect); AppMethodBeat.o(49436); return rect; } AppMethodBeat.o(49436); return null; } private void dOR() { AppMethodBeat.i(49437); if (getTitleTv() != null) { getTitleTv().setText(this.pIv); getTitleTv().setVisibility(this.pIw); } AppMethodBeat.o(49437); } public final TextView getTitleTv() { return this.iDT; } public final WalletIconImageView getInfoIv() { return this.pIn; } public final TextView getTipsTv() { return this.pIo; } public final TextView getPrefilledTv() { return this.pIl; } public final void setSelection(int i) { AppMethodBeat.i(49438); if (this.Aih != null) { this.Aih.setSelection(i); } AppMethodBeat.o(49438); } public final com.tencent.mm.wallet_core.ui.formview.a.a getEventDelegate() { return this.Aij; } public final com.tencent.mm.wallet_core.ui.formview.a.b getLogicDelegate() { return this.Aik; } public final String getText() { AppMethodBeat.i(49439); String a; if (this.Aih != null) { a = com.tencent.mm.wallet_core.ui.formview.c.a.a(this.Aim, this.Aih); if (this.Aik == null || !this.Aik.cev()) { AppMethodBeat.o(49439); return a; } a = this.Aik.e(this, a); AppMethodBeat.o(49439); return a; } ab.e("MicroMsg.WalletFormView", "hy: no content et. return nil"); a = ""; AppMethodBeat.o(49439); return a; } public final KeyListener getKeyListener() { AppMethodBeat.i(49440); if (this.Aih != null) { KeyListener keyListener = this.Aih.getKeyListener(); AppMethodBeat.o(49440); return keyListener; } ab.w("MicroMsg.WalletFormView", "hy: no content et"); AppMethodBeat.o(49440); return null; } public final EditText getContentEt() { return this.Aih; } public final void setMaxInputLength(int i) { this.pIH = i; } public final void setMinInputLength(int i) { this.pII = i; } public final int getMaxInputLength() { return this.pIH; } public final int getMinInputLength() { return this.pII; } public final void setBankcardTail(String str) { AppMethodBeat.i(49441); if (this.Aih != null) { this.Aih.setBankcardTailNum(str); } AppMethodBeat.o(49441); } public final int getEncrptType() { return this.Aim; } public final void setOnClickListener(OnClickListener onClickListener) { AppMethodBeat.i(49442); super.setOnClickListener(onClickListener); AppMethodBeat.o(49442); } public final void setOnInfoIvClickListener(OnClickListener onClickListener) { AppMethodBeat.i(49443); this.pIr = onClickListener; if (getInfoIv() != null) { getInfoIv().setOnClickListener(this.pIr); } AppMethodBeat.o(49443); } public final void setOnInputValidChangeListener(a aVar) { this.Aii = aVar; } public final void setOnFocusChangeListener(OnFocusChangeListener onFocusChangeListener) { this.pIq = onFocusChangeListener; } public final void setEventDelegate(com.tencent.mm.wallet_core.ui.formview.a.a aVar) { this.Aij = aVar; } public final void setLogicDelegate(com.tencent.mm.wallet_core.ui.formview.a.b bVar) { this.Aik = bVar; } public final void setEncryptType(int i) { this.Aim = i; } public final boolean isPhoneNum() { AppMethodBeat.i(49444); if (this.Aih == null) { AppMethodBeat.o(49444); return false; } boolean isPhoneNum = this.Aih.isPhoneNum(); AppMethodBeat.o(49444); return isPhoneNum; } public final void a(TextWatcher textWatcher) { AppMethodBeat.i(49445); if (this.Aih != null) { this.Aih.addTextChangedListener(textWatcher); } AppMethodBeat.o(49445); } public final void setKeyListener(KeyListener keyListener) { AppMethodBeat.i(49446); if (this.Aih != null) { this.Aih.setKeyListener(keyListener); } AppMethodBeat.o(49446); } public final boolean asa() { AppMethodBeat.i(49447); if (this.Aih != null) { int inputLength = this.Aih.getInputLength(); if (inputLength > this.pIH || inputLength < this.pII) { AppMethodBeat.o(49447); return false; } else if (this.Aik != null) { boolean a = this.Aik.a(this); AppMethodBeat.o(49447); return a; } else { AppMethodBeat.o(49447); return true; } } ab.e("MicroMsg.WalletFormView", "hy: no content edit text. true as default"); AppMethodBeat.o(49447); return true; } public final void cey() { AppMethodBeat.i(49448); if (this.Aih != null) { this.Aih.ClearInput(); } AppMethodBeat.o(49448); } public final void cex() { AppMethodBeat.i(49449); if (this.Aih != null) { this.Aih.clearFocus(); } AppMethodBeat.o(49449); } public final boolean fx(View view) { AppMethodBeat.i(49450); if (getVisibility() != 0) { if (view != null) { view.setVisibility(8); } AppMethodBeat.o(49450); return true; } else if (bo.isNullOrNil(getText())) { if (view != null) { view.setVisibility(4); } if (this.iDT != null) { this.iDT.setEnabled(true); } AppMethodBeat.o(49450); return false; } else if (asa()) { if (view != null) { view.setVisibility(4); } if (this.iDT != null) { this.iDT.setEnabled(true); } AppMethodBeat.o(49450); return true; } else { if (view != null) { view.setVisibility(0); } if (this.iDT != null) { this.iDT.setEnabled(false); } AppMethodBeat.o(49450); return false; } } public final void setFilters(InputFilter[] inputFilterArr) { AppMethodBeat.i(49451); if (this.Aih != null) { this.Aih.setFilters(inputFilterArr); } AppMethodBeat.o(49451); } public final int getInputLength() { AppMethodBeat.i(49452); if (this.Aih != null) { int inputLength = this.Aih.getInputLength(); AppMethodBeat.o(49452); return inputLength; } AppMethodBeat.o(49452); return 0; } public final void dOS() { AppMethodBeat.i(49453); if (this.Aih != null) { this.Aih.setFocusable(true); this.Aih.requestFocus(); ((InputMethodManager) getContext().getSystemService("input_method")).showSoftInput(this.Aih, 0); } AppMethodBeat.o(49453); } public final void f(WalletBaseUI walletBaseUI) { AppMethodBeat.i(49454); if (this.Aih != null) { this.Aih.setFocusable(true); this.Aih.requestFocus(); walletBaseUI.dOC(); } AppMethodBeat.o(49454); } public final void setIsSecretAnswer(boolean z) { AppMethodBeat.i(49455); if (this.Aih != null) { this.Aih.setIsSecurityAnswerFormat(z); } AppMethodBeat.o(49455); } public final void onFocusChange(View view, boolean z) { AppMethodBeat.i(49456); if (this.pIq != null) { this.pIq.onFocusChange(this, z); } if (this.Aii != null) { this.Aii.hY(asa()); } if (asa()) { if (this.iDT != null) { this.iDT.setEnabled(true); } } else if (this.iDT != null) { this.iDT.setEnabled(false); } cew(); AppMethodBeat.o(49456); } public final void set3DesToView(String str) { AppMethodBeat.i(49457); if (this.Aih != null) { this.Aih.set3DesEncrptData(str); } AppMethodBeat.o(49457); } }
2bb1745e7ba2e1d37450aa5f7d628b38c8900ea2
62e9e9cbcdde0a6ef47156e055f791bb90a63f13
/src/main/java/com/fjs/test/DateTest.java
556863af5dd4447015a5f51a62df7407580677d1
[]
no_license
machihaoyu/cronus
02e23973678042ea67b3dea22cb56ed86f9d96a6
915d6d9ab2bcc3badcb637432a388baaad9ad5c8
refs/heads/master
2020-03-26T08:12:12.567691
2018-08-22T08:57:59
2018-08-22T08:57:59
144,691,019
0
3
null
null
null
null
UTF-8
Java
false
false
3,803
java
package com.fjs.test; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.fjs.cronus.dto.cronus.EmplouInfo; import com.fjs.cronus.dto.cronus.QuestionsDTO; import com.fjs.cronus.util.DEC3Util; import org.w3c.dom.ls.LSInput; import javax.swing.event.ListDataEvent; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; import java.util.List; /** * Created by msi on 2017/10/11. */ public class DateTest { public static void main(String args[]){ /** * @ApiModelProperty(value = "企业名称",notes = "企业名称") private String companyName; @ApiModelProperty(value = "成立年限",notes = "成立年限") private String years; @ApiModelProperty(value = "年流水",notes = "年流水") private String turnover; @ApiModelProperty(value = "注册资本",notes = "注册资本") private String registerMoney; @ApiModelProperty(value = "认缴资本",notes = "认缴资本") private String subscribedMoney; @ApiModelProperty(value = "角色1法人 2股东 3高管",notes = "角色1法人 2股东 3高管") private Integer roles; @ApiModelProperty(value = "角色2股东占股多少",notes = "角色2股东占股多少") private String shares; @ApiModelProperty(value = "角色3高管 职位",notes = "角色3高管 职位") private String position; @ApiModelProperty(value = "经营状态:1存续,2在业,3吊销,4注销,5迁出,6迁入,7停业,8清算",notes = "经营状态:1存续,2在业,3吊销,4注销,5迁出,6迁入,7停业,8清算") private Integer status; */ /* Calendar cal = Calendar.getInstance();//使用默认时区和语言环境获得一个日历。 cal.add(Calendar.DAY_OF_YEAR, -100);//取当前日期的后一天. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.out.println(cal.getTime());*/ /*List<QuestionsDTO> questionsDTOS = new ArrayList<>(); QuestionsDTO questionsDTO = new QuestionsDTO(); QuestionsDTO questionsDTO2 = new QuestionsDTO(); QuestionsDTO questionsDTO3 = new QuestionsDTO(); questionsDTO.setName("asdad"); questionsDTO.setAnswer("zhangdsaf"); questionsDTO2.setName("asdasdfsa"); questionsDTO2.setAnswer("dsfsfafsdf"); questionsDTO3.setName("dfasdfasdfasdf"); questionsDTO3.setAnswer("dasfasfasfs"); questionsDTOS.add(questionsDTO); questionsDTOS.add(questionsDTO2); questionsDTOS.add(questionsDTO3); //*/ /* JSONObject jsonObject = new JSONObject(); // a:1:{i:0;a:3:{s:7:"content";s:12:"按规定发";s:14:"create_user_id";s:1:"1";s:11:"create_time";i:1512095726;}} jsonObject.put("content","按规定发"); jsonObject.put("create_user_id","1"); jsonObject.put("create_time","1512095726"); // a:1:{i:0;a:3:{s:7:"content";s:12:"按规定发";s:14:"create_user_id";s:1:"1";s:11:"create_time";i:1512095726;}} JSONObject jsonObject1 = new JSONObject(); jsonObject1.put("content","sdaadsfasdfasf"); jsonObject1.put("create_user_id","1"); jsonObject1.put("create_time","1512095726"); JSONArray jsonArray = new JSONArray(); jsonArray.add(jsonObject); jsonArray.add(jsonObject1); System.out.println(jsonArray.toString());*/ String telephone = "13162706810"; String phoneNumber = telephone.substring(0, 6) + "****" + telephone.substring(3, telephone.length()); System.out.println(phoneNumber); } }
2ecd50cf821eae029c633921fd0db1168e70698d
c03a28264a1da6aa935a87c6c4f84d4d28afe272
/Leetcode/src/linkedin/Permutations.java
8cdb92ed5634af5e3c1741822b61fa782d4209bc
[]
no_license
bbfeechen/Algorithm
d59731686f06d6f4d4c13d66a8963f190a84f361
87a158a608d842e53e13bccc73526aadd5d129b0
refs/heads/master
2021-04-30T22:35:03.499341
2019-05-03T07:26:15
2019-05-03T07:26:15
7,991,128
1
1
null
null
null
null
UTF-8
Java
false
false
1,200
java
package linkedin; import java.util.ArrayList; import java.util.List; public class Permutations { public static List<List<Integer>> permute(int[] num) { List<List<Integer>> result = new ArrayList<List<Integer>>(); if(num == null) { return result; } List<Integer> solution = new ArrayList<Integer>(); helper(result, solution, num); return result; } private static void helper(List<List<Integer>> result, List<Integer> solution, int[] num) { if(solution.size() == num.length) { result.add(new ArrayList<Integer>(solution)); return; } for(int i = 0; i < num.length; i++) { if(solution.contains(num[i])) { continue; } solution.add(num[i]); helper(result, solution, num); solution.remove(solution.size() - 1); } } public static void main(String[] args) { int[] num = {1,2,3}; List<List<Integer>> result = permute(num); for(List<Integer> list : result) { System.out.print("["); for(int i : list) { System.out.print(i + ""); } System.out.print("]"); } } }
1d9cd5c39892c97a2a3d31abeb822bc48a5da3ba
cbb8ad0799cc1bca7f07a57719ad0819e8b11eb0
/src/main/java/com/example/bootdemo/utils/annotation/DataValidate.java
2ef9a4dd062acac90f4da9546e8955e1dfe7d1ba
[]
no_license
allworldall/bootDemo
b468140dea2aa61b5ec8f2b3845427d87b094d4e
21294fb08dbbebffa01aa7751645e07b90619147
refs/heads/master
2020-03-17T17:03:03.683171
2019-04-13T06:30:53
2019-04-13T06:30:53
133,773,013
0
0
null
2019-04-13T06:32:38
2018-05-17T07:04:57
Java
UTF-8
Java
false
false
838
java
package com.example.bootdemo.utils.annotation; 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.FIELD, ElementType.PARAMETER}) public @interface DataValidate { //是否可以为空 boolean nullable() default false; //最大长度 int maxLength() default Integer.MAX_VALUE; //最小长度 int minLength() default 0; //固定长度 int length() default 0; //提供常用的正则表达式验证 RegexType regexType() default RegexType.NONE; //自定义正则验证 String regexExpression() default ""; //参数字段描述,为显示友好的异常信息 String description() default ""; }
ceb970f65f0cba580d3a406d1884b24c2757c040
1c9b45cc8545e1a0c3709c1ebbbfb7316906a239
/src/main/java/com/tellnow/api/main/TellnowWebXml.java
ec2b17961600e340a0ce8cfc9a81dc19147adb9c
[]
no_license
saachigopal/TellNow
ba4d642d610e1e1261cfbd2755075c8431493893
f916c802f27189d4adaaa02d894472374d560af6
refs/heads/master
2021-08-31T00:23:30.835760
2015-07-01T11:40:41
2015-07-01T11:40:41
114,824,489
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.tellnow.api.main; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.context.web.SpringBootServletInitializer; public class TellnowWebXml extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } }
be26457b7d8a999820d34d3dba5801a12c4f5601
ed3c45d30725ad4b9589fc1dec5584d92db0a742
/src/test/java/commons/basedActions.java
c25fe41aea95afe71bbaf0a9289f36df02ce602b
[]
no_license
trung1987/cucumber_pom
510420209435cfc9abfcf1b4e99ba654fe59d346
232a3bddbf6a5722845640f0076d247737a07bd6
refs/heads/master
2022-07-27T21:18:50.915253
2019-06-30T11:25:51
2019-06-30T11:25:51
194,507,690
0
0
null
2022-06-29T17:29:00
2019-06-30T11:21:55
HTML
UTF-8
Java
false
false
6,137
java
package commons; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.Select; import org.testng.Assert; public class basedActions { public void openURL(WebDriver driver, String URL) { driver.get(URL); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } public void enterText(WebDriver driver, String xpath, String input) { WebElement element =driver.findElement(By.xpath(xpath)); element.clear(); element.sendKeys(input); } public void clickBtn(WebDriver driver, String xpath) { WebElement element =driver.findElement(By.xpath(xpath)); element.click(); } public void acceptAlert(WebDriver driver) { Alert myAlert = driver.switchTo().alert(); myAlert.accept(); } public String getValue(WebDriver driver, String xpath) { WebElement element = driver.findElement(By.xpath(xpath)); return element.getText(); } public String getAlertMsg(WebDriver driver) { Alert myAlert = driver.switchTo().alert(); return myAlert.getText(); } public void assertValue(WebDriver driver,String returnMsg, String expectedMsg) { Assert.assertEquals(returnMsg, expectedMsg); } //Capture each step /*public static String captureEachStep(WebDriver driver) throws IOException { String dateName = new SimpleDateFormat("yyyyMMDDhhmmss").format(new Date()); TakesScreenshot ts = (TakesScreenshot)driver; File source = ts.getScreenshotAs(OutputType.FILE); String dest = System.getProperty("user.dir") +"/report/testReport_screenShot"+dateName+".png"; File destination = new File(dest); FileUtils.copyFile(source, destination); return dest; }*/ /*Execise defines other general actions*/ /*Web Browser*/ public void getTitle(WebDriver driver) { driver.getTitle(); } public String getCurrentURL(WebDriver driver) { return driver.getCurrentUrl(); } public void back(WebDriver driver) { driver.navigate().back(); } public void forward(WebDriver driver) { driver.navigate().forward(); } public void refresh(WebDriver driver) { driver.navigate().refresh(); } /*Alert*/ public void cancelAlert(WebDriver driver) { Alert myAlert = driver.switchTo().alert(); myAlert.dismiss(); } public void sendkeyToAlert(WebDriver driver, String keysToSend) { Alert myAlert = driver.switchTo().alert(); myAlert.sendKeys(keysToSend); } /*Web Element*/ public void clickToEleByJs(WebDriver driver, String objectToClick) { JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("arguments[0].click();", objectToClick); } public void clickToEleByAction(WebDriver driver, String xpath) { WebElement element = driver.findElement(By.xpath(xpath)); Actions action = new Actions(driver); action.click(element).build().perform(); } public void selectItemInHtmlDropDownByIndex(WebDriver driver, String xpath, Integer index) { Select dropDown = new Select(driver.findElement(By.xpath(xpath))); dropDown.selectByIndex(index); } public void selectItemInHtmlDropDownByValue(WebDriver driver, String xpath, String value) { Select dropDown = new Select(driver.findElement(By.xpath(xpath))); dropDown.selectByValue(value); } public void selectItemInHtmlDropDownByInvisibleText(WebDriver driver, String xpath, String value) { Select dropDown = new Select(driver.findElement(By.xpath(xpath))); dropDown.selectByVisibleText(value); } public String getSelectedItemInHtmlDropDown(WebDriver driver, String xpath, String value) { Select dropDown = new Select(driver.findElement(By.xpath(xpath))); WebElement select = dropDown.getFirstSelectedOption(); return select.getText(); } public void checkTheCheckBox(WebDriver driver, String checkBoxName) { //If type = 'checkbox', Ex: <.input type="checkbox" name="vehicle" value="Bike">I have a bike<br /> List<WebElement> checkbox = driver.findElements(By.name(checkBoxName)); ((WebElement) checkbox.get(0)).click(); /*OR by xpath: WebElement elementToClick = driver.findElement(By.xpath(xpath)); elementToClick.click();*/ } public void UncheckTheCheckBox(WebDriver driver, String xpath) { //If type = 'checkbox' WebElement checkBox = driver.findElement(By.xpath(xpath)); boolean checkStatus; checkStatus = checkBox.isSelected(); if(checkStatus == true) { checkBox.click(); } else { System.out.println("it has been uncheck already"); } } public boolean isControlDisplayed(WebDriver driver, String xpath) { WebElement checkItem = driver.findElement(By.xpath(xpath)); return checkItem.isDisplayed(); } public boolean isControlSelected(WebDriver driver, String xpath) { WebElement checkItem = driver.findElement(By.xpath(xpath)); return checkItem.isSelected(); } public boolean isControlEnabled(WebDriver driver, String xpath) { WebElement checkItem = driver.findElement(By.xpath(xpath)); return checkItem.isEnabled(); } /*scrollByJSToBottom ->javascript /Action - NOT YET*/ /*iframe/tab: ----*/ public void switchToIframe(WebDriver driver) { Set<String> tabList = driver.getWindowHandles(); //System.out.println("tabList value" + tabList); for (String activeTab :tabList) { driver.switchTo().window(activeTab); } } /* Remaining: .switchToMainFrame .switchToTabByIndex*/ //-uploadFile -remaining - robot and some others public void upFileSendKey(WebDriver driver, String xpathBtn, String uploadPath, String xpathUploadTo,String beginXpathBtn, Integer index) { WebElement uploadBtn = driver.findElement(By.xpath(xpathBtn)); WebElement beginUploadBtn = driver.findElement(By.xpath(beginXpathBtn)); Select uploadTo = new Select(driver.findElement(By.xpath(xpathUploadTo))); uploadBtn.click(); uploadBtn.sendKeys(uploadPath); uploadTo.selectByIndex(index); } }
a92ea9929c6a4b64e5a8870a1e565ad8afb0467f
c8879ad139355c0c2962b012350a9d16c0c1e42c
/Android [JAVA]/Zipper.java
da3629252245998ae18e371260e8f83517abe215
[ "MIT" ]
permissive
nalancer08/zipper-rarper
0c65d923e479786405732b7e7cf9ad1ca600d420
738be6a44bb4725aaf2deef1f492484285b45a10
refs/heads/master
2021-01-11T15:52:33.347139
2017-01-27T00:38:26
2017-01-27T00:38:26
79,947,023
0
0
null
null
null
null
UTF-8
Java
false
false
2,959
java
package com.appbuilders.libraries; import android.util.Log; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; /** * Created by saer6003 on 26/01/2017. */ public class Zipper { private String path; public Zipper() { String path = "/storage/emulated/0/media/hummingbird.zip"; ZipInputStream zipIs = null; try { zipIs = new ZipInputStream( new FileInputStream(path)); } catch (FileNotFoundException e) { e.printStackTrace(); } ZipEntry entry = null; try { while ( ( entry = zipIs.getNextEntry() ) != null ){ if ( entry.isDirectory() ) { Log.d("AB_DEV", "Directory: "); } else { System.out.print("File: "); } Log.d("AB_DEV", entry.getName() + "\n"); } } catch (IOException e) { e.printStackTrace(); } try { zipIs.close(); } catch (IOException e) { e.printStackTrace(); } } public void unZip() { String path = "/storage/emulated/0/media/hummingbird.zip"; String out = "/storage/emulated/0/media/hummingbird_auto"; // Create Output folder if it does not exists File folder = new File(out); if (!folder.exists()) { folder.mkdirs(); } // Create buffer byte[] buffer = new byte[1024]; ZipInputStream zipIs = null; try { // Create ZipInputStream read a file from path. zipIs = new ZipInputStream(new FileInputStream(path)); ZipEntry entry = null; // Read ever Entry (From top to bottom until the end) while ((entry = zipIs.getNextEntry()) != null) { String entryName = entry.getName(); String outFileName = out + File.separator + entryName; System.out.println("Unzip: " + outFileName); if (entry.isDirectory()) { // Make directories new File(outFileName).mkdirs(); } else { // Create Stream to write file. FileOutputStream fos = new FileOutputStream(outFileName); int len; // Read the data on the current entry. while ((len = zipIs.read(buffer)) > 0) { fos.write(buffer, 0, len); } fos.close(); } } } catch (Exception e) { e.printStackTrace(); } finally { try { zipIs.close(); } catch (Exception e) { } } } }
fd5999662040fb65330c141cb9598f31103125fd
393973e99ee8940a9503f91348b5b3b9acada7f8
/src/bridgePattern/Image.java
34785333153b85881c020e32612ed6959e7b3788
[]
no_license
crazyda/pattern-23
fd3b33d0e09c81ec552b1f513a9871527feab8d9
420c3e0b404e8e05d064d0abdf53d22b21bb7111
refs/heads/master
2020-09-07T10:53:07.787566
2019-11-10T07:34:39
2019-11-10T07:34:39
220,755,945
0
0
null
null
null
null
GB18030
Java
false
false
626
java
/** * @Title: Image.java * @Package bridgePattern * @Description: * Copyright: Copyright (c) 2018 * Website: www.panzhijie.cn * * @Author Crazy * @DateTime 2019年11月2日 下午10:00:22 * @version V1.0 */ package bridgePattern; /** * @ClassName: Image * @Description: 抽象图像类,充当抽象类 * @Author Crazy * @DateTime 2019年11月2日 下午10:00:22 */ public abstract class Image { protected ImageImp imp ; //注入实现类接口对象 public void setImageImp(ImageImp imp) { this.imp = imp; } public abstract void parseFile(String fileName); }
89ba7cf75c58bf5266881b577a6faedaa5fc2de6
da3892ef3b0e5a6d5ef41142f0b521b398edb543
/src/main/java/edu/swjtuhc/cgService/mapper/ReservationMapper.java
013033a79a44a4e31ee445cdf479bb8b41336745
[]
no_license
ImNotAFrog/Career-guidance-service
39905d764a0152d45986b81a161af004ec2488f7
226b5f677a29a7aa6a3a4a17f25096d522c543bd
refs/heads/master
2020-09-12T11:28:45.913254
2020-01-01T14:19:09
2020-01-01T14:19:09
222,409,428
0
0
null
null
null
null
UTF-8
Java
false
false
522
java
package edu.swjtuhc.cgService.mapper; import java.util.List; import org.apache.ibatis.annotations.Mapper; import edu.swjtuhc.cgService.model.Reservation; @Mapper public interface ReservationMapper { Reservation getReservationByrId(Long rId); Integer createReservation(Reservation reservation); Integer updateReservation(Reservation reservation); Integer deleteReservation(Reservation reservation); public List<Reservation> getReservation(); public List<Reservation> getAllReservation(); }
[ "hp@LAPTOP-8D65V861" ]
hp@LAPTOP-8D65V861
859374a4fb6253d137a26f0e411a11b3f478b716
f2e8f78902cb19c64b2ad308aa43ae148b9c181b
/webapp/src/main/java/com/flinkinfo/demo/controller/demo/SimpleCORSFilter.java
8cca898e11f1769f3f440fd7d035f2573943b00c
[]
no_license
qq523160615/spring-mvc-demo
7e8d78c6b33b1c6138c136cf819895b676402b5b
b46defb0c5ec884a6b1eaffdc319ede7a1fb8453
refs/heads/master
2021-01-10T04:52:55.097862
2016-04-06T02:07:30
2016-04-06T02:07:30
53,953,649
0
0
null
null
null
null
UTF-8
Java
false
false
1,075
java
package com.flinkinfo.demo.controller.demo; import java.io.IOException; import javax.servlet.Filter; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; import org.springframework.stereotype.Component; @Component public class SimpleCORSFilter implements Filter { public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { HttpServletResponse response = (HttpServletResponse) res; response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "x-requested-with"); chain.doFilter(req, res); } public void init(FilterConfig filterConfig) { } public void destroy() { } }
7c02c9892ff89ff5acd075db59c8545be5e7fdea
25a39eab2c4afeceaa63722405a91aa9cb06884d
/app/src/test/java/com/Irondelle/ExampleUnitTest.java
8b180f2085374a7b1a310c3bdaa17290bd25cf8d
[]
no_license
PandaPoPy/arduino_thinkcode
d75a1c96117c6211b981eb9f966a02a4bee85d5a
42e7cae580470ad2945a31bd124af859732ec6a9
refs/heads/master
2021-05-11T21:37:37.930443
2018-02-16T12:58:27
2018-02-16T12:58:27
117,473,823
0
0
null
null
null
null
UTF-8
Java
false
false
391
java
package com.Irondelle; 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); } }
c06b618e45767c65aa6e58594377f72e0d69e9b7
e4b0a3c0ac1a452282ee23d4a6f4844e57cfc8ae
/Day038_mkFolder_CFile_Scanner_Buffered/src/Day038/File002.java
0c4f74d8a1a144229775ec89bcbde0169494b91f
[]
no_license
kimnewbie/selfstudy
bace8e6ec3e2ebda55c0d72d8527cef51a114f21
61b5eabfe206bea1ed72dd414a99d5c45a4930b5
refs/heads/master
2023-01-21T11:30:09.732492
2020-11-30T08:56:05
2020-11-30T08:56:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,766
java
package Day038; import java.io.BufferedWriter; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Scanner; public class File002 { public static void main(String[] args) { String folderPath = "C:\\file"; String filePath = "\\file002.txt"; File folder = new File(folderPath); if(!folder.exists()) {folder.mkdir(); System.out.println("1. 폴더생성완료!");} else {System.out.println("1. 폴더 있어요!");} File file = new File(filePath); try { if(!file.exists()) {file.createNewFile(); System.out.println("2. 파일생성완료!");} else {System.out.println("2. 파일 있어요!");} } catch(Exception e) {e.printStackTrace();} // Path output = Paths.get(folderPath+filePath); Scanner sc = new Scanner(System.in); String name = ""; int price = 0; System.out.print("ㅁ 우유 이름 입력 > "); name = sc.next(); System.out.print("ㅁ 우유 가격 입력 > "); price = sc.nextInt(); try { BufferedWriter writer = Files.newBufferedWriter(output, StandardCharsets.UTF_8); writer.write(""+name +"\t"+price); // 큰따옴표를 붙여야 price에 오류가 안생겨 int로 했을 때 writer.newLine(); writer.close(); // 파일작성 닫기(해야 저장완료) System.out.println("파일쓰기 성공!"); } catch (IOException e) {e.printStackTrace();} } } /** BufferedReader / BufferedWriter는 문자 입력 스트림으로부터 문자를 읽어 들이거나 문자 출력 스트림으로 문자를 내보낼 때 버퍼링을 함으로써 문자, 문자 배열, 문자열 라인 등을 보다 효율적으로 처리할 수 있도록 해준다 */
701efa1b5aa27fc3cca0583edacfffe1c9ed1a20
f89c8fb73f1a6df8523dad5675ec7fb99aeee5c0
/coverage1/IglooScore2.java
5ce2d83ce255f56d2a404a10ab60559d81008fab
[]
no_license
delunaselene/programs
f90562881626fa15837629d2aa0f7cca5bcd5167
0d0040463b774858c8e1e96a10277151d89ee3bf
refs/heads/master
2020-07-11T13:18:05.376311
2019-12-08T23:57:49
2019-12-08T23:57:49
204,550,377
0
0
null
null
null
null
UTF-8
Java
false
false
1,790
java
/*** * Olympic Igloo Scoring Class * * For the Winter Olympics igloo building event there are * three judges, each of which gives a score from 0 to 50 * (inclusive), but the lowest score is thrown out and the * competitor's overall score is just the sum of the two * highest scores. This class supports the recording of the * three judge's scores, and the computing of the competitor's * overall score. * ***/ public class IglooScore2 { int score1; int score2; int score3; public IglooScore2() { score1 = 0; score2 = 0; score3 = 0; } public void recordScores(int s1, int s2, int s3) { score1 = s1; score2 = s2; score3 = s3; } public int overallScore() { int s, s1, s2; if (score1 < score2 && score1 < score3) { s1 = score2; s2 = score3; } else if (score2 < score1 && score2 < score3) { s1 = score1; s2 = score3; } else if (score3 < score1 && score3 < score2) { s1 = score1; s2 = score2; } else { s1 = 99; s2 = 99; } s = s1 + s2; return s; } public static void main(String args[]) { int s1, s2, s3; if (args==null || args.length != 3) { System.err.println("Error: must supply three arguments!"); return; } try { s1 = Integer.parseInt(args[0]); s2 = Integer.parseInt(args[1]); s3 = Integer.parseInt(args[2]); } catch (Exception e) { System.err.println("Error: arguments must be integers!"); return; } if (s1<0 || s2<0 || s3<0 || s1>50 || s2>50 || s3>50) { System.err.println("Error: scores must be between 0 and 50!"); return; } IglooScore2 score = new IglooScore2(); score.recordScores(s1,s2,s3); System.out.println("Overall score: " + score.overallScore()); return; } } // end class
a27187c694cd10a890625ba04ce23c6565e53939
9b7b4a78ed80110a4f06c798265c254927b2bd10
/src/main/java/com/xingyun/smartsite/service/Engineering/EngineeringScheduleService.java
620a1bfda467c6743fee86761c461e9ee30e9904
[]
no_license
chysos/smartsite1
eaaa0000ba84109b25b109b32901c037d33558f8
b460d1a5036b47bed99bb2ba75d10248d20959d6
refs/heads/master
2021-05-08T02:52:00.082126
2017-10-30T00:59:06
2017-10-30T00:59:06
108,093,949
0
0
null
null
null
null
UTF-8
Java
false
false
278
java
package com.xingyun.smartsite.service.Engineering; import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; @Service public interface EngineeringScheduleService { List<EngineeringScheduleModel> getSchedule(Map<String,String> select); }
0a82f2e4f5a83c24f96a05ffa8079de02d3eb29a
a8e9e13e89d405cf487cca69e8b9d88f8558bae7
/OOP_Project/src/IQueue.java
9813e30a5bc9e71c93a08803fa265d54f022ab17
[]
no_license
burcuolmez/DesktopApplication
eeae53fe7f95507ec77061f188de45dbd47a9aa6
0a0a94cf4c8dbed2bdc0f9084010a094e9b40069
refs/heads/main
2023-03-07T11:06:11.599910
2021-02-18T20:16:11
2021-02-18T20:16:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package src; public interface IQueue { public void enqueue(Object item) throws QueueFull; public Object peek() throws QueueEmpty; public Object dequeue() throws QueueEmpty;; public boolean isEmpty(); }
a99f167872b018c98f5b5e99172a2f56b9f6bce9
3e10fdc56fbc80532471d7bb67e1bd4d44e9199d
/src/test/java/com/vinaylogics/recipeapp/controllers/IndexesControllerTest.java
74a94b3bcdb482516b269ffc11f62110f3a7851b
[]
no_license
VinayagamD/Recipe-App
7f51ec5eed368d07e7c43f62944072a04a3caa60
ad9f874db6d5c7d981134531ea8d710d51cb7ea0
refs/heads/master
2020-05-24T16:55:55.016396
2019-07-01T12:32:17
2019-07-01T12:32:17
187,372,103
0
0
null
null
null
null
UTF-8
Java
false
false
2,493
java
package com.vinaylogics.recipeapp.controllers; import com.vinaylogics.recipeapp.domain.Recipe; import com.vinaylogics.recipeapp.services.RecipeService; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.ui.Model; import java.util.HashSet; import java.util.Set; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; /** * Test for class {@link IndexesController} */ public class IndexesControllerTest { @Mock RecipeService recipeService; @Mock Model model; IndexesController indexesController; @Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); indexesController = new IndexesController(recipeService); } @After public void tearDown() throws Exception { } @Test public void testMockMVC() throws Exception { MockMvc mockMvc = MockMvcBuilders.standaloneSetup(indexesController) .build(); mockMvc.perform(MockMvcRequestBuilders.get("/")) .andExpect(status().isOk()) .andExpect(view().name("index")); } /** * test for method {@link IndexesController#getIndexPage(Model)} */ @Test public void getIndexPage() { // given Set<Recipe> recipes = new HashSet<>(); recipes.add(new Recipe()); Recipe recipe = new Recipe(); recipe.setId(1l); recipes.add(recipe); when(recipeService.getRecipes()).thenReturn(recipes); ArgumentCaptor<Set<Recipe>> argumentCaptor = ArgumentCaptor.forClass(Set.class); //When String viewName = indexesController.getIndexPage(model); //Then assertEquals("index",viewName); verify(recipeService, times(1)).getRecipes(); verify(model,times(1)).addAttribute(eq("recipes"),argumentCaptor.capture()); Set<Recipe> setInController = argumentCaptor.getValue(); assertEquals(2, setInController.size()); } }
49441d3a06e9bfda614bbf7c1b39e023704a7418
b6a7047cdc87c454e927a5595f0d5a494ed4b40b
/HomeMonitor/src/main/java/com/clopez/homemonitor/LastPictures.java
e1f6de33b04d9c77429bdc587fca78606ab04a3b
[]
no_license
cluis-lopez/HomeMonitor
c168b870e5ca9b36d005037c3f025567ead92ca6
01db76edb1ba41ff19bd0144b7f39151197cc33e
refs/heads/master
2021-01-11T15:57:45.910424
2017-06-12T23:36:42
2017-06-12T23:36:42
80,142,346
1
0
null
null
null
null
UTF-8
Java
false
false
4,166
java
package com.clopez.homemonitor; import java.io.IOException; import java.io.PrintStream; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.TimeZone; import java.util.TreeSet; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.appengine.api.appidentity.AppIdentityService; import com.google.appengine.api.appidentity.AppIdentityServiceFactory; import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.api.datastore.DatastoreServiceFactory; import com.google.appengine.api.datastore.Entity; import com.google.appengine.api.datastore.EntityNotFoundException; import com.google.appengine.api.datastore.FetchOptions; import com.google.appengine.api.datastore.Key; import com.google.appengine.api.datastore.PreparedQuery; import com.google.appengine.api.datastore.Query; import com.google.appengine.api.datastore.Query.FilterOperator; import com.google.appengine.api.datastore.Query.SortDirection; import com.google.gson.Gson; /** * Servlet implementation class LastPictures */ public class LastPictures extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public LastPictures() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); SimpleDateFormat sdf = new SimpleDateFormat("EEEE dd-MM-YYYY z HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("Europe/Madrid")); LinkedList<Map<String, Object>> lista = new LinkedList<Map<String, Object>>(); // Create the URL to serve the pictures AppIdentityService appIdentity = AppIdentityServiceFactory.getAppIdentityService(); String bucket = appIdentity.getDefaultGcsBucketName(); String error = ""; // Get the last 9 entities of kind "Sample" with Pict != null Query q = new Query("Samples"); q.addSort("__key__", SortDirection.DESCENDING); PreparedQuery pq = ds.prepare(q); // List<Entity> ents = ds.prepare(q).asList(FetchOptions.Builder.withLimit(9)); // 3x3 TreeSet<Key> trees = new TreeSet<Key>(); // Now we'll store all the not // null url entity keys in a TreeSet for (Entity e : pq.asIterable()) { if (e.getProperty("Pict") != null){ trees.add(e.getKey()); } } int size= trees.size(); // size = num of not null Pict (ej. Samples with image URL) if (size == 0) { error = "No pictures stored"; } else { for (int i = 0; (i < size && i < 9); i++) { Key urlkey = trees.pollLast(); // As the TreeSet is ordered, // this entry is the last // non-null URL in the datastore try { Entity e = ds.get(urlkey); Date date = new Date(Long.parseLong(e.getKey().getName())); String ts = sdf.format(date); HashMap<String, Object> map = new HashMap<String, Object>(); map.put("Ts", ts); map.put("URL", bucket + "/" + e.getProperty("Pict")); lista.add(map); } catch (EntityNotFoundException e1) { error = "Cannot locate entity for the required Picture"; PrintStream ps = new PrintStream("Cannot locate entity for the last sample"); e1.printStackTrace(ps); e1.printStackTrace(); } } } // Generate the JSON here Gson gson = new Gson(); String json = gson.toJson(lista); resp.setContentType("application/json"); resp.setCharacterEncoding("UTF-8"); resp.setHeader("cache-control", "no-cache"); resp.getWriter().write(json); resp.flushBuffer(); //System.out.println("Enviado JSON Chart"); //System.out.println(json); } }
1ade15caaded9089896eea7aaa97094036ee91f7
44ce2b6bac8c2fafc5b3f782ab6af20df67bf53b
/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatporntubeRipperTest.java
6856eb06ed32ecbeb3ce7992ddd697a2fd232a7e
[ "MIT" ]
permissive
Owd-Larrd/ripme-1
2b7d2d9449259dcd2919e805b2a3b2702beb50a4
8f84d3f8ff3cbf391af7c738e2d6222b3f8b3657
refs/heads/master
2020-03-14T03:02:25.166788
2018-04-26T16:54:17
2018-04-26T16:54:17
131,411,862
1
0
null
2018-04-28T13:29:04
2018-04-28T13:29:03
null
UTF-8
Java
false
false
440
java
package com.rarchives.ripme.tst.ripper.rippers; import java.io.IOException; import java.net.URL; import com.rarchives.ripme.ripper.rippers.GfycatporntubeRipper; public class GfycatporntubeRipperTest extends RippersTest { public void testRip() throws IOException { GfycatporntubeRipper ripper = new GfycatporntubeRipper(new URL("https://gfycatporntube.com/blowjob-bunny-puts-on-a-show/")); testRipper(ripper); } }