blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e47bbf4264d3b0017d72c6fa259a04adda828ae7 | c2e6f7c40edce79fd498a5bbaba4c2d69cf05e0c | /src/main/java/com/google/android/gms/common/zzh.java | ed06314bf8d937217a05673da67f89ce81f44396 | [] | no_license | pengju1218/decompiled-apk | 7f64ee6b2d7424b027f4f112c77e47cd420b2b8c | b60b54342a8e294486c45b2325fb78155c3c37e6 | refs/heads/master | 2022-03-23T02:57:09.115704 | 2019-12-28T23:13:07 | 2019-12-28T23:13:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package com.google.android.gms.common;
import com.google.android.gms.common.util.VisibleForTesting;
@VisibleForTesting
final class zzh {
static final zze[] a = {new zzi(zze.a("0\u0004C0\u0003+ \u0003\u0002\u0001\u0002\u0002\t\u0000ÂàFdJ00")), new zzj(zze.a("0\u0004¨0\u0003 \u0003\u0002\u0001\u0002\u0002\t\u0000Õ
¸l}ÓNõ0"))};
}
| [
"apoorwaand@gmail.com"
] | apoorwaand@gmail.com |
1deaa9e05d89c78bdc10cab1570d039c31446919 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/JetBrains--intellij-community/1c98b28f08cb8dc815eb30818f622e7549240adb/after/Indent.java | 0c8ce579973c85ebc7f71466294716ddb55d911c | [] | no_license | fracz/refactor-extractor | 3ae45c97cc63f26d5cb8b92003b12f74cc9973a9 | dd5e82bfcc376e74a99e18c2bf54c95676914272 | refs/heads/master | 2021-01-19T06:50:08.211003 | 2018-11-30T13:00:57 | 2018-11-30T13:00:57 | 87,353,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,218 | java | /*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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.intellij.formatting;
/**
* The indent setting for a formatting model block. Indicates how the block is indented
* relative to its parent block.
* <p/>
* Number of factory methods of this class use <code>'indent relative to direct parent'</code> flag. It specified anchor parent block
* to use to apply indent.
* <p/>
* Consider the following situation:
* <p/>
* <pre>
* return a == 0
&& (b == 0
|| c == 0);
* </pre>
* <p/>
* Here is the following blocks hierarchy (going from child to parent):
* <p/>
* <ul>
* <li><code>'|| c == 0`</code>;</li>
* <li><code>'b == 0 || c == 0'</code>;</li>
* <li><code>'(b == 0 || c == 0)'</code>;</li>
* <li><code>'a == 0 && (b == 0 || c == 0)'</code>;</li>
* <li><code>'return a == 0 && (b == 0 || c == 0)'</code>;</li>
* </ul>
* <p/>
* By default formatter applies block indent to the first block ancestor (direct or indirect) that starts on a new line. That means
* that such an ancestor for both blocks <code>'|| c == 0'</code> and <code>'&& (b == 0 || c == 0)'</code>
* is <code>'return a == 0 && (b == 0 || c == 0)'</code>. That means that the code above is formatted as follows:
* <p/>
* <pre>
* return a == 0
* && (b == 0
* || c == 0);
* </pre>
* <p/>
* In contrast, it's possible to specify that direct parent block that starts on a line before target child block is used as an anchor.
* Initial formatting example illustrates such approach.
*
* @see com.intellij.formatting.Block#getIndent()
* @see com.intellij.formatting.ChildAttributes#getChildIndent()
*/
public abstract class Indent {
private static IndentFactory myFactory;
static void setFactory(IndentFactory factory) {
myFactory = factory;
}
/**
* Returns an instance of a regular indent, with the width specified
* in "Project Code Style | General | Indent".
* <p/>
* <b>Note:</b> returned indent is not set to be <code>'relative'</code> to it's direct parent block
*
* @return the indent instance.
* @see #getNormalIndent(boolean)
*/
public static Indent getNormalIndent() {
return myFactory.getNormalIndent(false);
}
/**
* Returns an instance of a regular indent, with the width specified
* in "Project Code Style | General | Indent" and given <code>'relative to direct parent'</code> flag
*
* @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free
* to get more information about that at class-level javadoc)
* @return newly created indent instance configured in accordance with the given parameter
*/
public static Indent getNormalIndent(boolean relativeToDirectParent) {
return myFactory.getNormalIndent(relativeToDirectParent);
}
/**
* Returns the standard "empty indent" instance, indicating that the block is not
* indented relative to its parent block.
*
* @return the empty indent instance.
*/
public static Indent getNoneIndent() {
return myFactory.getNoneIndent();
}
/**
* Returns the "absolute none" indent instance, indicating that the block will
* be placed at the leftmost column in the document.
*
* @return the indent instance.
*/
public static Indent getAbsoluteNoneIndent() {
return myFactory.getAbsoluteNoneIndent();
}
/**
* Returns the "absolute label" indent instance, indicating that the block will be
* indented by the number of spaces indicated in the "Project Code Style | General |
* Label indent" setting from the leftmost column in the document.
*
* @return the indent instance.
*/
public static Indent getAbsoluteLabelIndent() {
return myFactory.getAbsoluteLabelIndent();
}
/**
* Returns the "label" indent instance, indicating that the block will be indented by
* the number of spaces indicated in the "Project Code Style | General | Label indent"
* setting relative to its parent block.
*
* @return the indent instance.
*/
public static Indent getLabelIndent() {
return myFactory.getLabelIndent();
}
/**
* Returns the "continuation" indent instance, indicating that the block will be indented by
* the number of spaces indicated in the "Project Code Style | General | Continuation indent"
* setting relative to its parent block.
* <p/>
* <b>Note:</b> returned indent is not set to be <code>'relative'</code> to it's direct parent block
*
* @return the indent instance.
* @see #getContinuationIndent(boolean)
*/
public static Indent getContinuationIndent() {
return myFactory.getContinuationIndent(false);
}
/**
* Returns the "continuation" indent instance, indicating that the block will be indented by
* the number of spaces indicated in the "Project Code Style | General | Continuation indent"
* setting relative to its parent block and given <code>'relative to direct parent'</code> flag.
*
* @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free
* to get more information about that at class-level javadoc)
* @return newly created indent instance configured in accordance with the given parameter
*/
public static Indent getContinuationIndent(boolean relativeToDirectParent) {
return myFactory.getContinuationIndent(relativeToDirectParent);
}
/**
* Returns the "continuation without first" indent instance, indicating that the block will
* be indented by the number of spaces indicated in the "Project Code Style | General | Continuation indent"
* setting relative to its parent block, unless this block is the first of the children of its
* parent having the same indent type. This is used for things like parameter lists, where the first parameter
* does not have any indent and the remaining parameters are indented by the continuation indent.
* <p/>
* <b>Note:</b> returned indent is not set to be <code>'relative'</code> to it's direct parent block
*
* @return the indent instance.
* @see #getContinuationWithoutFirstIndent(boolean)
*/
public static Indent getContinuationWithoutFirstIndent() {//is default
return myFactory.getContinuationWithoutFirstIndent(false);
}
/**
* Returns the "continuation without first" indent instance, indicating that the block will
* be indented by the number of spaces indicated in the "Project Code Style | General | Continuation indent"
* setting relative to its parent block, unless this block is the first of the children of its
* parent having the same indent type. This is used for things like parameter lists, where the first parameter
* does not have any indent and the remaining parameters are indented by the continuation indent and given
* <code>'relative to direct parent'</code> flag.
*
* @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free
* to get more information about that at class-level javadoc)
* @return newly created indent instance configured in accordance with the given parameter
*/
public static Indent getContinuationWithoutFirstIndent(boolean relativeToDirectParent) {
return myFactory.getContinuationWithoutFirstIndent(relativeToDirectParent);
}
/**
* Returns an indent with the specified width.
* <p/>
* <b>Note:</b> returned indent is not set to be <code>'relative'</code> to it's direct parent block
*
* @param spaces the number of spaces in the indent.
* @return the indent instance.
* @see #getSpaceIndent(int, boolean)
*/
public static Indent getSpaceIndent(final int spaces) {
return myFactory.getSpaceIndent(spaces, false);
}
/**
* Returns an indent with the specified width and given <code>'relative to direct parent'</code> flag.
*
* @param spaces the number of spaces in the indent
* @param relativeToDirectParent flag the indicates if current indent object anchors direct block parent (feel free
* to get more information about that at class-level javadoc)
* @return newly created indent instance configured in accordance with the given parameter
*/
public static Indent getSpaceIndent(final int spaces, final boolean relativeToDirectParent) {
return myFactory.getSpaceIndent(spaces, relativeToDirectParent);
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
ae5932f0a6d6c4a7b7b3bab6ba56caf475d3a30c | f1abec4d472ab8ef7be47b4bb438ede9132c84c4 | /src/ciupka/pokemon/pokemon/abilities/context/Switch.java | 74e0f7915645e9bcd45665c2fb71220a42641734 | [] | no_license | CutyCupy/PokemonSpiel | 7b7063139da0cbcdba0ed8b706975c53cc3abb91 | c085537cf77566a3bf6e639f2872ddd252f10866 | refs/heads/master | 2023-06-06T18:43:09.723619 | 2021-07-09T19:11:36 | 2021-07-09T19:11:36 | 94,694,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 457 | java | package ciupka.pokemon.pokemon.abilities.context;
import ciupka.pokemon.pokemon.Pokemon;
public class Switch {
private Pokemon target;
private Pokemon replacement;
public Switch(Pokemon target, Pokemon replacement) {
this.target = target;
this.replacement = replacement;
}
public Pokemon getTarget() {
return this.target;
}
public Pokemon getReplacement() {
return this.replacement;
}
} | [
"alex.ciupka@gmx.de"
] | alex.ciupka@gmx.de |
d55863bca8e91ffd4c66360d6bdeec0a861774b5 | 5234bc430c83d616a8214d7f77c2c081543b6b26 | /src/Java/101-200/143.ReorderList.java | 69c9b072453e9e3e12b875829e537a4ced9967b0 | [
"Apache-2.0"
] | permissive | AveryHuo/PeefyLeetCode | 3e749b962cadfdf10d7f7b1ed21c5fafc4342950 | 92156e4b48ba19e3f02e4286b9f733e9769a1dee | refs/heads/master | 2022-04-26T06:01:18.547761 | 2020-04-25T09:55:46 | 2020-04-25T09:55:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,354 | java |
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Queue;
import java.util.HashSet;
import java.util.LinkedList;
class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
next = null;
}
}
class Solution {
public void reorderList(ListNode head) {
if (head == null || head.next == null)
return;
ListNode p1 = head;
ListNode p2 = head;
// 找到链表的一半
while (p2.next != null && p2.next.next != null) {
p1 = p1.next;
p2 = p2.next.next;
}
// 将链表分为两段
p2 = p1.next;
p1.next = null;
p1 = head;
// 将后半段进行链表的翻转
ListNode head2 = p2;
ListNode next2;
while (p2.next != null) {
next2 = p2.next;
p2.next = next2.next;
next2.next = head2;
head2 = next2;
}
p2 = head2;
// 两条链表进行合并
ListNode next1;
while (p2 != null) {
next1 = p1.next;
next2 = p2.next;
p1.next = p2;
p2.next = next1;
p1 = next1;
p2 = next2;
}
}
}
| [
"xpf6677@163.com"
] | xpf6677@163.com |
a1a786e1068dba98a64a6babe966019784b112e5 | 98b63e93d4bb7671656f55332e0c610f068f82bf | /sources/de/hfkbremen/creatingprocessingfinding/isosurface/SketchIsoSurface3.java | 39c04840893b40786cd997daa373dbd8b1c2f17f | [] | no_license | Stehveh/creating-processing-finding | ea00279ff94cb4e16211bfb41d54dd4f446aa286 | 971c15e646cf86e4c85696321dbfededc202024b | refs/heads/master | 2021-01-18T07:48:17.723996 | 2013-03-25T16:46:10 | 2013-03-25T16:46:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,043 | java |
package de.hfkbremen.creatingprocessingfinding.isosurface;
import mathematik.Vector3f;
import de.hfkbremen.creatingprocessingfinding.isosurface.marchingcubes.Metaball;
import de.hfkbremen.creatingprocessingfinding.isosurface.marchingcubes.MetaballManager;
import de.hfkbremen.creatingprocessingfinding.util.ArcBall;
import processing.core.PApplet;
import java.util.Vector;
public class SketchIsoSurface3
extends PApplet {
private MetaballManager mMetaballManager;
private int mCurrentCircle = 0;
private ArcBall mArcBall;
public void setup() {
size(1024, 768, OPENGL);
textFont(createFont("Courier", 11));
mArcBall = new ArcBall(width / 2, height / 2, 0, 400.0f, this, true);
mMetaballManager = new MetaballManager();
mMetaballManager.dimension.set(width, height, height);
mMetaballManager.resolution.set(30, 30, 30);
mMetaballManager.position.set(width / -2, height / -2, height / -2);
mMetaballManager.add(new Metaball(new Vector3f(0, 0, 0), 1, 100));
}
public void draw() {
background(255);
directionalLight(126, 126, 126, 0, 0, -1);
ambientLight(102, 102, 102);
/* draw extra info */
fill(0);
noStroke();
text("ISOVALUE : " + mMetaballManager.isovalue(), 10, 12);
text("SELECTED : " + mCurrentCircle, 10, 24);
text("FPS : " + (int)frameRate, 10, 36);
/* darw isosurface */
mArcBall.update();
if (!mMetaballManager.metaballs().isEmpty()) {
mMetaballManager.metaballs().get(mCurrentCircle).position.x = mouseX - width / 2;
mMetaballManager.metaballs().get(mCurrentCircle).position.y = mouseY - height / 2;
}
final Vector<Vector3f> myData = mMetaballManager.createSurface();
/* draw metaballs */
translate(width / 2, height / 2);
fill(255, 127, 0);
noStroke();
beginShape(TRIANGLES);
for (int i = 0; i < myData.size(); i++) {
vertex(myData.get(i).x, myData.get(i).y, myData.get(i).z);
}
endShape();
}
public void keyPressed() {
switch (key) {
case '+':
mMetaballManager.isovalue(mMetaballManager.isovalue() + 0.01f);
break;
case '-':
mMetaballManager.isovalue(mMetaballManager.isovalue() - 0.01f);
break;
case ' ':
mCurrentCircle++;
mCurrentCircle %= mMetaballManager.metaballs().size();
break;
case 'c':
mMetaballManager.add(new Metaball(new Vector3f(mouseX - width / 2, mouseY - height / 2, random(-100, 100)),
random(1, 2),
random(50, 150)));
break;
}
}
public static void main(String args[]) {
PApplet.main(new String[] {SketchIsoSurface3.class.getName()});
}
}
| [
"dennis.paul@hfk-bremen.de"
] | dennis.paul@hfk-bremen.de |
0819b19e049057e21da08e9281859eb37cf83874 | 4ff5fa08f47ab18fc7ac87e667321482e64a8602 | /authentication-template/src/main/java/com/application/repositories/RoleRepository.java | 1a6d386e410ea7ebd10b8eaf8c4b8c718e6f75de | [] | no_license | i-anshuman/spring-boot-template | 912cf82dfa6f1279ad7dfcac35f65930a237561f | 42b5a229eb0b634c3e369b50559c191acf086e5c | refs/heads/main | 2023-08-24T05:39:08.798435 | 2021-10-16T18:40:00 | 2021-10-16T18:40:00 | 417,903,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.application.repositories;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.application.entities.Role;
@Repository
public interface RoleRepository extends JpaRepository<Role, Long> {
Optional<Role> findByRole(com.application.core.Role role);
}
| [
"56269970+i-anshuman@users.noreply.github.com"
] | 56269970+i-anshuman@users.noreply.github.com |
6f762c70cb04c0818321dcee20dc03ac30dc4234 | 4e9c3b9d04a02c088d1e5b709bc025cb6109fe4a | /EXERCISE 2.1/src/Exercise4_6/Avocado.java | 573b39535ef723a461ce5963fedc307b32edf1a9 | [] | no_license | AuChyiMin/Exercise4.5 | 5c9aa73c43506df91b2988a65a5026f11b33e258 | 3516120626778eb71e3591690816750be6d6d988 | refs/heads/master | 2023-05-04T03:33:27.790599 | 2021-05-19T17:30:49 | 2021-05-19T17:30:49 | 365,812,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package Exercise4_6;
public class Avocado extends Apple {
public Avocado(String n, double p, int q) {
super(n, p, q);
}
public String printBenefit() { //overriding method
return "\n******Benefit******" + "\nAvocado help to regulate appetie and help keep eyes healthy.";
}
public String toString() { //overriding method
return printBenefit();
}
}
| [
"chyim@LAPTOP-MPVN3KDA.realtek"
] | chyim@LAPTOP-MPVN3KDA.realtek |
8bd2d798eae469f16e05dea71e94818247c675c3 | 7da5206be6fac3e181c242d0530d227fe0b70cde | /src/main/java/cn/zjz/ssm/memento/EmpMemento.java | 0eea44d96df18a698fba44238b14ab8846714772 | [] | no_license | missaouib/gof | ee65204123f5b116dff93c960c7da7083cb95901 | f10746ea0988aac439444162267af2b0dfd521fe | refs/heads/master | 2022-12-28T09:43:44.336334 | 2019-07-23T01:49:16 | 2019-07-23T01:49:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | package cn.zjz.ssm.memento;
/**
* 备忘录类
* @author Administrator
*
*/
public class EmpMemento {
private String ename;
private int age;
private double salary;
public EmpMemento(Emp e) {
this.ename = e.getEname();
this.age = e.getAge();
this.salary = e.getSalary();
}
public String getEname() {
return ename;
}
public void setEname(String ename) {
this.ename = ename;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
}
| [
"1773443679@qq.com"
] | 1773443679@qq.com |
f275dc228a8a2f292572ed34dcdf5b818ab60272 | 19d84a0d1980f775186f64d1bb3949d13f4ef0b6 | /compilador/src/Frame/AccessList.java | 38a10aaebf192ee8e1a634899a1e2d9a5420293e | [] | no_license | rbrito/old-projects | cc7a1d1730f8170e52587a3e3b2d3a5ced33ffbf | 442bb27d5aa99c0af0bb163efd9fd338bccb90ba | refs/heads/master | 2020-05-06T12:21:07.994529 | 2019-04-27T23:02:59 | 2019-04-27T23:02:59 | 5,565,923 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 53 | java | package Frame;
public abstract class AccessList {
}
| [
"rbrito@ime.usp.br"
] | rbrito@ime.usp.br |
b823b68a3578f3d414b70d7f4d867a91a4405454 | 6e906d38822a7f03b3aacede6a0abcc1780ea18a | /src/main/java/net/qihoo/xlearning/webapp/InfoPage.java | 27f4c1c85d234c6c3548aef1c375b48da6537209 | [
"Apache-2.0"
] | permissive | skymysky/XLearning | 7ae0e143d59a9de7cdbb74c495ef05aef20552cf | f479bd861e2e6148a6d2afabfa5dde451866636f | refs/heads/master | 2021-08-23T13:32:58.013136 | 2017-12-05T02:47:24 | 2017-12-05T02:47:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 792 | java | package net.qihoo.xlearning.webapp;
import org.apache.hadoop.yarn.webapp.SubView;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.HTML;
import org.apache.hadoop.yarn.webapp.view.TwoColumnLayout;
import static org.apache.hadoop.yarn.util.StringHelper.join;
public class InfoPage extends TwoColumnLayout implements AMParams {
@Override
protected void preHead(HTML<_> html) {
super.preHead(html);
setTitle(join($(APP_TYPE) + " Application ", $(APP_ID)));
}
@Override
protected Class<? extends SubView> content() {
if ($(APP_TYPE).equals("Tensorflow") || $(APP_TYPE).equals("Mxnet")) {
return InfoBlock.class;
} else {
return SingleInfoBlock.class;
}
}
@Override
protected Class<? extends SubView> nav() {
return NavBlock.class;
}
}
| [
"liyuance@360.cn"
] | liyuance@360.cn |
ad11261ac1f7484a5f2702a6e83c1c42c64a964d | 9bf1b5652f21cf7cccbff199850dea073603559e | /src/main/java/Utilities/PageUtil.java | ac309c3202a71ba27f284dd281b168ca8b2f8294 | [] | no_license | prashant2906/CucumberTestNG | 4bffdaa717a61bbc7f3d4377cbd1905af3fc5daa | 419b6412b1ab1f4eff16a5a1e642014464aa41e0 | refs/heads/master | 2023-04-15T18:35:06.465258 | 2020-07-15T09:36:20 | 2020-07-15T09:36:20 | 279,229,524 | 0 | 0 | null | 2021-04-26T20:28:48 | 2020-07-13T06:26:06 | HTML | UTF-8 | Java | false | false | 29,810 | java | package Utilities;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.testng.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.asserts.Assertion;
import org.testng.asserts.SoftAssert;
import com.aventstack.extentreports.Status;
import BDD_DEMO.BaseExecution.BaseSetup;
import runner.TestRunner;
import org.openqa.selenium.StaleElementReferenceException;
public class PageUtil {
WebDriver driver;
SoftAssert sAssert;
Assertion hAssert;
String url = PropertyFiles.propertiesFile().getProperty("applicationUrl");
public PageUtil(WebDriver driver)
{
this.driver = driver;
sAssert = new SoftAssert();
hAssert = new Assertion();
}
public void implicitWait(WebDriver driver) {
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
}
public void explicitWaitLink(WebDriver driver, String linkText) {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.elementToBeClickable(By.linkText(linkText)));
}
public void explicitWaitForWebElement(WebDriver driver, By locator) {
try {
WebDriverWait wait = new WebDriverWait(driver, 120);
wait.until(ExpectedConditions.visibilityOfElementLocated(locator));
}
catch (NoSuchElementException e) {
// e.printStackTrace();
System.err.format("No Element Found: " + e);
BaseSetup.test.log(Status.FAIL, "No Element Found after wait" + e);
}
}
public void explicitWaitForWebElementAttribute(WebDriver driver, By locator, String attribute, String value) {
try {
WebDriverWait wait = new WebDriverWait(driver, 60);
wait.until(ExpectedConditions.attributeContains(locator, attribute, value));
}
catch (NoSuchElementException e) {
// e.printStackTrace();
System.err.format("No Element Found: " + e);
BaseSetup.test.log(Status.FAIL, "No Element Found after wait" + e);
}
}
public String getCurrentPageTitle() {
String title = null;
try {
title = driver.getTitle();
// System.out.println(title);
//logger.info("User gets the Current Page Title " + title);
} catch (Exception e) {
e.printStackTrace();
//logger.info("Element is not found");
}
return title;
}
public void verifyCurrentPageTitle(String expectedTitle) {
String actualTitle = getCurrentPageTitle();
Assert.assertEquals(actualTitle, expectedTitle);
BaseSetup.test.log(Status.PASS,"The expected title: " + expectedTitle + " matches with the title: " + actualTitle);
//logger.info("User verifies the current Page Title as " + expectedTitle);
// sAssert.assertAll();
}
public String getCurrentPageUrl() {
String pageUrl = driver.getCurrentUrl();
//logger.info("User gets the Current Page URL as " + pageUrl);
return pageUrl;
}
public void assertCurrentPageUrl(String expectedUrl) {
String actualUrl = getCurrentPageUrl();
Assert.assertTrue(actualUrl.contains(expectedUrl));
// hAssert.assertTrue(actualUrl.contains(expectedUrl), "The URL
// validation matched");
// hAssert.assertEquals(actualUrl, expectedUrl);
//logger.info("User verifies the current Page URL as " + expectedUrl);
BaseSetup.test.log(Status.PASS, "The expected URL: " + expectedUrl + " matches with the URL: " + actualUrl);
// return getCurrentPageUrl().contains(expectedUrl);
}
public boolean verifyElementPresent(By locator)
{
boolean bValue = false;
WebElement element = null;
try {
element = driver.findElement(locator);
if (element.isDisplayed() || element.isEnabled())
BaseSetup.test.log(Status.PASS, "The element " + element.toString() + " is found");
bValue = true;
}
catch (NoSuchElementException e) {
e.printStackTrace();
//logger.info("The element is not found");
BaseSetup.test.log(Status.FAIL, "The element " + element.toString() + " is not found");
bValue = false;
}
catch (StaleElementReferenceException e) {
e.printStackTrace();
BaseSetup.test.log(Status.FAIL, "The element " + element.toString() + "is not available in Dom");
//logger.info("The element is not available in Dom");
bValue = false;
}
return bValue;
}
public boolean verifyElementPresent(WebElement element)
{
boolean bValue = false;
try {
if (element.isDisplayed() || element.isEnabled())
BaseSetup.test.log(Status.PASS, "The element " + element.toString() + " is found");
bValue = true;
}
catch (NoSuchElementException e) {
e.printStackTrace();
//logger.info("The element is not found");
BaseSetup.test.log(Status.FAIL, "The element " + element.toString() + " is not found");
bValue = false;
}
catch (StaleElementReferenceException e) {
e.printStackTrace();
BaseSetup.test.log(Status.FAIL, "The element " + element.toString() + "is not available in Dom");
//logger.info("The element is not available in Dom");
bValue = false;
}
return bValue;
}
public boolean verifyElementNotPresent(By locator) {
try {
driver.findElement(locator);
return false;
} catch (NoSuchElementException e) {
// e.getStackTrace();
return true;
}
}
public boolean verifyElementVisible(By locator) {
try {
driver.findElement(locator).isDisplayed();
return true;
} catch (NoSuchElementException e) {
e.getStackTrace();
return false;
}
}
public boolean verifyElementVisible(WebElement element) {
try {
element.isDisplayed();
return true;
} catch (NoSuchElementException e) {
e.getStackTrace();
return false;
}
}
public boolean verifyElementNotVisible(By locator) {
try {
if (driver.findElement(locator).isDisplayed() == false)
;
BaseSetup.test.log(Status.PASS, locator + " : element is not displaying on the page");
return false;
} catch (NoSuchElementException e) {
BaseSetup.test.log(Status.FAIL, locator + " : element is displaying on the page");
e.getStackTrace();
return true;
}
}
public boolean verifyElementNotEnabled(By locator) {
try {
if (!(driver.findElement(locator).isEnabled()))
//logger.info(locator + " : This element is enabled");
BaseSetup.test.log(Status.FAIL, locator + " : element is enabled");
return true;
} catch (NoSuchElementException e) {
e.getStackTrace();
//logger.info(locator + " : This element is not enabled");
BaseSetup.test.log(Status.FAIL, locator + " : element not enabled");
return false;
}
}
// To get the Locator Text
public String getLocatorText(By locator) {
try {
String sText = driver.findElement(locator).getText();
//logger.info("Element Text is " + sText);
} catch (NoSuchElementException e) {
e.printStackTrace();
//logger.info(locator + " : This element is not found");
BaseSetup.test.log(Status.FAIL, locator + " : element not found");
}
return driver.findElement(locator).getText().toString();
}
public boolean isElementDisplayed(By locator) {
if (driver.findElements(locator).size() > 0 && driver.findElement(locator).isDisplayed()) {
BaseSetup.test.log(Status.PASS, getLocatorText(locator) + " is displayed on the Page");
return true;
} else {
BaseSetup.test.log(Status.FAIL, locator + " is not Displayed on the Page");
return false;
}
}
public boolean isElementDisplayed(WebElement element) {
if (element.isDisplayed()) {
BaseSetup.test.log(Status.PASS, element.getText() + " is displayed on the Page");
return true;
} else {
BaseSetup.test.log(Status.FAIL, element.getText() + " is not Displayed on the Page");
return false;
}
}
public boolean isElementEnabled(By locator) {
WebElement element = driver.findElement(locator);
if (element.isEnabled()) {
BaseSetup.test.log(Status.PASS, getLocatorText(locator) + " is enabled on the Page");
return true;
}
else
{
BaseSetup.test.log(Status.FAIL, locator + " is not enabled on the Page");
return false;
}
}
public boolean isElementDisabled(By locator) {
WebElement element = driver.findElement(locator);
if (!element.isEnabled()) {
BaseSetup.test.log(Status.PASS, getLocatorText(locator) + " is disabled on the Page");
return true;
}
else
{
BaseSetup.test.log(Status.FAIL, locator + " is not disabled on the Page");
return false;
}
}
public boolean isLinkOrIconDisplayed(By locator, String elementName) {
if (driver.findElements(locator).size() > 0 && driver.findElement(locator).isDisplayed()) {
BaseSetup.test.log(Status.PASS, getLocatorText(locator) + " " + elementName + " is displayed on the Page");
return true;
} else {
BaseSetup.test.log(Status.FAIL, elementName + " is not displayed on the Page");
return false;
}
}
public boolean isElementNotDisplayed(By locator) {
if (driver.findElements(locator).isEmpty()) {
BaseSetup.test.log(Status.PASS, locator + " : is not displayed on the Page");
return true;
} else {
BaseSetup.test.log(Status.PASS, locator + " : is displayed on the Page");
return false;
}
}
public void deleteCookies() {
driver.manage().deleteAllCookies();
}
public String getParentWindow() {
String parent = driver.getWindowHandle();
return parent;
}
public String getObjectlLabel(By locator) {
String title = null;
try {
driver.findElement(locator).isDisplayed();
title = driver.findElement(locator).getText();
//logger.info("User gets the test object Label as: " + title);
// BaseSetup.test.log(Status.PASS, "User gets the test object Label
// as: " + title);
}
catch (Exception e) {
e.printStackTrace();
//logger.info("User gets a blank test object Label");
BaseSetup.test.log(Status.INFO, "User gets a blank test object Label");
}
return title;
}
public String getObjectlLabel(WebElement element) {
String sTitle = null;
try {
element.isDisplayed();
sTitle = element.getText();
// System.out.println(sTitle);
//logger.info("User gets the test object Label as: " + sTitle);
// BaseSetup.test.log(Status.PASS, "User gets the test object Label
// as: " + title);
}
catch (Exception e) {
e.printStackTrace();
//logger.info("User gets a blank test object Label");
BaseSetup.test.log(Status.FAIL, "User gets a blank test object Label");
}
return sTitle;
}
public void verifyObjectLabel(By locator, String expectedObjectLabel) {
String actualObjectLabel = getObjectlLabel(locator); // return
getObjectlLabel(locator).contains(expectedObjectLabel);
sAssert.assertEquals(actualObjectLabel, expectedObjectLabel);
//logger.info("User verifies the test object Label as: " + expectedObjectLabel);
BaseSetup.test.log(Status.PASS, "The expected object label: " + expectedObjectLabel
+ " matches with the actual object label: " + actualObjectLabel);
}
public void verifyObjectLabel(WebElement element, String expectedObjectLabel) {
String actualObjectLabel = getObjectlLabel(element); // return
getObjectlLabel(element).contains(expectedObjectLabel);
Assert.assertEquals(actualObjectLabel, expectedObjectLabel);
//logger.info("User verifies the test object Label as: " + expectedObjectLabel);
BaseSetup.test.log(Status.PASS, "The expected object label: " + expectedObjectLabel
+ " matches with the actual object label: " + actualObjectLabel);
}
public void verifyObjectLabelContains(By locator, String expectedValue) {
hAssert.assertTrue(getObjectlLabel(locator).contains(expectedValue),
"The label contains the value" + expectedValue);
//logger.info("User verifies the test object Label contains: " + expectedValue);
BaseSetup.test.log(Status.PASS, "The expected object label contains: " + expectedValue);
}
public void verifyObjectLabelContains(WebElement element, String expectedValue) {
Assert.assertTrue(getObjectlLabel(element).contains(expectedValue),
"The label contains the value" + expectedValue);
//logger.info("User verifies the test object Label contains: " + expectedValue);
BaseSetup.test.log(Status.PASS, "The expected object label contains: " + expectedValue);
}
public void verifyObjectLabelNotContains(By locator, String expectedValue) {
hAssert.assertFalse(getObjectlLabel(locator).contains(expectedValue),
"The label does not contain the value" + expectedValue);
//logger.info("User verifies the test object Label does not contain: " + expectedValue);
BaseSetup.test.log(Status.PASS, "The expected object label does not contain: " + expectedValue);
}
public void verifyObjectLabelContains(String expectedValue, String actualValue) {
sAssert.assertTrue(expectedValue.contains(actualValue), "The label contains the value" + actualValue);
//logger.info("User verifies the test object Label contains: " + actualValue);
BaseSetup.test.log(Status.PASS, "The expected object label" + expectedValue + "contains: " + actualValue);
}
public void assertObjectLabel(By locator, String expectedObjectLabel) {
String actualObjectLabel = getObjectlLabel(locator);
sAssert.assertEquals(actualObjectLabel, expectedObjectLabel);
//logger.info("User verifies the test object Label as: " + expectedObjectLabel);
BaseSetup.test.log(Status.PASS, "The expected object label: " + expectedObjectLabel
+ " matches with the actual object label: " + actualObjectLabel);
}
public void assertObjectLabel(String actualObjectLabel, String expectedObjectLabel) {
// return getObjectlLabel(locator).contains(expectedObjectLabel);
sAssert.assertEquals(actualObjectLabel, expectedObjectLabel);
//logger.info("User verifies the test object Label as: " + expectedObjectLabel);
BaseSetup.test.log(Status.PASS, "The expected object label: " + expectedObjectLabel
+ " matches with the actual object label: " + actualObjectLabel);
}
public void enterTextValue(By locator, String expectedData) {
try {
WebElement element = driver.findElement(locator);
if (verifyElementPresent(locator))
// element.isDisplayed())
{
element.clear();
element.sendKeys(expectedData);
//logger.info("User enters " + expectedData + " in the " + element.getText() + " text box");
BaseSetup.test.log(Status.PASS,
"User enters " + expectedData + " in the " + element.getText() + " text box");
}
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to enter text" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to enter text" + e);
}
}
public void enterTextValue(By locator, int expectedData) {
try {
WebElement element = driver.findElement(locator);
if (verifyElementPresent(locator))
// element.isDisplayed())
{
element.clear();
WebElement wb = element;
JavascriptExecutor jse = (JavascriptExecutor) driver;
jse.executeScript("arguments[0].value='" + expectedData + "';", wb);
// element.sendKeys(expectedData);
//logger.info("User enters " + expectedData + " in the " + element.getText() + " text box");
BaseSetup.test.log(Status.PASS,
"User enters " + expectedData + " in the " + element.getText() + " text box");
}
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to enter text" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to enter text" + e);
}
}
public void pressEnter(By locator) {
try {
WebElement element = driver.findElement(locator);
if (verifyElementPresent(locator))
{
element.sendKeys(Keys.RETURN);
//logger.info("User presses the enter key");
BaseSetup.test.log(Status.PASS, ("User presses the enter key"));
}
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to press enter" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to press enter" + e);
}
}
public void clearTextBox(By locator) {
try {
WebElement element = driver.findElement(locator);
if (verifyElementPresent(locator))
// element.isDisplayed())
{
element.clear();
//logger.info("User clears the " + element.getText() + " text box");
BaseSetup.test.log(Status.PASS, "User clears the " + element.getText() + " text box");
}
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to enter text" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to enter text" + e);
}
}
public void click(By locator) {
for (int iCount = 0; iCount < 3; iCount++) {
try {
WebElement element = driver.findElement(locator);
if (verifyElementPresent(locator)) {
//logger.info("User clicks on " + element.getText() + " button");
BaseSetup.test.log(Status.PASS, "User clicks on " + element.getText() + " button");
element.click();
}
break;
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to perform click" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to enter click" + e);
}
// explicitWaitUntilClickable(driver, locator);
}
}
public static void click(WebElement element) {
for (int iCount = 0; iCount < 3; iCount++) {
try {
if (element.isDisplayed()) {
//logger.info("User clicks on " + element.getText() + " button");
BaseSetup.test.log(Status.PASS, "User clicks on " + element.getText() + " button");
element.click();
}
break;
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to perform click" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to enter click" + e);
}
}
}
public static void enterTextValue(WebElement element, int expectedData)
{
try {
if (element.isDisplayed()) {
//logger.info("User clicks on " + element.getText() + " button");
System.out.println(element.getText());
BaseSetup.test.log(Status.PASS, "User clicks on " + element.getText() + " button");
//element.clear();
element.sendKeys("expectedData");
}
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to perform click" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to enter click" + e);
}
}
public void selectRadio(By locator) {
try {
WebElement element = driver.findElement(locator);
if (verifyElementPresent(locator)) {
//logger.info("User clicks on " + element.getText() + " button");
BaseSetup.test.log(Status.PASS, "User clicks on " + element.getText() + " button");
element.click();
}
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to perform click" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to enter click" + e);
}
}
//select the dropdown using "select by visible text", so pass VisibleText
public void selectFromDropDownByVisibleText(By locator, String visibleText) {
try {
WebElement element = driver.findElement(locator);
if (element.isDisplayed()) {
Select selObj = new Select(element);
selObj.selectByVisibleText(visibleText);
//logger.info("User selects the visible text as " + visibleText + "from Dropdown");
BaseSetup.test.log(Status.PASS, "User selects the visible text as " + visibleText + "from Dropdown");
}
}
catch (NoSuchElementException e)
{
e.printStackTrace();
System.err.format("No Element Found to perform selection in the dropdown" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e);
}
}
// select the dropdown using "select by index", so pass IndexValue as '2'
public void selectFromDropDownByIndex(By locator, int indexValue) {
try {
WebElement element = driver.findElement(locator);
if (element.isDisplayed()) {
Select selObj = new Select(element);
selObj.selectByIndex(indexValue);
//logger.info("User selects the index as " + indexValue + " from Dropdown");
BaseSetup.test.log(Status.PASS, "User selects the index as " + indexValue + " from Dropdown");
}
else {
BaseSetup.test.log(Status.FAIL, "Element not displaying");
}
}
catch (NoSuchElementException e)
{
e.printStackTrace();
System.err.format("No Element Found to perform selection" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e);
}
}
// select the dropdown using "select by value", so pass Value as
public void selectFromDropDownByValue(By locator, String value) {
try {
WebElement element = driver.findElement(locator);
if (element.isDisplayed()) {
Select selObj = new Select(element);
selObj.selectByValue(value);
System.out.println(element.getText());
//logger.info("User selects the value as " + value + "from Dropdown");
BaseSetup.test.log(Status.PASS, "User selects the value as " + value + "from Dropdown");
}
}
catch (NoSuchElementException e)
{
e.printStackTrace();
System.err.format("No Element Found to perform selection" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e);
}
}
public String getAttributeValue(By locator, String attributeName) {
String attributeValue = null;
try {
WebElement element = driver.findElement(locator);
if (element.isDisplayed()) {
attributeValue = element.getAttribute(attributeName);
// System.out.println(value);
//logger.info("User gets the value as " + attributeValue + " for the webelement");
BaseSetup.test.log(Status.PASS, "User gets the value as " + attributeValue + "for the webelement");
}
}
catch (NoSuchElementException e)
{
e.printStackTrace();
System.err.format("No Element Found to perform selection" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e);
}
return attributeValue;
}
public void assertAttributeValue(By locator, String attributeName, String expectedAttributeValue) {
String actualAttributeValue = getAttributeValue(locator, attributeName);
Assert.assertEquals(actualAttributeValue, expectedAttributeValue);
//logger.info("the expected value: " + expectedAttributeValue + " matches the actual value: " + actualAttributeValue);
BaseSetup.test.log(Status.PASS,
"the expected value: " + expectedAttributeValue + " matches the actual value: " + actualAttributeValue);
}
public String getCssValue(WebElement element, String sPropertyName) {
String propertyValue = null;
try {
if (element.isDisplayed()) {
propertyValue = element.getCssValue(sPropertyName);
// System.out.println(propertyValue);
//logger.info("User gets the value as " + propertyValue + "for the webelement");
BaseSetup.test.log(Status.PASS, "User gets the value as " + propertyValue + "for the webelement");
}
}
catch (NoSuchElementException e)
{
e.printStackTrace();
System.err.format("No Element Found to perform selection" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e);
}
return propertyValue;
}
public boolean getCheckBoxState(By locator) {
boolean value = false;
try {
WebElement element = driver.findElement(locator);
if (element.isDisplayed()) {
value = element.isSelected();
// System.out.println(value);
//logger.info("User gets the value as " + value + " from the check box");
BaseSetup.test.log(Status.PASS, "User gets the value as " + value + " from the check box");
}
}
catch (NoSuchElementException e)
{
e.printStackTrace();
System.err.format("No Element Found to perform selection" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e);
}
return value;
}
public boolean getRadioButtonState(By locator) {
boolean value = false;
try {
WebElement element = driver.findElement(locator);
if (element.isDisplayed()) {
value = element.isSelected();
// System.out.println(value);
//logger.info("User gets the value as " + value + " from the radio button");
BaseSetup.test.log(Status.PASS, "User gets the value as " + value + " from the radio button");
}
}
catch (NoSuchElementException e)
{
e.printStackTrace();
System.err.format("No Element Found to perform selection" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to perform selection in the dropdown" + e);
}
return value;
}
public void launchApplication() throws InterruptedException {
driver.navigate().to(url);
//logger.info("User navigates to the URL: " + url);
// BaseSetup.test.log(Status.PASS, "User navigates to the URL: " + url);
if (isAlertPresent()) {
acceptAlert();
Thread.sleep(1000);
}
}
/*public void launchotherLanguages() {
driver.navigate().to(applicationUrl);
//logger.info("User navigates to the URL: " + GermanyUrl);
BaseSetup.test.log(Status.PASS, "User navigates to the URL: " + GermanyUrl);
}*/
public boolean isAlertPresent() {
try {
driver.switchTo().alert();
return true;
} // try
catch (NoAlertPresentException Ex) {
return false;
} // catch
}
public void verifyStringValue(String expected, String actual) {
Assert.assertEquals(expected, actual);
//logger.info("the expected value: " + expected + " matches the actual value: " + actual);
BaseSetup.test.log(Status.PASS, "the expected value: " + expected + " matches the actual value: " + actual);
}
public void verifyWebElementStateDiffers(boolean expected, boolean actual) {
Assert.assertNotSame(expected, actual);
//logger.info("the expected value: " + expected + " does not match the actual value: " + actual);
BaseSetup.test.log(Status.PASS,
"the expected value: " + expected + " does not match matche the actual value: " + actual);
}
public String getAlertMessage() {
String alertText = null;
boolean isAlertAvailable = isAlertPresent();
if (isAlertAvailable) {
alertText = driver.switchTo().alert().getText();
// System.out.println(alertText);
}
return alertText;
}
public void verifyAlertMessage(String expectedMessage) {
Assert.assertEquals(expectedMessage, getAlertMessage());
}
public void acceptAlert() {
boolean isAlertAvailable = isAlertPresent();
if (isAlertAvailable) {
driver.switchTo().alert().accept();
}
}
public void dissmisAlert() {
boolean isAlertAvailable = isAlertPresent();
if (isAlertAvailable) {
driver.switchTo().alert().dismiss();
}
}
public void switchToChildWindow() {
Set<String> s1 = driver.getWindowHandles();
Iterator<String> I1 = s1.iterator();
while (I1.hasNext()) {
String child_window = I1.next();
// Here we will compare if parent window is not equal to child
// window then we will close
if (!getParentWindow().equals(child_window)) {
driver.switchTo().window(child_window);
}
}
}
public String getMainWindowHandle(WebDriver driver) {
return driver.getWindowHandle();
}
public static boolean closeAllOtherWindows(WebDriver driver, String openWindowHandle) {
Set<String> allWindowHandles = driver.getWindowHandles();
for (String currentWindowHandle : allWindowHandles) {
if (!currentWindowHandle.equals(openWindowHandle)) {
driver.switchTo().window(currentWindowHandle);
driver.close();
}
}
driver.switchTo().window(openWindowHandle);
if (driver.getWindowHandles().size() == 1)
return true;
else
return false;
}
public void closeChildWindow() {
driver.close();
}
public void switchMainWindow(String wparent) {
driver.switchTo().window(wparent);
}
public boolean verifyObjectWaterMark(By locator, String expectedObjectWaterMark) {
//logger.info("User verifies the test object Label as: " + expectedObjectWaterMark);
return getObjectlLabel(locator).contains(expectedObjectWaterMark.toLowerCase());
}
public static List<WebElement> collectAllSimillarElements(WebDriver driver, By locator)
{
List<WebElement> elementList = new ArrayList<WebElement>();
elementList = driver.findElements(locator);
return elementList;
}
public List<WebElement> countAllSimillarElements(WebDriver driver, By locator)
{
List<WebElement> elementList = new ArrayList<WebElement>();
elementList = driver.findElements(locator);
for (int i = 0; i < elementList.size(); i++)
{
BaseSetup.test.log(Status.INFO, ": is displayed on the Page\n"+ elementList.get(1));
//countelements = elementList.size();
}
return elementList;
}
public WebElement getWebElement(By locator) {
return driver.findElement(locator);
}
public List<WebElement> getWebElements(By locator) {
return driver.findElements(locator);
}
public void navigateto(String uri) {
driver.get(uri);
}
public void enterTextValue(By username, Keys enter) {
// TODO Auto-generated method stub
try {
WebElement element = driver.findElement(username);
if (verifyElementPresent(username))
// element.isDisplayed())
{
element.clear();
element.sendKeys(Keys.ENTER);
//logger.info("User enters " + expectedData + " in the " + element.getText() + " text box");
BaseSetup.test.log(Status.PASS,
"User Press enters in the " + element.getText() + " text box");
}
} catch (NoSuchElementException e) {
e.printStackTrace();
System.err.format("No Element Found to enter text" + e);
BaseSetup.test.log(Status.FAIL, "No Element Found to enter text" + e);
}
}
}
| [
"PR20145736@wipro.com"
] | PR20145736@wipro.com |
75a493ea1825c2fcf40b708648368298c5f5dc46 | 2d9bd0fc6fd3e788b0cff0d17bc6d74c55d51671 | /Sprint17_repush/commons/commons-data/src/main/java/dz/gov/mesrs/sii/commons/data/model/referentiel/Nomenclature.java | 2eec30eb53a1c8478b4df63b1cdccf6aadcf01b7 | [] | no_license | kkezzar/code2 | 952de18642d118d9dae9b10acc3b15ef7cfd709e | ee7bd0908ac7826074d26e214ef07c594e8a9706 | refs/heads/master | 2016-09-06T04:17:06.896511 | 2015-03-10T13:41:04 | 2015-03-10T13:41:04 | 31,958,723 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,482 | java | package dz.gov.mesrs.sii.commons.data.model.referentiel;
// Generated 20 janv. 2014 11:10:42 by Hibernate Tools 3.6.0
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
/**
* NcValues generated by hbm2java
*/
@Entity
@Table(name = "nomenclature", schema = "nc")
public class Nomenclature implements java.io.Serializable {
/**
* serialVersionUID
*
* @author BELDI Jamel on : 23 janv. 2014 11:20:05
*/
private static final long serialVersionUID = 1L;
private int id;
private Nomenclature nomenclature;
private NcNames ncNames;
private String libelleLongFr;
private String libelleLongAr;
private String libelleCourtFr;
private String libelleCourtAr;
private Boolean status;
private String code;
// private Set<NcHistory> ncHistories = new HashSet<NcHistory>(0);
private List<Nomenclature> nomenclatures;
public Nomenclature() {
}
public Nomenclature(int id, String code) {
this.id = id;
this.code = code;
}
// public Nomenclature(int id, Nomenclature nomenclature, NcNames ncNames,
// String libelleLongFr, String libelleLongAr, String libelleCourtFr,
// String libelleCourtAr, Boolean status, String code, Set<NcHistory>
// ncHistories,
// Set<Nomenclature> ncValueses) {
// this.id = id;
// //this.nomenclature = nomenclature;
// this.ncNames = ncNames;
// this.libelleLongFr = libelleLongFr;
// this.libelleLongAr = libelleLongAr;
// this.libelleCourtFr = libelleCourtFr;
// this.libelleCourtAr = libelleCourtAr;
// this.status = status;
// this.code = code;
// this.ncHistories = ncHistories;
// }
@Id
@SequenceGenerator(name = "seq_nc", initialValue = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_nc")
@Column(name = "id", unique = true, nullable = false)
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "ref_valeur")
public Nomenclature getNomenclature() {
return this.nomenclature;
}
public void setNomenclature(Nomenclature nomenclature) {
this.nomenclature = nomenclature;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "id_list")
public NcNames getNcNames() {
return this.ncNames;
}
public void setNcNames(NcNames ncNames) {
this.ncNames = ncNames;
}
@Column(name = "libelle_long_fr", length = 100)
public String getLibelleLongFr() {
return this.libelleLongFr;
}
public void setLibelleLongFr(String libelleLongFr) {
this.libelleLongFr = libelleLongFr;
}
@Column(name = "libelle_long_ar", length = 100)
public String getLibelleLongAr() {
return this.libelleLongAr;
}
public void setLibelleLongAr(String libelleLongAr) {
this.libelleLongAr = libelleLongAr;
}
@Column(name = "libelle_court_fr", length = 100)
public String getLibelleCourtFr() {
return this.libelleCourtFr;
}
public void setLibelleCourtFr(String libelleCourtFr) {
this.libelleCourtFr = libelleCourtFr;
}
@Column(name = "libelle_court_ar", length = 100)
public String getLibelleCourtAr() {
return this.libelleCourtAr;
}
public void setLibelleCourtAr(String libelleCourtAr) {
this.libelleCourtAr = libelleCourtAr;
}
@Column(name = "code", unique = false, nullable = false, length = 30)
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
/**
* [Nomenclature.nomenclatures] Getter
* @author MAKERRI Sofiane on : 6 janv. 2015 10:59:59
* @return the nomenclatures
*/
@OneToMany(fetch = FetchType.LAZY, mappedBy = "nomenclature", cascade = CascadeType.ALL, orphanRemoval = true)
public List<Nomenclature> getNomenclatures() {
return nomenclatures;
}
/**
* [Nomenclature.nomenclatures] Setter
* @author MAKERRI Sofiane on : 6 janv. 2015 10:59:59
* @param nomenclatures the nomenclatures to set
*/
public void setNomenclatures(List<Nomenclature> nomenclatures) {
this.nomenclatures = nomenclatures;
}
@Column(name = "status")
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
}
| [
"root@lhalid-pc"
] | root@lhalid-pc |
8aef5622473bd8541e78897e492d1a4c86bc7c2e | 12ccbc8b5331dd9612552c8499fcf031683df9d5 | /src/main/java/com/mongodb/m101j/spark/HelloWorldMongoDBSparkFreemarkerStyle.java | b9b40a63507fdb0904ae62f98d72fdb5b5aef695 | [] | no_license | Just-Fun/M101J_MongoDB | 7ce970241cba9fd1eafeb72a5c1e0901822cc13f | 7d052033296e8dbb7c5d224ccd1d9b8ff0d27649 | refs/heads/master | 2021-01-16T18:56:14.775642 | 2017-08-19T15:21:56 | 2017-08-19T15:21:56 | 100,131,730 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,289 | java | /*
* Copyright 2015 MongoDB, Inc.
*
* 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.mongodb.m101j.spark;
import com.mongodb.MongoClient;
import com.mongodb.ServerAddress;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.bson.Document;
import spark.Request;
import spark.Response;
import spark.Route;
import spark.Spark;
import java.io.StringWriter;
public class HelloWorldMongoDBSparkFreemarkerStyle {
public static void main(String[] args) {
final Configuration configuration = new Configuration();
configuration.setClassForTemplateLoading
(HelloWorldMongoDBSparkFreemarkerStyle.class, "/freemarker");
MongoClient client = new MongoClient(new ServerAddress("localhost", 27017));
MongoDatabase database = client.getDatabase("course");
final MongoCollection<Document> collection = database.getCollection("hello");
collection.drop();
collection.insertOne(new Document("name", "MongoDB"));
Spark.get(new Route("/") {
@Override
public Object handle(final Request request,
final Response response) {
StringWriter writer = new StringWriter();
try {
Template helloTemplate = configuration.getTemplate("hello.ftl");
Document document = collection.find().first();
helloTemplate.process(document, writer);
} catch (Exception e) {
halt(500);
e.printStackTrace();
}
return writer;
}
});
}
}
| [
"sergii.zagryvyi@dimetogo.com"
] | sergii.zagryvyi@dimetogo.com |
e0291aef4371bd72a2700abc253d1ad725822dae | bfa33a35129e842c636df9d688f0248571ad8b60 | /Demo21_IO(字符流)&字符流其他内容&递归/src/cn/zx/chario/Demo4_Buffered.java | 1d38cb8396c2ca05c413bda9606b44a7f4f47959 | [] | no_license | zhangxu1107/Learn_Demo | 9cc2395d40db6306af584da6222781e7821698c4 | d9d957fec60e8006dcfe7c79317a91f31c340f52 | refs/heads/master | 2020-03-31T11:42:06.203235 | 2018-10-16T13:29:44 | 2018-10-16T13:29:44 | 152,172,694 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,165 | java | package cn.zx.chario;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class Demo4_Buffered {
/**
* @param args
* 带缓冲区的流中的特殊方法
* readLine()
* newLine();
*
* newLine()与\r\n的区别
* newLine()是跨平台的方法
* \r\n只支持的是windows系统
* @throws IOException
*/
public static void main(String[] args) throws IOException {
demo1();
//newLine()方法
BufferedReader br = new BufferedReader(new FileReader("zzz.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("aaa.txt"));
String line;
while((line = br.readLine()) != null) {
bw.write(line);
bw.newLine();
//写出回车换行符
//bw.write("\r\n");
}
br.close();
bw.close();
}
private static void demo1() throws FileNotFoundException, IOException {
//readLine()方法
BufferedReader br = new BufferedReader(new FileReader("zzz.txt"));
String line;
while((line = br.readLine()) != null) {
System.out.println(line);
}
br.close();
}
}
| [
"1083155747@qq.com"
] | 1083155747@qq.com |
a0e294b70c313deab47e55847b3cb3a464d1f135 | 61103500eaa66125da9979c74667adc75c4ca397 | /stubook/src/com/itqf/service/impl/ShowProductServiceImpl.java | a184fbd5fde194f695f18867901d0db34cb9f865 | [] | no_license | Sun19930306/MyProject | 0a5ad6425d9d19312d6092be716eca6eae4afb54 | 5117cd3de428e86cd5c6d403a5d7143a5a5b6b05 | refs/heads/master | 2021-05-12T06:31:21.590845 | 2018-01-13T01:07:28 | 2018-01-13T01:07:28 | 117,220,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.itqf.service.impl;
import java.util.Map;
import com.itqf.dao.ShowProduct;
import com.itqf.dao.impl.ShowProductDaoImpl;
import com.itqf.service.ShowProductService;
public class ShowProductServiceImpl implements ShowProductService {
private ShowProduct product = new ShowProductDaoImpl();
public Map<String, Object> query(int page) {
return product.query(page);
}
}
| [
"284219347@qq.com"
] | 284219347@qq.com |
df37c431603293ba1713fdd5dcb0572b5c62ea0e | 55aca439e180a9bcf0a36f60320013979905d1e5 | /efreight-afbase/src/main/java/com/efreight/afbase/controller/LcCostController.java | 1402308778a535d15ad7c19c5ffa1195d9c542ba | [] | no_license | zhoudy-github/efreight-cloud | 1a8f791f350a37c1f2828985ebc20287199a8027 | fc669facfdc909b51779a88575ab4351e275bd25 | refs/heads/master | 2023-03-18T07:24:18.001404 | 2021-03-23T06:55:54 | 2021-03-23T06:55:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java | package com.efreight.afbase.controller;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.efreight.afbase.entity.LcCost;
import com.efreight.afbase.service.LcCostService;
import com.efreight.common.security.util.MessageInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@RestController
@AllArgsConstructor
@RequestMapping("/lc-cost")
@Slf4j
public class LcCostController {
private final LcCostService service;
/**
* 查询成本明细(未完全对账的)
* @param lcCost
* @return
*/
@GetMapping("/list")
public MessageInfo getCostList(LcCost lcCost) {
try {
List<LcCost> result = service.getCostList(lcCost);
return MessageInfo.ok(result);
} catch (Exception e) {
log.info(e.getMessage());
return MessageInfo.failed(e.getMessage());
}
}
} | [
"yeliang_sun@163.com"
] | yeliang_sun@163.com |
9c2d8968635e974e70d99c0b14381469ccd89611 | 6a73c05f6de364388de2bd9b16fcfd45f20dbfc0 | /AIDL_Demo/src/main/java/com/zuimeia/aidl_demo/Book.java | d014141dd208040ecc185d2d986972847601c14f | [] | no_license | Adan0225/androiddemo | 9eaf2ce33abd31d06c71a66bbfbdf51bea6d6108 | c6e823f89eef3d36d90ab8d83ed0bcfe4e28fd3f | refs/heads/master | 2020-03-28T18:35:13.616255 | 2018-09-15T10:52:28 | 2018-09-15T10:52:28 | 148,893,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,180 | java | package com.zuimeia.aidl_demo;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by chenzhiyong on 16/3/6.
*/
public class Book implements Parcelable
{
private String mDesc;
private int mPrise;
public String getDesc()
{
return mDesc;
}
public void setDesc(String desc)
{
mDesc = desc;
}
public int getPrise()
{
return mPrise;
}
public void setPrise(int prise)
{
mPrise = prise;
}
@Override
public int describeContents()
{
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags)
{
dest.writeString(this.mDesc);
dest.writeInt(this.mPrise);
}
public Book()
{
}
protected Book(Parcel in)
{
this.mDesc = in.readString();
this.mPrise = in.readInt();
}
public static final Parcelable.Creator<Book> CREATOR = new
Parcelable.Creator<Book>()
{
public Book createFromParcel(Parcel source) {
return new Book(source);
}
public Book[] newArray(int size) {
return new Book[size];
}
};
}
| [
"jason_yao"
] | jason_yao |
fc3e10d0111ec746d1b47563738c7d78110c291a | 645b3bdc2e37f282c3e8c631a458b94901742b8d | /job-tracker-dao/src/main/java/org/limbo/flowjob/tracker/dao/po/PlanInfoPO.java | e5918e3095858671db3e02dc1c6f33cd1358f53a | [
"Apache-2.0"
] | permissive | ExtremeYu/flow-job | 6beef48f499eedfc77f7410777dd1b04b2f247d3 | 2706b3dc3ea6e5b4442b6309ca326fcc03adc2a1 | refs/heads/master | 2023-07-15T15:49:53.469436 | 2021-08-30T11:10:50 | 2021-08-30T11:10:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,167 | java | /*
* Copyright 2020-2024 Limbo Team (https://github.com/limbo-world).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.limbo.flowjob.tracker.dao.po;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* plan 的信息存档 历史版本
*
* @author Brozen
* @since 2021-07-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("flowjob_plan_info")
public class PlanInfoPO extends PO {
private static final long serialVersionUID = -1639602897831847418L;
/**
* DB自增序列ID,并不是唯一标识
*/
private Long serialId;
/**
* 作业执行计划ID
*/
private String planId;
/**
* 版本 planId + version 唯一
*/
private Integer version;
/**
* 执行计划描述
*/
private String description;
/**
* 计划作业调度方式
*/
private Byte scheduleType;
/**
* 从何时开始调度作业
*/
private LocalDateTime scheduleStartAt;
/**
* 作业调度延迟时间,单位秒
*/
private Long scheduleDelay;
/**
* 作业调度间隔时间,单位秒。
*/
private Long scheduleInterval;
/**
* 作业调度的CRON表达式
*/
private String scheduleCron;
/**
* 重试次数 超过执行就失败
* job上的这个版本不设计了,用户本来就需要做幂等处理
*/
private Integer retry;
/**
* 任务 json string
*/
private String jobs;
/**
* 是否删除
*/
private Boolean isDeleted;
}
| [
"ysodevilo@163.com"
] | ysodevilo@163.com |
d7f2b492bc76a8f16113fe39ae9cebbb351ebcee | b4252cd1c9942474ca1a17cd906196d264f4d60e | /src/com/cartmatic/estore/imports/handler/product/ProductKindHandler.java | 99abcda31a7bdd9ec8c592853c6ec42965308bc6 | [] | no_license | 1649865412/StoreAdminOne | 5acb273becf848f5007320bff720924cb1fd5faf | 70bc2fb098eafb436c8860cdf9a58e63ee61510b | refs/heads/master | 2021-01-02T22:58:16.554900 | 2015-06-26T05:54:52 | 2015-06-26T05:54:52 | 38,096,515 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,642 | java |
package com.cartmatic.estore.imports.handler.product;
import java.math.BigDecimal;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import com.cartmatic.estore.common.model.catalog.Product;
import com.cartmatic.estore.imports.handler.ColumnHandler;
import com.cartmatic.estore.imports.handler.basic.ColumnBasicHandler;
import com.cartmatic.estore.imports.model.Column;
import com.cartmatic.estore.imports.model.ImportModel;
public class ProductKindHandler extends ColumnBasicHandler implements
ColumnHandler {
private Logger logger = Logger.getLogger(ProductKindHandler.class);
public void setProperty(ImportModel importModel,Column column) throws Exception {
Product product=(Product)importModel.getTarget();
Short origProductKind=product.getProductKind();
//目前只判断是否存在两个价格来决定是否变种
List<String> values = column.getValues();
int count=0;
for (String value : values) {
if (StringUtils.isNotBlank(value)) {
try {
if(new BigDecimal(value).doubleValue()>0)
count++;
} catch (Exception e) {
// TODO: handle exception
}
}
}
Short productKind=null;
if(count>1){
productKind=new Short("2");
}else{
productKind=new Short("1");
}
if(product.getId()==null){
product.setProductKind(productKind);
}else{
if(column.isSupportUpdate()){
product.setProductKind(productKind);
}else if(productKind.intValue()!=origProductKind){
logger.warn("本条数据为更新,productKind不支持更新操作。"+column);
}
}
}
}
| [
"1649865412@qq.com"
] | 1649865412@qq.com |
c104a4bacc2f6fbece1af58e1db7a87a113bb502 | 898d4aaeaaf76bfdeba4f2f3090c8de6b87f5b34 | /app/src/main/java/com/example/akdenizapp/NewComplaint.java | 77683fb3373b3a012a8bf2f5f0a06bc30c72ef6e | [] | no_license | ErkamDogan/UniversityApp | 99b9e4c43f23502ea4641c8b13fa49f32b80c334 | f2a0e8f5542e19b939ae7b186f2ae20d0a924548 | refs/heads/master | 2023-06-07T08:43:28.619100 | 2021-07-07T14:29:04 | 2021-07-07T14:29:04 | 383,804,215 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,399 | java | package com.example.akdenizapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.drawerlayout.widget.DrawerLayout;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import com.google.android.material.navigation.NavigationView;
import java.util.ArrayList;
public class NewComplaint extends AppCompatActivity {
private DrawerLayout mDrawer;
private NavigationView nvDrawer;
// Make sure to be using androidx.appcompat.app.ActionBarDrawerToggle version.
private ActionBarDrawerToggle drawerToggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_complaints);
ArrayList<String> units = new ArrayList<String>();
units.add("Hangi birime ulaştırmak istediğinizi seçiniz");
findViewById(R.id.button_complaint_send).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent t = new Intent(NewComplaint.this, Complaints.class);
startActivity(t);
}
});
// This will display an Up icon (<-), we will replace it with hamburger later
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Find our drawer view
mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawerToggle = new ActionBarDrawerToggle(this,mDrawer,R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawerToggle.setDrawerIndicatorEnabled(true);
mDrawer.addDrawerListener(drawerToggle);
drawerToggle.syncState();
nvDrawer = (NavigationView) findViewById(R.id.nvView);
nvDrawer.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener(){
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
int id = item.getItemId();
if(id == R.id.nav_home){
Intent t = new Intent(NewComplaint.this, HomePageActivity.class);
startActivity(t);
}
if(id == R.id.nav_announcements){
Intent t = new Intent(NewComplaint.this,Announcements_stvs.class);
startActivity(t);
}
if(id == R.id.nav_events){
Intent t = new Intent(NewComplaint.this,Events.class);
startActivity(t);
}
if(id == R.id.nav_complaints){
Intent t = new Intent(NewComplaint.this, Complaints.class);
startActivity(t);
}
if(id == R.id.nav_maps){
Intent t = new Intent(NewComplaint.this,MapsActivity.class);
startActivity(t);
}
if(id == R.id.nav_feedback){
Intent t = new Intent(NewComplaint.this,feedback.class);
startActivity(t);
}
if(id == R.id.nav_dinings){
Intent t = new Intent(NewComplaint.this,Dining.class);
startActivity(t);
}
if(id == R.id.nav_classes){
Intent t = new Intent(NewComplaint.this,Classes.class);
startActivity(t);
}
if(id == R.id.nav_clubs){
Intent t = new Intent(NewComplaint.this,StudentClubs.class);
startActivity(t);
}
if(id == R.id.nav_Surveys){
Intent t = new Intent(NewComplaint.this,Surveys.class);
startActivity(t);
}
if(id == R.id.nav_login){
Intent t = new Intent(NewComplaint.this,login.class);
startActivity(t);
}
return true;
}
});
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
if(drawerToggle.onOptionsItemSelected(item))
return true;
return super.onOptionsItemSelected(item);
}
} | [
"erkamdogan27@gmail.com"
] | erkamdogan27@gmail.com |
ef9af01006df7fbea42a9a4e6be7dee178f371f8 | 2f0320694e18b5200030bc7d5ab46bdd61a0e25a | /src/main/java/com/li/controller/HomeController.java | f6b08b47343135e0d6dcc826c0f01db96e211f61 | [] | no_license | JarvisJim/HSSM | c2dd443de7fdcdd8baadc80b7c7f01ad01340c23 | ecfa6df4f493fdb6e178745d8d14f53cf3ceee99 | refs/heads/master | 2020-06-18T08:35:58.171117 | 2018-07-30T06:56:56 | 2018-07-30T06:56:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.li.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HomeController {
@RequestMapping("/index")
public String index(){
return "listEmployee2";
}
}
| [
"980500807@qq.com"
] | 980500807@qq.com |
a020d27140e9b05bd3a96b9ad06c3bafb6eb5305 | ced45223306b65c430c427996507224720aa42dc | /jdbcTestproject/src/johnabbott/test/configuration/WebAppInitializer.java | 07f0e7d6394db37edc737f69c1dfb8b0c1742b3c | [] | no_license | rezash86/jdbctemplatetest | f536ab5d2ee461036ae176040571f9d3195d22c4 | 0105fbbbe5675718d1db5b5f88b4004450a3ad07 | refs/heads/master | 2022-12-23T23:35:49.019494 | 2020-01-06T02:03:13 | 2020-01-06T02:03:13 | 231,703,790 | 0 | 0 | null | 2022-12-15T23:56:59 | 2020-01-04T03:37:59 | Java | UTF-8 | Java | false | false | 901 | java | package johnabbott.test.configuration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
public class WebAppInitializer implements WebApplicationInitializer {
public void onStartup(ServletContext container) throws ServletException {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
ctx.register(WebMvcConfig.class);
ctx.setServletContext(container);
ServletRegistration.Dynamic servlet = container.addServlet("dispatcher", new DispatcherServlet(ctx));
servlet.setLoadOnStartup(1);
servlet.addMapping("/");
}
}
| [
"shalchian.r@gmail.com"
] | shalchian.r@gmail.com |
6c67644d8702e2d4609ba311cc3191dc86fd0a04 | 53599bdf7ebfe935627fa9311c94446744614bbe | /Jarvis/app/src/main/java/com/example/jarvis/FriendList.java | 353e6c7f043216b00ef901e9c3884032e3a7474b | [] | no_license | smkjason/Jarvis-CPEN-321- | 42ff5bb24a808f35e8603a2530e6b58c040692f4 | e7dc2ab568d21dde39a91276b67b923ff25349e0 | refs/heads/master | 2022-12-27T20:22:07.112408 | 2019-11-27T01:06:48 | 2019-11-27T01:06:48 | 209,467,543 | 0 | 0 | null | 2020-10-06T01:45:43 | 2019-09-19T05:13:03 | Java | UTF-8 | Java | false | false | 4,602 | java | package com.example.jarvis;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.jarvis.adapter.FriendAdapter;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class FriendList extends AppCompatActivity {
private RecyclerView recyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager layoutManager;
private List<String> list;
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.friend_list);
toolbar = findViewById(R.id.friend_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("FriendList");
getSupportActionBar().setDisplayShowHomeEnabled(true);
GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(this);
//new BackendTask(acct.getEmail()).execute();
ListView resultsListView = (ListView) findViewById(R.id.results);
HashMap<String,String> nameEmail = new HashMap<>();
nameEmail.put("a","a");
nameEmail.put("b","b");
nameEmail.put("c","c");
nameEmail.put("d","d");
nameEmail.put("e","e");
nameEmail.put("f","f");
nameEmail.put("g","g");
nameEmail.put("h","h");
nameEmail.put("i","i");
List<HashMap<String,String>> listItems = new ArrayList<>();
SimpleAdapter adapter = new SimpleAdapter(this,listItems,R.layout.friend_list_text_view, new String[]{"First Line", "Second Line"}, new int[]{R.id.name,R.id.email});
Iterator it = nameEmail.entrySet().iterator();
while (it.hasNext()) {
HashMap<String,String> resultMap = new HashMap<>();
Map.Entry pair = (Map.Entry)it.next();
resultMap.put("First Line", pair.getKey().toString());
resultMap.put("Second Line", pair.getValue().toString());
listItems.add(resultMap);
}
resultsListView.setAdapter(adapter);
// recyclerView = (RecyclerView) findViewById(R.id.friends_recycler_view);
//
// // use this setting to improve performance if you know that changes
// // in content do not change the layout size of the RecyclerView
// recyclerView.setHasFixedSize(true);
//
// // use a linear layout manager
// layoutManager = new LinearLayoutManager(this);
// recyclerView.setLayoutManager(layoutManager);
//
// list = Arrays.asList(getResources().getStringArray(R.array.test)); //change to friend list in data base
// // specify an adapter (see also next example)
// mAdapter = new FriendAdapter(list);
// recyclerView.setAdapter(mAdapter);
}
private class BackendTask extends AsyncTask<Void, Void, String> {
String email;
BackendTask(String email) {
this.email = email;
}
@Override
protected String doInBackground(Void... v) {
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet("http://ec2-3-14-144-180.us-east-2.compute.amazonaws.com/user/" + email);
String message = "";
try {
HttpResponse response = client.execute(request);
JSONObject friendlist = new JSONObject(response.toString());
} catch (java.io.IOException e) {
Log.e("Error", "Connection Error");
} catch (org.json.JSONException je) {
Log.e("Error", "Invalid JSONObject");
}
return message;
}
protected void onProgressUpdate() {
}
protected void onPostExecute(String message) {
}
}
}
| [
"tony.lee0754@gmail.com"
] | tony.lee0754@gmail.com |
27ab7cfa26d7b8bb06ad541104bb3d86a68ded5a | 4c730ce99f29fdc883557bbdcb52a48890e2ff18 | /app/src/main/java/details/hotel/app/hoteldetails/Adapter/RoomCategoriesListAdapter.java | dfafee9dd2fe184395eebe0e68c9c0554ee6fe9d | [] | no_license | nisharzingo/HotelDetailsOptions | 0b6ba91a0ee0b1e6ea956682bf0c315f86c73a30 | 48d9b007d6a3101ac4a46cfbe9f11703d6372107 | refs/heads/master | 2020-04-10T17:48:22.721586 | 2018-12-11T19:14:13 | 2018-12-11T19:14:13 | 161,184,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,962 | java | package details.hotel.app.hoteldetails.Adapter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import details.hotel.app.hoteldetails.Customs.CustomFonts.TextViewRobotoregular;
import details.hotel.app.hoteldetails.Model.HotelDetails;
import details.hotel.app.hoteldetails.Model.Rates;
import details.hotel.app.hoteldetails.Model.RoomCategories;
import details.hotel.app.hoteldetails.R;
import details.hotel.app.hoteldetails.UI.Activities.BookAvailablityScreen;
import details.hotel.app.hoteldetails.Utils.Util;
import details.hotel.app.hoteldetails.WebAPI.RateApi;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
/**
* Created by ZingoHotels Tech on 11-12-2018.
*/
public class RoomCategoriesListAdapter extends RecyclerView.Adapter<RoomCategoriesListAdapter.ViewHolder> {
Context context;
ArrayList<RoomCategories> roomCategories;
public RoomCategoriesListAdapter(Context context, ArrayList<RoomCategories> roomCategories)
{
this.context = context;
this.roomCategories = roomCategories;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_room_category_list,parent,false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
final RoomCategories roomCategory = roomCategories.get(position);
if(roomCategory!=null){
holder.mCategoryName.setText(roomCategories.get(position).getCategoryName());
if(roomCategory.getRates()!=null){
if(roomCategory.getRates().size()!=0){
holder.mRate.setText("₹ "+roomCategory.getRates().get(0).getSellRateForSingle()+"/-(incl GST)");
}
}else{
getRatesByCategoryId(roomCategory.getRoomCategoryId(),holder.mRate);
}
holder.mBookNow.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent book = new Intent(context, BookAvailablityScreen.class);
Bundle bundle = new Bundle();
bundle.putSerializable("Category",roomCategory);
book.putExtras(bundle);
context.startActivity(book);
}
});
}else{
}
}
@Override
public int getItemCount() {
return roomCategories.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
TextView mCategoryName,mRate;
ImageView mCategoryImage;
Button mBookNow;
public ViewHolder(View itemView) {
super(itemView);
mCategoryName = (TextView)itemView.findViewById(R.id.category_name);
mRate = (TextView) itemView.findViewById(R.id.rate);
mCategoryImage = (ImageView) itemView.findViewById(R.id.category_image);
mBookNow = (Button) itemView.findViewById(R.id.book_category);
}
}
private void getRatesByCategoryId(final int categoryId, final TextView sellRate){
RateApi apiService = Util.getClient().create(RateApi.class);
//String authenticationString = Util.getToken(context);
String authenticationString = "Basic TW9obmlBdmQ6ODIyMDgxOTcwNg==";
Call<ArrayList<Rates>> call = apiService.getRatesByCategoryId(authenticationString,categoryId);
call.enqueue(new Callback<ArrayList<Rates>>() {
@Override
public void onResponse(Call<ArrayList<Rates>> call, Response<ArrayList<Rates>> response) {
try {
int statusCode = response.code();
if (statusCode == 200||statusCode==201||statusCode==204) {
if(response.body()!=null&&response.body().size()!=0){
sellRate.setText("₹ "+response.body().get(0).getSellRateForSingle()+"/-(incl GST)");
}
}else {
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
@Override
public void onFailure(Call<ArrayList<Rates>> call, Throwable t) {
// Log error here since request failed
Log.e("TAG", t.toString());
}
});
}
}
| [
"nishar@zingohotels.com"
] | nishar@zingohotels.com |
e0b5d83b67d08ecfae0c90f5c93d85660db4ec65 | b429ade6399c3a0cc6419f06bb0e335a6f563c5e | /backend/src/main/java/net/bons/comptes/cqrs/CreateProjectHandler.java | d0e28b7a59dd69916f3c16c9b260282cced0c1b6 | [
"Beerware"
] | permissive | barmic/cotize | 02874c60a8d836a153952fad190bf499df3ff295 | 9f4abd9f00aef2547c5680e38f62b0fe9f8d049d | refs/heads/master | 2022-06-03T16:34:46.509423 | 2019-06-03T07:14:36 | 2019-06-03T07:14:36 | 41,143,047 | 3 | 3 | NOASSERTION | 2022-05-20T20:51:58 | 2015-08-21T07:50:15 | Java | UTF-8 | Java | false | false | 1,639 | java | package net.bons.comptes.cqrs;
/* Licence Public Barmic
* copyright 2014-2016 Michel Barret <michel.barret@gmail.com>
*/
import com.google.inject.Inject;
import io.vertx.core.Handler;
import io.vertx.rxjava.ext.web.RoutingContext;
import net.bons.comptes.cqrs.command.CreateProject;
import net.bons.comptes.cqrs.utils.CommandExtractor;
import net.bons.comptes.cqrs.utils.Utils;
import net.bons.comptes.service.MailService;
import net.bons.comptes.service.ProjectStore;
public class CreateProjectHandler implements Handler<RoutingContext> {
private CommandExtractor commandExtractor;
private MailService mailService;
private ProjectStore projectStore;
@Inject
public CreateProjectHandler(CommandExtractor commandExtractor, MailService mailService, ProjectStore projectStore) {
this.commandExtractor = commandExtractor;
this.mailService = mailService;
this.projectStore = projectStore;
}
@Override
public void handle(RoutingContext event) {
commandExtractor.readQuery(event, CreateProject::new)
.flatMap(projectStore::storeProject)
.map(project -> {
mailService.sendCreatedProject(project, event.request().getHeader("host"));
return project;
})
.subscribe(tuple2 ->
event.response()
.putHeader("Content-Type", "application/json")
.end(tuple2.toJson().toString())
, Utils.manageError(event));
}
}
| [
"michel.barret@gmail.com"
] | michel.barret@gmail.com |
4bfb3535c07f444475309df37ce78d0625dc02e2 | ab97b5478d007246782597387473bd3c11e39b1f | /src/main/java/net/kkolyan/elements/engine/core/slick2d/ShellAdapter.java | c0f3953d42d99c0680617cf21686692ce16ff1bc | [] | no_license | kkolyan/elements | 41bbac7acf1bd683719698728c0684ddd52ba73b | a94c1e6386f9455fe6877041226dd2db64d606ab | refs/heads/master | 2020-03-28T19:12:37.778846 | 2015-09-13T04:29:32 | 2015-09-13T04:29:32 | 42,209,588 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,186 | java | package net.kkolyan.elements.engine.core.slick2d;
import org.newdawn.slick.Color;
import org.newdawn.slick.Game;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.KeyListener;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.TrueTypeFont;
import java.awt.Font;
import java.util.ArrayList;
import java.util.List;
/**
* @author nplekhanov
*/
public class ShellAdapter implements Game, KeyListener {
private List<String> history = new ArrayList<String>();
private int historyCursor;
private String commandLine;
private Shell shell;
private SwitchableInputGame target;
private TrueTypeFont font;
private Input input;
public ShellAdapter(Shell shell, SwitchableInputGame target) {
this.shell = shell;
this.target = target;
}
@Override
public void init(GameContainer container) throws SlickException {
font = new TrueTypeFont(new Font("Courier New", Font.BOLD, 16), true);
target.init(container);
input = container.getInput();
input.addKeyListener(this);
}
@Override
public void update(GameContainer container, int delta) throws SlickException {
container.setShowFPS(commandLine == null);
target.update(container, delta);
}
@Override
public void render(GameContainer container, Graphics g) throws SlickException {
target.render(container, g);
if (commandLine != null) {
g.setColor(new Color(0, 0, 0, 127));
g.fillRect(0, 0, container.getWidth(), container.getHeight());
g.setColor(Color.white);
g.setFont(font);
g.drawString(">"+commandLine+"_", 30, 30);
}
}
@Override
public boolean closeRequested() {
return target.closeRequested();
}
@Override
public String getTitle() {
return target.getTitle();
}
@Override
public void keyPressed(int key, char c) {
if (key != -1)
{
// alt and control keys don't come through here
if (input.isKeyDown(Input.KEY_LCONTROL) || input.isKeyDown(Input.KEY_RCONTROL)) {
return;
}
if (input.isKeyDown(Input.KEY_LALT) || input.isKeyDown(Input.KEY_RALT)) {
return;
}
}
if (key == Input.KEY_GRAVE) {
if (commandLine == null) {
commandLine = "";
} else {
commandLine = null;
}
target.setAcceptingInput(commandLine == null);
return;
}
if (commandLine == null) {
return;
}
if (key == Input.KEY_UP) {
navigateHistory(1);
}
else if (key == Input.KEY_DOWN) {
navigateHistory(-1);
}
else if (key == Input.KEY_BACK) {
if (!commandLine.isEmpty()) {
commandLine = commandLine.substring(0, commandLine.length() - 1);
}
} else if ((c < 127) && (c > 31)) {
commandLine = commandLine + c;
} else if (key == Input.KEY_RETURN) {
if (!commandLine.isEmpty()) {
shell.executeCommand(commandLine);
history.add(commandLine);
historyCursor = 0;
commandLine = "";
}
}
}
private void navigateHistory(int offset) {
historyCursor += offset;
if (historyCursor > history.size()) {
historyCursor = history.size();
}
if (historyCursor < 0) {
historyCursor = 0;
}
if (historyCursor == 0) {
commandLine = "";
} else {
commandLine = history.get(history.size() - historyCursor);
}
}
@Override
public void keyReleased(int key, char c) {
}
@Override
public void setInput(Input input) {
}
@Override
public boolean isAcceptingInput() {
return true;
}
@Override
public void inputEnded() {
}
@Override
public void inputStarted() {
}
}
| [
"hidden"
] | hidden |
d3478c8c3c05d333a3eca59b5bb5570a6d0d228a | 2a927385052f1f58354801dd09e11e331b806977 | /mybatis-3-mybatis-3.4.2/src/test/java/org/apache/ibatis/reflection/ReflectorTest.java | 8b73b5813124db20cb0d96c82411dad076c56407 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | fenggulaike/SourceCode-mybatis | 13e0ede395a988f02ebea0e33f0fc65dac4783b7 | 8733083a2154cc95320711b21369cb0bdee8f0c9 | refs/heads/master | 2020-03-11T23:33:15.304692 | 2018-04-20T09:02:21 | 2018-04-20T09:02:21 | 130,324,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,487 | java | /**
* Copyright ${license.git.copyrightYears} the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.reflection;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import java.io.Serializable;
import java.util.List;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class ReflectorTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
public void testGetSetterType() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Section.class);
Assert.assertEquals(Long.class, reflector.getSetterType("id"));
}
@Test
public void testGetGetterType() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Section.class);
Assert.assertEquals(Long.class, reflector.getGetterType("id"));
}
@Test
public void shouldNotGetClass() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Section.class);
Assert.assertFalse(reflector.hasGetter("class"));
}
static interface Entity<T> {
T getId();
void setId(T id);
}
static abstract class AbstractEntity implements Entity<Long> {
private Long id;
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
}
static class Section extends AbstractEntity implements Entity<Long> {
}
@Test
public void shouldResolveSetterParam() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Child.class);
assertEquals(String.class, reflector.getSetterType("id"));
}
@Test
public void shouldResolveParameterizedSetterParam() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Child.class);
assertEquals(List.class, reflector.getSetterType("list"));
}
@Test
public void shouldResolveArraySetterParam() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Child.class);
Class<?> clazz = reflector.getSetterType("array");
assertTrue(clazz.isArray());
assertEquals(String.class, clazz.getComponentType());
}
@Test
public void shouldResolveGetterType() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Child.class);
assertEquals(String.class, reflector.getGetterType("id"));
}
@Test
public void shouldResolveSetterTypeFromPrivateField() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Child.class);
assertEquals(String.class, reflector.getSetterType("fld"));
}
@Test
public void shouldResolveGetterTypeFromPublicField() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Child.class);
assertEquals(String.class, reflector.getGetterType("pubFld"));
}
@Test
public void shouldResolveParameterizedGetterType() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Child.class);
assertEquals(List.class, reflector.getGetterType("list"));
}
@Test
public void shouldResolveArrayGetterType() throws Exception {
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(Child.class);
Class<?> clazz = reflector.getGetterType("array");
assertTrue(clazz.isArray());
assertEquals(String.class, clazz.getComponentType());
}
static abstract class Parent<T extends Serializable> {
protected T id;
protected List<T> list;
protected T[] array;
private T fld;
public T pubFld;
public T getId() {
return id;
}
public void setId(T id) {
this.id = id;
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
public T[] getArray() {
return array;
}
public void setArray(T[] array) {
this.array = array;
}
public T getFld() {
return fld;
}
}
static class Child extends Parent<String> {
}
@Test
public void shouldResoleveReadonlySetterWithOverload() throws Exception {
class BeanClass implements BeanInterface<String> {
public void setId(String id) {}
}
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(BeanClass.class);
assertEquals(String.class, reflector.getSetterType("id"));
}
interface BeanInterface<T> {
void setId(T id);
}
@Test
public void shouldSettersWithUnrelatedArgTypesThrowException() throws Exception {
@SuppressWarnings("unused")
class BeanClass {
public void setTheProp(String arg) {}
public void setTheProp(Integer arg) {}
}
expectedException.expect(ReflectionException.class);
expectedException.expectMessage(allOf(
containsString("theProp"),
containsString("BeanClass"),
containsString("java.lang.String"),
containsString("java.lang.Integer")));
ReflectorFactory reflectorFactory = new DefaultReflectorFactory();
Reflector reflector = reflectorFactory.findForClass(BeanClass.class);
reflector.getSetterType("theProp");
}
}
| [
"fenggulaike"
] | fenggulaike |
3e82ef9a5edb15f02a0ae312e102236a35e9c7c0 | df3b9e4d50e53de5e6132ba26165f15c2500256c | /src/main/java/com/blanche/softpairing/util/Auxiliary.java | b1d8220bc0f1ced2531644c1854e6fb2e3dcd4e9 | [] | no_license | blanche789/softpairing | b9334be8df753ee5d3f6eb4ddda75f7e1768a473 | 19c66be5080c2bdb983d62fca2c9d2ce743d02dc | refs/heads/master | 2020-08-15T09:31:18.576996 | 2019-10-16T16:02:12 | 2019-10-16T16:02:12 | 215,317,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,849 | java | package com.blanche.softpairing.util;
import java.util.Random;
/**
* @Auther:Blanche
* @Date:2019/10/13
* @Description:com.blanche.softpairing.util
* @version:1.0
*/
public class Auxiliary {
Random random = new Random();
public int commonDivisor(int numerator, int denominator) { //生成最大公约数
int num = 1;
for (int i = 1; i <= numerator; i++) {
if (numerator % i == 0 && denominator % i == 0) {
num = i;
}
}
return num;
}
public int[] indexArray(int operatorNum , int totalOperator) { //生成运算符匹配的索引
Random random = new Random();
int[] operatorIndex = new int[operatorNum];
for (int i = 0; i < operatorNum; i++) {
operatorIndex[i] = random.nextInt(totalOperator);
}
return operatorIndex;
}
public String splicingFormula(int[] operatorIndex, int[] operands, int operatorNum) {//将运算符与操作数连接
//判断式子形式的标志
int tag = random.nextInt(2);
StringBuilder stringBuilder = new StringBuilder();
switch (operatorNum) {
case 1:
//a+b的式子
stringBuilder.append(operands[0])
.append(" ")
.append(Generate.operatorArr[operatorIndex[0]])
.append(" ")
.append(operands[1])
.append(" ")
.append("=")
.append(" ");
break;
case 2:
if (tag == 0) { //a+b+c的式子
stringBuilder.append(operands[0])
.append(" ")
.append(Generate.operatorArr[operatorIndex[0]])
.append(" ")
.append(operands[1])
.append(" ")
.append(Generate.operatorArr[operatorIndex[1]])
.append(" ")
.append(operands[2])
.append(" ")
.append("=")
.append(" ");
}else { //a+(b+c)的式子
stringBuilder.append(operands[0])
.append(" ")
.append(Generate.operatorArr[operatorIndex[0]])
.append(" ")
.append("(")
.append(" ")
.append(operands[1])
.append(" ")
.append(Generate.operatorArr[operatorIndex[1]])
.append(" ")
.append(operands[2])
.append(" ")
.append(")")
.append(" ")
.append("=")
.append(" ");
}
break;
case 3:
if (tag == 0) {//a+b+c+d的式子
stringBuilder.append(operands[0])
.append(" ")
.append(Generate.operatorArr[operatorIndex[0]])
.append(" ")
.append(operands[1])
.append(" ")
.append(Generate.operatorArr[operatorIndex[1]])
.append(" ")
.append(operands[2])
.append(" ")
.append(Generate.operatorArr[operatorIndex[2]])
.append(" ")
.append(operands[3])
.append(" ")
.append("=")
.append(" ");
} else { //a+((b+c)+d)的式子
stringBuilder.append(operands[0])
.append(" ")
.append(Generate.operatorArr[operatorIndex[0]])
.append(" ")
.append("((")
.append(" ")
.append(operands[1])
.append(" ")
.append(Generate.operatorArr[operatorIndex[1]])
.append(" ")
.append(operands[2])
.append(" ")
.append(")")
.append(" ")
.append(Generate.operatorArr[operatorIndex[2]])
.append(" ")
.append(operands[3])
.append(" ")
.append(")")
.append(" ")
.append("=")
.append(" ");
}
break;
}
return stringBuilder.toString();
}
//生成互质的两个数,分别作为分子分母
public int[] primeNumber(int numRange) {
int x = random.nextInt(numRange) + 1;
int y = random.nextInt(numRange) + 1;
int[] primeNumArr = new int[2];
int divisor = commonDivisor(x, y);
if (divisor != 1) {
x = x / divisor;
y = y / divisor;
}
primeNumArr[0] = x;
primeNumArr[1] = y;
return primeNumArr;
}
//转换为真分数
public String properFraction(int x, int y) {
String properFraction;
if (x > y) {
if (y != 1) {
int n = x / y;
x = x - n * y;
properFraction = n + "'" + x + "/" + y;
} else {
properFraction = String.valueOf(x);
}
} else if (x == y) {
properFraction = String.valueOf(1);
}else {
properFraction = x + "/" + y;
}
return properFraction;
}
public int caculate(int a, int b, String operator) {//计算两个整数
char operatorChar = operator.charAt(0);
int result = 0;
switch (operatorChar) {
case '+':
result = a + b;
break;
case '-':
result = a - b;
break;
case '*':
result = a * b;
break;
case '÷':
if (b == 0) {
result = -1;
} else if (a % b != 0) {
result = -2;
}else
result = a / b;
break;
}
return result;
}
}
| [
"blanche789@163.com"
] | blanche789@163.com |
f5e469bde59e2b0828bf111cf3f7d0f9fe1c648b | 9cd45a02087dac52ea4d39a0c17e525c11a8ed97 | /src/java/com/adincube/sdk/mediation/f/a.java | 9fbe7066b8f98f878a17858c401f759188353ea1 | [] | no_license | abhijeetvaidya24/INFO-NDVaidya | fffb90b8cb4478399753e3c13c4813e7e67aea19 | 64d69250163e2d8d165e8541aec75b818c2d21c5 | refs/heads/master | 2022-11-29T16:03:21.503079 | 2020-08-12T06:00:59 | 2020-08-12T06:00:59 | 286,928,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | /*
* Decompiled with CFR 0.0.
*
* Could not load the following classes:
* java.lang.Integer
* java.lang.Object
* java.lang.String
*/
package com.adincube.sdk.mediation.f;
import com.adincube.sdk.mediation.b;
import com.adincube.sdk.mediation.j;
public final class a {
com.adincube.sdk.mediation.a a = null;
private b b = null;
public a(b b2) {
this.b = b2;
}
public final void a() {
com.adincube.sdk.mediation.a a2 = this.a;
if (a2 != null) {
a2.a();
}
}
public final void a(int n2) {
if (this.a != null) {
j.a a2 = j.a.d;
if (n2 != -103 && n2 != -102) {
if (n2 != -6) {
if (n2 == 204) {
a2 = j.a.b;
}
} else {
a2 = j.a.d;
}
} else {
a2 = j.a.c;
}
j j2 = new j(this.b, a2, Integer.toString((int)n2));
this.a.a(j2);
}
}
}
| [
"abhijeetvaidya24@gmail.com"
] | abhijeetvaidya24@gmail.com |
4a485980344b5db164e8aafa185b4b59a6bda38e | e9a2bd62e0e3a25821158fb2243d976076f565e1 | /dt-parent/dt-web/src/main/java/com/techm/adms/dt/web/EmpathyService.java | 677058be4d6877aec373e66aa796adedde30e004 | [] | no_license | kailashsjk/latestdt | 98caafbf2b0926ee708a4aca1b13bffbf03aa63d | 48287afea859c2af0538dfb3175723de1de4f38d | refs/heads/master | 2021-07-14T17:36:03.138327 | 2017-10-13T13:20:14 | 2017-10-13T13:20:14 | 106,825,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,177 | java | package com.techm.adms.dt.web;
import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.techm.adms.dt.common.exception.DTServiceException;
import com.techm.adms.dt.entity.Empathy;
import com.techm.adms.dt.entity.Observation;
import com.techm.adms.dt.service.IDTEmpathyBean;
import com.techm.adms.dt.web.util.ServiceConstants;
@Path("/empathyservice")
@RequestScoped
public class EmpathyService {
@Inject
IDTEmpathyBean dTEmpathyBean;
private static final Logger LOGGER = LoggerFactory.getLogger(EmpathyService.class);
/**
* Retrieves Empathy list to display in empathy map screen
*
* @param mediaId
* @return
*/
@GET
@Path("/getempathy/{mediaID}")
@Produces({"application/json"})
public Empathy retrieveEmpathyList(@PathParam("mediaID") int mediaID){
LOGGER.info("In Service Class");
try{
List<Observation> observationsList = dTEmpathyBean.retrieveEmpathy(mediaID);
return prepareEmpathyMap(observationsList);
}catch(Exception e){
throw new DTServiceException(e);
}
}
/*
* Preparing the Empathy Map list from Observations based on Media
*/
private Empathy prepareEmpathyMap(List<Observation> observationsList){
Empathy empathy = new Empathy();
LOGGER.info("In Service Class");
try{
for(Observation observation:observationsList){
switch(observation.getObservationCategory().getObservationCategoryID()){
case ServiceConstants.OBSERVATION_CATEGORY_SAY_ID:
empathy.addSayObservation(observation);
break;
case ServiceConstants.OBSERVATION_CATEGORY_DO_ID:
empathy.addDoObservation(observation);
break;
case ServiceConstants.OBSERVATION_CATEGORY_FEEL_ID:
empathy.addFeelObservation(observation);
break;
case ServiceConstants.OBSERVATION_CATEGORY_THINK_ID:
empathy.addThinkObservation(observation);
break;
default:
break;
}
}
}catch(Exception e){
throw new DTServiceException(e);
}
return empathy;
}
}
| [
"PV00434293@techmahindra.com"
] | PV00434293@techmahindra.com |
7af371c31cf1eafda8b8d62bfe795558e1db1740 | be76334be32ddf40f4c417e1f543e92b547fcda7 | /Foros/generado/ForosISIS.api/src/main/java/co/edu/uniandes/csw/G3xtreme/lugar/logic/dto/LugarDTO.java | 655b33605f3d23968d9bcff885ada394805824ac | [] | no_license | SamuelBaquero/ForosIsis | 788895b2217e7673adeae9c47985116a2b11ab79 | 4a2da9f7add49987c6b497953d78e83d8f4df074 | refs/heads/master | 2021-01-15T13:33:24.136206 | 2014-10-28T21:18:07 | 2014-10-28T21:18:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,449 | java | /* ========================================================================
* Copyright 2014 G3xtreme
*
* Licensed under the MIT, The MIT License (MIT)
* Copyright (c) 2014 G3xtreme
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
* ========================================================================
Source generated by CrudMaker version 1.0.0.201408112050
*/
package co.edu.uniandes.csw.G3xtreme.lugar.logic.dto;
public class LugarDTO extends _LugarDTO {
} | [
"estudiante@ISIS2603-SERVER.virtual.uniandes.edu.co"
] | estudiante@ISIS2603-SERVER.virtual.uniandes.edu.co |
a562ca27d7ce46c991a3bdcf7abb835c93d62561 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_1893.java | bd2e1eb1ec776bf8a89f5d57f136f1b0c1cea562 | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | /**
* This is a fast, native implementation of an iterative box blur. The algorithm runs in-place on the provided bitmap and therefore has a very small memory footprint. <p> The iterative box blur has the nice property that it approximates the Gaussian blur very quickly. Usually iterations=3 is sufficient such that the casual observer cannot tell the difference. <p> The edge pixels are repeated such that the bitmap still has a well-defined border. <p> Asymptotic runtime: O(width * height * iterations) <p> Asymptotic memory: O(radius + max(width, height))
* @param bitmap The targeted bitmap that will be blurred in-place. Each dimension must not begreater than 65536.
* @param iterations The number of iterations to run. Must be greater than 0 and not greater than65536.
* @param blurRadius The given blur radius. Must be greater than 0 and not greater than 65536.
*/
public static void iterativeBoxBlur(Bitmap bitmap,int iterations,int blurRadius){
Preconditions.checkNotNull(bitmap);
Preconditions.checkArgument(iterations > 0);
Preconditions.checkArgument(blurRadius > 0);
nativeIterativeBoxBlur(bitmap,iterations,blurRadius);
}
| [
"sonnguyen@utdallas.edu"
] | sonnguyen@utdallas.edu |
b5c65f35a94811aa14f363029326f31297c06192 | 2600d49514fbc88d4367a2f0709d61f9ffcf56db | /epei/src/main/java/com/acooly/epei/domain/Department.java | 425d1961ce5dbcc3a01936d2ee46ba5403ef1cf2 | [] | no_license | hyx66/lpz | 534df3e34f684ea0272c2b5ebff246c8d8a32f88 | 1d851b91ac52d285575367b6843b89876a4d16f7 | refs/heads/master | 2020-12-30T18:03:32.154503 | 2017-05-12T07:09:32 | 2017-05-12T07:09:32 | 90,950,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,283 | java | package com.acooly.epei.domain;
import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
/**
* 医院科室 Entity
*
* @author Acooly Code Generator
* Date: 2015-10-19 18:43:56
*/
@Entity
@Table(name = "EP_DEPARTMENT")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Department extends TimeEntity {
/** serialVersionUID */
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/**医院ID*/
private Long hospitalId;
/**医院名称*/
private String hospitalName;
/** 科室 */
private String name;
/** 删除 */
private int deleted;
/**陪护价格*/
private BigDecimal phServicePrice;
@Id
@GeneratedValue(generator = "sequence")
@GenericGenerator(name = "sequence", strategy = "sequence", parameters = { @Parameter(name = "sequence",
value = "SEQ_EP_DEPARTMENT") })
public Long getId(){
return this.id;
}
public void setId(Long id){
this.id = id;
}
public Long getHospitalId() {
return hospitalId;
}
public void setHospitalId(Long hospitalId) {
this.hospitalId = hospitalId;
}
public String getName(){
return this.name;
}
public void setName(String name){
this.name = name;
}
public int getDeleted(){
return this.deleted;
}
public void setDeleted(int deleted){
this.deleted = deleted;
}
public String getHospitalName() {
return hospitalName;
}
public void setHospitalName(String hospitalName) {
this.hospitalName = hospitalName;
}
public BigDecimal getPhServicePrice() {
return phServicePrice;
}
public void setPhServicePrice(BigDecimal phServicePrice) {
this.phServicePrice = phServicePrice;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
| [
"1174068588@qq.com"
] | 1174068588@qq.com |
d47ea119c8da6a75ef312a5c0f3f7633e22b17f7 | a3b0886f7c447d202faef59ecea86e455f4803cc | /app/src/main/java/suleman/martin/com/service/bundle_values_class.java | 57d15af7323ef14c45573e18ef356f42079a6ac1 | [] | no_license | sulemartin87/Service_Smart_App | a10e38653cbb822601c476fb77efddd5c715669b | 1c108e88d8727ea874009b8d947ebc149b14d8f0 | refs/heads/master | 2021-01-10T03:06:30.579644 | 2015-11-30T21:10:32 | 2015-11-30T21:10:32 | 46,877,179 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package suleman.martin.com.service;
public class bundle_values_class
{
private String bundle_value;
public String getbundle_value()
{
return bundle_value;
}
public void setbundle_value(String bundle_value)
{
this.bundle_value = bundle_value;
}
@Override
public String toString()
{
return bundle_value;
}
}
| [
"sulemartin87@gmail.com"
] | sulemartin87@gmail.com |
df382ef1f71b2a7f002dd68b9815d6ddba1dbfb2 | 46859af06fdb68004f3a57e2acdd879e92a89489 | /sum.java | 9042d051d7094aea8b8af70754d64f50db3af3e5 | [] | no_license | vinodk619/war_project | bccb3a5d5e1f9f28c5225c343df84d5446f59ca4 | e6d796e62a65d541fe8c8a098096244c86924dd4 | refs/heads/master | 2021-03-15T04:45:50.814605 | 2020-03-12T12:16:28 | 2020-03-12T12:16:28 | 246,825,390 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 95 | java | class sum
{
public static void main{string[]}
{
init a,b,c
a=20,b=30,c=4
d=a+b+c}
}
| [
"vinodkumarrrddy619@gmail.com"
] | vinodkumarrrddy619@gmail.com |
f22c1a94462b70a2555932d3f5506e45a5ae4cbe | cd4a79a2841c6d3d7ee687e502f121a7156d0920 | /app/src/main/java/hainu/com/trainorganization/adapter/ArticlelistAdapter.java | 479ed3c243a6758334c785f7f1f31047bb5e2421 | [] | no_license | 1812507678/TrainOrganization | 8064d2fdf61ee9dd0a53ac463ea63be1bbe225b3 | 4943b1ca2fbc05ff07b4f2500c06b547ea35d02b | refs/heads/master | 2020-06-13T03:59:50.339432 | 2016-12-28T18:25:59 | 2016-12-28T18:25:59 | 75,451,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,019 | java | package hainu.com.trainorganization.adapter;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.lidroid.xutils.BitmapUtils;
import java.util.List;
import hainu.com.trainorganization.R;
import hainu.com.trainorganization.bean.StrategyArticle;
/**
* Created by Administrator on 2016/7/26.
*/
public class ArticlelistAdapter extends BaseAdapter {
private BitmapUtils bitmapUtils;
private Activity activity;
private List<StrategyArticle> data;
public ArticlelistAdapter(Activity activity, List<StrategyArticle> data) {
bitmapUtils = new BitmapUtils(activity);
this.data = data;
this.activity = activity;
}
@Override
public int getCount() {
return data.size();
}
@Override
public Object getItem(int position) {
return data.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final StrategyArticle article = data.get(position);
View inflate = View.inflate(activity, R.layout.list_article_item,null);
ImageView iv_readlist_artcileimage = (ImageView) inflate.findViewById(R.id.iv_readlist_artcileimage);
TextView tv_readlist_title = (TextView) inflate.findViewById(R.id.tv_readlist_title);
TextView tv_readlist_time = (TextView) inflate.findViewById(R.id.tv_readlist_time);
TextView tv_readlist_count = (TextView) inflate.findViewById(R.id.tv_readlist_count);
String imageurl = article.getimageUrl();
bitmapUtils.display(iv_readlist_artcileimage,imageurl);
tv_readlist_title.setText(article.getTitle());
tv_readlist_time.setText(article.getTime());
tv_readlist_count.setText("阅读量:"+ article.getReadCount()+"");
return inflate;
}
}
| [
"1812507678@qq.com"
] | 1812507678@qq.com |
6573cc2e30421a378c928383bfc61acdcb763ac3 | 7c832046815214f00436a5047cdcf2df1d705263 | /common_base/src/main/java/com/xy/commonbase/base/BasePopupWindow.java | d37d65a5260f004188fddec0b64c8ee7f6672fef | [] | no_license | surpreme/aite1.1.1 | 1c0d258d3ae0e9fb6e7fa618a1bdf31799bc8f5a | 37346a1ec059c7bb4210be46fdd913642375831c | refs/heads/master | 2020-08-29T12:21:50.871759 | 2019-10-28T08:18:18 | 2019-10-28T08:18:18 | 218,029,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,677 | java | package com.xy.commonbase.base;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;
import androidx.annotation.StyleRes;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
public abstract class BasePopupWindow extends PopupWindow {
protected Context mContext;
private Unbinder binder;
protected CompositeDisposable disposable;
public BasePopupWindow(Context context, CompositeDisposable disposable) {
this(context,ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT,0,disposable);
}
public BasePopupWindow(Context context, int width, int height, @StyleRes int anim , CompositeDisposable disposable) {
this.mContext = context;
View enrollView = LayoutInflater.from(mContext).inflate(getLayout(), null);
binder = ButterKnife.bind(this, enrollView);
this.disposable = disposable;
this.setContentView(enrollView);
// 设置宽高
this.setWidth(width);
this.setHeight(height);
// 设置弹出窗口可点击
this.setOutsideTouchable(true);
// 窗体背景色
this.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
this.setAnimationStyle(anim);
initData();
initView();
}
public abstract int getLayout();
protected abstract void initData();
protected abstract void initView();
} | [
"1740747328@qq.com"
] | 1740747328@qq.com |
760c9004cab87ed9cd776bee42986eba4c895447 | 63e6db6507fa7bdfa5f7da9bc260e63e619a90f6 | /src/main/java/pl/moras/tracker/services/ITrackingService.java | 20aaa8f5a339848155c22268059fe34f157f4a2e | [] | no_license | Moras-del/FindMyFriend | efe21df89dd9f7743003bf554b3f9ed50bf9da20 | df7b6b1da5030edd329f2b5e7e6c9f751eabe0e7 | refs/heads/master | 2021-05-17T13:55:13.058028 | 2020-05-23T21:42:11 | 2020-05-23T21:42:11 | 250,805,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 366 | java | package pl.moras.tracker.services;
import pl.moras.tracker.model.LocationDto;
import pl.moras.tracker.model.User;
import java.util.List;
public interface ITrackingService {
List<User> getOnlineFriends(String username);
User updateLocation(User user, LocationDto locationDto);
User enableTracking(User user);
User disableTracking(User user);
}
| [
"morekszymon@wp.pl"
] | morekszymon@wp.pl |
961bfcb56614d1fb21b6d57da9d3f39bd4fdf710 | 90cc58b0c2d519211416f73831f1896b54196e95 | /ROOT/src/com/upmile/util/VelocityUtils.java | b81d34cc852d95fd12345de072ca514d1161d302 | [] | no_license | kavram/bucket | 0a3587017adf55aec051e96313e50f45ac8bb059 | 13f42a9662cb71d03b97fc21aa010abb39efc9e0 | refs/heads/master | 2021-01-19T08:53:30.015133 | 2014-02-26T05:25:13 | 2014-02-26T05:25:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,135 | java | package com.upmile.util;
import java.util.Properties;
import org.apache.log4j.Logger;
import org.apache.velocity.app.Velocity;
public class VelocityUtils {
static Logger log = Logger.getLogger(VelocityUtils.class);
private String filePath;
private String loader;
private String forEachScopeControl;
private String interpolateStringLiterals;
private static String domain;
private static String uploadedImagesUrl;
private static String uploadedImagesPath;
public void init(){
try {
Properties props = new Properties();
props.put("file.resource.loader.path", filePath);
props.put("resource.loader", loader);
props.put("foreach.provide.scope.control", forEachScopeControl);
props.put("runtime.interpolate.string.literals", interpolateStringLiterals);
Velocity.init(props);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getLoader() {
return loader;
}
public void setLoader(String loader) {
this.loader = loader;
}
public String getForEachScopeControl() {
return forEachScopeControl;
}
public void setForEachScopeControl(String forEachScopeControl) {
this.forEachScopeControl = forEachScopeControl;
}
public String getInterpolateStringLiterals() {
return interpolateStringLiterals;
}
public void setInterpolateStringLiterals(String interpolateStringLiterals) {
this.interpolateStringLiterals = interpolateStringLiterals;
}
public void setDomain(String domain) {
VelocityUtils.domain = domain;
}
public static String getDomain() {
return VelocityUtils.domain;
}
public void setUploadedImagesUrl(String uploadedImagesUrl) {
VelocityUtils.uploadedImagesUrl = uploadedImagesUrl;
}
public static String getUploadedImagesUrl() {
return VelocityUtils.uploadedImagesUrl;
}
public void setUploadedImagesPath(String uploadedImagesPath) {
VelocityUtils.uploadedImagesPath = uploadedImagesPath;
}
public static String getUploadedImagesPath() {
return VelocityUtils.uploadedImagesPath;
}
}
| [
"kirill_avramenko@yahoo.com"
] | kirill_avramenko@yahoo.com |
47e945dee6eac6bc68ee7a15cbd304dfaf0f85a3 | 25848f7a075be87ad7e0dad7ec300f9194a2fd11 | /MakeTags.java | f2eb2f45bc9639a780d473a011ed41e825dd503b | [] | no_license | fearlessfreap24/StringOneJava | b0026d258da3b116d8b7d51603c3012ee10da543 | f312e43d6627b8434e16f5143ca8fcba563d4051 | refs/heads/master | 2022-11-30T17:01:05.636671 | 2020-08-14T21:18:50 | 2020-08-14T21:18:50 | 287,103,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,034 | java | import java.util.Arrays;
//The web is built with HTML strings like "<i>Yay</i>" which draws
//Yay as italic text. In this example, the "i" tag makes <i> and
//</i> which surround the word "Yay". Given tag and word strings,
//create the HTML string with tags around the word, e.g. "<i>Yay</i>".
//
//makeTags("i", "Yay") → "<i>Yay</i>"
//makeTags("i", "Hello") → "<i>Hello</i>"
//makeTags("cite", "Yay") → "<cite>Yay</cite>"
public class MakeTags {
public static void main(String[] args) {
// TODO Auto-generated method stub
MakeTags start = new MakeTags();
start.run();
}
private void run() {
// TODO Auto-generated method stub
String[][] input = { {"i", "Yay"}, {"i", "Hello"}, {"cite", "Yay"} };
for ( String[] i : input ) {
System.out.printf("i = %s : %s\n", Arrays.toString(i), makeTags( i[0], i[1]));
}
}
private String makeTags(String tag, String word) {
// TODO Auto-generated method stub
return String.format("<%s>%s</%s>", tag, word, tag);
}
}
| [
"dylanaperez@yahoo.com"
] | dylanaperez@yahoo.com |
0ae4c0132f69eaa4998ac4d438ea527798b09531 | 3c5b348c4240982f2826bece631f645ecc203581 | /operate system/Victor/12-03-14/os.java | a6c80537c9c02b5514e6e892a518df2d97bbcbfc | [] | no_license | bloodjay/College | 547addf59acb6902566b5f60b751c8bf8da58d68 | 3b8db4e31448b0257d0f8fbd549565fa99ae3e4d | refs/heads/master | 2021-01-17T14:36:14.540888 | 2017-03-06T16:20:19 | 2017-03-06T16:20:19 | 84,093,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,298 | java | import java.util.*;
//OS class
//holds all the functions called by SOS: startup, crint, drmint, dskint, tro, svc
public class os
{
//"global" variables for OS class
static jobTable arrivingJob; //job that most recently came into system
static jobTable runningJob; //job that is being run
static memManager memory; //objects for memory management
static CPUScheduler scheduler; //and CPU Scheduling
//*NOTE: the ready queue and wait queue are part of scheduler
static int timeSlice; //default time slice or time quantum for jobs
static int curTime; //current time
static int prevTime; //previous time - used to measure run time of a job
//Startup - initializes all variables and objects
public static void startup()
{
System.out.print("\n\n///////------*****STARTUP*****------///////\n\n");
sos.ontrace();
arrivingJob = new jobTable();
runningJob = new jobTable();
memory = new memManager();
scheduler = new CPUScheduler();
curTime = 0;
prevTime = 0;
return;
}
//Crint - called when job arrives on drum
//p: 1 = jobNum, 2 = priority, 3 = size, 4 = maxCPUTime, 5 = currentTime
public static void Crint(int []a, int []p)
{
//update time variables
prevTime = curTime;
curTime = p[5];
System.out.print("\n\n///////------*****CRINT*****------///////\n\n");
//create temp jobTable object of job that just came onto the drum
arrivingJob = new jobTable(p[1], p[3], p[4], memory.worstFitLocation);
//update worstfit location;
memory.worstFit();
//if the job can fit into memory and the drum is not busy, call siodrum, which moves job from
//drum to memory or the other way
if (memory.canFit(arrivingJob.size) && !scheduler.drumBusy)
{
sos.siodrum(arrivingJob.num, arrivingJob.size, arrivingJob.location, 0);
//************************************************************************************************************************************************
//debugging purposes line here. want to know when is the drum marked busy and when is not
System.out.println("Drum bussy? "scheduler.drumBusy + " **************************************************************************************************************************");
//***********************************************************************************************************************************************
scheduler.drumBusy = true;
}
//if it can't fit or the drum is busy, put it into the wait queue
else
scheduler.waitQ.add(arrivingJob);
//if there is no job on the ready queue and the drum is busy, put CPU in idle mode.
if (scheduler.readyQ.isEmpty() && scheduler.drumBusy)
{
a[0] = 1;
return;
}
//but if the ready queue is empty but drum is not busy, check the waitQ
else if (scheduler.readyQ.isEmpty() && !scheduler.drumBusy)
//if waitQ is not empty, call siodrum to move the job into memory
if (!scheduler.waitQ.isEmpty())
{
/******************************************************************************************************************************************
need to fix this, move a job from waiting queue to memory when drum is not busy and memory has enough space.
*/
System.out.println("8888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888");
}
//if waitQ is also empty, put CPU in idle
else
{
a[0] = 1;
return;
}
//else, run job on queue
runningJob.timeSlice -= curTime - prevTime;
runningJob.runTime += curTime - prevTime;
/*if job finished time quantum and used it's max CPU time, then
*it is completed, remove it from queue and memory*/
if (runningJob.timeSlice == 0 && runningJob.runTime == runningJob.maxTime)
{
//remove job from memory
memory.remove(runningJob.location, runningJob.size);
//remove job from queue
scheduler.readyQ.remove();
//if the ready queue is empty, return control to sos with no jobs to run
if (scheduler.readyQ.isEmpty())
a[0] = 1;
return;
}
//else, there should be a running job, run it
else
a[0] = 2;
p[2] = runningJob.location;
p[3] = runningJob.size;
p[4] = runningJob.timeSlice;
return;
}
//Diskint - called when a job finishes I/O
public static void Dskint(int []a, int []p)
{
//update time variables
prevTime = curTime;
curTime = p[5];
System.out.print("\n\n///////------*****DSKINT*****------///////\n\n");
//Since it finished I/O, it is no longer latched and is unblocked
scheduler.readyQ.peek().latchBit = false;
scheduler.readyQ.peek().blockBit = false;
runningJob = scheduler.readyQ.peek();
//Resume job to run
a[0] = 2;
p[2] = runningJob.location;
p[3] = runningJob.size;
p[4] = runningJob.timeSlice;
return;
}
//Drmint - called when job finishes moving from drum to mem, or vice versa
public static void Drmint(int []a, int []p)
{
//************************************************************************************************************************************************
//debugging purposes line here. want to know when is the drum marked busy and when is not
System.out.println(" Drum bussy? "scheduler.drumBusy + " **************************************************************************************************************************");
//***********************************************************************************************************************************************
scheduler.drumBusy = false;
prevTime = curTime;
curTime = p[5];
/*if there is a job running, check if it is completed then remove it,
*else just keep running it */
if (runningJob !=null)
{
runningJob.timeSlice -= curTime - prevTime;
runningJob.runTime += curTime - prevTime;
/*if job finished time quantum and used it's max CPU time, then
*it is completed, remove it from queue and memory*/
if (runningJob.timeSlice == 0 && runningJob.runTime !=0)
{
//remove job from memory
memory.remove(runningJob.location, runningJob.size);
scheduler.readyQ.remove();
}
}
System.out.print("\n\n///////------*****DRMINT*****------///////\n\n");
//add job into memory
memory.add(arrivingJob.size);
//add job into ready queue
scheduler.readyQ.add(arrivingJob);
runningJob = scheduler.readyQ.peek();
//Resume job to run
a[0] = 2;
p[2] = runningJob.location;
p[3] = runningJob.size;
p[4] = runningJob.timeSlice;
/************************************************************************************************************************************************************
this loop is set for debugging purposes
it prints our version of memory to be compared to sos memory*/
for (int i=0; i<25; i++)
{
if ((i+1)%4 == 0)
System.out.println("\n");
System.out.println(i +"" + memory.mem[i] + "\t\t" + (i + 25) +"" + memory.mem[i + 25] + "\t\t" + + (i + 50) +"" + memory.mem[i + 50 ] + "\t\t" + + (i + 75) +"" + memory.mem[i + 75]);
}
System.out.println("WORST FIT LOCTION " + memory.worstFitLocation + "\n\n");
//************************************************************************************************************************************************************
return;
}
//TRO - called when a job completes its time quantum
public static void Tro(int []a, int []p)
{
//update time variables
prevTime = curTime;
curTime = p[5];
runningJob.timeSlice -= curTime - prevTime;
runningJob.runTime += curTime - prevTime;
/*If job remaining time is less than time quantum and the job still needs time to
*complete, then make the time quantum the remaining time for the job */
if (runningJob.maxTime - runningJob.runTime <= 5 && runningJob.maxTime - runningJob.runTime !=0)
runningJob.timeSlice = runningJob.maxTime - runningJob.runTime;
/*else if job finished time quantum and used it's max CPU time, then
*it is completed, remove it from queue and memory*/
else if (runningJob.timeSlice == 0 && runningJob.maxTime == runningJob.runTime)
{
//remove job from memory
memory.remove(runningJob.location, runningJob.size);
scheduler.readyQ.remove();
//if there is no job in the ready queue, the CPU is idle
if (scheduler.readyQ.isEmpty()) {
a[0] = 1;
runningJob = null;
return;
}
//otherwise, the next job in the queue is now the running job
runningJob = scheduler.readyQ.peek();
//Resume the job to run
a[0] = 2;
p[2] = runningJob.location;
p[3] = runningJob.size;
p[4] = runningJob.timeSlice;
return;
}
//else, the job still needs time for completion, therefore is given a new time quantum
else
runningJob.timeSlice = runningJob.TIMEQUANTUM;
System.out.print("\n\n///////------*****TRO*****------///////\n\n");
//push running job to back and start next job in queue
scheduler.roundRobin();
runningJob = scheduler.readyQ.peek();
//Resume job to run
a[0] = 2;
p[2] = runningJob.location;
p[3] = runningJob.size;
p[4] = runningJob.timeSlice;
return;
}
//SVC - called in one of three instances
//terminate, which means a job wants to finish
//request I/O, which means a job wants to do I/O
//block, which means a job does not want to run on the CPU until it finishes I/O
public static void Svc(int []a, int []p)
{
//update time variables
prevTime = curTime;
curTime = p[5];
//the three mentioned instances are denoted by the value of a
switch (a[0])
{
//a=5 - terminate
case 5:
System.out.print("\n\n///////------*****SVC-TERM*****------///////\n\n");
//remove job from memory
memory.remove(runningJob.location, runningJob.size);
scheduler.readyQ.remove();
//if there is no job in the ready queue, the CPU is idle
if (scheduler.readyQ.isEmpty()) {
a[0] = 1;
runningJob = null;
/************************************************************************************************************************************************************
this loop is set for debugging purposes
it prints our version of memory to be compared to sos memory*/
for (int i=0; i<25; i++)
{
if ((i+1)%4 == 0)
System.out.println("\n");
System.out.println(i +"" + memory.mem[i] + "\t\t" + (i + 25) +"" + memory.mem[i + 25] + "\t\t" + + (i + 50) +"" + memory.mem[i + 50 ] + "\t\t" + + (i + 75) +"" + memory.mem[i + 75]);
}
System.out.println("WORST FIT LOCATION " + memory.worstFitLocation + "\n\n");
//************************************************************************************************************************************************************
break;
}
//otherwise, the next job in the queue is now the running job
runningJob = scheduler.readyQ.peek();
//Resume the job to run
a[0] = 2;
p[2] = runningJob.location;
p[3] = runningJob.size;
p[4] = runningJob.timeSlice;
break;
//a=6 - request I/O
case 6:
System.out.print("\n\n///////------*****SVC-I/O*****------///////\n\n");
//call siodisk - which starts I/O for the given job
sos.siodisk(runningJob.num);
//Update its CPU running time
runningJob.timeSlice -= curTime - prevTime;
runningJob.runTime += curTime - prevTime;
//set the latchBit to true, since the job is doing I/O
scheduler.readyQ.peek().latchBit = true;
//run next job
runningJob = scheduler.readyQ.peek();
a[0] = 2;
p[2] = runningJob.location;
p[3] = runningJob.size;
p[4] = runningJob.timeSlice;
break;
//a=7 - block
case 7:
System.out.print("\n\n///////------*****SVC-BLOCK*****------///////\n\n");
//Update its CPU running time
runningJob.timeSlice -= curTime - prevTime;
runningJob.runTime += curTime - prevTime;
//set blockBit to true
scheduler.readyQ.peek().blockBit = true;
//blocked jobs can't run on CPU, so reschedule
scheduler.reschedule();
runningJob = scheduler.readyQ.peek();
//if the running job is blocked and latched, the CPU is idle
if (runningJob.blockBit && runningJob.latchBit)
a[0] = 1;
//else resume job to run
else{
a[0] = 2;
p[2] = runningJob.location;
p[3] = runningJob.size;
p[4] = runningJob.timeSlice;
}
break;
}
return;
}
} | [
"hejiayi@live.com"
] | hejiayi@live.com |
1ac65a73f1e673a0813397bfb3bd29451bdba239 | cf0f8f9b8c7f0eeef62b81ff1f4c883a7905e8a1 | /src/com/kaylerrenslow/armaDialogCreator/control/DefaultValueProvider.java | 4f8ed3b45d97bc8bd354f68e7ac67eee2327f368 | [
"MIT"
] | permissive | pikaxo/arma-dialog-creator | 5fc21f06110501e24b8ac55f51c74202c8b97e05 | 5ff118a0661c7878a44ebe20ad35fb9594b083ad | refs/heads/master | 2020-03-28T19:54:42.052608 | 2017-06-17T05:03:30 | 2017-06-17T05:03:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package com.kaylerrenslow.armaDialogCreator.control;
import com.kaylerrenslow.armaDialogCreator.control.sv.SerializableValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
Get {@link SerializableValue} instances from storage or create them dynamically.
@author Kayler
@since 11/22/2016 */
public interface DefaultValueProvider {
/**
Get a default value for the given property lookup
@param lookup lookup
*/
@Nullable SerializableValue getDefaultValue(@NotNull ControlPropertyLookupConstant lookup);
/**
Tells the provider that the given properties will be needed for a series of {@link #getDefaultValue(ControlPropertyLookupConstant)} calls. This will not be called before
{@link #getDefaultValue(ControlPropertyLookupConstant)}
@param tofetch list to fetch that are being requested.
*/
void prefetchValues(@NotNull List<ControlPropertyLookupConstant> tofetch);
}
| [
"kaylerrenslow@gmail.com"
] | kaylerrenslow@gmail.com |
dd11d2e0b91497ea2db273cafe1e37551970a221 | ce5f34dd41dc2034d832bdc6e2438da9eaba9d4b | /src/main/java/cn/test07/controller/SeckillController.java | e00b79487ae3992ec00d5398527dee24e229086f | [] | no_license | wdlsjdl/cn.test07 | e45c233bedaab843851c4efcb390c3046426f61a | 886e8f6443422c394a270dc8cc5dd89e10f264e4 | refs/heads/master | 2021-01-19T22:41:02.996088 | 2017-04-20T08:45:10 | 2017-04-20T08:45:10 | 88,842,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,828 | java | package cn.test07.controller;
import cn.test07.dto.Exposer;
import cn.test07.dto.SeckillExecution;
import cn.test07.dto.SeckillResult;
import cn.test07.exception.RepeatkillException;
import cn.test07.exception.SeckillCloseException;
import cn.test07.exception.SeckillException;
import cn.test07.po.Seckill;
import cn.test07.po.SeckillStateEnum;
import cn.test07.service.SeckillService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* Created by VNT on 2017/4/19.
*/
@Controller
@RequestMapping("/seckill")
public class SeckillController {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private SeckillService seckillService;
@RequestMapping(value = "/list" , method = RequestMethod.GET)
public String list(Model model){
List<Seckill> list = seckillService.getSeckillList();
model.addAttribute("list", list);
return "list";
}
@RequestMapping(value = "/{seckillId}/detail" , method = RequestMethod.GET)
public String detail(@PathVariable("seckillId") Long seckillId,Model model){
if(seckillId==null)
return "redirect:/seckill/list";
Seckill seckill = seckillService.getById(seckillId);
if(seckill==null)
return "forward:/seckill/list";
model.addAttribute("seckill", seckill);
return "detail";
}
@RequestMapping(value = "/{seckillId}/exposer",method = RequestMethod.POST,produces = {"application/json; charset=utf-8"})
@ResponseBody
public SeckillResult<Exposer> exposer(@PathVariable("seckillId") Long seckillId){
SeckillResult<Exposer> result;
try {
Exposer exposer = seckillService.exportSeckillUrl(seckillId);
result = new SeckillResult<Exposer>(true, exposer);
} catch (Exception e) {
logger.error(e.getMessage(), e);
result = new SeckillResult<Exposer>(false, e.getMessage());
}
return result;
}
@RequestMapping(value = "/{seckillId}/{md5}/execution",method = RequestMethod.POST,produces = {"application/json; charset=utf-8"})
@ResponseBody
public SeckillResult<SeckillExecution> execute(@PathVariable("seckillId") Long seckillId, @PathVariable("md5") String md5, @CookieValue(value = "killPhone",required = false) Long phone){
if(phone==null)
return new SeckillResult<SeckillExecution>(false, "未注册");
SeckillExecution seckillExecution = null;
try {
seckillExecution = seckillService.executeSeckill(seckillId, phone, md5);
return new SeckillResult<SeckillExecution>(true, seckillExecution);
} catch (RepeatkillException e) {
seckillExecution = new SeckillExecution(seckillId, SeckillStateEnum.REPEAT_KILL);
return new SeckillResult<SeckillExecution>(true,seckillExecution);
}catch (SeckillCloseException e){
seckillExecution = new SeckillExecution(seckillId, SeckillStateEnum.END);
return new SeckillResult<SeckillExecution>(true,seckillExecution);
}catch (SeckillException e){
logger.error(e.getMessage(),e);
seckillExecution = new SeckillExecution(seckillId, SeckillStateEnum.INNER_ERROR);
return new SeckillResult<SeckillExecution>(true, seckillExecution);
}
}
@RequestMapping(value = "/time/now",method = RequestMethod.GET)
@ResponseBody
public SeckillResult<Long> time(){
Date now = new Date();
return new SeckillResult<Long>(true,now.getTime());
}
}
| [
"420923889@qq.com"
] | 420923889@qq.com |
e2388e257179ca40b41c60840a27da1c68e1b7b3 | 8fd2c2998888c28ccd54ee4d745bedda509b6e9c | /src/main/java/app/common/validation/Constraint.java | d2fdae36741c615b20a6921df5a8e542573c6bc6 | [
"MIT"
] | permissive | project-templates/payara-application | 301df8750513061ab97b02cb05243a982cf80a38 | b2becb437c57b322b62ca9e820152208c3f6a1d6 | refs/heads/master | 2021-06-09T08:12:07.628270 | 2016-12-08T14:34:12 | 2016-12-08T14:34:12 | 73,614,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 135 | java | package app.common.validation;
public interface Constraint {
boolean validate(String text);
String getErrorMessage();
}
| [
"tomcat.port.8080+github@gmail.com"
] | tomcat.port.8080+github@gmail.com |
9b772122fd1d9c3ce3947fd7d5f71f0faf5140be | 50587d0e85e68f9bbc9ce82e407bab21775d165e | /myshoes/src/myshoes/domain/Notice.java | e67295fad63e5bc63c30c7abe82fcf099c2ad1d4 | [] | no_license | Lizhiming001/-javaweb | 388afd8959a0661ff7a0e19af42c794c2a970fc2 | 0c5df7e19fa36251be59697986af01f90715b2e5 | refs/heads/master | 2020-11-24T06:42:30.693213 | 2019-12-14T12:39:39 | 2019-12-14T12:39:39 | 228,013,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package myshoes.domain;
public class Notice {
private int n_id;
private String title;
private String details;
private String n_time;
public String getN_time() {
return n_time;
}
public void setN_time(String n_time) {
this.n_time = n_time;
}
public int getN_id() {
return n_id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public void setN_id(int n_id) {
this.n_id = n_id;
}
public String getDetails() {
return details;
}
public void setDetails(String details) {
this.details = details;
}
}
| [
"312740338@qq.com"
] | 312740338@qq.com |
5f0064dc796bcaa734d0962bd90b9d3f682c734c | ebb00685bf845d10123a761fb587ed39731f7510 | /app/src/main/java/com/samourai/wallet/payload/PayloadUtil.java | 8278169180269b585da7ef19fa153c8eb720bdec | [
"Unlicense"
] | permissive | eMaringolo/samourai-wallet-android | 4e73c24bec4670ff2fdba6fddbc03979c537e122 | 68faeb29de88df0db3c9a27b28c3774a62b63f27 | refs/heads/develop | 2021-04-29T16:45:13.606071 | 2018-02-14T14:32:42 | 2018-02-14T14:32:42 | 120,467,326 | 0 | 0 | null | 2018-02-06T18:28:41 | 2018-02-06T14:12:02 | Java | UTF-8 | Java | false | false | 32,011 | java | package com.samourai.wallet.payload;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.widget.Toast;
//import android.util.Log;
import com.samourai.wallet.R;
import com.samourai.wallet.SamouraiWallet;
import com.samourai.wallet.SendActivity;
import com.samourai.wallet.access.AccessFactory;
import com.samourai.wallet.api.APIFactory;
import com.samourai.wallet.bip47.BIP47Meta;
import com.samourai.wallet.bip47.BIP47Util;
import com.samourai.wallet.crypto.AESUtil;
import com.samourai.wallet.crypto.DecryptionException;
import com.samourai.wallet.hd.HD_Account;
import com.samourai.wallet.hd.HD_Wallet;
import com.samourai.wallet.hd.HD_WalletFactory;
import com.samourai.wallet.ricochet.RicochetMeta;
import com.samourai.wallet.segwit.BIP49Util;
import com.samourai.wallet.send.BlockedUTXO;
import com.samourai.wallet.util.AddressFactory;
import com.samourai.wallet.util.BatchSendUtil;
import com.samourai.wallet.util.CharSequenceX;
import com.samourai.wallet.util.PrefsUtil;
import com.samourai.wallet.send.RBFUtil;
import com.samourai.wallet.util.SIMUtil;
import com.samourai.wallet.util.SendAddressUtil;
import com.samourai.wallet.JSONRPC.TrustedNodeUtil;
import com.samourai.wallet.util.TorUtil;
import com.samourai.wallet.util.WebUtil;
import org.apache.commons.codec.DecoderException;
import org.bitcoinj.core.AddressFormatException;
import org.bitcoinj.core.NetworkParameters;
import org.bitcoinj.crypto.MnemonicException;
import org.bitcoinj.params.MainNetParams;
import org.bitcoinj.params.TestNet3Params;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.RandomAccessFile;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.security.SecureRandom;
public class PayloadUtil {
private final static String dataDir = "wallet";
private final static String strFilename = "samourai.dat";
private final static String strTmpFilename = "samourai.tmp";
private final static String strBackupFilename = "samourai.sav";
private final static String strOptionalBackupDir = "/samourai";
private final static String strOptionalFilename = "samourai.txt";
private static Context context = null;
private static PayloadUtil instance = null;
private PayloadUtil() { ; }
public static PayloadUtil getInstance(Context ctx) {
context = ctx;
if (instance == null) {
instance = new PayloadUtil();
}
return instance;
}
public File getBackupFile() {
String directory = Environment.DIRECTORY_DOCUMENTS;
File dir = Environment.getExternalStoragePublicDirectory(directory + strOptionalBackupDir);
File file = new File(dir, strOptionalFilename);
return file;
}
public JSONObject putPayload(String data, boolean external) {
JSONObject obj = new JSONObject();
try {
obj.put("version", 1);
obj.put("payload", data);
obj.put("external", external);
}
catch(JSONException je) {
return null;
}
return obj;
}
public boolean hasPayload(Context ctx) {
File dir = ctx.getDir(dataDir, Context.MODE_PRIVATE);
File file = new File(dir, strFilename);
if(file.exists()) {
return true;
}
return false;
}
public synchronized void wipe() throws IOException {
BIP47Util.getInstance(context).reset();
BIP47Meta.getInstance().clear();
BIP49Util.getInstance(context).reset();
APIFactory.getInstance(context).reset();
try {
int nbAccounts = HD_WalletFactory.getInstance(context).get().getAccounts().size();
for(int i = 0; i < nbAccounts; i++) {
HD_WalletFactory.getInstance(context).get().getAccount(i).getReceive().setAddrIdx(0);
HD_WalletFactory.getInstance(context).get().getAccount(i).getChange().setAddrIdx(0);
AddressFactory.getInstance().setHighestTxReceiveIdx(i, 0);
AddressFactory.getInstance().setHighestTxChangeIdx(i, 0);
}
HD_WalletFactory.getInstance(context).set(null);
}
catch(MnemonicException.MnemonicLengthException mle) {
mle.printStackTrace();
}
HD_WalletFactory.getInstance(context).clear();
File dir = context.getDir(dataDir, Context.MODE_PRIVATE);
File datfile = new File(dir, strFilename);
File tmpfile = new File(dir, strTmpFilename);
if(tmpfile.exists()) {
secureDelete(tmpfile);
}
if(datfile.exists()) {
secureDelete(datfile);
try {
serialize(new JSONObject("{}"), new CharSequenceX(""));
}
catch(JSONException je) {
je.printStackTrace();
}
catch(Exception e) {
e.printStackTrace();
}
}
}
public JSONObject getPayload() {
try {
JSONObject wallet = new JSONObject();
wallet.put("testnet", SamouraiWallet.getInstance().isTestNet() ? true : false);
if(HD_WalletFactory.getInstance(context).get().getSeedHex() != null) {
wallet.put("seed", HD_WalletFactory.getInstance(context).get().getSeedHex());
wallet.put("passphrase", HD_WalletFactory.getInstance(context).get().getPassphrase());
// obj.put("mnemonic", getMnemonic());
}
JSONArray accts = new JSONArray();
for(HD_Account acct : HD_WalletFactory.getInstance(context).get().getAccounts()) {
accts.put(acct.toJSON(false));
}
wallet.put("accounts", accts);
//
// export BIP47 payment code for debug payload
//
try {
wallet.put("payment_code", BIP47Util.getInstance(context).getPaymentCode().toString());
}
catch(AddressFormatException afe) {
;
}
//
// export BIP49 account for debug payload
//
JSONArray bip49_account = new JSONArray();
bip49_account.put(BIP49Util.getInstance(context).getWallet().getAccount(0).toJSON(true));
wallet.put("bip49_accounts", bip49_account);
//
// can remove ???
//
/*
obj.put("receiveIdx", mAccounts.get(0).getReceive().getAddrIdx());
obj.put("changeIdx", mAccounts.get(0).getChange().getAddrIdx());
*/
JSONObject meta = new JSONObject();
meta.put("version_name", context.getText(R.string.version_name));
meta.put("android_release", Build.VERSION.RELEASE == null ? "" : Build.VERSION.RELEASE);
meta.put("device_manufacturer", Build.MANUFACTURER == null ? "" : Build.MANUFACTURER);
meta.put("device_model", Build.MODEL == null ? "" : Build.MODEL);
meta.put("device_product", Build.PRODUCT == null ? "" : Build.PRODUCT);
meta.put("prev_balance", APIFactory.getInstance(context).getXpubBalance());
meta.put("sent_tos", SendAddressUtil.getInstance().toJSON());
meta.put("batch_send", BatchSendUtil.getInstance().toJSON());
meta.put("use_segwit", PrefsUtil.getInstance(context).getValue(PrefsUtil.USE_SEGWIT, true));
meta.put("use_like_typed_change", PrefsUtil.getInstance(context).getValue(PrefsUtil.USE_LIKE_TYPED_CHANGE, true));
meta.put("spend_type", PrefsUtil.getInstance(context).getValue(PrefsUtil.SPEND_TYPE, SendActivity.SPEND_BIP126));
meta.put("use_bip126", PrefsUtil.getInstance(context).getValue(PrefsUtil.USE_BIP126, true));
meta.put("rbf_opt_in", PrefsUtil.getInstance(context).getValue(PrefsUtil.RBF_OPT_IN, false));
meta.put("bip47", BIP47Meta.getInstance().toJSON());
meta.put("pin", AccessFactory.getInstance().getPIN());
meta.put("pin2", AccessFactory.getInstance().getPIN2());
meta.put("ricochet", RicochetMeta.getInstance(context).toJSON());
meta.put("trusted_node", TrustedNodeUtil.getInstance().toJSON());
meta.put("rbfs", RBFUtil.getInstance().toJSON());
meta.put("tor", TorUtil.getInstance(context).toJSON());
meta.put("blocked_utxos", BlockedUTXO.getInstance().toJSON());
meta.put("explorer", PrefsUtil.getInstance(context).getValue(PrefsUtil.BLOCK_EXPLORER, 0));
meta.put("trusted_no", PrefsUtil.getInstance(context).getValue(PrefsUtil.ALERT_MOBILE_NO, ""));
meta.put("scramble_pin", PrefsUtil.getInstance(context).getValue(PrefsUtil.SCRAMBLE_PIN, false));
meta.put("haptic_pin", PrefsUtil.getInstance(context).getValue(PrefsUtil.HAPTIC_PIN, true));
meta.put("auto_backup", PrefsUtil.getInstance(context).getValue(PrefsUtil.AUTO_BACKUP, true));
meta.put("remote", PrefsUtil.getInstance(context).getValue(PrefsUtil.ACCEPT_REMOTE, false));
meta.put("use_trusted", PrefsUtil.getInstance(context).getValue(PrefsUtil.TRUSTED_LOCK, false));
meta.put("check_sim", PrefsUtil.getInstance(context).getValue(PrefsUtil.CHECK_SIM, false));
meta.put("fiat", PrefsUtil.getInstance(context).getValue(PrefsUtil.CURRENT_FIAT, "USD"));
meta.put("fiat_sel", PrefsUtil.getInstance(context).getValue(PrefsUtil.CURRENT_FIAT_SEL, 0));
meta.put("fx", PrefsUtil.getInstance(context).getValue(PrefsUtil.CURRENT_EXCHANGE, "LocalBitcoins.com"));
meta.put("fx_sel", PrefsUtil.getInstance(context).getValue(PrefsUtil.CURRENT_EXCHANGE_SEL, 0));
meta.put("use_trusted_node", PrefsUtil.getInstance(context).getValue(PrefsUtil.USE_TRUSTED_NODE, false));
meta.put("fee_provider_sel", PrefsUtil.getInstance(context).getValue(PrefsUtil.FEE_PROVIDER_SEL, 0));
meta.put("broadcast_tx", PrefsUtil.getInstance(context).getValue(PrefsUtil.BROADCAST_TX, true));
// meta.put("xpubreg44", PrefsUtil.getInstance(context).getValue(PrefsUtil.XPUB44REG, false));
meta.put("xpubreg49", PrefsUtil.getInstance(context).getValue(PrefsUtil.XPUB49REG, false));
meta.put("paynym_claimed", PrefsUtil.getInstance(context).getValue(PrefsUtil.PAYNYM_CLAIMED, false));
meta.put("paynym_refused", PrefsUtil.getInstance(context).getValue(PrefsUtil.PAYNYM_REFUSED, false));
JSONObject obj = new JSONObject();
obj.put("wallet", wallet);
obj.put("meta", meta);
return obj;
}
catch(JSONException ex) {
throw new RuntimeException(ex);
}
catch(IOException ioe) {
throw new RuntimeException(ioe);
}
catch(MnemonicException.MnemonicLengthException mle) {
throw new RuntimeException(mle);
}
}
public synchronized void saveWalletToJSON(CharSequenceX password) throws MnemonicException.MnemonicLengthException, IOException, JSONException, DecryptionException, UnsupportedEncodingException {
// Log.i("PayloadUtil", get().toJSON().toString());
// save payload
serialize(getPayload(), password);
// save optional external storage backup
// encrypted using passphrase; cannot be used for restored wallets that do not use a passphrase
if(SamouraiWallet.getInstance().hasPassphrase(context) && isExternalStorageWritable() && PrefsUtil.getInstance(context).getValue(PrefsUtil.AUTO_BACKUP, true) && HD_WalletFactory.getInstance(context).get() != null) {
final String passphrase = HD_WalletFactory.getInstance(context).get().getPassphrase();
String encrypted = null;
try {
encrypted = AESUtil.encrypt(getPayload().toString(), new CharSequenceX(passphrase), AESUtil.DefaultPBKDF2Iterations);
serialize(encrypted);
}
catch (Exception e) {
// Toast.makeText(context, e.getMessage(), Toast.LENGTH_SHORT).show();
}
finally {
if (encrypted == null) {
// Toast.makeText(context, R.string.encryption_error, Toast.LENGTH_SHORT).show();
return;
}
}
}
}
public synchronized HD_Wallet restoreWalletfromJSON(JSONObject obj) throws DecoderException, MnemonicException.MnemonicLengthException {
// Log.i("PayloadUtil", obj.toString());
HD_Wallet hdw = null;
NetworkParameters params = SamouraiWallet.getInstance().getCurrentNetworkParams();
JSONObject wallet = null;
JSONObject meta = null;
try {
if(obj.has("wallet")) {
wallet = obj.getJSONObject("wallet");
}
else {
wallet = obj;
}
if(obj.has("meta")) {
meta = obj.getJSONObject("meta");
}
else {
meta = obj;
}
}
catch(JSONException je) {
;
}
try {
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
// Log.i("PayloadUtil", obj.toString());
if(wallet != null) {
if(wallet.has("testnet")) {
SamouraiWallet.getInstance().setCurrentNetworkParams(wallet.getBoolean("testnet") ? TestNet3Params.get() : MainNetParams.get());
PrefsUtil.getInstance(context).setValue(PrefsUtil.TESTNET, wallet.getBoolean("testnet"));
}
else {
SamouraiWallet.getInstance().setCurrentNetworkParams(MainNetParams.get());
PrefsUtil.getInstance(context).removeValue(PrefsUtil.TESTNET);
}
hdw = new HD_Wallet(context, 44, wallet, params);
hdw.getAccount(SamouraiWallet.SAMOURAI_ACCOUNT).getReceive().setAddrIdx(wallet.has("receiveIdx") ? wallet.getInt("receiveIdx") : 0);
hdw.getAccount(SamouraiWallet.SAMOURAI_ACCOUNT).getChange().setAddrIdx(wallet.has("changeIdx") ? wallet.getInt("changeIdx") : 0);
if(wallet.has("accounts")) {
JSONArray accounts = wallet.getJSONArray("accounts");
//
// temporarily set to 2 until use of public XPUB
//
for(int i = 0; i < 2; i++) {
JSONObject account = accounts.getJSONObject(i);
hdw.getAccount(i).getReceive().setAddrIdx(account.has("receiveIdx") ? account.getInt("receiveIdx") : 0);
hdw.getAccount(i).getChange().setAddrIdx(account.has("changeIdx") ? account.getInt("changeIdx") : 0);
AddressFactory.getInstance().account2xpub().put(i, hdw.getAccount(i).xpubstr());
AddressFactory.getInstance().xpub2account().put(hdw.getAccount(i).xpubstr(), i);
}
}
}
if(meta != null) {
if(meta.has("prev_balance")) {
APIFactory.getInstance(context).setXpubBalance(meta.getLong("prev_balance"));
}
if(meta.has("use_segwit")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.USE_SEGWIT, meta.getBoolean("use_segwit"));
editor.putBoolean("segwit", meta.getBoolean("use_segwit"));
editor.commit();
}
if(meta.has("use_like_typed_change")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.USE_LIKE_TYPED_CHANGE, meta.getBoolean("use_like_typed_change"));
editor.putBoolean("likeTypedChange", meta.getBoolean("use_like_typed_change"));
editor.commit();
}
if(meta.has("spend_type")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.SPEND_TYPE, meta.getInt("spend_type"));
editor.putBoolean("bip126", meta.getInt("spend_type") == SendActivity.SPEND_BIP126 ? true : false);
editor.commit();
}
if(meta.has("use_bip126")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.USE_BIP126, meta.getBoolean("use_bip126"));
editor.putBoolean("bip126", meta.getBoolean("use_bip126"));
editor.commit();
}
if(meta.has("rbf_opt_in")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.RBF_OPT_IN, meta.getBoolean("rbf_opt_in"));
editor.putBoolean("rbf", meta.getBoolean("rbf_opt_in") ? true : false);
editor.commit();
}
if(meta.has("sent_tos")) {
SendAddressUtil.getInstance().fromJSON((JSONArray) meta.get("sent_tos"));
}
if(meta.has("batch_send")) {
BatchSendUtil.getInstance().fromJSON((JSONArray) meta.get("batch_send"));
}
if(meta.has("bip47")) {
try {
BIP47Meta.getInstance().fromJSON((JSONObject) meta.get("bip47"));
}
catch(ClassCastException cce) {
JSONArray _array = (JSONArray) meta.get("bip47");
JSONObject _obj = new JSONObject();
_obj.put("pcodes", _array);
BIP47Meta.getInstance().fromJSON(_obj);
}
}
if(meta.has("pin")) {
AccessFactory.getInstance().setPIN((String) meta.get("pin"));
}
if(meta.has("pin2")) {
AccessFactory.getInstance().setPIN2((String) meta.get("pin2"));
}
if(meta.has("ricochet")) {
RicochetMeta.getInstance(context).fromJSON((JSONObject) meta.get("ricochet"));
}
if(meta.has("trusted_node")) {
TrustedNodeUtil.getInstance().fromJSON((JSONObject) meta.get("trusted_node"));
}
if(meta.has("rbfs")) {
RBFUtil.getInstance().fromJSON((JSONArray) meta.get("rbfs"));
}
if(meta.has("tor")) {
TorUtil.getInstance(context).fromJSON((JSONObject) meta.get("tor"));
}
if(meta.has("blocked_utxos")) {
BlockedUTXO.getInstance().fromJSON((JSONObject) meta.get("blocked_utxos"));
}
if(meta.has("explorer")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.BLOCK_EXPLORER, meta.getInt("explorer"));
}
if(meta.has("trusted_no")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.ALERT_MOBILE_NO, (String) meta.get("trusted_no"));
editor.putString("alertSMSNo", meta.getString("trusted_no"));
editor.commit();
}
if(meta.has("scramble_pin")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.SCRAMBLE_PIN, meta.getBoolean("scramble_pin"));
editor.putBoolean("scramblePin", meta.getBoolean("scramble_pin"));
editor.commit();
}
if(meta.has("haptic_pin")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.HAPTIC_PIN, meta.getBoolean("haptic_pin"));
editor.putBoolean("haptic", meta.getBoolean("haptic_pin"));
editor.commit();
}
if(meta.has("auto_backup")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.AUTO_BACKUP, meta.getBoolean("auto_backup"));
editor.putBoolean("auto_backup", meta.getBoolean("auto_backup"));
editor.commit();
}
if(meta.has("remote")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.ACCEPT_REMOTE, meta.getBoolean("remote"));
editor.putBoolean("stealthRemote", meta.getBoolean("remote"));
editor.commit();
}
if(meta.has("use_trusted")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.TRUSTED_LOCK, meta.getBoolean("use_trusted"));
editor.putBoolean("trustedLock", meta.getBoolean("use_trusted"));
editor.commit();
}
if(meta.has("check_sim")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.CHECK_SIM, meta.getBoolean("check_sim"));
editor.putBoolean("sim_switch", meta.getBoolean("check_sim"));
editor.commit();
if(meta.getBoolean("check_sim")) {
SIMUtil.getInstance(context).setStoredSIM();
}
}
if (meta.has("fiat")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.CURRENT_FIAT, (String)meta.get("fiat"));
}
if (meta.has("fiat_sel")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.CURRENT_FIAT_SEL, meta.getInt("fiat_sel"));
}
if (meta.has("fx")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.CURRENT_EXCHANGE, (String)meta.get("fx"));
}
if(meta.has("fx_sel")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.CURRENT_EXCHANGE_SEL, meta.getInt("fx_sel"));
}
if(meta.has("use_trusted_node")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.USE_TRUSTED_NODE, meta.getBoolean("use_trusted_node"));
}
if(meta.has("fee_provider_sel")) {
// PrefsUtil.getInstance(context).setValue(PrefsUtil.FEE_PROVIDER_SEL, meta.getInt("fee_provider_sel") > 0 ? 0 : meta.getInt("fee_provider_sel"));
PrefsUtil.getInstance(context).setValue(PrefsUtil.FEE_PROVIDER_SEL, 0);
}
if(meta.has("broadcast_tx")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.BROADCAST_TX, meta.getBoolean("broadcast_tx"));
}
/*
if(meta.has("xpubreg44")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.XPUB44REG, meta.getBoolean("xpubreg44"));
}
*/
if(meta.has("xpubreg49")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.XPUB49REG, meta.getBoolean("xpubreg49"));
}
if(meta.has("paynym_claimed")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.PAYNYM_CLAIMED, meta.getBoolean("paynym_claimed"));
}
if(meta.has("paynym_refused")) {
PrefsUtil.getInstance(context).setValue(PrefsUtil.PAYNYM_REFUSED, meta.getBoolean("paynym_refused"));
}
/*
if(obj.has("passphrase")) {
Log.i("PayloadUtil", (String)obj.get("passphrase"));
Toast.makeText(context, "'" + (String)obj.get("passphrase") + "'", Toast.LENGTH_SHORT).show();
}
Toast.makeText(context, "'" + hdw.getPassphrase() + "'", Toast.LENGTH_SHORT).show();
*/
}
}
catch(IOException ioe) {
ioe.printStackTrace();
}
catch(JSONException je) {
je.printStackTrace();
}
HD_WalletFactory.getInstance(context).getWallets().clear();
HD_WalletFactory.getInstance(context).getWallets().add(hdw);
return hdw;
}
public synchronized HD_Wallet restoreWalletfromJSON(CharSequenceX password) throws DecoderException, MnemonicException.MnemonicLengthException {
JSONObject obj = null;
try {
obj = deserialize(password, false);
}
catch(IOException ioe) {
ioe.printStackTrace();
}
catch(JSONException je0) {
try {
obj = deserialize(password, true);
}
catch(IOException ioe) {
ioe.printStackTrace();
}
catch(JSONException je1) {
je1.printStackTrace();
}
}
return restoreWalletfromJSON(obj);
}
public synchronized boolean walletFileExists() {
File dir = context.getDir(dataDir, Context.MODE_PRIVATE);
File walletfile = new File(dir, strFilename);
return walletfile.exists();
}
private synchronized void serialize(JSONObject jsonobj, CharSequenceX password) throws IOException, JSONException, DecryptionException, UnsupportedEncodingException {
File dir = context.getDir(dataDir, Context.MODE_PRIVATE);
File newfile = new File(dir, strFilename);
File tmpfile = new File(dir, strTmpFilename);
File bakfile = new File(dir, strBackupFilename);
newfile.setWritable(true, true);
tmpfile.setWritable(true, true);
bakfile.setWritable(true, true);
// prepare tmp file.
if(tmpfile.exists()) {
tmpfile.delete();
// secureDelete(tmpfile);
}
String data = null;
String jsonstr = jsonobj.toString(4);
if(password != null) {
data = AESUtil.encrypt(jsonstr, password, AESUtil.DefaultPBKDF2Iterations);
}
else {
data = jsonstr;
}
JSONObject jsonObj = putPayload(data, false);
if(jsonObj != null) {
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmpfile), "UTF-8"));
try {
out.write(jsonObj.toString());
} finally {
out.close();
}
copy(tmpfile, newfile);
copy(tmpfile, bakfile);
// secureDelete(tmpfile);
}
//
// test payload
//
}
private synchronized JSONObject deserialize(CharSequenceX password, boolean useBackup) throws IOException, JSONException {
File dir = context.getDir(dataDir, Context.MODE_PRIVATE);
File file = new File(dir, useBackup ? strBackupFilename : strFilename);
// Log.i("PayloadUtil", "wallet file exists: " + file.exists());
StringBuilder sb = new StringBuilder();
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8"));
String str = null;
while((str = in.readLine()) != null) {
sb.append(str);
}
in.close();
JSONObject jsonObj = null;
try {
jsonObj = new JSONObject(sb.toString());
}
catch(JSONException je) {
;
}
String payload = null;
if(jsonObj != null && jsonObj.has("payload")) {
payload = jsonObj.getString("payload");
}
// not a json stream, assume v0
if(payload == null) {
payload = sb.toString();
}
JSONObject node = null;
if(password == null) {
node = new JSONObject(payload);
}
else {
String decrypted = null;
try {
decrypted = AESUtil.decrypt(payload, password, AESUtil.DefaultPBKDF2Iterations);
}
catch(Exception e) {
return null;
}
if(decrypted == null) {
return null;
}
node = new JSONObject(decrypted);
}
return node;
}
private synchronized void secureDelete(File file) throws IOException {
if (file.exists()) {
long length = file.length();
SecureRandom random = new SecureRandom();
RandomAccessFile raf = new RandomAccessFile(file, "rws");
for(int i = 0; i < 5; i++) {
raf.seek(0);
raf.getFilePointer();
byte[] data = new byte[64];
int pos = 0;
while (pos < length) {
random.nextBytes(data);
raf.write(data);
pos += data.length;
}
}
raf.close();
file.delete();
}
}
public synchronized void copy(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
try {
OutputStream out = new FileOutputStream(dst);
try {
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
} finally {
out.close();
}
} finally {
in.close();
}
}
private boolean isExternalStorageWritable() {
String state = Environment.getExternalStorageState();
if(Environment.MEDIA_MOUNTED.equals(state)) {
return true;
}
return false;
}
private synchronized void serialize(String data) throws IOException {
String directory = Environment.DIRECTORY_DOCUMENTS;
File dir = Environment.getExternalStoragePublicDirectory(directory + "/samourai");
if(!dir.exists()) {
dir.mkdirs();
dir.setWritable(true, true);
dir.setReadable(true, true);
}
File newfile = new File(dir, "samourai.txt");
newfile.setWritable(true, true);
newfile.setReadable(true, true);
JSONObject jsonObj = putPayload(data, false);
if(jsonObj != null) {
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newfile), "UTF-8"));
try {
out.write(jsonObj.toString());
} finally {
out.close();
}
}
//
// test payload
//
}
public String getDecryptedBackupPayload(String data, CharSequenceX password) {
String encrypted = null;
try {
JSONObject jsonObj = new JSONObject(data);
if(jsonObj != null && jsonObj.has("payload")) {
encrypted = jsonObj.getString("payload");
}
else {
encrypted = data;
}
}
catch(JSONException je) {
encrypted = data;
}
String decrypted = null;
try {
decrypted = AESUtil.decrypt(encrypted, password, AESUtil.DefaultPBKDF2Iterations);
}
catch (Exception e) {
Toast.makeText(context, R.string.decryption_error, Toast.LENGTH_SHORT).show();
}
finally {
if (decrypted == null || decrypted.length() < 1) {
Toast.makeText(context, R.string.decryption_error, Toast.LENGTH_SHORT).show();
// AppUtil.getInstance(context).restartApp();
}
}
return decrypted;
}
}
| [
"dev@samouraiwallet.com"
] | dev@samouraiwallet.com |
216b59ac7729e253cfe40683139b06457116ecf9 | f95ae56d5828c6d91729ca7dbe637986afaed579 | /src/main/java/org/xcoderelease/parser/JSONFlattener.java | cc5d7d41c9947df33e4f6bf8019110e16b913a0b | [] | no_license | ykhandelwal913/checkXodeRelease | c540677c24a8b89db9d1ee07a152cceaa6ad35bb | d1cab86645f36e031c0a682019696a21c8d2a542 | refs/heads/master | 2023-04-16T12:10:44.766107 | 2020-09-17T19:50:17 | 2020-09-17T19:50:17 | 282,170,906 | 0 | 0 | null | 2021-04-26T20:31:24 | 2020-07-24T08:53:27 | Java | UTF-8 | Java | false | false | 7,656 | java | /*
* Copyright 2012-2014 Dristhi software
* Copyright 2015 Arkni Brahim
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.xcoderelease.parser;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class JSONFlattener {
/**
* The JSONObject type
*/
private static final Class<?> JSON_OBJECT = JSONObject.class;
/**
* The JSONArray type
*/
private static final Class<?> JSON_ARRAY = JSONArray.class;
/**
* The class Logger
*/
private static final Logger LOGGER = Logger.getLogger(JSONFlattener.class);
/**
* Parse the JSON content at the given URI using the default
* character encoding UTF-8
*
* @param uri
* @return
*/
public static List<Map<String, String>> parseJson(URI uri) {
return parseJson(uri, "UTF-8");
}
/**
* Parse the JSON content at the given URI using the specified
* character encoding
*
* @param uri
* @return
*/
public static List<Map<String, String>> parseJson(URI uri, String encoding) {
List<Map<String, String>> flatJson = null;
String json = "";
try {
json = IOUtils.toString(uri, encoding);
flatJson = parseJson(json);
} catch (IOException e) {
LOGGER.error("JsonFlattener#ParseJson(uri, encoding) IOException: ", e);
} catch (Exception ex) {
LOGGER.error("JsonFlattener#ParseJson(uri, encoding) Exception: ", ex);
}
return flatJson;
}
/**
* Parse the JSON file using the default character encoding UTF-8
*
* @param file
* @return
*/
public static List<Map<String, String>> parseJson(File file) {
return parseJson(file, "UTF-8");
}
/**
* Parse the JSON file using the specified character encoding
*
* @param file
* @return
*/
public static List<Map<String, String>> parseJson(File file, String encoding) {
List<Map<String, String>> flatJson = null;
String json = "";
try {
json = FileUtils.readFileToString(file, encoding);
flatJson = parseJson(json);
} catch (IOException e) {
LOGGER.error("JsonFlattener#ParseJson(file, encoding) IOException: ", e);
} catch (Exception ex) {
LOGGER.error("JsonFlattener#ParseJson(file, encoding) Exception: ", ex);
}
return flatJson;
}
/**
* Parse the JSON String
*
* @param json
* @return
* @throws Exception
*/
public static List<Map<String, String>> parseJson(String json) {
List<Map<String, String>> flatJson = null;
try {
JSONObject jsonObject = new JSONObject(json);
flatJson = new ArrayList<Map<String, String>>();
flatJson.add(parse(jsonObject));
} catch (JSONException je) {
LOGGER.info("Handle the JSON String as JSON Array");
flatJson = handleAsArray(json);
}
return flatJson;
}
/**
* Parse a JSON Object
*
* @param jsonObject
* @return
*/
public static Map<String, String> parse(JSONObject jsonObject) {
Map<String, String> flatJson = new LinkedHashMap<String, String>();
flatten(jsonObject, flatJson, "");
return flatJson;
}
/**
* Parse a JSON Array
*
* @param jsonArray
* @return
*/
public static List<Map<String, String>> parse(JSONArray jsonArray) {
JSONObject jsonObject = null;
List<Map<String, String>> flatJson = new ArrayList<Map<String, String>>();
int length = jsonArray.length();
for (int i = 0; i < length; i++) {
jsonObject = jsonArray.getJSONObject(i);
Map<String, String> stringMap = parse(jsonObject);
flatJson.add(stringMap);
}
return flatJson;
}
/**
* Handle the JSON String as Array
*
* @param json
* @return
* @throws Exception
*/
private static List<Map<String, String>> handleAsArray(String json) {
List<Map<String, String>> flatJson = null;
try {
JSONArray jsonArray = new JSONArray(json);
flatJson = parse(jsonArray);
} catch (Exception e) {
// throw new Exception("Json might be malformed");
LOGGER.error("JSON might be malformed, Please verify that your JSON is valid");
}
return flatJson;
}
/**
* Flatten the given JSON Object
*
* This method will convert the JSON object to a Map of
* String keys and values
*
* @param obj
* @param flatJson
* @param prefix
*/
private static void flatten(JSONObject obj, Map<String, String> flatJson, String prefix) {
Iterator<?> iterator = obj.keys();
String _prefix = prefix != "" ? prefix + "." : "";
while (iterator.hasNext()) {
String key = iterator.next().toString();
if (obj.get(key).getClass() == JSON_OBJECT) {
JSONObject jsonObject = (JSONObject) obj.get(key);
flatten(jsonObject, flatJson, _prefix + key);
} else if (obj.get(key).getClass() == JSON_ARRAY) {
JSONArray jsonArray = (JSONArray) obj.get(key);
if (jsonArray.length() < 1) {
continue;
}
flatten(jsonArray, flatJson, _prefix + key);
} else {
String value = obj.get(key).toString();
if (value != null && !value.equals("null")) {
flatJson.put(_prefix + key, value);
}
}
}
}
/**
* Flatten the given JSON Array
*
* @param obj
* @param flatJson
* @param prefix
*/
private static void flatten(JSONArray obj, Map<String, String> flatJson, String prefix) {
int length = obj.length();
for (int i = 0; i < length; i++) {
if (obj.get(i).getClass() == JSON_ARRAY) {
JSONArray jsonArray = (JSONArray) obj.get(i);
// jsonArray is empty
if (jsonArray.length() < 1) {
continue;
}
flatten(jsonArray, flatJson, prefix + "[" + i + "]");
} else if (obj.get(i).getClass() == JSON_OBJECT) {
JSONObject jsonObject = (JSONObject) obj.get(i);
flatten(jsonObject, flatJson, prefix + "[" + (i + 1) + "]");
} else {
String value = obj.get(i).toString();
if (value != null) {
flatJson.put(prefix + "[" + (i + 1) + "]", value);
}
}
}
}
}
| [
"yogesh_khandelwal@intuit.com"
] | yogesh_khandelwal@intuit.com |
058dd8d928bddf322827dab0f475427b94ceea87 | bf8810f9aa14c4986589d428129e042098e3d069 | /InterviewBit/Programming/Arrays/MinStepsInInfiniteGrid.java | efccde4adf70638aebcb5ffc6897563879b6027b | [] | no_license | shubhiroy/UCA | ecbed1675dc04d17f649e71ad4520cb453b6bc45 | cd61dd9afcdf60815ae4e69fdfd8e9f547f6ad45 | refs/heads/master | 2020-04-12T03:52:20.769081 | 2019-01-24T13:08:49 | 2019-01-24T13:08:49 | 162,280,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | public class Solution {
public int coverPoints(ArrayList<Integer> A, ArrayList<Integer> B) {
int steps=0;
for(int i=1;i<A.size();i++){
int a=java.lang.Math.abs(A.get(i)-A.get(i-1));
int b=java.lang.Math.abs(B.get(i)-B.get(i-1));
steps+=java.lang.Math.max(a,b);
}
return steps;
}
}
| [
"shubham09roy@gmail.com"
] | shubham09roy@gmail.com |
7d48d6ebb5cf9c93f6d20bb7ca5212deb7828529 | 27b0806c51afddc583984d7ecac3abb86f712397 | /src/main/java/com/apap/tutorial7/service/PilotService.java | 7f3a97908a5b3ae32c36edea5b20dad371af84a6 | [] | no_license | Apap-2018/tutorial7_1606893481 | 404c5511e65983b94a7b6b248fdba08fcfbec56a | 258d87ddf1434ec452784c32852f346d5828cf62 | refs/heads/master | 2020-04-04T05:11:29.855311 | 2018-11-01T15:43:19 | 2018-11-01T15:43:19 | 155,737,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package com.apap.tutorial7.service;
import com.apap.tutorial7.model.PilotModel;
import java.util.Optional;
/**
* PilotService
*/
public interface PilotService {
PilotModel getPilotDetailByLicenseNumber(String licenseNumber);
PilotModel addPilot(PilotModel pilot);
void deletePilotByLicenseNumber(String licenseNumber);
Optional<PilotModel> getPilotDetailById(long id);
void updatePilot(PilotModel pilot);
void deletePilot(PilotModel pilot);
} | [
"esaphogus@gmail.com"
] | esaphogus@gmail.com |
e87d73013cbc177186aadf533d38d13efa736e53 | 3fb146c5241afa403e0d75b83f1c6129eee60ac6 | /src/com/tencent/xinge/unittest/XingeAppUnitTest.java | 4149c17845bb060b7158392d4cd33ec170094e47 | [] | no_license | lyon-y/XgPushJavaSDK | 5f3fdc1f27b3876f0478c196bcfc296cb574ce19 | 7c25d49822504be079f26c0264756565f957fb00 | refs/heads/master | 2021-05-02T16:51:14.788197 | 2016-11-01T02:20:51 | 2016-11-01T02:20:51 | 72,496,043 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 980 | java | package com.tencent.xinge.unittest;
import static org.junit.Assert.*;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONObject;
import org.junit.Test;
import com.tencent.xinge.XingeApp;
public class XingeAppUnitTest extends XingeApp {
public XingeAppUnitTest()
{
super(353, "353_secret_key");
}
@Test
public void testCallRestful() {
XingeAppUnitTest xgt = new XingeAppUnitTest();
Map<String, Object> params = new HashMap<String, Object>();
params.put("key1", 2);
JSONObject json = xgt.callRestful("http://10.1.152.139/v1/push/single_device", params);
assertEquals("{\"err_msg\":\"common param error!\",\"ret_code\":-1}", json.toString());
json = xgt.callRestful("http://10.1.152.139/v1/push/single_", params);
assertEquals("{\"err_msg\":\"call restful error\",\"ret_code\":-1}", json.toString());
json = xgt.callRestful("abc", params);
assertEquals("{\"err_msg\":\"generateSign error\",\"ret_code\":-1}", json.toString());
}
}
| [
"lyonyang@tencent.com"
] | lyonyang@tencent.com |
898944884e972b5a87844fd858def503fbe5aff0 | c4215f53c1ab80b7076539d54495282557d5ab65 | /test/app/src/main/java/com/example/test/MainActivity.java | db2d6f4fd9bf8fca5ff44875a22c799bb364a94f | [] | no_license | macaroni-chan/galileo_pracical_exam | ed446c4247d6b6ed7eab759178b3c80352e9e627 | 8b1bc6d143ff481bfdad52432713f3b3d269f5d2 | refs/heads/master | 2023-07-12T04:20:53.932018 | 2021-08-12T13:45:32 | 2021-08-12T13:45:32 | 393,842,574 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,302 | java | package com.example.test;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity {
Button btn_search;
Button btn_country_list;
EditText et_key_word;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn_search = findViewById(R.id.btn_search);
btn_country_list = findViewById(R.id.btn_clist);
et_key_word = findViewById(R.id.edit_text_search);
btn_search.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String item_search = et_key_word.getText().toString();
if(item_search.isEmpty()){
alert();
}else{
Intent nav = new Intent(getApplicationContext(), country_search_deets.class);
nav.putExtra("key", item_search);
startActivity(nav);
finish();
}
}
});
btn_country_list.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent nav = new Intent(getApplicationContext(), country_holder.class);
startActivity(nav);
finish();
}
});
}
private void alert() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Search bar is empty.")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
//no events
}
});
AlertDialog alert = builder.create();
alert.show();
}
@Override
public void onBackPressed() {
System.exit(0);
}
} | [
"macalino.joshuamatthew@ue.edu.ph"
] | macalino.joshuamatthew@ue.edu.ph |
37e40f1f543f510e4a8376a056d78860bd453df1 | a4f8491a95fd9fa708ef1280e523af83fb84d2a0 | /Java Fundamentals/JavaFundMapsLambdaAndStreamApi/Orders.java | f45aaf712f58f56f2a122d7b516203da3101d939 | [] | no_license | Zlatimir/SOFTUNI | 2dd3b685a79bd537b85fab3d2325586c366673d8 | 4b8e4b6089cc76324c0165682517e8c719b86db7 | refs/heads/main | 2023-06-26T15:20:01.202562 | 2021-07-25T11:54:08 | 2021-07-25T11:54:08 | 318,970,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,334 | java | package JavaFundMapsLambdaAndStreamApi;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
/**
* Created by Zlatimir Ivanov on 12.11.2020 г..
*/
public class Orders {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Map<String, Double> productPrice = new LinkedHashMap<>();
Map<String, Integer> productCount = new LinkedHashMap<>();
Map<String, Double> totalPrice = new LinkedHashMap<>();
String input = sc.nextLine();
while (!input.equals("buy")) {
String[] data = input.split(" ");
String product = data[0];
double price = Double.parseDouble(data[1]);
int count = Integer.parseInt(data[2]);
productPrice.put(product, price);
if (productCount.get(product) == null) {
productCount.put(product, count);
} else {
productCount.put(product, count + productCount.get(product));
}
totalPrice.put(product, productPrice.get(product) * productCount.get(product));
input = sc.nextLine();
}
for (Map.Entry<String, Double> entry : totalPrice.entrySet()) {
System.out.printf("%s -> %.2f%n", entry.getKey(), entry.getValue());
}
}
}
| [
"zlatimir_ivanov@abv.bg"
] | zlatimir_ivanov@abv.bg |
c070a0387833630eb902658dbec14af3dafa3abc | e04af49094db9f5b18f7900a6e6841996f22b0bd | /app/src/main/java/com/xavier/financasdroid/ui/tools/ToolsFragment.java | 7fa271ce6d888801afee5a9f4a84984a2e870878 | [
"MIT"
] | permissive | fxavier/financasdroid | 0548bca5a5a48921023203dff1f6315cc5c43c57 | d8934253f37c044c0ff77bad71b4d895e77e1011 | refs/heads/master | 2020-09-16T13:26:28.095809 | 2019-11-24T17:35:47 | 2019-11-24T17:35:47 | 223,732,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,148 | java | package com.xavier.financasdroid.ui.tools;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.xavier.financasdroid.R;
public class ToolsFragment extends Fragment {
private ToolsViewModel toolsViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
toolsViewModel =
ViewModelProviders.of(this).get(ToolsViewModel.class);
View root = inflater.inflate(R.layout.fragment_tools, container, false);
final TextView textView = root.findViewById(R.id.text_tools);
toolsViewModel.getText().observe(this, new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
} | [
"xavierfrancisco353@gmail.com"
] | xavierfrancisco353@gmail.com |
6219dda65fc10ef34aeb3021e5e19ba440f32a99 | 3fe65965fb5b5f4320aa0a1bb8bc57bfddef5bef | /src/cn/it/web/UI/RoomALLUIServlet.java | 57a27aa642240cde57079d441cb83f77643e21e0 | [] | no_license | hewq/IntelligentClassroom | 44e3b8f3b88d95ed3834761d1524a77a089fa455 | c9f3310b9a15cd1a735907cccf54a94f30cab03c | refs/heads/master | 2021-01-21T14:00:58.194584 | 2016-05-28T13:54:28 | 2016-05-28T13:54:28 | 46,710,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package cn.it.web.UI;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class RoomALLUIServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.getRequestDispatcher("/WEB-INF/jsp/room.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
| [
"632305424@qq.com"
] | 632305424@qq.com |
7b879fd7d315b91120ef270d3db9b071ca1c9177 | 1e8a5381b67b594777147541253352e974b641c5 | /com/veryfit/multi/camera/PhotoFragment.java | ce435f53ef69a2d78660bafd5151e2f74216986f | [] | no_license | jramos92/Verify-Prueba | d45f48829e663122922f57720341990956390b7f | 94765f020d52dbfe258dab9e36b9bb8f9578f907 | refs/heads/master | 2020-05-21T14:35:36.319179 | 2017-03-11T04:24:40 | 2017-03-11T04:24:40 | 84,623,529 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,172 | java | package com.veryfit.multi.camera;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.graphics.Point;
import android.media.ThumbnailUtils;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.provider.MediaStore.Images.Media;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationSet;
import android.view.animation.AnimationUtils;
import android.view.animation.ScaleAnimation;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import com.project.library.core.APPCoreServiceListener;
import com.project.library.core.CoreServiceProxy;
import com.project.library.device.cmd.DeviceBaseCommand;
import com.project.library.device.cmd.appcontrol.AppControlCmd;
import com.project.library.util.DebugLog;
import com.veryfit.multi.photowall.ImageDetailsActivity;
import com.veryfit.multi.photowall.Images;
import java.util.List;
public class PhotoFragment
extends Fragment
implements View.OnTouchListener
{
public static final String ACTION = "com.guodoo.multi.takepicture_receiver";
private static final byte MODE_CAMERA = 3;
private static final byte MODE_EXIT = 1;
private static final byte MODE_IDLE = 2;
private static final byte MODE_OPEN = 0;
private APPCoreServiceListener mAppListener = new APPCoreServiceListener()
{
public void onAppControlSuccess(byte paramAnonymousByte, boolean paramAnonymousBoolean)
{
if (paramAnonymousByte == 2)
{
if (paramAnonymousBoolean) {
break label17;
}
PhotoFragment.this.failedOpenCameraMode();
}
label17:
do
{
return;
if (PhotoFragment.this.mode == 1)
{
PhotoFragment.this.mode = 2;
PhotoFragment.this.getActivity().finish();
return;
}
} while (PhotoFragment.this.mode != 0);
PhotoFragment.this.mode = 3;
}
public void onBLEConnected()
{
if (PhotoFragment.this.mode == 3) {
PhotoFragment.this.mCore.writeForce(AppControlCmd.getInstance().getCameraCmd((byte)0));
}
}
public void onBLEDisConnected(String paramAnonymousString) {}
public void onBleControlReceive(byte paramAnonymousByte1, byte paramAnonymousByte2)
{
DebugLog.d("onBleControlReceive====接收拍照命令");
PhotoFragment.this.mReceiveCmdTime = System.currentTimeMillis();
if ((paramAnonymousByte1 == 1) && (com.project.library.device.cmd.blecontrol.BleControlCmd.EVENT_TYPE[5] == paramAnonymousByte2) && (PhotoFragment.this.getActivity() != null)) {
PhotoFragment.this.getActivity().runOnUiThread(new Runnable()
{
public void run()
{
PhotoFragment.this.clickedTakePhoto();
}
});
}
}
public void onDataSendTimeOut(byte[] paramAnonymousArrayOfByte)
{
if ((DeviceBaseCommand.getCmdId(paramAnonymousArrayOfByte) == 6) && (DeviceBaseCommand.getCmdKey(paramAnonymousArrayOfByte) == 2)) {
PhotoFragment.this.failedOpenCameraMode();
}
}
};
private Button mCloseFlashBtn;
protected CoreServiceProxy mCore = CoreServiceProxy.getInstance();
private SeekBar mCountSeekBar;
private Button mDefaultFlashBtn;
private FlashState mFlashState = FlashState.FLASH_AUTO;
private View mFlashView;
private ImageView mGalleryBtn;
private Handler mHandler = new Handler();
private ImageView mIvFocus;
private Button mOpenFlashBtn;
private Button mPhotoCloseBtn;
private TextView mPhotoCount;
private TextView mPhotoTime;
private CameraPreView mPreView = null;
private long mReceiveCmdTime = 0L;
private View mRootView;
private View mSettingView;
private SharedPreferences mSharedPreferences = null;
private Button mTakePhotoBtn;
private SeekBar mTimeSeekBar;
private byte mode = 2;
private BroadcastReceiver takePictureReceiver = new BroadcastReceiver()
{
public void onReceive(Context paramAnonymousContext, Intent paramAnonymousIntent)
{
if (paramAnonymousIntent.getAction().equals("com.guodoo.multi.takepicture_receiver"))
{
paramAnonymousContext = paramAnonymousIntent.getStringExtra("fileName");
PhotoFragment.this.setDefaultIcon(paramAnonymousContext);
}
}
};
private void failedOpenCameraMode()
{
this.mode = 1;
this.mCore.writeForce(AppControlCmd.getInstance().getCameraCmd((byte)1));
getActivity().runOnUiThread(new Runnable()
{
public void run()
{
Toast.makeText(PhotoFragment.this.getActivity(), 2131296617, 0).show();
PhotoFragment.this.getActivity().finish();
}
});
}
private void initBle()
{
this.mode = 2;
if (this.mCore.isAvailable())
{
this.mCore.addListener(this.mAppListener);
if (!this.mCore.isDeviceConnected()) {
break label73;
}
if (!this.mCore.writeForce(AppControlCmd.getInstance().getCameraCmd((byte)0))) {
Toast.makeText(getActivity(), 2131296616, 0).show();
}
}
else
{
return;
}
this.mode = 0;
return;
label73:
Toast.makeText(getActivity(), 2131296616, 0).show();
}
private void initFlashControl()
{
this.mFlashView = this.mRootView.findViewById(2131231039);
this.mDefaultFlashBtn = ((Button)this.mRootView.findViewById(2131231038));
this.mCloseFlashBtn = ((Button)this.mRootView.findViewById(2131231040));
this.mOpenFlashBtn = ((Button)this.mRootView.findViewById(2131231041));
this.mFlashView.setVisibility(8);
this.mDefaultFlashBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
switch (PhotoFragment.this.mFlashState)
{
default:
PhotoFragment.this.mFlashState = PhotoFragment.FlashState.FLASH_ON;
PhotoFragment.this.mPreView.updateFlash("flash_on");
PhotoFragment.this.mDefaultFlashBtn.setBackgroundResource(2130837563);
return;
case FLASH_ON:
PhotoFragment.this.mFlashState = PhotoFragment.FlashState.FLASH_OFF;
PhotoFragment.this.mPreView.updateFlash("flash_off");
PhotoFragment.this.mDefaultFlashBtn.setBackgroundResource(2130837562);
return;
}
PhotoFragment.this.mFlashState = PhotoFragment.FlashState.FLASH_AUTO;
PhotoFragment.this.mPreView.updateFlash("flash_auto");
PhotoFragment.this.mDefaultFlashBtn.setBackgroundResource(2130837561);
}
});
}
private void initSetting()
{
this.mSettingView = this.mRootView.findViewById(2131231043);
this.mSettingView.setVisibility(8);
this.mPhotoCount = ((TextView)this.mRootView.findViewById(2131231045));
this.mPhotoTime = ((TextView)this.mRootView.findViewById(2131231047));
this.mCountSeekBar = ((SeekBar)this.mRootView.findViewById(2131231044));
this.mCountSeekBar.setMax(15);
this.mTimeSeekBar = ((SeekBar)this.mRootView.findViewById(2131231046));
this.mTimeSeekBar.setMax(100);
int i = Integer.parseInt(this.mSharedPreferences.getString("preference_burst_mode", "1"));
float f = Float.parseFloat(this.mSharedPreferences.getString("preference_burst_interval", "0"));
this.mCountSeekBar.setProgress(i);
this.mTimeSeekBar.setProgress((int)(10.0F * f));
if (i == 1)
{
str = getResources().getString(2131296612);
this.mPhotoCount.setText(i + " " + str);
if (f / 1.0F != 1.0F) {
break label331;
}
}
label331:
for (String str = getResources().getString(2131296410);; str = getResources().getString(2131296610))
{
this.mPhotoTime.setText(f / 1.0F + " " + str);
this.mCountSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
{
public void onProgressChanged(SeekBar paramAnonymousSeekBar, int paramAnonymousInt, boolean paramAnonymousBoolean)
{
if (paramAnonymousInt == 1) {}
for (paramAnonymousSeekBar = PhotoFragment.this.getResources().getString(2131296612);; paramAnonymousSeekBar = PhotoFragment.this.getResources().getString(2131296613))
{
PhotoFragment.this.mPhotoCount.setText(paramAnonymousInt + " " + paramAnonymousSeekBar);
PhotoFragment.this.mSharedPreferences.edit().putString("preference_burst_mode", paramAnonymousInt).commit();
return;
}
}
public void onStartTrackingTouch(SeekBar paramAnonymousSeekBar) {}
public void onStopTrackingTouch(SeekBar paramAnonymousSeekBar) {}
});
this.mTimeSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
{
public void onProgressChanged(SeekBar paramAnonymousSeekBar, int paramAnonymousInt, boolean paramAnonymousBoolean)
{
if (paramAnonymousInt / 10.0F == 1.0F) {}
for (paramAnonymousSeekBar = PhotoFragment.this.getResources().getString(2131296410);; paramAnonymousSeekBar = PhotoFragment.this.getResources().getString(2131296610))
{
PhotoFragment.this.mPhotoTime.setText(paramAnonymousInt / 10.0F + " " + paramAnonymousSeekBar);
PhotoFragment.this.mSharedPreferences.edit().putString("preference_burst_interval", paramAnonymousInt / 10.0F).commit();
return;
}
}
public void onStartTrackingTouch(SeekBar paramAnonymousSeekBar) {}
public void onStopTrackingTouch(SeekBar paramAnonymousSeekBar) {}
});
this.mRootView.findViewById(2131231048).setOnClickListener(new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
PhotoFragment.this.clickedOkTextView();
}
});
return;
str = getResources().getString(2131296613);
break;
}
}
private void setAnimation()
{
AnimationSet localAnimationSet = new AnimationSet(true);
ScaleAnimation localScaleAnimation = new ScaleAnimation(3.0F, 1.5F, 3.0F, 1.5F, 1, 0.5F, 1, 0.5F);
localScaleAnimation.setDuration(500L);
AlphaAnimation localAlphaAnimation = new AlphaAnimation(1.0F, 1.0F);
localAlphaAnimation.setDuration(2000L);
localAnimationSet.addAnimation(localScaleAnimation);
localAnimationSet.addAnimation(localAlphaAnimation);
this.mIvFocus.startAnimation(localAnimationSet);
this.mIvFocus.setVisibility(4);
}
private void setDefaultIcon(String paramString)
{
if (paramString == null)
{
this.mGalleryBtn.setImageDrawable(getResources().getDrawable(2130837507));
return;
}
paramString = ThumbnailUtils.extractThumbnail(SDCardImageLoader.getInstance().compressBitmap(paramString), 55, 55);
this.mGalleryBtn.setImageBitmap(paramString);
}
public void clickedGallery()
{
Intent localIntent = new Intent("android.intent.action.PICK", null);
localIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
startActivityForResult(localIntent, 100);
}
public void clickedOkTextView()
{
Animation localAnimation = AnimationUtils.loadAnimation(getActivity(), 2130968596);
localAnimation.setAnimationListener(new Animation.AnimationListener()
{
public void onAnimationEnd(Animation paramAnonymousAnimation)
{
PhotoFragment.this.mSettingView.setVisibility(8);
}
public void onAnimationRepeat(Animation paramAnonymousAnimation) {}
public void onAnimationStart(Animation paramAnonymousAnimation) {}
});
this.mSettingView.startAnimation(localAnimation);
}
public void clickedSetting()
{
if (this.mSettingView.getVisibility() == 8)
{
Animation localAnimation = AnimationUtils.loadAnimation(getActivity(), 2130968595);
localAnimation.setAnimationListener(new Animation.AnimationListener()
{
public void onAnimationEnd(Animation paramAnonymousAnimation)
{
PhotoFragment.this.mSettingView.setVisibility(0);
}
public void onAnimationRepeat(Animation paramAnonymousAnimation) {}
public void onAnimationStart(Animation paramAnonymousAnimation) {}
});
this.mSettingView.startAnimation(localAnimation);
this.mSettingView.setVisibility(0);
}
}
public void clickedSwitchCamera()
{
this.mPreView.switchCamera();
}
public void clickedTakePhoto()
{
if (this.mPreView != null) {
this.mPreView.takePicturePressed();
}
}
public void initView()
{
ScreenUtils.initScreen(getActivity());
this.mPreView = ((CameraPreView)this.mRootView.findViewById(2131231032));
ViewGroup.LayoutParams localLayoutParams = this.mPreView.getLayoutParams();
Point localPoint = DisplayUtil.getScreenMetrics(getActivity());
this.mIvFocus = ((ImageView)this.mRootView.findViewById(2131231033));
localLayoutParams.width = localPoint.x;
localLayoutParams.height = localPoint.y;
this.mPreView.setLayoutParams(localLayoutParams);
this.mTakePhotoBtn = ((Button)this.mRootView.findViewById(2131231036));
this.mTakePhotoBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
if (PhotoFragment.this != null) {
PhotoFragment.this.clickedTakePhoto();
}
}
});
this.mGalleryBtn = ((ImageView)this.mRootView.findViewById(2131231037));
this.mGalleryBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
PhotoFragment.this.getActivity().startActivity(new Intent(PhotoFragment.this.getActivity(), ImageDetailsActivity.class));
}
});
this.mRootView.findViewById(2131231042).setOnClickListener(new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
PhotoFragment.this.clickedSwitchCamera();
}
});
new Handler().postDelayed(new Runnable()
{
public void run()
{
PhotoFragment.this.mPhotoCloseBtn.setVisibility(0);
PhotoFragment.this.mRootView.findViewById(2131231037).setVisibility(0);
}
}, 1000L);
this.mPhotoCloseBtn = ((Button)this.mRootView.findViewById(2131231035));
this.mPhotoCloseBtn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View paramAnonymousView)
{
if ((CameraInterface.getInstance().isTakingPhoto()) || (System.currentTimeMillis() - PhotoFragment.this.mReceiveCmdTime < 1200L)) {
return;
}
PhotoFragment.this.onBackKeyDown();
}
});
initFlashControl();
setAnimation();
this.mPreView.setOnTouchListener(this);
}
public void onActivityCreated(Bundle paramBundle)
{
super.onActivityCreated(paramBundle);
getActivity().getWindow().addFlags(128);
}
public void onBackKeyDown()
{
if ((this.mode == 3) && (this.mCore.isDeviceConnected()))
{
if (!this.mCore.write(AppControlCmd.getInstance().getCameraCmd((byte)1)))
{
this.mode = 1;
this.mCore.writeForce(AppControlCmd.getInstance().getCameraCmd((byte)1));
return;
}
this.mode = 1;
return;
}
getActivity().finish();
}
public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
{
if (this.mRootView != null)
{
paramLayoutInflater = (ViewGroup)this.mRootView.getParent();
if (paramLayoutInflater != null) {
paramLayoutInflater.removeView(this.mRootView);
}
}
for (;;)
{
paramLayoutInflater = new IntentFilter("com.guodoo.multi.takepicture_receiver");
getActivity().registerReceiver(this.takePictureReceiver, paramLayoutInflater);
return this.mRootView;
this.mRootView = paramLayoutInflater.inflate(2130903104, paramViewGroup, false);
this.mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(getActivity());
initView();
initBle();
}
}
public void onDestroy()
{
super.onDestroy();
getActivity().unregisterReceiver(this.takePictureReceiver);
this.mCore.removeListener(this.mAppListener);
}
public void onPause()
{
this.mPreView.onPause();
CameraInterface.getInstance().doStopCamera();
super.onPause();
}
public void onResume()
{
List localList = Images.getImages();
if ((localList == null) || (localList.size() <= 0)) {
this.mGalleryBtn.setImageDrawable(getResources().getDrawable(2130837507));
}
for (;;)
{
this.mPreView.cameraHasOpened();
this.mHandler.postDelayed(new Runnable()
{
public void run()
{
PhotoFragment.this.mPreView.onResume();
}
}, 1000L);
super.onResume();
return;
setDefaultIcon((String)localList.get(0));
}
}
public boolean onTouch(View paramView, MotionEvent paramMotionEvent)
{
switch (paramMotionEvent.getAction())
{
default:
return false;
}
float f2 = paramMotionEvent.getX();
float f3 = paramMotionEvent.getY();
int i = View.MeasureSpec.makeMeasureSpec(0, 0);
int j = View.MeasureSpec.makeMeasureSpec(0, 0);
this.mIvFocus.measure(i, j);
int k = this.mIvFocus.getHeight();
int m = this.mIvFocus.getWidth();
float f1 = f2;
if (f2 < m / 2) {
f1 = m / 2;
}
f2 = f1;
if (f1 > DisplayUtil.getScreenMetrics(getActivity()).x - m / 2) {
f2 = DisplayUtil.getScreenMetrics(getActivity()).x - m / 2;
}
f1 = f3;
if (f3 < k / 2) {
f1 = k / 2;
}
f3 = f1;
if (f1 > DisplayUtil.getScreenMetrics(getActivity()).y - k / 2) {
f3 = DisplayUtil.getScreenMetrics(getActivity()).y - k / 2;
}
i = (int)(f2 - m / 2);
j = (int)(f3 - k / 2);
m = (int)(m / 2 + f2);
k = (int)(k / 2 + f3);
this.mIvFocus.layout(i, j, m, k);
setAnimation();
return false;
}
static enum FlashState
{
FLASH_AUTO, FLASH_OFF, FLASH_ON;
}
}
/* Location: C:\Users\julian\Downloads\Veryfit 2 0_vV2.0.28_apkpure.com-dex2jar.jar!\com\veryfit\multi\camera\PhotoFragment.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"ramos.marin92@gmail.com"
] | ramos.marin92@gmail.com |
42345986bdeb16acb697b9ed71e3dec39f8f4db9 | 0498b2a550adc40b48da03a5c7adcd7c3d3a037d | /errai-ui/src/main/java/org/jboss/errai/ui/shared/VisitContextImpl.java | 1a13067a8489789fe2d672ddcc6192f98f200d57 | [] | no_license | sinaisix/errai | ba5cd3db7a01f1a0829086635128d918f25c0122 | 7e7e0a387d02b7366cbed9947d6c969f21ac655f | refs/heads/master | 2021-01-18T08:03:04.809057 | 2015-02-24T00:10:16 | 2015-02-24T00:14:28 | 31,277,838 | 1 | 0 | null | 2015-02-24T19:32:46 | 2015-02-24T19:32:46 | null | UTF-8 | Java | false | false | 435 | java | package org.jboss.errai.ui.shared;
public class VisitContextImpl<T> implements VisitContextMutable<T> {
private boolean complete;
private T result;
public boolean isVisitComplete() {
return complete;
}
@Override
public void setVisitComplete() {
complete = true;
}
@Override
public T getResult() {
return result;
}
@Override
public void setResult(T result) {
this.result = result;
}
}
| [
"lincolnbaxter@gmail.com"
] | lincolnbaxter@gmail.com |
b1373318b7fbefb70a4cccc20f52a9ce1354e6ed | bc68d36ad98e62217d2dcf45ff25e0157a3058e8 | /src/main/java/com/example/demo/service/impl/UserServiceMybatisImpl.java | 2bfe4791ef562d431fb175f6a18b1e38ea8cf298 | [] | no_license | 15803058931/Demo1 | cd06cc7679214b4afc918164c0259f723dc03922 | a993d2454851ea36dccbd504dfc496d5c00e2e97 | refs/heads/master | 2020-04-12T04:13:20.111893 | 2018-12-19T04:30:07 | 2018-12-19T04:30:07 | 162,288,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,849 | java | package com.example.demo.service.impl;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.example.demo.mapper.UserMapper;
import com.example.demo.pojo.User;
import com.example.demo.service.UserService;
//@Service("userService")
public class UserServiceMybatisImpl implements UserService{
private static final Logger log = LoggerFactory.getLogger(UserServiceMybatisImpl.class);
@Autowired
UserMapper userMapper;
@Override
public User getUser(Long id) {
// TODO Auto-generated method stub
log.info("Mybatis.getUser");
return userMapper.getUserById(id);
}
@Override
public List<User> getUserByAddress(String address) {
// TODO Auto-generated method stub
return null;
}
@Override
public int countByAge(int age) {
// TODO Auto-generated method stub
return 0;
}
@Override
public User saveUser(User user) {
// TODO Auto-generated method stub
return null;
}
@Override
public User updateUser(User user) {
// TODO Auto-generated method stub
return null;
}
@Override
public void transactionDemo(User user) {
// TODO Auto-generated method stub
}
@Override
public void deleteById(Long id) {
// TODO Auto-generated method stub
}
@Override
public Page<User> pageByNameDemo(String name, Pageable page) {
// TODO Auto-generated method stub
return null;
}
@Override
public Page<User> getAll(Pageable page) {
// TODO Auto-generated method stub
return null;
}
@Override
public int test(int i) {
// TODO Auto-generated method stub
return 0;
}
}
| [
"53313229@qq.com"
] | 53313229@qq.com |
89c9ae5002ad5c695b523fd44c20bcb499914c59 | 93a8286c08349169ed6491fa01f838a5fe11de3e | /src/main/java/ucbl/ptm/projet/servlets/AdministrationRubrique.java | 19cf25215ac5efe64d64d2af74a95f012a073d49 | [] | no_license | nRudzy/Pandor | 79072693e753cd17a184a896151795e1e85dcc58 | 864c6e2b08e01d30c68d2cbeb557ab0f989e097e | refs/heads/master | 2022-04-02T23:54:24.287389 | 2020-02-02T21:44:49 | 2020-02-02T21:44:49 | 237,841,447 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,173 | java | package ucbl.ptm.projet.servlets;
import ucbl.ptm.projet.metier.Pandor;
import ucbl.ptm.projet.modele.Rubrique;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.logging.Logger;
@WebServlet(name = "AdministrationRubrique", urlPatterns = "/AdministrationRubrique")
public class AdministrationRubrique extends HttpServlet {
private static final Logger LOGGER = Logger.getLogger(AdministrationRubrique.class.getName());
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e){
LOGGER.log(Level.INFO, e.getMessage(), e);
}
Pandor pandor = (Pandor) request.getServletContext().getAttribute("pandor");
int idRubrique = 0;
try {
idRubrique = Integer.parseInt(request.getParameter("rubriqueId"));
} catch (NumberFormatException e) {
try {
response.sendRedirect(request.getContextPath() + "/Accueil");
} catch(IOException ex) {
LOGGER.log(Level.INFO, ex.getMessage(), ex);
}
}
request.setCharacterEncoding("UTF-8");
if(request.getParameter("action") != null && request.getParameter("rubriqueId") != null) {
Rubrique rubrique = pandor.getRubrique(idRubrique);
String nomRubriqueEnCours = rubrique.getNom();
String action = request.getParameter("action");
switch (action) {
case "modifierNomRubrique" :
String nouveauNom = request.getParameter("modifierNomRubrique");
pandor.modifierNomRubrique(
pandor.getRubriqueByName(nomRubriqueEnCours), nouveauNom);
break;
case "modifierPresentationRubrique" :
String nouvellePresentation = request.getParameter("modifierPresentationRubrique");
pandor.modifierPresentationRubrique(
pandor.getRubriqueByName(nomRubriqueEnCours), nouvellePresentation);
break;
default:
break;
}
}
try {
request.getRequestDispatcher("WEB-INF/jsp/adminRubric.jsp").forward(request, response);
} catch(IOException | ServletException e) {
LOGGER.log(Level.INFO, e.getMessage(), e);
}
}
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
request.getRequestDispatcher("WEB-INF/jsp/adminRubric.jsp").forward(request, response);
} catch(IOException | ServletException e) {
LOGGER.log(Level.INFO, e.getMessage(), e);
}
}
}
| [
"omedxhd@gmail.com"
] | omedxhd@gmail.com |
3d3f8a5f98c01158b66939fbb79aaabab0bdbb42 | a137224d471c5586e3200a8badd736715cb826a6 | /Universal-Space-Operations-Center/src/main/java/com/ksatstuttgart/usoc/data/SerialEvent.java | 6c83494b641f79726e31d184684fce4c42c07fb0 | [
"MIT"
] | permissive | Gyanesha/Universal-Space-Operations-Center | 49bd2cf87da424eeb59fb18d04a42a8fc032d405 | 36a3a51395aadcbfc02ed9175ec7ed9074381cef | refs/heads/master | 2021-01-25T14:10:45.299711 | 2018-02-28T22:24:56 | 2018-02-28T22:24:56 | 123,663,441 | 0 | 1 | MIT | 2018-10-26T19:33:02 | 2018-03-03T05:43:05 | Java | UTF-8 | Java | false | false | 2,142 | java | /*
* The MIT License
*
* Copyright 2017 KSat e.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.ksatstuttgart.usoc.data;
/**
*
* @author valentinstarlinger
*/
public class SerialEvent extends USOCEvent{
private String msg;
private String port;
private long timeStamp;
public SerialEvent(String msg, String port, long timeStamp, DataSource dataSource){
super(dataSource);
this.msg = msg;
this.port = port;
}
public long getTimeStamp() {
return timeStamp;
}
public void setTimeStamp(long timeStamp) {
this.timeStamp = timeStamp;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getPort() {
return port;
}
public void setPort(String port) {
this.port = port;
}
@Override
public DataSource getDataSource() {
return this.dataSource;
}
@Override
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}
}
| [
"valentin@starlinger.net"
] | valentin@starlinger.net |
2bed3dfc7c8687cdbf7f36c2cc730de9811af06d | 915cdea11a14572a89bf424d76eeb287d6c5c665 | /tools/src/main/java/com/zccl/ruiqianqi/tools/StringUtils.java | c068991e72835d2ee26b72967540caf80163dafa | [] | no_license | panyzyw/lock_screen | 5397d06ba1828a94e6b49322115010f969613464 | b5a41a807a70b7f9f3b8cba113603e7ee98b18f2 | refs/heads/master | 2021-07-01T10:12:16.591172 | 2017-09-15T08:22:11 | 2017-09-15T08:22:11 | 103,632,592 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,852 | java | package com.zccl.ruiqianqi.tools;
import android.text.TextUtils;
import java.text.DateFormat;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class StringUtils {
/**
* 检查字符串是否为空
* @param str
* @return
*/
public static boolean isEmpty(String str){
if(TextUtils.isEmpty(str)){
return true;
}else{
str = str.trim();
if(str.length()==0){
return true;
}
}
return false;
}
/**
* 截取字符串
* @param str
* @param length
* @return
*/
public static String substring(String str, int length){
if (isEmpty(str)) {
return null;
}
if (length<=0 || str.length()<=length) {
return str;
}
return str.substring(0, length);
}
/**
* 按照指定的格式,输出对象字符串化的对象
*
* 占位符可以使用0和#两种,当使用0的时候会严格按照样式来进行匹配,不够的时候会补0,
* 而使用#时会将前后的0进行忽略
* @param format 0000 ###
* @param obj
* @return
*/
public static String obj2FormatStr(String format, Object obj){
try {
DecimalFormat df = new DecimalFormat(format);
return df.format(obj);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 保留小数点后一位
* @param value
* @return
*/
public static String pointOne(float value) {
DecimalFormat df = new DecimalFormat("#.0");
return df.format(value);
}
/**
* 保留小数点后两位
* @param value
* @return
*/
public static String pointTwo(float value) {
return String.format("%.2f", value);
}
/**
* 1、转换符
* %s: 字符串类型,如:"ljq"
* %b: 布尔类型,如:true
* %d: 整数类型(十进制),如:99
* %f: 浮点类型,如:99.99
* %%: 百分比类型,如:%
* %n: 换行符
*
* 2、常见日期时间格式化
* tc: 包括全部日期和时间信息 星期六 十月 27 14:21:20 CST 2007
* tF: "年-月-日"格式,如:2007-10-27
* tD: "月/日/年"格式,如:10/27/07
* tr: "HH:MM:SS PM"格式(12时制),如:02:25:51 下午
* tT: "HH:MM:SS"格式(24时制),如:14:28:16
* tR: "HH:MM"格式(24时制),如:14:28
*
* 3、格式化日期字符串
* b或者h: 月份简称,如
* 中:十月
* 英:Oct
*
* B: 月份全称,如
* 中:十月
* 英:October
*
* a: 星期的简称,如
* 中:星期六
* 英:Sat
*
* A: 星期的全称,如:
* 中:星期六
* 英:Saturday
*
* C: 年的前两位数字(不足两位前面补0),如:20
* y: 年的后两位数字(不足两位前面补0),如:07
* Y: 4位数字的年份(不足4位前面补0),如:2007
* j: 一年中的天数(即年的第几天),如:300
* m: 两位数字的月份(不足两位前面补0),如:10
* d: 两位数字的日(不足两位前面补0),如:27
* e: 月份的日(前面不补0),如:5
*
* 4、格式化时间字符串
* H: 2位数字24时制的小时(不足2位前面补0),如:15
* I: 2位数字12时制的小时(不足2位前面补0),如:03
* k: 2位数字24时制的小时(前面不补0),如:15
* l: 2位数字12时制的小时(前面不补0),如:3
* M: 2位数字的分钟(不足2位前面补0),如:03
* S: 2位数字的秒(不足2位前面补0),如:09
* L: 3位数字的毫秒(不足3位前面补0),如:015
* N: 9位数字的毫秒数(不足9位前面补0),如:562000000
*
* p: 小写字母的上午或下午标记,如:
* 中:下午
* 英:pm
*
* z: 相对于GMT的RFC822时区的偏移量,如:+0800
* Z: 时区缩写字符串,如:CST
* s: 1970-1-1 00:00:00 到现在所经过的秒数,如:1193468128
* Q: 1970-1-1 00:00:00 到现在所经过的毫秒数,如:1193468128984
* @return
*/
public static String formatTime(){
// tF: "年-月-日"格式,如:2007-10-27
return String.format("%tF", new Date());
}
/**
* 时长格式化显示
*/
public static String generateTime(long time) {
int totalSeconds = (int) (time / 1000);
int seconds = totalSeconds % 60;
int minutes = totalSeconds / 60;
return minutes > 99 ? String.format("%d:%02d", minutes, seconds) : String.format("%02d:%02d", minutes, seconds);
}
/**
* 获取系统当前时间
*
SimpleDateFormat函数语法:
G 年代标志符
y 年
M 月
d 日
h 时 在上午或下午 (1~12)
H 时 在一天中 (0~23)
m 分
s 秒
S 毫秒
E 星期
D 一年中的第几天
F 一月中第几个星期几
w 一年中第几个星期
W 一月中第几个星期
a 上午 / 下午 标记符
k 时 在一天中 (1~24)
K 时 在上午或下午 (0~11)
z 时区
*/
public static String getDate() {
Calendar ca = Calendar.getInstance();
DateFormat matter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS", Locale.getDefault());
//ca.getTime().toLocaleString();
return matter.format(ca.getTime());
}
/**
* 取开年时间戳【设置成一月】
* @return
*/
public static long getYearBeginTime(){
Calendar ca = Calendar.getInstance();
ca.set(Calendar.MONTH, Calendar.JANUARY);
return ca.getTimeInMillis();
}
/**
* 取开月时间戳【设置成当月】
* @return
*/
public static long getMonthBeginTime(){
Calendar ca = Calendar.getInstance();
ca.set(Calendar.MONTH, ca.get(Calendar.MONTH));
return ca.getTimeInMillis();
}
/**
* 得到可订票日期
* @return
*/
public static String getOrderTime(){
DateFormat format2 = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
long myTime = (date.getTime() / 1000) + 19 * 24 * 60 * 60;
date.setTime(myTime * 1000);
String datestring = format2.format(date);
return datestring;
}
}
| [
"panyuanzhi@yongyida.com"
] | panyuanzhi@yongyida.com |
eb1b285ec4f94c70b850d81d593a416f35e6884e | 15928c1d2f7db42a97c8db83fbb541a1e55cada6 | /group-travel-assistant-android/app/src/main/java/com/fpt/gta/App.java | 0eb6c9f18b8fc5b0a1905b7bdbb3f5895faea39d | [] | no_license | Duongnvse62382/grouptravel | a11ee5548071d3d05b291be5012402a8dbcbc625 | 97f8115bcc657f1189a0486a31aa7ac79f06a4ef | refs/heads/main | 2022-12-30T13:27:48.921378 | 2020-10-13T11:26:35 | 2020-10-13T11:26:35 | 303,672,652 | 2 | 0 | null | 2020-10-13T11:18:12 | 2020-10-13T10:54:04 | null | UTF-8 | Java | false | false | 1,451 | java | package com.fpt.gta;
import android.app.Application;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
public class App extends Application {
private static Resources resources;
private static Context context;
public static final String CHANNEL_ID = "com.fpt.gta";
@Override
public void onCreate() {
super.onCreate();
resources = getResources();
context=getApplicationContext();
createNotificationChannel();
}
private void createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
CharSequence name = getString(R.string.channel_name);
String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, importance);
channel.setDescription(description);
channel.setImportance(NotificationManager.IMPORTANCE_HIGH);
NotificationManager manager = getSystemService(NotificationManager.class);
manager.createNotificationChannel(channel);
}
}
public static Resources getAppResources() {
return resources;
}
public static Context getAppContext() {
return App.context;
}
}
| [
"51112107+Duongnvse62382@users.noreply.github.com"
] | 51112107+Duongnvse62382@users.noreply.github.com |
fc00d89a912b5c5d0cf3dfb36e71bb27a0de5810 | 16b5d51ab0409cbb5a1da9eacb9948a54acd6258 | /app/src/main/java/com/haoche51/checker/entity/VehicleBrandEntity.java | 791a7e0af8d7d3ae02e0af91a49c843c5259e724 | [] | no_license | liyq1406/haochebang | c3405a537d4f695ca51cb26d7889e952c6965eea | 12727fcca80c85aa9586bd58fe9b16c98fa1bf5b | refs/heads/master | 2021-01-17T21:20:31.261785 | 2017-02-28T04:52:06 | 2017-02-28T04:52:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 974 | java | package com.haoche51.checker.entity;
public class VehicleBrandEntity extends BaseEntity {
private int id = 0;
private String name = "";
private String pinyin = "";
private String first_char = "";
private String img_url = "";
public static VehicleBrandEntity parseFromJson(String jsonString) {
return gson.fromJson(jsonString, VehicleBrandEntity.class);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPinyin() {
return pinyin;
}
public void setPinyin(String pinyin) {
this.pinyin = pinyin;
}
public String getFirst_char() {
return first_char;
}
public void setFirst_char(String first_char) {
this.first_char = first_char;
}
public String getImg_url() {
return img_url;
}
public void setImg_url(String img_url) {
this.img_url = img_url;
}
}
| [
"pengxianglin@haoche51.com"
] | pengxianglin@haoche51.com |
dcc08fe6c5df674848f05297488edd182ab84dc6 | e0fd595a98ca7a23ecf90f4c08801bf7e0361bf2 | /results_without_immortals/pristine2/jena2/jena-arq/src/main/java/org/apache/jena/riot/RDFLanguages.java | b3ad386256fa7930b2f74b7ea0254c6e39f63603 | [
"Apache-2.0"
] | permissive | amchristi/AdFL | 690699a1c3d0d0e84e412b79826aa1b51b572979 | 40c879e7fe5f87afbf4abc29e442a6e37b1e6541 | refs/heads/master | 2021-12-15T11:43:07.539575 | 2019-07-18T05:56:21 | 2019-07-18T05:56:21 | 176,834,877 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,797 | 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.jena.riot;
import static org.apache.jena.riot.WebContent.* ;
import java.util.Collection ;
import java.util.Collections ;
import java.util.HashMap;
import java.util.Locale ;
import java.util.Map ;
import org.apache.jena.atlas.logging.Log ;
import org.apache.jena.atlas.web.ContentType ;
import org.apache.jena.atlas.web.MediaType ;
import org.apache.jena.util.FileUtils ;
/** Central registry of RDF languages and syntaxes.
* @see RDFParserRegistry
* @see RDFFormat
*/
public class RDFLanguages
{
// Display names
public static final String strLangRDFXML = "RDF/XML" ;
public static final String strLangTurtle = "Turtle" ;
public static final String strLangNTriples = "N-Triples" ;
public static final String strLangN3 = "N3" ;
public static final String strLangRDFJSON = "RDF/JSON" ;
public static final String strLangJSONLD = "JSON-LD" ;
public static final String strLangNQuads = "N-Quads" ;
public static final String strLangTriG = "TriG" ;
public static final String strLangCSV = "CSV";
public static final String strLangTriX = "TriX";
public static final String strLangRDFTHRIFT = "RDF-THRIFT";
/*
* ".owl" is not a formally registered file extension for OWL
* using RDF/XML. It was mentioned in OWL1 (when there was
* formally only one syntax for publishing RDF).
*
* OWL2 does not mention it.
*
* ".owx" is the OWL direct XML syntax.
*/
/** <a href="http://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML</a> */
public static final Lang RDFXML = LangBuilder.create(strLangRDFXML, contentTypeRDFXML)
.addAltNames("RDFXML", "RDF/XML-ABBREV", "RDFXML-ABBREV")
.addFileExtensions("rdf", "owl", "xml")
.build() ;
/** <a href="http://www.w3.org/TR/turtle/">Turtle</a>*/
public static final Lang TURTLE = LangBuilder.create(strLangTurtle, contentTypeTurtle)
.addAltNames("TTL")
.addAltContentTypes(contentTypeTurtleAlt1, contentTypeTurtleAlt2)
.addFileExtensions("ttl")
.build() ;
/** Alternative constant for {@link #TURTLE} */
public static final Lang TTL = TURTLE ;
/** N3 (treat as Turtle) */
public static final Lang N3 = LangBuilder.create(strLangN3, contentTypeN3)
.addAltContentTypes(contentTypeN3, contentTypeN3Alt1, contentTypeN3Alt2)
.addFileExtensions("n3")
.build() ;
/** <a href="http://www.w3.org/TR/n-triples/">N-Triples</a>*/
public static final Lang NTRIPLES = LangBuilder.create(strLangNTriples, contentTypeNTriples)
.addAltNames("NT", "NTriples", "NTriple", "N-Triple", "N-Triples")
// Remove? Causes more trouble than it's worth.
.addAltContentTypes(contentTypeNTriplesAlt)
.addFileExtensions("nt")
.build() ;
/** Alternative constant for {@link #NTRIPLES} */
public static final Lang NT = NTRIPLES ;
/** <a href="http://www.w3.org/TR/json-ld/">JSON-LD</a>. */
public static final Lang JSONLD = LangBuilder.create(strLangJSONLD, "application/ld+json")
.addAltNames("JSONLD")
.addFileExtensions("jsonld")
.build() ;
/** <a href="http://www.w3.org/TR/rdf-json/">RDF/JSON</a>. This is not <a href="http://www.w3.org/TR/json-ld/">JSON-LD</a>. */
public static final Lang RDFJSON = LangBuilder.create(strLangRDFJSON, contentTypeRDFJSON)
.addAltNames("RDFJSON")
.addFileExtensions("rj")
.build() ;
/** <a href="http://www.w3.org/TR/trig/">TriG</a> */
public static final Lang TRIG = LangBuilder.create(strLangTriG, contentTypeTriG)
.addAltContentTypes(contentTypeTriGAlt1, contentTypeTriGAlt2)
.addFileExtensions("trig")
.build() ;
/** <a href="http://www.w3.org/TR/n-quads">N-Quads</a> */
public static final Lang NQUADS = LangBuilder.create(strLangNQuads, contentTypeNQuads)
.addAltNames("NQ", "NQuads", "NQuad", "N-Quad", "N-Quads")
.addAltContentTypes(contentTypeNQuadsAlt1, contentTypeNQuadsAlt2)
.addFileExtensions("nq")
.build() ;
/** Alternative constant {@link #NQUADS} */
public static final Lang NQ = NQUADS ;
/** CSV data. This can be read into an RDF model with simple conversion */
public static final Lang CSV = LangBuilder.create(strLangCSV, contentTypeTextCSV)
.addAltNames("csv")
.addFileExtensions("csv")
.build() ;
/** The RDF syntax "RDF Thrift" : see http://jena.apache.org/documentation/io */
public static final Lang THRIFT = LangBuilder.create(strLangRDFTHRIFT, contentTypeRDFThrift)
.addAltNames("RDF_THRIFT", "RDFTHRIFT", "RDF/THRIFT", "TRDF")
.addFileExtensions("rt", "trdf")
.build() ;
/** Text */
public static final Lang TEXT = LangBuilder.create("text", contentTypeTextPlain)
.addAltNames("TEXT")
.addFileExtensions("txt")
.build() ;
/** TriX */
public static final Lang TRIX = LangBuilder.create(strLangTriX, contentTypeTriX)
.addAltContentTypes(contentTypeTriXxml)
.addAltNames("TRIX", "trix")
// Extension "xml" is used for RDF/XML.
.addFileExtensions("trix")
.build() ;
/** The "null" language */
public static final Lang RDFNULL = LangBuilder.create("rdf/null", "null/rdf")
.addAltNames("NULL", "null")
.build() ;
// ---- Central registry
/** Mapping of colloquial name to language */
private static Map<String, Lang> mapLabelToLang = new HashMap<>() ;
// For testing mainly.
public static Collection<Lang> getRegisteredLanguages() { return Collections.unmodifiableCollection(mapLabelToLang.values()); }
/** Mapping of content type (main and alternatives) to language */
private static Map<String, Lang> mapContentTypeToLang = new HashMap<>() ;
/** Mapping of file extension to language */
private static Map<String, Lang> mapFileExtToLang = new HashMap<>() ;
// ----------------------
public static void init() {}
static { init$() ; }
private static synchronized void init$()
{
initStandard() ;
// Needed to avoid a class initialization loop.
Lang.RDFXML = RDFLanguages.RDFXML ;
Lang.NTRIPLES = RDFLanguages.NTRIPLES ;
Lang.NT = RDFLanguages.NT ;
Lang.N3 = RDFLanguages.N3 ;
Lang.TURTLE = RDFLanguages.TURTLE ;
Lang.TTL = RDFLanguages.TTL ;
Lang.JSONLD = RDFLanguages.JSONLD ;
Lang.RDFJSON = RDFLanguages.RDFJSON ;
Lang.NQUADS = RDFLanguages.NQUADS ;
Lang.NQ = RDFLanguages.NQ ;
Lang.TRIG = RDFLanguages.TRIG ;
Lang.RDFTHRIFT = RDFLanguages.THRIFT ;
Lang.CSV = RDFLanguages.CSV ;
Lang.TRIX = RDFLanguages.TRIX ;
Lang.RDFNULL = RDFLanguages.RDFNULL ;
}
// ----------------------
/** Standard built-in languages */
private static void initStandard()
{
register(RDFXML) ;
register(TURTLE) ;
register(N3) ;
register(NTRIPLES) ;
register(JSONLD) ;
register(RDFJSON) ;
register(TRIG) ;
register(NQUADS) ;
register(THRIFT) ;
register(CSV) ;
register(TRIX) ;
register(RDFNULL) ;
// Check for JSON-LD engine.
String clsName = "com.github.jsonldjava.core.JsonLdProcessor" ;
try {
Class.forName(clsName) ;
} catch (ClassNotFoundException ex) {
Log.warn(RDFLanguages.class, "java-jsonld classes not on the classpath - JSON-LD input-output not available.") ;
Log.warn(RDFLanguages.class, "Minimum jarfiles are jsonld-java, jackson-core, jackson-annotations") ;
Log.warn(RDFLanguages.class, "If using a Jena distribution, put all jars in the lib/ directory on the classpath") ;
return ;
}
}
/** Register a language.
* To create a {@link Lang} object use {@link LangBuilder}.
* See also
* {@link RDFParserRegistry#registerLang}
* for registering a language and it's RDF parser fatory.
*
* @see RDFParserRegistry
*/
public static void register(Lang lang)
{
if ( lang == null )
throw new IllegalArgumentException("null for language") ;
checkRegistration(lang) ;
mapLabelToLang.put(canonicalKey(lang.getLabel()), lang) ;
for (String altName : lang.getAltNames() )
mapLabelToLang.put(canonicalKey(altName), lang) ;
mapContentTypeToLang.put(canonicalKey(lang.getContentType().getContentType()), lang) ;
for ( String ct : lang.getAltContentTypes() )
mapContentTypeToLang.put(canonicalKey(ct), lang) ;
for ( String ext : lang.getFileExtensions() )
{
if ( ext.startsWith(".") )
ext = ext.substring(1) ;
mapFileExtToLang.put(canonicalKey(ext), lang) ;
}
}
private static void checkRegistration(Lang lang)
{
if ( lang == null )
return ;
String label = canonicalKey(lang.getLabel()) ;
Lang lang2 = mapLabelToLang.get(label) ;
if ( lang2 == null )
return ;
if ( lang.equals(lang2) )
return ;
// Content type.
if ( mapContentTypeToLang.containsKey(lang.getContentType().getContentType()))
{
String k = lang.getContentType().getContentType() ;
error("Language overlap: " +lang+" and "+mapContentTypeToLang.get(k)+" on content type "+k) ;
}
for (String altName : lang.getAltNames() )
if ( mapLabelToLang.containsKey(altName) )
error("Language overlap: " +lang+" and "+mapLabelToLang.get(altName)+" on name "+altName) ;
for (String ct : lang.getAltContentTypes() )
if ( mapContentTypeToLang.containsKey(ct) )
error("Language overlap: " +lang+" and "+mapContentTypeToLang.get(ct)+" on content type "+ct) ;
for (String ext : lang.getFileExtensions() )
if ( mapFileExtToLang.containsKey(ext) )
error("Language overlap: " +lang+" and "+mapFileExtToLang.get(ext)+" on file extension type "+ext) ;
}
/** Remove a regsitration of a language - this also removes all recorded mapping
* of content types and file extensions.
*/
public static void unregister(Lang lang)
{
if ( lang == null )
throw new IllegalArgumentException("null for language") ;
checkRegistration(lang) ;
mapLabelToLang.remove(canonicalKey(lang.getLabel())) ;
mapContentTypeToLang.remove(canonicalKey(lang.getContentType().getContentType())) ;
for ( String ct : lang.getAltContentTypes() )
mapContentTypeToLang.remove(canonicalKey(ct)) ;
for ( String ext : lang.getFileExtensions() )
mapFileExtToLang.remove(canonicalKey(ext)) ;
}
public static boolean isRegistered(Lang lang)
{
if ( lang == null )
throw new IllegalArgumentException("null for language") ;
String label = canonicalKey(lang.getLabel()) ;
Lang lang2 = mapLabelToLang.get(label) ;
if ( lang2 == null )
return false ;
checkRegistration(lang) ;
return true ;
}
/** return true if the language is registered as a triples language */
public static boolean isTriples(Lang lang) { return RDFParserRegistry.isTriples(lang) ; }
/** return true if the language is registered as a quads language */
public static boolean isQuads(Lang lang) { return RDFParserRegistry.isQuads(lang) ; }
/** Map a content type (without charset) to a {@link Lang} */
public static Lang contentTypeToLang(String contentType)
{
if ( contentType == null )
return null ;
String key = canonicalKey(contentType) ;
return mapContentTypeToLang.get(key) ;
}
/** Map a content type (without charset) to a {@link Lang} */
public static Lang contentTypeToLang(ContentType ct)
{
if ( ct == null )
return null ;
String key = canonicalKey(ct.getContentType()) ;
return mapContentTypeToLang.get(key) ;
}
public static String getCharsetForContentType(String contentType)
{
MediaType ct = MediaType.create(contentType) ;
if ( ct.getCharset() != null )
return ct.getCharset() ;
String mt = ct.getContentType() ;
if ( contentTypeNTriples.equals(mt) ) return charsetUTF8 ;
if ( contentTypeNTriplesAlt.equals(mt) ) return charsetASCII ;
if ( contentTypeNQuads.equals(mt) ) return charsetUTF8 ;
if ( contentTypeNQuadsAlt1.equals(mt) ) return charsetASCII ;
if ( contentTypeNQuadsAlt2.equals(mt) ) return charsetASCII ;
return charsetUTF8 ;
}
/** Map a colloquial name (e.g. "Turtle") to a {@link Lang} */
public static Lang shortnameToLang(String label)
{
if ( label == null )
return null ;
String key = canonicalKey(label) ;
return mapLabelToLang.get(key) ;
}
/** Try to map a file extension to a {@link Lang}; return null on no registered mapping */
public static Lang fileExtToLang(String ext)
{
if ( ext == null ) return null ;
if ( ext.startsWith(".") )
ext = ext.substring(1) ;
ext = canonicalKey(ext) ;
return mapFileExtToLang.get(ext) ;
}
/** Try to map a resource name to a {@link Lang}; return null on no registered mapping */
public static Lang resourceNameToLang(String resourceName) { return filenameToLang(resourceName) ; }
/** Try to map a resource name to a {@link Lang}; return the given default where there is no registered mapping */
public static Lang resourceNameToLang(String resourceName, Lang dftLang) { return filenameToLang(resourceName, dftLang) ; }
/** Try to map a file name to a {@link Lang}; return null on no registered mapping */
public static Lang filenameToLang(String filename)
{
if ( filename == null ) return null ;
if ( filename.endsWith(".gz") )
filename = filename.substring(0, filename.length()-3) ;
return fileExtToLang(FileUtils.getFilenameExt(filename)) ;
}
/** Try to map a file name to a {@link Lang}; return the given default where there is no registered mapping */
public static Lang filenameToLang(String filename, Lang dftLang)
{
Lang lang = filenameToLang(filename) ;
return (lang == null) ? dftLang : lang ;
}
/** Turn a name for a language into a {@link Lang} object.
* The name can be a label, or a content type.
*/
public static Lang nameToLang(String langName)
{
if ( langName == null )
return null ;
Lang lang = shortnameToLang(langName) ;
if ( lang != null )
return lang ;
lang = contentTypeToLang(langName) ;
return lang ;
}
static String canonicalKey(String x) { return x.toLowerCase(Locale.ROOT) ; }
public static ContentType guessContentType(String resourceName)
{
if ( resourceName == null )
return null ;
Lang lang = filenameToLang(resourceName) ;
if ( lang == null )
return null ;
return lang.getContentType() ;
}
private static void error(String message)
{
throw new RiotException(message) ;
}
public static boolean sameLang(Lang lang1, Lang lang2)
{
if ( lang1 == null || lang2 == null ) return false ;
if ( lang1 == lang2 ) return true ;
return lang1.getLabel() == lang2.getLabel() ;
}
}
| [
"amchristi@bitbucket.org"
] | amchristi@bitbucket.org |
17c4608edd53f52e66e391fd54d90edd1b68ac3b | bb13c58a58ae28aa42f2f2cc4be31d6633c0a776 | /src/main/java/com/als/mall/mapper/CartMapper.java | 15ad2866d700246c56c572e8baddd571c8f73659 | [] | no_license | aionrepository/mall | 3d62319800ec884b4b2a4f8a644d26ff6e52955b | 97db945d88241c708d703fe84d129c319fd58e00 | refs/heads/main | 2023-02-10T14:06:46.474368 | 2021-01-10T13:22:59 | 2021-01-10T13:22:59 | 328,376,906 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 645 | java | package com.als.mall.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.als.mall.entity.Cart;
import com.als.mall.vo.CartVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@Mapper
public interface CartMapper extends BaseMapper<Cart>{
@Select("SELECT cart.id, product_id, quantity, cost, \r\n" +
" NAME, price, stock, file_name FROM cart \r\n" +
" LEFT JOIN product ON product_id = product.`id`\r\n" +
" WHERE user_id = #{userId}")
List<CartVO> queryAllByUserId(@Param("userId")int userId);
}
| [
"ai_lin_sen@qq.com"
] | ai_lin_sen@qq.com |
348902383c80d729dbcd3fcc902218c7f99d3b6b | f85c64e04cf0b42fcbddbacd84e6465d18c46d64 | /trunk/java/src/main/java/com/joyadata/tjlog/controller/TagController.java | c576f5be12b5a436ace1d1f0fcf98b3558d87e49 | [] | no_license | xc1124646582/tianJin | bfbeffe0ce78585757a09056607f8a433ffab071 | db6d1fb44fbb4e625694609cef9d2c59b5ddd214 | refs/heads/master | 2021-08-23T09:20:53.647203 | 2017-12-04T13:25:41 | 2017-12-04T13:25:41 | 113,043,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,332 | java | package com.joyadata.tjlog.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.joyadata.tjlog.model.DataTagReg;
import com.joyadata.tjlog.model.Tag;
import com.joyadata.tjlog.model.TagReg;
import com.joyadata.tjlog.service.TagService;
import com.joyadata.tjlog.util.Generator;
import com.joyadata.tjlog.util.Response;
import com.joyadata.tjlog.util.ResponseFactory;
/**
* 标签操作
*
* @ClassName: TagController
* @Description: TagController
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:47:36
*
*/
@Controller
public class TagController {
@Autowired
private TagService tagService;
/**
*
* @Description: 获取标签
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/tags", method = RequestMethod.GET)
public Response<List<Tag>> getTags() {
List<Tag> list = tagService.getAllTags();
return ResponseFactory.makeResponse(list);
}
/**
*
* @Description: 删除标签
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/tags/{tagId}", method = RequestMethod.DELETE)
public Response<Tag> delTag(@PathVariable String tagId) {
tagService.deleteTag(tagId);
Tag tag = new Tag();
tag.setId(tagId);
return ResponseFactory.makeResponse(tag);
}
/**
*
* @Description: 创建标签
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/tag", method = RequestMethod.POST)
public Response<Tag> tag(String name) {
Tag tag = new Tag();
tag.setName(name);
tag.setId(Generator.uuid());
tagService.addTag(tag);
return ResponseFactory.makeResponse(tag);
}
/**
*
* @Description: 获取标签匹配规则
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/tags/{id}/regs", method = RequestMethod.GET)
public Response<List<TagReg>> tagReg(@PathVariable String id) {
List<TagReg> list = tagService.getTagReg(id);
return ResponseFactory.makeResponse(list);
}
/**
*
* @Description: 添加标签匹配规则
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/tags/{id}/reg", method = RequestMethod.POST)
public Response<TagReg> addReg(@PathVariable String id) {
TagReg reg = new TagReg();
reg.setId(Generator.uuid());
reg.setTagId(id);
tagService.addTagReg(reg);
return ResponseFactory.makeResponse(reg);
}
/**
*
* @Description: 删除标签匹配规则
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/tags/{tagId}/regs/{regId}", method = RequestMethod.DELETE)
public Response<TagReg> delReg(@PathVariable String tagId, @PathVariable String regId) {
tagService.delTagReg(regId);
TagReg reg = new TagReg();
reg.setTagId(tagId);
reg.setId(regId);
return ResponseFactory.makeResponse(reg);
}
/**
*
* @Description: 更新标签匹配规则
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/tags/{tagId}/regs/{regId}", method = RequestMethod.POST)
public Response<TagReg> regUpdate(@PathVariable String tagId, @PathVariable String regId, String field,
String group, String regStr) {
TagReg reg = new TagReg();
reg.setId(regId);
reg.setTagId(tagId);
reg.setField(field);
reg.setGroup(group);
reg.setRegStr(regStr);
tagService.updateTagReg(reg);
return ResponseFactory.makeResponse(reg);
}
/**
*
* @Description: 添加数据标签
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/log/reg", method = RequestMethod.POST)
public Response<DataTagReg> addDataTagReg() {
DataTagReg reg = new DataTagReg();
reg.setId(Generator.uuid());
tagService.addDataTagReg(reg);
return ResponseFactory.makeResponse(reg);
}
/**
*
* @Description: 获取数据标签列表
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/log/regs", method = RequestMethod.GET)
public Response<List<DataTagReg>> getDataTagReg() {
List<DataTagReg> list = tagService.getAllDataTagReg();
return ResponseFactory.makeResponse(list);
}
/**
*
* @Description: 更新数据标签
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/log/reg/{id}", method = RequestMethod.POST)
public Response<DataTagReg> updateDataTagReg(@PathVariable String id, String tagId, String regStr, String status) {
DataTagReg reg = new DataTagReg();
reg.setId(id);
reg.setTagId(tagId);
reg.setRegStr(regStr);
reg.setStatus(status);
tagService.updateDataTagReg(reg);
return ResponseFactory.makeResponse(reg);
}
/**
*
* @Description: 删除数据标签
* @param name
* @return
* @author 黄宏强 st8817@163.com
* @date 2017年11月21日 上午10:03:32
* @version V1.0
*/
@ResponseBody
@RequestMapping(value = "/data/log/reg/{id}", method = RequestMethod.DELETE)
public Response<DataTagReg> delDataTagReg(@PathVariable String id) {
DataTagReg reg = new DataTagReg();
reg.setId(id);
tagService.delDataTagReg(id);
return ResponseFactory.makeResponse(reg);
}
}
| [
"1124646582@qq.com"
] | 1124646582@qq.com |
2a80948732db9c9e7f69a1106f26f28852f1f19a | ceb27b4a8c0787f5717187567807fbe0c4781614 | /src/main/java/com/example/northwind/dataAccess/concretes/OrderDetailRepository.java | 28072f1676f53590e7464213519f88f399e41793 | [] | no_license | fatmanursaritemur/FinalProject-T | c60053a8397ac343b44cfce886d81b2ec60e2fee | 21a4b5824a07ba81dd2cbd61735ea244f9517511 | refs/heads/master | 2023-03-04T17:16:20.645673 | 2021-02-17T17:45:45 | 2021-02-17T17:45:45 | 339,807,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 422 | java | package com.example.northwind.dataAccess.concretes;
import com.example.northwind.entities.concretes.OrderDetail;
import com.example.northwind.entities.concretes.OrderDetailIdentity;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
public interface OrderDetailRepository extends JpaRepository<OrderDetail, OrderDetailIdentity> {
List<OrderDetail> findAllByIdOrderId(int orderId);
}
| [
"fatmanursaritemur@gmail.com"
] | fatmanursaritemur@gmail.com |
ea83eb536c3f35f09e6f4c9bf66382def7d38a4f | 618f5940052ae2323cdd015df392a10a85d644be | /common/src/main/java/com/example/hdd/common/util/CloseUtils.java | a02f57b088ece5173feb29c6bfb7abf3665af8d7 | [] | no_license | 710330668/MoreCharge | af0194cb1ca14698a674d9db0b6ce6b3a53a61e1 | fad135f1d7c7e468413584630ee64ab593093a6d | refs/heads/master | 2020-04-06T16:51:03.562746 | 2018-12-10T14:36:40 | 2018-12-10T14:36:40 | 157,636,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,250 | java | package com.example.hdd.common.util;
import java.io.Closeable;
import java.io.IOException;
/**
* <pre>
* closeIO : 关闭 IO
* closeIOQuietly: 安静关闭 IO
* </pre>
*/
public final class CloseUtils {
private CloseUtils() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
/**
* Close the io stream.
*
* @param closeables closeables
*/
public static void closeIO(final Closeable... closeables) {
if (closeables == null) return;
for (Closeable closeable : closeables) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
/**
* Close the io stream quietly.
*
* @param closeables closeables
*/
public static void closeIOQuietly(final Closeable... closeables) {
if (closeables == null) return;
for (Closeable closeable : closeables) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException ignored) {
}
}
}
}
}
| [
"qq452608069@sina.com"
] | qq452608069@sina.com |
9e5a1e5f8e4dec4c8fb5d9c290ad302854bdef3b | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_f96795b64045c9e9f932b0f0bc9a36d6163aaa0f/Chunk/3_f96795b64045c9e9f932b0f0bc9a36d6163aaa0f_Chunk_s.java | 49cb85170f167e8fed3206ae61ea9379b70ccccf | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 32,257 | java | package net.minecraft.server;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.canarymod.Canary;
import net.canarymod.PortalReconstructJob;
import net.canarymod.api.world.CanaryChunk;
import net.canarymod.api.world.blocks.BlockType;
import net.canarymod.api.world.blocks.CanaryBlock;
import net.canarymod.hook.world.PortalDestroyHook;
import net.canarymod.tasks.ServerTaskManager;
public class Chunk {
public static boolean a;
private ExtendedBlockStorage[] r;
private byte[] s;
public int[] b;
public boolean[] c;
public boolean d;
public World e;
public int[] f;
public final int g;
public final int h;
private boolean t;
public Map i;
public List[] j;
public boolean k;
public boolean l;
public boolean m;
public long n;
public boolean o;
public int p;
private int u;
boolean q;
// CanaryMod Chunk handler
private CanaryChunk canaryChunk;
public Chunk(World world, int i0, int i1) {
this.r = new ExtendedBlockStorage[16];
this.s = new byte[256];
this.b = new int[256];
this.c = new boolean[256];
this.t = false;
this.i = new HashMap();
this.k = false;
this.l = false;
this.m = false;
this.n = 0L;
this.o = false;
this.p = 0;
this.u = 4096;
this.q = false;
this.j = new List[16];
this.e = world;
this.g = i0;
this.h = i1;
this.f = new int[256];
for (int i2 = 0; i2 < this.j.length; ++i2) {
this.j[i2] = new ArrayList();
}
Arrays.fill(this.b, -999);
Arrays.fill(this.s, (byte) -1);
canaryChunk = new CanaryChunk(this); // CanaryMod: wrap chunk
}
public Chunk(World world, byte[] abyte, int i0, int i1) {
this(world, i0, i1);
int i2 = abyte.length / 256;
for (int i3 = 0; i3 < 16; ++i3) {
for (int i4 = 0; i4 < 16; ++i4) {
for (int i5 = 0; i5 < i2; ++i5) {
byte b0 = abyte[i3 << 11 | i4 << 7 | i5];
if (b0 != 0) {
int i6 = i5 >> 4;
if (this.r[i6] == null) {
this.r[i6] = new ExtendedBlockStorage(i6 << 4, !world.t.f);
}
this.r[i6].a(i3, i5 & 15, i4, b0);
}
}
}
}
canaryChunk = new CanaryChunk(this); // CanaryMod: wrap chunk
}
public boolean a(int i0, int i1) {
return i0 == this.g && i1 == this.h;
}
public int b(int i0, int i1) {
return this.f[i1 << 4 | i0];
}
public int h() {
for (int i0 = this.r.length - 1; i0 >= 0; --i0) {
if (this.r[i0] != null) {
return this.r[i0].d();
}
}
return 0;
}
public ExtendedBlockStorage[] i() {
return this.r;
}
public void b() {
int i0 = this.h();
this.p = Integer.MAX_VALUE;
int i1;
int i2;
for (i1 = 0; i1 < 16; ++i1) {
i2 = 0;
while (i2 < 16) {
this.b[i1 + (i2 << 4)] = -999;
int i3 = i0 + 16 - 1;
while (true) {
if (i3 > 0) {
if (this.b(i1, i3 - 1, i2) == 0) {
--i3;
continue;
}
this.f[i2 << 4 | i1] = i3;
if (i3 < this.p) {
this.p = i3;
}
}
if (!this.e.t.f) {
i3 = 15;
int i4 = i0 + 16 - 1;
do {
i3 -= this.b(i1, i4, i2);
if (i3 > 0) {
ExtendedBlockStorage extendedblockstorage = this.r[i4 >> 4];
if (extendedblockstorage != null) {
extendedblockstorage.c(i1, i4 & 15, i2, i3);
this.e.p((this.g << 4) + i1, i4, (this.h << 4) + i2);
}
}
--i4;
} while (i4 > 0 && i3 > 0);
}
++i2;
break;
}
}
}
this.l = true;
for (i1 = 0; i1 < 16; ++i1) {
for (i2 = 0; i2 < 16; ++i2) {
this.e(i1, i2);
}
}
}
private void e(int i0, int i1) {
this.c[i0 + i1 * 16] = true;
this.t = true;
}
private void q() {
this.e.C.a("recheckGaps");
if (this.e.b(this.g * 16 + 8, 0, this.h * 16 + 8, 16)) {
for (int i0 = 0; i0 < 16; ++i0) {
for (int i1 = 0; i1 < 16; ++i1) {
if (this.c[i0 + i1 * 16]) {
this.c[i0 + i1 * 16] = false;
int i2 = this.b(i0, i1);
int i3 = this.g * 16 + i0;
int i4 = this.h * 16 + i1;
int i5 = this.e.g(i3 - 1, i4);
int i6 = this.e.g(i3 + 1, i4);
int i7 = this.e.g(i3, i4 - 1);
int i8 = this.e.g(i3, i4 + 1);
if (i6 < i5) {
i5 = i6;
}
if (i7 < i5) {
i5 = i7;
}
if (i8 < i5) {
i5 = i8;
}
this.g(i3, i4, i5);
this.g(i3 - 1, i4, i2);
this.g(i3 + 1, i4, i2);
this.g(i3, i4 - 1, i2);
this.g(i3, i4 + 1, i2);
}
}
}
this.t = false;
}
this.e.C.b();
}
private void g(int i0, int i1, int i2) {
int i3 = this.e.f(i0, i1);
if (i3 > i2) {
this.d(i0, i1, i2, i3 + 1);
} else if (i3 < i2) {
this.d(i0, i1, i3, i2 + 1);
}
}
private void d(int i0, int i1, int i2, int i3) {
if (i3 > i2 && this.e.b(i0, 0, i1, 16)) {
for (int i4 = i2; i4 < i3; ++i4) {
this.e.c(EnumSkyBlock.a, i0, i4, i1);
}
this.l = true;
}
}
private void h(int i0, int i1, int i2) {
int i3 = this.f[i2 << 4 | i0] & 255;
int i4 = i3;
if (i1 > i3) {
i4 = i1;
}
while (i4 > 0 && this.b(i0, i4 - 1, i2) == 0) {
--i4;
}
if (i4 != i3) {
this.e.e(i0 + this.g * 16, i2 + this.h * 16, i4, i3);
this.f[i2 << 4 | i0] = i4;
int i5 = this.g * 16 + i0;
int i6 = this.h * 16 + i2;
int i7;
int i8;
if (!this.e.t.f) {
ExtendedBlockStorage extendedblockstorage;
if (i4 < i3) {
for (i7 = i4; i7 < i3; ++i7) {
extendedblockstorage = this.r[i7 >> 4];
if (extendedblockstorage != null) {
extendedblockstorage.c(i0, i7 & 15, i2, 15);
this.e.p((this.g << 4) + i0, i7, (this.h << 4) + i2);
}
}
} else {
for (i7 = i3; i7 < i4; ++i7) {
// CanaryMod start: Catch corrupt index info
if (i7 >> 4 < 0 || i7 >> 4 >= 16) {
Canary.logWarning("Invalid chunk info array index: " + (i7 >> 4));
Canary.logWarning("x: " + i3 + ", z: " + i4);
Canary.logWarning("Chunk location: " + i5 + ", " + i6);
i7 = 0;
}
// CanaryMod end
extendedblockstorage = this.r[i7 >> 4];
if (extendedblockstorage != null) {
extendedblockstorage.c(i0, i7 & 15, i2, 0);
this.e.p((this.g << 4) + i0, i7, (this.h << 4) + i2);
}
}
}
i7 = 15;
while (i4 > 0 && i7 > 0) {
--i4;
i8 = this.b(i0, i4, i2);
if (i8 == 0) {
i8 = 1;
}
i7 -= i8;
if (i7 < 0) {
i7 = 0;
}
ExtendedBlockStorage extendedblockstorage1 = this.r[i4 >> 4];
if (extendedblockstorage1 != null) {
extendedblockstorage1.c(i0, i4 & 15, i2, i7);
}
}
}
i7 = this.f[i2 << 4 | i0];
i8 = i3;
int i9 = i7;
if (i7 < i3) {
i8 = i7;
i9 = i3;
}
if (i7 < this.p) {
this.p = i7;
}
if (!this.e.t.f) {
this.d(i5 - 1, i6, i8, i9);
this.d(i5 + 1, i6, i8, i9);
this.d(i5, i6 - 1, i8, i9);
this.d(i5, i6 + 1, i8, i9);
this.d(i5, i6, i8, i9);
}
this.l = true;
}
}
public int b(int i0, int i1, int i2) {
return Block.t[this.a(i0, i1, i2)];
}
public int a(int i0, int i1, int i2) {
if (i1 >> 4 >= this.r.length) {
return 0;
} else {
ExtendedBlockStorage extendedblockstorage = this.r[i1 >> 4];
return extendedblockstorage != null ? extendedblockstorage.a(i0, i1 & 15, i2) : 0;
}
}
public int c(int i0, int i1, int i2) {
if (i1 >> 4 >= this.r.length) {
return 0;
} else {
ExtendedBlockStorage extendedblockstorage = this.r[i1 >> 4];
return extendedblockstorage != null ? extendedblockstorage.b(i0, i1 & 15, i2) : 0;
}
}
public boolean a(int i0, int i1, int i2, int i3, int i4) {
return this.a(i0, i1, i2, i3, i4, true); // CanaryMod: Redirect
}
public boolean a(int i0, int i1, int i2, int i3, int i4, boolean checkPortal) { // CanaryMod: add Portal Check
int i5 = i2 << 4 | i0;
if (i1 >= this.b[i5] - 1) {
this.b[i5] = -999;
}
int i6 = this.f[i5];
int i7 = this.a(i0, i1, i2);
int i8 = this.c(i0, i1, i2);
if (i7 == i3 && i8 == i4) {
return false;
} else {
// CanaryMod: Start - check if removed block is portal block
int portalPointX = this.g * 16 + i0;
int portalPointZ = this.h * 16 + i2;
if (checkPortal == true) {
int portalPointY = i1;
int portalId = BlockType.Portal.getId();
if (canaryChunk.getDimension().getBlockAt(portalPointX, portalPointY, portalPointZ).getTypeId() == portalId) {
// These will be equal 1 if the portal is defined on their axis and 0 if not.
int portalXOffset = (canaryChunk.getDimension().getBlockAt(portalPointX - 1, portalPointY, portalPointZ).getTypeId() == portalId || canaryChunk.getDimension().getBlockAt(portalPointX + 1, portalPointY, portalPointZ).getTypeId() == portalId) ? 1 : 0;
int portalZOffset = (canaryChunk.getDimension().getBlockAt(portalPointX, portalPointY, portalPointZ - 1).getTypeId() == portalId || canaryChunk.getDimension().getBlockAt(portalPointX, portalPointY, portalPointZ + 1).getTypeId() == portalId) ? 1 : 0;
// If the portal is either x aligned or z aligned but not both (has neighbor portal in x or z plane but not both)
if (portalXOffset != portalZOffset) {
// Get the edge of the portal.
int portalX = portalPointX - ((canaryChunk.getDimension().getBlockAt(portalPointX - 1, portalPointY, portalPointZ).getTypeId() == portalId) ? 1 : 0);
int portalZ = portalPointZ - ((canaryChunk.getDimension().getBlockAt(portalPointX, portalPointY, portalPointZ - 1).getTypeId() == portalId) ? 1 : 0);
int portalY = i1;
while (canaryChunk.getDimension().getBlockAt(portalX, ++portalY, portalZ).getTypeId() == portalId) {
;
}
portalY -= 1;
// Scan the portal and see if its still all there (2x3 formation)
boolean completePortal = true;
CanaryBlock[][] portalBlocks = new CanaryBlock[3][2];
for (int i9001 = 0; i9001 < 3 && completePortal; i9001 += 1) {
for (int i9002 = 0; i9002 < 2 && completePortal; i9002 += 1) {
portalBlocks[i9001][i9002] = (CanaryBlock) canaryChunk.getDimension().getBlockAt(portalX + i9002 * portalXOffset, portalY - i9001, portalZ + i9002 * portalZOffset);
if (portalBlocks[i9001][i9002].getTypeId() != portalId) {
completePortal = false;
}
}
}
if (completePortal == true) {
// CanaryMod: PortalDestroy
PortalDestroyHook hook = new PortalDestroyHook(portalBlocks);
Canary.hooks().callHook(hook);
if (hook.isCanceled()) {// Hook canceled = don't destroy the portal.
// in that case we need to reconstruct the portal's frame to make the portal valid.
// Problem is we don't want to reconstruct it right away because more blocks might be deleted (for example on explosion).
// In order to avoid spamming the hook for each destroyed block, I'm queuing the reconstruction of the portal instead.
ServerTaskManager.addTask(new PortalReconstructJob(this.e.getCanaryWorld(), portalX, portalY, portalZ, (portalXOffset == 1)));
}
}
}
}
}
// CanaryMod: End - check if removed block is portal block0.
ExtendedBlockStorage extendedblockstorage = this.r[i1 >> 4];
boolean flag0 = false;
if (extendedblockstorage == null) {
if (i3 == 0) {
return false;
}
extendedblockstorage = this.r[i1 >> 4] = new ExtendedBlockStorage(i1 >> 4 << 4, !this.e.t.f);
flag0 = i1 >= i6;
}
int i9 = this.g * 16 + i0;
int i10 = this.h * 16 + i2;
if (i7 != 0 && !this.e.I) {
Block.r[i7].l(this.e, i9, i1, i10, i8);
}
extendedblockstorage.a(i0, i1 & 15, i2, i3);
if (i7 != 0) {
if (!this.e.I) {
Block.r[i7].a(this.e, i9, i1, i10, i7, i8);
} else if (Block.r[i7] instanceof ITileEntityProvider && i7 != i3) {
this.e.s(i9, i1, i10);
}
}
if (extendedblockstorage.a(i0, i1 & 15, i2) != i3) {
return false;
} else {
extendedblockstorage.b(i0, i1 & 15, i2, i4);
if (flag0) {
this.b();
} else {
if (Block.t[i3 & 4095] > 0) {
if (i1 >= i6) {
this.h(i0, i1 + 1, i2);
}
} else if (i1 == i6 - 1) {
this.h(i0, i1, i2);
}
this.e(i0, i2);
}
TileEntity tileentity;
if (i3 != 0) {
if (!this.e.I) {
Block.r[i3].a(this.e, i9, i1, i10);
}
if (Block.r[i3] instanceof ITileEntityProvider) {
tileentity = this.e(i0, i1, i2);
if (tileentity == null) {
tileentity = ((ITileEntityProvider) Block.r[i3]).b(this.e);
this.e.a(i9, i1, i10, tileentity);
}
if (tileentity != null) {
tileentity.i();
}
}
} else if (i7 > 0 && Block.r[i7] instanceof ITileEntityProvider) {
tileentity = this.e(i0, i1, i2);
if (tileentity != null) {
tileentity.i();
}
}
this.l = true;
return true;
}
}
}
public boolean b(int i0, int i1, int i2, int i3) {
ExtendedBlockStorage extendedblockstorage = this.r[i1 >> 4];
if (extendedblockstorage == null) {
return false;
} else {
int i4 = extendedblockstorage.b(i0, i1 & 15, i2);
if (i4 == i3) {
return false;
} else {
this.l = true;
extendedblockstorage.b(i0, i1 & 15, i2, i3);
int i5 = extendedblockstorage.a(i0, i1 & 15, i2);
if (i5 > 0 && Block.r[i5] instanceof ITileEntityProvider) {
TileEntity tileentity = this.e(i0, i1, i2);
if (tileentity != null) {
tileentity.i();
tileentity.p = i3;
}
}
return true;
}
}
}
public int a(EnumSkyBlock enumskyblock, int i0, int i1, int i2) {
ExtendedBlockStorage extendedblockstorage = this.r[i1 >> 4];
return extendedblockstorage == null ? (this.d(i0, i1, i2) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.a ? (this.e.t.f ? 0 : extendedblockstorage.c(i0, i1 & 15, i2)) : (enumskyblock == EnumSkyBlock.b ? extendedblockstorage.d(i0, i1 & 15, i2) : enumskyblock.c));
}
public void a(EnumSkyBlock enumskyblock, int i0, int i1, int i2, int i3) {
ExtendedBlockStorage extendedblockstorage = this.r[i1 >> 4];
if (extendedblockstorage == null) {
extendedblockstorage = this.r[i1 >> 4] = new ExtendedBlockStorage(i1 >> 4 << 4, !this.e.t.f);
this.b();
}
this.l = true;
if (enumskyblock == EnumSkyBlock.a) {
if (!this.e.t.f) {
extendedblockstorage.c(i0, i1 & 15, i2, i3);
}
} else if (enumskyblock == EnumSkyBlock.b) {
extendedblockstorage.d(i0, i1 & 15, i2, i3);
}
}
public int c(int i0, int i1, int i2, int i3) {
ExtendedBlockStorage extendedblockstorage = this.r[i1 >> 4];
if (extendedblockstorage == null) {
return !this.e.t.f && i3 < EnumSkyBlock.a.c ? EnumSkyBlock.a.c - i3 : 0;
} else {
int i4 = this.e.t.f ? 0 : extendedblockstorage.c(i0, i1 & 15, i2);
if (i4 > 0) {
a = true;
}
i4 -= i3;
int i5 = extendedblockstorage.d(i0, i1 & 15, i2);
if (i5 > i4) {
i4 = i5;
}
return i4;
}
}
public void a(Entity entity) {
this.m = true;
int i0 = MathHelper.c(entity.u / 16.0D);
int i1 = MathHelper.c(entity.w / 16.0D);
if (i0 != this.g || i1 != this.h) {
this.e.W().c("Wrong location! " + entity);
// Thread.dumpStack();
entity.w();
return;
}
int i2 = MathHelper.c(entity.v / 16.0D);
if (i2 < 0) {
i2 = 0;
}
if (i2 >= this.j.length) {
i2 = this.j.length - 1;
}
entity.ai = true;
entity.aj = this.g;
entity.ak = i2;
entity.al = this.h;
this.j[i2].add(entity);
}
public void b(Entity entity) {
this.a(entity, entity.ak);
}
public void a(Entity entity, int i0) {
if (i0 < 0) {
i0 = 0;
}
if (i0 >= this.j.length) {
i0 = this.j.length - 1;
}
this.j[i0].remove(entity);
}
public boolean d(int i0, int i1, int i2) {
return i1 >= this.f[i2 << 4 | i0];
}
public TileEntity e(int i0, int i1, int i2) {
ChunkPosition chunkposition = new ChunkPosition(i0, i1, i2);
TileEntity tileentity = (TileEntity) this.i.get(chunkposition);
if (tileentity == null) {
int i3 = this.a(i0, i1, i2);
if (i3 <= 0 || !Block.r[i3].t()) {
return null;
}
if (tileentity == null) {
tileentity = ((ITileEntityProvider) Block.r[i3]).b(this.e);
this.e.a(this.g * 16 + i0, i1, this.h * 16 + i2, tileentity);
}
tileentity = (TileEntity) this.i.get(chunkposition);
}
if (tileentity != null && tileentity.r()) {
this.i.remove(chunkposition);
return null;
} else {
return tileentity;
}
}
public void a(TileEntity tileentity) {
int i0 = tileentity.l - this.g * 16;
int i1 = tileentity.m;
int i2 = tileentity.n - this.h * 16;
this.a(i0, i1, i2, tileentity);
if (this.d) {
this.e.g.add(tileentity);
}
}
public void a(int i0, int i1, int i2, TileEntity tileentity) {
ChunkPosition chunkposition = new ChunkPosition(i0, i1, i2);
tileentity.b(this.e);
tileentity.l = this.g * 16 + i0;
tileentity.m = i1;
tileentity.n = this.h * 16 + i2;
if (this.a(i0, i1, i2) != 0 && Block.r[this.a(i0, i1, i2)] instanceof ITileEntityProvider) {
if (this.i.containsKey(chunkposition)) {
((TileEntity) this.i.get(chunkposition)).w_();
}
tileentity.s();
this.i.put(chunkposition, tileentity);
}
}
public void f(int i0, int i1, int i2) {
ChunkPosition chunkposition = new ChunkPosition(i0, i1, i2);
if (this.d) {
TileEntity tileentity = (TileEntity) this.i.remove(chunkposition);
if (tileentity != null) {
tileentity.w_();
}
}
}
public void c() {
this.d = true;
this.e.a(this.i.values());
for (int i0 = 0; i0 < this.j.length; ++i0) {
this.e.a(this.j[i0]);
}
}
public void d() {
this.d = false;
Iterator iterator = this.i.values().iterator();
while (iterator.hasNext()) {
TileEntity tileentity = (TileEntity) iterator.next();
this.e.a(tileentity);
}
for (int i0 = 0; i0 < this.j.length; ++i0) {
this.e.b(this.j[i0]);
}
}
public void e() {
this.l = true;
}
public void a(Entity entity, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) {
int i0 = MathHelper.c((axisalignedbb.b - 2.0D) / 16.0D);
int i1 = MathHelper.c((axisalignedbb.e + 2.0D) / 16.0D);
if (i0 < 0) {
i0 = 0;
i1 = Math.max(i0, i1);
}
if (i1 >= this.j.length) {
i1 = this.j.length - 1;
i0 = Math.min(i0, i1);
}
for (int i2 = i0; i2 <= i1; ++i2) {
List list1 = this.j[i2];
for (int i3 = 0; i3 < list1.size(); ++i3) {
Entity entity1 = (Entity) list1.get(i3);
if (entity1 != entity && entity1.E.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
Entity[] aentity = entity1.an();
if (aentity != null) {
for (int i4 = 0; i4 < aentity.length; ++i4) {
entity1 = aentity[i4];
if (entity1 != entity && entity1.E.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
}
}
}
}
}
}
}
public void a(Class oclass0, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) {
int i0 = MathHelper.c((axisalignedbb.b - 2.0D) / 16.0D);
int i1 = MathHelper.c((axisalignedbb.e + 2.0D) / 16.0D);
if (i0 < 0) {
i0 = 0;
} else if (i0 >= this.j.length) {
i0 = this.j.length - 1;
}
if (i1 >= this.j.length) {
i1 = this.j.length - 1;
} else if (i1 < 0) {
i1 = 0;
}
for (int i2 = i0; i2 <= i1; ++i2) {
List list1 = this.j[i2];
for (int i3 = 0; i3 < list1.size(); ++i3) {
Entity entity = (Entity) list1.get(i3);
if (oclass0.isAssignableFrom(entity.getClass()) && entity.E.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity))) {
list.add(entity);
}
}
}
}
public boolean a(boolean flag0) {
if (flag0) {
if (this.m && this.e.G() != this.n || this.l) {
return true;
}
} else if (this.m && this.e.G() >= this.n + 600L) {
return true;
}
return this.l;
}
public Random a(long i0) {
return new Random(this.e.F() + (long) (this.g * this.g * 4987142) + (long) (this.g * 5947611) + (long) (this.h * this.h) * 4392871L + (long) (this.h * 389711) ^ i0);
}
public boolean g() {
return false;
}
public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i0, int i1) {
if (!this.k && ichunkprovider.a(i0 + 1, i1 + 1) && ichunkprovider.a(i0, i1 + 1) && ichunkprovider.a(i0 + 1, i1)) {
ichunkprovider.a(ichunkprovider1, i0, i1);
}
if (ichunkprovider.a(i0 - 1, i1) && !ichunkprovider.d(i0 - 1, i1).k && ichunkprovider.a(i0 - 1, i1 + 1) && ichunkprovider.a(i0, i1 + 1) && ichunkprovider.a(i0 - 1, i1 + 1)) {
ichunkprovider.a(ichunkprovider1, i0 - 1, i1);
}
if (ichunkprovider.a(i0, i1 - 1) && !ichunkprovider.d(i0, i1 - 1).k && ichunkprovider.a(i0 + 1, i1 - 1) && ichunkprovider.a(i0 + 1, i1 - 1) && ichunkprovider.a(i0 + 1, i1)) {
ichunkprovider.a(ichunkprovider1, i0, i1 - 1);
}
if (ichunkprovider.a(i0 - 1, i1 - 1) && !ichunkprovider.d(i0 - 1, i1 - 1).k && ichunkprovider.a(i0, i1 - 1) && ichunkprovider.a(i0 - 1, i1)) {
ichunkprovider.a(ichunkprovider1, i0 - 1, i1 - 1);
}
}
public int d(int i0, int i1) {
int i2 = i0 | i1 << 4;
int i3 = this.b[i2];
if (i3 == -999) {
int i4 = this.h() + 15;
i3 = -1;
while (i4 > 0 && i3 == -1) {
int i5 = this.a(i0, i4, i1);
Material material = i5 == 0 ? Material.a : Block.r[i5].cO;
if (!material.c() && !material.d()) {
--i4;
} else {
i3 = i4 + 1;
}
}
this.b[i2] = i3;
}
return i3;
}
public void k() {
if (this.t && !this.e.t.f) {
this.q();
}
}
public ChunkCoordIntPair l() {
return new ChunkCoordIntPair(this.g, this.h);
}
public boolean c(int i0, int i1) {
if (i0 < 0) {
i0 = 0;
}
if (i1 >= 256) {
i1 = 255;
}
for (int i2 = i0; i2 <= i1; i2 += 16) {
ExtendedBlockStorage extendedblockstorage = this.r[i2 >> 4];
if (extendedblockstorage != null && !extendedblockstorage.a()) {
return false;
}
}
return true;
}
public void a(ExtendedBlockStorage[] aextendedblockstorage) {
this.r = aextendedblockstorage;
}
public BiomeGenBase a(int i0, int i1, WorldChunkManager worldchunkmanager) {
int i2 = this.s[i1 << 4 | i0] & 255;
if (i2 == 255) {
BiomeGenBase biomegenbase = worldchunkmanager.a((this.g << 4) + i0, (this.h << 4) + i1);
i2 = biomegenbase.N;
this.s[i1 << 4 | i0] = (byte) (i2 & 255);
}
return BiomeGenBase.a[i2] == null ? BiomeGenBase.c : BiomeGenBase.a[i2];
}
public byte[] m() {
return this.s;
}
public void a(byte[] abyte) {
this.s = abyte;
}
public void n() {
this.u = 0;
}
public void o() {
for (int i0 = 0; i0 < 8; ++i0) {
if (this.u >= 4096) {
return;
}
int i1 = this.u % 16;
int i2 = this.u / 16 % 16;
int i3 = this.u / 256;
++this.u;
int i4 = (this.g << 4) + i2;
int i5 = (this.h << 4) + i3;
for (int i6 = 0; i6 < 16; ++i6) {
int i7 = (i1 << 4) + i6;
if (this.r[i1] == null && (i6 == 0 || i6 == 15 || i2 == 0 || i2 == 15 || i3 == 0 || i3 == 15) || this.r[i1] != null && this.r[i1].a(i2, i6, i3) == 0) {
if (Block.v[this.e.a(i4, i7 - 1, i5)] > 0) {
this.e.A(i4, i7 - 1, i5);
}
if (Block.v[this.e.a(i4, i7 + 1, i5)] > 0) {
this.e.A(i4, i7 + 1, i5);
}
if (Block.v[this.e.a(i4 - 1, i7, i5)] > 0) {
this.e.A(i4 - 1, i7, i5);
}
if (Block.v[this.e.a(i4 + 1, i7, i5)] > 0) {
this.e.A(i4 + 1, i7, i5);
}
if (Block.v[this.e.a(i4, i7, i5 - 1)] > 0) {
this.e.A(i4, i7, i5 - 1);
}
if (Block.v[this.e.a(i4, i7, i5 + 1)] > 0) {
this.e.A(i4, i7, i5 + 1);
}
this.e.A(i4, i7, i5);
}
}
}
}
// CanaryMod start
public CanaryChunk getCanaryChunk() {
return canaryChunk;
}
// CanaryMod end
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
fbf95802fa1778cf0952ab0c563b426c95caa5b6 | 264732c75c9dbfdbde13c505b8238c3dc19bb8f8 | /test/com/tw/biblioteca/TestSession.java | 859b6a0abb82071f3eda26802de4184ddb116fbf | [] | no_license | ShambhaviP/Biblioteca | 993b9c57a85b01f7943d968e3c605684c25169b3 | 551d689ba38e6d602abc187f15cc3e25f81415e6 | refs/heads/master | 2021-01-25T07:29:05.641978 | 2015-09-18T13:55:06 | 2015-09-18T13:55:06 | 41,843,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package com.tw.biblioteca;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TestSession {
@Test
public void shouldReturnCurrentUser() {
User user = new User("111-1111", "abcd", "CUSTOMER", "Elena Gilbert", "elena_gilbert@tvd.com", "+1 2345678901");
Session session = new Session(user);
assertEquals(user, session.getCurrentUser());
}
@Test
public void shouldSetTheLoggedInUserToCurrentUser() {
User user = new User("111-1111", "abcd", "CUSTOMER", "Elena Gilbert", "elena_gilbert@tvd.com", "+1 2345678901");
Session session = new Session(user);
session.setCurrentUser(user);
assertEquals(user, session.getCurrentUser());
}
} | [
"shambhap@thoughtworks.com"
] | shambhap@thoughtworks.com |
ddb323604b9c956eb37800afd33774f29e837c50 | 5d6407df82a953d7438f6042c916891c1d0ae968 | /finalpro/src/main/java/com/agile/service/impl/ProductImageServiceImpl.java | 70ec8f8ea33ba7847a5dbd7db64baacb1acc0e1f | [] | no_license | ahalzj/demo | 4aa217d90f7dc0b212b01d44dc523ab8a8739ec4 | f6fe3bdf0e4f0a7dd48225cab6785d3b6e51d841 | refs/heads/master | 2022-12-24T08:46:09.271777 | 2020-02-19T13:50:49 | 2020-02-19T13:50:49 | 241,634,273 | 0 | 0 | null | 2022-12-16T10:52:37 | 2020-02-19T13:54:19 | Java | UTF-8 | Java | false | false | 1,478 | java | package com.agile.service.impl;
import com.agile.dao.ProductImageDao;
import com.agile.pojo.ProductImage;
import com.agile.pojo.example.ProductImageExample;
import com.agile.service.ProductImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ProductImageServiceImpl implements ProductImageService {
@Autowired
private ProductImageDao productImageDao = null;
@Override
public void add(ProductImage image) {
productImageDao.insert(image);
}
@Override
public void deleteByProductId(Integer product_id) {
ProductImageExample example = new ProductImageExample();
example.or().andProduct_idEqualTo(product_id);
List<ProductImage> idList = productImageDao.selectByExample(example);
for (ProductImage productImage : idList) {
productImageDao.deleteByPrimaryKey(productImage.getId());
}
}
@Override
public void update(ProductImage image) {
productImageDao.updateByPrimaryKey(image);
}
@Override
public ProductImage get(Integer id) {
return productImageDao.selectByPrimaryKey(id);
}
@Override
public List<ProductImage> list(Integer product_id) {
ProductImageExample example = new ProductImageExample();
example.or().andIdEqualTo(product_id);
return productImageDao.selectByExample(example);
}
}
| [
"15001727895@163.com"
] | 15001727895@163.com |
1f8357baab9877f906b43a015456773461f171ba | d7be0cf96dae35a98dc1643011e025a28e3c92bd | /QZComm/src/main/java/com/ks/object/ValidObject.java | e81687cf0a0f4fd87773d4112bce3b0826be6de1 | [] | no_license | liaohanjie/QZStore | 8ab5827138266dc88179ee2cfb94c98d391c39be | 698d1e7d8386bca3b15fd4b3ea3020e5b9cc3c43 | refs/heads/master | 2021-01-10T18:35:14.604327 | 2016-05-31T05:17:50 | 2016-05-31T05:17:50 | 59,005,984 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 176 | java | package com.ks.object;
import lombok.Data;
@Data
public class ValidObject {
private int heroSize;
private int propSize;
private int eternalSize;
private int equipSize;
}
| [
"liaohanjie1314@126.com"
] | liaohanjie1314@126.com |
fc1d2d957a397ab25fd2e6a5e6aa1938385eacf9 | 13a8013ed218cf2800697bdd1c2cf4d1a97fc478 | /api-common/src/main/java/com/beidou/common/web/CustomSimpleMappingExceptionResolver.java | f8f53c77eec2688b5f641049078037b87612952b | [] | no_license | silencelwy/spiderFr | cf4e4e891c3f03cb5ac525d087042f3252b3fba5 | 2a75486be6ae44dc1c416ddc33d6b36c9c9ebe46 | refs/heads/master | 2023-04-15T00:12:02.134434 | 2016-11-11T09:59:49 | 2016-11-11T09:59:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,029 | java | package com.beidou.common.web;
import com.beidou.common.exception.ErrorCodeException;
import com.beidou.common.exception.NotLoginException;
import com.beidou.common.exception.ServiceException;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Administrator on 2015/6/26.
*/
public class CustomSimpleMappingExceptionResolver extends SimpleMappingExceptionResolver {
@Override
protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
String viewName = determineViewName(ex, request);
if (request.getRequestURL().indexOf(".htm")>-1) { // 如果不是异步请求
Integer statusCode = determineStatusCode(request, viewName);
if (statusCode != null) {
applyStatusCodeIfPossible(request, response, statusCode);
}
return getModelAndView(viewName, ex, request);
} else {// JSON,xml格式返回
Map<String, Object> map = new HashMap<String, Object>();
logger.info(ExceptionUtils.getFullStackTrace(ex));
if (ex instanceof ErrorCodeException) {
map.put("content",BaseController.getAjaxException(((ErrorCodeException) ex).getFormatErrorDesc()));
}else if (ex instanceof ServiceException) {
map.put("content",BaseController.getAjaxException(ex.getMessage()));
}else if (ex instanceof NotLoginException) {
map.put("content",BaseController.getAjaxNotLogin(ex.getMessage()));
}else{
map.put("content",BaseController.getAjaxException("系统异常"));
}
return new ModelAndView(viewName, map);
}
}
}
| [
"gusy39@163.com"
] | gusy39@163.com |
bd064a4e8522ee065e5a628c3e72e6b5b855dd99 | 388c2a44fe5de5c6524d407c1dddfe43db754c5b | /src/gui/org/deidentifier/arx/gui/view/impl/common/datatable/DataTableConfigLabelAccumulator.java | 648542aa9047d1a0489671255b6fc4f17e18a5e9 | [
"Apache-2.0"
] | permissive | arx-deidentifier/arx | d51f751acac017d39e18213cce18d42887dcdb22 | c8c26c95e42465908cdc1e07f6211121374600af | refs/heads/master | 2023-08-16T08:07:47.794373 | 2023-04-06T18:34:16 | 2023-04-06T18:34:16 | 9,751,165 | 567 | 243 | Apache-2.0 | 2023-05-23T20:17:59 | 2013-04-29T15:23:18 | Java | UTF-8 | Java | false | false | 2,391 | java | /*
* ARX Data Anonymization Tool
* Copyright 2012 - 2023 Fabian Prasser and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.deidentifier.arx.gui.view.impl.common.datatable;
import org.deidentifier.arx.RowSet;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator;
/**
* A label accumulator for the data view.
*
* @author Fabian Prasser
*/
public class DataTableConfigLabelAccumulator implements IConfigLabelAccumulator {
/** TODO */
private final DataTableContext context;
/** TODO */
private final NatTable table;
/**
* Creates a new instance.
*
* @param table
* @param context
*/
public DataTableConfigLabelAccumulator(NatTable table, DataTableContext context) {
this.context = context;
this.table = table;
}
@Override
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
int[] groups = context.getGroups();
RowSet rows = context.getRows();
if (table != null && groups != null) {
int row = table.getRowIndexByPosition(rowPosition + 1);
configLabels.addLabel("background" + (groups[row] % 2)); //$NON-NLS-1$
if (row < groups.length - 1 && groups[row] != groups[row + 1]) {
configLabels.addLabel(DataTableDecorator.BOTTOM_LINE_BORDER_LABEL);
}
}
if (table != null && rows != null) {
int column = table.getColumnIndexByPosition(columnPosition + 1);
if (column == 0) {
configLabels.addLabel("checkbox"); //$NON-NLS-1$
}
}
}
}
| [
"mail@fabian-prasser.de"
] | mail@fabian-prasser.de |
baeaf97d4e9961c629aa6720fd27309aacd5cac8 | 4ad0a43811f7f8bb7f0eccfb634bc6ef1740dce4 | /app/src/main/java/com/example/crc_rajnandangaon/Notice.java | bbbc0aada100f0114f478fab0c5e52f0f381ce12 | [] | no_license | bezaisingh/crc_app | 67df9b11095700536f93760096f61c65338e9f5c | 18afe193c988e8f042085f48d5fda7674f7460e8 | refs/heads/master | 2022-12-19T12:24:55.666655 | 2020-09-24T06:53:29 | 2020-09-24T06:53:29 | 265,632,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,424 | java | package com.example.crc_rajnandangaon;
import android.graphics.Color;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
public class Notice extends AppCompatActivity {
WebView myWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_notice);
Toolbar toolbar=findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle("Notice");
toolbar.setTitleTextColor(Color.WHITE);
toolbar.setSubtitleTextColor(Color.WHITE);
toolbar.setBackgroundColor(Color.parseColor("#008577"));
/////////////
myWebView = findViewById(R.id.webviewTender);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.loadUrl("http://crcrajnandgaon.nic.in/tender/");
myWebView.setWebViewClient(new WebViewClient());
////////////
}
///////////
@Override
public void onBackPressed() {
if (myWebView.canGoBack()) {
myWebView.goBack();
} else {
super.onBackPressed();
}
}
/////////////////
}
| [
"60504377+bezaisingh@users.noreply.github.com"
] | 60504377+bezaisingh@users.noreply.github.com |
3cdad1627f20591280b3492925042c6fd3215fa8 | 0af0217e16bf319e81d47c6f1bd2895f6687a66a | /src/main/java/com/krishnan/balaji/jfx/ch4/list/PAColleges.java | 67e9519f404ac962976259a9e5ba9bff172fc687 | [] | no_license | balaji142857/java_learning | 7edec6ac8e3a462a404a48d05ae073a351f1c816 | 3d2957fdbeb0a33b0414063164689bfed041fa0b | refs/heads/master | 2022-12-12T05:56:49.534231 | 2021-03-13T04:56:33 | 2021-03-13T04:56:33 | 90,326,430 | 0 | 0 | null | 2022-11-16T09:26:50 | 2017-05-05T01:52:09 | Java | UTF-8 | Java | false | false | 2,410 | java | package com.krishnan.balaji.jfx.ch4.list;
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;
import javafx.scene.control.MultipleSelectionModel;
import javafx.scene.layout.FlowPane;
import javafx.scene.paint.Paint;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class PAColleges extends Application {
@Override
public void start(Stage primaryStage) {
Label response = new Label("Select a college or university:");
ListView<String> lvColleges;
Text title = new Text("PA Colleges and Universities");
title.setFill(Paint.valueOf("#2A5058"));
title.setFont(Font.font("Verdana", FontWeight.BOLD, 20));
FlowPane root = new FlowPane(10,10);
root.setAlignment(Pos.CENTER);
ObservableList<String> colleges =
FXCollections.observableArrayList("Penn State", "Drexel",
"Widener", "Shippensburg", "Bloomsburg", "Penn Tech",
"Lockhaven", "Kutztown");
lvColleges = new ListView<String>(colleges);
lvColleges.setPrefSize(300,150);
MultipleSelectionModel<String> lvSelModel =
lvColleges.getSelectionModel();
lvSelModel.selectedItemProperty().
addListener(new ChangeListener<String>() {
public void changed(ObservableValue<? extends String> changed,
String oldVal, String newVal)
{
response.setText("You selected " + newVal);
}
});
root.getChildren().add(title);
root.getChildren().add(lvColleges);
root.getChildren().add(response);
Scene scene = new Scene(root, 350, 300);
primaryStage.setTitle("ListView");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
} | [
"balaji2k9_srec14@ymail.com"
] | balaji2k9_srec14@ymail.com |
c82d31f92c5e0adc0243c2ccc68acb266f45598e | e4a0e4c60edf5f12fc418ebea5947f78561b4f0d | /CloudClient/src/Controller/NioClient.java | df70edab0b917954e7ca94a6cf06335ada9c6b41 | [] | no_license | sharap0v/Cloud | 6575c782605cac947e7344de64241097713afec6 | f050d6cb9d0ec79c62bf18031dec23e7c3481e44 | refs/heads/master | 2022-11-07T02:53:23.074646 | 2020-06-29T10:56:51 | 2020-06-29T10:56:51 | 273,431,461 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,727 | java | package Controller;
import lib.Library;
import java.io.*;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
import java.nio.file.Paths;
import java.util.Iterator;
public class NioClient implements Runnable{
private int port;
private String ip;
private String password;
private String userName;
private SocketChannel clientChannel;
private Selector selector;
private ByteBuffer byteBuffer = ByteBuffer.allocate(128);
public static String clientMessage;
public boolean fileReception =false;
public String transferFileName = null;
public NioClient(String port, String ip, String password, String userName) {
this.port = Integer.parseInt(port);
this.ip = ip;
this.password = password;
this.userName = userName;
}
@Override
public void run() {
try {
clientChannel = SocketChannel.open();
clientChannel.configureBlocking(false);
clientChannel.connect(new InetSocketAddress(ip,port));
selector = Selector.open();
clientChannel.register(selector, SelectionKey.OP_CONNECT);
SelectionKey key;
Iterator<SelectionKey> iterator;
while (!Thread.interrupted()){
int eventsCount = selector.select();
iterator = selector.selectedKeys().iterator();
while(iterator.hasNext()){
key = iterator.next();
//System.out.println("1");
if (!key.isValid()) {
System.out.println("break");
break;
}
if(key.isValid() & key.isConnectable()){
System.out.println("Соединение");
handleConnection(key);
}
if(key.isReadable()){
System.out.println("read");
handleRead(key);
}
if(key.isWritable()){
//System.out.println("write");
handleWrite(key);
}
iterator.remove();
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
private void handleWrite(SelectionKey key) throws IOException {
if(clientMessage!=null){
SocketChannel channel = ((SocketChannel) key.channel());
String[] msg = clientMessage.split(Library.DELIMITER);
String msgType = msg[0];
switch (msgType){
case Library.COPY_FILE_TO_SERVER:
channel.write(ByteBuffer.wrap(clientMessage.getBytes()));
channel.register(selector, SelectionKey.OP_READ);
transferFileName = msg[1];
clientMessage=null;
break;
}}
}
private void handleRead(SelectionKey key) throws IOException {
SocketChannel channel = ((SocketChannel) key.channel());
StringBuilder message = new StringBuilder();
//channel.read(byteBuffer);
System.out.println(byteBuffer);
int read = 0;
byteBuffer.rewind();
while ((read = channel.read(byteBuffer)) > 0) {
byteBuffer.flip();
byte[] bytes = new byte[byteBuffer.limit()];
byteBuffer.get(bytes);
message.append(new String(bytes));
byteBuffer.rewind();
}
System.out.println(message);
String[] msg = message.toString().split(Library.DELIMITER);
String msgType = msg[0];
System.out.println("1"+msg[0]);
if (Library.FILE_READY.equals(msgType)) {
channel.register(selector, SelectionKey.OP_WRITE);
sendFile(channel,transferFileName);
}
}
private void handleConnection(SelectionKey key) throws IOException {
SocketChannel channel = ((SocketChannel) key.channel());
if(channel.isConnectionPending()) {
channel.finishConnect();
}
channel.configureBlocking(false);
channel.write(ByteBuffer.wrap(Library.getAuthRequest(userName, password).getBytes()));
channel.register(selector, SelectionKey.OP_WRITE);
}
private void sendFile(SocketChannel channel,String fileName) throws IOException {
FileChannel fileChannel = FileChannel.open(Paths.get(fileName));
fileChannel.transferTo(0,fileChannel.size(),channel);
System.out.println("Файл передан");
}
}
| [
"_sharapov_@mail.ru"
] | _sharapov_@mail.ru |
2577a03ca696aeb29aa4cfe17572aca58f5b8acb | 2e02ef2c5aea5e60c45dd0f7bda90411ac10df63 | /src/main/java/org/opendevup/metier/parsingrequest/IParsingNoteBookRequestMetier.java | 565585ab1ef12281e7c0f6f178a718c0b8b3777f | [] | no_license | adouhane/note-book-intrepreter | db37b409ffbe0706c27172949b1491db784d9350 | 515f9df6e5f31e70accb16ca74208c205aae74b2 | refs/heads/master | 2020-12-29T05:20:44.580790 | 2020-02-05T18:14:23 | 2020-02-05T18:14:23 | 238,468,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package org.opendevup.metier.parsingrequest;
import org.opendevup.dto.NoteBookRequestDto;
import org.opendevup.dto.ProgrammeInformationDto;
import org.opendevup.exception.IllegalCodeFormatException;
public interface IParsingNoteBookRequestMetier {
ProgrammeInformationDto parseNoteBookRequest(NoteBookRequestDto request) throws IllegalCodeFormatException;
}
| [
"omaradouhane@gmail.com"
] | omaradouhane@gmail.com |
37db1bb762a9ce178f07ffbc2788412ae6aa2654 | 2c01557872502bcbe08478f0660980c2641856d9 | /src/main/java/com/patrick/replogle/javazoos/models/ZooAnimals.java | 40750b367cf2b3831bbb89fa1106d7ac116e1da5 | [
"MIT"
] | permissive | patrick-replogle/java-zoos | 2950bfc15aa697aa523309629b944b6b4ba0ed79 | 778479c2948838681e4297c37961a8083fc3a596 | refs/heads/master | 2022-12-18T04:10:32.466884 | 2020-09-16T01:41:54 | 2020-09-16T01:41:54 | 295,536,072 | 0 | 0 | MIT | 2020-09-16T01:41:55 | 2020-09-14T20:52:10 | Java | UTF-8 | Java | false | false | 1,824 | java | package com.patrick.replogle.javazoos.models;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "zooanimals")
@IdClass(ZooAnimalsId.class)
public class ZooAnimals extends Auditable implements Serializable
{
@Id
@ManyToOne
@JoinColumn(name = "zooid")
@JsonIgnoreProperties(value = "animals", allowSetters = true)
private Zoo zoo;
@Id
@ManyToOne
@JoinColumn(name = "animalid")
@JsonIgnoreProperties(value = "zoos", allowSetters = true)
private Animal animal;
private String incomingzoo;
public ZooAnimals()
{
}
public ZooAnimals(Zoo zoo, Animal animal, String incomingzoo)
{
this.zoo = zoo;
this.animal = animal;
this.incomingzoo = incomingzoo;
}
public Zoo getZoo()
{
return zoo;
}
public void setZoo(Zoo zoo)
{
this.zoo = zoo;
}
public Animal getAnimal()
{
return animal;
}
public void setAnimal(Animal animal)
{
this.animal = animal;
}
public String getIncomingzoo()
{
return incomingzoo;
}
public void setIncomingzoo(String incomingzoo)
{
this.incomingzoo = incomingzoo;
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ZooAnimals that = (ZooAnimals) o;
return ((this.zoo == null) ? 0: this.zoo.getZooid()) == ((that.zoo == null) ? 0 : that.zoo.getZooid()) &&
(((this.animal == null) ? 0 : this.animal.getAnimalid()) == ((that.animal == null) ? 0 : that.animal.getAnimalid()));
}
@Override
public int hashCode()
{
return 37;
}
}
| [
"patrickr1138@gmail.com"
] | patrickr1138@gmail.com |
5630e3d1411fe8fcd9ade3f12976eccd42ba1afb | ae0768a5a0c0d23f71ea8e84dd2b70131131889e | /Tic Tac Toe/src/Game.java | d5ccbf4a1464a8ec35f6f34ac11d7e6a0022b628 | [] | no_license | michelc1/TicTacToe | 928d312916879e0bd79c45d48d693df542610bb6 | 76c929c249d865426b4c8a302bf77f2e0cf29a09 | refs/heads/master | 2020-05-29T11:19:10.507994 | 2014-12-09T23:44:38 | 2014-12-09T23:44:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,723 | java | import java.awt.Color;
import java.awt.event.ActionEvent;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
public class Game {
private char[] templateOfBoard; // our board, TicTacToe field, static
private char userTurn; // users turn , only one letter, tracks whether it is a X or O
private int count; // keeps track of user moves
final JFrame frame; // our JFrame
// constructor
// want to initialize the variable
// here we are stating the board size
// userTurn starts off at X
public Game(final JFrame frame) throws BoardErrorException{ // Game takes in the JFrame
this.frame = frame;
count = 0; // number of turns starts at 0;
userTurn = 'X'; // first turn will always be X
templateOfBoard = new char[GUI.sizeOfBoard]; // size of the board we are going to make it
try{
for(int spaces=0; spaces<GUI.sizeOfBoard; spaces++){ // size of Board is in the GUI class
templateOfBoard[spaces] = ' '; // the board is being created, looping through all rows and col
//every index of the board not has a char value equal to a space
//determine if everything came out correctly
//should equal of a total of 9
// 3x3
}
System.out.println("Board template created"); // means the board now has all spaces
}
catch(Exception e){
System.out.println("Could not initalize the board to empty char");
e.printStackTrace();
}
}
public Game userMove(int moveMade) throws UserMoveErrorExcepion {
templateOfBoard[moveMade] = userTurn;
// index of the board, or in simpler terms, where the user
// inserts there turn i.e X or O, 0-8
//System.out.println(userMove);
//boolean statement to determine the turns
// So user X starts first
//if the turn is X, the nextTurn is now O,
if(userTurn == 'X'){
userTurn = 'O';
//System.out.println("User Turn " +userTurn);
}
else {
userTurn = 'X';
//System.out.println("User Turn " +userTurn);
}
count++;
//System.out.println(count);
// System.out.print("Switch made" + count);
// System.out.println(userTurn);
return this; // going to return the userTurn
// issue actually entering the userTurn is not giving right value, but using 'this' does
}
// for some odd reason the toString is causing some issues, keep getting @hash code
//saw online to override it like this
// will make the board out of emepty strings
// going to return a string representation of an object
public String toString(){
return new String(templateOfBoard);
}
public void mouseListener(ActionEvent e, int moveMade) throws ButtonsNotMadeException,ButtonCanNotBeClickedException, WinnerErrorException{
// mouse click events
// what happens after a button is clicked
//clickButton[i].setText("X")
if(templateOfBoard[moveMade] == ' '){ // the user can only space a click, so an letter on the field if it is empty
((JButton)e.getSource()).setText(Character.toString(userTurn)); // when the button is clicked, we want an X placed there
if (userTurn == 'X'){
UIManager.getDefaults().put("Button.disabledText",Color.RED); // when the but gets disabled the test will turn red
}
else{
UIManager.getDefaults().put("Button.disabledText",Color.BLUE);
}
//calling the method userTurn to determine who goes next
//problem is that is expects a String
//going to override the toString method
try {
userMove(moveMade); // calling userMove in moveMade, moveMade is the index at which the user put either an X or a O
winner(); // we want to check each time to ensure there was/was not a winner
} catch (UserMoveErrorExcepion | WinnerErrorException | BoardErrorException | ButtonsNotMadeException | ButtonCanNotBeClickedException e1) {
e1.printStackTrace();
}
}
}
public Game winner() throws WinnerErrorException, BoardErrorException, ButtonsNotMadeException, ButtonCanNotBeClickedException { // determines who is the winner
//testing purposes to get the values , X or O
//templateOfBoard[0] = 'O';
//templateOfBoard[4] = 'O';
//templateOfBoard[8] = 'O';
//list below defines all the possible win combinations
// the index of where a X or O can be place
// placed the locations to a int value
int win1 = templateOfBoard[0] + templateOfBoard[1] + templateOfBoard[2];
int win2 = templateOfBoard[3] + templateOfBoard[4] + templateOfBoard[5];
int win3 = templateOfBoard[6] + templateOfBoard[7] + templateOfBoard[8];
int win4 = templateOfBoard[0] + templateOfBoard[3] + templateOfBoard[6];
int win5 = templateOfBoard[1] + templateOfBoard[4] + templateOfBoard[7];
int win6 = templateOfBoard[2] + templateOfBoard[5] + templateOfBoard[8];
int win7 = templateOfBoard[0] + templateOfBoard[4] + templateOfBoard[8];
int win8 = templateOfBoard[2] + templateOfBoard[4] + templateOfBoard[6];
//System.out.println("count = " + count); // testing
//System.out.println("vaules at win7 = " + win7 + " is a win when 264 or 237"); testing
int[] win = new int[]{win1,win2,win3,win4,win5,win6,win7,win8};
// making a array to go through all the possibile wins
//possible total of wins is 8
for(int i = 0;i<win.length;i++){
// looping through the win possibilities
//System.out.println(win.length); testing
//System.out.println(win[i] + " " + (i+1)); testing
if(win[i] == 264){ // if one of the the combinations equal 'X','X','X' which equals 264, then there is a winner
System.out.println("X is the winner!!!");
System.out.println("Game Over!");
//System.exit(0);
try {
gameOver("X is the Winner");
} catch (CouldNotPlayAgainException | NoCancelOption e) {
e.printStackTrace();
}
//System.out.print("X Hello " + "win " + (i+1) + " value = " + win[i]); testing
return this; // if statement is true, it will return this(gameOver)
}
else if(win[i] == 237 ){ // if one of the the combinations equal 'O','O','O' which equals 234, then there is a winner
System.out.println("O is the winner!!!");
System.out.println("Game Over!");
//System.out.println(templateOfBoard[0]+templateOfBoard[1]+templateOfBoard[2]);
try {
gameOver("O is the Winner");
} catch (CouldNotPlayAgainException | NoCancelOption e) {
e.printStackTrace();
} // if statement is true, it will return this(gameOver)
//System.out.print("O Hello1");
return this;
}
}
//
if (count == 9) {
// if none of the statements above are true, it automatically comes done to here
//so if there is nine moves and no win, it is a draw
try {
gameOver("Draw");
} catch (CouldNotPlayAgainException | NoCancelOption e) {
e.printStackTrace();
}
}
return this;
// going to return this method ;
}
private void gameOver(String message) throws BoardErrorException, ButtonsNotMadeException, ButtonCanNotBeClickedException,
WinnerErrorException, CouldNotPlayAgainException,NoCancelOption{
JOptionPane.showMessageDialog(null, message, "Game Over", JOptionPane.YES_NO_OPTION); // gives a popup window at the end of the game
int playAgain = JOptionPane.showConfirmDialog(null, "Do you want to play another game?",
"Play Again", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
//going to ask user if he wants to play agin, while still seeing the board
if (playAgain == JOptionPane.OK_OPTION) {
frame.dispose(); // going to dispose of our frame// if user hit ok
GUI.playAgain(); // play the game again
}
if(playAgain == JOptionPane.CANCEL_OPTION){
secondPlayAgin(); // give user second chance
}
}
private void secondPlayAgin() throws CouldNotPlayAgainException,NoCancelOption {
int secondChoice = JOptionPane.showConfirmDialog(null, "PLEASE PLAY ME AGAIN",
"Play Again", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);
if (secondChoice == JOptionPane.OK_OPTION) {
frame.dispose(); // going to dispose of our frame// if user hit ok
GUI.playAgain();
}
else if(secondChoice == JOptionPane.CANCEL_OPTION){
JOptionPane.showMessageDialog(null, "You are entering View Mode Only", "View Only Mode", JOptionPane.YES_NO_OPTION);
//disabling all JButton until new game is started
try{
for(int i=0;i<9;i++){
GUI.clickButton[i].setEnabled(false);
//System.out.println("Buttons Disabled");
}
System.out.println("VIEW MODE ONLY");
}
catch(Exception e){
System.out.println("Could not disable the button");
e.printStackTrace();
}
}
}
public char[] getBoard() {
return this.templateOfBoard;
}
public char getUserTurn(){
return this.userTurn;
}
}
| [
"chrispp10@gmail.com"
] | chrispp10@gmail.com |
74979290823ec71364049f578b890a2c81da5c48 | 85bff012a334a6d8091a81523f840899f9939a11 | /src/main/java/com/predicate_proof/generated/predicate_proof_grammarLexer.java | 4cbdca275143a27cb4a22719e7efeb8bc0de0c5e | [] | no_license | dnickel8/Predicate_Proof | b9e09fd6ae9ffa71e471b5474a3bab4a93ed5424 | 724555bb53fb3ba800a87a9890652e6bbfbe2419 | refs/heads/master | 2023-08-12T03:22:07.577680 | 2021-09-30T17:22:03 | 2021-09-30T17:22:03 | 349,170,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,325 | java | // Generated from C:/Users/admin/Documents/Studium/Master/Forschungsprojekt/predicate_proof/src/main/java/com/predicate_proof/grammar\predicate_proof_grammar.g4 by ANTLR 4.9.1
package com.predicate_proof.generated;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.TokenStream;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.misc.*;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class predicate_proof_grammarLexer extends Lexer {
static { RuntimeMetaData.checkVersion("4.9.1", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, FORMULAEND=13, VARIABLEEND=14, BLOCKBEGIN=15,
BLOCKEND=16, ASSUMPTION=17, PREMISE=18, BOTTOM=19, NOT=20, EXISTQUANTOR=21,
ALLQUANTOR=22, AND=23, OR=24, TRANSFORMATION_ARROW=25, EUQIVALENZ_ARROW=26,
EQ=27, LPAREN=28, RPAREN=29, COMMA=30, EOL=31, DIGIT=32, CHAR=33, WS=34;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
public static String[] modeNames = {
"DEFAULT_MODE"
};
private static String[] makeRuleNames() {
return new String[] {
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
"T__9", "T__10", "T__11", "FORMULAEND", "VARIABLEEND", "BLOCKBEGIN",
"BLOCKEND", "ASSUMPTION", "PREMISE", "BOTTOM", "NOT", "EXISTQUANTOR",
"ALLQUANTOR", "AND", "OR", "TRANSFORMATION_ARROW", "EUQIVALENZ_ARROW",
"EQ", "LPAREN", "RPAREN", "COMMA", "EOL", "DIGIT", "CHAR", "WS"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "'i'", "'e1'", "'e2'", "'i1'", "'i2'", "'e'", "'MT'", "'PBC'",
"'LEM'", "'copy'", "'already proofed'", "'-'", "'\\mid'", "'\\parallel'",
"'\\ll'", "'\\gg'", null, null, "'\\bot'", "'\\neg'", "'\\exists'", "'\\forall'",
"'\\wedge'", "'\\vee'", null, "'\\leftrightarrow'", "'='", null, null,
"','"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, null, null, null, null, null, null, null, null, null, null, null,
null, "FORMULAEND", "VARIABLEEND", "BLOCKBEGIN", "BLOCKEND", "ASSUMPTION",
"PREMISE", "BOTTOM", "NOT", "EXISTQUANTOR", "ALLQUANTOR", "AND", "OR",
"TRANSFORMATION_ARROW", "EUQIVALENZ_ARROW", "EQ", "LPAREN", "RPAREN",
"COMMA", "EOL", "DIGIT", "CHAR", "WS"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
public predicate_proof_grammarLexer(CharStream input) {
super(input);
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
@Override
public String getGrammarFileName() { return "predicate_proof_grammar.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public String[] getChannelNames() { return channelNames; }
@Override
public String[] getModeNames() { return modeNames; }
@Override
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2$\u011f\b\1\4\2\t"+
"\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+
"\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+
"\t!\4\"\t\"\4#\t#\3\2\3\2\3\3\3\3\3\3\3\4\3\4\3\4\3\5\3\5\3\5\3\6\3\6"+
"\3\6\3\7\3\7\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\13\3\13\3\13"+
"\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f"+
"\3\f\3\r\3\r\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\17\3\17\3"+
"\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\22\3\22\3"+
"\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\5\22\u009e\n\22"+
"\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u00ab\n\23"+
"\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\25\3\26\3\26\3\26\3\26"+
"\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\30\3\30"+
"\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3\32"+
"\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\5\32\u00e3"+
"\n\32\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\33"+
"\3\33\3\33\3\33\3\34\3\34\3\35\3\35\3\35\3\35\3\35\3\35\3\35\5\35\u00fe"+
"\n\35\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36\5\36\u0108\n\36\3\37\3\37"+
"\3 \6 \u010d\n \r \16 \u010e\3 \3 \5 \u0113\n \3!\3!\3\"\3\"\3#\6#\u011a"+
"\n#\r#\16#\u011b\3#\3#\2\2$\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25"+
"\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32"+
"\63\33\65\34\67\359\36;\37= ?!A\"C#E$\3\2\6\4\2\f\f\17\17\3\2\62;\4\2"+
"C\\c|\5\2\13\f\17\17\"\"\2\u0127\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2\2\2"+
"\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2"+
"\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2"+
"\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2"+
"\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2"+
"\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2"+
"\2C\3\2\2\2\2E\3\2\2\2\3G\3\2\2\2\5I\3\2\2\2\7L\3\2\2\2\tO\3\2\2\2\13"+
"R\3\2\2\2\rU\3\2\2\2\17W\3\2\2\2\21Z\3\2\2\2\23^\3\2\2\2\25b\3\2\2\2\27"+
"g\3\2\2\2\31w\3\2\2\2\33y\3\2\2\2\35~\3\2\2\2\37\u0088\3\2\2\2!\u008c"+
"\3\2\2\2#\u009d\3\2\2\2%\u00aa\3\2\2\2\'\u00ac\3\2\2\2)\u00b1\3\2\2\2"+
"+\u00b6\3\2\2\2-\u00be\3\2\2\2/\u00c6\3\2\2\2\61\u00cd\3\2\2\2\63\u00e2"+
"\3\2\2\2\65\u00e4\3\2\2\2\67\u00f4\3\2\2\29\u00fd\3\2\2\2;\u0107\3\2\2"+
"\2=\u0109\3\2\2\2?\u0112\3\2\2\2A\u0114\3\2\2\2C\u0116\3\2\2\2E\u0119"+
"\3\2\2\2GH\7k\2\2H\4\3\2\2\2IJ\7g\2\2JK\7\63\2\2K\6\3\2\2\2LM\7g\2\2M"+
"N\7\64\2\2N\b\3\2\2\2OP\7k\2\2PQ\7\63\2\2Q\n\3\2\2\2RS\7k\2\2ST\7\64\2"+
"\2T\f\3\2\2\2UV\7g\2\2V\16\3\2\2\2WX\7O\2\2XY\7V\2\2Y\20\3\2\2\2Z[\7R"+
"\2\2[\\\7D\2\2\\]\7E\2\2]\22\3\2\2\2^_\7N\2\2_`\7G\2\2`a\7O\2\2a\24\3"+
"\2\2\2bc\7e\2\2cd\7q\2\2de\7r\2\2ef\7{\2\2f\26\3\2\2\2gh\7c\2\2hi\7n\2"+
"\2ij\7t\2\2jk\7g\2\2kl\7c\2\2lm\7f\2\2mn\7{\2\2no\7\"\2\2op\7r\2\2pq\7"+
"t\2\2qr\7q\2\2rs\7q\2\2st\7h\2\2tu\7g\2\2uv\7f\2\2v\30\3\2\2\2wx\7/\2"+
"\2x\32\3\2\2\2yz\7^\2\2z{\7o\2\2{|\7k\2\2|}\7f\2\2}\34\3\2\2\2~\177\7"+
"^\2\2\177\u0080\7r\2\2\u0080\u0081\7c\2\2\u0081\u0082\7t\2\2\u0082\u0083"+
"\7c\2\2\u0083\u0084\7n\2\2\u0084\u0085\7n\2\2\u0085\u0086\7g\2\2\u0086"+
"\u0087\7n\2\2\u0087\36\3\2\2\2\u0088\u0089\7^\2\2\u0089\u008a\7n\2\2\u008a"+
"\u008b\7n\2\2\u008b \3\2\2\2\u008c\u008d\7^\2\2\u008d\u008e\7i\2\2\u008e"+
"\u008f\7i\2\2\u008f\"\3\2\2\2\u0090\u0091\7c\2\2\u0091\u0092\7u\2\2\u0092"+
"\u009e\7u\2\2\u0093\u0094\7c\2\2\u0094\u0095\7u\2\2\u0095\u0096\7u\2\2"+
"\u0096\u0097\7w\2\2\u0097\u0098\7o\2\2\u0098\u0099\7r\2\2\u0099\u009a"+
"\7v\2\2\u009a\u009b\7k\2\2\u009b\u009c\7q\2\2\u009c\u009e\7p\2\2\u009d"+
"\u0090\3\2\2\2\u009d\u0093\3\2\2\2\u009e$\3\2\2\2\u009f\u00a0\7r\2\2\u00a0"+
"\u00a1\7t\2\2\u00a1\u00a2\7g\2\2\u00a2\u00ab\7o\2\2\u00a3\u00a4\7r\2\2"+
"\u00a4\u00a5\7t\2\2\u00a5\u00a6\7g\2\2\u00a6\u00a7\7o\2\2\u00a7\u00a8"+
"\7k\2\2\u00a8\u00a9\7u\2\2\u00a9\u00ab\7g\2\2\u00aa\u009f\3\2\2\2\u00aa"+
"\u00a3\3\2\2\2\u00ab&\3\2\2\2\u00ac\u00ad\7^\2\2\u00ad\u00ae\7d\2\2\u00ae"+
"\u00af\7q\2\2\u00af\u00b0\7v\2\2\u00b0(\3\2\2\2\u00b1\u00b2\7^\2\2\u00b2"+
"\u00b3\7p\2\2\u00b3\u00b4\7g\2\2\u00b4\u00b5\7i\2\2\u00b5*\3\2\2\2\u00b6"+
"\u00b7\7^\2\2\u00b7\u00b8\7g\2\2\u00b8\u00b9\7z\2\2\u00b9\u00ba\7k\2\2"+
"\u00ba\u00bb\7u\2\2\u00bb\u00bc\7v\2\2\u00bc\u00bd\7u\2\2\u00bd,\3\2\2"+
"\2\u00be\u00bf\7^\2\2\u00bf\u00c0\7h\2\2\u00c0\u00c1\7q\2\2\u00c1\u00c2"+
"\7t\2\2\u00c2\u00c3\7c\2\2\u00c3\u00c4\7n\2\2\u00c4\u00c5\7n\2\2\u00c5"+
".\3\2\2\2\u00c6\u00c7\7^\2\2\u00c7\u00c8\7y\2\2\u00c8\u00c9\7g\2\2\u00c9"+
"\u00ca\7f\2\2\u00ca\u00cb\7i\2\2\u00cb\u00cc\7g\2\2\u00cc\60\3\2\2\2\u00cd"+
"\u00ce\7^\2\2\u00ce\u00cf\7x\2\2\u00cf\u00d0\7g\2\2\u00d0\u00d1\7g\2\2"+
"\u00d1\62\3\2\2\2\u00d2\u00d3\7/\2\2\u00d3\u00e3\7@\2\2\u00d4\u00d5\7"+
"^\2\2\u00d5\u00d6\7v\2\2\u00d6\u00e3\7q\2\2\u00d7\u00d8\7^\2\2\u00d8\u00d9"+
"\7t\2\2\u00d9\u00da\7k\2\2\u00da\u00db\7i\2\2\u00db\u00dc\7j\2\2\u00dc"+
"\u00dd\7v\2\2\u00dd\u00de\7c\2\2\u00de\u00df\7t\2\2\u00df\u00e0\7t\2\2"+
"\u00e0\u00e1\7q\2\2\u00e1\u00e3\7y\2\2\u00e2\u00d2\3\2\2\2\u00e2\u00d4"+
"\3\2\2\2\u00e2\u00d7\3\2\2\2\u00e3\64\3\2\2\2\u00e4\u00e5\7^\2\2\u00e5"+
"\u00e6\7n\2\2\u00e6\u00e7\7g\2\2\u00e7\u00e8\7h\2\2\u00e8\u00e9\7v\2\2"+
"\u00e9\u00ea\7t\2\2\u00ea\u00eb\7k\2\2\u00eb\u00ec\7i\2\2\u00ec\u00ed"+
"\7j\2\2\u00ed\u00ee\7v\2\2\u00ee\u00ef\7c\2\2\u00ef\u00f0\7t\2\2\u00f0"+
"\u00f1\7t\2\2\u00f1\u00f2\7q\2\2\u00f2\u00f3\7y\2\2\u00f3\66\3\2\2\2\u00f4"+
"\u00f5\7?\2\2\u00f58\3\2\2\2\u00f6\u00fe\7*\2\2\u00f7\u00f8\7^\2\2\u00f8"+
"\u00f9\7n\2\2\u00f9\u00fa\7g\2\2\u00fa\u00fb\7h\2\2\u00fb\u00fc\7v\2\2"+
"\u00fc\u00fe\7*\2\2\u00fd\u00f6\3\2\2\2\u00fd\u00f7\3\2\2\2\u00fe:\3\2"+
"\2\2\u00ff\u0108\7+\2\2\u0100\u0101\7^\2\2\u0101\u0102\7t\2\2\u0102\u0103"+
"\7k\2\2\u0103\u0104\7i\2\2\u0104\u0105\7j\2\2\u0105\u0106\7v\2\2\u0106"+
"\u0108\7+\2\2\u0107\u00ff\3\2\2\2\u0107\u0100\3\2\2\2\u0108<\3\2\2\2\u0109"+
"\u010a\7.\2\2\u010a>\3\2\2\2\u010b\u010d\t\2\2\2\u010c\u010b\3\2\2\2\u010d"+
"\u010e\3\2\2\2\u010e\u010c\3\2\2\2\u010e\u010f\3\2\2\2\u010f\u0113\3\2"+
"\2\2\u0110\u0111\7^\2\2\u0111\u0113\7^\2\2\u0112\u010c\3\2\2\2\u0112\u0110"+
"\3\2\2\2\u0113@\3\2\2\2\u0114\u0115\t\3\2\2\u0115B\3\2\2\2\u0116\u0117"+
"\t\4\2\2\u0117D\3\2\2\2\u0118\u011a\t\5\2\2\u0119\u0118\3\2\2\2\u011a"+
"\u011b\3\2\2\2\u011b\u0119\3\2\2\2\u011b\u011c\3\2\2\2\u011c\u011d\3\2"+
"\2\2\u011d\u011e\b#\2\2\u011eF\3\2\2\2\13\2\u009d\u00aa\u00e2\u00fd\u0107"+
"\u010e\u0112\u011b\3\b\2\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
} | [
"david.nickel@fh-bielefeld.de"
] | david.nickel@fh-bielefeld.de |
a8b22fe1bc6c1e79087dd9d3755b613bbf0ed95b | cb756520c3035e7c241cb888e2637f92333f8ff5 | /src/test/java/org/jboss/netty/handler/codec/bayeux/BayeuxUtilTest.java | a4d67b9996c7dc41f66cbacce58e4035b3b4188f | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | Viyond/bayeux4netty | a7568751715d6eb00226bb7eaeaaf33ffad8e7c6 | 46e15cf75aecaefb4df19e2a4a92045fa91b6776 | refs/heads/master | 2021-01-24T15:06:59.266186 | 2014-01-25T16:09:38 | 2014-01-25T16:09:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,968 | java | /*
* Copyright 2009 Red Hat, Inc.
*
* Red Hat 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.jboss.netty.handler.codec.bayeux;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author daijun
*/
public class BayeuxUtilTest {
@Test
public void testGetCurrentTime() {
System.out.println("getCurrentTime:");
System.out.println(BayeuxUtil.getCurrentTime());
}
@Test
public void testGenerateUUID() {
System.out.println("getCurrentTime:");
System.out.println(BayeuxUtil.generateUUID());
}
@Test
public void testPrefixMatch(){
System.out.println("Prefix matchingy...");
String[] strings = {"/channel/*","/channel/**","/channel/a","/channel/a/aa","/channel/*/aa"};
String[] expResult = {"/channel/*","/channel/**"};
List<String> result = BayeuxUtil.prefixMatch("/channel/abc", strings);
assertArrayEquals(expResult, result.toArray());
String[] expResult2 = {"/channel/*","/channel/**","/channel/a"};
List<String> result2 = BayeuxUtil.prefixMatch("/channel/*", strings);
assertArrayEquals(expResult2, result2.toArray());
String[] expResult3 = {"/channel/*","/channel/**","/channel/a","/channel/a/aa"};
List<String> result3 = BayeuxUtil.prefixMatch("/channel/**", strings);
assertArrayEquals(expResult3, result3.toArray());
}
}
| [
"guiwuu@gmail.com"
] | guiwuu@gmail.com |
77fbe15575541c73a2fdb8529a1fe859f8d69603 | 4edf4bd86e9e1bc1147992c05e83bcb39b0437df | /app/src/main/java/com/example/balakrishnaballi/cricboardapp/module/AppModule.java | 85b194035c72be4833c840ae0bbf203aa7488d8e | [] | no_license | balub513/CricBoardApp | 1b145dc9a0328265e304595c749b44c7ff1c785f | be6a7345abae90b0d555ba8dc6d6ee6856c47c06 | refs/heads/master | 2022-12-20T07:22:44.089714 | 2020-09-17T08:40:57 | 2020-09-17T08:40:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 498 | java | package com.example.balakrishnaballi.cricboardapp.module;
import android.app.Application;
import android.content.Context;
import com.example.balakrishnaballi.cricboardapp.application.CricboardApplication;
import dagger.Module;
import dagger.Provides;
@Module
public class AppModule {
Context context;
public AppModule(Context context) {
this.context = context;
}
@Provides
public Context provideContext() {
return context;
}
}
| [
"balub513@gmail.com"
] | balub513@gmail.com |
0c3f7c212088d951068d25b9fe032304adcac83e | 8d23219406b12786d0166ce7cbbe95060602386f | /src/main/java/com/intuit/assignment/util/DisplayUtil.java | 2694a9460c43e667b79d48437a26e6866a28b65c | [] | no_license | ashking94/reservationsystem | 1187ab038ac476b4611d89529d2f66aa84231e33 | 20dd142843eb42a09ab50390aa3a12dd5b2c86c2 | refs/heads/master | 2021-07-16T23:50:55.885855 | 2017-10-24T02:19:27 | 2017-10-24T02:19:27 | 108,016,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package com.intuit.assignment.util;
public class DisplayUtil {
public static void printDelimitedStart(String title) {
System.out.println("\n===========================" + title + "==========================");
}
public static void printDelimitedShort(String title) {
System.out.println("\n==========" + title + "==========");
}
}
| [
"Ashish.Singh2@go-mmt.com"
] | Ashish.Singh2@go-mmt.com |
2b2b8ea8f64e3823d7411d103c71b0936e23e515 | 45c31d23be3d46b03af0828c1b5bc5739147cc44 | /pcapngdecoder/src/main/java/fr/bmartel/pcapdecoder/structure/PcapNgStructureParser.java | 0609f65034be9f17c9ca25f33b7f8548946db7c4 | [
"MIT"
] | permissive | bertrandmartel/pcapng-decoder | 15e6e8711ebce01a5d943eb248150987a432e46c | e9adb3bdf0d530a650f15aa2a557819da2dd60f8 | refs/heads/master | 2022-02-15T08:05:17.277067 | 2017-01-12T14:53:02 | 2017-01-12T14:53:02 | 34,972,594 | 20 | 9 | MIT | 2020-03-31T09:32:12 | 2015-05-03T03:37:56 | Java | UTF-8 | Java | false | false | 4,595 | java | /*
* The MIT License (MIT)
* <p/>
* Copyright (c) 2015-2016 Bertrand Martel
* <p/>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p/>
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* <p/>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package fr.bmartel.pcapdecoder.structure;
import fr.bmartel.pcapdecoder.structure.types.IPcapngType;
import fr.bmartel.pcapdecoder.structure.types.impl.EnhancedPacketHeader;
import fr.bmartel.pcapdecoder.structure.types.impl.InterfaceDescriptionHeader;
import fr.bmartel.pcapdecoder.structure.types.impl.InterfaceStatisticsHeader;
import fr.bmartel.pcapdecoder.structure.types.impl.NameResolutionHeader;
import fr.bmartel.pcapdecoder.structure.types.impl.SectionHeader;
/**
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Block Type |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Block Total Length |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* / Block Body /
* / variable length, aligned to 32 bits /
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Block Total Length |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* @author Bertrand Martel
*/
public class PcapNgStructureParser {
/**
* unique value that identifies the block. Values whose Most Significant Bit (MSB) is equal to 1 are reserved for
* local use. They allow to save private data to the file and to extend the file format
*/
private BlockTypes blockType = BlockTypes.UNKNOWN;
private IPcapngType pcapStruct = null;
/**
* total size of this block
*/
private byte[] blockTotalLength = new byte[32];
/**
* content of the block
*/
private byte[] blockData = new byte[]{};
private boolean isBigEndian = true;
/**
* Build Pcap Ng structure
*
* @param type block type
* @param data block data
*/
public PcapNgStructureParser(BlockTypes type, byte[] data, boolean isBigEndian) {
this.blockType = type;
this.blockData = data;
this.isBigEndian = isBigEndian;
}
public void decode() {
if (blockType == BlockTypes.SECTION_HEADER_BLOCK) {
pcapStruct = new SectionHeader(blockData, isBigEndian, blockType);
} else if (blockType == BlockTypes.INTERFACE_DESCRIPTION_BLOCK) {
pcapStruct = new InterfaceDescriptionHeader(blockData, isBigEndian, blockType);
} else if (blockType == BlockTypes.ENHANCES_PACKET_BLOCK) {
pcapStruct = new EnhancedPacketHeader(blockData, isBigEndian, blockType);
} else if (blockType == BlockTypes.SIMPLE_PACKET_BLOCK) {
} else if (blockType == BlockTypes.NAME_RESOLUTION_BLOCK) {
pcapStruct = new NameResolutionHeader(blockData, isBigEndian, blockType);
} else if (blockType == BlockTypes.INTERFACE_STATISTICS_BLOCK) {
pcapStruct = new InterfaceStatisticsHeader(blockData, isBigEndian, blockType);
} else if (blockType == BlockTypes.PACKET_BLOCK) {
}
}
public BlockTypes getBlockType() {
return blockType;
}
public IPcapngType getPcapStruct() {
return pcapStruct;
}
public byte[] getBlockTotalLength() {
return blockTotalLength;
}
public byte[] getBlockData() {
return blockData;
}
public boolean isBigEndian() {
return isBigEndian;
}
}
| [
"bmartel.fr@gmail.com"
] | bmartel.fr@gmail.com |
34162f1773e71ee78465fedba9a908b0dd18896a | a2054e8dbec716aec5af2e0269128c19be9551c1 | /Character_Main/src/net/sf/anathema/character/generic/framework/xml/trait/GenericTraitTemplateFactory.java | ea150526c06ac5ab63e46304546b5d2f19577078 | [] | no_license | oxford-fumble/anathema | a2cf9e1429fa875718460e6017119c4588f12ffe | 2ba9b506297e1e7a413dee7bfdbcd6af80a6d9ec | refs/heads/master | 2021-01-18T05:08:33.046966 | 2013-06-28T14:50:45 | 2013-06-28T14:50:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,868 | java | package net.sf.anathema.character.generic.framework.xml.trait;
import net.sf.anathema.character.generic.framework.xml.trait.pool.GenericTraitTemplatePool;
import net.sf.anathema.character.generic.template.ITraitTemplateFactory;
import net.sf.anathema.character.generic.traits.ITraitTemplate;
import net.sf.anathema.character.generic.traits.types.AbilityType;
import net.sf.anathema.character.generic.traits.types.AttributeType;
import net.sf.anathema.character.generic.traits.types.VirtueType;
import net.sf.anathema.lib.exception.UnreachableCodeReachedException;
import net.sf.anathema.lib.lang.clone.ICloneable;
public class GenericTraitTemplateFactory implements ITraitTemplateFactory, ICloneable<GenericTraitTemplateFactory> {
private GenericTraitTemplatePool abilitiesPool;
private GenericTraitTemplatePool attributesPool;
private GenericTraitTemplatePool virtuesPool;
private GenericTraitTemplate essenceTemplate;
private GenericTraitTemplate willpowerTemplate;
@Override
public ITraitTemplate createWillpowerTemplate() {
return willpowerTemplate;
}
@Override
public ITraitTemplate createEssenceTemplate() {
return essenceTemplate;
}
@Override
public ITraitTemplate createVirtueTemplate(VirtueType type) {
return virtuesPool.getTemplate(type);
}
@Override
public ITraitTemplate createAttributeTemplate(AttributeType type) {
return attributesPool.getTemplate(type);
}
@Override
public ITraitTemplate createAbilityTemplate(AbilityType type) {
return abilitiesPool.getTemplate(type);
}
public void setAbilitiesPool(GenericTraitTemplatePool abilitiesPool) {
this.abilitiesPool = abilitiesPool;
}
public void setAttributesPool(GenericTraitTemplatePool attributesPool) {
this.attributesPool = attributesPool;
}
public void setVirtuesPool(GenericTraitTemplatePool virtuesPool) {
this.virtuesPool = virtuesPool;
}
public void setEssenceTemplate(GenericTraitTemplate essenceTemplate) {
this.essenceTemplate = essenceTemplate;
}
public void setWillpowerTemplate(GenericTraitTemplate willpowerTemplate) {
this.willpowerTemplate = willpowerTemplate;
}
@Override
public GenericTraitTemplateFactory clone() {
GenericTraitTemplateFactory clone;
try {
clone = (GenericTraitTemplateFactory) super.clone();
} catch (CloneNotSupportedException e) {
throw new UnreachableCodeReachedException(e);
}
clone.abilitiesPool = abilitiesPool == null ? null : abilitiesPool.clone();
clone.attributesPool = attributesPool == null ? null : attributesPool.clone();
clone.virtuesPool = virtuesPool == null ? null : virtuesPool.clone();
clone.essenceTemplate = essenceTemplate == null ? null : essenceTemplate.clone();
clone.willpowerTemplate = willpowerTemplate == null ? null : willpowerTemplate.clone();
return clone;
}
} | [
"sandra.sieroux@googlemail.com"
] | sandra.sieroux@googlemail.com |
6b07c5059611b77a7bc54801a5ad04f25b20e41e | 7d3da8cd995c03e0a76e61f9441b000f779fb0b3 | /app/src/main/java/com/example/twirlbug/Split_The_Bill/EditPlaceActivity.java | a4bd470c70989efb8d68ba4fb005c003d3dad7e1 | [] | no_license | Twirlbug/SQLMultiTableDatabse | ff78e84c75d4755afec3d2902a74c3b9fc6466ab | 0645896586983f1450235c4b8feb249ddd383249 | refs/heads/master | 2021-01-10T15:21:19.916811 | 2016-04-07T04:23:14 | 2016-04-07T04:23:14 | 53,985,478 | 1 | 0 | null | 2016-04-07T04:23:15 | 2016-03-15T23:18:42 | Java | UTF-8 | Java | false | false | 6,453 | java | package com.example.twirlbug.Split_The_Bill;
import android.app.Activity;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.twirlbug.Split_The_Bill.database.DatabaseHelper;
import com.example.twirlbug.Split_The_Bill.database.DbSchema;
/**
* Created by Twirlbug on 3/17/2016.
*/
public class EditPlaceActivity extends AppCompatActivity {
private static final int PLACE_AUTOCOMPLETE_REQUEST_CODE = 0;
private EditText Place_Name;
private String getPlace_Name;
private EditText Place_Address;
private String getPlace_Address;
private Button mCancel;
int getPlace_Id;
private Button place_googlefind;
private Button place_submit;
private Button place_delete;
private Context db = this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.place_edit_layout);
Place_Name = (EditText) findViewById(R.id.Place_Name);
Place_Address = (EditText) findViewById(R.id.Place_Address);
place_googlefind = (Button) findViewById(R.id.Place_googlefind);
place_submit = (Button) findViewById(R.id.Place_Button);
place_delete = (Button) findViewById(R.id.Place_delete);
mCancel = (Button) findViewById(R.id.cancel_Button);
mCancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
Bundle b = getIntent().getExtras();
getPlace_Id = b.getInt("id");
if (getPlace_Id == 0) {
Toast.makeText(getBaseContext(), "Cannot Edit/Delete Place None", Toast.LENGTH_LONG).show();
finish();
}
DatabaseHelper dbh = new DatabaseHelper(getApplicationContext());
Place_Name.setText(dbh.PlaceToString(getPlace_Id));
Place_Address.setText(dbh.PlaceToAddress(getPlace_Id));
place_googlefind.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getBaseContext(), ReplacePlace.class);
startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE);
}
});
place_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//convert input info to strings
String oldname = getPlace_Name;
getPlace_Name = Place_Name.getText().toString();
getPlace_Address = Place_Address.getText().toString();
if (getPlace_Name.length() > 0) {
//Adds location and address to the database
DatabaseHelper dbh = new DatabaseHelper(db);
SQLiteDatabase db = dbh.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(DbSchema.TableInfo.Place.PID, getPlace_Id);
values.put(DbSchema.TableInfo.Place.PN, getPlace_Name);
values.put(DbSchema.TableInfo.Place.PA, getPlace_Address);
db.update(DbSchema.TableInfo.Place_Table, values,
DbSchema.TableInfo.Place.PID + " = ?",
new String[] {Integer.toString(getPlace_Id)});
Toast.makeText(getBaseContext(), "Edited " + oldname + " to " + getPlace_Name + ".", Toast.LENGTH_LONG).show();
//clear out fields
Place_Name.setText("");
Place_Address.setText("");
//return to previous screen
finish();
}
}
});
place_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialogMessage();
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent data) {
if (requestCode == PLACE_AUTOCOMPLETE_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
String address = data.getStringExtra("Address");
String name = data.getStringExtra("Name");
getPlace_Address = address;
getPlace_Name = name;
Place_Name.setText(getPlace_Name);
Place_Address.setText(getPlace_Address);
}
}
}
private void showDialogMessage(){
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Delete Place");
builder.setMessage("Are you sure you want to delete this place? WARNING: ALL ENTRIES WITH THIS PLACE WILL BE CHANGED TO PLACE NONE");
// Add the buttons
builder.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked OK button
//todo delete cascade Current type and change all occurrences of this to None/ id 0
DatabaseHelper dbh = new DatabaseHelper(db);
SQLiteDatabase db = dbh.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(DbSchema.TableInfo.Deal.PID, "0");
db.update(DbSchema.TableInfo.Deal_Table, values, DbSchema.TableInfo.Deal.PID + " = ?", new String[]{Integer.toString(getPlace_Id)});
db.delete(DbSchema.TableInfo.Place_Table, DbSchema.TableInfo.Place.PID + " = " + getPlace_Id, null);
dialog.cancel();
finish();
}
});
builder.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
}
| [
"twirlbug@gmail.com"
] | twirlbug@gmail.com |
da21f359397ccf99a39d2618a8b660f45dee7b1d | 6aa22b1ee230bb446d1244926302cd52ee60d7c3 | /Tinder/app/src/main/java/com/example/tinder/Card/CardListener.java | 9694092080f92415fcd5905384265af98ea5c79a | [] | no_license | Sudhanshu-Jain/Paysense_Project | a0b9ee01372cc7a4a995fcba6b49ac338017c919 | c228f0472ffba76614da0d18318272dc2f31ab23 | refs/heads/master | 2021-01-23T01:40:12.258018 | 2017-03-31T10:52:00 | 2017-03-31T10:52:00 | 85,922,836 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | java | package com.example.tinder.Card;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;
import javax.xml.datatype.Duration;
/**
* Created by sudhanshu on 7/5/16.
*/
public class CardListener implements View.OnTouchListener {
public float x1;
public float x2;
static final int MIN_DISTANCE = 150;
public static final String TAG = CardListener.class.getSimpleName();
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
x1 = event.getX();
break;
case MotionEvent.ACTION_UP:
x2 = event.getX();
float deltaX = x2 - x1;
if (Math.abs(deltaX) > MIN_DISTANCE) {
// Left to Right swipe action
if (x2 > x1) {
Log.i(TAG, "Left to Right");
}
// Right to left swipe action
else {
Log.i(TAG, "Right to Left");
}
} else {
Log.i(TAG, "Please swipe for more distance");
}
// consider as something else - a screen tap for example
break;
}
return true;
}
}
| [
"jain.sudhanshu26@gmail.com"
] | jain.sudhanshu26@gmail.com |
6a2a79ffdac30bef881f464c79f2713934fe643b | 89a05c4cdcd8b2d8afdff39623377c84c1157041 | /src/test/java/com/example/dawon_lpg/DaWonLpgApplicationTests.java | 49ff12951f6b3d6cc7dd9d7628cc6f0afd777175 | [] | no_license | Wolf31742/DaWon_LPG | 4f584088b5c99c7aa557165aee0c07425eab2dd2 | f58fa328e5fe1458f708de1bf78289888c1daf70 | refs/heads/master | 2023-08-22T06:19:29.523546 | 2021-10-22T10:15:18 | 2021-10-22T10:15:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package com.example.dawon_lpg;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DaWonLpgApplicationTests {
@Test
void contextLoads() {
}
}
| [
"xotjddl1114@gmail.com"
] | xotjddl1114@gmail.com |
0206bd252a222115c3209a391cf32d0ed6009b97 | 6eb4d95e49ab7cb6efc72ca75f65f3750660325d | /src/main/java/com/company/googleplay/GooglePlayDetailInfoScraper.java | 8ab9456675fce92b9d8ed4c0e2328c1ddf3c0b79 | [] | no_license | Sw24sX/GooglePlayScraper | 6880ffde71160dac8b6a2142f0b6ea94984340bd | a538e8cbef826e60cc93426e5b50ec3bec54393f | refs/heads/master | 2023-04-06T13:26:20.954333 | 2021-04-26T13:08:40 | 2021-04-26T13:08:40 | 349,483,315 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,022 | java | package com.company.googleplay;
import com.company.scraper.App;
import com.company.scraper.detailed.FullAppInfo;
import com.company.scraper.detailed.StoreDetailedScraper;
import org.apache.http.client.utils.URIBuilder;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import java.text.NumberFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
public class GooglePlayDetailInfoScraper extends StoreDetailedScraper {
public GooglePlayDetailInfoScraper(String appDetailBaseUrl) {
super(appDetailBaseUrl);
}
public GooglePlayDetailInfoScraper() {
super("https://play.google.com/store/apps/details");
}
@Override
public void setQueryDetailedInfoParameters(URIBuilder builder, App app) {
builder.setParameter("id", app.id);
builder.setParameter("hl", "ru");
builder.setParameter("gl", "ru");
}
@Override
public FullAppInfo parseDetailInfoRequest(String responseHTML, App app) throws ParseException {
var document = Jsoup.parse(responseHTML);
var developer = document.getElementsByClass("R8zArc").first().text();
var scoreStr = document.getElementsByClass("BHMmbe").first().text();
var score = (Double)NumberFormat.getNumberInstance().parse(scoreStr);
var images = findImages(document);
var description = findDescription(document);
return new FullAppInfo(app, developer, score, description, images);
}
private List<String> findImages(Document document) {
var images = new ArrayList<String>();
for (Element element :document.getElementsByClass("T75of DYfLw")) {
var src = element.attr("src");
if (src.equals(""))
src = element.attr("data-src");
images.add(src);
}
return images;
}
private String findDescription(Document document) {
return document.getElementsByClass("DWPxHb").first().text();
}
}
| [
"aleksandr.korolyov.99@mail.ru"
] | aleksandr.korolyov.99@mail.ru |
71ee1beb5035ca09959a75455f4b3f45eee01bb9 | 725e221250ab351bb82a940cc5ff05b18d6926a8 | /src/main/java/com/aot/standard/context/init/InitWebConstantContext.java | 872f0dba0d35847256df1ca50b535f17e443e59e | [] | no_license | jwpark87/pcfems | b5766035a13cffb98f1e15df3ac6b1cfbebf1b0e | 122ef05d77ca85825daff65573f92bed6a5feeb1 | refs/heads/master | 2023-01-19T09:21:39.959412 | 2019-11-10T12:06:30 | 2019-11-10T12:06:30 | 315,533,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,923 | java | package com.aot.standard.context.init;
import com.aot.standard.common.constant.CommonCode;
import com.aot.standard.common.exception.CommonExceptionCode;
import com.aot.standard.common.util.AotDateUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import javax.servlet.ServletContext;
import java.lang.reflect.Field;
import java.util.TimeZone;
@Configuration
public class InitWebConstantContext {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private static String contextPath = null;
@Autowired(required = false)
public void setConstant(final ServletContext servletContext) throws IllegalArgumentException, IllegalAccessException {
this.setContextPath(servletContext);
final Field[] fields = CommonCode.class.getDeclaredFields();
for (final Field field : fields) {
// this.logger.info("servletContext.setAttribute(\"{}\", \"{}\");", field.getName(), field.get(field.getName()));
servletContext.setAttribute(field.getName(), field.get(field.getName()));
}
this.logger.info("CommonCode - Complete");
final CommonExceptionCode[] values = CommonExceptionCode.values();
for (final CommonExceptionCode value : values) {
// this.logger.info("servletContext.setAttribute(\"{}\", \"{}\");", value.name(), value.getCode());
servletContext.setAttribute(value.name(), value.getCode());
}
this.logger.info("CommonResultCode - Complete");
DateTimeZone.setDefault(AotDateUtils.TIME_ZONE);
TimeZone.setDefault(AotDateUtils.TIME_ZONE.toTimeZone());
servletContext.setAttribute("TIME_ZONE_ASIA_SEOUL", AotDateUtils.TIME_ZONE.getID());
servletContext.setAttribute("LOCALE_KOREAN", AotDateUtils.LOCALE.toString());
this.logger.info("DateTimeZone/TimeZone.setDefault(\"{}\"); - Complete", AotDateUtils.TIME_ZONE.getID());
}
private void setContextPath(final ServletContext servletContext) {
if (contextPath == null) {
String tempContextPath = servletContext.getContextPath();
if (StringUtils.equals(tempContextPath, "/")) {
tempContextPath = "";
}
if (StringUtils.isNotEmpty(tempContextPath) && StringUtils.endsWith(tempContextPath, "/")) {
tempContextPath = StringUtils.removeEnd(tempContextPath, "/");
}
contextPath = tempContextPath;
}
servletContext.setAttribute("CONTEXT_PATH", contextPath);
this.logger.info("servletContext.setAttribute(\"CONTEXT_PATH\", \"{}\");", contextPath);
}
public static String getContextPath() {
return contextPath;
}
}
| [
"bestheroz@gmail.com"
] | bestheroz@gmail.com |
76f931187d5b2ac8337aed4d68aff55d64d2726b | 30c9dda3b97566da565aa641f96c13a624efcea3 | /src/main/java/cxsjcj/hdsx/com/view/badgeview/utils/StringUtils.java | 6c808de890da52f26c625526396343330a6cef36 | [] | no_license | dawitephrem565/ShoppingMall | 664039a72e8c298e5998e3321f767600c6c39f5d | 9b0c7eeb01f4cf57fe82fad55f34d70b14d7cc19 | refs/heads/master | 2020-04-03T12:00:09.435686 | 2015-11-08T13:54:17 | 2015-11-08T13:54:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package cxsjcj.hdsx.com.view.badgeview.utils;
import cxsjcj.hdsx.com.view.badgeview.values.IValue;
import cxsjcj.hdsx.com.view.badgeview.values.TextValue;
public class StringUtils {
public static boolean isNumber(IValue value) {
if (value instanceof TextValue) {
CharSequence str = ((TextValue) value).getValue();
return isNumber(str);
} else {
return false;
}
}
public static boolean isNumber(CharSequence str) {
try {
Double.parseDouble(str.toString());
} catch (NumberFormatException nfe) {
return false;
}
return true;
}
}
| [
"1038127753@qq.com"
] | 1038127753@qq.com |
70791699f44da0afb8f20cf96703fe40c312f0cf | 5d1601f8088337d892ae307a2049402b411b65a1 | /src/SurroundedRegions.java | 7bec1ea577a3d10e55071b5753afa1ac2fedb327 | [] | no_license | pennywong/leetcode | 999bde274bec65a7d008185f28d82132632f4fc6 | db1b4db69e2a1c09ae5b81254ff574a730568b83 | refs/heads/master | 2021-01-19T13:30:39.109808 | 2015-01-30T01:36:42 | 2015-01-30T01:36:42 | 26,159,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,885 | java | import java.util.LinkedList;
import java.util.Queue;
/**
* https://oj.leetcode.com/problems/surrounded-regions/
* <p/>
* Created by Penny on 2015/01/14
*/
public class SurroundedRegions {
public void solve(char[][] board) {
if (board == null)
return;
int row = board.length;
if (row <= 1)
return;
int column = board[0].length;
if (column <= 1)
return;
Queue<String> queue = new LinkedList<String>();
for (int i = 0; i < column; i++) {
if (board[0][i] == 'O')
queue.add("0," + i);
if (board[row - 1][i] == 'O')
queue.add((row - 1) + "," + i);
}
for (int i = 0; i < row; i++) {
if (board[i][0] == 'O')
queue.add(i + ",0");
if (board[i][column - 1] == 'O')
queue.add(i + "," + (column - 1));
}
while (!queue.isEmpty()) {
String string = queue.poll();
String[] strings = string.split(",");
int i = Integer.parseInt(strings[0]);
int j = Integer.parseInt(strings[1]);
board[i][j] = 'Z';
if (i - 1 > 0 && board[i - 1][j] == 'O')
queue.add((i - 1) + "," + j);
if (i + 1 < row && board[i + 1][j] == 'O')
queue.add((i + 1) + "," + j);
if (j - 1 > 0 && board[i][j - 1] == 'O')
queue.add(i + "," + (j - 1));
if (j + 1 < column && board[i][j + 1] == 'O')
queue.add(i + "," + (j + 1));
}
for (int i = 0; i < row; i++) {
for (int j = 0; j < column; j++) {
if (board[i][j] == 'O')
board[i][j] = 'X';
if (board[i][j] == 'Z')
board[i][j] = 'O';
}
}
}
}
| [
"ipennywong@gmail.com"
] | ipennywong@gmail.com |
ad07f1a13a7dd16070df208ccd39262a7b845f15 | ece51612da919483357ffef392284c51dc6950b3 | /Excel2Code/src/main/java/ls/tools/excel/model/VarExpr.java | 1851d7ce4ebbcc7b22bcdb30a9433c0c0531d049 | [] | no_license | slior/MaybeUseful | a0ba49f0b0170e903e9625ec2486cf56ed794828 | 40a18313838ca2ef3f0f95cc21fd1f5e7d7f10ff | refs/heads/master | 2016-09-02T06:11:58.176511 | 2014-06-27T15:46:40 | 2014-06-27T15:46:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89 | java | package ls.tools.excel.model;
public interface VarExpr extends Expr
{
String name();
}
| [
"lior.schejter@gmail.com"
] | lior.schejter@gmail.com |
5bb57eef13a2fc20c9f148a2de922dc1d4a3dbf0 | c89ef3832c11b98150999ef2b54c893e5cd3f728 | /src/com/paulodorow/decypher/operations/Subtraction.java | 9f77a4b69696e18cc0218fc438a5c3f2bd97b6c1 | [] | no_license | Mars-Wei/decypher | 39f30803b79e729637344e5ba0f1575ae7c84c03 | 19bf83936279a810b67382112ae99b9c5706f813 | refs/heads/master | 2020-03-18T22:58:46.525641 | 2017-08-10T18:13:01 | 2017-08-10T18:13:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,086 | java | package com.paulodorow.decypher.operations;
import java.util.ArrayList;
import java.util.List;
import com.paulodorow.decypher.HasContext;
import com.paulodorow.decypher.IsOperand;
public class Subtraction extends Operation<Subtraction> {
List<IsOperand<?>> subtraends;
public Subtraction() {
subtraends = new ArrayList<>();
}
public Subtraction(IsOperand<?> minuend) {
this();
subtract(minuend);
}
public Subtraction(IsOperand<?> minuend, IsOperand<?> subtraend) {
this();
subtract(minuend, subtraend);
}
public Subtraction subtract(IsOperand<?>... subtraends) {
for (IsOperand<?> subtraend : subtraends) if (subtraend != null) this.subtraends.add(subtraend);
return this;
}
@Override
public String toReturnableString(HasContext context) {
StringBuilder subtraction = new StringBuilder();
for (IsOperand<?> subtraend : subtraends) {
if (subtraction.length() > 0) subtraction.append(" - ");
subtraction.append(context.getInContext(subtraend).toReturnableString(context));
}
return subtraction.toString();
}
}
| [
"paulo.dorow@gmail.com"
] | paulo.dorow@gmail.com |
383c9b772d6d11ec646f7e3b9fb304032c9dc02b | 74d5ffa178c3cd3580e16faeb4b75813cffa1e88 | /src/main/java/com/example/recipeapp/services/IngredientServiceImpl.java | 8ec3009dcb83a127fd740c0ef7450e2349ae6e86 | [] | no_license | rbaliwal00/recipe-app | ae0921e3fe0b91c8c5c4fa37b07faa9f6a9ab9c0 | b29b28d188b100a22d7f1581d3df257c8b95c4e7 | refs/heads/main | 2023-07-04T22:58:46.977919 | 2021-08-27T13:45:33 | 2021-08-27T13:45:33 | 394,674,831 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,094 | java | package com.example.recipeapp.services;
import com.example.recipeapp.commands.IngredientCommand;
import com.example.recipeapp.converters.IngredientCommandToIngredient;
import com.example.recipeapp.converters.IngredientToIngredientCommand;
import com.example.recipeapp.domain.Ingredient;
import com.example.recipeapp.domain.Recipe;
import com.example.recipeapp.repostitories.RecipeRepository;
import com.example.recipeapp.repostitories.UnitOfMeasureRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Optional;
@Slf4j
@Service
public class IngredientServiceImpl implements IngredientService {
private final IngredientToIngredientCommand ingredientToIngredientCommand;
private final IngredientCommandToIngredient ingredientCommandToIngredient;
private final RecipeRepository recipeRepository;
private final UnitOfMeasureRepository unitOfMeasureRepository;
public IngredientServiceImpl(IngredientToIngredientCommand ingredientToIngredientCommand,
IngredientCommandToIngredient ingredientCommandToIngredient,
RecipeRepository recipeRepository,
UnitOfMeasureRepository unitOfMeasureRepository) {
this.ingredientToIngredientCommand = ingredientToIngredientCommand;
this.ingredientCommandToIngredient = ingredientCommandToIngredient;
this.recipeRepository = recipeRepository;
this.unitOfMeasureRepository = unitOfMeasureRepository;
}
@Override
public IngredientCommand findByRecipeIdAndIngredientId(Long recipeId, Long ingredientId) {
Optional<Recipe> recipeOptional = recipeRepository.findById(recipeId);
if (!((Optional<?>) recipeOptional).isPresent()){
//todo impl error handling
log.error("recipe id not found. Id: " + recipeId);
}
Recipe recipe = recipeOptional.get();
Optional<IngredientCommand> ingredientCommandOptional = recipe.getIngredients().stream()
.filter(ingredient -> ingredient.getId().equals(ingredientId))
.map( ingredient -> ingredientToIngredientCommand.convert(ingredient)).findFirst();
if(!ingredientCommandOptional.isPresent()){
//todo impl error handling
log.error("Ingredient id not found: " + ingredientId);
}
return ingredientCommandOptional.get();
}
@Override
@Transactional
public IngredientCommand saveIngredientCommand(IngredientCommand command) {
Optional<Recipe> recipeOptional = recipeRepository.findById(command.getRecipeId());
if(!recipeOptional.isPresent()){
//todo toss error if not found!
log.error("Recipe not found for id: " + command.getRecipeId());
return new IngredientCommand();
} else {
Recipe recipe = recipeOptional.get();
Optional<Ingredient> ingredientOptional = recipe
.getIngredients()
.stream()
.filter(ingredient -> ingredient.getId().equals(command.getId()))
.findFirst();
if(ingredientOptional.isPresent()){
Ingredient ingredientFound = ingredientOptional.get();
ingredientFound.setDescription(command.getDescription());
ingredientFound.setAmount(command.getAmount());
ingredientFound.setUom(unitOfMeasureRepository
.findById(command.getUom().getId())
.orElseThrow(() -> new RuntimeException("UOM NOT FOUND"))); //todo address this
} else {
//add new Ingredient
Ingredient ingredient = ingredientCommandToIngredient.convert(command);
ingredient.setRecipe(recipe);
recipe.addIngredient(ingredient);
}
Recipe savedRecipe = recipeRepository.save(recipe);
Optional<Ingredient> savedIngredientOptional = savedRecipe.getIngredients().stream()
.filter(recipeIngredients -> recipeIngredients.getId().equals(command.getId()))
.findFirst();
//check by description
if(!savedIngredientOptional.isPresent()){
//not totally safe... But best guess
savedIngredientOptional = savedRecipe.getIngredients().stream()
.filter(recipeIngredients -> recipeIngredients.getDescription().equals(command.getDescription()))
.filter(recipeIngredients -> recipeIngredients.getAmount().equals(command.getAmount()))
.filter(recipeIngredients -> recipeIngredients.getUom().getId().equals(command.getUom().getId()))
.findFirst();
}
//to do check for fail
return ingredientToIngredientCommand.convert(savedIngredientOptional.get());
}
}
@Override
public void deleteById(Long recipeId, Long idToDelete) {
log.debug("Deleting ingredient: " + recipeId + ":" + idToDelete);
Optional<Recipe> recipeOptional = recipeRepository.findById(recipeId);
if(recipeOptional.isPresent()){
Recipe recipe = recipeOptional.get();
log.debug("found recipe");
Optional<Ingredient> ingredientOptional = recipe
.getIngredients()
.stream()
.filter(ingredient -> ingredient.getId().equals(idToDelete))
.findFirst();
if(ingredientOptional.isPresent()){
log.debug("found Ingredient");
Ingredient ingredientToDelete = ingredientOptional.get();
ingredientToDelete.setRecipe(null);
recipe.getIngredients().remove(ingredientOptional.get());
recipeRepository.save(recipe);
}
} else {
log.debug("Recipe Id Not found. Id:" + recipeId);
}
}
}
| [
"rajan18baliwal@gmail.com"
] | rajan18baliwal@gmail.com |
99e62baa6e154dd66a5f1c949506e12438059f53 | ac55c6f74fc083c83b20485a64ab1dfab59b5706 | /app/src/main/java/com/example/dell/childcare/LearningActivity.java | acbf4d71c43af222f911e89f4f15a6e8ea90ce8b | [] | no_license | BinayMdr/ChildCare | fb8b9b02476eea21c1dd288d94830a8c24357528 | ad8468c67e9c5fe7688135f28b17dc2cba7dda63 | refs/heads/master | 2020-06-16T14:11:23.449766 | 2019-07-03T17:41:23 | 2019-07-03T17:41:23 | 195,603,992 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,793 | java | package com.example.dell.childcare;
import android.support.design.widget.TabLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class LearningActivity extends AppCompatActivity{
private static final String TAG = "MainActivity";
private SectionPageAdapter mSectionsPageAdapter;
private ViewPager mViewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_learning);
Log.d(TAG, "onCreate: Starting.");
mSectionsPageAdapter = new SectionPageAdapter(getSupportFragmentManager());
// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
setupViewPager(mViewPager);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
}
private void setupViewPager(ViewPager viewPager) {
SectionPageAdapter adapter = new SectionPageAdapter(getSupportFragmentManager());
adapter.addFragment(new FragementTab1(), "Number");
adapter.addFragment(new FragmentTab2(), "Alphabet");
viewPager.setAdapter(adapter);
}
}
| [
"binaymdr25@gmail.com"
] | binaymdr25@gmail.com |
2b7f9269e63720d0bb6cc2b762e31c3e9e4b43bd | bb9c6e7ce32081bf90e8b3c22406bd5e39eac6ff | /src/main/java/edu/zzuli/brand/pojo/po/Items.java | 6b813fa8bea29d9277c3d7e17e1920641e3b5fe6 | [] | no_license | duneF/brand | fad658f66574cd1968a9e5088a550113c4d3a8a0 | a2f1805be0150a5718ae9d3ff7bcaf1a2168e7b5 | refs/heads/master | 2021-01-24T01:29:33.603104 | 2018-02-25T06:36:13 | 2018-02-25T06:36:13 | 122,811,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,900 | java | package edu.zzuli.brand.pojo.po;
public class Items {
private String iid;
private String name;
private String function;
private Double budget;
private String icategory;
private String iprotfolio;
private String zishu;
private String ec;
private String year;
private String content;
private String linkman;
private String tel;
private Byte status;
private String bid;
private String cid;
public String getIid() {
return iid;
}
public void setIid(String iid) {
this.iid = iid == null ? null : iid.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getFunction() {
return function;
}
public void setFunction(String function) {
this.function = function == null ? null : function.trim();
}
public Double getBudget() {
return budget;
}
public void setBudget(Double budget) {
this.budget = budget;
}
public String getIcategory() {
return icategory;
}
public void setIcategory(String icategory) {
this.icategory = icategory == null ? null : icategory.trim();
}
public String getIprotfolio() {
return iprotfolio;
}
public void setIprotfolio(String iprotfolio) {
this.iprotfolio = iprotfolio == null ? null : iprotfolio.trim();
}
public String getZishu() {
return zishu;
}
public void setZishu(String zishu) {
this.zishu = zishu == null ? null : zishu.trim();
}
public String getEc() {
return ec;
}
public void setEc(String ec) {
this.ec = ec == null ? null : ec.trim();
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year == null ? null : year.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
public String getLinkman() {
return linkman;
}
public void setLinkman(String linkman) {
this.linkman = linkman == null ? null : linkman.trim();
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel == null ? null : tel.trim();
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public String getBid() {
return bid;
}
public void setBid(String bid) {
this.bid = bid == null ? null : bid.trim();
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid == null ? null : cid.trim();
}
} | [
"125712187@qq.com"
] | 125712187@qq.com |
f8be355b6ddefa2f2f3798f73c3f5e8ec67d5fc1 | 0ebe3e02b356b492feb38e5278b084f46c8e286a | /src/guardedSuspension/RequestQueue.java | 9e41598cebe6bad9d6a98c7642809a694580caee | [] | no_license | hwjworld/DesginPatternTest | 48f66b5980361214d42b20f8f4f4da39c7bd36ac | 2331e1cfd189936f295c0cd0dc6755c99644e390 | refs/heads/master | 2020-05-20T09:10:26.110219 | 2013-07-24T16:07:30 | 2013-07-24T16:07:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 494 | java | package guardedSuspension;
public class RequestQueue {
private java.util.LinkedList queue;
public RequestQueue() {
queue = new java.util.LinkedList();
}
public synchronized Request getRequest() {
while (queue.size() <= 0) {
try {
wait();
} catch (InterruptedException e) {
}
}
return (Request) queue.removeFirst();
}
public synchronized void putRequest(Request request) {
queue.addLast(request);
notifyAll();
}
}
class Request{
}
| [
"canni3269@gmail.com"
] | canni3269@gmail.com |
f6a93121b3a20e261b35923d2b2cb83bfedd94fc | bceba483c2d1831f0262931b7fc72d5c75954e18 | /src/qubed/corelogicextensions/CREDITFREEZEPIN.java | 2e80a97ba5089f38ec7672c8adfbe5054ff563fd | [] | no_license | Nigel-Qubed/credit-services | 6e2acfdb936ab831a986fabeb6cefa74f03c672c | 21402c6d4328c93387fd8baf0efd8972442d2174 | refs/heads/master | 2022-12-01T02:36:57.495363 | 2020-08-10T17:26:07 | 2020-08-10T17:26:07 | 285,552,565 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,986 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2020.08.05 at 04:53:09 AM CAT
//
package qubed.corelogicextensions;
import java.util.HashMap;
import java.util.Map;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.namespace.QName;
/**
* <p>Java class for CREDIT_FREEZE_PIN complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="CREDIT_FREEZE_PIN">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="CreditFreezePINValue" type="{http://www.mismo.org/residential/2009/schemas}MISMOValue" minOccurs="0"/>
* <element name="CreditRepositorySourceType" type="{http://www.mismo.org/residential/2009/schemas}CreditRepositorySourceEnum" minOccurs="0"/>
* <element name="CreditRepositorySourceTypeOtherDescription" type="{http://www.mismo.org/residential/2009/schemas}MISMOString" minOccurs="0"/>
* <element name="EXTENSION" type="{http://www.mismo.org/residential/2009/schemas}CREDIT_FREEZE_PIN_EXTENSION" minOccurs="0"/>
* </sequence>
* <attGroup ref="{http://www.w3.org/1999/xlink}MISMOresourceLink"/>
* <attGroup ref="{http://www.mismo.org/residential/2009/schemas}AttributeExtension"/>
* <attribute name="SequenceNumber" type="{http://www.mismo.org/residential/2009/schemas}MISMOSequenceNumber_Base" />
* <anyAttribute processContents='lax'/>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CREDIT_FREEZE_PIN", propOrder = {
"creditFreezePINValue",
"creditRepositorySourceType",
"creditRepositorySourceTypeOtherDescription",
"extension"
})
public class CREDITFREEZEPIN {
@XmlElementRef(name = "CreditFreezePINValue", namespace = "http://www.mismo.org/residential/2009/schemas", type = JAXBElement.class, required = false)
protected JAXBElement<MISMOValue> creditFreezePINValue;
@XmlElementRef(name = "CreditRepositorySourceType", namespace = "http://www.mismo.org/residential/2009/schemas", type = JAXBElement.class, required = false)
protected JAXBElement<CreditRepositorySourceEnum> creditRepositorySourceType;
@XmlElementRef(name = "CreditRepositorySourceTypeOtherDescription", namespace = "http://www.mismo.org/residential/2009/schemas", type = JAXBElement.class, required = false)
protected JAXBElement<MISMOString> creditRepositorySourceTypeOtherDescription;
@XmlElement(name = "EXTENSION")
protected CREDITFREEZEPINEXTENSION extension;
@XmlAttribute(name = "SequenceNumber")
protected Integer sequenceNumber;
@XmlAttribute(name = "label", namespace = "http://www.w3.org/1999/xlink")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
protected String label;
@XmlAnyAttribute
private Map<QName, String> otherAttributes = new HashMap<QName, String>();
/**
* Gets the value of the creditFreezePINValue property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link MISMOValue }{@code >}
*
*/
public JAXBElement<MISMOValue> getCreditFreezePINValue() {
return creditFreezePINValue;
}
/**
* Sets the value of the creditFreezePINValue property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link MISMOValue }{@code >}
*
*/
public void setCreditFreezePINValue(JAXBElement<MISMOValue> value) {
this.creditFreezePINValue = value;
}
/**
* Gets the value of the creditRepositorySourceType property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link CreditRepositorySourceEnum }{@code >}
*
*/
public JAXBElement<CreditRepositorySourceEnum> getCreditRepositorySourceType() {
return creditRepositorySourceType;
}
/**
* Sets the value of the creditRepositorySourceType property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link CreditRepositorySourceEnum }{@code >}
*
*/
public void setCreditRepositorySourceType(JAXBElement<CreditRepositorySourceEnum> value) {
this.creditRepositorySourceType = value;
}
/**
* Gets the value of the creditRepositorySourceTypeOtherDescription property.
*
* @return
* possible object is
* {@link JAXBElement }{@code <}{@link MISMOString }{@code >}
*
*/
public JAXBElement<MISMOString> getCreditRepositorySourceTypeOtherDescription() {
return creditRepositorySourceTypeOtherDescription;
}
/**
* Sets the value of the creditRepositorySourceTypeOtherDescription property.
*
* @param value
* allowed object is
* {@link JAXBElement }{@code <}{@link MISMOString }{@code >}
*
*/
public void setCreditRepositorySourceTypeOtherDescription(JAXBElement<MISMOString> value) {
this.creditRepositorySourceTypeOtherDescription = value;
}
/**
* Gets the value of the extension property.
*
* @return
* possible object is
* {@link CREDITFREEZEPINEXTENSION }
*
*/
public CREDITFREEZEPINEXTENSION getEXTENSION() {
return extension;
}
/**
* Sets the value of the extension property.
*
* @param value
* allowed object is
* {@link CREDITFREEZEPINEXTENSION }
*
*/
public void setEXTENSION(CREDITFREEZEPINEXTENSION value) {
this.extension = value;
}
/**
* Gets the value of the sequenceNumber property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getSequenceNumber() {
return sequenceNumber;
}
/**
* Sets the value of the sequenceNumber property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setSequenceNumber(Integer value) {
this.sequenceNumber = value;
}
/**
* Gets the value of the label property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLabel() {
return label;
}
/**
* Sets the value of the label property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLabel(String value) {
this.label = value;
}
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*
* <p>
* the map is keyed by the name of the attribute and
* the value is the string value of the attribute.
*
* the map returned by this method is live, and you can add new attribute
* by updating the map directly. Because of this design, there's no setter.
*
*
* @return
* always non-null
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
}
| [
"vectorcrael@yahoo.com"
] | vectorcrael@yahoo.com |
9459eebc20565dee9a072a78d08aab9b469158f4 | 63a9c24defb4bffc7ce97f42222f5bfbb671a87a | /shop/src/net/shopxx/controller/business/FullReductionPromotionController.java | c9edd9ed0c657b04df86506de4bf538202b47afd | [] | no_license | zhanglize-paomo/shop | 438437b26c79b8137a9b22edf242a5df49fa5c2e | d5728b263fa3cabf917e7a37bc1ca6986c68b019 | refs/heads/master | 2022-12-20T22:40:57.549683 | 2019-12-18T09:04:11 | 2019-12-18T09:04:11 | 228,772,639 | 0 | 1 | null | 2022-12-16T11:10:26 | 2019-12-18T06:24:10 | FreeMarker | UTF-8 | Java | false | false | 14,391 | java | /*
* Copyright 2005-2017 shopxx.net. All rights reserved.
* Support: http://www.shopxx.net
* License: http://www.shopxx.net/license
*/
package net.shopxx.controller.business;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.Predicate;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import net.shopxx.Pageable;
import net.shopxx.Results;
import net.shopxx.entity.Business;
import net.shopxx.entity.Product;
import net.shopxx.entity.Promotion;
import net.shopxx.entity.PromotionPluginSvc;
import net.shopxx.entity.Sku;
import net.shopxx.entity.Store;
import net.shopxx.exception.UnauthorizedException;
import net.shopxx.plugin.PaymentPlugin;
import net.shopxx.plugin.PromotionPlugin;
import net.shopxx.plugin.fullReductionPromotion.FullReductionPromotionPlugin;
import net.shopxx.security.CurrentStore;
import net.shopxx.security.CurrentUser;
import net.shopxx.service.CouponService;
import net.shopxx.service.MemberRankService;
import net.shopxx.service.PluginService;
import net.shopxx.service.PromotionService;
import net.shopxx.service.SkuService;
import net.shopxx.service.StoreService;
import net.shopxx.service.SvcService;
import net.shopxx.util.WebUtils;
/**
* Controller - 满减促销
*
* @author SHOP++ Team
* @version 5.0
*/
@Controller("businessFullReductionPromotionController")
@RequestMapping("/business/full_reduction_promotion")
public class FullReductionPromotionController extends BaseController {
@Inject
private PromotionService promotionService;
@Inject
private MemberRankService memberRankService;
@Inject
private SkuService skuService;
@Inject
private CouponService couponService;
@Inject
private StoreService storeService;
@Inject
private PluginService pluginService;
@Inject
private SvcService svcService;
/**
* 添加属性
*/
@ModelAttribute
public void populateModel(Long promotionId, @CurrentStore Store currentStore, ModelMap model) {
Promotion promotion = promotionService.find(promotionId);
if (promotion != null && !currentStore.equals(promotion.getStore())) {
throw new UnauthorizedException();
}
model.addAttribute("promotion", promotion);
}
/**
* 计算
*/
@GetMapping("/calculate")
public ResponseEntity<?> calculate(String paymentPluginId, Integer months, Boolean useBalance) {
Map<String, Object> data = new HashMap<>();
PromotionPlugin promotionPlugin = pluginService.getPromotionPlugin(FullReductionPromotionPlugin.ID);
if (promotionPlugin == null || !promotionPlugin.getIsEnabled()) {
return Results.UNPROCESSABLE_ENTITY;
}
if (months == null || months <= 0) {
return Results.UNPROCESSABLE_ENTITY;
}
BigDecimal amount = promotionPlugin.getPrice().multiply(new BigDecimal(months));
if (BooleanUtils.isTrue(useBalance)) {
data.put("fee", BigDecimal.ZERO);
data.put("amount", amount);
data.put("useBalance", true);
} else {
PaymentPlugin paymentPlugin = pluginService.getPaymentPlugin(paymentPluginId);
if (paymentPlugin == null || !paymentPlugin.getIsEnabled()) {
return Results.UNPROCESSABLE_ENTITY;
}
data.put("fee", paymentPlugin.calculateFee(amount));
data.put("amount", paymentPlugin.calculateAmount(amount));
data.put("useBalance", false);
}
return ResponseEntity.ok(data);
}
/**
* 到期日期
*/
@GetMapping("/end_date")
public @ResponseBody Map<String, Object> endDate(@CurrentStore Store currentStore) {
Map<String, Object> data = new HashMap<>();
data.put("endDate", currentStore.getFullReductionPromotionEndDate());
return data;
}
/**
* 购买
*/
@GetMapping("/buy")
public String buy(@CurrentStore Store currentStore, ModelMap model) {
if (currentStore.getType().equals(Store.Type.self) && currentStore.getFullReductionPromotionEndDate() == null) {
return "redirect:list";
}
PromotionPlugin promotionPlugin = pluginService.getPromotionPlugin(FullReductionPromotionPlugin.ID);
if (promotionPlugin == null || !promotionPlugin.getIsEnabled()) {
return UNPROCESSABLE_ENTITY_VIEW;
}
List<PaymentPlugin> paymentPlugins = pluginService.getActivePaymentPlugins(WebUtils.getRequest());
if (CollectionUtils.isNotEmpty(paymentPlugins)) {
model.addAttribute("defaultPaymentPlugin", paymentPlugins.get(0));
model.addAttribute("paymentPlugins", paymentPlugins);
}
model.addAttribute("promotionPlugin", promotionPlugin);
return "business/full_reduction_promotion/buy";
}
/**
* 购买
*/
@PostMapping("/buy")
public ResponseEntity<?> buy(Integer months, Boolean useBalance, @CurrentStore Store currentStore, @CurrentUser Business currentUser) {
Map<String, Object> data = new HashMap<>();
PromotionPlugin promotionPlugin = pluginService.getPromotionPlugin(FullReductionPromotionPlugin.ID);
if (currentStore.getType().equals(Store.Type.self) && currentStore.getFullReductionPromotionEndDate() == null) {
return Results.UNPROCESSABLE_ENTITY;
}
if (promotionPlugin == null || !promotionPlugin.getIsEnabled()) {
return Results.UNPROCESSABLE_ENTITY;
}
if (months == null || months <= 0) {
return Results.UNPROCESSABLE_ENTITY;
}
int days = months * 30;
BigDecimal amount = promotionPlugin.getPrice().multiply(new BigDecimal(months));
if (amount.compareTo(BigDecimal.ZERO) > 0) {
if (BooleanUtils.isTrue(useBalance)) {
if (currentUser.getBalance().compareTo(amount) < 0) {
return Results.unprocessableEntity("business.fullReductionPromotion.insufficientBalance");
}
storeService.buy(currentStore, promotionPlugin, months);
} else {
PromotionPluginSvc promotionPluginSvc = new PromotionPluginSvc();
promotionPluginSvc.setAmount(amount);
promotionPluginSvc.setDurationDays(days);
promotionPluginSvc.setStore(currentStore);
promotionPluginSvc.setPromotionPluginId(FullReductionPromotionPlugin.ID);
svcService.save(promotionPluginSvc);
data.put("promotionPluginSvcSn", promotionPluginSvc.getSn());
}
} else {
storeService.addFullReductionPromotionEndDays(currentStore, days);
}
return ResponseEntity.ok(data);
}
/**
* 赠品选择
*/
@GetMapping("/gift_select")
public @ResponseBody List<Map<String, Object>> giftSelect(String keyword, Long[] excludeIds, @CurrentUser Business currentUser) {
List<Map<String, Object>> data = new ArrayList<>();
if (StringUtils.isEmpty(keyword)) {
return data;
}
Set<Sku> excludes = new HashSet<>(skuService.findList(excludeIds));
List<Sku> skus = skuService.search(currentUser.getStore(), Product.Type.gift, keyword, excludes, null);
for (Sku sku : skus) {
Map<String, Object> item = new HashMap<>();
item.put("id", sku.getId());
item.put("sn", sku.getSn());
item.put("name", sku.getName());
item.put("specifications", sku.getSpecifications());
item.put("path", sku.getPath());
data.add(item);
}
return data;
}
/**
* 添加
*/
@GetMapping("/add")
public String add(@CurrentStore Store currentStore, ModelMap model) {
model.addAttribute("memberRanks", memberRankService.findAll());
model.addAttribute("coupons", couponService.findList(currentStore));
return "business/full_reduction_promotion/add";
}
/**
* 保存
*/
@PostMapping("/save")
public String save(@ModelAttribute("promotionForm") Promotion promotionForm, Boolean useAmountPromotion, Boolean useNumberPromotion, Long[] memberRankIds, Long[] couponIds, Long[] giftIds, @CurrentStore Store currentStore, RedirectAttributes redirectAttributes) {
promotionForm.setType(Promotion.Type.fullReduction);
promotionForm.setStore(currentStore);
promotionForm.setMemberRanks(new HashSet<>(memberRankService.findList(memberRankIds)));
promotionForm.setCoupons(new HashSet<>(couponService.findList(couponIds)));
if (ArrayUtils.isNotEmpty(giftIds)) {
List<Sku> gifts = skuService.findList(giftIds);
CollectionUtils.filter(gifts, new Predicate() {
public boolean evaluate(Object object) {
Sku gift = (Sku) object;
return gift != null && Product.Type.gift.equals(gift.getType());
}
});
promotionForm.setGifts(new HashSet<>(gifts));
} else {
promotionForm.setGifts(null);
}
if (!isValid(promotionForm)) {
return UNPROCESSABLE_ENTITY_VIEW;
}
if (promotionForm.getBeginDate() != null && promotionForm.getEndDate() != null && promotionForm.getBeginDate().after(promotionForm.getEndDate())) {
return UNPROCESSABLE_ENTITY_VIEW;
}
if (promotionForm.getMinimumQuantity() != null && promotionForm.getMaximumQuantity() != null && promotionForm.getMinimumQuantity() > promotionForm.getMaximumQuantity()) {
return UNPROCESSABLE_ENTITY_VIEW;
}
if (promotionForm.getMinimumPrice() != null && promotionForm.getMaximumPrice() != null && promotionForm.getMinimumPrice().compareTo(promotionForm.getMaximumPrice()) > 0) {
return UNPROCESSABLE_ENTITY_VIEW;
}
PromotionPlugin promotionPlugin = pluginService.getPromotionPlugin(FullReductionPromotionPlugin.ID);
String priceExpression = promotionPlugin.getPriceExpression(promotionForm, useAmountPromotion, useNumberPromotion);
if (StringUtils.isNotEmpty(priceExpression) && !promotionService.isValidPriceExpression(priceExpression)) {
return UNPROCESSABLE_ENTITY_VIEW;
}
promotionForm.setPriceExpression(priceExpression);
promotionForm.setProducts(null);
promotionForm.setProductCategories(null);
promotionService.save(promotionForm);
addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
return "redirect:list";
}
/**
* 编辑
*/
@GetMapping("/edit")
public String edit(@ModelAttribute(binding = false) Promotion promotion, @CurrentStore Store currentStore, ModelMap model) {
if (promotion == null) {
return UNPROCESSABLE_ENTITY_VIEW;
}
model.addAttribute("promotion", promotion);
model.addAttribute("memberRanks", memberRankService.findAll());
model.addAttribute("coupons", couponService.findList(currentStore));
return "business/full_reduction_promotion/edit";
}
/**
* 更新
*/
@PostMapping("/update")
public String update(@ModelAttribute("promotionForm") Promotion promotionForm, @ModelAttribute(binding = false) Promotion promotion, Boolean useAmountPromotion, Boolean useNumberPromotion, Long[] memberRankIds, Long[] couponIds, Long[] giftIds, RedirectAttributes redirectAttributes) {
if (promotion == null) {
return UNPROCESSABLE_ENTITY_VIEW;
}
promotionForm.setMemberRanks(new HashSet<>(memberRankService.findList(memberRankIds)));
promotionForm.setCoupons(new HashSet<>(couponService.findList(couponIds)));
if (ArrayUtils.isNotEmpty(giftIds)) {
List<Sku> gifts = skuService.findList(giftIds);
CollectionUtils.filter(gifts, new Predicate() {
public boolean evaluate(Object object) {
Sku gift = (Sku) object;
return gift != null && Product.Type.gift.equals(gift.getType());
}
});
promotionForm.setGifts(new HashSet<>(gifts));
} else {
promotionForm.setGifts(null);
}
if (promotionForm.getBeginDate() != null && promotionForm.getEndDate() != null && promotionForm.getBeginDate().after(promotionForm.getEndDate())) {
return UNPROCESSABLE_ENTITY_VIEW;
}
if (promotionForm.getMinimumQuantity() != null && promotionForm.getMaximumQuantity() != null && promotionForm.getMinimumQuantity() > promotionForm.getMaximumQuantity()) {
return UNPROCESSABLE_ENTITY_VIEW;
}
if (promotionForm.getMinimumPrice() != null && promotionForm.getMaximumPrice() != null && promotionForm.getMinimumPrice().compareTo(promotionForm.getMaximumPrice()) > 0) {
return UNPROCESSABLE_ENTITY_VIEW;
}
PromotionPlugin promotionPlugin = pluginService.getPromotionPlugin(FullReductionPromotionPlugin.ID);
String priceExpression = promotionPlugin.getPriceExpression(promotionForm, useAmountPromotion, useNumberPromotion);
if (StringUtils.isNotEmpty(priceExpression) && !promotionService.isValidPriceExpression(priceExpression)) {
return UNPROCESSABLE_ENTITY_VIEW;
}
if (useAmountPromotion != null && useAmountPromotion) {
promotionForm.setConditionsNumber(null);
promotionForm.setCreditNumber(null);
} else if (useNumberPromotion != null && useNumberPromotion) {
promotionForm.setConditionsAmount(null);
promotionForm.setCreditAmount(null);
} else {
promotionForm.setConditionsNumber(null);
promotionForm.setCreditNumber(null);
promotionForm.setConditionsAmount(null);
promotionForm.setCreditAmount(null);
}
promotionForm.setPriceExpression(priceExpression);
BeanUtils.copyProperties(promotionForm, promotion, "id", "type", "store", "product", "productCategories");
promotionService.update(promotion);
addFlashMessage(redirectAttributes, SUCCESS_MESSAGE);
return "redirect:list";
}
/**
* 列表
*/
@GetMapping("/list")
public String list(Pageable pageable, @CurrentStore Store currentStore, ModelMap model) {
PromotionPlugin promotionPlugin = pluginService.getPromotionPlugin(FullReductionPromotionPlugin.ID);
model.addAttribute("isEnabled", promotionPlugin.getIsEnabled());
model.addAttribute("page", promotionService.findPage(currentStore, Promotion.Type.fullReduction, pageable));
return "business/full_reduction_promotion/list";
}
/**
* 删除
*/
@PostMapping("/delete")
public ResponseEntity<?> delete(Long[] ids, @CurrentStore Store currentStore) {
for (Long id : ids) {
Promotion promotion = promotionService.find(id);
if (promotion == null) {
return Results.UNPROCESSABLE_ENTITY;
}
if (!currentStore.equals(promotion.getStore())) {
return Results.UNPROCESSABLE_ENTITY;
}
}
promotionService.delete(ids);
return Results.OK;
}
} | [
"Z18434395962@163.com"
] | Z18434395962@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.