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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c81ee83fa1b4e643b7585b7af3666a0cf52d279c | 0257feb49b6d54b306d15ee1b0fa78295bc08ca1 | /src/main/java/com/iyundao/base/exception/GlobalDefaultExceptionHandler.java | 1ed7feb2cc1a8b8b07b6aa873514e07100b6a6f3 | [] | no_license | ppyelf/unitedfront | ae5e9832e88a91287ececc9059f3a537c981ce33 | b17bcd6f03815d6cb060bfb9b48a332ec5509b3e | refs/heads/master | 2022-11-26T03:30:03.700241 | 2019-08-05T02:59:39 | 2019-08-05T02:59:39 | 199,355,900 | 0 | 0 | null | 2022-11-24T10:22:46 | 2019-07-29T01:21:42 | Java | UTF-8 | Java | false | false | 2,827 | java | package com.iyundao.base.exception;
import com.iyundao.base.utils.JsonResult;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.http.HttpStatus;
import org.springframework.validation.BindException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName: GlobalDefaultExceptionHandler
* @project: IYunDao
* @author: 念
* @Date: 2019/5/30 16:07
* @Description: 全局请求异常拦截器
* @Version: V2.0
*/
@ControllerAdvice
public class GlobalDefaultExceptionHandler {
private JsonResult jsonResult = JsonResult.failure(800, "");
@ExceptionHandler(MethodArgumentNotValidException.class)
public JsonResult processMethodArgumentNotValidException(MethodArgumentNotValidException ex) {
String errorMessage = ex.getBindingResult()
.getAllErrors()
.stream()
.map(DefaultMessageSourceResolvable::getDefaultMessage)
.reduce((s1, s2) -> s1.concat(",").concat(s2)).get();
jsonResult.setCode(800);
jsonResult.setMessage("参数校验失败:" + errorMessage);
return jsonResult;
}
@ExceptionHandler(BindException.class)
public JsonResult processBindException(BindException be) {
Map<String, Object> responseBody = new HashMap<>(3);
responseBody.put("code", HttpStatus.BAD_REQUEST.value());
String errorMessage = be.getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage)
.reduce((s1, s2) -> s1.concat(",").concat(s2)).get();
jsonResult.setCode(801);
jsonResult.setMessage("参数校验失败:" + errorMessage);
return jsonResult;
}
@ExceptionHandler(IllegalArgumentException.class)
public JsonResult processIllegalArgumentException(IllegalArgumentException iae) {
jsonResult.setMessage("参数校验失败:校验参数不能为空");
jsonResult.setCode(HttpStatus.NOT_FOUND.value());
return jsonResult;
}
@ExceptionHandler(AuthenticationException.class)
public JsonResult processAuthenticationException(AuthenticationException e) {
jsonResult.setCode(803);
jsonResult.setMessage(e.getMessage());
return jsonResult;
}
@ExceptionHandler(AuthorizationException.class)
public JsonResult processAuthorizationException(AuthorizationException ex) {
jsonResult.setCode(804);
jsonResult.setMessage(ex.getMessage());
return jsonResult;
}
}
| [
"85938219@qq.com"
] | 85938219@qq.com |
2fb22abc87a2c9953e4f1e1b9339062962b9b920 | 97c724ac797e755d1d0f4529975910a11669118a | /src/Algorithm4thEdition/Selection.java | fa44edf86cb4136d9ff50fa4c3d8e7a21181b558 | [] | no_license | ooblivion/Java-notes | e04668c17ed0a9ab23e69289b62216b7eeaa016f | f94e42742a3b70e46dbf92226310860de43a0321 | refs/heads/master | 2023-03-05T21:38:52.315983 | 2021-02-22T00:40:36 | 2021-02-22T00:40:36 | 338,740,759 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,111 | java | /******************************************************************************
* Compilation: javac Selection.java
* Execution: java Selection < input.txt
* Dependencies: StdOut.java StdIn.java
* Data files: https://algs4.cs.princeton.edu/21elementary/tiny.txt
* https://algs4.cs.princeton.edu/21elementary/words3.txt
*
* Sorts a sequence of strings from standard input using selection sort.
*
* % more tiny.txt
* S O R T E X A M P L E
*
* % java Selection < tiny.txt
* A E E L M O P R S T X [ one string per line ]
*
* % more words3.txt
* bed bug dad yes zoo ... all bad yet
*
* % java Selection < words3.txt
* all bad bed bug dad ... yes yet zoo [ one string per line ]
*
******************************************************************************/
package Algorithm4thEdition;
import java.util.Comparator;
/**
* The {@code Selection} class provides static methods for sorting an
* array using <em>selection sort</em>.
* This implementation makes ~ ½ <em>n</em><sup>2</sup> compares to sort
* any array of length <em>n</em>, so it is not suitable for sorting large arrays.
* It performs exactly <em>n</em> exchanges.
* <p>
* This sorting algorithm is not stable. It uses Θ(1) extra memory
* (not including the input array).
* <p>
* For additional documentation, see
* <a href="https://algs4.cs.princeton.edu/21elementary">Section 2.1</a>
* of <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
*
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public class Selection {
// This class should not be instantiated.
private Selection() { }
/**
* Rearranges the array in ascending order, using the natural order.
* @param a the array to be sorted
*/
public static void sort(Comparable[] a) {
int n = a.length;
for (int i = 0; i < n; i++) {
int min = i;
for (int j = i+1; j < n; j++) {
if (less(a[j], a[min])) min = j;
}
exch(a, i, min);
assert isSorted(a, 0, i);
}
assert isSorted(a);
}
/**
* Rearranges the array in ascending order, using a comparator.
* @param a the array
* @param comparator the comparator specifying the order
*/
public static void sort(Object[] a, Comparator comparator) {
int n = a.length;
for (int i = 0; i < n; i++) {
int min = i;
for (int j = i+1; j < n; j++) {
if (less(comparator, a[j], a[min])) min = j;
}
exch(a, i, min);
assert isSorted(a, comparator, 0, i);
}
assert isSorted(a, comparator);
}
/***************************************************************************
* Helper sorting functions.
***************************************************************************/
// is v < w ?
private static boolean less(Comparable v, Comparable w) {
return v.compareTo(w) < 0;
}
// is v < w ?
private static boolean less(Comparator comparator, Object v, Object w) {
return comparator.compare(v, w) < 0;
}
// exchange a[i] and a[j]
private static void exch(Object[] a, int i, int j) {
Object swap = a[i];
a[i] = a[j];
a[j] = swap;
}
/***************************************************************************
* Check if array is sorted - useful for debugging.
***************************************************************************/
// is the array a[] sorted?
private static boolean isSorted(Comparable[] a) {
return isSorted(a, 0, a.length - 1);
}
// is the array sorted from a[lo] to a[hi]
private static boolean isSorted(Comparable[] a, int lo, int hi) {
for (int i = lo + 1; i <= hi; i++)
if (less(a[i], a[i-1])) return false;
return true;
}
// is the array a[] sorted?
private static boolean isSorted(Object[] a, Comparator comparator) {
return isSorted(a, comparator, 0, a.length - 1);
}
// is the array sorted from a[lo] to a[hi]
private static boolean isSorted(Object[] a, Comparator comparator, int lo, int hi) {
for (int i = lo + 1; i <= hi; i++)
if (less(comparator, a[i], a[i-1])) return false;
return true;
}
// print array to standard output
private static void show(Comparable[] a) {
for (int i = 0; i < a.length; i++) {
StdOut.println(a[i]);
}
}
/**
* Reads in a sequence of strings from standard input; selection sorts them;
* and prints them to standard output in ascending order.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
String[] a = StdIn.readAllStrings();
Selection.sort(a);
show(a);
}
}
/******************************************************************************
* Copyright 2002-2020, Robert Sedgewick and Kevin Wayne.
*
* This file is part of algs4.jar, which accompanies the textbook
*
* Algorithms, 4th edition by Robert Sedgewick and Kevin Wayne,
* Addison-Wesley Professional, 2011, ISBN 0-321-57351-X.
* http://algs4.cs.princeton.edu
*
*
* algs4.jar is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* algs4.jar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with algs4.jar. If not, see http://www.gnu.org/licenses.
******************************************************************************/
| [
"https://ooblivion@github.com"
] | https://ooblivion@github.com |
4a64934a26a9b2ce97a2e61337f2d436492ad7c6 | 7951b011669b2347cad79d74811df5c0e7f812e4 | /MaksMandryka/src/oop/week5/io/NoSuchDirectoryExeption.java | 6ae6eb909466011a770f8f9341c1eaae376894e3 | [] | no_license | gorobec/ACO18TeamProject | 77c18e12cefb4eda3186dc6f7b84aed14040a691 | ae48c849915c8cb41aab637d001d2b492cc53432 | refs/heads/master | 2021-01-11T15:20:56.092695 | 2017-02-18T14:22:11 | 2017-02-18T14:22:11 | 80,338,687 | 1 | 1 | null | 2017-02-22T20:10:45 | 2017-01-29T09:48:23 | Java | UTF-8 | Java | false | false | 208 | java | package oop.week5.io;
/**
* Created by fmandryka on 18.02.2017.
*/
public class NoSuchDirectoryExeption extends RuntimeException {
public NoSuchDirectoryExeption(String s) {
super(s);
}
}
| [
"makspman@gmail.com"
] | makspman@gmail.com |
a9fc715cd15873f374ad6ff68c905a1f652403c9 | addc64b2d09013278e51a6edecd0fe8ec0e90267 | /app/src/main/java/com/xiaomi/xms/sales/ui/XianhuoShoppingListItem.java | 4063b9214bf36cd7b39abf36eb26ac9e81f6307e | [] | no_license | wfr/icu2 | cd7a2e98bade5e836e5d62703caafc902a2ff026 | 339f541df570e52ed3638f1e8b92770f3c4a0238 | refs/heads/master | 2021-01-21T10:05:50.848891 | 2015-04-19T12:07:27 | 2015-04-19T12:07:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,534 | java | package com.xiaomi.xms.sales.ui;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.xiaomi.xms.sales.R;
import com.xiaomi.xms.sales.loader.ImageLoader;
import com.xiaomi.xms.sales.model.ShoppingCartListInfo.Item.CartListNode;
import com.xiaomi.xms.sales.model.Tags;
import com.xiaomi.xms.sales.util.LogUtil;
public class XianhuoShoppingListItem extends BaseListItem<CartListNode> {
private ImageView mImage;
private TextView mTtile;
private TextView mSn; // sn
private TextView mTextCenter;
private ImageView mArrow;
private ImageView mShowType;
private View mContainer;
private View mTopLine;
private static String TAG = "XianhuoShoppingListItem";
public XianhuoShoppingListItem(Context context) {
super(context, null);
}
public XianhuoShoppingListItem(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(
R.layout.xianhuo_shopping_cartlist, this, true);
mTopLine = findViewById(R.id.action_divider);
mImage = (ImageView) findViewById(R.id.shopping_cartlist_photo);
mTtile = (TextView) findViewById(R.id.shopping_cartlist_text_title);
mSn = (TextView) findViewById(R.id.sn);
mTextCenter = (TextView) findViewById(R.id.shopping_cartlist_text_center);
mArrow = (ImageView) findViewById(R.id.arrow_right);
mShowType = (ImageView) findViewById(R.id.showtype);
mContainer = findViewById(R.id.container);
}
public View getContainer() {
return mContainer;
}
@Override
public void bind(CartListNode data) {
mTtile.setText(data.getTitle());
mSn.setText("sn:" + data.getItemIds());
mTextCenter.setText(String.format(
getResources().getString(
R.string.shopping_cartlist_text_center_template),
data.getPrice(), data.getCount(), data.getTotal()));
ImageLoader.getInstance().loadImage(mImage, data.getThumbnail(),
R.drawable.list_default_bg);
LogUtil.d(TAG, " The thumbnail url is: " + data.getThumbnail());
this.setTag(data);
String showType = data.getShowType();
if (TextUtils.equals(showType, Tags.ShoppingCartList.SHOWTYPE_BARGIN)) {
mTtile.setText(String.format(
getResources().getString(
R.string.cartitem_title_bargin_template),
data.getTitle()));
} else if (TextUtils.equals(showType,
Tags.ShoppingCartList.SHOWTYPE_GIFT)) {
mShowType.setImageResource(R.drawable.cartlist_item_showtype_gift);
} else if (TextUtils.equals(showType,
Tags.ShoppingCartList.SHOWTYPE_SECKILL)) {
mShowType
.setImageResource(R.drawable.cartlist_item_showtype_seckill);
} else if (TextUtils.equals(showType,
Tags.ShoppingCartList.SHOWTYPE_SPECIAL)) {
mShowType
.setImageResource(R.drawable.cartlist_item_showtype_special);
} else if (TextUtils.equals(showType,
Tags.ShoppingCartList.SHOWTYPE_ERNIE)) {
mShowType.setImageResource(R.drawable.cartlist_item_showtype_ernie);
} else {
mShowType.setImageDrawable(null);
}
}
public void showTopLine(boolean isShow) {
if (isShow) {
mTopLine.setVisibility(View.VISIBLE);
LayoutParams params = new LayoutParams(mImage.getLayoutParams());
params.setMargins(30, 20, 7, 20);
mImage.setLayoutParams(params);
} else {
mTopLine.setVisibility(View.GONE);
}
}
public void hideArrow(boolean isHide) {
if (isHide) {
mArrow.setVisibility(View.GONE);
} else {
mArrow.setVisibility(View.VISIBLE);
}
}
}
| [
"yaoqiang03@meituan.com"
] | yaoqiang03@meituan.com |
f44320f117e443d905a1ddb87fc63690e2543a71 | c0823bf3a5b351bea520c8606cfaf5ae8c9b68f7 | /microservicecloud-eureka-7002/src/main/java/com/atguigu/springcloud/EurekaServer7002_APP.java | 5ae3f386db552c1b64ca0f70fc7b70caa97b9553 | [] | no_license | 476554858/mymicroservicecloud | 6e92a815848c46f80f11e9adba978dfee41a4cdc | 857fdc108b256007415ccc3ed0decefa0a91694e | refs/heads/master | 2022-12-21T05:24:51.193289 | 2022-12-06T11:33:00 | 2022-12-06T11:33:00 | 201,773,190 | 1 | 0 | null | 2022-12-10T03:45:47 | 2019-08-11T14:11:50 | Java | UTF-8 | Java | false | false | 426 | java | package com.atguigu.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServer7002_APP {
public static void main(String[] args) {
SpringApplication.run(EurekaServer7002_APP.class,args);
}
}
| [
"38879101+476554858@users.noreply.github.com"
] | 38879101+476554858@users.noreply.github.com |
88dc63ca33e7f44d4ca25efd692d127047797d28 | 365dd8ebb72f54cedeed37272d4db23d139522f4 | /src/main/java/thaumcraft/api/ItemApi.java | a1c7fc1f6ca7e33b5c49d697e6dc1a0c9f133cb9 | [] | no_license | Bogdan-G/ThaumicHorizons | c05b1fdeda0bdda6d427a39b74cac659661c4cbe | 83caf754f51091c6b7297c0c68fe8df309d7d7f9 | refs/heads/master | 2021-09-10T14:13:54.532269 | 2018-03-27T16:58:15 | 2018-03-27T16:58:15 | 122,425,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,453 | java | package thaumcraft.api;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemApi {
public static ItemStack getItem(String itemString, int meta) {
ItemStack item = null;
try {
String ex = "thaumcraft.common.config.ConfigItems";
Object obj = Class.forName(ex).getField(itemString).get((Object)null);
if(obj instanceof Item) {
item = new ItemStack((Item)obj, 1, meta);
} else if(obj instanceof ItemStack) {
item = (ItemStack)obj;
}
} catch (Exception var5) {
FMLLog.warning("[Thaumcraft] Could not retrieve item identified by: " + itemString, new Object[0]);
}
return item;
}
public static ItemStack getBlock(String itemString, int meta) {
ItemStack item = null;
try {
String ex = "thaumcraft.common.config.ConfigBlocks";
Object obj = Class.forName(ex).getField(itemString).get((Object)null);
if(obj instanceof Block) {
item = new ItemStack((Block)obj, 1, meta);
} else if(obj instanceof ItemStack) {
item = (ItemStack)obj;
}
} catch (Exception var5) {
FMLLog.warning("[Thaumcraft] Could not retrieve block identified by: " + itemString, new Object[0]);
}
return item;
}
}
| [
"bogdangtt@gmail.com"
] | bogdangtt@gmail.com |
de9ca8462dfea2ab0c56531f379bc7da5738742c | 1d9348638425380e610cb1328a362b5237608e14 | /src/main/java/ExceptionsInJava/VideGolovach/Lection4/IlegalArgumentException.java | 3769ea510f7ff9d4044a3ca9d6ecc8d6912d9762 | [] | no_license | Aleksandr-Bogatyrenko/Rush | 4c5f59ed9857b5c69e6e616fdfaddd917b80f4dd | 252f21b97f4e092e644c327d62e91b1c3d69a841 | refs/heads/master | 2020-05-23T07:55:26.623079 | 2017-01-30T21:21:35 | 2017-01-30T21:21:35 | 80,465,226 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package ExceptionsInJava.VideGolovach.Lection4;
/**
* Created by Александр on 30.12.2015.
*/
public class IlegalArgumentException
{
public static void main(String[] args)
{
createnewUser(null, -1);
}
public static void createnewUser(String name, int age){
if (name != null || "".equals(age))
{
throw new IllegalArgumentException("Name must be not null");
}
if (age < 0 || age < 256){
throw new IllegalArgumentException("Age must be true");
}
}
}
| [
"bogatyrenko@mail.ua"
] | bogatyrenko@mail.ua |
5b89c3b6ce07ddf778177a0e1a0a3685f12bf6d5 | 8e1225f6cf9990d6a2576490ed4c6de0aefb590a | /housie/src/test/java/housie/caller/NumberGeneratorTest.java | 51fb55c08186dd19731709db83bbde0a279f1f12 | [] | no_license | ricardoamador/special-palm-tree | 83891da9f4bfe3c88b190738f331018964f0f035 | 41cb6ad0d830dd8eb8cbfdcd8103c14d41421ac7 | refs/heads/main | 2023-01-23T08:48:19.898532 | 2020-11-25T16:41:02 | 2020-11-25T16:41:02 | 314,956,088 | 0 | 0 | null | 2020-11-25T16:41:04 | 2020-11-22T04:05:12 | Java | UTF-8 | Java | false | false | 1,603 | java | package housie.caller;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.NoSuchElementException;
public class NumberGeneratorTest {
private NumberGenerator numberGenerator;
private static final int CAPACITY = 10;
@Before
public void setUp() {
numberGenerator = new NumberGenerator(CAPACITY);
}
@After
public void tearDown() {
numberGenerator = null;
}
@Test (expected = IllegalArgumentException.class)
public void testInvalidRange() {
numberGenerator = new NumberGenerator(-1);
}
@Test
public void testInitialize() {
for (int i = 0; i < CAPACITY; i++) {
int nextInt = numberGenerator.getNextNumber();
assertTrue(nextInt <= CAPACITY);
}
}
@Test
public void testReset() {
for (int i = 0; i < CAPACITY; i++) {
int nextInt = numberGenerator.getNextNumber();
assertTrue(nextInt <= CAPACITY);
}
numberGenerator.reset();
for (int i = 0; i < CAPACITY; i++) {
int nextInt = numberGenerator.getNextNumber();
assertTrue(nextInt <= CAPACITY);
}
}
@Test (expected = NoSuchElementException.class)
public void testGetBeyondCapacity() {
for (int i = 0; i < CAPACITY; i++) {
int nextInt = numberGenerator.getNextNumber();
assertTrue(nextInt <= CAPACITY);
}
numberGenerator.getNextNumber();
}
}
| [
"ricardo.amador2@gmail.com"
] | ricardo.amador2@gmail.com |
7921958833bfe582d62a8cb5f277c9faba845621 | 38c4451ab626dcdc101a11b18e248d33fd8a52e0 | /tokens/xalan-j-2.7.1/src/org/apache/xml/utils/res/CharArrayWrapper.java | 008918cfcd0600176cff74ea06f01171fcfcba61 | [] | no_license | habeascorpus/habeascorpus-data | 47da7c08d0f357938c502bae030d5fb8f44f5e01 | 536d55729f3110aee058ad009bcba3e063b39450 | refs/heads/master | 2020-06-04T10:17:20.102451 | 2013-02-19T15:19:21 | 2013-02-19T15:19:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,361 | java | package TokenNamepackage
org TokenNameIdentifier
. TokenNameDOT
apache TokenNameIdentifier
. TokenNameDOT
xml TokenNameIdentifier
. TokenNameDOT
utils TokenNameIdentifier
. TokenNameDOT
res TokenNameIdentifier
; TokenNameSEMICOLON
public TokenNamepublic
class TokenNameclass
CharArrayWrapper TokenNameIdentifier
{ TokenNameLBRACE
private TokenNameprivate
char TokenNamechar
[ TokenNameLBRACKET
] TokenNameRBRACKET
m_char TokenNameIdentifier
; TokenNameSEMICOLON
public TokenNamepublic
CharArrayWrapper TokenNameIdentifier
( TokenNameLPAREN
char TokenNamechar
[ TokenNameLBRACKET
] TokenNameRBRACKET
arg TokenNameIdentifier
) TokenNameRPAREN
{ TokenNameLBRACE
m_char TokenNameIdentifier
= TokenNameEQUAL
arg TokenNameIdentifier
; TokenNameSEMICOLON
} TokenNameRBRACE
public TokenNamepublic
char TokenNamechar
getChar TokenNameIdentifier
( TokenNameLPAREN
int TokenNameint
index TokenNameIdentifier
) TokenNameRPAREN
{ TokenNameLBRACE
return TokenNamereturn
m_char TokenNameIdentifier
[ TokenNameLBRACKET
index TokenNameIdentifier
] TokenNameRBRACKET
; TokenNameSEMICOLON
} TokenNameRBRACE
public TokenNamepublic
int TokenNameint
getLength TokenNameIdentifier
( TokenNameLPAREN
) TokenNameRPAREN
{ TokenNameLBRACE
return TokenNamereturn
m_char TokenNameIdentifier
. TokenNameDOT
length TokenNameIdentifier
; TokenNameSEMICOLON
} TokenNameRBRACE
} TokenNameRBRACE
| [
"pschulam@gmail.com"
] | pschulam@gmail.com |
7111033025938c826566f2a93b208baea6b59432 | aead6a2a1ab1cdce969f9236d35eb71c9c208f98 | /src/main/java/cn/xdevops/fox/admin/domain/authentication/LoginUser.java | 814030c3f153bda3a2b8bc7985cdf4e51e0ae2f7 | [] | no_license | tibetan-fox/fox-admin | 40e839dbb747d6dc84eb8b8faf15b6ee346c0855 | f042af0b5e155db1904d8bf80572b75edd570c0a | refs/heads/master | 2023-06-19T20:11:36.425393 | 2021-07-15T07:41:02 | 2021-07-15T07:41:02 | 385,497,860 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,830 | java | package cn.xdevops.fox.admin.domain.authentication;
import cn.xdevops.fox.admin.infrastructure.entity.SysUser;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
import java.util.Set;
/**
* 登录用户身份权限
*
* @author ruoyi
*/
public class LoginUser implements UserDetails
{
private static final long serialVersionUID = 1L;
/**
* 用户唯一标识
*/
private String token;
/**
* 登录时间
*/
private Long loginTime;
/**
* 过期时间
*/
private Long expireTime;
/**
* 登录IP地址
*/
private String ipaddr;
/**
* 登录地点
*/
private String loginLocation;
/**
* 浏览器类型
*/
private String browser;
/**
* 操作系统
*/
private String os;
/**
* 权限列表
*/
private Set<String> permissions;
/**
* 用户信息
*/
private SysUser user;
public String getToken()
{
return token;
}
public void setToken(String token)
{
this.token = token;
}
public LoginUser()
{
}
public LoginUser(SysUser user, Set<String> permissions)
{
this.user = user;
this.permissions = permissions;
}
@JsonIgnore
@Override
public String getPassword()
{
return user.getPassword();
}
@Override
public String getUsername()
{
return user.getUserName();
}
/**
* 账户是否未过期,过期无法验证
*/
@JsonIgnore
@Override
public boolean isAccountNonExpired()
{
return true;
}
/**
* 指定用户是否解锁,锁定的用户无法进行身份验证
*
* @return
*/
@JsonIgnore
@Override
public boolean isAccountNonLocked()
{
return true;
}
/**
* 指示是否已过期的用户的凭据(密码),过期的凭据防止认证
*
* @return
*/
@JsonIgnore
@Override
public boolean isCredentialsNonExpired()
{
return true;
}
/**
* 是否可用 ,禁用的用户不能身份验证
*
* @return
*/
@JsonIgnore
@Override
public boolean isEnabled()
{
return true;
}
public Long getLoginTime()
{
return loginTime;
}
public void setLoginTime(Long loginTime)
{
this.loginTime = loginTime;
}
public String getIpaddr()
{
return ipaddr;
}
public void setIpaddr(String ipaddr)
{
this.ipaddr = ipaddr;
}
public String getLoginLocation()
{
return loginLocation;
}
public void setLoginLocation(String loginLocation)
{
this.loginLocation = loginLocation;
}
public String getBrowser()
{
return browser;
}
public void setBrowser(String browser)
{
this.browser = browser;
}
public String getOs()
{
return os;
}
public void setOs(String os)
{
this.os = os;
}
public Long getExpireTime()
{
return expireTime;
}
public void setExpireTime(Long expireTime)
{
this.expireTime = expireTime;
}
public Set<String> getPermissions()
{
return permissions;
}
public void setPermissions(Set<String> permissions)
{
this.permissions = permissions;
}
public SysUser getUser()
{
return user;
}
public void setUser(SysUser user)
{
this.user = user;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities()
{
return null;
}
}
| [
"williamsrlin@outlook.com"
] | williamsrlin@outlook.com |
f1851b4ec051c0bf84c6160c03f0dbf49a919a18 | dad4ae031129152e29d23f60ec26ec262d6019c9 | /src/co/g2academy/array/ArrayOfChar.java | 7a93f28773006a625bd461d4b6a7dd20aba1c3f7 | [] | no_license | veryharfan/bootcamp-java | 8e220217da433b85917c6f437f4d6757fd4ad4d3 | 8e5bdf976bee2f1824d58afc2a77b2197c2b587c | refs/heads/main | 2023-01-19T11:58:12.381583 | 2020-11-23T15:41:40 | 2020-11-23T15:41:40 | 315,354,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package co.g2academy.array;
public class ArrayOfChar {
public char[] createArray() {
char[] s = new char[26];
for (int i = 0; i< s.length; i++){
s[i] = (char) ('A' + i);
}
return s;
}
}
| [
"veryharfan@gmail.com"
] | veryharfan@gmail.com |
7a1f9eb47ff145948cbee7074e17783f1782df06 | 962f3aef2177b36c77d7cbf6d8292d1199e36cde | /app/src/test/java/com/ajz/directoryhub/ExampleUnitTest.java | 17e5b026057fbd0af5eae79d102d25afe46a90ab | [] | no_license | adamzarn/DirectoryHubAndroid | 1b6a3d65a371311185567d5bd35cfa3cfd3c6ed4 | 868546a75019346300b2fbc63817e55e03a7daa4 | refs/heads/master | 2021-08-10T22:07:42.946198 | 2017-11-13T01:15:44 | 2017-11-13T01:15:44 | 108,614,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.ajz.directoryhub;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"ajzarn@gmail.com"
] | ajzarn@gmail.com |
1fe6e7deb72bbed1459352eec850404deaa9d90f | b5ee2455a47823623e29bb85c363c57a7b23929b | /iMissAndroid/src/main/java/info/hugozhu/imiss/ui/Views/OnSwipeTouchListener.java | 52b4ce026c218a4cdd1d94cc38782b78a8af992e | [] | no_license | hugozhu/iMiss | efb1e959c323a08ef15ffe5c3fce0c517f97286a | fcadd0d602ee1982218e709513e958bbc698564d | refs/heads/master | 2021-01-13T01:21:28.189022 | 2014-06-22T17:04:17 | 2014-06-22T17:04:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,543 | java | package info.hugozhu.imiss.ui.Views;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.GridView;
import android.widget.ListView;
public class OnSwipeTouchListener implements OnTouchListener {
private float downX, downY;
private boolean discard = false;
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()){
case MotionEvent.ACTION_DOWN: {
downX = event.getX();
downY = event.getY();
discard = false;
return !(v instanceof ListView || v instanceof GridView);
}
case MotionEvent.ACTION_MOVE: {
float upX = event.getX();
float upY = event.getY();
float deltaX = downX - upX;
float deltaY = downY - upY;
if (Math.abs(deltaY) > 40) {
discard = true;
}
if(!discard && Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > 90) {
if(deltaX < 0) {
onSwipeRight();
return true;
}
if(deltaX > 0) {
onSwipeLeft();
return true;
}
}
break;
}
case MotionEvent.ACTION_UP: {
onTouchUp(event);
return false;
}
}
return false;
}
/*private final GestureDetector gestureDetector = new GestureDetector(new GestureListener());
public boolean onTouch(final View view, final MotionEvent motionEvent) {
return gestureDetector.onTouchEvent(motionEvent);
}
private final class GestureListener extends SimpleOnGestureListener {
private static final int SWIPE_THRESHOLD = 100;
private static final int SWIPE_VELOCITY_THRESHOLD = 100;
private long lastTime = 0;
@Override
public boolean onDown(MotionEvent e) {
return true;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
boolean result = false;
try {
int mask = e1.getActionMasked();
Log.e("tmessages", "event1" + e1);
Log.e("tmessages", "event2" + e2);
float diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX();
float velocityX = 0;
if (lastTime != 0)
if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (diffX > 0) {
onSwipeRight();
} else {
onSwipeLeft();
}
}
}
} catch (Exception exception) {
exception.printStackTrace();
}
return result;
}
// @Override
// public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
// boolean result = false;
// try {
// float diffY = e2.getY() - e1.getY();
// float diffX = e2.getX() - e1.getX();
// if (Math.abs(diffX) > Math.abs(diffY)) {
// if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
// if (diffX > 0) {
// onSwipeRight();
// } else {
// onSwipeLeft();
// }
// }
// } else {
// if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) {
// if (diffY > 0) {
// onSwipeBottom();
// } else {
// onSwipeTop();
// }
// }
// }
// } catch (Exception exception) {
// exception.printStackTrace();
// }
// return result;
// }
}
*/
public void onTouchUp(MotionEvent event) {
}
public void onSwipeRight() {
}
public void onSwipeLeft() {
}
}
| [
"hugozhu@alibaba-inc.com"
] | hugozhu@alibaba-inc.com |
907aa82ed311fc5313e9ba8553ac11be74dd9769 | a744882fb7cf18944bd6719408e5a9f2f0d6c0dd | /sourcecode7/src/sun/security/util/AuthResources_it.java | cde167dd82967e0909f89a924c4664deba99cabe | [
"Apache-2.0"
] | permissive | hanekawasann/learn | a39b8d17fd50fa8438baaa5b41fdbe8bd299ab33 | eef678f1b8e14b7aab966e79a8b5a777cfc7ab14 | refs/heads/master | 2022-09-13T02:18:07.127489 | 2020-04-26T07:58:35 | 2020-04-26T07:58:35 | 176,686,231 | 0 | 0 | Apache-2.0 | 2022-09-01T23:21:38 | 2019-03-20T08:16:05 | Java | UTF-8 | Java | false | false | 7,009 | java | /*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package sun.security.util;
/**
* <p> This class represents the <code>ResourceBundle</code>
* for the following packages:
*
* <ol>
* <li> com.sun.security.auth
* <li> com.sun.security.auth.login
* </ol>
*/
public class AuthResources_it extends java.util.ListResourceBundle {
private static final Object[][] contents = {
// NT principals
{ "invalid.null.input.value", "input nullo non valido: {0}" },
{ "NTDomainPrincipal.name", "NTDomainPrincipal: {0}" },
{ "NTNumericCredential.name", "NTNumericCredential: {0}" },
{ "Invalid.NTSid.value", "Valore NTSid non valido" }, { "NTSid.name", "NTSid: {0}" },
{ "NTSidDomainPrincipal.name", "NTSidDomainPrincipal: {0}" },
{ "NTSidGroupPrincipal.name", "NTSidGroupPrincipal: {0}" },
{ "NTSidPrimaryGroupPrincipal.name", "NTSidPrimaryGroupPrincipal: {0}" },
{ "NTSidUserPrincipal.name", "NTSidUserPrincipal: {0}" }, { "NTUserPrincipal.name", "NTUserPrincipal: {0}" },
// UnixPrincipals
{ "UnixNumericGroupPrincipal.Primary.Group.name", "UnixNumericGroupPrincipal [gruppo primario]: {0}" },
{ "UnixNumericGroupPrincipal.Supplementary.Group.name",
"UnixNumericGroupPrincipal [gruppo supplementare]: {0}" },
{ "UnixNumericUserPrincipal.name", "UnixNumericUserPrincipal: {0}" },
{ "UnixPrincipal.name", "UnixPrincipal: {0}" },
// com.sun.security.auth.login.ConfigFile
{ "Unable.to.properly.expand.config", "Impossibile espandere correttamente {0}" },
{ "extra.config.No.such.file.or.directory.", "{0} (file o directory inesistente)" },
{ "Configuration.Error.No.such.file.or.directory",
"Errore di configurazione:\n\tFile o directory inesistente" },
{ "Configuration.Error.Invalid.control.flag.flag",
"Errore di configurazione:\n\tflag di controllo non valido, {0}" },
{ "Configuration.Error.Can.not.specify.multiple.entries.for.appName",
"Errore di configurazione:\n\timpossibile specificare pi\u00F9 valori per {0}" },
{ "Configuration.Error.expected.expect.read.end.of.file.",
"Errore di configurazione:\n\tprevisto [{0}], letto [end of file]" },
{ "Configuration.Error.Line.line.expected.expect.found.value.",
"Errore di configurazione:\n\triga {0}: previsto [{1}], trovato [{2}]" },
{ "Configuration.Error.Line.line.expected.expect.", "Errore di configurazione:\n\triga {0}: previsto [{1}]" },
{ "Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
"Errore di configurazione:\n\triga {0}: propriet\u00E0 di sistema [{1}] espansa a valore vuoto" },
// com.sun.security.auth.module.JndiLoginModule
{ "username.", "Nome utente: " }, { "password.", "Password: " },
// com.sun.security.auth.module.KeyStoreLoginModule
{ "Please.enter.keystore.information", "Immettere le informazioni per il keystore" },
{ "Keystore.alias.", "Alias keystore: " }, { "Keystore.password.", "Password keystore: " },
{ "Private.key.password.optional.", "Password chiave privata (opzionale): " },
// com.sun.security.auth.module.Krb5LoginModule
{ "Kerberos.username.defUsername.", "Nome utente Kerberos [{0}]: " },
{ "Kerberos.password.for.username.", "Password Kerberos per {0}: " },
/*** EVERYTHING BELOW IS DEPRECATED ***/
// com.sun.security.auth.PolicyFile
{ ".error.parsing.", ": errore durante l'analisi " }, { "COLON", ": " },
{ ".error.adding.Permission.", ": errore durante l'aggiunta dell'autorizzazione " }, { "SPACE", " " },
{ ".error.adding.Entry.", ": errore durante l'aggiunta della voce " }, { "LPARAM", "(" }, { "RPARAM", ")" },
{ "attempt.to.add.a.Permission.to.a.readonly.PermissionCollection",
"tentativo di aggiungere un'autorizzazione a una PermissionCollection di sola lettura" },
// com.sun.security.auth.PolicyParser
{ "expected.keystore.type", "tipo keystore previsto" },
{ "can.not.specify.Principal.with.a.wildcard.class.without.a.wildcard.name",
"impossibile specificare un principal con una classe carattere jolly senza un nome carattere jolly" },
{ "expected.codeBase.or.SignedBy", "previsto codeBase o SignedBy" },
{ "only.Principal.based.grant.entries.permitted",
"sono consentiti solo valori garantiti basati sul principal" },
{ "expected.permission.entry", "prevista voce di autorizzazione" }, { "number.", "numero " },
{ "expected.expect.read.end.of.file.", "previsto {0}, letto end of file" },
{ "expected.read.end.of.file", "previsto ';', letto end of file" }, { "line.", "riga " },
{ ".expected.", ": previsto '" }, { ".found.", "', trovato '" }, { "QUOTE", "'" },
// SolarisPrincipals
{ "SolarisNumericGroupPrincipal.Primary.Group.", "SolarisNumericGroupPrincipal [gruppo primario]: " },
{ "SolarisNumericGroupPrincipal.Supplementary.Group.",
"SolarisNumericGroupPrincipal [gruppo supplementare]: " },
{ "SolarisNumericUserPrincipal.", "SolarisNumericUserPrincipal: " },
{ "SolarisPrincipal.", "SolarisPrincipal: " },
// provided.null.name is the NullPointerException message when a
// developer incorrectly passes a null name to the constructor of
// subclasses of java.security.Principal
{ "provided.null.name", "il nome fornito \u00E8 nullo" }
};
/**
* Returns the contents of this <code>ResourceBundle</code>.
*
* <p>
*
* @return the contents of this <code>ResourceBundle</code>.
*/
public Object[][] getContents() {
return contents;
}
}
| [
"763803382@qq.com"
] | 763803382@qq.com |
c3f5b2ca36bbba233a9795699988a9d1e9166882 | 28823b037ca34bd377de9f67cec3553932aa3013 | /src/main/java/org/apache/ibatis/builder/xml/XMLStatementBuilder.java | 5f4916cebc212abac77f8e950dcbf4953ef1d444 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | janforp/mybatis | 9240dea373aa7615ebb10fd44c5f0b02b8d6c0d0 | bd8dad6ef602e07c8cd14c5db79186071c5ff90b | refs/heads/master | 2022-07-08T19:43:24.594569 | 2020-04-04T14:31:56 | 2020-04-04T14:31:56 | 246,563,112 | 0 | 0 | Apache-2.0 | 2022-06-29T19:34:00 | 2020-03-11T12:20:26 | Java | UTF-8 | Java | false | false | 15,689 | java | package org.apache.ibatis.builder.xml;
import org.apache.ibatis.builder.BaseBuilder;
import org.apache.ibatis.builder.MapperBuilderAssistant;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import org.apache.ibatis.executor.keygen.KeyGenerator;
import org.apache.ibatis.executor.keygen.NoKeyGenerator;
import org.apache.ibatis.executor.keygen.SelectKeyGenerator;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.ResultSetType;
import org.apache.ibatis.mapping.SqlCommandType;
import org.apache.ibatis.mapping.SqlSource;
import org.apache.ibatis.mapping.StatementType;
import org.apache.ibatis.parsing.XNode;
import org.apache.ibatis.scripting.LanguageDriver;
import org.apache.ibatis.session.Configuration;
import org.w3c.dom.Node;
import java.util.List;
import java.util.Locale;
/**
* XML语句构建器,建造者模式,继承BaseBuilder
*
* 解析mapper文件的每一个方法 配置select|insert|update|delete,每一个方法sql都是一个statement
*
* @author Clinton Begin
*/
public class XMLStatementBuilder extends BaseBuilder {
private MapperBuilderAssistant builderAssistant;
/**
* 一个 insert/delete/update/select 方法sql中的所有内容,包括动态标签
*/
private XNode methodSqlNode;
private String requiredDatabaseId;
public XMLStatementBuilder(Configuration configuration, MapperBuilderAssistant builderAssistant, XNode methodSqlNode) {
this(configuration, builderAssistant, methodSqlNode, null);
}
/**
* sql语句构造器
*
* @param configuration 配置
* @param builderAssistant 辅助
* @param methodSqlNode 一个 insert/delete/update/select 方法sql中的所有内容,包括动态标签
* @param databaseId 数据库id
*/
public XMLStatementBuilder(Configuration configuration, MapperBuilderAssistant builderAssistant, XNode methodSqlNode, String databaseId) {
super(configuration);
this.builderAssistant = builderAssistant;
this.methodSqlNode = methodSqlNode;
this.requiredDatabaseId = databaseId;
}
//解析语句(select|insert|update|delete)
//<select
// id="selectPerson"
// parameterType="int"
// parameterMap="deprecated"
// resultType="hashmap"
// resultMap="personResultMap"
// flushCache="false"
// useCache="true"
// timeout="10000"
// fetchSize="256"
// statementType="PREPARED"
// resultSetType="FORWARD_ONLY">
// SELECT * FROM PERSON WHERE ID = #{id}
//</select>
//<insert id="insertAndgetkey" parameterType="com.soft.mybatis.model.User">
// <!--selectKey 会将 SELECT LAST_INSERT_ID()的结果放入到传入的model的主键里面,
// keyProperty 对应的model中的主键的属性名,这里是 user 中的id,因为它跟数据库的主键对应
// order AFTER 表示 SELECT LAST_INSERT_ID() 在insert执行之后执行,多用与自增主键,
// BEFORE 表示 SELECT LAST_INSERT_ID() 在insert执行之前执行,这样的话就拿不到主键了,
// 这种适合那种主键不是自增的类型
// resultType 主键类型 -->
// <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
// SELECT LAST_INSERT_ID()
// </selectKey>
// insert into t_user (username,password,create_date) values(#{username},#{password},#{createDate})
// </insert>
public void parseStatementNode() {
//<delete id="deleteAuthor" parameterType="int">
String id = methodSqlNode.getStringAttribute("id");
String databaseId = methodSqlNode.getStringAttribute("databaseId");
//如果databaseId不匹配,退出
if (!databaseIdMatchesCurrent(id, databaseId, this.requiredDatabaseId)) {
return;
}
//暗示驱动程序每次批量返回的结果行数
Integer fetchSize = methodSqlNode.getIntAttribute("fetchSize");
//超时时间
Integer timeout = methodSqlNode.getIntAttribute("timeout");
//引用外部 parameterMap,已废弃
String parameterMap = methodSqlNode.getStringAttribute("parameterMap");
//参数类型
//<update id="updateAuthor" parameterType="org.apache.ibatis.domain.blog.Author">
String parameterType = methodSqlNode.getStringAttribute("parameterType");
//参数类型
Class<?> parameterTypeClass = resolveClass(parameterType);
//引用外部的 resultMap(高级功能)
String resultMap = methodSqlNode.getStringAttribute("resultMap");
//结果类型
String resultType = methodSqlNode.getStringAttribute("resultType");
//脚本语言,mybatis3.2的新功能
String lang = methodSqlNode.getStringAttribute("lang");
//得到语言驱动
LanguageDriver langDriver = getLanguageDriver(lang);
Class<?> resultTypeClass = resolveClass(resultType);
//结果集类型,FORWARD_ONLY|SCROLL_SENSITIVE|SCROLL_INSENSITIVE 中的一种
String resultSetType = methodSqlNode.getStringAttribute("resultSetType");
ResultSetType resultSetTypeEnum = resolveResultSetType(resultSetType);
//语句类型, STATEMENT|PREPARED|CALLABLE 的一种
//默认 PREPARED
String statementTypeConfig = methodSqlNode.getStringAttribute("statementType", StatementType.PREPARED.toString());
StatementType statementType = StatementType.valueOf(statementTypeConfig);
//获取命令类型(select|insert|update|delete)
Node contextNode = methodSqlNode.getNode();
String nodeName = contextNode.getNodeName();
SqlCommandType sqlCommandType = SqlCommandType.valueOf(nodeName.toUpperCase(Locale.ENGLISH));
//是否是查询函数
boolean isSelect = (sqlCommandType == SqlCommandType.SELECT);
//如果是查询,默认不刷新缓存,当然也可以指定刷新
boolean flushCache = methodSqlNode.getBooleanAttribute("flushCache", !isSelect);
//是否要缓存select结果,如果是查询,默认使用缓存,当然可以指定不用缓存
boolean useCache = methodSqlNode.getBooleanAttribute("useCache", isSelect);
//仅针对嵌套结果 select 语句适用:如果为 true,就是假设包含了嵌套结果集或是分组了,这样的话当返回一个主结果行的时候,就不会发生有对前面结果集的引用的情况。
//这就使得在获取嵌套的结果集的时候不至于导致内存不够用。默认值:false。
boolean resultOrdered = methodSqlNode.getBooleanAttribute("resultOrdered", false);
// Include Fragments before parsing
//解析之前先解析<include>SQL片段
XMLIncludeTransformer includeParser = new XMLIncludeTransformer(configuration, builderAssistant);
includeParser.applyIncludes(contextNode);
// Parse selectKey after includes and remove them.
//解析之前先解析<selectKey>
processSelectKeyNodes(id, parameterTypeClass, langDriver);
// Parse the SQL (pre: <selectKey> and <include> were parsed and removed)
//解析成SqlSource,一般是DynamicSqlSource,解析出所有的sql片段,带上动态标签中的表达式
SqlSource sqlSource = langDriver.createSqlSource(configuration, methodSqlNode, parameterTypeClass);
String resultSets = methodSqlNode.getStringAttribute("resultSets");
//(仅对 insert 有用) 标记一个属性, MyBatis 会通过 getGeneratedKeys 或者通过 insert 语句的 selectKey 子元素设置它的值
String keyProperty = methodSqlNode.getStringAttribute("keyProperty");
//(仅对 insert 有用) 标记一个属性, MyBatis 会通过 getGeneratedKeys 或者通过 insert 语句的 selectKey 子元素设置它的值
String keyColumn = methodSqlNode.getStringAttribute("keyColumn");
KeyGenerator keyGenerator;
String keyStatementId = id + SelectKeyGenerator.SELECT_KEY_SUFFIX;
//org.apache.ibatis.submitted.selectkey.Table1.insert!selectKey
keyStatementId = builderAssistant.applyCurrentNamespace(keyStatementId, true);
boolean hasKeyGenerator = configuration.hasKeyGenerator(keyStatementId);
if (hasKeyGenerator) {
//通过 <selectKey>
keyGenerator = configuration.getKeyGenerator(keyStatementId);
} else {
//直接在sql上指定 <insert id="insertTable2WithGeneratedKeyXml" useGeneratedKeys="true" keyProperty="nameId,generatedName" keyColumn="ID,NAME_FRED">
//则使用 Jdbc3KeyGenerator 自增
//setting中配置了能够使用自增主键,并且该sql是插入类型,则默认使用自增主键,否则还是以该sql的具体配置为准
boolean defaultUseKeyGenerator = configuration.isUseGeneratedKeys() && SqlCommandType.INSERT.equals(sqlCommandType);
//该sql的具体配置,如果没配置,则取 defaultUseKeyGenerator
Boolean useGeneratedKeys = methodSqlNode.getBooleanAttribute("useGeneratedKeys", defaultUseKeyGenerator);
//如果要使用主键,则用 Jdbc3KeyGenerator,否则传一个自增主键的空实现实例
keyGenerator = useGeneratedKeys ? new Jdbc3KeyGenerator() : new NoKeyGenerator();
}
//又去调助手类
builderAssistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType,
fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, resultTypeClass,
resultSetTypeEnum, flushCache, useCache, resultOrdered,
keyGenerator, keyProperty, keyColumn, databaseId, langDriver, resultSets);
}
/**
* <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
* SELECT LAST_INSERT_ID()
* </selectKey>
*
* @param id sql方法的id <insert id="insertAndgetkey" parameterType="com.soft.mybatis.model.User">
* @param parameterTypeClass <insert id="insertAndgetkey" parameterType="com.soft.mybatis.model.User">
* @param langDriver
*/
private void processSelectKeyNodes(String id, Class<?> parameterTypeClass, LanguageDriver langDriver) {
List<XNode> selectKeyNodes = methodSqlNode.evalNodes("selectKey");
if (configuration.getDatabaseId() != null) {
parseSelectKeyNodes(id, selectKeyNodes, parameterTypeClass, langDriver, configuration.getDatabaseId());
}
parseSelectKeyNodes(id, selectKeyNodes, parameterTypeClass, langDriver, null);
removeSelectKeyNodes(selectKeyNodes);
}
private void parseSelectKeyNodes(String parentId, List<XNode> list, Class<?> parameterTypeClass, LanguageDriver langDriver, String skRequiredDatabaseId) {
for (XNode nodeToHandle : list) {
//sql的id + "!selectKey"如:insertOne!selectKey
String id = parentId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
String databaseId = nodeToHandle.getStringAttribute("databaseId");
boolean databaseIdMatchesCurrent = databaseIdMatchesCurrent(id, databaseId, skRequiredDatabaseId);
if (databaseIdMatchesCurrent) {
parseSelectKeyNode(id, nodeToHandle, parameterTypeClass, langDriver, databaseId);
}
}
}
/**
* 解析 <selectKey/>如:
*
* <selectKey keyProperty="id" resultType="int" order="BEFORE">
* <if test="_databaseId == 'oracle'">
* select seq_users.nextval from dual
* </if>
* <if test="_databaseId == 'db2'">
* select nextval for seq_users from sysibm.sysdummy1"
* </if>
* </selectKey>
*
* @param id sql的id + "!selectKey"如:insertOne!selectKey
* @param keyNode <selectKey/>
* @param parameterTypeClass sql的入参数,也就是主键自动生成之后需要回写到参数的某个属性
* @param langDriver 语音驱动
* @param databaseId 数据库id
*/
private void parseSelectKeyNode(String id, XNode keyNode, Class<?> parameterTypeClass, LanguageDriver langDriver, String databaseId) {
//返回主键类型
String keyResultType = keyNode.getStringAttribute("resultType");
Class<?> keyResultTypeClass = resolveClass(keyResultType);
//生成主键sql也可以指定 statementType
StatementType statementType = StatementType.valueOf(keyNode.getStringAttribute("statementType", StatementType.PREPARED.toString()));
//主键的属性名称
String keyProperty = keyNode.getStringAttribute("keyProperty");
//主键列
String keyColumn = keyNode.getStringAttribute("keyColumn");
//order="AFTER",默认为after,是指在执行sql之前还是之后获取主键
boolean executeBefore = "BEFORE".equals(keyNode.getStringAttribute("order", "AFTER"));
//defaults
boolean useCache = false;
boolean resultOrdered = false;
KeyGenerator keyGenerator = new NoKeyGenerator();
Integer fetchSize = null;
Integer timeout = null;
boolean flushCache = false;
String parameterMap = null;
String resultMap = null;
ResultSetType resultSetTypeEnum = null;
//langDriver是一个接口
//TODO ? langDriver 实例如何来?
SqlSource sqlSource = langDriver.createSqlSource(configuration, keyNode, parameterTypeClass);
//主键相关为查询类型
SqlCommandType sqlCommandType = SqlCommandType.SELECT;
builderAssistant.addMappedStatement(id, sqlSource, statementType, sqlCommandType,
fetchSize, timeout, parameterMap, parameterTypeClass, resultMap, keyResultTypeClass,
resultSetTypeEnum, flushCache, useCache, resultOrdered,
keyGenerator, keyProperty, keyColumn, databaseId, langDriver, null);
//org.apache.ibatis.submitted.selectkey.Table1.insert!selectKey
id = builderAssistant.applyCurrentNamespace(id, false);
MappedStatement keyStatement = configuration.getMappedStatement(id, false);
SelectKeyGenerator selectKeyGenerator = new SelectKeyGenerator(keyStatement, executeBefore);
//丢进map
configuration.addKeyGenerator(id, selectKeyGenerator);
}
private void removeSelectKeyNodes(List<XNode> selectKeyNodes) {
for (XNode nodeToHandle : selectKeyNodes) {
nodeToHandle.getParent().getNode().removeChild(nodeToHandle.getNode());
}
}
private boolean databaseIdMatchesCurrent(String id, String databaseId, String requiredDatabaseId) {
if (requiredDatabaseId != null) {
return requiredDatabaseId.equals(databaseId);
} else {
if (databaseId != null) {
return false;
}
// skip this statement if there is a previous one with a not null databaseId
id = builderAssistant.applyCurrentNamespace(id, false);
if (this.configuration.hasStatement(id, false)) {
// issue #2
MappedStatement previous = this.configuration.getMappedStatement(id, false);
return previous.getDatabaseId() == null;
}
}
return true;
}
//取得语言驱动
private LanguageDriver getLanguageDriver(String lang) {
Class<?> langClass = null;
if (lang != null) {
langClass = resolveClass(lang);
}
//调用builderAssistant
return builderAssistant.getLanguageDriver(langClass);
}
}
| [
"zhucj@servyou.com.cn"
] | zhucj@servyou.com.cn |
8770248006431c2faef9619f9d29383efb121a51 | a20d4f02de75623f452bf6726dfda08c43ebff25 | /app/src/main/java/com/cat/music/ui/music/local/adapter/MyPagerAdapter.java | 67ef3bf390471f6ec244eaa65a081b9573cfe0d3 | [
"Apache-2.0"
] | permissive | Seachal/CatMusic | b4d4727529fc1a37760df9fe2278d4c05b4aac2b | 7481b85373ec992545a339462ddb7d94c27df3df | refs/heads/main | 2023-01-28T04:45:14.613176 | 2020-12-09T03:24:43 | 2020-12-09T03:24:43 | 319,835,147 | 1 | 1 | null | 2020-12-09T03:51:59 | 2020-12-09T03:51:58 | null | UTF-8 | Java | false | false | 1,018 | java | package com.cat.music.ui.music.local.adapter;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
/**
* Created by D22434 on 2017/9/25.
*/
//适配viewpager
public class MyPagerAdapter extends PagerAdapter {
private List<View> mViews;
public MyPagerAdapter(List<View> views) {
mViews = views;
}
@Override
public int getCount() {
return mViews.size();
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
return view == object;
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
container.addView(mViews.get(position));
return mViews.get(position);
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView(mViews.get(position));
}
} | [
"liangchaojie1@126.com"
] | liangchaojie1@126.com |
4c865ab0b09cf28cf6c210508f0bff973d684e62 | dba87418d2286ce141d81deb947305a0eaf9824f | /sources/com/google/firebase/remoteconfig/FirebaseRemoteConfigFetchThrottledException.java | 3710f487ce20c37d514e0bcf10913cf76b690ca5 | [] | no_license | Sluckson/copyOavct | 1f73f47ce94bb08df44f2ba9f698f2e8589b5cf6 | d20597e14411e8607d1d6e93b632d0cd2e8af8cb | refs/heads/main | 2023-03-09T12:14:38.824373 | 2021-02-26T01:38:16 | 2021-02-26T01:38:16 | 341,292,450 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 610 | java | package com.google.firebase.remoteconfig;
/* compiled from: com.google.firebase:firebase-config@@19.1.4 */
public class FirebaseRemoteConfigFetchThrottledException extends FirebaseRemoteConfigFetchException {
private final long throttleEndTimeMillis;
public FirebaseRemoteConfigFetchThrottledException(long j) {
this("Fetch was throttled.", j);
}
public FirebaseRemoteConfigFetchThrottledException(String str, long j) {
super(str);
this.throttleEndTimeMillis = j;
}
public long getThrottleEndTimeMillis() {
return this.throttleEndTimeMillis;
}
}
| [
"lucksonsurprice94@gmail.com"
] | lucksonsurprice94@gmail.com |
49a6be3ea7b84005cf095de9544789614ef62969 | 39b55714c3f1adaa96c1a8d19b64972df51375ab | /app/src/main/java/com/traxsmart/swmwrapperapp/di/activitiesModule/login/LoginModule.java | 5dbc268f22366768c3c824f03668a3da710a69ab | [] | no_license | avinashsamplersoft/SwmWrapperApp | e844d67a79a42bfc97726059b10f78967b7ade89 | 5f98b6d5348f04f77800a06678311989418f5b21 | refs/heads/master | 2023-04-01T02:08:13.294629 | 2021-03-23T10:20:55 | 2021-03-23T10:20:55 | 350,667,615 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package com.traxsmart.swmwrapperapp.di.activitiesModule.login;
import dagger.Module;
@Module
public class LoginModule {
/*@LoginScope
@Provides
@Named("auth_user")
static CredentialsDetails someUser(){
return new CredentialsDetails();
}*/
/*@LoginScope
@Provides
static AuthApi provideAuthApi(Retrofit retrofit){
return retrofit.create(AuthApi.class);
}*/
}
| [
"vnsh326@gmail.com"
] | vnsh326@gmail.com |
aee70f637988005662ad82de96905a5849a8627e | 9e1f60f9f5f9e096a0739f053931a1440307b00b | /src/main/java/com/favari/kafkapoc/entities/SkuSqlServer.java | 4fe3992b4620c61bd1fad5e2e3db993bedad9ff5 | [] | no_license | pedfav/kafka-poc | c304cbce47fbdd41206d7a4919c72c953c29275c | e73c3435e397ab8e180786794e6ef84dfafb0fd5 | refs/heads/master | 2020-07-03T07:14:42.171836 | 2019-08-20T02:03:52 | 2019-08-20T02:03:52 | 201,834,545 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package com.favari.kafkapoc.entities;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Data
@Entity
@Table(name = "inventory")
public class SkuSqlServer {
@Id
private String sku;
private Integer quantity;
private String description;
}
| [
"pedfav@gmail.com"
] | pedfav@gmail.com |
217fd4d0dfd74563d62d29062cbe408547bcf88f | 8e7e7c76312c871ad75a6788c8bd27b744daaf86 | /Tess4J-1.4-src/Tess4J/src/net/sourceforge/tess4j/ITessAPI.java | dea4ecb19b968c33efca05e2aa8cf71ce7943d02 | [
"Apache-2.0"
] | permissive | alaasayed/ocrapp | 482fde32fbf6ba5b99fef19119fac4cb4fc52f5e | e7d46c63ac6ee24af739f1d71df5580f741cecc2 | refs/heads/master | 2021-01-25T04:58:12.834177 | 2015-05-06T09:51:17 | 2015-05-06T09:51:17 | 35,146,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,484 | java | /**
* Copyright @ 2014 Quan Nguyen
*
* 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 net.sourceforge.tess4j;
import com.sun.jna.Callback;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
import com.sun.jna.PointerType;
import com.sun.jna.Structure;
import java.util.Arrays;
import java.util.List;
/**
* An interface represents common TessAPI classes/constants.
*/
public interface ITessAPI {
/**
* When Tesseract/Cube is initialized we can choose to instantiate/load/run
* only the Tesseract part, only the Cube part or both along with the
* combiner. The preference of which engine to use is stored in
* <code>tessedit_ocr_engine_mode</code>.<br>
* <br>
* ATTENTION: When modifying this enum, please make sure to make the
* appropriate changes to all the enums mirroring it (e.g. OCREngine in
* cityblock/workflow/detection/detection_storage.proto). Such enums will
* mention the connection to OcrEngineMode in the comments.
*/
public static interface TessOcrEngineMode {
/**
* Run Tesseract only - fastest
*/
public static final int OEM_TESSERACT_ONLY = 0;
/**
* Run Cube only - better accuracy, but slower
*/
public static final int OEM_CUBE_ONLY = 1;
/**
* Run both and combine results - best accuracy
*/
public static final int OEM_TESSERACT_CUBE_COMBINED = 2;
/**
* Specify this mode when calling <code>init_*()</code>, to indicate
* that any of the above modes should be automatically inferred from the
* variables in the language-specific config, command-line configs, or
* if not specified in any of the above should be set to the default
* <code>OEM_TESSERACT_ONLY</code>.
*/
public static final int OEM_DEFAULT = 3;
};
/**
* Possible modes for page layout analysis. These *must* be kept in order of
* decreasing amount of layout analysis to be done, except for
* <code>OSD_ONLY</code>, so that the inequality test macros below work.
*/
public static interface TessPageSegMode {
/**
* Orientation and script detection only.
*/
public static final int PSM_OSD_ONLY = 0;
/**
* Automatic page segmentation with orientation and script detection.
* (OSD)
*/
public static final int PSM_AUTO_OSD = 1;
/**
* Automatic page segmentation, but no OSD, or OCR.
*/
public static final int PSM_AUTO_ONLY = 2;
/**
* Fully automatic page segmentation, but no OSD.
*/
public static final int PSM_AUTO = 3;
/**
* Assume a single column of text of variable sizes.
*/
public static final int PSM_SINGLE_COLUMN = 4;
/**
* Assume a single uniform block of vertically aligned text.
*/
public static final int PSM_SINGLE_BLOCK_VERT_TEXT = 5;
/**
* Assume a single uniform block of text.
*/
public static final int PSM_SINGLE_BLOCK = 6;
/**
* Treat the image as a single text line.
*/
public static final int PSM_SINGLE_LINE = 7;
/**
* Treat the image as a single word.
*/
public static final int PSM_SINGLE_WORD = 8;
/**
* Treat the image as a single word in a circle.
*/
public static final int PSM_CIRCLE_WORD = 9;
/**
* Treat the image as a single character.
*/
public static final int PSM_SINGLE_CHAR = 10;
/**
* Find as much text as possible in no particular order.
*/
public static final int PSM_SPARSE_TEXT = 11;
/**
* Sparse text with orientation and script detection.
*/
public static final int PSM_SPARSE_TEXT_OSD = 12;
/**
* Number of enum entries.
*/
public static final int PSM_COUNT = 13;
};
/**
* Enum of the elements of the page hierarchy, used in
* <code>ResultIterator</code> to provide functions that operate on each
* level without having to have 5x as many functions.
*/
public static interface TessPageIteratorLevel {
/**
* Block of text/image/separator line.
*/
public static final int RIL_BLOCK = 0;
/**
* Paragraph within a block.
*/
public static final int RIL_PARA = 1;
/**
* Line within a paragraph.
*/
public static final int RIL_TEXTLINE = 2;
/**
* Word within a textline.
*/
public static final int RIL_WORD = 3;
/**
* Symbol/character within a word.
*/
public static final int RIL_SYMBOL = 4;
};
/**
* Possible types for a POLY_BLOCK or ColPartition. Must be kept in sync
* with <code>kPBColors</code> in polyblk.cpp and <code>PTIs*Type</code>
* functions below, as well as <code>kPolyBlockNames</code> in
* publictypes.cpp. Used extensively by ColPartition, and POLY_BLOCK.
*/
public static interface TessPolyBlockType {
/**
* Type is not yet known. Keep as the first element.
*/
public static final int PT_UNKNOWN = 0;
/**
* Text that lives inside a column.
*/
public static final int PT_FLOWING_TEXT = 1;
/**
* Text that spans more than one column.
*/
public static final int PT_HEADING_TEXT = 2;
/**
* Text that is in a cross-column pull-out region.
*/
public static final int PT_PULLOUT_TEXT = 3;
/**
* Partition belonging to an equation region.
*/
public static final int PT_EQUATION = 4;
/**
* Partition has inline equation.
*/
public static final int PT_INLINE_EQUATION = 5;
/**
* Partition belonging to a table region.
*/
public static final int PT_TABLE = 6;
/**
* Text-line runs vertically.
*/
public static final int PT_VERTICAL_TEXT = 7;
/**
* Text that belongs to an image.
*/
public static final int PT_CAPTION_TEXT = 8;
/**
* Image that lives inside a column.
*/
public static final int PT_FLOWING_IMAGE = 9;
/**
* Image that spans more than one column.
*/
public static final int PT_HEADING_IMAGE = 10;
/**
* Image that is in a cross-column pull-out region.
*/
public static final int PT_PULLOUT_IMAGE = 11;
/**
* Horizontal Line.
*/
public static final int PT_HORZ_LINE = 12;
/**
* Vertical Line.
*/
public static final int PT_VERT_LINE = 13;
/**
* Lies outside of any column.
*/
public static final int PT_NOISE = 14;
/**
* Number of enum entries.
*/
public static final int PT_COUNT = 15;
};
/**
* <pre>
* +------------------+
* | 1 Aaaa Aaaa Aaaa |
* | Aaa aa aaa aa |
* | aaaaaa A aa aaa. |
* | 2 |
* | ####### c c C |
* | ####### c c c |
* | < ####### c c c |
* | < ####### c c |
* | < ####### . c |
* | 3 ####### c |
* +------------------+
* </pre> Orientation Example:
* <br>
* ====================
* <br>
* Above is a diagram of some (1) English and (2) Chinese text and a (3)
* photo credit.<br>
* <br>
* Upright Latin characters are represented as A and a. '<' represents a
* latin character rotated anti-clockwise 90 degrees. Upright Chinese
* characters are represented C and c.<br>
* <br> NOTA BENE: enum values here should match goodoc.proto<br>
* <br>
* If you orient your head so that "up" aligns with Orientation, then the
* characters will appear "right side up" and readable.<br>
* <br>
* In the example above, both the English and Chinese paragraphs are
* oriented so their "up" is the top of the page (page up). The photo credit
* is read with one's head turned leftward ("up" is to page left).<br>
* <br> The values of this enum match the convention of Tesseract's
* osdetect.h
*/
public static interface TessOrientation {
public static final int ORIENTATION_PAGE_UP = 0;
public static final int ORIENTATION_PAGE_RIGHT = 1;
public static final int ORIENTATION_PAGE_DOWN = 2;
public static final int ORIENTATION_PAGE_LEFT = 3;
};
/**
* The grapheme clusters within a line of text are laid out logically in
* this direction, judged when looking at the text line rotated so that its
* Orientation is "page up".<br>
* <br>
* For English text, the writing direction is left-to-right. For the Chinese
* text in the above example, the writing direction is top-to-bottom.
*/
public static interface TessWritingDirection {
public static final int WRITING_DIRECTION_LEFT_TO_RIGHT = 0;
public static final int WRITING_DIRECTION_RIGHT_TO_LEFT = 1;
public static final int WRITING_DIRECTION_TOP_TO_BOTTOM = 2;
};
/**
* The text lines are read in the given sequence.<br>
* <br>
* In English, the order is top-to-bottom. In Chinese, vertical text lines
* are read right-to-left. Mongolian is written in vertical columns top to
* bottom like Chinese, but the lines order left-to right.<br>
* <br>
* Note that only some combinations make sense. For example,
* <code>WRITING_DIRECTION_LEFT_TO_RIGHT</code> implies
* <code>TEXTLINE_ORDER_TOP_TO_BOTTOM</code>.
*/
public static interface TessTextlineOrder {
public static final int TEXTLINE_ORDER_LEFT_TO_RIGHT = 0;
public static final int TEXTLINE_ORDER_RIGHT_TO_LEFT = 1;
public static final int TEXTLINE_ORDER_TOP_TO_BOTTOM = 2;
};
public static final int TRUE = 1;
public static final int FALSE = 0;
public static class TessBaseAPI extends PointerType {
public TessBaseAPI(Pointer address) {
super(address);
}
public TessBaseAPI() {
super();
}
};
public static class TessPageIterator extends PointerType {
public TessPageIterator(Pointer address) {
super(address);
}
public TessPageIterator() {
super();
}
};
public static class TessMutableIterator extends PointerType {
public TessMutableIterator(Pointer address) {
super(address);
}
public TessMutableIterator() {
super();
}
};
public static class TessResultIterator extends PointerType {
public TessResultIterator(Pointer address) {
super(address);
}
public TessResultIterator() {
super();
}
};
/**
* Description of the output of the OCR engine. This structure is used as
* both a progress monitor and the final output header, since it needs to be
* a valid progress monitor while the OCR engine is storing its output to
* shared memory. During progress, all the buffer info is -1. Progress
* starts at 0 and increases to 100 during OCR. No other constraint. Every
* progress callback, the OCR engine must set <code>ocr_alive</code> to 1.
* The HP side will set <code>ocr_alive</code> to 0. Repeated failure to
* reset to 1 indicates that the OCR engine is dead. If the cancel function
* is not null then it is called with the number of user words found. If it
* returns true then operation is cancelled.
*/
public static class ETEXT_DESC extends Structure {
/**
* chars in this buffer(0). Total number of UTF-8 bytes for this run.
*/
public short count;
/**
* percent complete increasing (0-100)
*/
public short progress;
/**
* true if not last
*/
public byte more_to_come;
/**
* ocr sets to 1, HP 0
*/
public byte ocr_alive;
/**
* for errcode use
*/
public byte err_code;
/**
* returns true to cancel
*/
public CANCEL_FUNC cancel;
/**
* this or other data for cancel
*/
public Pointer cancel_this;
/**
* time to stop if not 0
*/
public TimeVal end_time;
/**
* character data
*/
public EANYCODE_CHAR[] text = new EANYCODE_CHAR[1];
/**
* Gets Field Order.
*
* @return
*/
@Override
protected List getFieldOrder() {
return Arrays.asList("count", "progress", "more_to_come", "ocr_alive", "err_code", "cancel", "cancel_this", "end_time", "text");
}
}
/**
* It should be noted that the format for char_code for version 2.0 and
* beyond is UTF-8, which means that ASCII characters will come out as one
* structure but other characters will be returned in two or more instances
* of this structure with a single byte of the UTF-8 code in each, but each
* will have the same bounding box.<br>
* <br>
* Programs which want to handle languages with different characters sets
* will need to handle extended characters appropriately, but
* <strong>all</strong>
* code needs to be prepared to receive UTF-8 coded characters for
* characters such as bullet and fancy quotes.
*/
public static class EANYCODE_CHAR extends Structure {
/**
* character itself, one single UTF-8 byte long. A Unicode character may
* consist of one or more UTF-8 bytes. Bytes of a character will have
* the same bounding box.
*/
public byte char_code;
/**
* left of char (-1)
*/
public short left;
/**
* right of char (-1)
*/
public short right;
/**
* top of char (-1)
*/
public short top;
/**
* bottom of char (-1)
*/
public short bottom;
/**
* what font (0)
*/
public short font_index;
/**
* classification confidence: 0=perfect, 100=reject (0/100)
*/
public byte confidence;
/**
* point size of char, 72 = 1 inch, (10)
*/
public byte point_size;
/**
* number of spaces before this char (1)
*/
public byte blanks;
/**
* char formatting (0)
*/
public byte formatting;
/**
* Gets Field Order.
*
* @return
*/
@Override
protected List getFieldOrder() {
return Arrays.asList("char_code", "left", "right", "top", "bottom", "font_index", "confidence", "point_size", "blanks", "formatting");
}
}
/**
* Callback for <code>cancel_func</code>.
*/
interface CANCEL_FUNC extends Callback {
/**
*
* @param cancel_this
* @param words
* @return
*/
boolean invoke(Pointer cancel_this, int words);
};
public static class TimeVal extends Structure {
/**
* seconds
*/
public NativeLong tv_sec;
/**
* microseconds
*/
public NativeLong tv_usec;
@Override
protected List<?> getFieldOrder() {
return Arrays.asList("tv_sec", "tv_usec");
}
}
}
| [
"alaa.sayed4@gmail.com"
] | alaa.sayed4@gmail.com |
79dde59932b64158cd5400e85b39db7b01cbfd77 | cdc1483a176083cb7876e3cc122455a164619cf2 | /platform/android/module/src/jp/idumo/java/android/model/AndroidOrientationModel.java | 501bbc349207a5863f67ca8a64343b70cbf6661d | [] | no_license | hixi-hyi/idumo-java | 54a59f434a579aafe6fd0abbccdb260ccbce854b | fb88bbd494a41461630d5adf9fed68737be3db70 | refs/heads/master | 2016-09-16T14:16:22.423851 | 2013-02-24T20:30:29 | 2013-02-24T20:30:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,549 | java | /**
* Copyright (c) <2012>, <Hiroyoshi Houchi> All rights reserved.
*
* http://www.hixi-hyi.com/
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* The names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package jp.idumo.java.android.model;
import jp.idumo.java.model.IfDataElement.AbstractData;
import jp.idumo.java.model.raw.NumberRawDataType;
/**
* @author Hiroyoshi HOUCHI
* @version 2.0
*/
public class AndroidOrientationModel extends AbstractData {
private static final String PITCH = "pitch";
private static final String ROLL = "roll";
private static final String AZMUTH = "azmuth";
public AndroidOrientationModel(float pitch, float roll, float azmuth) {
add(new NumberRawDataType(PITCH, pitch, "Android Orientation Pitch"));
add(new NumberRawDataType(ROLL, roll, "Android Orientation Roll"));
add(new NumberRawDataType(AZMUTH, azmuth, "Android Orientation Azmuth"));
}
public float getAzmuth() {
return (Float) getValue(AZMUTH);
}
public float getPitch() {
return (Float) getValue(PITCH);
}
public float getRoll() {
return (Float) getValue(ROLL);
}
@Override
public String getText() {
return String.format("%s:%f\n%s:%f\n%s:%f", PITCH, getPitch(), ROLL, getRoll(), AZMUTH, getAzmuth());
}
}
| [
"git@hixi-hyi.com"
] | git@hixi-hyi.com |
68b476fa2870bdb53c3eea387cdd5fc3b3bb8a28 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_c201d712469b9510e63e2afa2a13f1c5bdb1ce18/RunCompile/2_c201d712469b9510e63e2afa2a13f1c5bdb1ce18_RunCompile_s.java | d62526c9a2f45d65f65a2b4aa2acff701a3eed59 | [] | 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 | 7,076 | java | package de.unisiegen.informatik.bs.alvis.commands;
import java.io.File;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
import org.eclipse.ui.model.BaseWorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.part.FileEditorInput;
import de.unisiegen.informatik.bs.alvis.Activator;
import de.unisiegen.informatik.bs.alvis.Run;
import de.unisiegen.informatik.bs.alvis.compiler.CompilerAccess;
import de.unisiegen.informatik.bs.alvis.tools.IO;
public class RunCompile extends AbstractHandler {
Run seri;
ExecutionEvent myEvent;
public Object execute(ExecutionEvent event) throws ExecutionException {
// NOTE: event is null when executing from run editor.
myEvent = event;
// Save all Editors
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.saveAllEditors(true);
new CloseRunPerspective().execute(event);
// Instantiate IEditorInput
IEditorInput input = null;
/*
* Register datatypes and packagenames to the compiler This is important
* for compiling
*/
CompilerAccess.getDefault().setDatatypes(
Activator.getDefault().getAllDatatypesInPlugIns());
CompilerAccess.getDefault().setDatatypePackages(
Activator.getDefault().getAllDatatypesPackagesInPlugIns());
// System.out.println(Platform.getInstanceLocation().getURL().getPath());
// CompilerAccess.getDefault().testDatatypes();
try {
// What to run? get the input (filepath)
input = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().getActiveEditor().getEditorInput();
} catch (NullPointerException e) {
e.printStackTrace();
}
// Instantiate a new Run object
seri = null;
/*
* GET THE RUN OBJECT
*/
// Check if the input is a FileEditorInput
if (input != null && input instanceof FileEditorInput) {
// cast to FileEditorInput
FileEditorInput fileInput = (FileEditorInput) input;
// If the user has choosen a graph to run...
if (fileInput.getFile().getFileExtension().equals("run")) { //$NON-NLS-1$
// get the path in system
String systemPath = fileInput.getPath().toString();
// and deserialize the saved run to seri
seri = (Run) IO.deserialize(systemPath);
} else {
// ask for run settings
seri = getPreferencesByDialog();
}
} else {
// ask for run settings
seri = getPreferencesByDialog();
}
// END OF GET THE RUN OBJECT
if (seri != null) {
// GET THE ALGORITHM AS STRING
try {
// Translate the PseudoCode and get the translated file
File javaCode = null;
// if the algorithm is of type ".algo" it is pseudo code and it must be compiled
// if not, it's passed on to the virtual machine
if(seri.getAlgorithmFile().endsWith(".algo")){
// try to compile with compiler
javaCode = CompilerAccess.getDefault().compile(
seri.getAlgorithmFile());
// if fails
if (null == javaCode) // compile with dummy
throw new Exception();// TODO throw a meaningful exception
}
else{
javaCode = new File(Platform.getInstanceLocation().getURL().getPath() + seri.getAlgorithmFile());
}
// Kill the extension
String fileNameOfTheAlgorithm = javaCode.getCanonicalPath()
.replaceAll("\\.java$", ""); //$NON-NLS-1$
// Get the path where the translated files are saved to.
String pathToTheAlgorithm = javaCode.getParentFile()
.getCanonicalPath();
// Register Algorithm to VM
// TODO Warning, if we change the name of the translated file
// this here will crash
fileNameOfTheAlgorithm = "Algorithm";
// setJavaAlgorithmToVM has 2 parameter 1. is the path 2. is the
// filename
// if /usr/alvis/src/Algorithm.java then
// 1.: /usr/alvis/src
// 2.: Algorithm
Activator.getDefault().setJavaAlgorithmToVM(pathToTheAlgorithm,
fileNameOfTheAlgorithm,
Activator.getDefault().getAllDatatypesInPlugIns());
Activator.getDefault().setActiveRun(seri);
// Then activate command SwitchToRunPerspective
new SwitchToRunPerspective().execute(event);
} catch (Exception e) {
// Create the required Status object
Status status = new Status(IStatus.ERROR, "My Plug-in ID", 0,
e.getMessage(), null);
// Display the dialog
ErrorDialog
.openError(
Display.getCurrent().getActiveShell(),
"Error starting the Run",
"An Error has occurred. The run could not start. Read the message shown below to solve the problem.",
status);
e.printStackTrace();
} finally {
}
} else {
return null;
}
// IResource.refreshLocal();
new RefreshWorkspace().execute(event);
return null;
}
private Run getPreferencesByDialog() {
String extensions = Activator.getDefault().getFileExtensionsAsCommaSeparatedList();
Run seri = new Run();
while (seri.getAlgorithmFile().equals("") | seri.getExampleFile().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(), new WorkbenchLabelProvider(),
new BaseWorkbenchContentProvider());
dialog.setTitle(Messages.RunCompile_7);
dialog.setMessage(NLS.bind(Messages.RunCompile_8, "(" + extensions + ")"));
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.open();
if (dialog.getResult() != null) {
String result = ""; //$NON-NLS-1$
for (Object o : dialog.getResult()) {
result = o.toString();
for(String fileExtension : Activator.getDefault().getFileExtensions()){
if (result.startsWith("L") && result.endsWith(fileExtension)) { //$NON-NLS-1$ //$NON-NLS-2$
result = result.substring(2); // cut the first two chars
seri.setExampleFile(result);
}
}
if (result.startsWith("L") && (result.endsWith("algo")|| result.endsWith(".java"))) { //$NON-NLS-1$ //$NON-NLS-2$
result = result.substring(2); // cut the first two chars
seri.setAlgorithmFile(result);
}
}
}
if (dialog.getReturnCode() == 1) // the user clicked cancel
return null;
}
return seri;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
7ebdcddfba34522fbbd91556e0f56c4cd7928314 | a6494e8b1bda1f57a248b0758e24be613d87f2dc | /android/build/generated/source/buildConfig/androidTest/debug/mx/itesm/wahcamole/test/BuildConfig.java | ac4fc80928f925588845f88a42105da85decc080 | [] | no_license | emilycrow/DinoSpazio2.0 | b9365934e819942de6e20bc2fe988701b9ef731d | 02ff70b725b70e94736e964abcf56c299bf2e11a | refs/heads/master | 2021-01-10T12:38:31.894805 | 2016-04-22T01:23:49 | 2016-04-22T01:23:49 | 54,814,023 | 0 | 0 | null | 2016-04-01T03:17:45 | 2016-03-27T05:23:12 | Java | UTF-8 | Java | false | false | 451 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package mx.itesm.wahcamole.test;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "mx.itesm.wahcamole.test";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = -1;
public static final String VERSION_NAME = "";
}
| [
"michell-campos@hotmail.com"
] | michell-campos@hotmail.com |
789f39ea21e2c68d0ceddbac81b78b42ca68e9d0 | d7aa38b8309f7e6ce9b0a51491b2dee246cdf45a | /java/ru/myx/xstore/s3/concept/ReplacerConditionStateList.java | 8b149de8d66acfcf47c7e7a67a0ed738bb3daa61 | [] | no_license | acmcms/acm-plug-s3 | 2535d29fe41f074cbe12406aa87984c57cef9300 | 4a7f3152c51d6198b3d29c4cc3c271fe5e2b0f08 | refs/heads/master | 2023-04-07T08:01:54.501723 | 2023-03-22T22:43:14 | 2023-03-22T22:43:14 | 140,318,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 662 | java | /*
* Created on 14.01.2005
*/
package ru.myx.xstore.s3.concept;
import java.util.function.Function;
import ru.myx.ae3.help.Convert;
import ru.myx.query.OneCondition;
import ru.myx.query.OneConditionSimple;
final class ReplacerConditionStateList implements Function<OneCondition, OneCondition> {
private final String stateList;
ReplacerConditionStateList(final String stateList) {
this.stateList = stateList;
}
@Override
public OneCondition apply(final OneCondition condition) {
return new OneConditionSimple(condition.isExact(), "o.objState", Convert.Any.toInt(condition.getValue(), 0) == 0
? " NOT IN "
: " IN ", this.stateList);
}
}
| [
"myx@myx.co.nz"
] | myx@myx.co.nz |
fa3c234776fd64af8539d14e9370f8a74b2d27de | 8a5e2c3797a5f9328e3fd648c46314258926ff08 | /android/app/src/main/java/com/materialtabapp/MainActivity.java | d2c5f2dcedbee6a619f0cfcad31dbf654fd5552f | [] | no_license | iwmnikhil/reactnative_tabbar | 97c0c6cdea457116c1d2a96467dce69d853f805c | bec91a3e984a577312c832f5a1d05937289c93a9 | refs/heads/master | 2020-04-08T18:33:30.279890 | 2019-01-30T14:21:57 | 2019-01-30T14:21:57 | 159,613,403 | 0 | 0 | null | 2019-01-30T14:24:33 | 2018-11-29T05:39:23 | Objective-C | UTF-8 | Java | false | false | 373 | java | package com.materialtabapp;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "MaterialTabApp";
}
}
| [
"nikhil.j@infowaysmedia.com"
] | nikhil.j@infowaysmedia.com |
901dcde11887294138a9a0534aafc26ca8dde54f | 0d5c1caacd2e499081a0bc212efb93346bdb1ae8 | /NewnhamCollege/app/src/androidTest/java/app/com/example/android/newnhamcollege/ApplicationTest.java | 7539ecaff081e3da23ef0590dee69286c9cc8214 | [] | no_license | sophieeihpos/Newnham-College | 54aa180b07028ddb297df190bf5926c2fe34ae66 | ddf26492bb29f8a1ea50482733eab53bd792d696 | refs/heads/master | 2021-01-18T19:32:32.699959 | 2017-04-02T17:12:48 | 2017-04-02T17:12:48 | 86,901,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package app.com.example.android.newnhamcollege;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"sophie-eihpos@hotmail.com"
] | sophie-eihpos@hotmail.com |
aad76aa291d7788a524a5de8dd57665911314a5f | cbca459181b4516ee273a5b1f762728d26f9e513 | /plugin_login/src/test/java/com/bingoloves/plugin_login/ExampleUnitTest.java | 40e1cd0ce2fc211c37c0b6ede101fbaa8e393589 | [] | no_license | bingoloves/VirtualApp | 3feb78463ec04dacbf27a8579680b899da78c932 | d95bca4bb1a495dd6aa5c38f65ba261c6a18a05a | refs/heads/main | 2023-02-14T22:21:02.024835 | 2021-01-13T08:48:55 | 2021-01-13T08:48:55 | 315,262,821 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package com.bingoloves.plugin_login;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"657952166@qq.com"
] | 657952166@qq.com |
227355f6d34a53a4bcbd0163acd29da402e809d3 | 39f01c5fa5db5f088daf0ced644a7d1957c4d6d1 | /BehavioralPattern/InterpreterPattern/Client.java | 4443584244877fea7aac2860295233c29bbb408e | [] | no_license | lautung/JavaDesignPattern | e8fb8020ab5442106a0caa8ed007d9e1d9f9d9d6 | 4e78e1381da9f9044a43dfa07f93707e9188c107 | refs/heads/main | 2023-06-23T07:51:52.728989 | 2021-07-24T06:46:53 | 2021-07-24T06:46:53 | 388,528,637 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 143 | java | package BehavioralPattern.InterpreterPattern;
public class Client {
public static void main(String[] args) {
// TODO PSVM
}
}
| [
"2281876422@qq.com"
] | 2281876422@qq.com |
dc3d28520ed3da5c0355ff0155a2540629c3db07 | 37db8f6b2e7907b71f748808ea9ff8e8d033d564 | /JavaSource/org/unitime/timetable/server/rooms/RoomPropertiesBackend.java | 334e081735fc97e3ce8c497f4e91db376fdfc71c | [
"Apache-2.0",
"EPL-2.0",
"CDDL-1.0",
"MIT",
"CC-BY-3.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-freemarker",
"LGPL-2.1-only",
"EPL-1.0",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-generic-cla",
... | permissive | UniTime/unitime | 48eaa44ae85db344d015577d21dcc1a41cecd862 | bc69f2e18f82bdb6c995c4e6490cb650fa4fa98e | refs/heads/master | 2023-08-18T00:52:29.614387 | 2023-08-16T16:08:17 | 2023-08-16T16:08:17 | 29,594,752 | 253 | 185 | Apache-2.0 | 2023-05-17T14:16:13 | 2015-01-21T14:58:53 | Java | UTF-8 | Java | false | false | 16,782 | java | /*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*
* The Apereo Foundation 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.unitime.timetable.server.rooms;
import java.util.TreeSet;
import org.cpsolver.ifs.util.DistanceMetric;
import org.unitime.localization.impl.Localization;
import org.unitime.timetable.defaults.ApplicationProperty;
import org.unitime.timetable.defaults.CommonValues;
import org.unitime.timetable.defaults.UserProperty;
import org.unitime.timetable.events.EventAction.EventContext;
import org.unitime.timetable.gwt.command.server.GwtRpcImplementation;
import org.unitime.timetable.gwt.command.server.GwtRpcImplements;
import org.unitime.timetable.gwt.resources.GwtConstants;
import org.unitime.timetable.gwt.shared.RoomInterface;
import org.unitime.timetable.gwt.shared.EventInterface.EventServiceProviderInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.AcademicSessionInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.BuildingInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.DepartmentInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.ExamTypeInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.FeatureInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.FeatureTypeInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.GroupInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.PreferenceInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.RoomPropertiesInterface;
import org.unitime.timetable.gwt.shared.RoomInterface.RoomPropertiesRequest;
import org.unitime.timetable.gwt.shared.RoomInterface.RoomTypeInterface;
import org.unitime.timetable.model.AttachmentType;
import org.unitime.timetable.model.Building;
import org.unitime.timetable.model.Department;
import org.unitime.timetable.model.DepartmentRoomFeature;
import org.unitime.timetable.model.DepartmentStatusType;
import org.unitime.timetable.model.EventServiceProvider;
import org.unitime.timetable.model.ExamType;
import org.unitime.timetable.model.GlobalRoomFeature;
import org.unitime.timetable.model.PreferenceLevel;
import org.unitime.timetable.model.RoomFeature;
import org.unitime.timetable.model.RoomFeatureType;
import org.unitime.timetable.model.RoomGroup;
import org.unitime.timetable.model.RoomType;
import org.unitime.timetable.model.Session;
import org.unitime.timetable.model.dao.RoomFeatureTypeDAO;
import org.unitime.timetable.model.dao.SessionDAO;
import org.unitime.timetable.security.SessionContext;
import org.unitime.timetable.security.UserAuthority;
import org.unitime.timetable.security.rights.Right;
/**
* @author Tomas Muller
*/
@GwtRpcImplements(RoomPropertiesRequest.class)
public class RoomPropertiesBackend implements GwtRpcImplementation<RoomPropertiesRequest, RoomPropertiesInterface> {
protected static final GwtConstants CONSTANTS = Localization.create(GwtConstants.class);
@Override
public RoomPropertiesInterface execute(RoomPropertiesRequest request, SessionContext context) {
if (request.hasSessionId())
context = new EventContext(context, request.getSessionId());
context.checkPermission(Right.Rooms);
RoomPropertiesInterface response = new RoomPropertiesInterface();
UserAuthority authority = null;
if (context.getUser() != null) {
Session session = SessionDAO.getInstance().get(request.hasSessionId() ? request.getSessionId() : context.getUser().getCurrentAcademicSessionId());
response.setAcademicSession(new AcademicSessionInterface(session.getUniqueId(), session.getAcademicTerm() + " " + session.getAcademicYear()));
authority = context.getUser().getCurrentAuthority();
}
response.setCanEditDepartments(context.hasPermission(Right.EditRoomDepartments));
response.setCanExportCsv(context.hasPermission(Right.RoomsExportCsv));
response.setCanExportPdf(context.hasPermission(Right.RoomsExportPdf));
response.setCanEditRoomExams(context.hasPermission(Right.EditRoomDepartmentsExams));
response.setCanAddRoom(context.hasPermission(Right.AddRoom));
response.setCanAddNonUniversity(context.hasPermission(Right.AddNonUnivLocation));
response.setCanSeeCourses(context.hasPermission(Right.InstructionalOfferings) || context.hasPermission(Right.Classes) ||
(authority != null && (authority.hasRight(Right.RoomEditChangeRoomProperties) || authority.hasRight(Right.RoomEditChangeControll) || authority.hasRight(Right.RoomDetailAvailability) || authority.hasRight(Right.RoomEditAvailability))));
response.setCanSeeExams(context.hasPermission(Right.Examinations) ||
(authority != null && (authority.hasRight(Right.RoomEditChangeExaminationStatus) || authority.hasRight(Right.RoomDetailPeriodPreferences))));
response.setCanSeeEvents(context.hasPermission(Right.Events) ||
(authority != null && (authority.hasRight(Right.RoomEditChangeEventProperties) || authority.hasRight(Right.RoomDetailEventAvailability ) || authority.hasRight(Right.RoomEditEventAvailability))));
response.setCanExportRoomGroups(context.hasPermission(Right.RoomGroupsExportPdf));
response.setCanExportRoomFeatures(context.hasPermission(Right.RoomFeaturesExportPdf));
response.setCanAddGlobalRoomGroup(context.hasPermission(Right.GlobalRoomGroupAdd));
response.setCanAddDepartmentalRoomGroup(context.hasPermission(Right.DepartmentRoomGroupAdd));
response.setCanAddGlobalRoomFeature(context.hasPermission(Right.GlobalRoomFeatureAdd));
response.setCanAddDepartmentalRoomFeature(context.hasPermission(Right.DepartmentRoomFeatureAdd));
if (context.getUser() != null) {
response.setCanChangeAvailability(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditAvailability));
response.setCanChangeControll(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditChangeControll));
response.setCanChangeEventAvailability(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditEventAvailability));
response.setCanChangeEventProperties(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditChangeEventProperties));
response.setCanChangeExamStatus(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditChangeExaminationStatus));
response.setCanChangeExternalId(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditChangeExternalId));
response.setCanChangeFeatures(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditFeatures) || context.getUser().getCurrentAuthority().hasRight(Right.RoomEditGlobalFeatures));
response.setCanChangeGroups(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditGroups) || context.getUser().getCurrentAuthority().hasRight(Right.RoomEditGlobalGroups));
response.setCanChangePicture(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditChangePicture));
response.setCanChangePreferences(context.getUser().getCurrentAuthority().hasRight(Right.RoomEditPreference));
response.setCanChangeDefaultGroup(context.getUser().getCurrentAuthority().hasRight(Right.GlobalRoomGroupEditSetDefault));
if (!response.isCanSeeEvents() && response.isCanChangeEventProperties())
response.setCanSeeEvents(true);
}
for (RoomType type: RoomType.findAll())
response.addRoomType(new RoomTypeInterface(type.getUniqueId(), type.getReference(), type.getLabel(), type.isRoom(), type.getOrd()));
for (Building b: Building.findAll(response.getAcademicSessionId())) {
BuildingInterface building = new BuildingInterface(b.getUniqueId(), b.getAbbreviation(), b.getName());
building.setX(b.getCoordinateX()); building.setY(b.getCoordinateY());
building.setExternalId(b.getExternalUniqueId());
response.addBuilding(building);
}
for (RoomFeatureType type: new TreeSet<RoomFeatureType>(RoomFeatureTypeDAO.getInstance().findAll()))
response.addFeatureType(new FeatureTypeInterface(type.getUniqueId(), type.getReference(), type.getLabel(), type.isShowInEventManagement()));
if (context.getUser() != null) {
for (ExamType type: ExamType.findAllApplicable(context.getUser(), DepartmentStatusType.Status.ExamView, DepartmentStatusType.Status.ExamTimetable))
response.addExamType(new ExamTypeInterface(type.getUniqueId(), type.getReference(), type.getLabel(), type.getType() == ExamType.sExamTypeFinal));
}
for (Department d: Department.getUserDepartments(context.getUser())) {
DepartmentInterface department = new DepartmentInterface();
department.setId(d.getUniqueId());
department.setDeptCode(d.getDeptCode());
department.setAbbreviation(d.getAbbreviation());
department.setLabel(d.getName());
department.setExternal(d.isExternalManager());
department.setEvent(d.isAllowEvents());
department.setExtAbbreviation(d.getExternalMgrAbbv());
department.setExtLabel(d.getExternalMgrLabel());
department.setTitle(d.getLabel());
department.setCanEditRoomSharing(context.hasPermission(d, Right.EditRoomDepartments));
response.addDepartment(department);
}
response.setNrDepartments(Department.findAllBeingUsed(response.getAcademicSessionId()).size());
response.setHorizontal(context.getUser() == null ? false : CommonValues.HorizontalGrid.eq(context.getUser().getProperty(UserProperty.GridOrientation)));
response.setGridAsText(context.getUser() == null ? false : CommonValues.TextGrid.eq(context.getUser().getProperty(UserProperty.GridOrientation)));
for (int i = 0; true; i++) {
String mode = ApplicationProperty.RoomSharingMode.value(String.valueOf(1 + i), i < CONSTANTS.roomSharingModes().length ? CONSTANTS.roomSharingModes()[i] : null);
if (mode == null || mode.isEmpty()) break;
response.addMode(new RoomInterface.RoomSharingDisplayMode(mode));
}
boolean filterDepartments = context.getUser() != null && !context.getUser().getCurrentAuthority().hasRight(Right.DepartmentIndependent);
boolean includeGlobalGroups = context.getUser() != null && context.getUser().getCurrentAuthority().hasRight(Right.RoomEditGlobalGroups);
boolean includeDeptGroups = context.getUser() != null && context.getUser().getCurrentAuthority().hasRight(Right.RoomEditGroups);
for (RoomGroup g: RoomGroup.getAllRoomGroupsForSession(context.getUser().getCurrentAcademicSessionId())) {
GroupInterface group = new GroupInterface(g.getUniqueId(), g.getAbbv(), g.getName());
if (g.getDepartment() != null) {
if (!includeDeptGroups) continue;
if (filterDepartments && !context.getUser().getCurrentAuthority().hasQualifier(g.getDepartment())) continue;
group.setDepartment(response.getDepartment(g.getDepartment().getUniqueId()));
group.setTitle((g.getDescription() == null || g.getDescription().isEmpty() ? g.getName() : g.getDescription()) + " (" + g.getDepartment().getName() + ")");
} else {
if (!includeGlobalGroups) continue;
group.setTitle((g.getDescription() == null || g.getDescription().isEmpty() ? g.getName() : g.getDescription()));
}
response.addGroup(group);
}
if (context.getUser() != null && context.getUser().getCurrentAuthority().hasRight(Right.RoomEditGlobalFeatures)) {
for (GlobalRoomFeature f: RoomFeature.getAllGlobalRoomFeatures(context.getUser().getCurrentAcademicSessionId())) {
FeatureInterface feature = new FeatureInterface(f.getUniqueId(), f.getAbbv(), f.getLabel());
if (f.getFeatureType() != null)
feature.setType(response.getFeatureType(f.getFeatureType().getUniqueId()));
feature.setTitle((f.getDescription() == null || f.getDescription().isEmpty() ? f.getLabel() : f.getDescription()));
response.addFeature(feature);
}
}
if (context.getUser() != null && context.getUser().getCurrentAuthority().hasRight(Right.RoomEditFeatures)) {
for (DepartmentRoomFeature f: RoomFeature.getAllDepartmentRoomFeaturesInSession(context.getUser().getCurrentAcademicSessionId())) {
if (filterDepartments && !context.getUser().getCurrentAuthority().hasQualifier(f.getDepartment())) continue;
FeatureInterface feature = new FeatureInterface(f.getUniqueId(), f.getAbbv(), f.getLabel());
if (f.getFeatureType() != null)
feature.setType(new FeatureTypeInterface(f.getFeatureType().getUniqueId(), f.getFeatureType().getReference(), f.getFeatureType().getLabel(), f.getFeatureType().isShowInEventManagement()));
feature.setDepartment(response.getDepartment(f.getDepartment().getUniqueId()));
feature.setTitle((f.getDescription() == null || f.getDescription().isEmpty() ? f.getLabel() : f.getDescription()) + " (" + f.getDepartment().getName() + ")");
feature.setDescription(f.getDescription());
response.addFeature(feature);
}
}
for (PreferenceLevel pref: PreferenceLevel.getPreferenceLevelList(false)) {
response.addPreference(new PreferenceInterface(pref.getUniqueId(), PreferenceLevel.prolog2bgColor(pref.getPrefProlog()), pref.getPrefProlog(), pref.getPrefName(), pref.getAbbreviation(), true));
}
for (AttachmentType type: AttachmentType.listTypes(AttachmentType.VisibilityFlag.ROOM_PICTURE_TYPE)) {
response.addPictureType(RoomPicturesBackend.getPictureType(type));
}
if (request.hasSessionId()) {
for (EventServiceProvider p: EventServiceProvider.findAll(request.getSessionId())) {
if (p.isAllRooms()) continue;
EventServiceProviderInterface provider = new EventServiceProviderInterface();
provider.setId(p.getUniqueId());
provider.setReference(p.getReference());
provider.setLabel(p.getLabel());
provider.setMessage(p.getNote());
provider.setEmail(p.getEmail());
if (p.getDepartment() != null)
provider.setDepartmentId(p.getDepartment().getUniqueId());
response.addEventServiceProvider(provider);
}
}
DistanceMetric.Ellipsoid ellipsoid = DistanceMetric.Ellipsoid.valueOf(ApplicationProperty.DistanceEllipsoid.value());
response.setEllipsoid(ellipsoid.getEclipsoindName());
response.setGoogleMap(ApplicationProperty.RoomUseGoogleMap.isTrue());
response.setGoogleMapApiKey(ApplicationProperty.GoogleMapsApiKey.value());
response.setLeafletMap(!response.isGoogleMap() && ApplicationProperty.RoomUseLeafletMap.isTrue());
response.setLeafletMapTiles(ApplicationProperty.RoomCacheLeafletMapTiles.isTrue() ? "maps?tile={z},{x},{y}" : ApplicationProperty.RoomUseLeafletMapTiles.value());
response.setLeafletMapAttribution(ApplicationProperty.RoomUseLeafletMapAttribution.value());
if (response.getAcademicSession() != null) {
for (Session session: SessionDAO.getInstance().getSession().createQuery(
"select f from Session f, Session s where " +
"s.uniqueId = :sessionId and s.sessionBeginDateTime < f.sessionBeginDateTime and s.academicInitiative = f.academicInitiative " +
"order by f.sessionBeginDateTime", Session.class)
.setParameter("sessionId", response.getAcademicSessionId()).list()) {
AcademicSessionInterface s = new AcademicSessionInterface(session.getUniqueId(), session.getAcademicTerm() + " " + session.getAcademicYear());
EventContext cx = new EventContext(context, context.getUser(), session.getUniqueId());
s.setCanAddRoom(cx.hasPermission(Right.AddRoom));
s.setCanAddNonUniversity(cx.hasPermission(Right.AddNonUnivLocation));
s.setCanAddGlobalRoomGroup(cx.hasPermission(Right.GlobalRoomGroupAdd));
s.setCanAddDepartmentalRoomGroup(cx.hasPermission(Right.DepartmentRoomGroupAdd));
s.setCanAddGlobalRoomFeature(cx.hasPermission(Right.GlobalRoomFeatureAdd));
s.setCanAddDepartmentalRoomFeature(cx.hasPermission(Right.DepartmentRoomFeatureAdd));
if (s.isCanAddRoom() || s.isCanAddNonUniversity())
response.addFutureSession(s);
}
}
response.setRoomAreaInMetricUnits(ApplicationProperty.RoomAreaUnitsMetric.isTrue());
response.setCanSaveFilterDefaults(context.hasPermission(Right.HasRole));
if (context.isAuthenticated() && response.isCanSaveFilterDefaults() && request.hasMode()) {
response.setFilterDefault("filter", context.getUser().getProperty("Default[" + request.getMode() + ".filter]"));
} else if (request.hasMode()) {
response.setFilterDefault("filter", "EVENTS".equalsIgnoreCase(request.getMode()) ? "flag:Event" : "");
}
return response;
}
}
| [
"muller@unitime.org"
] | muller@unitime.org |
0fdf44ba94655a988777f9bfafb27884e09417f2 | 8dbedcaf71484ced9ee7177fe5b284bbda2c4671 | /bible-dao/src/main/java/com/moon/bible/dto/tweettopic/TweetTopicAndDetails.java | b0ee2d88922f3d4b97dd2bdb1c058cdcc0a1b9ad | [] | no_license | SpiritZc/bible | 9e5cc53a0971ea9c9b4e40999bf35656bddf57b8 | ffc501c7fae6eae9f06882b7c67f2c584e85ad20 | refs/heads/master | 2022-12-17T16:57:15.559238 | 2020-09-12T10:52:09 | 2020-09-12T10:52:09 | 277,579,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package com.moon.bible.dto.tweettopic;
import com.moon.bible.entity.tcategory.TCategory;
import com.moon.bible.entity.tweetdetails.TweetDetails;
import com.moon.bible.entity.tweettopic.TweetTopic;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @ClassName : TCategoryAndDtails //类名
* @Description : 发现分类带详情 //描述
* @Author : HTB //作者
* @Date: 2020-08-30 13:38 //时间
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TweetTopicAndDetails extends TweetTopic {
private List<TweetDetails> tweetDetails;//推文详情
}
| [
"1297770856@qq.com"
] | 1297770856@qq.com |
033d79f437de59934f07cb53ab20d175ae81fe23 | be3b25f2ca47b983a84ea742ee22dc1f1296e5b2 | /src/main/java/com/scaleup/notesharing/repositores/BookInstanceRepository.java | d51b60a183be664e1a7392c9d7ecb1aba977ce46 | [] | no_license | sarangbagade/notesharing | 6b7c459804ac7d6cbf906e6bb6677577a9f0e102 | 4e8cf91edd734ac799d600eb6415ce189d6d8c85 | refs/heads/master | 2023-05-30T00:52:43.571443 | 2020-09-27T13:25:23 | 2020-09-27T13:25:23 | 266,784,513 | 0 | 1 | null | 2021-06-04T22:11:22 | 2020-05-25T13:20:13 | HTML | UTF-8 | Java | false | false | 310 | java | package com.scaleup.notesharing.repositores;
import com.scaleup.notesharing.models.BookInstance;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface BookInstanceRepository extends JpaRepository<BookInstance, Long> {
}
| [
"sarangbagade@Sarangs-MacBook-Pro.local"
] | sarangbagade@Sarangs-MacBook-Pro.local |
8230d41e0a55931096fccd96bfcba76af020c94d | 2262dd0ed1c109c884b8166a4cf0de674d113642 | /xulux/src/java/org/xulux/utils/StringUtils.java | ebd449238299462fff56733d0e9a5634ffb226d8 | [
"Apache-2.0"
] | permissive | codehaus/xulux | 9d0bc6b49a04aa77f52bf6fd2fa91a371d2768f3 | 957193dc98b20583afaef93e73c23afc475386df | refs/heads/master | 2023-07-20T00:29:03.313892 | 2005-05-14T11:38:32 | 2005-05-14T11:38:32 | 36,225,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,266 | java | /*
$Id: StringUtils.java,v 1.2 2004-10-18 14:10:47 mvdb Exp $
Copyright 2002-2004 The Xulux Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.xulux.utils;
/**
* @author <a href="mailto:martin@mvdb.net">Martin van den Bemt</a>
* @version $Id: StringUtils.java,v 1.2 2004-10-18 14:10:47 mvdb Exp $
*/
public class StringUtils {
/**
* Replace the specified string with the specified char
*
* @param value the value to do the magic on
* @param replace the value to replace
* @param c the char to replace it with
* @return a new string with replacements
*/
public static String replace(String value, String replace, char c) {
if (value.indexOf(replace) == -1) {
return value;
}
StringBuffer sb = new StringBuffer();
for (int i = 0; i < value.length(); i++) {
boolean replaceIt = false;
for (int j = 0; j < replace.length(); j++) {
if (value.charAt(i+j) == replace.charAt(j)) {
replaceIt = true;
} else {
replaceIt = false;
break;
}
}
if (replaceIt) {
sb.append(c);
i+=replace.length()-1;
} else {
sb.append(value.charAt(i));
}
}
return sb.toString();
}
/**
* Capitalizes a string, which means the first character
* will be uppercase and the other characters will be lowercase.
* @param constraint
*/
public static String capitalize(String constraint) {
if (constraint == null || constraint.length() == 0) {
return constraint;
}
constraint = constraint.toLowerCase();
StringBuffer buffer = new StringBuffer();
buffer.append(Character.toUpperCase(constraint.charAt(0)));
buffer.append(constraint.substring(1));
return buffer.toString();
}
}
| [
"mvdb@cee8c64b-ab72-0410-a008-e88fd0df2434"
] | mvdb@cee8c64b-ab72-0410-a008-e88fd0df2434 |
5bde62f391206b7c41ba24a4ac0bb3011caee29f | b5495b0cb34e373830c7b259eeab85933590adee | /src/main/java/com/endpoints/Resources_GetAppointments.java | ce448e45f7cc4709f699bddfbe6c348c98d57517 | [] | no_license | satishrsgp/API-Project | f85c620a0299acd8b7fbff2f34696728d81659d7 | 2dc7f9be303db3ab89509f143b2f491bd3002ebe | refs/heads/master | 2021-04-27T00:12:28.429500 | 2018-10-20T15:53:17 | 2018-10-20T15:53:17 | 123,770,708 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,708 | java | //This needs to deleted. Not a valid class
package com.endpoints;
import java.util.ArrayList;
import org.testng.asserts.SoftAssert;
import com.testscripts.BaseTest;
import com.utils.DatabaseConnection;
import com.utils.FinalAssertions;
import com.utils.JsonListArray;
import com.utils.Log;
public class Resources_GetAppointments
{
public static Boolean Resources_GetAppointments_Test(String strResponse, String strUniqueJsonToken, SoftAssert softAssert)
{
Boolean status=false;
try
{
String strQuery =null;
if(strResponse.contains("$skip=25"))
{
strQuery= "select top 25 message_id as id, description as messageDescription,alerttype_id as alertTypeId,case when delete_ind='N' then 'false' else 'true' end as isDeleted from ehr_alerts_mstr order by message_id";
}
else
{
strQuery= "select message_id as id, description as messageDescription,alerttype_id as alertTypeId,case when delete_ind='N' then 'false' else 'true' end as isDeleted from ehr_alerts_mstr order by message_id";
}
String[] jsonMetaData = {"id","messageDescription","alertTypeId","isDeleted"};
try
{
ArrayList<Object> jsonList = JsonListArray.computeJsonList(jsonMetaData, strResponse, strUniqueJsonToken);
Log.info("JSON LIST is :\n" + jsonList);
status = FinalAssertions.assertResponseCount(DatabaseConnection.statementExecution(BaseTest.connNGA, strQuery), strResponse, "$..id", jsonList);
}
catch (Exception e)
{
e.printStackTrace();
Log.info("Error in Test Class and the detail are : \n" + e.getMessage());
softAssert.fail("Error in Test Script please look at logs");
}
}
catch(Exception e)
{
e.printStackTrace();
}
return status;
}
} | [
"satishrsgp@gmail.com"
] | satishrsgp@gmail.com |
96d216105758bae43d9613ad038635fccdd4e8d7 | 7701d552e365428198021f53eb82006cfe29df3b | /java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamToLoop/afterToArrayTypeMismatch.java | 997c7d4354f55521bfe0cdb7976c81916f1aa354 | [
"Apache-2.0"
] | permissive | aabb667/intellij-community | 876743e4b739af6e0f8bc40ef41e0d06d33c1a9b | 8719a0be53e26773584ae00b1c3558ad2f54aae6 | refs/heads/master | 2021-01-12T09:16:06.056172 | 2016-12-18T17:34:27 | 2016-12-18T17:41:51 | 76,807,010 | 1 | 0 | null | 2016-12-18T21:13:01 | 2016-12-18T21:13:01 | null | UTF-8 | Java | false | false | 563 | java | // "Replace Stream API chain with loop" "true"
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
public class Main {
private static Number[] test(Object[] objects) {
List<Object> list = new ArrayList<>();
for (Object object : objects) {
if (Number.class.isInstance(object)) {
list.add(object);
}
}
return list.toArray(new Number[0]);
}
public static void main(String[] args) {
System.out.println(Arrays.asList(test(new Object[]{1, 2, 3, "string", 4})));
}
} | [
"Tagir.Valeev@jetbrains.com"
] | Tagir.Valeev@jetbrains.com |
f758c0c6e10ed1d8262132b6866ef3e513d932c9 | d47ff33323288af0368404a47d410c7f4caa4ea4 | /cobox_project/cobox/src/main/java/com/koreait/cobox/model/domain/Movie.java | 94f80dc0e1df33d9a3a44d3bf13c288202c5f1b9 | [] | no_license | RAMA4368/CoBox | 72a0522e61cfcec90a1f99defd8b9e7311fc7c9a | 455ed79908dba8bec28be631e14c02fc1fd9b8b0 | refs/heads/master | 2023-03-01T21:57:47.197475 | 2021-02-10T00:51:32 | 2021-02-10T00:51:32 | 335,285,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package com.koreait.cobox.model.domain;
import java.util.List;
import org.springframework.web.multipart.MultipartFile;
import lombok.Data;
@Data
public class Movie {
private int movie_id;
private String movie_name;
private int rating_id;
private String director;
private String actor;
private String release;
private String story;
private String poster;//.png
//이미지 처리
private MultipartFile repImg;
//insert
private Genre[] genre;
//rating 의 name값가져오기
private Rating rating;
//조인
private List<Genre> genreList;
}
| [
"ksooyeun@naver.com"
] | ksooyeun@naver.com |
58631f8a9c6f4ccefa8a9d3a00c107a930ec1486 | 4b5abde75a6daab68699a9de89945d8bf583e1d0 | /app-release-unsigned/sources/i/s/b/q.java | 58e5fb6fa88233575bd599f45ae31bc1b3fe6d8e | [] | no_license | agustrinaldokurniawan/News_Android_Kotlin_Mobile_Apps | 95d270d4fa2a47f599204477cb25bae7bee6e030 | a1f2e186970cef9043458563437b9c691725bcb5 | refs/heads/main | 2023-07-03T01:03:22.307300 | 2021-08-08T10:47:00 | 2021-08-08T10:47:00 | 375,330,796 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java | package i.s.b;
import i.a;
public interface q<P1, P2, P3, R> extends a<R> {
R j(P1 p1, P2 p2, P3 p3);
}
| [
"agust.kurniawan@Agust-Rinaldo-Kurniawan.local"
] | agust.kurniawan@Agust-Rinaldo-Kurniawan.local |
ba2ed1483679a71cabd553472fef3aff087e270c | 2aa01a52011be9025ffac05e2327a282af3cc88a | /spring-integration-endpoint/src/main/java/com/test/spring/SpringIntegrationEndpointApplication.java | 12004596f46f6e131cd28b5ea97aff3549ba9fd8 | [] | no_license | vinodhkumarg/spring-integration | 65bc21204883e757920d0bcdd89d5b7e3b3d13e9 | 7c4d8b3085a37b88b81d1f3a36a0048ef3ad0c21 | refs/heads/master | 2020-04-11T05:04:43.249546 | 2018-12-20T06:08:39 | 2018-12-20T06:08:39 | 159,646,102 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,064 | java | package com.test.spring;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.MessagingException;
@SpringBootApplication
@Configuration
@ImportResource("integration-context.xml")
public class SpringIntegrationEndpointApplication implements ApplicationRunner {
@Autowired
@Qualifier("inputChannel")
DirectChannel inputChannel;
@Autowired
@Qualifier("outputChannel")
DirectChannel outputChannel;
public static void main(String[] args) {
SpringApplication.run(SpringIntegrationEndpointApplication.class, args);
}
@Override
public void run(ApplicationArguments args) throws Exception {
// Register a message handler
outputChannel.subscribe(new MessageHandler() {
@Override
public void handleMessage(Message<?> message) throws MessagingException {
// create a service & invoke a print method
System.out.println(message.getPayload());
}
});
//java8 lambda
// channel.subscribe((message)->{
// new PrintService().print((Message<String>) message);
// });
// message with message builder
Message<String> message1 = MessageBuilder.withPayload("Spring Integration message from channel").setHeader("foo", "bar").build();
// send the message to service component
inputChannel.send(message1);
}
}
| [
"icuE@1234"
] | icuE@1234 |
14294fda010a947b2fdd77616cd79f8dd30abdff | 2dfd5c45b0a956f10db40b961358e71a9b985df4 | /app/src/main/java/com/waterdrop/k/waterdrop/DataBase/MyRegion.java | d996bc697943ab20660c0e59f26a8fda6be44ba9 | [] | no_license | Ko-donghyun/water-drop | 65ee6930d857b1df2818a1a6c875ab9f30727ddf | 89acd0128c4301454f8c2d5b5b92136e8ec1d53f | refs/heads/master | 2021-01-21T10:16:05.048070 | 2017-09-03T04:18:08 | 2017-09-03T04:18:08 | 101,976,389 | 0 | 0 | null | 2017-09-02T00:10:04 | 2017-08-31T08:10:15 | Java | UTF-8 | Java | false | false | 1,032 | java | package com.waterdrop.k.waterdrop.DataBase;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class MyRegion extends SQLiteOpenHelper {
public MyRegion(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase database) {
// 테이블 생성
database.execSQL("CREATE TABLE myregion (_id INTEGER PRIMARY KEY AUTOINCREMENT, city1 TEXT, city2 TEXT, city3 TEXT);");
database.execSQL("INSERT INTO myregion VALUES(null, '제주특별자치도', '서귀포시', '남원읍');");
database.execSQL("INSERT INTO myregion VALUES(null, '부산광역시', '금정구', '장전3동');");
}
@Override
public void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
database.execSQL("DROP TABLE IF EXISTS myregion");
onCreate(database);
}
} | [
"kodonghyun1209@gmail.com"
] | kodonghyun1209@gmail.com |
1eb3afe142fa275233df8e877e7d40616910218d | 2905ceb9655cff213e99e538c7338a4fa8bd0dc2 | /app/src/test/java/com/example/machathon/ExampleUnitTest.java | 031684eef6a59dea631f82cfae2623a4e49e0dde | [] | no_license | MriganshiSharma/Machathon | 1f2e978c22fc7715b21080440a0d74ca319fdd94 | 08992f6920ee623ffbb89728f45e06068572acdf | refs/heads/master | 2020-05-18T06:09:51.556126 | 2019-05-06T16:02:11 | 2019-05-06T16:02:11 | 184,227,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.example.machathon;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"50135997+MriganshiSharma@users.noreply.github.com"
] | 50135997+MriganshiSharma@users.noreply.github.com |
5845ee727ad3d28f83c2ecebdbe51d76faf71cdb | 29ac3ec99471d27aea0838d35c0979d31768e24b | /clients/google-api-services-servicenetworking/v1/1.30.1/com/google/api/services/servicenetworking/v1/ServiceNetworking.java | 74f8758542273ce170b574e6fe268e51c2325873 | [
"Apache-2.0"
] | permissive | chrislatimer/google-api-java-client-services | 8d8f8ff22e2c4866100b447e621aba4a17f5eba3 | 4044138392b3a29018b60ca622d27c07410569b2 | refs/heads/master | 2020-12-24T03:15:02.714672 | 2020-01-30T18:18:13 | 2020-01-30T18:18:13 | 237,362,140 | 0 | 1 | Apache-2.0 | 2020-01-31T04:48:38 | 2020-01-31T04:48:37 | null | UTF-8 | Java | false | false | 93,574 | java | /*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.servicenetworking.v1;
/**
* Service definition for ServiceNetworking (v1).
*
* <p>
* Provides automatic management of network configurations necessary for certain services.
* </p>
*
* <p>
* For more information about this service, see the
* <a href="https://cloud.google.com/service-infrastructure/docs/service-networking/getting-started" target="_blank">API Documentation</a>
* </p>
*
* <p>
* This service uses {@link ServiceNetworkingRequestInitializer} to initialize global parameters via its
* {@link Builder}.
* </p>
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class ServiceNetworking extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
com.google.api.client.util.Preconditions.checkState(
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.15 of google-api-client to run version " +
"1.30.3 of the Service Networking API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
}
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://servicenetworking.googleapis.com/";
/**
* The default encoded service path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_SERVICE_PATH = "";
/**
* The default encoded batch path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.23
*/
public static final String DEFAULT_BATCH_PATH = "batch";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
*/
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
* <p>
* Use {@link Builder} if you need to specify any of the optional parameters.
* </p>
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public ServiceNetworking(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
this(new Builder(transport, jsonFactory, httpRequestInitializer));
}
/**
* @param builder builder
*/
ServiceNetworking(Builder builder) {
super(builder);
}
@Override
protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest<?> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* An accessor for creating requests from the Operations collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code ServiceNetworking servicenetworking = new ServiceNetworking(...);}
* {@code ServiceNetworking.Operations.List request = servicenetworking.operations().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Operations operations() {
return new Operations();
}
/**
* The "operations" collection of methods.
*/
public class Operations {
/**
* Starts asynchronous cancellation on a long-running operation. The server makes a best effort to
* cancel the operation, but success is not guaranteed. If the server doesn't support this method,
* it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other
* methods to check whether the cancellation succeeded or whether the operation completed despite
* cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an
* operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to
* `Code.CANCELLED`.
*
* Create a request for the method "operations.cancel".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link Cancel#execute()} method to invoke the remote operation.
*
* @param name The name of the operation resource to be cancelled.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.CancelOperationRequest}
* @return the request
*/
public Cancel cancel(java.lang.String name, com.google.api.services.servicenetworking.v1.model.CancelOperationRequest content) throws java.io.IOException {
Cancel result = new Cancel(name, content);
initialize(result);
return result;
}
public class Cancel extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Empty> {
private static final String REST_PATH = "v1/{+name}:cancel";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^operations/.+$");
/**
* Starts asynchronous cancellation on a long-running operation. The server makes a best effort
* to cancel the operation, but success is not guaranteed. If the server doesn't support this
* method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
* other methods to check whether the cancellation succeeded or whether the operation completed
* despite cancellation. On successful cancellation, the operation is not deleted; instead, it
* becomes an operation with an Operation.error value with a google.rpc.Status.code of 1,
* corresponding to `Code.CANCELLED`.
*
* Create a request for the method "operations.cancel".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link Cancel#execute()} method to invoke the remote
* operation. <p> {@link
* Cancel#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param name The name of the operation resource to be cancelled.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.CancelOperationRequest}
* @since 1.13
*/
protected Cancel(java.lang.String name, com.google.api.services.servicenetworking.v1.model.CancelOperationRequest content) {
super(ServiceNetworking.this, "POST", REST_PATH, content, com.google.api.services.servicenetworking.v1.model.Empty.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^operations/.+$");
}
}
@Override
public Cancel set$Xgafv(java.lang.String $Xgafv) {
return (Cancel) super.set$Xgafv($Xgafv);
}
@Override
public Cancel setAccessToken(java.lang.String accessToken) {
return (Cancel) super.setAccessToken(accessToken);
}
@Override
public Cancel setAlt(java.lang.String alt) {
return (Cancel) super.setAlt(alt);
}
@Override
public Cancel setCallback(java.lang.String callback) {
return (Cancel) super.setCallback(callback);
}
@Override
public Cancel setFields(java.lang.String fields) {
return (Cancel) super.setFields(fields);
}
@Override
public Cancel setKey(java.lang.String key) {
return (Cancel) super.setKey(key);
}
@Override
public Cancel setOauthToken(java.lang.String oauthToken) {
return (Cancel) super.setOauthToken(oauthToken);
}
@Override
public Cancel setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Cancel) super.setPrettyPrint(prettyPrint);
}
@Override
public Cancel setQuotaUser(java.lang.String quotaUser) {
return (Cancel) super.setQuotaUser(quotaUser);
}
@Override
public Cancel setUploadType(java.lang.String uploadType) {
return (Cancel) super.setUploadType(uploadType);
}
@Override
public Cancel setUploadProtocol(java.lang.String uploadProtocol) {
return (Cancel) super.setUploadProtocol(uploadProtocol);
}
/** The name of the operation resource to be cancelled. */
@com.google.api.client.util.Key
private java.lang.String name;
/** The name of the operation resource to be cancelled.
*/
public java.lang.String getName() {
return name;
}
/** The name of the operation resource to be cancelled. */
public Cancel setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^operations/.+$");
}
this.name = name;
return this;
}
@Override
public Cancel set(String parameterName, Object value) {
return (Cancel) super.set(parameterName, value);
}
}
/**
* Deletes a long-running operation. This method indicates that the client is no longer interested
* in the operation result. It does not cancel the operation. If the server doesn't support this
* method, it returns `google.rpc.Code.UNIMPLEMENTED`.
*
* Create a request for the method "operations.delete".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param name The name of the operation resource to be deleted.
* @return the request
*/
public Delete delete(java.lang.String name) throws java.io.IOException {
Delete result = new Delete(name);
initialize(result);
return result;
}
public class Delete extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Empty> {
private static final String REST_PATH = "v1/{+name}";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^operations/.+$");
/**
* Deletes a long-running operation. This method indicates that the client is no longer interested
* in the operation result. It does not cancel the operation. If the server doesn't support this
* method, it returns `google.rpc.Code.UNIMPLEMENTED`.
*
* Create a request for the method "operations.delete".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link Delete#execute()} method to invoke the remote
* operation. <p> {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param name The name of the operation resource to be deleted.
* @since 1.13
*/
protected Delete(java.lang.String name) {
super(ServiceNetworking.this, "DELETE", REST_PATH, null, com.google.api.services.servicenetworking.v1.model.Empty.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^operations/.+$");
}
}
@Override
public Delete set$Xgafv(java.lang.String $Xgafv) {
return (Delete) super.set$Xgafv($Xgafv);
}
@Override
public Delete setAccessToken(java.lang.String accessToken) {
return (Delete) super.setAccessToken(accessToken);
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setCallback(java.lang.String callback) {
return (Delete) super.setCallback(callback);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUploadType(java.lang.String uploadType) {
return (Delete) super.setUploadType(uploadType);
}
@Override
public Delete setUploadProtocol(java.lang.String uploadProtocol) {
return (Delete) super.setUploadProtocol(uploadProtocol);
}
/** The name of the operation resource to be deleted. */
@com.google.api.client.util.Key
private java.lang.String name;
/** The name of the operation resource to be deleted.
*/
public java.lang.String getName() {
return name;
}
/** The name of the operation resource to be deleted. */
public Delete setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^operations/.+$");
}
this.name = name;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Gets the latest state of a long-running operation. Clients can use this method to poll the
* operation result at intervals as recommended by the API service.
*
* Create a request for the method "operations.get".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param name The name of the operation resource.
* @return the request
*/
public Get get(java.lang.String name) throws java.io.IOException {
Get result = new Get(name);
initialize(result);
return result;
}
public class Get extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Operation> {
private static final String REST_PATH = "v1/{+name}";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^operations/[^/]+$");
/**
* Gets the latest state of a long-running operation. Clients can use this method to poll the
* operation result at intervals as recommended by the API service.
*
* Create a request for the method "operations.get".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link Get#execute()} method to invoke the remote operation.
* <p> {@link
* Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must be
* called to initialize this instance immediately after invoking the constructor. </p>
*
* @param name The name of the operation resource.
* @since 1.13
*/
protected Get(java.lang.String name) {
super(ServiceNetworking.this, "GET", REST_PATH, null, com.google.api.services.servicenetworking.v1.model.Operation.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^operations/[^/]+$");
}
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get set$Xgafv(java.lang.String $Xgafv) {
return (Get) super.set$Xgafv($Xgafv);
}
@Override
public Get setAccessToken(java.lang.String accessToken) {
return (Get) super.setAccessToken(accessToken);
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setCallback(java.lang.String callback) {
return (Get) super.setCallback(callback);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUploadType(java.lang.String uploadType) {
return (Get) super.setUploadType(uploadType);
}
@Override
public Get setUploadProtocol(java.lang.String uploadProtocol) {
return (Get) super.setUploadProtocol(uploadProtocol);
}
/** The name of the operation resource. */
@com.google.api.client.util.Key
private java.lang.String name;
/** The name of the operation resource.
*/
public java.lang.String getName() {
return name;
}
/** The name of the operation resource. */
public Get setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^operations/[^/]+$");
}
this.name = name;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Lists operations that match the specified filter in the request. If the server doesn't support
* this method, it returns `UNIMPLEMENTED`.
*
* NOTE: the `name` binding allows API services to override the binding to use different resource
* name schemes, such as `users/operations`. To override the binding, API services can add a binding
* such as `"/v1/{name=users}/operations"` to their service configuration. For backwards
* compatibility, the default name includes the operations collection id, however overriding users
* must ensure the name binding is the parent resource, without the operations collection id.
*
* Create a request for the method "operations.list".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param name The name of the operation's parent resource.
* @return the request
*/
public List list(java.lang.String name) throws java.io.IOException {
List result = new List(name);
initialize(result);
return result;
}
public class List extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.ListOperationsResponse> {
private static final String REST_PATH = "v1/{+name}";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^operations$");
/**
* Lists operations that match the specified filter in the request. If the server doesn't support
* this method, it returns `UNIMPLEMENTED`.
*
* NOTE: the `name` binding allows API services to override the binding to use different resource
* name schemes, such as `users/operations`. To override the binding, API services can add a
* binding such as `"/v1/{name=users}/operations"` to their service configuration. For backwards
* compatibility, the default name includes the operations collection id, however overriding users
* must ensure the name binding is the parent resource, without the operations collection id.
*
* Create a request for the method "operations.list".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* <p> {@link
* List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must be
* called to initialize this instance immediately after invoking the constructor. </p>
*
* @param name The name of the operation's parent resource.
* @since 1.13
*/
protected List(java.lang.String name) {
super(ServiceNetworking.this, "GET", REST_PATH, null, com.google.api.services.servicenetworking.v1.model.ListOperationsResponse.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^operations$");
}
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List set$Xgafv(java.lang.String $Xgafv) {
return (List) super.set$Xgafv($Xgafv);
}
@Override
public List setAccessToken(java.lang.String accessToken) {
return (List) super.setAccessToken(accessToken);
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setCallback(java.lang.String callback) {
return (List) super.setCallback(callback);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUploadType(java.lang.String uploadType) {
return (List) super.setUploadType(uploadType);
}
@Override
public List setUploadProtocol(java.lang.String uploadProtocol) {
return (List) super.setUploadProtocol(uploadProtocol);
}
/** The name of the operation's parent resource. */
@com.google.api.client.util.Key
private java.lang.String name;
/** The name of the operation's parent resource.
*/
public java.lang.String getName() {
return name;
}
/** The name of the operation's parent resource. */
public List setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^operations$");
}
this.name = name;
return this;
}
/** The standard list filter. */
@com.google.api.client.util.Key
private java.lang.String filter;
/** The standard list filter.
*/
public java.lang.String getFilter() {
return filter;
}
/** The standard list filter. */
public List setFilter(java.lang.String filter) {
this.filter = filter;
return this;
}
/** The standard list page size. */
@com.google.api.client.util.Key
private java.lang.Integer pageSize;
/** The standard list page size.
*/
public java.lang.Integer getPageSize() {
return pageSize;
}
/** The standard list page size. */
public List setPageSize(java.lang.Integer pageSize) {
this.pageSize = pageSize;
return this;
}
/** The standard list page token. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** The standard list page token.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** The standard list page token. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
}
/**
* An accessor for creating requests from the Services collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code ServiceNetworking servicenetworking = new ServiceNetworking(...);}
* {@code ServiceNetworking.Services.List request = servicenetworking.services().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Services services() {
return new Services();
}
/**
* The "services" collection of methods.
*/
public class Services {
/**
* For service producers, provisions a new subnet in a peered service's shared VPC network in the
* requested region and with the requested size that's expressed as a CIDR range (number of leading
* bits of ipV4 network mask). The method checks against the assigned allocated ranges to find a
* non-conflicting IP address range. The method will reuse a subnet if subsequent calls contain the
* same subnet name, region, and prefix length. This method will make producer's tenant project to
* be a shared VPC service project as needed. The response from the `get` operation will be of type
* `Subnetwork` if the operation successfully completes.
*
* Create a request for the method "services.addSubnetwork".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link AddSubnetwork#execute()} method to invoke the remote
* operation.
*
* @param parent Required. A tenant project in the service producer organization, in the
following format:
* services/{service}/{collection-id}/{resource-id}.
{collection-id} is the cloud resource
* collection type that represents the
tenant project. Only `projects` are supported.
* {resource-id} is the tenant project numeric id, such as
`123456`. {service} the name of
* the peering service, such as
`service-peering.example.com`. This service must already be
* enabled in the service consumer's project.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.AddSubnetworkRequest}
* @return the request
*/
public AddSubnetwork addSubnetwork(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.AddSubnetworkRequest content) throws java.io.IOException {
AddSubnetwork result = new AddSubnetwork(parent, content);
initialize(result);
return result;
}
public class AddSubnetwork extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Operation> {
private static final String REST_PATH = "v1/{+parent}:addSubnetwork";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^services/[^/]+/[^/]+/[^/]+$");
/**
* For service producers, provisions a new subnet in a peered service's shared VPC network in the
* requested region and with the requested size that's expressed as a CIDR range (number of
* leading bits of ipV4 network mask). The method checks against the assigned allocated ranges to
* find a non-conflicting IP address range. The method will reuse a subnet if subsequent calls
* contain the same subnet name, region, and prefix length. This method will make producer's
* tenant project to be a shared VPC service project as needed. The response from the `get`
* operation will be of type `Subnetwork` if the operation successfully completes.
*
* Create a request for the method "services.addSubnetwork".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link AddSubnetwork#execute()} method to invoke the remote
* operation. <p> {@link AddSubnetwork#initialize(com.google.api.client.googleapis.services.Abstra
* ctGoogleClientRequest)} must be called to initialize this instance immediately after invoking
* the constructor. </p>
*
* @param parent Required. A tenant project in the service producer organization, in the
following format:
* services/{service}/{collection-id}/{resource-id}.
{collection-id} is the cloud resource
* collection type that represents the
tenant project. Only `projects` are supported.
* {resource-id} is the tenant project numeric id, such as
`123456`. {service} the name of
* the peering service, such as
`service-peering.example.com`. This service must already be
* enabled in the service consumer's project.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.AddSubnetworkRequest}
* @since 1.13
*/
protected AddSubnetwork(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.AddSubnetworkRequest content) {
super(ServiceNetworking.this, "POST", REST_PATH, content, com.google.api.services.servicenetworking.v1.model.Operation.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+/[^/]+/[^/]+$");
}
}
@Override
public AddSubnetwork set$Xgafv(java.lang.String $Xgafv) {
return (AddSubnetwork) super.set$Xgafv($Xgafv);
}
@Override
public AddSubnetwork setAccessToken(java.lang.String accessToken) {
return (AddSubnetwork) super.setAccessToken(accessToken);
}
@Override
public AddSubnetwork setAlt(java.lang.String alt) {
return (AddSubnetwork) super.setAlt(alt);
}
@Override
public AddSubnetwork setCallback(java.lang.String callback) {
return (AddSubnetwork) super.setCallback(callback);
}
@Override
public AddSubnetwork setFields(java.lang.String fields) {
return (AddSubnetwork) super.setFields(fields);
}
@Override
public AddSubnetwork setKey(java.lang.String key) {
return (AddSubnetwork) super.setKey(key);
}
@Override
public AddSubnetwork setOauthToken(java.lang.String oauthToken) {
return (AddSubnetwork) super.setOauthToken(oauthToken);
}
@Override
public AddSubnetwork setPrettyPrint(java.lang.Boolean prettyPrint) {
return (AddSubnetwork) super.setPrettyPrint(prettyPrint);
}
@Override
public AddSubnetwork setQuotaUser(java.lang.String quotaUser) {
return (AddSubnetwork) super.setQuotaUser(quotaUser);
}
@Override
public AddSubnetwork setUploadType(java.lang.String uploadType) {
return (AddSubnetwork) super.setUploadType(uploadType);
}
@Override
public AddSubnetwork setUploadProtocol(java.lang.String uploadProtocol) {
return (AddSubnetwork) super.setUploadProtocol(uploadProtocol);
}
/**
* Required. A tenant project in the service producer organization, in the following format:
* services/{service}/{collection-id}/{resource-id}. {collection-id} is the cloud resource
* collection type that represents the tenant project. Only `projects` are supported.
* {resource-id} is the tenant project numeric id, such as `123456`. {service} the name of the
* peering service, such as `service-peering.example.com`. This service must already be
* enabled in the service consumer's project.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** Required. A tenant project in the service producer organization, in the following format:
services/{service}/{collection-id}/{resource-id}. {collection-id} is the cloud resource collection
type that represents the tenant project. Only `projects` are supported. {resource-id} is the tenant
project numeric id, such as `123456`. {service} the name of the peering service, such as `service-
peering.example.com`. This service must already be enabled in the service consumer's project.
*/
public java.lang.String getParent() {
return parent;
}
/**
* Required. A tenant project in the service producer organization, in the following format:
* services/{service}/{collection-id}/{resource-id}. {collection-id} is the cloud resource
* collection type that represents the tenant project. Only `projects` are supported.
* {resource-id} is the tenant project numeric id, such as `123456`. {service} the name of the
* peering service, such as `service-peering.example.com`. This service must already be
* enabled in the service consumer's project.
*/
public AddSubnetwork setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+/[^/]+/[^/]+$");
}
this.parent = parent;
return this;
}
@Override
public AddSubnetwork set(String parameterName, Object value) {
return (AddSubnetwork) super.set(parameterName, value);
}
}
/**
* Disables VPC service controls for a connection.
*
* Create a request for the method "services.disableVpcServiceControls".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link DisableVpcServiceControls#execute()} method to invoke the
* remote operation.
*
* @param parent The service that is managing peering connectivity for a service producer's
organization. For Google
* services that support this functionality, this
value is
* `services/servicenetworking.googleapis.com`.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.DisableVpcServiceControlsRequest}
* @return the request
*/
public DisableVpcServiceControls disableVpcServiceControls(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.DisableVpcServiceControlsRequest content) throws java.io.IOException {
DisableVpcServiceControls result = new DisableVpcServiceControls(parent, content);
initialize(result);
return result;
}
public class DisableVpcServiceControls extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Operation> {
private static final String REST_PATH = "v1/{+parent}:disableVpcServiceControls";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^services/[^/]+$");
/**
* Disables VPC service controls for a connection.
*
* Create a request for the method "services.disableVpcServiceControls".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link DisableVpcServiceControls#execute()} method to invoke
* the remote operation. <p> {@link DisableVpcServiceControls#initialize(com.google.api.client.goo
* gleapis.services.AbstractGoogleClientRequest)} must be called to initialize this instance
* immediately after invoking the constructor. </p>
*
* @param parent The service that is managing peering connectivity for a service producer's
organization. For Google
* services that support this functionality, this
value is
* `services/servicenetworking.googleapis.com`.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.DisableVpcServiceControlsRequest}
* @since 1.13
*/
protected DisableVpcServiceControls(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.DisableVpcServiceControlsRequest content) {
super(ServiceNetworking.this, "PATCH", REST_PATH, content, com.google.api.services.servicenetworking.v1.model.Operation.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
}
@Override
public DisableVpcServiceControls set$Xgafv(java.lang.String $Xgafv) {
return (DisableVpcServiceControls) super.set$Xgafv($Xgafv);
}
@Override
public DisableVpcServiceControls setAccessToken(java.lang.String accessToken) {
return (DisableVpcServiceControls) super.setAccessToken(accessToken);
}
@Override
public DisableVpcServiceControls setAlt(java.lang.String alt) {
return (DisableVpcServiceControls) super.setAlt(alt);
}
@Override
public DisableVpcServiceControls setCallback(java.lang.String callback) {
return (DisableVpcServiceControls) super.setCallback(callback);
}
@Override
public DisableVpcServiceControls setFields(java.lang.String fields) {
return (DisableVpcServiceControls) super.setFields(fields);
}
@Override
public DisableVpcServiceControls setKey(java.lang.String key) {
return (DisableVpcServiceControls) super.setKey(key);
}
@Override
public DisableVpcServiceControls setOauthToken(java.lang.String oauthToken) {
return (DisableVpcServiceControls) super.setOauthToken(oauthToken);
}
@Override
public DisableVpcServiceControls setPrettyPrint(java.lang.Boolean prettyPrint) {
return (DisableVpcServiceControls) super.setPrettyPrint(prettyPrint);
}
@Override
public DisableVpcServiceControls setQuotaUser(java.lang.String quotaUser) {
return (DisableVpcServiceControls) super.setQuotaUser(quotaUser);
}
@Override
public DisableVpcServiceControls setUploadType(java.lang.String uploadType) {
return (DisableVpcServiceControls) super.setUploadType(uploadType);
}
@Override
public DisableVpcServiceControls setUploadProtocol(java.lang.String uploadProtocol) {
return (DisableVpcServiceControls) super.setUploadProtocol(uploadProtocol);
}
/**
* The service that is managing peering connectivity for a service producer's organization.
* For Google services that support this functionality, this value is
* `services/servicenetworking.googleapis.com`.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** The service that is managing peering connectivity for a service producer's organization. For Google
services that support this functionality, this value is
`services/servicenetworking.googleapis.com`.
*/
public java.lang.String getParent() {
return parent;
}
/**
* The service that is managing peering connectivity for a service producer's organization.
* For Google services that support this functionality, this value is
* `services/servicenetworking.googleapis.com`.
*/
public DisableVpcServiceControls setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
this.parent = parent;
return this;
}
@Override
public DisableVpcServiceControls set(String parameterName, Object value) {
return (DisableVpcServiceControls) super.set(parameterName, value);
}
}
/**
* Enables VPC service controls for a connection.
*
* Create a request for the method "services.enableVpcServiceControls".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link EnableVpcServiceControls#execute()} method to invoke the
* remote operation.
*
* @param parent The service that is managing peering connectivity for a service producer's
organization. For Google
* services that support this functionality, this
value is
* `services/servicenetworking.googleapis.com`.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.EnableVpcServiceControlsRequest}
* @return the request
*/
public EnableVpcServiceControls enableVpcServiceControls(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.EnableVpcServiceControlsRequest content) throws java.io.IOException {
EnableVpcServiceControls result = new EnableVpcServiceControls(parent, content);
initialize(result);
return result;
}
public class EnableVpcServiceControls extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Operation> {
private static final String REST_PATH = "v1/{+parent}:enableVpcServiceControls";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^services/[^/]+$");
/**
* Enables VPC service controls for a connection.
*
* Create a request for the method "services.enableVpcServiceControls".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link EnableVpcServiceControls#execute()} method to invoke
* the remote operation. <p> {@link EnableVpcServiceControls#initialize(com.google.api.client.goog
* leapis.services.AbstractGoogleClientRequest)} must be called to initialize this instance
* immediately after invoking the constructor. </p>
*
* @param parent The service that is managing peering connectivity for a service producer's
organization. For Google
* services that support this functionality, this
value is
* `services/servicenetworking.googleapis.com`.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.EnableVpcServiceControlsRequest}
* @since 1.13
*/
protected EnableVpcServiceControls(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.EnableVpcServiceControlsRequest content) {
super(ServiceNetworking.this, "PATCH", REST_PATH, content, com.google.api.services.servicenetworking.v1.model.Operation.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
}
@Override
public EnableVpcServiceControls set$Xgafv(java.lang.String $Xgafv) {
return (EnableVpcServiceControls) super.set$Xgafv($Xgafv);
}
@Override
public EnableVpcServiceControls setAccessToken(java.lang.String accessToken) {
return (EnableVpcServiceControls) super.setAccessToken(accessToken);
}
@Override
public EnableVpcServiceControls setAlt(java.lang.String alt) {
return (EnableVpcServiceControls) super.setAlt(alt);
}
@Override
public EnableVpcServiceControls setCallback(java.lang.String callback) {
return (EnableVpcServiceControls) super.setCallback(callback);
}
@Override
public EnableVpcServiceControls setFields(java.lang.String fields) {
return (EnableVpcServiceControls) super.setFields(fields);
}
@Override
public EnableVpcServiceControls setKey(java.lang.String key) {
return (EnableVpcServiceControls) super.setKey(key);
}
@Override
public EnableVpcServiceControls setOauthToken(java.lang.String oauthToken) {
return (EnableVpcServiceControls) super.setOauthToken(oauthToken);
}
@Override
public EnableVpcServiceControls setPrettyPrint(java.lang.Boolean prettyPrint) {
return (EnableVpcServiceControls) super.setPrettyPrint(prettyPrint);
}
@Override
public EnableVpcServiceControls setQuotaUser(java.lang.String quotaUser) {
return (EnableVpcServiceControls) super.setQuotaUser(quotaUser);
}
@Override
public EnableVpcServiceControls setUploadType(java.lang.String uploadType) {
return (EnableVpcServiceControls) super.setUploadType(uploadType);
}
@Override
public EnableVpcServiceControls setUploadProtocol(java.lang.String uploadProtocol) {
return (EnableVpcServiceControls) super.setUploadProtocol(uploadProtocol);
}
/**
* The service that is managing peering connectivity for a service producer's organization.
* For Google services that support this functionality, this value is
* `services/servicenetworking.googleapis.com`.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** The service that is managing peering connectivity for a service producer's organization. For Google
services that support this functionality, this value is
`services/servicenetworking.googleapis.com`.
*/
public java.lang.String getParent() {
return parent;
}
/**
* The service that is managing peering connectivity for a service producer's organization.
* For Google services that support this functionality, this value is
* `services/servicenetworking.googleapis.com`.
*/
public EnableVpcServiceControls setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
this.parent = parent;
return this;
}
@Override
public EnableVpcServiceControls set(String parameterName, Object value) {
return (EnableVpcServiceControls) super.set(parameterName, value);
}
}
/**
* Service producers can use this method to find a currently unused range within consumer allocated
* ranges. This returned range is not reserved, and not guaranteed to remain unused. It will
* validate previously provided allocated ranges, find non-conflicting sub-range of requested size
* (expressed in number of leading bits of ipv4 network mask, as in CIDR range notation). Operation
*
* Create a request for the method "services.searchRange".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link SearchRange#execute()} method to invoke the remote
* operation.
*
* @param parent Required. This is in a form services/{service}. {service} the name of the private
access management
* service, for example 'service-peering.example.com'.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.SearchRangeRequest}
* @return the request
*/
public SearchRange searchRange(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.SearchRangeRequest content) throws java.io.IOException {
SearchRange result = new SearchRange(parent, content);
initialize(result);
return result;
}
public class SearchRange extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Operation> {
private static final String REST_PATH = "v1/{+parent}:searchRange";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^services/[^/]+$");
/**
* Service producers can use this method to find a currently unused range within consumer
* allocated ranges. This returned range is not reserved, and not guaranteed to remain unused.
* It will validate previously provided allocated ranges, find non-conflicting sub-range of
* requested size (expressed in number of leading bits of ipv4 network mask, as in CIDR range
* notation). Operation
*
* Create a request for the method "services.searchRange".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link SearchRange#execute()} method to invoke the remote
* operation. <p> {@link
* SearchRange#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param parent Required. This is in a form services/{service}. {service} the name of the private
access management
* service, for example 'service-peering.example.com'.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.SearchRangeRequest}
* @since 1.13
*/
protected SearchRange(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.SearchRangeRequest content) {
super(ServiceNetworking.this, "POST", REST_PATH, content, com.google.api.services.servicenetworking.v1.model.Operation.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
}
@Override
public SearchRange set$Xgafv(java.lang.String $Xgafv) {
return (SearchRange) super.set$Xgafv($Xgafv);
}
@Override
public SearchRange setAccessToken(java.lang.String accessToken) {
return (SearchRange) super.setAccessToken(accessToken);
}
@Override
public SearchRange setAlt(java.lang.String alt) {
return (SearchRange) super.setAlt(alt);
}
@Override
public SearchRange setCallback(java.lang.String callback) {
return (SearchRange) super.setCallback(callback);
}
@Override
public SearchRange setFields(java.lang.String fields) {
return (SearchRange) super.setFields(fields);
}
@Override
public SearchRange setKey(java.lang.String key) {
return (SearchRange) super.setKey(key);
}
@Override
public SearchRange setOauthToken(java.lang.String oauthToken) {
return (SearchRange) super.setOauthToken(oauthToken);
}
@Override
public SearchRange setPrettyPrint(java.lang.Boolean prettyPrint) {
return (SearchRange) super.setPrettyPrint(prettyPrint);
}
@Override
public SearchRange setQuotaUser(java.lang.String quotaUser) {
return (SearchRange) super.setQuotaUser(quotaUser);
}
@Override
public SearchRange setUploadType(java.lang.String uploadType) {
return (SearchRange) super.setUploadType(uploadType);
}
@Override
public SearchRange setUploadProtocol(java.lang.String uploadProtocol) {
return (SearchRange) super.setUploadProtocol(uploadProtocol);
}
/**
* Required. This is in a form services/{service}. {service} the name of the private access
* management service, for example 'service-peering.example.com'.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** Required. This is in a form services/{service}. {service} the name of the private access management
service, for example 'service-peering.example.com'.
*/
public java.lang.String getParent() {
return parent;
}
/**
* Required. This is in a form services/{service}. {service} the name of the private access
* management service, for example 'service-peering.example.com'.
*/
public SearchRange setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
this.parent = parent;
return this;
}
@Override
public SearchRange set(String parameterName, Object value) {
return (SearchRange) super.set(parameterName, value);
}
}
/**
* Service producers use this method to validate if the consumer provided network, project and the
* requested range is valid. This allows them to use a fail-fast mechanism for consumer requests,
* and not have to wait for AddSubnetwork operation completion to determine if user request is
* invalid.
*
* Create a request for the method "services.validate".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link Validate#execute()} method to invoke the remote operation.
*
* @param parent Required. This is in a form services/{service} where {service} is the name of the
private access
* management service. For example
'service-peering.example.com'.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.ValidateConsumerConfigRequest}
* @return the request
*/
public Validate validate(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.ValidateConsumerConfigRequest content) throws java.io.IOException {
Validate result = new Validate(parent, content);
initialize(result);
return result;
}
public class Validate extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.ValidateConsumerConfigResponse> {
private static final String REST_PATH = "v1/{+parent}:validate";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^services/[^/]+$");
/**
* Service producers use this method to validate if the consumer provided network, project and the
* requested range is valid. This allows them to use a fail-fast mechanism for consumer requests,
* and not have to wait for AddSubnetwork operation completion to determine if user request is
* invalid.
*
* Create a request for the method "services.validate".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link Validate#execute()} method to invoke the remote
* operation. <p> {@link
* Validate#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param parent Required. This is in a form services/{service} where {service} is the name of the
private access
* management service. For example
'service-peering.example.com'.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.ValidateConsumerConfigRequest}
* @since 1.13
*/
protected Validate(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.ValidateConsumerConfigRequest content) {
super(ServiceNetworking.this, "POST", REST_PATH, content, com.google.api.services.servicenetworking.v1.model.ValidateConsumerConfigResponse.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
}
@Override
public Validate set$Xgafv(java.lang.String $Xgafv) {
return (Validate) super.set$Xgafv($Xgafv);
}
@Override
public Validate setAccessToken(java.lang.String accessToken) {
return (Validate) super.setAccessToken(accessToken);
}
@Override
public Validate setAlt(java.lang.String alt) {
return (Validate) super.setAlt(alt);
}
@Override
public Validate setCallback(java.lang.String callback) {
return (Validate) super.setCallback(callback);
}
@Override
public Validate setFields(java.lang.String fields) {
return (Validate) super.setFields(fields);
}
@Override
public Validate setKey(java.lang.String key) {
return (Validate) super.setKey(key);
}
@Override
public Validate setOauthToken(java.lang.String oauthToken) {
return (Validate) super.setOauthToken(oauthToken);
}
@Override
public Validate setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Validate) super.setPrettyPrint(prettyPrint);
}
@Override
public Validate setQuotaUser(java.lang.String quotaUser) {
return (Validate) super.setQuotaUser(quotaUser);
}
@Override
public Validate setUploadType(java.lang.String uploadType) {
return (Validate) super.setUploadType(uploadType);
}
@Override
public Validate setUploadProtocol(java.lang.String uploadProtocol) {
return (Validate) super.setUploadProtocol(uploadProtocol);
}
/**
* Required. This is in a form services/{service} where {service} is the name of the private
* access management service. For example 'service-peering.example.com'.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** Required. This is in a form services/{service} where {service} is the name of the private access
management service. For example 'service-peering.example.com'.
*/
public java.lang.String getParent() {
return parent;
}
/**
* Required. This is in a form services/{service} where {service} is the name of the private
* access management service. For example 'service-peering.example.com'.
*/
public Validate setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
this.parent = parent;
return this;
}
@Override
public Validate set(String parameterName, Object value) {
return (Validate) super.set(parameterName, value);
}
}
/**
* An accessor for creating requests from the Connections collection.
*
* <p>The typical use is:</p>
* <pre>
* {@code ServiceNetworking servicenetworking = new ServiceNetworking(...);}
* {@code ServiceNetworking.Connections.List request = servicenetworking.connections().list(parameters ...)}
* </pre>
*
* @return the resource collection
*/
public Connections connections() {
return new Connections();
}
/**
* The "connections" collection of methods.
*/
public class Connections {
/**
* Creates a private connection that establishes a VPC Network Peering connection to a VPC network
* in the service producer's organization. The administrator of the service consumer's VPC network
* invokes this method. The administrator must assign one or more allocated IP ranges for
* provisioning subnetworks in the service producer's VPC network. This connection is used for all
* supported services in the service producer's organization, so it only needs to be invoked once.
* The response from the `get` operation will be of type `Connection` if the operation successfully
* completes.
*
* Create a request for the method "connections.create".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link Create#execute()} method to invoke the remote operation.
*
* @param parent The service that is managing peering connectivity for a service producer's
organization. For Google
* services that support this functionality, this
value is
* `services/servicenetworking.googleapis.com`.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.Connection}
* @return the request
*/
public Create create(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.Connection content) throws java.io.IOException {
Create result = new Create(parent, content);
initialize(result);
return result;
}
public class Create extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Operation> {
private static final String REST_PATH = "v1/{+parent}/connections";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^services/[^/]+$");
/**
* Creates a private connection that establishes a VPC Network Peering connection to a VPC network
* in the service producer's organization. The administrator of the service consumer's VPC network
* invokes this method. The administrator must assign one or more allocated IP ranges for
* provisioning subnetworks in the service producer's VPC network. This connection is used for all
* supported services in the service producer's organization, so it only needs to be invoked once.
* The response from the `get` operation will be of type `Connection` if the operation
* successfully completes.
*
* Create a request for the method "connections.create".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link Create#execute()} method to invoke the remote
* operation. <p> {@link
* Create#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param parent The service that is managing peering connectivity for a service producer's
organization. For Google
* services that support this functionality, this
value is
* `services/servicenetworking.googleapis.com`.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.Connection}
* @since 1.13
*/
protected Create(java.lang.String parent, com.google.api.services.servicenetworking.v1.model.Connection content) {
super(ServiceNetworking.this, "POST", REST_PATH, content, com.google.api.services.servicenetworking.v1.model.Operation.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
}
@Override
public Create set$Xgafv(java.lang.String $Xgafv) {
return (Create) super.set$Xgafv($Xgafv);
}
@Override
public Create setAccessToken(java.lang.String accessToken) {
return (Create) super.setAccessToken(accessToken);
}
@Override
public Create setAlt(java.lang.String alt) {
return (Create) super.setAlt(alt);
}
@Override
public Create setCallback(java.lang.String callback) {
return (Create) super.setCallback(callback);
}
@Override
public Create setFields(java.lang.String fields) {
return (Create) super.setFields(fields);
}
@Override
public Create setKey(java.lang.String key) {
return (Create) super.setKey(key);
}
@Override
public Create setOauthToken(java.lang.String oauthToken) {
return (Create) super.setOauthToken(oauthToken);
}
@Override
public Create setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Create) super.setPrettyPrint(prettyPrint);
}
@Override
public Create setQuotaUser(java.lang.String quotaUser) {
return (Create) super.setQuotaUser(quotaUser);
}
@Override
public Create setUploadType(java.lang.String uploadType) {
return (Create) super.setUploadType(uploadType);
}
@Override
public Create setUploadProtocol(java.lang.String uploadProtocol) {
return (Create) super.setUploadProtocol(uploadProtocol);
}
/**
* The service that is managing peering connectivity for a service producer's organization.
* For Google services that support this functionality, this value is
* `services/servicenetworking.googleapis.com`.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** The service that is managing peering connectivity for a service producer's organization. For Google
services that support this functionality, this value is
`services/servicenetworking.googleapis.com`.
*/
public java.lang.String getParent() {
return parent;
}
/**
* The service that is managing peering connectivity for a service producer's organization.
* For Google services that support this functionality, this value is
* `services/servicenetworking.googleapis.com`.
*/
public Create setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
this.parent = parent;
return this;
}
@Override
public Create set(String parameterName, Object value) {
return (Create) super.set(parameterName, value);
}
}
/**
* List the private connections that are configured in a service consumer's VPC network.
*
* Create a request for the method "connections.list".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param parent The service that is managing peering connectivity for a service producer's
organization. For Google
* services that support this functionality, this
value is
* `services/servicenetworking.googleapis.com`.
If you specify `services/-` as the parameter
* value, all configured peering
services are listed.
* @return the request
*/
public List list(java.lang.String parent) throws java.io.IOException {
List result = new List(parent);
initialize(result);
return result;
}
public class List extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.ListConnectionsResponse> {
private static final String REST_PATH = "v1/{+parent}/connections";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^services/[^/]+$");
/**
* List the private connections that are configured in a service consumer's VPC network.
*
* Create a request for the method "connections.list".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* <p> {@link
* List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must be
* called to initialize this instance immediately after invoking the constructor. </p>
*
* @param parent The service that is managing peering connectivity for a service producer's
organization. For Google
* services that support this functionality, this
value is
* `services/servicenetworking.googleapis.com`.
If you specify `services/-` as the parameter
* value, all configured peering
services are listed.
* @since 1.13
*/
protected List(java.lang.String parent) {
super(ServiceNetworking.this, "GET", REST_PATH, null, com.google.api.services.servicenetworking.v1.model.ListConnectionsResponse.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List set$Xgafv(java.lang.String $Xgafv) {
return (List) super.set$Xgafv($Xgafv);
}
@Override
public List setAccessToken(java.lang.String accessToken) {
return (List) super.setAccessToken(accessToken);
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setCallback(java.lang.String callback) {
return (List) super.setCallback(callback);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUploadType(java.lang.String uploadType) {
return (List) super.setUploadType(uploadType);
}
@Override
public List setUploadProtocol(java.lang.String uploadProtocol) {
return (List) super.setUploadProtocol(uploadProtocol);
}
/**
* The service that is managing peering connectivity for a service producer's organization.
* For Google services that support this functionality, this value is
* `services/servicenetworking.googleapis.com`. If you specify `services/-` as the parameter
* value, all configured peering services are listed.
*/
@com.google.api.client.util.Key
private java.lang.String parent;
/** The service that is managing peering connectivity for a service producer's organization. For Google
services that support this functionality, this value is
`services/servicenetworking.googleapis.com`. If you specify `services/-` as the parameter value,
all configured peering services are listed.
*/
public java.lang.String getParent() {
return parent;
}
/**
* The service that is managing peering connectivity for a service producer's organization.
* For Google services that support this functionality, this value is
* `services/servicenetworking.googleapis.com`. If you specify `services/-` as the parameter
* value, all configured peering services are listed.
*/
public List setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^services/[^/]+$");
}
this.parent = parent;
return this;
}
/**
* The name of service consumer's VPC network that's connected with service producer network
* through a private connection. The network name must be in the following format:
* `projects/{project}/global/networks/{network}`. {project} is a project number, such as in
* `12345` that includes the VPC service consumer's VPC network. {network} is the name of
* the service consumer's VPC network.
*/
@com.google.api.client.util.Key
private java.lang.String network;
/** The name of service consumer's VPC network that's connected with service producer network through a
private connection. The network name must be in the following format:
`projects/{project}/global/networks/{network}`. {project} is a project number, such as in `12345`
that includes the VPC service consumer's VPC network. {network} is the name of the service
consumer's VPC network.
*/
public java.lang.String getNetwork() {
return network;
}
/**
* The name of service consumer's VPC network that's connected with service producer network
* through a private connection. The network name must be in the following format:
* `projects/{project}/global/networks/{network}`. {project} is a project number, such as in
* `12345` that includes the VPC service consumer's VPC network. {network} is the name of
* the service consumer's VPC network.
*/
public List setNetwork(java.lang.String network) {
this.network = network;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Updates the allocated ranges that are assigned to a connection. The response from the `get`
* operation will be of type `Connection` if the operation successfully completes.
*
* Create a request for the method "connections.patch".
*
* This request holds the parameters needed by the servicenetworking server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param name The private service connection that connects to a service producer
organization. The name includes
* both the private service name and the VPC
network peering name in the format of
* `services/{peering_service_name}/connections/{vpc_peering_name}`. For
Google services that
* support this functionality, this is
`services/servicenetworking.googleapis.com/connections
* /servicenetworking-googleapis-com`.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.Connection}
* @return the request
*/
public Patch patch(java.lang.String name, com.google.api.services.servicenetworking.v1.model.Connection content) throws java.io.IOException {
Patch result = new Patch(name, content);
initialize(result);
return result;
}
public class Patch extends ServiceNetworkingRequest<com.google.api.services.servicenetworking.v1.model.Operation> {
private static final String REST_PATH = "v1/{+name}";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^services/[^/]+/connections/[^/]+$");
/**
* Updates the allocated ranges that are assigned to a connection. The response from the `get`
* operation will be of type `Connection` if the operation successfully completes.
*
* Create a request for the method "connections.patch".
*
* This request holds the parameters needed by the the servicenetworking server. After setting
* any optional parameters, call the {@link Patch#execute()} method to invoke the remote
* operation. <p> {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor. </p>
*
* @param name The private service connection that connects to a service producer
organization. The name includes
* both the private service name and the VPC
network peering name in the format of
* `services/{peering_service_name}/connections/{vpc_peering_name}`. For
Google services that
* support this functionality, this is
`services/servicenetworking.googleapis.com/connections
* /servicenetworking-googleapis-com`.
* @param content the {@link com.google.api.services.servicenetworking.v1.model.Connection}
* @since 1.13
*/
protected Patch(java.lang.String name, com.google.api.services.servicenetworking.v1.model.Connection content) {
super(ServiceNetworking.this, "PATCH", REST_PATH, content, com.google.api.services.servicenetworking.v1.model.Operation.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^services/[^/]+/connections/[^/]+$");
}
}
@Override
public Patch set$Xgafv(java.lang.String $Xgafv) {
return (Patch) super.set$Xgafv($Xgafv);
}
@Override
public Patch setAccessToken(java.lang.String accessToken) {
return (Patch) super.setAccessToken(accessToken);
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setCallback(java.lang.String callback) {
return (Patch) super.setCallback(callback);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUploadType(java.lang.String uploadType) {
return (Patch) super.setUploadType(uploadType);
}
@Override
public Patch setUploadProtocol(java.lang.String uploadProtocol) {
return (Patch) super.setUploadProtocol(uploadProtocol);
}
/**
* The private service connection that connects to a service producer organization. The name
* includes both the private service name and the VPC network peering name in the format of
* `services/{peering_service_name}/connections/{vpc_peering_name}`. For Google services
* that support this functionality, this is
* `services/servicenetworking.googleapis.com/connections/servicenetworking-googleapis-com`.
*/
@com.google.api.client.util.Key
private java.lang.String name;
/** The private service connection that connects to a service producer organization. The name includes
both the private service name and the VPC network peering name in the format of
`services/{peering_service_name}/connections/{vpc_peering_name}`. For Google services that support
this functionality, this is `services/servicenetworking.googleapis.com/connections
/servicenetworking-googleapis-com`.
*/
public java.lang.String getName() {
return name;
}
/**
* The private service connection that connects to a service producer organization. The name
* includes both the private service name and the VPC network peering name in the format of
* `services/{peering_service_name}/connections/{vpc_peering_name}`. For Google services
* that support this functionality, this is
* `services/servicenetworking.googleapis.com/connections/servicenetworking-googleapis-com`.
*/
public Patch setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^services/[^/]+/connections/[^/]+$");
}
this.name = name;
return this;
}
/**
* If a previously defined allocated range is removed, force flag must be set to true.
*/
@com.google.api.client.util.Key
private java.lang.Boolean force;
/** If a previously defined allocated range is removed, force flag must be set to true.
*/
public java.lang.Boolean getForce() {
return force;
}
/**
* If a previously defined allocated range is removed, force flag must be set to true.
*/
public Patch setForce(java.lang.Boolean force) {
this.force = force;
return this;
}
/**
* The update mask. If this is omitted, it defaults to "*". You can only update the listed
* peering ranges.
*/
@com.google.api.client.util.Key
private String updateMask;
/** The update mask. If this is omitted, it defaults to "*". You can only update the listed peering
ranges.
*/
public String getUpdateMask() {
return updateMask;
}
/**
* The update mask. If this is omitted, it defaults to "*". You can only update the listed
* peering ranges.
*/
public Patch setUpdateMask(String updateMask) {
this.updateMask = updateMask;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
}
}
/**
* Builder for {@link ServiceNetworking}.
*
* <p>
* Implementation is not thread-safe.
* </p>
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport, which should normally be:
* <ul>
* <li>Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li>
* <li>Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}</li>
* <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
* </li>
* </ul>
* @param jsonFactory JSON factory, which may be:
* <ul>
* <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li>
* <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li>
* <li>Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li>
* </ul>
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
super(
transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
setBatchPath(DEFAULT_BATCH_PATH);
}
/** Builds a new instance of {@link ServiceNetworking}. */
@Override
public ServiceNetworking build() {
return new ServiceNetworking(this);
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setBatchPath(String batchPath) {
return (Builder) super.setBatchPath(batchPath);
}
@Override
public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
@Override
public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
}
@Override
public Builder setSuppressAllChecks(boolean suppressAllChecks) {
return (Builder) super.setSuppressAllChecks(suppressAllChecks);
}
/**
* Set the {@link ServiceNetworkingRequestInitializer}.
*
* @since 1.12
*/
public Builder setServiceNetworkingRequestInitializer(
ServiceNetworkingRequestInitializer servicenetworkingRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(servicenetworkingRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}
| [
"chingor@google.com"
] | chingor@google.com |
b2abcc74d20844b4dd776674086e01d6e28da09c | 7b9392d2d6c34a12a26ee25a92dd0a137a9c4d33 | /src/main/java/com/diwayou/utils/db/transaction/ShardTransactionTemplate.java | 251118a04dc4f823e1ac01318c8251c6307f5a25 | [] | no_license | tasfe/utils-db | 558d784145dd861df2a94e3cf43fde801289b8f3 | ebc9e33069f0f8c5c315e20cb5fc60dcffb3ca01 | refs/heads/master | 2021-01-11T18:16:06.214600 | 2015-09-11T10:00:29 | 2015-09-11T10:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,616 | java | package com.diwayou.utils.db.transaction;
import com.diwayou.utils.db.exception.ShardDaoException;
import com.diwayou.utils.db.shard.ShardContextHolder;
import com.diwayou.utils.db.shard.route.DbRouteStrategy;
import com.diwayou.utils.db.shard.rule.DbRule;
import com.diwayou.utils.db.util.RouteUtil;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
/**
* Created by diwayou on 2015/9/10.
*/
public class ShardTransactionTemplate extends TransactionTemplate {
@Override
public <T> T execute(TransactionCallback<T> action) throws TransactionException {
throw new UnsupportedOperationException();
}
public <T> T execute(Object routeKey, ShardTransactionCallback<T> action) throws TransactionException {
DbRule dbRule = action.getDbRule();
if (dbRule == null) {
throw new ShardDaoException("Must set dbRule.");
}
DbRouteStrategy dbRouteStrategy = dbRule.getDbRouteStrategy();
String dbNameSuffix = dbRouteStrategy.getRouteSuffix(routeKey, dbRule.getDbCount());
String dbName = RouteUtil.buildDbName(dbRule.getDbName(), dbNameSuffix);
try {
TransactionContextHolder.setInTransaction(Boolean.TRUE);
ShardContextHolder.setShardDataSourceName(dbName);
return super.execute(action);
} finally {
TransactionContextHolder.clearInTransaction();
ShardContextHolder.clearShardDataSourceName();
}
}
}
| [
"diwayou@qq.com"
] | diwayou@qq.com |
7260c467ec5c28837f18850cb7e04efc74a4bf82 | dd82a37087d3b0289c9398920ec2eb6827476f3f | /src/main/java/com/buzz/controller/redis/RedisLuaScriptController.java | a348237f09f8f1db1c36176cda89676febfe15e8 | [] | no_license | pentos9/spacex-shane | 90f879ca6c877706ee9507f5e966de97bcd650ed | 83798e48c01dd9f09170ecf6460285cad54369a5 | refs/heads/master | 2021-10-08T10:09:18.100751 | 2018-12-11T01:31:41 | 2018-12-11T01:31:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,345 | java | package com.buzz.controller.redis;
import com.google.common.collect.Lists;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
import org.springframework.data.redis.core.script.RedisScript;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("shane/redis")
public class RedisLuaScriptController {
private Logger logger = LoggerFactory.getLogger(RedisLuaScriptController.class);
private static String INCR_LUA = StringUtils.EMPTY;
@Autowired
private StringRedisTemplate stringRedisTemplate;
static {
StringBuilder builder = new StringBuilder();
builder.append("local mock_id = redis.call(\"get\",KEYS[1]) ");
builder.append("print( type(mock_id)) ");
builder.append("if not mock_id then ");
builder.append(" mock_id=redis.call(\"incr\",KEYS[2]) ");//返回的是 lua number 类型
builder.append(" print( type(mock_id)) ");
builder.append(" redis.call(\"set\",KEYS[1],tostring(mock_id) ) ");
builder.append(" return tostring(mock_id) ");
builder.append("else ");
builder.append(" print( type(mock_id)) ");
builder.append(" return tostring(mock_id) ");
builder.append("end ");
INCR_LUA = builder.toString();
}
@RequestMapping(value = "/lua", method = RequestMethod.GET)
public String executeWithLuaScript(String deviceId) {
logger.info("RedisLuaScriptController#executeWithLuaScript starts now");
List<String> keys = Lists.newArrayList();
keys.add("shane:mock-id:" + deviceId);
keys.add("shane:global:mock-id:increment");
RedisScript<String> script = new DefaultRedisScript<>(INCR_LUA, String.class);
String result = stringRedisTemplate.execute(script, keys);
logger.info("executeWithLuaScript#stringRedisTemplate.execute(script, keys) result ->{}", result);
return result;
}
}
| [
"ayaaa168@163.com"
] | ayaaa168@163.com |
c9004e81bcc10ef5baeef4ed80dd047ae26b2f96 | 4ff635b1f522fe2af863081d8c2ef9fd61778145 | /src/main/java/com/galenframework/ide/devices/tasks/DeviceTask.java | 21d5bf7fa776fb1427866b316fb0bc4d355d8c07 | [
"Apache-2.0"
] | permissive | ishubin/galen-ide | 8d40da309560f888e7ea305d3a965c8cf17f7213 | 8f199173240509c18362354302a815e36e65d9ff | refs/heads/master | 2021-01-16T23:32:28.740908 | 2016-10-08T20:43:43 | 2016-10-08T20:43:43 | 50,373,614 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,778 | java | /*******************************************************************************
* Copyright 2016 Ivan Shubin http://galenframework.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.galenframework.ide.devices.tasks;
import com.galenframework.ide.devices.commands.DeviceCommand;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.util.List;
public class DeviceTask {
private String name;
private String taskId;
private List<DeviceCommand> commands;
public DeviceTask() {
}
public DeviceTask(String name, List<DeviceCommand> commands) {
this.name = name;
this.commands = commands;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<DeviceCommand> getCommands() {
return commands;
}
public void setCommands(List<DeviceCommand> commands) {
this.commands = commands;
}
public String getTaskId() {
return taskId;
}
public void setTaskId(String taskId) {
this.taskId = taskId;
}
@Override
public int hashCode() {
return new HashCodeBuilder()
.append(taskId)
.append(name)
.append(commands)
.toHashCode();
}
@Override
public boolean equals(Object obj) {
if(obj == null) {
return false;
} else if(obj == this) {
return true;
} else if(!(obj instanceof DeviceTask)) {
return false;
} else {
DeviceTask rhs = (DeviceTask) obj;
return new EqualsBuilder()
.append(rhs.taskId, this.taskId)
.append(rhs.name, this.name)
.append(rhs.commands, this.commands)
.isEquals();
}
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("taskId", taskId)
.append("name", name)
.append("commands", getCommands())
.toString();
}
}
| [
"ivan.ishubin@gmail.com"
] | ivan.ishubin@gmail.com |
37cfb1038cb2c29de38685cd2f6084177d8f5389 | 7b313863ad6635cb0f04ee44f418087687f86aeb | /NonParameterizedConst.java | beea3027bcb80692f499184f5874f1735f79cc14 | [] | no_license | Harshada-Joshi/JAVA-LEARNING | 2fcff325ea877e3cb2159d386604aae011dd0fe4 | e53147b49f90d756770e9f951a73ce7b9a3914f5 | refs/heads/master | 2023-04-26T10:06:00.514203 | 2021-05-27T05:01:32 | 2021-05-27T05:01:32 | 361,670,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 548 | java | class NonParameterizedConst
{
int roll_no;
int marks1,marks2;//instance variable
public NonParameterizedConst()
{
int result;
marks1=90;
marks2=90;
roll_no=01;
result=marks1+marks2;
System.out.println("result is : "+result);
System.out.println("calling non-parameterized constructor");
}
public static void main(String args[])
{
NonParameterizedConst obj=new NonParameterizedConst();
System.out.println("roll_no is :"+" "+obj.roll_no);
System.out.println("marks1 is:"+obj.marks1+" , "+"marks2 is:"+obj.marks2);
}
} | [
"harshadaj206@gmail.com"
] | harshadaj206@gmail.com |
248be96ccc6e754741143c40835b3d8b04f701bc | 4fa942cc15c9c40035d9932642128e0fc45a927b | /src/hidra/metaheuristics/mopsocdls/MOPSOCDLS.java | 940cb382543760281a6aa8468f28ad1e35da0243 | [] | no_license | renanalencar/mofss-algorithm | 0cd8f52909408e9807a51d3baf8f3f388e1f4bb3 | 6a91c53b737b56bd8513a2bc42be47698357e29d | refs/heads/master | 2021-08-28T18:49:17.447252 | 2017-12-13T01:03:49 | 2017-12-13T01:03:55 | 112,488,789 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,732 | java | package hidra.metaheuristics.mopsocdls;
import hidra.core.population.HIDRAPopulationAlgorithm;
import jmetal.core.Problem;
import jmetal.core.Solution;
import jmetal.core.SolutionSet;
import jmetal.core.Variable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Random;
import jmetal.util.Distance;
import jmetal.util.JMException;
import jmetal.util.PseudoRandom;
import jmetal.util.comparators.CrowdingDistanceComparator;
import jmetal.util.comparators.DominanceComparator;
import jmetal.util.wrapper.XReal;
public class MOPSOCDLS extends HIDRAPopulationAlgorithm{
private int swarmSize_;
private int archiveSize_;
/*private int maxIterations_;
private int iteration_;
*/
private SolutionSet particles_;
private Solution[] best_;
private CDLSArchive leaders_;
private double[][] speed_;
private Comparator dominance_;
private Comparator crowdingDistanceComparator_;
private Distance distance_;
private double C1_;
private double C2_;
private double wMax_;
private double wMin_;
public MOPSOCDLS(Problem problem) {
super(problem);
/*swarmSize_ = MOPSOCDLSConstants.swarmSize;
maxIterations_ = MOPSOCDLSConstants.maxIterations;*/
}
public void initParams() {
swarmSize_ = ((Integer) getInputParameter("swarmSize")).intValue();
archiveSize_ = ((Integer) getInputParameter("archiveSize")).intValue();
maxIterations_ = ((Integer) getInputParameter("maxIterations")).intValue();
iteration_ = 0 ;
particles_ = new SolutionSet(swarmSize_);
best_ = new Solution[swarmSize_];
leaders_ = new CDLSArchive(archiveSize_, problem_.getNumberOfObjectives());
// Create comparators for dominance and crowding distance
dominance_ = new DominanceComparator();
crowdingDistanceComparator_ = new CrowdingDistanceComparator();
distance_ = new Distance();
//distance = new UtilDistance();
// Create the speed vector
speed_ = new double[swarmSize_][problem_.getNumberOfVariables()];
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("maxIterations_",maxIterations_);
//parameters.put("percMutation_",MOPSOCDRConstants.MUTATION_PERCENTUAL_MOPSO);
this.C1_ = 1.49445;
this.C2_ = 1.49445;
this.wMax_ = 0.4;
this.wMin_ = 0.0;
}
/**
* Update the position of each particle
* @throws JMException
*/
private void computeNewPositions() throws JMException{
for (int i = 0; i < swarmSize_; i++){
Variable[] particle = particles_.get(i).getDecisionVariables();
//particle.move(speed_[i]);
for (int var = 0; var < particle.length; var++){
particle[var].setValue(particle[var].getValue()+ speed_[i][var]);
if (particle[var].getValue() < problem_.getLowerLimit(var)){
particle[var].setValue(problem_.getLowerLimit(var));
speed_[i][var] = speed_[i][var] * -1.0;
}
if (particle[var].getValue() > problem_.getUpperLimit(var)){
particle[var].setValue(problem_.getUpperLimit(var));
speed_[i][var] = speed_[i][var] * -1.0;
}
}
}
} // computeNewPositions
/*@Override
public SolutionSet execute() throws JMException, ClassNotFoundException {
initParams();
//->Step 1 (and 3) Create the initial population and evaluate
for (int i = 0; i < swarmSize_; i++){
Solution particle = new Solution(problem_);
problem_.evaluate(particle);
problem_.evaluateConstraints(particle);
particles_.add(particle);
}
//-> Step2. Initialize the speed_ of each particle to 0
for (int i = 0; i < swarmSize_; i++) {
for (int j = 0; j < problem_.getNumberOfVariables(); j++) {
speed_[i][j] = 0.0;
}
}
// Step4 and 5
for (int i = 0; i < particles_.size(); i++) {
Solution particle = new Solution(particles_.get(i));
leaders_.add(particle);
}
//Crowding the leaders_
distance_.crowdingDistanceAssignment(leaders_, problem_.getNumberOfObjectives());
//-> Step 6. Initialize the memory of each particle
for (int i = 0; i < particles_.size(); i++) {
Solution particle = new Solution(particles_.get(i));
best_[i] = particle;
}
//-> Step 7. Iterations ..
while (iteration_ < maxIterations_) {
computeSpeed();
System.out.println(iteration_);
//Compute the new positions for the particles_
computeNewPositions();
//Evaluate the new particles_ in new positions
for (int i = 0; i < particles_.size(); i++) {
Solution particle = particles_.get(i);
problem_.evaluate(particle);
}
//Actualize the archive
for (int i = 0; i < particles_.size(); i++) {
Solution particle = new Solution(particles_.get(i));
leaders_.add(particle);
}
//Crowding the leaders_
distance_.crowdingDistanceAssignment(leaders_, problem_.getNumberOfObjectives());
double sigma = (SIGMA_MAX - SIGMA_MIN) * ((maxIterations_ - iteration_)/ ((double)maxIterations_)) + SIGMA_MIN;
localSearch(sigma);
//distance_.crowdingDistanceAssignment(leaders_, problem_.getNumberOfObjectives());
//Update Particles of the Memory
for (int i = 0; i < particles_.size(); i++) {
int flag = dominance_.compare(particles_.get(i), best_[i]);
if (flag == -1) { // the new particle is best than the older pBest
Solution particle = new Solution(particles_.get(i));
best_[i] = particle;
}else if(flag == 0){
if (Math.random() > 0.5) {
Solution particle = new Solution(particles_.get(i));
best_[i] = particle;
}
}
}
//Assign crowding distance to the leaders_
distance_.crowdingDistanceAssignment(leaders_,
problem_.getNumberOfObjectives());
iteration_++;
}
return this.leaders_;
}
*/
@Override
protected SolutionSet initializationAlgorithm()
throws ClassNotFoundException, JMException {
initParams();
//->Step 1 (and 3) Create the initial population and evaluate
for (int i = 0; i < swarmSize_; i++){
Solution particle = new Solution(problem_);
problem_.evaluate(particle);
problem_.evaluateConstraints(particle);
particles_.add(particle);
}
//-> Step2. Initialize the speed_ of each particle to 0
for (int i = 0; i < swarmSize_; i++) {
for (int j = 0; j < problem_.getNumberOfVariables(); j++) {
speed_[i][j] = 0.0;
}
}
// Step4 and 5
for (int i = 0; i < particles_.size(); i++) {
Solution particle = new Solution(particles_.get(i));
leaders_.add(particle);
}
//Crowding the leaders_
distance_.crowdingDistanceAssignment(leaders_, problem_.getNumberOfObjectives());
//-> Step 6. Initialize the memory of each particle
for (int i = 0; i < particles_.size(); i++) {
Solution particle = new Solution(particles_.get(i));
best_[i] = particle;
}
return this.leaders_;
}
@Override
protected SolutionSet runIteration() throws JMException {
computeSpeed();
System.out.println(iteration_);
//Compute the new positions for the particles_
computeNewPositions();
//Evaluate the new particles_ in new positions
for (int i = 0; i < particles_.size(); i++) {
Solution particle = particles_.get(i);
problem_.evaluate(particle);
}
//Actualize the archive
for (int i = 0; i < particles_.size(); i++) {
Solution particle = new Solution(particles_.get(i));
leaders_.add(particle);
}
//Crowding the leaders_
distance_.crowdingDistanceAssignment(leaders_, problem_.getNumberOfObjectives());
double sigma = (SIGMA_MAX - SIGMA_MIN) * ((maxIterations_ - iteration_)/ ((double)maxIterations_)) + SIGMA_MIN;
localSearch(sigma);
//distance_.crowdingDistanceAssignment(leaders_, problem_.getNumberOfObjectives());
//Update Particles of the Memory
for (int i = 0; i < particles_.size(); i++) {
int flag = dominance_.compare(particles_.get(i), best_[i]);
if (flag == -1) { // the new particle is best than the older pBest
Solution particle = new Solution(particles_.get(i));
best_[i] = particle;
}else if(flag == 0){
if (Math.random() > 0.5) {
Solution particle = new Solution(particles_.get(i));
best_[i] = particle;
}
}
}
//Assign crowding distance to the leaders_
distance_.crowdingDistanceAssignment(leaders_,
problem_.getNumberOfObjectives());
iteration_++;
return this.leaders_;
}
// Adaptive inertia
private double inertiaWeight() {
double w = wMax_ - (((wMax_-wMin_)*(double)iteration_)/(double)maxIterations_);
if ( w < 0.0 ) {
w = 0.0;
}
return w;
} // inertiaWeight
private void computeSpeed() throws JMException{
double r1, r2;
double wmax, wmin, W;
XReal bestGlobal;
wmax = wMax_;
wmin = wMin_;
W = inertiaWeight();
SolutionSet aux = new SolutionSet(this.leaders_.size());
SolutionSet archive = new SolutionSet(this.leaders_.size());
for(int i=0; i < this.leaders_.size(); i++){
aux.add(this.leaders_.get(i));
}
aux.sort(new CrowdingDistanceComparator());
/*for(int i = this.leaders_.size()-1; i >= 0; i--){
archive.add(aux.get(i));
}
*/
archive = aux;
//SolutionSet archive = this.leaders_;
for (int i = 0; i < swarmSize_; i++) {
XReal particle = new XReal(particles_.get(i)) ;
XReal bestParticle = new XReal(best_[i]) ;
bestGlobal = new XReal(selectLeaderCD(particles_.get(i),archive ) );
for (int var = 0; var < particle.getNumberOfDecisionVariables(); var++) {
// generate stochastic components for each dimension
r1 = PseudoRandom.randDouble(0.0, 1.0);
r2 = PseudoRandom.randDouble(0.0, 1.0);
//Computing the velocity of this particle
speed_[i][var] = (W *
speed_[i][var] +
C1_ * r1 * (bestParticle.getValue(var) -
particle.getValue(var)) +
C2_ * r2 * (bestGlobal.getValue(var) -
particle.getValue(var)));
double vmax = particle.getUpperBound(var) - particle.getLowerBound(var);
speed_[i][var] =
Math.signum(speed_[i][var]) *
Math.min(Math.abs(speed_[i][var]),vmax);
}
}
} // computeSpeed
public static final double SIGMA = 0.2;
public static final double SIGMA_MAX = 0.3;
public static final double SIGMA_MIN = 0.1;
public void localSearch(double sigma) throws JMException{
SolutionSet aux = new SolutionSet(this.leaders_.size());
SolutionSet archive = new SolutionSet(this.leaders_.size());
for(int i=0; i < this.leaders_.size(); i++){
aux.add(this.leaders_.get(i));
}
aux.sort(crowdingDistanceComparator_);
/*for(int i = this.leaders_.size()-1; i >= 0; i--){
archive.add(aux.get(i));
}*/
archive = aux;
ArrayList<Solution> tenPercentlessCrowdedExternalArchive = new ArrayList<Solution>();
int tenPercentExternalArchiveSize = (int) (archive.size() * 0.1);
int count = 0;
int index = 0;
if (tenPercentExternalArchiveSize > 0) {
for(int i=0; i < tenPercentExternalArchiveSize ; i++){
tenPercentlessCrowdedExternalArchive.add( archive.get(i) );
}
}else{
return;
}
double step = Double.NEGATIVE_INFINITY;
for(int var = 0; var < problem_.getNumberOfVariables(); var++){
step = Math.max(step, problem_.getUpperLimit(var)-problem_.getLowerLimit(var));
}
step = step * sigma;
for(int i=0; i < tenPercentlessCrowdedExternalArchive.size() ; i++){
Solution x = tenPercentlessCrowdedExternalArchive.get(i);
Solution s = new Solution(x);
XReal xreal = new XReal( s );
for(int var = 0; var < s.numberOfVariables(); var++){
double value = xreal.getValue(var);
double lambda1 = Math.random();
double lambda2 = Math.random();
if(lambda1 > 0.5){
value = value + lambda2 * step;
}else{
value = value - lambda2 * step;
}
value = Math.min(problem_.getUpperLimit(var), value);
value = Math.max(problem_.getLowerLimit(var), value);
xreal.setValue(var, value);
}
problem_.evaluate(s);
problem_.evaluateConstraints(s);
int dominance = dominance_.compare( s, x);
if(dominance < 1){
boolean inserted = this.leaders_.add(s);
if(inserted){
this.leaders_.remove(x);
}
}
}
}
public Solution selectLeaderCD(Solution particle, SolutionSet archive)
{
ArrayList<Solution> tenPercentlessCrowdedExternalArchive;
int tenPercentExternalArchiveSize, index, toSort;
Comparator dominanceOperator = new DominanceComparator();
Random r;
Solution leader = null;
tenPercentlessCrowdedExternalArchive = new ArrayList<Solution>();
tenPercentExternalArchiveSize = (int) (archive.size() * 0.1);
toSort = tenPercentExternalArchiveSize;
index = 0;
r = new Random();
if (tenPercentExternalArchiveSize > 0) {
while ((toSort > 0) && (index < archive.size())) {
int dominance = dominanceOperator.compare(particle, archive.get(index));
if (dominance == 1) {
tenPercentlessCrowdedExternalArchive.add( new Solution( archive.get(index) ) );
toSort--;
}
index++;
}
if (toSort == 0) {
leader = tenPercentlessCrowdedExternalArchive.get(r.nextInt(tenPercentExternalArchiveSize));
} else {
leader = archive.get(r.nextInt(archive.size()));
}
} else {
leader = archive.get(r.nextInt(archive.size()));
}
return leader;
}
@Override
protected SolutionSet getParetoFront() {
// TODO Auto-generated method stub
return this.leaders_;
}
}
| [
"renan.costaalencar@gmail.com"
] | renan.costaalencar@gmail.com |
765b16a0dee464f61e5531adc5a6906ead05c8f6 | 087a8628bd9dc417b5395039fbcebd71f3a7da0e | /src/readList.java | 51882e6da318dee2335a3747cf7d3d71b4c257a5 | [] | no_license | poynt2005/TropUserReader | eac07340eff636e49e9d74c4674a9e069cbb0d7a | db1e8eb3799dec4ed4b98002f765d4be91c1d0f3 | refs/heads/master | 2020-03-19T02:15:33.194939 | 2018-06-01T15:45:57 | 2018-06-01T15:45:57 | 135,612,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,125 | java | import org.w3c.dom.*;
import javax.xml.parsers.*;
import java.io.*;
public class readList {
private String fileName;
private int trophyCounts;
private String[] trophyNames;
private String gameTitle;
private String gameId;
public readList() {
System.out.println("No input files!");
}
public readList(String fileName) {
this.fileName = fileName;
try {
this.openFile();
} catch (Exception e) {
System.out.println("Open File failed!");
}
}
private void openFile() throws Exception {
File F = new File(this.fileName);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); //get the DOM parser's factory instance
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); //get DOM parser
Document doc = dBuilder.parse(F);
doc.getDocumentElement().normalize();
NodeList trophyList = doc.getElementsByTagName("trophy"); //get trophy node nodelist
trophyCounts = trophyList.getLength(); //total counts of trophies
trophyNames = new String[trophyCounts];
for (int i = 0; i < trophyList.getLength(); i++) {
NodeList childNodes = trophyList.item(i).getChildNodes(); //get child node nodelist
for (int j = 0; j < childNodes.getLength(); j++) {
Node trophyNameNode = childNodes.item(j);
if (trophyNameNode.getNodeName() == "name") //if child node is "name"
trophyNames[i] = trophyNameNode.getTextContent(); //record the trophy name
}
}
//get game title and game id
NodeList gameName = doc.getElementsByTagName("title-name");
for (int i = 0; i < gameName.getLength(); i++) {
Node currentNode = gameName.item(i);
gameTitle = currentNode.getTextContent();
}
NodeList npcommid = doc.getElementsByTagName("npcommid");
for (int i = 0; i < npcommid.getLength(); i++) {
Node currentNode = npcommid.item(i);
gameId = currentNode.getTextContent();
}
}
public int getTrophyCounts() {
return this.trophyCounts;
}
public String[] gettrophyNames() {
return this.trophyNames;
}
public String getGameName(){
return this.gameTitle;
}
public String getGameId(){
return this.gameId;
}
}
| [
"poynt2010@hotmail.com"
] | poynt2010@hotmail.com |
a0bcbdc82f07f7e7ba17b1f355d42209aabbc752 | 874479d96ae427c4bd8c5604c623cb686732b4d6 | /app/src/main/java/com2027/housinghub/Models/Review.java | 1710eea1c37cc6dfecd05eb4e4a636973174e165 | [] | no_license | dp00405/HousingHub | 36531ade5e25bdff9f94635d013421b1c660ed0c | 1b33efc570850b7f4083c225f5cebdd3a99b945c | refs/heads/master | 2020-05-03T23:07:02.111014 | 2019-05-11T21:52:02 | 2019-05-11T21:52:02 | 178,857,800 | 0 | 0 | null | 2019-04-01T12:25:33 | 2019-04-01T12:25:33 | null | UTF-8 | Java | false | false | 1,097 | java | package com2027.housinghub.Models;
/**
* Review class that holds the stars and comments on landlords
*/
public class Review {
private String reviewId;
private int stars;
private String reviewTitle;
private String reviewDescription;
public Review(){
}
/**
*
* @param stars
* @param reviewTitle
* @param reviewDescription
*/
public Review (int stars, String reviewTitle, String reviewDescription){
this.stars =stars;
this.reviewTitle = reviewTitle;
this.reviewDescription = reviewDescription;
}
public String getReviewDescription() {
return reviewDescription;
}
public void setReviewDescription(String reviewDescription) {
this.reviewDescription = reviewDescription;
}
public String getReviewTitle() {
return reviewTitle;
}
public void setReviewTitle(String reviewTitle) {
this.reviewTitle = reviewTitle;
}
public int getStars() {
return stars;
}
public void setStars(int stars) {
this.stars = stars;
}
}
| [
"boowoghiri1@gmail.com"
] | boowoghiri1@gmail.com |
cabb7968e6610ba6882dacacf3dd91efd88c6ad7 | 88d3adf0d054afabe2bc16dc27d9e73adf2e7c61 | /io/src/test/java/org/vietspider/nlp/TestCharsIndexOf.java | dc0e04e0e823856eac9d540fad428715dab7466a | [
"Apache-2.0"
] | permissive | nntoan/vietspider | 5afc8d53653a1bb3fc2e20fb12a918ecf31fdcdc | 79d563afea3abd93f7fdff5bcecb5bac2162d622 | refs/heads/master | 2021-01-10T06:23:20.588974 | 2020-05-06T09:44:32 | 2020-05-06T09:44:32 | 54,641,132 | 0 | 2 | null | 2020-05-06T07:52:29 | 2016-03-24T12:45:02 | Java | UTF-8 | Java | false | false | 755 | java | /***************************************************************************
* Copyright 2001-2009 The VietSpider All rights reserved. *
**************************************************************************/
package org.vietspider.nlp;
import org.vietspider.chars.CharsUtil;
/**
* Author : Nhu Dinh Thuan
* nhudinhthuan@yahoo.com
* Sep 26, 2009
*/
public class TestCharsIndexOf {
public static void main(String[] args) {
char chars [] = " Bảo hành 12 tháng, giao hàng và lắp đặt miễn phí trong phạm vi thành phố Hồ Chí Minh. ".toCharArray();
char chars2 [] = "thành phố hồ chí minh".toCharArray();
System.out.println(CharsUtil.indexOfIgnoreCase(chars, chars2, 0));
}
}
| [
"nntoan@users.noreply.github.com"
] | nntoan@users.noreply.github.com |
6d9e3c9c5785494f7da1d68bdb3333ebd8c4277b | b41cb13676597d1586154e3419f3f50d9feb8dd8 | /src/test/java/pages/GoogleResultPage.java | 9f70f4016cacd86ec439feb5bb313195e10e658e | [] | no_license | VladislavRaa/web.qa.training2 | c87facdf55a6b4ace5a43884524ea8adb69d28c8 | 879a3326df4747d60819e926c4daa7839401a5d8 | refs/heads/master | 2020-04-04T21:16:53.801666 | 2018-11-18T23:58:08 | 2018-11-18T23:58:08 | 156,280,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,705 | java | package pages;
import app.Application;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.PageFactory;
public class GoogleResultPage extends Page {
public GoogleResultPage(WebDriver driver) {
super(driver);
PageFactory.initElements(driver, this);
}
public void clickSearchResultsByLinkContains(String link){
wait.until(d -> xpathSearcherByText(link).size() > 0);
xpathSearcherByText(link).get(0).click();
}
public void inputBySearchField(String value){
By searchField = By.name("q");
String testText = "Проба ввода текста";
/*демонстрация Actions
на поисковое поле устанавливаетя фокус
выполняется клик
с помощью сочетания клавиш CTRL+A+DELETE очищается содержимое поля
делее, заполняется поле новым значением
*/
Actions actions = new Actions(driver);
actions.moveToElement(driver.findElement(searchField))
.click()
.sendKeys(Keys.CONTROL + "a" + Keys.DELETE)
.sendKeys(testText)
.sendKeys(Keys.ENTER)
.perform();
//с полем input getText() не сработает, значение нужно явно забрать из атрибута value
wait.until(d -> d.findElement(searchField)
.getAttribute("value")
.equals(testText));
}
}
| [
"vladras97@yandex.ru"
] | vladras97@yandex.ru |
332de7ebc115eb5f43e73a4a4a4a406bc796067d | f83aed8911541ef9ef3da5f3c2199a9e6eee4572 | /app/src/main/java/io/reciteapp/recite/main/MainPresenter.java | 137a7aa3c251d6b3295a70ad1ad23b8d4c11ffd9 | [] | no_license | JohanAdam/Dagger2-Retrofit-Mvp | 2bf5950362b93dd8c71bd4b97beedd5aa66d164d | 42bc5e8b4346d349275477e2e930942aba44c962 | refs/heads/master | 2021-10-23T09:06:17.066114 | 2019-03-16T11:19:13 | 2019-03-16T11:19:13 | 175,961,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,639 | java | package io.reciteapp.recite.main;
import android.text.TextUtils;
import io.reciteapp.recite.constants.Constants;
import io.reciteapp.recite.R;
import io.reciteapp.recite.data.networking.NetworkCallWrapper;
import io.reciteapp.recite.data.networking.call.CouponCall.PostCouponCallback;
import io.reciteapp.recite.data.networking.call.ReferralCall.PatchReferralCodeCallback;
import io.reciteapp.recite.data.networking.call.UserProfileCall.GetUserProfileResponseCallback;
import io.reciteapp.recite.main.MainContract.Model;
import io.reciteapp.recite.main.MainContract.Presenter;
import io.reciteapp.recite.main.MainContract.View;
import io.reciteapp.recite.data.model.CouponResponse;
import io.reciteapp.recite.data.model.UserProfileResponse;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import rx.Subscription;
import rx.subscriptions.CompositeSubscription;
import timber.log.Timber;
public class MainPresenter implements Presenter {
private View view;
private MainContract.Model model;
private NetworkCallWrapper service;
private CompositeSubscription subscriptions;
public MainPresenter(Model model) {
this.subscriptions = new CompositeSubscription();
this.model = model;
}
@Override
public void setView(View view, NetworkCallWrapper service) {
this.view = view;
this.service = service;
}
/**
* Check for view after a network call to avoid view null when result return from call
* @return true for view is attach, false for view is null
*/
private boolean isViewAttached() {
return view != null;
}
//Get resources drawable item by sending position
@Override
public int getDrawerItemIcon(int position) {
switch (position) {
case 1:
return R.drawable.ic_reffral;
case 2:
return R.drawable.ic_redemption;
case 3:
return R.drawable.ic_reload;
case 4:
return R.drawable.ic_reviewer_test;
case 5:
return R.drawable.ic_settings;
case 6:
return R.drawable.ic_quick_start;
case 7:
return R.drawable.ic_share;
case 8:
return R.drawable.ic_about;
}
return R.drawable.ic_verse_id;
}
//Get title of drawer item by sending position
@Override
public int getDrawerItemTitle(int position) {
switch (position) {
case 1:
return R.string.title_referral;
case 2:
return R.string.title_redemption;
case 3:
return R.string.title_reload;
case 4:
return R.string.title_reviewer_test;
case 5:
return R.string.title_settings;
case 6:
return R.string.title_quick_start;
case 7:
return R.string.title_share;
case 8:
return R.string.title_about;
}
return R.string.app_name;
}
// > processReferral > checkUserProfile > patchReferralCodeToUserProfile
// > showEnrollDialog > checkUserProfile > patchReferralCodeToUserProfile
@Override
public void processReferral(String refCode) {
String json = model.getEnrollList();
try {
List<String> enrollList = jsonStringToArray(json);
Timber.d("enrollList is %s", enrollList);
if (enrollList != null && !enrollList.isEmpty()) {
if (enrollList.contains(refCode)) {
if (isViewAttached()) {
view.showEnrollDialog(refCode);
}
} else {
patchReferralCodeToUserProfile(refCode);
}
} else {
patchReferralCodeToUserProfile(refCode);
}
} catch (JSONException e) {
e.printStackTrace();
patchReferralCodeToUserProfile(refCode);
}
}
@Override
public void patchReferralCodeToUserProfile(String refCode) {
view.showLoadingDialog();
//check for referral code is available in server or not
checkReferralCodeInUserProfile(new CheckReferralCodeCallback() {
@Override
public void onResult(boolean referralCodeAvailable) {
if (referralCodeAvailable) {
//if available , just update the view
if (isViewAttached()){
view.removeLoadingDialog();
view.showErrorDialog(Constants.RESPONSE_CODE_ACCOUNT_ALREADY_HAS_REFERRAL_CODE, false);
}
} else {
//if not available , patch the referral code to server
String token = model.getToken();
Subscription subscription = service.patchReferralCode(token, refCode, new PatchReferralCodeCallback() {
@Override
public void onSuccess(String result) {
if (isViewAttached()){
model.setReferralCode(refCode);
view.removeLoadingDialog();
}
}
@Override
public void onError(int responseCode) {
if (isViewAttached()){
view.removeLoadingDialog();
view.showErrorDialog(responseCode, false);
}
}
});
subscriptions.add(subscription);
}
}
});
}
@Override
public void processCoupon(String coupon) {
view.showLoadingDialog();
String token = model.getToken();
Subscription subscription = service.postCouponCode(token, coupon, new PostCouponCallback() {
@Override
public void onSuccess(CouponResponse response) {
if (isViewAttached()) {
view.removeLoadingDialog();
if (response.getResponse() == Constants.RESPONSE_CODE_SUCCESS) {
//Code redeem success
//refresh
view.openFirstViewFragment(Constants.TAG_MAIN_FRAGMENT, null,null);
//show Sponsor dialog
view.showSponsorDialog(response.getCouponMessage(),
response.getCouponImage(),
response.getCouponUrl(),
true);
} else if (response.getResponse() == Constants.RESPONSE_CODE_CODE_USED) {
//Code has been used
view.showErrorDialog(Constants.RESPONSE_CODE_CODE_USED, false);
} else if (response.getResponse() == Constants.RESPONSE_CODE_CODE_EXPIRED) {
//Code has expired
view.showErrorDialog(Constants.RESPONSE_CODE_CODE_EXPIRED, false);
} else {
view.showErrorDialog(Constants.RESPONSE_CODE_FAILED, false);
}
}
}
@Override
public void onError(int responseCode) {
if (isViewAttached()) {
view.removeLoadingDialog();
if (responseCode == Constants.RESPONSE_CODE_NO_INTERNET) {
view.showSnackBar(R.string.error_no_connection);
} else {
view.showErrorDialog(responseCode, false);
}
}
}
});
subscriptions.add(subscription);
}
private List<String> jsonStringToArray(String jsonString) throws JSONException {
List<String> stringArray = new ArrayList<String>();
JSONArray jsonArray = new JSONArray(jsonString);
for (int i = 0; i < jsonArray.length(); i++) {
stringArray.add(jsonArray.getString(i));
}
return stringArray;
}
@Override
public void checkBundle(boolean isError, String errorText,
String fragment,
String surahName,
String ayatId) {
if (isError && !TextUtils.isEmpty(errorText)) {
//true , popup error
//Authentication error
view.showErrorDialog(Constants.RESPONSE_CODE_UNAUTHORIZED, false);
}
//If fragment is null, open dashboard
//If fragment is contain HistoryTag, open history
if (!TextUtils.isEmpty(fragment)) {
if (fragment.equals(Constants.OPEN_FRAGMENT_HISTORY)) {
//Open fragment History List (
view.openFirstViewFragment(fragment, surahName, ayatId);
} else {
//Open fragment Submission List (New Submission)
view.openFirstViewFragment(fragment, null, null);
}
} else {
view.openFirstViewFragment(Constants.TAG_MAIN_FRAGMENT, null, null);
}
}
@Override
public boolean getCsStatus() {
return model.getCsStatus();
}
@Override
public void checkFirstUser() {
if (model.getFirstUser()) {
openQuickActivity();
}
}
/**
* Check onResume activity
* if not login, send fragment to dashboard / refresh dashboard component
*/
@Override
public void checkLogin() {
if (!model.getLoginStatus()) {
view.openFirstViewFragment(Constants.TAG_MAIN_FRAGMENT, null, null);
}
}
@Override
public void openQuickActivity() {
if (model.getCsStatus()) {
view.openQuickStartCsActivity();
} else {
view.openQuickStartActivity();
}
}
private interface CheckReferralCodeCallback {
void onResult(boolean referralCodeAvailable);
}
//Check User Profile before submitting referral code
private void checkReferralCodeInUserProfile(CheckReferralCodeCallback callback) {
String token = model.getToken();
Subscription subscription = service.getUserProfile(token,
new GetUserProfileResponseCallback() {
@Override
public void onSuccess(ArrayList<UserProfileResponse> result) {
//From result check is userprofile already have referral code or not
if (isViewAttached()) {
for (UserProfileResponse userProfileResponse : result) {
if (!TextUtils.isEmpty(userProfileResponse.getReferralCode())) {
//if referral code is available
callback.onResult(true);
} else {
//if referral code empty
callback.onResult(false);
}
}
}
}
@Override
public void onError(int responseCode) {
if (isViewAttached()) {
callback.onResult(false);
}
}
});
subscriptions.add(subscription);
}
@Override
public void unSubscribe() {
subscriptions.unsubscribe();
view = null;
}
/**
* Logout button function
*/
@Override
public void logoutFunction() {
if (model.getLoginStatus()) {
//login
view.logout();
} else {
//logout
view.openLoginActivity();
}
}
/**
* Return title resource for log item based on user state
* @return Title resource
*/
@Override
public int getLogItemTitle() {
if (model.getLoginStatus()) {
return R.string.title_logout;
} else {
return R.string.title_login;
}
}
@Override
public void logout() {
// AzureServiceAdapter.getInstance().logout();
model.logout();
if (isViewAttached()) {
view.updateLogItem();
}
}
}
| [
"johan@thelorry.com"
] | johan@thelorry.com |
a5e6f4d8f0e04e1098b6f6ff22b66187874c7c3e | f0603db8eb1ae79a9b5b5d36a4aebe838e271289 | /erasmus/src/main/java/es/udc/fic/erasmus/account/Account.java | 9e12351396869d1e342bd2e2fb6a751889d08084 | [] | no_license | miguelSande/ErasmusApp | 50ce616cc5d734989cd74003b7ef4bf9e70a5359 | dc104fc534ace9dcaadcaab606e8f47cce563995 | refs/heads/master | 2021-01-01T15:58:19.402116 | 2018-07-10T15:29:07 | 2018-07-10T15:29:07 | 97,747,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,135 | java | package es.udc.fic.erasmus.account;
import java.time.ZonedDateTime;
import javax.persistence.*;
import java.time.Instant;
import com.fasterxml.jackson.annotation.JsonIgnore;
@SuppressWarnings("serial")
@Entity
@Table(name = "account")
public class Account implements java.io.Serializable {
@Id
@GeneratedValue
private Long id;
@Column(unique = true)
private String email;
@JsonIgnore
private String password;
private String role = "ROLE_USER";
private Instant created;
protected Account() {
}
public Account(String email, String password, String role) {
this.email = email;
this.password = password;
this.role = role;
this.created = Instant.now();
}
public Long getId() {
return id;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public Instant getCreated() {
return created;
}
}
| [
"miguel.sande@udc.es"
] | miguel.sande@udc.es |
0c6080bf84fe518ffa15a6a45e061fb0fa566e90 | c8604b0c7a4187ec8c84246dbb5412a7ea772577 | /src/main/java/com/utsab/configurations/DropwizardBasicConfiguration.java | bacf336e0f3e536ffdf735590e217404afd2c531 | [] | no_license | utsab-banerjee/dropwizard-basic | e64df4d5300832facd7c31b7573c1e00a1fc37a6 | 26cf19be3372c06a91651a83ea9674c7b14b2401 | refs/heads/master | 2021-06-21T20:48:43.679992 | 2017-08-14T16:57:58 | 2017-08-14T16:57:58 | 100,289,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package com.utsab.configurations;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.db.DataSourceFactory;
import lombok.Data;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
/**
* Created by utsab.banerjee on 11/08/17.
*/
@Data
public class DropwizardBasicConfiguration extends Configuration {
@Valid
@NotNull
@JsonProperty
private DataSourceFactory applicationDatabase;
}
| [
"utsab.banerjee@flipkart.com"
] | utsab.banerjee@flipkart.com |
ac8bd02fec37f06f5492b59e98debdce830f91fa | 8a844225884617d3d67f35105d4692769903d5bc | /src/org/bm/checker/Checker.java | b97d440737f3eb6962eee07631a4a5904e48f921 | [] | no_license | morinb/java-checker | 40ff07e108673de80298e1f111a9b6040fb335d0 | 8328e269ebea69ca51da37c3b87ae49e1b1df0d8 | refs/heads/master | 2016-09-05T16:29:18.490967 | 2012-12-14T14:18:18 | 2012-12-14T14:18:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | package org.bm.checker;
import java.util.LinkedList;
import java.util.List;
/**
*
* @author 408658
*
* @param <T> Type against which the checks are done.
* @param <E> Type of the error object generated by the checks.
*/
public class Checker<T, E> {
private final List<DataChecker<T, E>> checkers;
private final List<CheckError<E>> errors;
private Checker() {
checkers = new LinkedList<DataChecker<T, E>>();
errors = new LinkedList<CheckError<E>>();
}
public static <T, E> Checker<T, E> get() {
return new Checker<T, E>();
}
public Checker<T, E> addChecker(DataChecker<T, E> checker) {
checkers.add(checker);
return this;
}
public List<CheckError<E>> check(DataGetter<T> getter) {
T get = getter.get();
for (DataChecker<T, E> checker : checkers) {
CheckError<E> error = checker.check(get);
if (null != error) {
errors.add(error);
}
}
return errors;
}
}
| [
"morinb@server"
] | morinb@server |
4cdb48e6ebe337fb3915854c89e8905897be1d7f | 618a2515b015727c46cf8fad1d21c5af200433f1 | /src/main/java/br/tinnova/execicio2/application/Aplicacao.java | 126fef0eace15f28bf91092548c9c342f52e895e | [] | no_license | victoremerick/tinnova | c3c9111cb81e585b33d3ffa756ab72107e6a678c | 25509dc6180beaf1d32d5ad472e6a89eb967e354 | refs/heads/main | 2023-07-15T06:01:19.953044 | 2021-08-30T05:16:55 | 2021-08-30T05:16:55 | 400,852,815 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 721 | java | package br.tinnova.execicio2.application;
import java.util.Scanner;
import br.tinnova.execicio2.application.utils.AlgoritmosOrdenacao;
import br.tinnova.execicio2.view.ViewExercicio2;
/**
* @author Emerick
*
* A classe Aplicacao é a camada de aplicação do sistema, onde tem-se o controle geral
* da aplicação.
*
*/
public class Aplicacao {
private final static Scanner scanner = new Scanner(System.in);
/**
* Inicia a aplicação.
*/
public static void start() {
ViewExercicio2 view = new ViewExercicio2(scanner);
do {
int quantity = view.getQuantity();
int[] array = view.getArray(quantity);
AlgoritmosOrdenacao.bubbleSort(array);
view.showArray(array);
}while(view.sair());
}
}
| [
"emerick_machado@hotmail.com"
] | emerick_machado@hotmail.com |
1fb59aba249a64487fa734db21de5d9177c84f0b | 16d56c5912598b6d28760619e15ec1a827487b50 | /src/com/me/Main.java | 577b5e90579b492e857e8feca056f2664ede1018 | [] | no_license | patrickatcw/JavaArraysSortingIntsAscending | a5359a301ed71deb8ba5c81c2d3c4c262d2e13d8 | 4370ccc6ffb956b658d26d2a9a7d0ca1f5bcbb82 | refs/heads/master | 2021-04-27T00:20:49.243672 | 2018-03-05T15:26:30 | 2018-03-05T15:26:30 | 123,797,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,718 | java | package com.me;
//directions
/*
- create a program using arrays that sort a list of integers in ascending order
- set up the program so that the numbers to sort are read in from the keyboard
- implement the following methods - getIntegers, printArray, and sortIntegers
- getIntegers returns an array of entered integers from keyboard
- printArray prints out the contents of the array
and sortIntegers should sort the array and return a new array containing the sorted numbers
-you will have to figure out how to copy the array elements from the passed array into a new
array and sort them and return the new sorted array
*/
//step 1
import java.util.Scanner;
public class Main {
//step 1
private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
//step 2 create int array
int[] myIntegers = getIntegers(5);
//step 9 after method 6 sortIntegers
int[] sorted = sortIntegers(myIntegers);
printArray(sorted); //then run
}
//step 3 method to get ints, from step 2
public static int[] getIntegers(int capacity) { //parameter in method name
int[] array = new int[capacity]; //defining our array, not capacity
//the message displayed when initiate program
System.out.println("Enter " + capacity + " integer values: \r"); //r is for input in console
for (int i = 0; i < array.length; i++) { //looping through array
array[i] = scanner.nextInt(); //for console input
}
//step 4 return array step 2, step 3
return array;
}
//step 5 next create print array method, accept array and printout contents
//for step 2, step 3, step 4
public static void printArray(int[] array) {
for (int i = 0; i < array.length; i++) { //looping through to print array
System.out.println("Element " + i + " contents " + array[i]);
}
}
//step 6 method for sorting, creates a copy of array passed to a sorted array
public static int[] sortIntegers(int[] array) {//passing the unsorted array
int[] sortedArray = new int[array.length]; //creating an array that is same size as array that has been passed
for (int i = 0; i < array.length; i++) { //loops through to put values in
sortedArray[i] = array[i]; //creates new sorted array
}
//this takes a copy of the array with the right length and automatically makes a new array called
//sortedArray for us
//step 7 while loop to actually sort the array
boolean flag = true; //set boolean to true
int temp; //stores num temporarily
while (flag) {
flag = false; //continue while loop if only assigned flag to true
//checking code
//loop will continue only after all have been sorted in order desired
for (int i = 0; i < sortedArray.length - 1; i++) {
if (sortedArray[i] > sortedArray[i + 1]) { //swapping ints, ***important for order
temp = sortedArray[i]; //stores current value of sorted array temporarily
sortedArray[i] = sortedArray[i + 1];
sortedArray[i + 1] = temp;
flag = true; //while loop will continue processing until false
//then exist out
}
}
}
//step 8 return
return sortedArray;
}
}
//example results;
/*
Enter 5 integer values:
9
8
7
6
5
Element 0 contents 5
Element 1 contents 6
Element 2 contents 7
Element 3 contents 8
Element 4 contents 9
*/
| [
"pj8392@yahoo.com"
] | pj8392@yahoo.com |
2a6175e07f16bf3006f89300adf78265e99874ba | 9da4c3936258193a3868edfb6300f3e0f837387f | /djikstra/Djikstra.java | 4e0445754f69743943c1a226f913d5744f73f0a3 | [] | no_license | Dumtard/Algorithms-Project | 65908fa814f5b6cc68c2bff97cb0a20edbdd4148 | 5d924beccfa2105b41c0f1997f0651f37a19a06a | refs/heads/master | 2020-04-04T13:23:48.861484 | 2012-12-04T06:00:46 | 2012-12-04T06:00:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,440 | java | import java.util.*;
public class Djikstra {
public Djikstra() {}
public Vector<Edge> calculate (Vector<Node> nodes, Vector<Edge> edges, Node start, Node end) {
Vector<Node> n = new Vector<Node>();
n.add(start);
do {
Vector<Node> n2 = new Vector<Node>();//node to update dist, and path to.
Vector<Node> newNodes = new Vector<Node>();//current nodes being checked for new paths
for (int i = 0; i < edges.size(); i++) {//go through all edges
if (n.contains(edges.get(i).From)) {//if the edge is connected to a node being checked
Node n3 = nodes.get(nodes.indexOf(edges.get(i).To));//set n3 to be the destination of this path
if (edges.get(i).Weight < n3.dist) {//if the new path is shorter
n3.dist = edges.get(i).Weight + edges.get(i).From.dist;//update the path with the new values
n3.path = new Vector<Edge>();
for (int j = 0; j < edges.get(i).From.path.size(); j++) {
n3.path.add(edges.get(i).From.path.get(j));//update the path of the newly connected intersection
}
n3.path.add(edges.get(i));
newNodes.add(n3);//add this newly connected intersection the list being checked
}
}
}
n = newNodes;
} while (end.dist == 99999);
//for (int i = 0; i < end.path.size(); i++) {
// System.out.println(end.path.get(i).From.x + "\t" + end.path.get(i).From.y + "\t" + end.path.get(i).To.x + "\t" + end.path.get(i).To.y);
//}
return end.path;
}
}
| [
"thekokiri.swordsman@gmail.com"
] | thekokiri.swordsman@gmail.com |
98e8b9bfac80a5eb042427ae8db18e326667f7e5 | 0197c673ca286d0eb444a6bd8df92b73805cbbc7 | /app/src/androidTest/java/com/example/manuelseguranavarro/eltiempo/data/TestUtilities.java | dbd5df789b6b1b904e6da6712df156f86407ce4c | [] | no_license | msegura1979/ElTiempo | 115ccf8555ee73edb6bd1d976fe16f7f05989564 | 5d3c429c0aea764028802dd5a230528f4d0af6d8 | refs/heads/master | 2021-01-10T06:14:13.918900 | 2015-12-27T19:42:11 | 2015-12-27T19:42:11 | 48,657,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,484 | java | package com.example.manuelseguranavarro.eltiempo.data;
import android.content.ContentValues;
import android.content.Context;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.os.Handler;
import android.os.HandlerThread;
import android.test.AndroidTestCase;
import com.example.manuelseguranavarro.eltiempo.utils.PollingCheck;
import java.util.Map;
import java.util.Set;
/*
Students: These are functions and some test data to make it easier to test your database and
Content Provider. Note that you'll want your WeatherContract class to exactly match the one
in our solution to use these as-given.
*/
public class TestUtilities extends AndroidTestCase {
static final String TEST_LOCATION = "99705";
static final long TEST_DATE = 1419033600L; // December 20th, 2014
static void validateCursor(String error, Cursor valueCursor, ContentValues expectedValues) {
assertTrue("Empty cursor returned. " + error, valueCursor.moveToFirst());
validateCurrentRecord(error, valueCursor, expectedValues);
valueCursor.close();
}
static void validateCurrentRecord(String error, Cursor valueCursor, ContentValues expectedValues) {
Set<Map.Entry<String, Object>> valueSet = expectedValues.valueSet();
for (Map.Entry<String, Object> entry : valueSet) {
String columnName = entry.getKey();
int idx = valueCursor.getColumnIndex(columnName);
assertFalse("Column '" + columnName + "' not found. " + error, idx == -1);
String expectedValue = entry.getValue().toString();
assertEquals("Value '" + entry.getValue().toString() +
"' did not match the expected value '" +
expectedValue + "'. " + error, expectedValue, valueCursor.getString(idx));
}
}
/*
Students: Use this to create some default weather values for your database tests.
*/
static ContentValues createWeatherValues(long locationRowId) {
ContentValues weatherValues = new ContentValues();
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_LOC_KEY, locationRowId);
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_DATE, TEST_DATE);
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_DEGREES, 1.1);
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_HUMIDITY, 1.2);
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_PRESSURE, 1.3);
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_MAX_TEMP, 75);
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_MIN_TEMP, 65);
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_SHORT_DESC, "Asteroids");
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_WIND_SPEED, 5.5);
weatherValues.put(WeatherContract.WeatherEntry.COLUMN_WEATHER_ID, 321);
return weatherValues;
}
/*
Students: You can uncomment this helper function once you have finished creating the
LocationEntry part of the WeatherContract.
*/
static ContentValues createNorthPoleLocationValues() {
// Create a new map of values, where column names are the keys
ContentValues testValues = new ContentValues();
testValues.put(WeatherContract.LocationEntry.COLUMN_LOCATION_SETTING, TEST_LOCATION);
testValues.put(WeatherContract.LocationEntry.COLUMN_CITY_NAME, "North Pole");
testValues.put(WeatherContract.LocationEntry.COLUMN_COORD_LAT, 64.7488);
testValues.put(WeatherContract.LocationEntry.COLUMN_COORD_LONG, -147.353);
return testValues;
}
/*
Students: You can uncomment this function once you have finished creating the
LocationEntry part of the WeatherContract as well as the WeatherDbHelper.
*/
static long insertNorthPoleLocationValues(Context context) {
// insert our test records into the database
WeatherDbHelper dbHelper = new WeatherDbHelper(context);
SQLiteDatabase db = dbHelper.getWritableDatabase();
ContentValues testValues = TestUtilities.createNorthPoleLocationValues();
long locationRowId;
locationRowId = db.insert(WeatherContract.LocationEntry.TABLE_NAME, null, testValues);
// Verify we got a row back.
assertTrue("Error: Failure to insert North Pole Location Values", locationRowId != -1);
return locationRowId;
}
/*
Students: The functions we provide inside of TestProvider use this utility class to test
the ContentObserver callbacks using the PollingCheck class that we grabbed from the Android
CTS tests.
Note that this only tests that the onChange function is called; it does not test that the
correct Uri is returned.
*/
static class TestContentObserver extends ContentObserver {
final HandlerThread mHT;
boolean mContentChanged;
static TestContentObserver getTestContentObserver() {
HandlerThread ht = new HandlerThread("ContentObserverThread");
ht.start();
return new TestContentObserver(ht);
}
private TestContentObserver(HandlerThread ht) {
super(new Handler(ht.getLooper()));
mHT = ht;
}
// On earlier versions of Android, this onChange method is called
@Override
public void onChange(boolean selfChange) {
onChange(selfChange, null);
}
@Override
public void onChange(boolean selfChange, Uri uri) {
mContentChanged = true;
}
public void waitForNotificationOrFail() {
// Note: The PollingCheck class is taken from the Android CTS (Compatibility Test Suite).
// It's useful to look at the Android CTS source for ideas on how to test your Android
// applications. The reason that PollingCheck works is that, by default, the JUnit
// testing framework is not running on the main Android application thread.
new PollingCheck(5000) {
@Override
protected boolean check() {
return mContentChanged;
}
}.run();
mHT.quit();
}
}
static TestContentObserver getTestContentObserver() {
return TestContentObserver.getTestContentObserver();
}
}
| [
"m.segura.navarro@gmail.com"
] | m.segura.navarro@gmail.com |
4019a25258e95252cf32e1fee3adc5097b70d57a | 070bb4161ff4948f1f3afa8c7b4efcfac8ba4ce9 | /app/src/main/java/com/example/covidselfcareapp/login.java | 6be916eb3ddcee210255d8ddeea4d268ad2c6227 | [] | no_license | Dvenkateshprasad/cs251Project2 | 0bcf6c59b974826bc5f60d203f523e7ff15a47d2 | 2b0cb8cf94c78def6c5610565b19041858ac261b | refs/heads/main | 2023-08-23T06:50:32.688025 | 2021-10-21T08:38:42 | 2021-10-21T08:38:42 | 418,888,055 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,076 | java | package com.example.covidselfcareapp;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.util.Patterns;
import android.view.View;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
public class login extends AppCompatActivity {
EditText loginname,password;
TextView registerdirect;
ProgressBar progressBar;
FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
loginname = findViewById(R.id.loginName);
password = findViewById(R.id.loginPassword);
mAuth = FirebaseAuth.getInstance();
progressBar = findViewById(R.id.progressBar2);
registerdirect = findViewById(R.id.registerDirect);
registerdirect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getApplicationContext(),Register.class));
finish();
}
});
}
public void loginBtnClick(View v){
String username = loginname.getText().toString().trim();
String Password = password.getText().toString().trim();
if(!Patterns.EMAIL_ADDRESS.matcher(username).matches()){
loginname.setError("Please enter a valid email");
loginname.requestFocus();
}
if(Password.length()<6){
password.setError("password should be atleast six characters");
password.requestFocus();
}
progressBar.setVisibility(View.VISIBLE);
mAuth.signInWithEmailAndPassword(username,Password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
Toast.makeText(login.this,"logged in successfully",Toast.LENGTH_LONG).show();
Intent intent = new Intent(login.this,tabbed.class);
startActivity(intent);
progressBar.setVisibility(View.GONE);
}
else{
Toast.makeText(login.this,"user credientials not valid",Toast.LENGTH_LONG).show();
progressBar.setVisibility(View.GONE);
}
}
});
}
} | [
"vp28022003@gmail.com"
] | vp28022003@gmail.com |
a810bb70f9ef502ee9a7e63098d191163a76ce63 | ede99208a4a6813953ac777c7c94186c2a673f90 | /app/src/main/java/com/ibeef/cowboying/view/activity/ViewPagerActivity.java | 4a46c5b8c91ef7e89496ce6373416e86ff5cbdd3 | [] | no_license | L864741831/Cowboying | 67e41e3f742d85a1a9a48cdda27cc5de459b253e | 8d5863f4ddd13281e0d1b18b0e627734b4d90a05 | refs/heads/master | 2020-04-28T09:02:15.682811 | 2019-01-16T02:27:43 | 2019-01-16T02:27:43 | 175,151,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,143 | java | package com.ibeef.cowboying.view.activity;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.github.chrisbanes.photoview.PhotoView;
import com.ibeef.cowboying.R;
import com.ibeef.cowboying.application.CowboyingApplication;
import com.ibeef.cowboying.bean.OfflineStoreInfoResultBean;
import com.ibeef.cowboying.config.Constant;
import com.ibeef.cowboying.view.customview.HackyViewPager;
import butterknife.Bind;
import butterknife.ButterKnife;
public class ViewPagerActivity extends AppCompatActivity {
@Bind(R.id.view_pager)
HackyViewPager viewPager;
@Bind(R.id.rvs_id)
RelativeLayout rvsId;
@Bind(R.id.back_id)
ImageView back_id;
private static int index=0;
private OfflineStoreInfoResultBean info;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_pager);
ButterKnife.bind(this);
info= (OfflineStoreInfoResultBean) getIntent().getSerializableExtra("info");
viewPager.setAdapter(new SamplePagerAdapter());
index=getIntent().getIntExtra("index",0);
viewPager.setCurrentItem(index);
rvsId.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
back_id.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
private class SamplePagerAdapter extends PagerAdapter {
@Override
public int getCount() {
return info.getBizData().getStoreImages().size();
}
@Override
public View instantiateItem(ViewGroup container, int position) {
PhotoView photoView = new PhotoView(container.getContext());
photoView.setScaleType(ImageView.ScaleType.CENTER_CROP);
RequestOptions options = new RequestOptions()
.skipMemoryCache(true)
.error(R.mipmap.jzsb)
//跳过内存缓存
;
Glide.with(CowboyingApplication.getInstance()).load(Constant.imageDomain+info.getBizData().getStoreImages().get(position)).apply(options).into(photoView);
// Now just add PhotoView to ViewPager and return it
container.addView(photoView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
return photoView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
}
}
| [
"lwang057@163.com"
] | lwang057@163.com |
51e1df1f8cb5224c1b71958c4ddf4f16c3e92f49 | 75051369ad4d90e91a4862e96796d8cb4368629b | /src/main/java/ids/sharklite/jprocess/base/BaseUserDao.java | 81cd58a62cffa5317d4c9673f9ea0bd0a79a05a9 | [] | no_license | sharklite/JProcess | dde80dc19a806b6c21dfccddf38d3164aa90ca71 | 6b20b7733940d6363bd805a48565b764303b2e00 | refs/heads/master | 2020-05-15T03:01:53.432347 | 2019-04-28T02:09:32 | 2019-04-28T02:09:32 | 182,059,981 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package ids.sharklite.jprocess.base;
import ids.sharklite.jprocess.entity.AbstractUser;
import java.util.Collection;
public abstract class BaseUserDao<E extends AbstractUser> extends BaseDao<E> {
@Override
public void deleteById(String id) {
this.executeUpdate("update " + this.getTableName() + " set deleted=1 where id=?", id);
}
@Deprecated
@Override
public void delete(E e) {
}
@Deprecated
@Override
public void delete(Collection<E> e) {
}
public void deleteReally(String userId) {
this.executeUpdate("delete from " + this.getTableName() + " where id=?", userId);
}
}
| [
"wu.honway@gmail.com"
] | wu.honway@gmail.com |
dded8d7bae67fcc5bffe04aa1d13823457407cb6 | 0e68a2f0244aee4f532e3bb860731a08fd9899c6 | /src/main/java/org/datanucleus/store/rdbms/mapping/column/NCharColumnMapping.java | e3131fb1622f3ee36871dc0d51df753f08cd42bf | [
"Apache-2.0"
] | permissive | aihuaxu/datanucleus-rdbms | b90b320f710550ed07506f348d701b14868e0bf5 | a23813ec080a851c74442dfe337141cb81ddc38b | refs/heads/master | 2020-03-19T22:55:30.814539 | 2018-06-11T22:13:18 | 2018-06-11T22:57:36 | 136,986,426 | 0 | 0 | null | 2018-06-11T22:11:28 | 2018-06-11T22:11:28 | null | UTF-8 | Java | false | false | 15,169 | java | /**********************************************************************
Copyright (c) 2010 Andy Jefferson and others. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Contributors:
...
**********************************************************************/
package org.datanucleus.store.rdbms.mapping.column;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import java.text.ParseException;
import java.util.Calendar;
import org.datanucleus.ClassNameConstants;
import org.datanucleus.exceptions.NucleusDataStoreException;
import org.datanucleus.exceptions.NucleusUserException;
import org.datanucleus.metadata.JdbcType;
import org.datanucleus.store.rdbms.exceptions.NullValueException;
import org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping;
import org.datanucleus.store.rdbms.RDBMSPropertyNames;
import org.datanucleus.store.rdbms.RDBMSStoreManager;
import org.datanucleus.store.rdbms.adapter.DatastoreAdapter;
import org.datanucleus.store.rdbms.table.Column;
import org.datanucleus.util.Localiser;
import org.datanucleus.util.NucleusLogger;
import org.datanucleus.util.TypeConversionHelper;
/**
* Mapping of a NCHAR column.
* Copied from CharColumnMapping but uses setNString/getNString instead of setString/getString.
*/
public class NCharColumnMapping extends CharColumnMapping
{
public NCharColumnMapping(JavaTypeMapping mapping, RDBMSStoreManager storeMgr, Column col)
{
super(mapping, storeMgr, col);
}
public int getJDBCType()
{
return Types.NCHAR;
}
/**
* Method to set a character at the specified position in the JDBC PreparedStatement.
* @param ps The PreparedStatement
* @param param Parameter position
* @param value The value to set
*/
public void setChar(PreparedStatement ps, int param, char value)
{
try
{
if (value == Character.UNASSIGNED &&
!getDatastoreAdapter().supportsOption(DatastoreAdapter.PERSIST_OF_UNASSIGNED_CHAR))
{
// Some datastores (e.g Postgresql) dont allow persistence of 0x0 ("\0") so use a space
value = ' ';
NucleusLogger.DATASTORE.warn(Localiser.msg("055008"));
}
ps.setNString(param, Character.valueOf(value).toString());
}
catch (SQLException e)
{
throw new NucleusDataStoreException(Localiser.msg("055001", "char",
"" + value, column, e.getMessage()), e);
}
}
/**
* Method to extract a character from the ResultSet at the specified position
* @param rs The Result Set
* @param param The parameter position
* @return the character
*/
public char getChar(ResultSet rs, int param)
{
char value;
try
{
value = rs.getNString(param).charAt(0);
}
catch (SQLException e)
{
throw new NucleusDataStoreException(Localiser.msg("055002","char","" + param, column, e.getMessage()), e);
}
return value;
}
/**
* Method to set a String at the specified position in the JDBC PreparedStatement.
* @param ps The PreparedStatement
* @param param Parameter position
* @param value The value to set
*/
public void setString(PreparedStatement ps, int param, String value)
{
try
{
if (value == null)
{
// Null string
if (useDefaultWhenNull())
{
ps.setNString(param,column.getDefaultValue().toString().trim());
}
else
{
ps.setNull(param, getJDBCType());
}
}
else if (value.length() == 0)
{
// Empty string
if (storeMgr.getBooleanProperty(RDBMSPropertyNames.PROPERTY_RDBMS_PERSIST_EMPTY_STRING_AS_NULL))
{
// Persist as null
ps.setNString(param, null);
}
else
{
if (getDatastoreAdapter().supportsOption(DatastoreAdapter.NULL_EQUALS_EMPTY_STRING))
{
// Datastore doesnt support empty string so use special character
value = getDatastoreAdapter().getSurrogateForEmptyStrings();
}
ps.setNString(param, value);
}
}
else
{
if (column != null) // Column could be null if we have a query of something like an "enumClass.value"
{
Integer colLength = column.getColumnMetaData().getLength();
if (colLength != null && colLength.intValue() < value.length())
{
// Data in field exceeds datastore column, so take required action
String action = storeMgr.getStringProperty(RDBMSPropertyNames.PROPERTY_RDBMS_STRING_LENGTH_EXCEEDED_ACTION);
if (action.equals("EXCEPTION"))
{
throw new NucleusUserException(Localiser.msg("055007",
value, column.getIdentifier().toString(), "" + colLength.intValue())).setFatal();
}
else if (action.equals("TRUNCATE"))
{
value = value.substring(0, colLength.intValue());
}
}
}
ps.setNString(param, value);
}
}
catch (SQLException e)
{
throw new NucleusDataStoreException(Localiser.msg("055001","String","" + value, column, e.getMessage()), e);
}
}
/**
* Method to extract a String from the ResultSet at the specified position
* @param rs The Result Set
* @param param The parameter position
* @return the String
*/
public String getString(ResultSet rs, int param)
{
try
{
String value = rs.getNString(param);
if (value == null)
{
return value;
}
else if (getDatastoreAdapter().supportsOption(DatastoreAdapter.NULL_EQUALS_EMPTY_STRING) &&
value.equals(getDatastoreAdapter().getSurrogateForEmptyStrings()))
{
// Special character symbolizing empty string
return "";
}
else
{
if (column.getJdbcType() == JdbcType.CHAR && getDatastoreAdapter().supportsOption(DatastoreAdapter.CHAR_COLUMNS_PADDED_WITH_SPACES))
{
// String has likely been padded with spaces at the end by the datastore so trim trailing whitespace
int numPaddingChars = 0;
for (int i=value.length()-1;i>=0;i--)
{
if (value.charAt(i) == ' ') // Only allow for space currently
{
numPaddingChars++;
}
else
{
break;
}
}
if (numPaddingChars > 0)
{
value = value.substring(0, value.length()-numPaddingChars);
}
}
return value;
}
}
catch (SQLException e)
{
throw new NucleusDataStoreException(Localiser.msg("055001","String","" + param, column, e.getMessage()), e);
}
}
/**
* Method to set a boolean at the specified position in the JDBC PreparedStatement.
* @param ps The PreparedStatement
* @param param Parameter position
* @param value The value to set
*/
public void setBoolean(PreparedStatement ps, int param, boolean value)
{
try
{
ps.setNString(param, value ? "Y" : "N");
}
catch (SQLException e)
{
throw new NucleusDataStoreException(Localiser.msg("055001","boolean","" + value, column, e.getMessage()), e);
}
}
/**
* Method to extract a boolean from the ResultSet at the specified position
* @param rs The Result Set
* @param param The parameter position
* @return the boolean
*/
public boolean getBoolean(ResultSet rs, int param)
{
boolean value;
try
{
String s = rs.getNString(param);
if (s == null)
{
if( column == null || column.getColumnMetaData() == null || !column.getColumnMetaData().isAllowsNull() )
{
if (rs.wasNull())
{
throw new NullValueException(Localiser.msg("055003",column));
}
}
return false;
}
if (s.equals("Y"))
{
value = true;
}
else if (s.equals("N"))
{
value = false;
}
else
{
throw new NucleusDataStoreException(Localiser.msg("055003",column));
}
}
catch (SQLException e)
{
throw new NucleusDataStoreException(Localiser.msg("055002","boolean","" + param, column, e.getMessage()), e);
}
return value;
}
/**
* Method to set an object at the specified position in the JDBC PreparedStatement.
* @param ps The PreparedStatement
* @param param Parameter position
* @param value The value to set
*/
public void setObject(PreparedStatement ps, int param, Object value)
{
try
{
if (value == null)
{
ps.setNull(param, getJDBCType());
}
else
{
if (value instanceof Boolean)
{
ps.setNString(param, ((Boolean) value).booleanValue() ? "Y" : "N");
}
else if (value instanceof java.sql.Time)
{
ps.setNString(param, ((java.sql.Time) value).toString());
}
else if (value instanceof java.sql.Date)
{
ps.setNString(param, ((java.sql.Date) value).toString());
}
else if (value instanceof java.sql.Timestamp)
{
Calendar cal = storeMgr.getCalendarForDateTimezone();
// pass the calendar to oracle makes it loses milliseconds
if (cal != null)
{
ps.setTimestamp(param, (Timestamp) value, cal);
}
else
{
ps.setTimestamp(param, (Timestamp) value);
}
}
else if (value instanceof java.util.Date)
{
ps.setNString(param, getJavaUtilDateFormat().format((java.util.Date) value));
}
else if (value instanceof String)
{
ps.setNString(param, ((String) value));
}
else
{
// This caters for all non-string types. If any more need specific treatment, split them out above.
ps.setNString(param, value.toString());
}
}
}
catch (SQLException e)
{
throw new NucleusDataStoreException(Localiser.msg("055001","Object","" + value, column, e.getMessage()), e);
}
}
/**
* Method to extract an object from the ResultSet at the specified position
* @param rs The Result Set
* @param param The parameter position
* @return the object
*/
public Object getObject(ResultSet rs, int param)
{
Object value;
try
{
String s = rs.getNString(param);
if (s == null)
{
value = null;
}
else
{
if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_BOOLEAN))
{
if (s.equals("Y"))
{
value = Boolean.TRUE;
}
else if (s.equals("N"))
{
value = Boolean.FALSE;
}
else
{
throw new NucleusDataStoreException(Localiser.msg("055003",column));
}
}
else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_LANG_CHARACTER))
{
value = Character.valueOf(s.charAt(0));
}
else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_SQL_TIME))
{
value = java.sql.Time.valueOf(s);
}
else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_SQL_DATE))
{
value = java.sql.Date.valueOf(s);
}
else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_UTIL_DATE))
{
value = getJavaUtilDateFormat().parse(s);
}
else if (getJavaTypeMapping().getJavaType().getName().equals(ClassNameConstants.JAVA_SQL_TIMESTAMP))
{
Calendar cal = storeMgr.getCalendarForDateTimezone();
value = TypeConversionHelper.stringToTimestamp(s, cal);
}
else
{
value = s;
}
}
}
catch (SQLException e)
{
throw new NucleusDataStoreException(Localiser.msg("055002","Object","" + param, column, e.getMessage()), e);
}
catch (ParseException e)
{
throw new NucleusDataStoreException(Localiser.msg("055002","Object","" + param, column, e.getMessage()), e);
}
return value;
}
}
| [
"andy@datanucleus.org"
] | andy@datanucleus.org |
30c1cd8903a5af5522fe6eedada30f6c345fe1ac | 9a5f1d72b2472c7bb0b27aaca08e2f4cef30f96a | /src/main/java/com/SpringBootAndMaterialize/SpringBootAndMaterialize/exception/NegocioException.java | efdf10171ee829bb2a955b090d12a7ed54e26d79 | [
"MIT"
] | permissive | matheusfreitas70/SpringBootAndMaterialize | c4b8cb010b2552776219641e69d4cf79267b3cd2 | f756e86bd93719da5db6b1a19f904dd044bd1d3a | refs/heads/master | 2020-12-02T21:25:50.831906 | 2017-07-01T02:17:06 | 2017-07-01T02:17:06 | 96,316,220 | 1 | 0 | null | 2017-07-05T12:21:40 | 2017-07-05T12:21:40 | null | UTF-8 | Java | false | false | 252 | java | package com.SpringBootAndMaterialize.SpringBootAndMaterialize.exception;
public class NegocioException extends RuntimeException {
private static final long serialVersionUID = 1L;
public NegocioException(String mensagem){
super(mensagem);
}
}
| [
"lucas-barros28@hotmail.com"
] | lucas-barros28@hotmail.com |
910864e27ef4bbdf25ec2abec4439566706c12b9 | 6fb3351b5957e371ce2fa23f1c7f7b0bd04af936 | /Class5b/app/src/main/java/com/example/minwo/class_5b/MainActivity.java | 98c213213b8984dfd0bba6fa7e5785a2ab157ebd | [] | no_license | rhapsodist-MK/android | beda04aad2e768dbb0099eb6b603bf384dcaea86 | 78eda1a384f9ff592699a8fc0d4e3cb0e9c9fce8 | refs/heads/master | 2021-05-14T16:16:08.951578 | 2018-01-09T07:02:24 | 2018-01-09T07:02:24 | 116,015,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package com.example.minwo.class_5b;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RedFragment redFragment = new RedFragment();
getSupportFragmentManager().beginTransaction().add(R.id.fl_right, redFragment).commit();
}
}
| [
"rhapsodist.mk@gmail.com"
] | rhapsodist.mk@gmail.com |
3b07157c9a6999e3def04791e42e29b20ce0c6a0 | 9ce862618630e986a9ebfdaac0fc70d4d7ba4b42 | /src/main/java/net/iretailer/rest/dao/RecordsPassbyMapper.java | 2316d2a2ce395e330113704378e616bbce62aad6 | [] | no_license | kimizhu8/oldway | 6b90eddae62e0d9b2d678890124f2c7b649e7f62 | 16df62bbcb5595c776a810b35bfc787a72de6a47 | refs/heads/master | 2021-01-11T17:28:18.997157 | 2017-05-15T08:59:02 | 2017-05-15T08:59:02 | 79,778,751 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package net.iretailer.rest.dao;
import net.iretailer.rest.model.RecordsPassby;
public interface RecordsPassbyMapper {
int deleteByPrimaryKey(Integer fkRecordsId);
int insert(RecordsPassby record);
int insertSelective(RecordsPassby record);
RecordsPassby selectByPrimaryKey(Integer fkRecordsId);
int updateByPrimaryKeySelective(RecordsPassby record);
int updateByPrimaryKey(RecordsPassby record);
} | [
"weizhenggong@zillionfortune.com"
] | weizhenggong@zillionfortune.com |
c1fb8bc8def8ea29c1d331d2943ccb60502386c3 | 3f909a50c27b5a3cb9cb4acd9c44a0b70b72d9b7 | /src/org/usfirst/frc/team4501/robot/commands/ShiftHigh.java | 9d8a066ae906b4686209159c58886ce132b75fd5 | [] | no_license | Humans4501/Comp-Robot | c19481a32c73e305e5d396940b14d2a803f025bb | b73886d50002acba46f43a1ca103e94edc51b190 | refs/heads/master | 2021-04-29T15:23:29.444051 | 2018-09-24T21:40:56 | 2018-09-24T21:40:56 | 121,795,224 | 0 | 0 | null | 2018-09-24T21:40:57 | 2018-02-16T20:05:24 | Java | UTF-8 | Java | false | false | 974 | java | package org.usfirst.frc.team4501.robot.commands;
import org.usfirst.frc.team4501.robot.Robot;
import edu.wpi.first.wpilibj.command.Command;
/// **
// *
// */
public class ShiftHigh extends Command {
public ShiftHigh() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.driveTrain);
}
// Called just before this Command runs the first time
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
Robot.driveTrain.shiftHigh();
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return Robot.driveTrain.isShifted();
}
// Called once after isFinished returns true
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
}
| [
"nrsrobotics@gmail.com"
] | nrsrobotics@gmail.com |
dac08f539af60fc6c14f2995e3ab872f0f30e10e | 810951e3f5bbcbd5a85b417db96e61d3347949c2 | /src/main/java/mes/sensorview/Common/Function/AuthFunction.java | 7c85e7f56d95bdfd4f23776d053aab7d6be63baa | [] | no_license | qaws2921/sensorview_mes | 35a8f0b68d6963740d88d36ef3192cc9d0156fb9 | eeb9b00353934e7a06be1a15b262ce17a99703b5 | refs/heads/master | 2021-01-08T14:41:50.026155 | 2020-02-21T06:17:08 | 2020-02-21T06:17:08 | 242,052,546 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,010 | java | package mes.sensorview.Common.Function;
import mes.sensorview.Common.Auth.Auth;
import mes.sensorview.Common.Interceptor.Session;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
public class AuthFunction {
public Session getSessionData(HttpServletRequest req)
{
return (Session) req.getSession().getAttribute("userData");
}
public ArrayList<List<Auth>> gb_list(List<Auth> rs)
{
int index = 0;
int check = 99;
ArrayList<Auth> topList = new ArrayList<>();
ArrayList<Auth> underList = new ArrayList<>();
for (Auth list : rs) {
if (check == list.getLevel() && check != 3) {
topList.remove(index-1);
check = 99;
--index;
}
if (list.getLevel() == 1) {
topList.add(list);
}else if(list.getLevel() == 2){
topList.add(list);
check = 2;
++index;
}else if (list.getLevel() == 3) {
underList.add(list);
check = 3;
}
}
ArrayList<List<Auth>> list = new ArrayList<>();
list.add(topList);
list.add(underList);
return list;
}
public List<?> authAllSubSelect(ArrayList<List<Auth>> allSubList, ArrayList<List<Auth>> allSubList2){
int index = 0;
int index2 = 0;
int check = 0;
for (List<Auth> list : allSubList2) {
for (Auth Auth : list) {
if (Auth.getLevel() == check && check != 3) {
allSubList.get(index).remove(index2-1);
--index2;
check = 0;
}
if (Auth.getLevel() == 2) {
check = 2;
}else {
check = 3;
}
++index2;
}
++index;
}
return allSubList;
}
}
| [
"w8230@naver.com"
] | w8230@naver.com |
e83f85ed793ecb45853e623185b2668a7b146616 | 93e1c8f892f0de6a748cb8d5ff2e72490b87d98f | /GeoServer/src/main/java/edu/dmitry/geoserver/MapInteraction/LocationsStatisticRequest.java | 9489ed7afe5f91715106c61e421478d2fcf91f69 | [] | no_license | KDmitry/GeoAnalyzer | 3d52a7034237c1d572721113dd65f018681da7d1 | 04743da58772477996d728556e27a97da646246d | refs/heads/master | 2020-12-04T17:03:01.207112 | 2016-09-06T19:42:37 | 2016-09-06T19:42:37 | 67,516,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 709 | java | package edu.dmitry.geoserver.MapInteraction;
import org.joda.time.DateTime;
public class LocationsStatisticRequest {
private DateTime from;
private DateTime to;
private int lastLocationStatisticId;
public DateTime getFrom() {
return from;
}
public void setFrom(DateTime from) {
this.from = from;
}
public DateTime getTo() {
return to;
}
public void setTo(DateTime to) {
this.to = to;
}
public int getLastLocationStatisticId() {
return lastLocationStatisticId;
}
public void setLastLocationStatisticId(int lastLocationStatisticId) {
this.lastLocationStatisticId = lastLocationStatisticId;
}
}
| [
"dimakorolev94@yandex.ru"
] | dimakorolev94@yandex.ru |
1e0516435e67857d060053c88c57b00dc8a2ea85 | c4ec72b480bf5c7f868ea2fccc50a782ae8a9be2 | /vespajlib/src/test/java/com/yahoo/text/Ascii7BitMatcherTestCase.java | 3f628b109f5719e1a2684da0242fc1e78c4d8600 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | leisureshadow/vespa | e9cd6fc87b44445a1466c87a0fec15d31ea92b05 | 28a35b8d53cbd6dda54eb141e29b12584b297410 | refs/heads/master | 2020-11-29T20:33:46.702099 | 2019-12-25T18:30:11 | 2019-12-25T18:30:11 | 230,207,178 | 0 | 0 | Apache-2.0 | 2019-12-26T06:21:12 | 2019-12-26T06:21:11 | null | UTF-8 | Java | false | false | 1,635 | java | package com.yahoo.text;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.*;
public class Ascii7BitMatcherTestCase {
@Test
public void testThatListedCharsAreLegal() {
assertTrue(new Ascii7BitMatcher("a").matches("aaaa"));
assertTrue(new Ascii7BitMatcher("ab").matches("abbbbbbbbb"));
assertTrue(new Ascii7BitMatcher("ab").matches("bbbbbbbbbba"));
assertTrue(new Ascii7BitMatcher("1").matches("1"));
}
@Test
public void requireThatNotListedCharsFail() {
assertFalse(new Ascii7BitMatcher("a").matches("b"));
}
@Test
public void testThatLegalFirstAndRestPass() {
assertTrue(new Ascii7BitMatcher("a", "").matches("a"));
assertTrue(new Ascii7BitMatcher("a", "b").matches("abbbbbbbbb"));
assertTrue(new Ascii7BitMatcher("abc", "0123").matches("a123120"));
}
@Test
public void requireThatIllegalFirstOrSecondFail() {
assertFalse(new Ascii7BitMatcher("a", "").matches("aa"));
assertFalse(new Ascii7BitMatcher("a", "b").matches("aa"));
assertFalse(new Ascii7BitMatcher("", "a").matches("a"));
assertFalse(new Ascii7BitMatcher("a", "b").matches("bb"));
assertFalse(new Ascii7BitMatcher("a", "b").matches("abbbbbx"));
}
@Test
public void requireThatNonAsciiFailConstruction() {
try {
new Ascii7BitMatcher("aæb");
Assert.fail("'æ' should not be allowed");
} catch (IllegalArgumentException e) {
assertEquals("Char 'æ' at position 1 is not valid ascii 7 bit char", e.getMessage());
}
}
}
| [
"balder@yahoo-inc.com"
] | balder@yahoo-inc.com |
d4de254d141e47b7360b6697cde5a214a9465284 | 46fb31118d6d4b980403bfd0c5e5725930115c45 | /src/hibernate/DAO/PhotoCommentDAO.java | 23b2f21c831416125e56b8ebf7d43ca85cd92918 | [] | no_license | vitos999ven/WordsEasy | 2a35c1bdc00792a7d158e59fc8cd6d3813d2bc8a | 5b5f20e4dfa0a71df290c9c78e9f5d9b019ada60 | refs/heads/master | 2021-01-10T01:29:41.558711 | 2015-05-23T13:47:35 | 2015-05-23T13:47:35 | 36,125,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,716 | java | package hibernate.DAO;
import hibernate.logic.PhotoComment;
import hibernate.logic.User;
import java.sql.SQLException;
import java.util.List;
public interface PhotoCommentDAO {
public void addPhotoComment(PhotoComment photoComment) throws SQLException;
public void updatePhotoComment(PhotoComment photoComment) throws SQLException;
public PhotoComment getPhotoCommentById(Long id) throws SQLException;
public PhotoComment getLastPhotoComment(String user_from) throws SQLException;
public List<PhotoComment> getAllPhotoComments() throws SQLException;
public List<PhotoComment> getAllPhotoComments(User user_from, boolean withDeleted) throws SQLException;
public List<PhotoComment> getAllPhotoComments(String user_from, boolean withDeleted) throws SQLException;
public List<PhotoComment> getAllPhotoComments(Long photo_id, boolean withDeleted) throws SQLException;
public List<PhotoComment> getPhotoCommentsBeforeId(long photo_id, long comment_id, long count, boolean withDeleted) throws SQLException;
public void deletePhotoCommentById(Long id) throws SQLException;
public void setDeletedPhotoCommentById(Long id) throws SQLException;
public void deleteAllPhotoComments(User user) throws SQLException;
public void deleteAllPhotoComments(String user) throws SQLException;
public void deleteAllPhotoComments(Long photo_id) throws SQLException;
public void setDeletedAllPhotoComments(User user) throws SQLException;
public void setDeletedAllPhotoComments(String user) throws SQLException;
public void setDeletedAllPhotoComments(Long photo_id) throws SQLException;
public void deleteAllPhotoComments() throws SQLException;
}
| [
"vitos999ven@gmail.com"
] | vitos999ven@gmail.com |
f7307a925ca7a3c8cd88a79970c95a88f255550d | f15bb0ddf9e28ea808f4c49e8c442c29e6f53218 | /bus-office/src/main/java/org/aoju/bus/office/magic/Calc.java | e91a1eb785a5aacc2cd90ee5efcd4b0b14e5b3f4 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | erickwang/bus | 7f31a19ace167b2ce525105d4393b379118a525e | a8ed185f2f1c0f085d8a2be5e005bcbf50431386 | refs/heads/master | 2022-04-15T15:28:06.342430 | 2020-03-26T06:14:42 | 2020-03-26T06:14:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,084 | java | /*********************************************************************************
* *
* The MIT License *
* *
* Copyright (c) 2015-2020 aoju.org and other contributors. *
* *
* 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 org.aoju.bus.office.magic;
import com.sun.star.lang.XComponent;
import com.sun.star.sheet.XSpreadsheetDocument;
import org.aoju.bus.office.Builder;
/**
* 使Office Calc文档(电子表格)更容易使用的实用函数集合.
*
* @author Kimi Liu
* @version 5.8.1
* @since JDK 1.8+
*/
public final class Calc {
/**
* 获取给定文档是否为电子表格文档.
*
* @param document 要测试的文档.
* @return 如果文档是电子表格文档,则为{@code true},否则为{@code false}.
*/
public static boolean isCalc(final XComponent document) {
return Info.isDocumentType(document, Builder.CALC_SERVICE);
}
/**
* 将给定的文档转换为{@link XSpreadsheetDocument}.
*
* @param document 要转换的文档.
* @return 如果文档不是电子表格文档,则为null.
*/
public static XSpreadsheetDocument getCalcDoc(final XComponent document) {
if (document == null) {
return null;
}
return Lo.qi(XSpreadsheetDocument.class, document);
}
}
| [
"839536@qq.com"
] | 839536@qq.com |
bd6da1df9309c2cb14ce9509c6b9762bdab2d198 | 00487b2c49ae2ec16ab507e6c373912297690d5b | /src/main/java/com/shoppingcartdemo/demo/entity/Product.java | a8460cf14b8dd4eca80ec4512ea2628dbba9e4a1 | [] | no_license | supmean/shoppingcartdemo | 51dd2416ad8bb498ae252efed7a49f7073825189 | 12ccb213874244e4ab1682308437c1dbc3d3ab41 | refs/heads/master | 2021-04-02T01:43:14.816454 | 2020-03-18T12:57:21 | 2020-03-18T12:57:21 | 248,230,875 | 0 | 0 | null | 2020-10-13T20:27:32 | 2020-03-18T12:52:34 | Java | UTF-8 | Java | false | false | 1,014 | java | package com.shoppingcartdemo.demo.entity;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author
*/
@Data
public class Product {
private String productName;
private BigDecimal unitPrice;
public static final class ProductBuilder {
private String productName;
private BigDecimal unitPrice;
public ProductBuilder() {
}
public static ProductBuilder aProduct() {
return new ProductBuilder();
}
public ProductBuilder withProductName(String productName) {
this.productName = productName;
return this;
}
public ProductBuilder withUnitPrice(String unitPriceString) {
this.unitPrice = new BigDecimal(unitPriceString);
return this;
}
public Product build() {
Product product = new Product();
product.setProductName(productName);
product.setUnitPrice(unitPrice);
return product;
}
}
}
| [
"mic.z.young@gmail.com"
] | mic.z.young@gmail.com |
13b203174a5c35118be3f7e1222f0495f347e406 | afbbf8defc9b0eb6bd5fa756ad5e0384258a8c9f | /app/src/test/java/com/example/ecl_android_test/ExampleUnitTest.java | d28744cf85f16b792730d73da0a127873a2e83be | [] | no_license | VyacheslavMik/ecl-android-test2 | f8cff02faeb742e2eadcddbfe7e8e2414d60789b | 1dd14d61845825bc485236b616286e5d25d58e28 | refs/heads/master | 2022-11-11T11:29:04.542623 | 2020-07-02T14:23:31 | 2020-07-02T14:23:31 | 276,666,428 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package com.example.ecl_android_test;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"mikushev.vyacheslav@tyrell.group"
] | mikushev.vyacheslav@tyrell.group |
532598ea786bea5853c7c49164aaf108c1f24121 | c074ce302e0a2a09ebe8b0a94e342380afbaa911 | /beakjoon_PS/no14503.java | dd2671a9e32debdebe38a27b8dd6d9f6edaf136f | [] | no_license | elrion018/CS_study | eeea7a48e9e9b116ddf561ebf10633670d305722 | 3d5478620c4d23343ae0518d27920b3211f686fd | refs/heads/master | 2021-06-10T13:35:20.258335 | 2021-04-25T10:12:17 | 2021-04-25T10:12:17 | 169,424,097 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,053 | java | import java.io.*;
import java.util.*;
public class no14503 {
static int stoi(String s) {
return Integer.parseInt(s);
}
static int[] dr = { -1, 0, 1, 0 };
static int[] dc = { 0, 1, 0, -1 };
static int[][] map;
static int r, c, d;
static int N;
static int M;
// static int turnCount = 0;
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
st = new StringTokenizer(br.readLine());
N = stoi(st.nextToken());
M = stoi(st.nextToken());
map = new int[N][M];
st = new StringTokenizer(br.readLine());
r = stoi(st.nextToken());
c = stoi(st.nextToken());
d = stoi(st.nextToken());
for (int i = 0; i < N; i++) {
st = new StringTokenizer(br.readLine());
for (int j = 0; j < M; j++) {
map[i][j] = stoi(st.nextToken());
}
}
run(r, c, d, 0);
}
static void run(int r, int c, int d, int turnCount) {
clean(r, c, d, turnCount);
return;
}
static void cal() {
int result = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
if (map[i][j] == 2) {
result += 1;
}
}
}
System.out.println(result);
return;
}
static void search(int r, int c, int d, int turnCount) {
int ad = rotate(d);
int ar = r + dr[ad];
int ac = c + dc[ad];
int ar2 = r - dr[d];
int ac2 = c - dc[d];
if (turnCount == 4 && map[ar2][ac2] == 1) {
cal();
return;
}
if (turnCount == 4) {
search(ar2, ac2, d, 0);
return;
}
if (map[ar][ac] == 0) {
clean(ar, ac, ad, 0);
return;
}
if (map[ar][ac] == 1 || map[ar][ac] == 2) {
search(r, c, ad, turnCount + 1);
return;
}
}
static void clean(int r, int c, int d, int turnCount) {
map[r][c] = 2;
search(r, c, d, turnCount);
return;
}
static int rotate(int d) {
if (d == 0) {
return 3;
}
d = d - 1;
return d;
}
} | [
"elrion018@gmail.com"
] | elrion018@gmail.com |
a285a0ff15de6c078100ce4ab4b2ad05fb81d9b5 | 46f054fc0d064706f4fe7d7f3cf7886aca787d6b | /src/test/java/TestCases/FreeListingPage/InvalidCompanyNameTest.java | 7125088d5229428e5dff1c07daee7b91f08b8b21 | [] | no_license | snehakothale/spring-rest | 93a9384022dcc7c51cc0e329b83507ab0a34adba | a8df1640ce42a8d548e1fbeb9797b9854b8c9b78 | refs/heads/master | 2023-07-02T04:05:09.084219 | 2021-08-09T04:15:24 | 2021-08-09T04:15:24 | 394,132,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,299 | java | package TestCases.FreeListingPage;
import java.io.IOException;
import org.openqa.selenium.support.PageFactory;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.Test;
import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;
import com.aventstack.extentreports.Status;
import Pages.FreeListingPage;
import Utilities.DataProviderSource;
import Utilities.ExtendReport;
public class InvalidCompanyNameTest extends FreeListingPage{
ExtentReports report = ExtendReport.getReportInstance("InvalidCompanyNameTest");
@Test(groups="Regression Test",dataProvider = "Test Data", dataProviderClass = DataProviderSource.class)
public void verifyPopUpMessageForCompanyName(String companyName,String cityName,String firstName,String lastName,String phoneNum,String landlineNum) throws InterruptedException, IOException {
ExtentTest logger = report.createTest("Get error message for invalid firstname");
logger.log(Status.INFO, "Lunch browser and open url");
openBaseUrl("baseUrl");
PageFactory.initElements(driver, this);
logger.log(Status.INFO, "Navigate to FreeListing page");
goToFreelistingPage();
logger.log(Status.INFO, "Entering the Company name");
enterCompanyname(companyName);
logger.log(Status.INFO, "Selecting Title");
selectTitle();
logger.log(Status.INFO, "Entering the First Name");
enterFirstname(firstName);
logger.log(Status.INFO, "Entering the Last Name");
enterLastname(lastName);
logger.log(Status.INFO, "Entering the Phone Number");
enterPhonenumber(phoneNum);
logger.log(Status.INFO, "Entering the LandLine Number");
enterLandlinenumber(landlineNum);
logger.log(Status.INFO, "click on submit button");
submitForm();
String actualmessage = companyNameError.getText();
String expectedmessage = "Company name is blank";
try {
Assert.assertEquals(actualmessage, expectedmessage);
System.out.println("System gives pop up message 'Company name is blank'");
logger.log(Status.PASS, "System gives error message");
} catch (Exception e) {
e.printStackTrace();
System.out.println("System does not give error message");
}
driver.close();
}
@AfterTest
public void endReport() {
report.flush();
}
}
| [
"snehakothale99@gmail.com"
] | snehakothale99@gmail.com |
512fb386db987799629950fbad1ba13ea4e3d009 | 918c202eb26cac9cc01ff6022874b7c17f9a5588 | /source/de/tuclausthal/submissioninterface/servlets/view/TaskGroupManagerView.java | c12348255d8a265c596f4b4f07162f5c975ff63f | [] | no_license | HannesOlivier/si | a3513ad7b27ba8c3d3f5857dcd8bf89019a1cd00 | e1793a9c9aa944c37135dde82d8dab5e93132def | refs/heads/master | 2022-11-22T23:48:13.671761 | 2020-07-19T14:53:01 | 2020-07-30T08:09:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,522 | java | /*
* Copyright 2010 - 2012 Sven Strickroth <email@cs-ware.de>
*
* This file is part of the SubmissionInterface.
*
* SubmissionInterface is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* SubmissionInterface is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SubmissionInterface. If not, see <http://www.gnu.org/licenses/>.
*/
package de.tuclausthal.submissioninterface.servlets.view;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import de.tuclausthal.submissioninterface.persistence.datamodel.Lecture;
import de.tuclausthal.submissioninterface.persistence.datamodel.TaskGroup;
import de.tuclausthal.submissioninterface.template.Template;
import de.tuclausthal.submissioninterface.template.TemplateFactory;
import de.tuclausthal.submissioninterface.util.Util;
/**
* View-Servlet for displaying a form for adding/editing a task
* @author Sven Strickroth
*/
public class TaskGroupManagerView extends HttpServlet {
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
Template template = TemplateFactory.getTemplate(request, response);
TaskGroup taskGroup = (TaskGroup) request.getAttribute("taskGroup");
Lecture lecture = taskGroup.getLecture();
if (taskGroup.getTaskGroupId() != 0) {
template.printTemplateHeader("Aufgabengruppe bearbeiten", lecture);
} else {
template.printTemplateHeader("neue Aufgabengruppe", lecture);
}
PrintWriter out = response.getWriter();
out.println("<form action=\"" + response.encodeURL("?") + "\" method=post>");
if (taskGroup.getTaskGroupId() != 0) {
out.println("<input type=hidden name=action value=saveTaskGroup>");
out.println("<input type=hidden name=taskgroupid value=\"" + taskGroup.getTaskGroupId() + "\">");
} else {
out.println("<input type=hidden name=action value=saveNewTaskGroup>");
}
out.println("<input type=hidden name=lecture value=\"" + lecture.getId() + "\">");
out.println("<table class=border>");
out.println("<tr>");
out.println("<th>Titel:</th>");
out.println("<td><input type=text name=title value=\"" + Util.escapeHTML(taskGroup.getTitle()) + "\" required=required ></td>");
out.println("</tr>");
out.println("<tr>");
out.println("<td colspan=2 class=mid><input type=submit value=speichern> <a href=\"");
out.println(response.encodeURL("ShowLecture?lecture=" + lecture.getId()));
out.println("\">Abbrechen</a></td>");
out.println("</tr>");
out.println("</table>");
out.println("</form>");
if (taskGroup.getTaskGroupId() != 0) {
out.println("<p class=mid><a onclick=\"return confirmLink('Wirklich löschen?')\" href=\"");
out.println(response.encodeURL("TaskManager?action=deleteTaskGroup&taskgroupid=" + taskGroup.getTaskGroupId() + "&lecture=" + lecture.getId()));
out.println("\">Löschen</a></p>");
}
template.printTemplateFooter();
}
}
| [
"email@cs-ware.de"
] | email@cs-ware.de |
293cb0177e40966c71afcffc19299942fbe805f6 | 1fad4cb6f73a3787636d0c7526352bb441df22cd | /src/main/com/flightaware/flightxml/soap/flightxml2/FlightXML2Soap.java | edfc415a5f9a1a6811558851404fb934b4e7d204 | [] | no_license | chooli/com.jumkid.live | 7d92969535fb7d1b0c8e68c2fc8e11f97e570e62 | 22214073865498bc68de3b75b7463654a259c97a | refs/heads/master | 2020-03-30T07:08:54.328217 | 2015-07-08T15:31:45 | 2015-07-08T15:31:45 | 38,758,529 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,560 | java | package com.flightaware.flightxml.soap.flightxml2;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
/**
* This class was generated by Apache CXF 3.1.0
* 2015-05-12T17:01:14.378-05:00
* Generated source version: 3.1.0
*
*/
@WebService(targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", name = "FlightXML2Soap")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface FlightXML2Soap {
@WebResult(name = "CountAirportOperationsResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "CountAirportOperations", action = "FlightXML2:CountAirportOperations")
public CountAirportOperationsResults countAirportOperations(
@WebParam(partName = "parameters", name = "CountAirportOperationsRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
CountAirportOperationsRequest parameters
);
@WebResult(name = "AirportInfoResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "AirportInfo", action = "FlightXML2:AirportInfo")
public AirportInfoResults airportInfo(
@WebParam(partName = "parameters", name = "AirportInfoRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
AirportInfoRequest parameters
);
@WebResult(name = "SearchResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "Search", action = "FlightXML2:Search")
public SearchResults search(
@WebParam(partName = "parameters", name = "SearchRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
SearchRequest parameters
);
@WebResult(name = "FlightInfoExResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "FlightInfoEx", action = "FlightXML2:FlightInfoEx")
public FlightInfoExResults flightInfoEx(
@WebParam(partName = "parameters", name = "FlightInfoExRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
FlightInfoExRequest parameters
);
@WebResult(name = "SetMaximumResultSizeResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "SetMaximumResultSize", action = "FlightXML2:SetMaximumResultSize")
public SetMaximumResultSizeResults setMaximumResultSize(
@WebParam(partName = "parameters", name = "SetMaximumResultSizeRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
SetMaximumResultSizeRequest parameters
);
@WebResult(name = "SearchCountResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "SearchCount", action = "FlightXML2:SearchCount")
public SearchCountResults searchCount(
@WebParam(partName = "parameters", name = "SearchCountRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
SearchCountRequest parameters
);
@WebResult(name = "GetHistoricalTrackResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "GetHistoricalTrack", action = "FlightXML2:GetHistoricalTrack")
public GetHistoricalTrackResults getHistoricalTrack(
@WebParam(partName = "parameters", name = "GetHistoricalTrackRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
GetHistoricalTrackRequest parameters
);
@WebResult(name = "TafResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "Taf", action = "FlightXML2:Taf")
public TafResults taf(
@WebParam(partName = "parameters", name = "TafRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
TafRequest parameters
);
@WebResult(name = "BlockIdentCheckResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "BlockIdentCheck", action = "FlightXML2:BlockIdentCheck")
public BlockIdentCheckResults blockIdentCheck(
@WebParam(partName = "parameters", name = "BlockIdentCheckRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
BlockIdentCheckRequest parameters
);
@WebResult(name = "InboundFlightInfoResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "InboundFlightInfo", action = "FlightXML2:InboundFlightInfo")
public InboundFlightInfoResults inboundFlightInfo(
@WebParam(partName = "parameters", name = "InboundFlightInfoRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
InboundFlightInfoRequest parameters
);
@WebResult(name = "AirlineInfoResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "AirlineInfo", action = "FlightXML2:AirlineInfo")
public AirlineInfoResults airlineInfo(
@WebParam(partName = "parameters", name = "AirlineInfoRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
AirlineInfoRequest parameters
);
@WebResult(name = "DepartedResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "Departed", action = "FlightXML2:Departed")
public DepartedResults departed(
@WebParam(partName = "parameters", name = "DepartedRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
DepartedRequest parameters
);
@WebResult(name = "MapFlightResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "MapFlight", action = "FlightXML2:MapFlight")
public MapFlightResults mapFlight(
@WebParam(partName = "parameters", name = "MapFlightRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
MapFlightRequest parameters
);
@WebResult(name = "DecodeRouteResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "DecodeRoute", action = "FlightXML2:DecodeRoute")
public DecodeRouteResults decodeRoute(
@WebParam(partName = "parameters", name = "DecodeRouteRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
DecodeRouteRequest parameters
);
@WebResult(name = "GetAlertsResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "GetAlerts", action = "FlightXML2:GetAlerts")
public GetAlertsResults getAlerts(
@WebParam(partName = "parameters", name = "GetAlertsRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
GetAlertsRequest parameters
);
@WebResult(name = "RoutesBetweenAirportsExResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "RoutesBetweenAirportsEx", action = "FlightXML2:RoutesBetweenAirportsEx")
public RoutesBetweenAirportsExResults routesBetweenAirportsEx(
@WebParam(partName = "parameters", name = "RoutesBetweenAirportsExRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
RoutesBetweenAirportsExRequest parameters
);
@WebResult(name = "MetarExResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "MetarEx", action = "FlightXML2:MetarEx")
public MetarExResults metarEx(
@WebParam(partName = "parameters", name = "MetarExRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
MetarExRequest parameters
);
@WebResult(name = "ArrivedResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "Arrived", action = "FlightXML2:Arrived")
public ArrivedResults arrived(
@WebParam(partName = "parameters", name = "ArrivedRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
ArrivedRequest parameters
);
@WebResult(name = "FleetScheduledResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "FleetScheduled", action = "FlightXML2:FleetScheduled")
public FleetScheduledResults fleetScheduled(
@WebParam(partName = "parameters", name = "FleetScheduledRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
FleetScheduledRequest parameters
);
@WebResult(name = "DecodeFlightRouteResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "DecodeFlightRoute", action = "FlightXML2:DecodeFlightRoute")
public DecodeFlightRouteResults decodeFlightRoute(
@WebParam(partName = "parameters", name = "DecodeFlightRouteRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
DecodeFlightRouteRequest parameters
);
@WebResult(name = "SearchBirdseyeInFlightResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "SearchBirdseyeInFlight", action = "FlightXML2:SearchBirdseyeInFlight")
public SearchBirdseyeInFlightResults searchBirdseyeInFlight(
@WebParam(partName = "parameters", name = "SearchBirdseyeInFlightRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
SearchBirdseyeInFlightRequest parameters
);
@WebResult(name = "LatLongsToHeadingResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "LatLongsToHeading", action = "FlightXML2:LatLongsToHeading")
public LatLongsToHeadingResults latLongsToHeading(
@WebParam(partName = "parameters", name = "LatLongsToHeadingRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
LatLongsToHeadingRequest parameters
);
@WebResult(name = "ScheduledResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "Scheduled", action = "FlightXML2:Scheduled")
public ScheduledResults scheduled(
@WebParam(partName = "parameters", name = "ScheduledRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
ScheduledRequest parameters
);
@WebResult(name = "GetLastTrackResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "GetLastTrack", action = "FlightXML2:GetLastTrack")
public GetLastTrackResults getLastTrack(
@WebParam(partName = "parameters", name = "GetLastTrackRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
GetLastTrackRequest parameters
);
@WebResult(name = "AircraftTypeResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "AircraftType", action = "FlightXML2:AircraftType")
public AircraftTypeResults aircraftType(
@WebParam(partName = "parameters", name = "AircraftTypeRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
AircraftTypeRequest parameters
);
@WebResult(name = "RegisterAlertEndpointResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "RegisterAlertEndpoint", action = "FlightXML2:RegisterAlertEndpoint")
public RegisterAlertEndpointResults registerAlertEndpoint(
@WebParam(partName = "parameters", name = "RegisterAlertEndpointRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
RegisterAlertEndpointRequest parameters
);
@WebResult(name = "MapFlightExResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "MapFlightEx", action = "FlightXML2:MapFlightEx")
public MapFlightExResults mapFlightEx(
@WebParam(partName = "parameters", name = "MapFlightExRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
MapFlightExRequest parameters
);
@WebResult(name = "GetFlightIDResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "GetFlightID", action = "FlightXML2:GetFlightID")
public GetFlightIDResults getFlightID(
@WebParam(partName = "parameters", name = "GetFlightIDRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
GetFlightIDRequest parameters
);
@WebResult(name = "RoutesBetweenAirportsResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "RoutesBetweenAirports", action = "FlightXML2:RoutesBetweenAirports")
public RoutesBetweenAirportsResults routesBetweenAirports(
@WebParam(partName = "parameters", name = "RoutesBetweenAirportsRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
RoutesBetweenAirportsRequest parameters
);
@WebResult(name = "DeleteAlertResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "DeleteAlert", action = "FlightXML2:DeleteAlert")
public DeleteAlertResults deleteAlert(
@WebParam(partName = "parameters", name = "DeleteAlertRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
DeleteAlertRequest parameters
);
@WebResult(name = "AllAirportsResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "AllAirports", action = "FlightXML2:AllAirports")
public AllAirportsResults allAirports(
@WebParam(partName = "parameters", name = "AllAirportsRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
AllAirportsRequest parameters
);
@WebResult(name = "InFlightInfoResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "InFlightInfo", action = "FlightXML2:InFlightInfo")
public InFlightInfoResults inFlightInfo(
@WebParam(partName = "parameters", name = "InFlightInfoRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
InFlightInfoRequest parameters
);
@WebResult(name = "MetarResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "Metar", action = "FlightXML2:Metar")
public MetarResults metar(
@WebParam(partName = "parameters", name = "MetarRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
MetarRequest parameters
);
@WebResult(name = "FleetArrivedResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "FleetArrived", action = "FlightXML2:FleetArrived")
public FleetArrivedResults fleetArrived(
@WebParam(partName = "parameters", name = "FleetArrivedRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
FleetArrivedRequest parameters
);
@WebResult(name = "AirlineFlightSchedulesResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "AirlineFlightSchedules", action = "FlightXML2:AirlineFlightSchedules")
public AirlineFlightSchedulesResults airlineFlightSchedules(
@WebParam(partName = "parameters", name = "AirlineFlightSchedulesRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
AirlineFlightSchedulesRequest parameters
);
@WebResult(name = "TailOwnerResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "TailOwner", action = "FlightXML2:TailOwner")
public TailOwnerResults tailOwner(
@WebParam(partName = "parameters", name = "TailOwnerRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
TailOwnerRequest parameters
);
@WebResult(name = "LatLongsToDistanceResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "LatLongsToDistance", action = "FlightXML2:LatLongsToDistance")
public LatLongsToDistanceResults latLongsToDistance(
@WebParam(partName = "parameters", name = "LatLongsToDistanceRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
LatLongsToDistanceRequest parameters
);
@WebResult(name = "CountAllEnrouteAirlineOperationsResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "CountAllEnrouteAirlineOperations", action = "FlightXML2:CountAllEnrouteAirlineOperations")
public CountAllEnrouteAirlineOperationsResults countAllEnrouteAirlineOperations(
@WebParam(partName = "parameters", name = "CountAllEnrouteAirlineOperationsRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
CountAllEnrouteAirlineOperationsRequest parameters
);
@WebResult(name = "AirlineInsightResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "AirlineInsight", action = "FlightXML2:AirlineInsight")
public AirlineInsightResults airlineInsight(
@WebParam(partName = "parameters", name = "AirlineInsightRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
AirlineInsightRequest parameters
);
@WebResult(name = "SearchBirdseyePositionsResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "SearchBirdseyePositions", action = "FlightXML2:SearchBirdseyePositions")
public SearchBirdseyePositionsResults searchBirdseyePositions(
@WebParam(partName = "parameters", name = "SearchBirdseyePositionsRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
SearchBirdseyePositionsRequest parameters
);
@WebResult(name = "NTafResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "NTaf", action = "FlightXML2:NTaf")
public NTafResults nTaf(
@WebParam(partName = "parameters", name = "NTafRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
NTafRequest parameters
);
@WebResult(name = "FlightInfoResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "FlightInfo", action = "FlightXML2:FlightInfo")
public FlightInfoResults flightInfo(
@WebParam(partName = "parameters", name = "FlightInfoRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
FlightInfoRequest parameters
);
@WebResult(name = "EnrouteResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "Enroute", action = "FlightXML2:Enroute")
public EnrouteResults enroute(
@WebParam(partName = "parameters", name = "EnrouteRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
EnrouteRequest parameters
);
@WebResult(name = "AllAirlinesResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "AllAirlines", action = "FlightXML2:AllAirlines")
public AllAirlinesResults allAirlines(
@WebParam(partName = "parameters", name = "AllAirlinesRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
AllAirlinesRequest parameters
);
@WebResult(name = "AirlineFlightInfoResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "AirlineFlightInfo", action = "FlightXML2:AirlineFlightInfo")
public AirlineFlightInfoResults airlineFlightInfo(
@WebParam(partName = "parameters", name = "AirlineFlightInfoRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
AirlineFlightInfoRequest parameters
);
@WebResult(name = "ZipcodeInfoResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "ZipcodeInfo", action = "FlightXML2:ZipcodeInfo")
public ZipcodeInfoResults zipcodeInfo(
@WebParam(partName = "parameters", name = "ZipcodeInfoRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
ZipcodeInfoRequest parameters
);
@WebResult(name = "SetAlertResults", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2", partName = "parameters")
@WebMethod(operationName = "SetAlert", action = "FlightXML2:SetAlert")
public SetAlertResults setAlert(
@WebParam(partName = "parameters", name = "SetAlertRequest", targetNamespace = "http://flightxml.flightaware.com/soap/FlightXML2")
SetAlertRequest parameters
);
}
| [
"chooli.yip@gmail.com"
] | chooli.yip@gmail.com |
6757b1f25100a48dc894d3196046e1502c073936 | 77f1d30e8529ac0ee93035c514929622dd84de1b | /projects/hacAccess/hacScraperJava.java | b88a13d2cd46b8c76151c4a9b77d22cf53efdfb2 | [] | no_license | hexatedjuice/juicepouch | e90c53a6ac3d8f7e4cc998af5ce84098f6a94baf | e941e53d068d16fc513fed696053a40327fd4720 | refs/heads/master | 2023-05-11T12:07:41.351901 | 2023-04-26T20:39:59 | 2023-04-26T20:39:59 | 224,934,808 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,082 | java | package test;
import java.io.IOException;
import java.util.Map;
import java.util.Scanner;
import org.jsoup.Jsoup;
import org.jsoup.Connection;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
// @author hexated
public class Test {
static Scanner input = new Scanner(System.in);
static String baseUrl;
static String userName;
static String userPass;
public static void main(String[] args) throws IOException {
try {
baseUrl = input.nextLine();
userName = input.nextLine();
userPass = input.nextLine();
Connection.Response loginForm = Jsoup.connect(baseUrl + "/HomeAccess/Account/LogOn?ReturnUrl=%2fhomeaccess")
.data("Database", "10")
.data("LogOnDetails.UserName", userName)
.data("LogOnDetails.Password", userPass)
.method(Connection.Method.POST)
.execute();
if (loginForm.body().contains("Your attempt to log in was unsuccessful")){
System.out.println("incorrect login");
} else if (loginForm.body().contains("Schedule")){
Map<String, String> loginCookies = loginForm.cookies();
Document doc = Jsoup.connect(baseUrl + "/HomeAccess/Content/Student/Assignments.aspx")
.cookies(loginCookies)
.get();
for (Element table : doc.select("table[id~=plnMain_rptAssigmnetsByCourse_dgCourseAssignments_]")){
for (Element row : table.select("tr")){
Elements tds = row.select("td");
System.out.println(tds.text());
}
}
}
} catch(IOException e){
e.printStackTrace();
System.out.println("invalid url");
}
}
}
| [
"44182109+hexatedjuice@users.noreply.github.com"
] | 44182109+hexatedjuice@users.noreply.github.com |
42399d55abe11b4b77afc0effc1529a9088d0327 | c3c0a3116e2a0dee2610a057063d9638a66f3b70 | /src/main/java/com/guchaolong/javalearn/base/StringTest.java | 9b0a513cabdd96942b033241d52c73535b97825e | [] | no_license | guchaolong/java-learn | 8523ecad5bb1ed4b61e563e0507cafb12b3ea95d | ac3b744551a185c7fc1601aa5633c9192c2b8aca | refs/heads/master | 2023-08-19T07:49:15.351765 | 2023-08-17T14:25:47 | 2023-08-17T14:25:47 | 159,709,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package com.guchaolong.javalearn.base;
/**
* Description:
*
* @author AA
* @date 2020/10/8 19:37
*/
public class StringTest {
public static void main(String[] args) {
String str = "helloword";
String str2 = "hello".substring(1,5);
System.out.println("substring " + str2);
char[] chars = new char[]{'h', 'e', 'l', 'l','o'};
System.out.println(str + "-" +str.substring(2));//substring(n) 去掉前n个
System.out.println(new String(chars, 1, 4));//offset: 起始位置(0开始), count:字符个数
}
}
| [
"guclno1@qq.com"
] | guclno1@qq.com |
e6a6f41cbdb482dae4c62b74d0e1a81fae20d2fa | 08a57e8ee68882d06df4cd0f3cf34be77931e09b | /ttestapp1/src/main/java/com/nfinity/ll/ttestapp1/domain/model/PetsEntity.java | 8d19a55900176677c2cd37115c84970dab6c7328 | [] | no_license | musman013/sample1 | 397b9c00d63d83e10f92d91a1bb4d0e1534567fb | 7659329adfedac945cb4aa867fc37978721cc06c | refs/heads/master | 2022-09-19T09:10:39.126249 | 2020-03-27T11:06:11 | 2020-03-27T11:06:11 | 250,512,532 | 0 | 0 | null | 2022-05-20T21:31:13 | 2020-03-27T11:06:51 | Java | UTF-8 | Java | false | false | 2,040 | java | package com.nfinity.ll.ttestapp1.domain.model;
import java.io.Serializable;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
import java.util.Date;
@Entity
@Table(name = "pets", schema = "sample")
public class PetsEntity implements Serializable {
private Date birthDate;
private Integer id;
private String name;
public PetsEntity() {
}
@Basic
@Column(name = "birthDate", nullable = true)
public Date getBirthDate() {
return birthDate;
}
public void setBirthDate(Date birthDate) {
this.birthDate = birthDate;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Basic
@Column(name = "name", nullable = true, length =30)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ManyToOne
@JoinColumn(name = "ownerId")
public OwnersEntity getOwners() {
return owners;
}
public void setOwners(OwnersEntity owners) {
this.owners = owners;
}
private OwnersEntity owners;
@ManyToOne
@JoinColumn(name = "typeId")
public TypesEntity getTypes() {
return types;
}
public void setTypes(TypesEntity types) {
this.types = types;
}
private TypesEntity types;
@OneToMany(mappedBy = "pets", cascade = CascadeType.ALL)
public Set<VisitsEntity> getVisitsSet() {
return visitsSet;
}
public void setVisitsSet(Set<VisitsEntity> visits) {
this.visitsSet = visits;
}
private Set<VisitsEntity> visitsSet = new HashSet<VisitsEntity>();
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof PetsEntity)) return false;
// PetsEntity pets = (PetsEntity) o;
// return id != null && id.equals(pets.id);
// }
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
757309662bafb2b62c2088aa31ff12e308f6a5af | d3c859cd83f85e97efd0b43445864f113e001d9e | /Calculator/app/src/androidTest/java/com/sszg/calculator/ExampleInstrumentedTest.java | 5e36c7f57e1fd357ba84497a6e462ea97cf32ed2 | [] | no_license | SaranSundar/AndroidCurriculum | 812f2f7ba1665649cc42bf0cb550205f9f1a0b1f | 3e5f34c4041cd3f8b8053bde795a1f86156bbaba | refs/heads/master | 2020-03-22T19:13:12.389062 | 2018-09-05T03:39:39 | 2018-09-05T03:39:39 | 140,513,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package com.sszg.calculator;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.sszg.calculator", appContext.getPackageName());
}
}
| [
"saran@Sarans-MacBook-Pro.local"
] | saran@Sarans-MacBook-Pro.local |
a546a50857f5e1736b322226fb47c9bbb2002dfa | 6b0004ae36d4279cadf26746124c04c34e3c8e86 | /contribs/dvrp/src/main/java/org/matsim/contrib/dvrp/run/DvrpConfigConsistencyChecker.java | 216f7d4daa86c6cdbf355712c2400651e01778fb | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | matsim-eth/avtestbed-wip | dadcaeb1467b490dd2146672061f7f2f8cb723a4 | 95666132eeffb6dd4a1b6bc03f76b4d900518d7e | refs/heads/master | 2021-05-15T02:44:50.629732 | 2017-10-12T09:26:53 | 2017-10-12T09:26:53 | 106,279,132 | 1 | 1 | null | 2017-10-12T09:26:54 | 2017-10-09T12:12:57 | Java | UTF-8 | Java | false | false | 3,045 | java | /* *********************************************************************** *
* project: org.matsim.*
* *
* *********************************************************************** *
* *
* copyright : (C) 2016 by the members listed in the COPYING, *
* LICENSE and WARRANTY file. *
* email : info at matsim dot org *
* *
* *********************************************************************** *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* See also COPYING, LICENSE and WARRANTY file *
* *
* *********************************************************************** */
package org.matsim.contrib.dvrp.run;
import org.apache.log4j.Logger;
import org.matsim.contrib.dynagent.run.DynQSimConfigConsistencyChecker;
import org.matsim.core.config.Config;
public class DvrpConfigConsistencyChecker
extends DynQSimConfigConsistencyChecker
{
private static final Logger log = Logger.getLogger(DvrpConfigConsistencyChecker.class);
@Override
public void checkConsistency(Config config)
{
super.checkConsistency(config);
if (!config.qsim().isInsertingWaitingVehiclesBeforeDrivingVehicles()) {
log.warn("Typically, vrp paths are calculated from startLink to endLink"
+ "(not from startNode to endNode). That requires making some assumptions"
+ "on how much time travelling on the first and last links takes. "
+ "The current implementation assumes freeflow travelling on the last link, "
+ "which is actually the case in QSim, and a 1-second stay on the first link. "
+ "The latter expectation is optimistic, and to make it more likely,"
+ "departing vehicles must be inserted befor driving ones "
+ "(though that still does not guarantee 1-second stay");
}
if (config.qsim().isRemoveStuckVehicles()) {
throw new RuntimeException("Stuck DynAgents cannot be removed from simulation");
}
DvrpConfigGroup dvrpCfg = DvrpConfigGroup.get(config);
double alpha = dvrpCfg.getTravelTimeEstimationAlpha();
if (alpha > 1 || alpha <= 0) {
throw new RuntimeException("travelTimeEstimationAlpha must be in (0,1]");
}
}
}
| [
"hoerl.sebastian@gmail.com"
] | hoerl.sebastian@gmail.com |
284599cd748bcfb335c365b70326442876880c3a | 83813ed39c7acdc17f2d18cabf1bc2c37c22d951 | /src/main/java/com/microservice/counth/CountH/controller/FirmanteController.java | 42ff954e6f1b61d94c1684d2dfc08cfe5297f832 | [] | no_license | davisvitate/MSSavingsaccount | 0831413282fb8524ef7f7eab39d695983f150207 | d5ca976ef9d264ea183e68dc35166093a8e6f47d | refs/heads/master | 2020-11-30T09:59:52.922060 | 2020-01-06T21:14:00 | 2020-01-06T21:14:00 | 230,370,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,028 | java | package com.microservice.counth.CountH.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.microservice.counth.CountH.model.Firmante;
import com.microservice.counth.CountH.services.CountHServices;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@RestController
@RequestMapping("/counth/firmante")
public class FirmanteController {
@Autowired
private CountHServices service;
@GetMapping
public Mono<ResponseEntity<Flux<Firmante>>> listaFirmante(){
return Mono.just(
ResponseEntity.ok()
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(service.findAllFirmante())
);
}
@RequestMapping(value = "/id/{id}", method = RequestMethod.GET)
@ResponseBody
public Mono<Firmante> findById(@PathVariable("id") String id) {
return service.findByIdFirmante(id);
}
@PostMapping
public Mono<Firmante> create(@RequestBody Firmante monoFirmante){
return service.saveFirmante(monoFirmante);
}
@DeleteMapping("/{id}")
public Mono<ResponseEntity<Void>> eliminar(@PathVariable String id){
return service.findByIdFirmante(id).flatMap(p ->{
return service.deleteFirmante(p).then(Mono.just(new ResponseEntity<Void>(HttpStatus.NO_CONTENT)));
}).defaultIfEmpty(new ResponseEntity<Void>(HttpStatus.NOT_FOUND));
}
}
| [
"davisvitate@gmail.com"
] | davisvitate@gmail.com |
1ee307ab2707a746abbff25ed6f07eff15463095 | 96445cb77dc0d1c34b404793af01b17e17172871 | /yarn/simple/src/test/java/org/springframework/yarn/examples/SimpleExampleTests.java | bb6c98c589b00b1af32d03f73e0f90db7ea9485c | [] | no_license | jvalkeal/spring-xd-yarn-examples | 7b19ad9524eddec507303212f14ec69e563b6f1a | fdc1dfc0ae8c7a3f5425ec412f26e72a0797fd8e | refs/heads/master | 2021-01-10T20:39:42.215344 | 2013-07-30T11:45:22 | 2013-07-30T11:45:22 | 11,173,036 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,770 | java | /*
* Copyright 2013 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.springframework.yarn.examples;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.net.URI;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.junit.Test;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.test.annotation.Timed;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.xd.rest.client.SpringXDOperations;
import org.springframework.xd.rest.client.StreamOperations;
import org.springframework.xd.rest.client.domain.StreamDefinitionResource;
import org.springframework.xd.rest.client.impl.SpringXDTemplate;
import org.springframework.yarn.test.context.MiniYarnCluster;
import org.springframework.yarn.test.context.YarnDelegatingSmartContextLoader;
import org.springframework.yarn.test.junit.AbstractYarnClusterTests;
/**
* Tests for Spring XD Yarn Simple example.
*
* @author Janne Valkealahti
*
*/
@ContextConfiguration(loader=YarnDelegatingSmartContextLoader.class)
@MiniYarnCluster
public class SimpleExampleTests extends AbstractYarnClusterTests {
@Test
@Timed(millis=240000)
public void testAppSubmission() throws Exception {
// submit and wait running state
ApplicationId applicationId = submitApplication();
assertNotNull(applicationId);
YarnApplicationState state = waitState(applicationId, 120, TimeUnit.SECONDS, YarnApplicationState.RUNNING);
assertNotNull(state);
assertTrue(state.equals(YarnApplicationState.RUNNING));
// wait and do ticktock put
Thread.sleep(20000);
doTickTockTimeLogPut(applicationId);
// assertTrue("Ticktock request failed", doTickTockTimeLogPut(applicationId));
// wait a bit for spring-xd containers to log something
Thread.sleep(10000);
// long running app, kill it and check that state is KILLED
killApplication(applicationId);
state = getState(applicationId);
assertTrue(state.equals(YarnApplicationState.KILLED));
// get log files
File workDir = getYarnCluster().getYarnWorkDir();
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
String locationPattern = "file:" + workDir.getAbsolutePath() + "/**/*.std*";
Resource[] resources = resolver.getResources(locationPattern);
// appmaster and 1 container should make it 4 log files
assertThat(resources, notNullValue());
assertThat(resources.length, is(4));
// do some checks for log file content
for (Resource res : resources) {
File file = res.getFile();
if (file.getName().endsWith("stdout")) {
// there has to be some content in stdout file
assertThat(file.length(), greaterThan(0l));
if (file.getName().equals("Container.stdout")) {
Scanner scanner = new Scanner(file);
String content = scanner.useDelimiter("\\A").next();
scanner.close();
// this is what xd container should log
assertThat(content, containsString("LoggingHandler"));
}
}
}
}
private StreamDefinitionResource doTickTockTimeLogPut(ApplicationId applicationId) throws Exception {
String url = findXdBaseUrl(applicationId);
SpringXDOperations springXDOperations = new SpringXDTemplate(URI.create(url));
StreamOperations streamOperations = springXDOperations.streamOperations();
streamOperations.destroyStream("ticktock");
StreamDefinitionResource stream = streamOperations.createStream("ticktock", "time | log", true);
return stream;
}
private String findXdBaseUrl(ApplicationId applicationId) {
// returned track url is "<rm manager>:xxxx//<node>:xxxx", we need the last part
return "http://" + getYarnClient().getApplicationReport(applicationId).getTrackingUrl().split("//")[1];
}
}
| [
"janne.valkealahti@gmail.com"
] | janne.valkealahti@gmail.com |
170ed515b4f3fb597df525c44370d9057da34580 | 99677a714b4294bc5353a6b72e1ae10707303f7b | /bos_sms/src/main/java/cn/itcast/bos/mq/MailConsumer.java | 94fc3a8a70b1df2e590382afc490545ef8faced0 | [] | no_license | mbacsx/Bos_test | 77a6f3c61442a3d12a27cd354b9695dd8e19203c | e74539731bc40d96a24f7f4e086b89fca02de08a | refs/heads/master | 2021-01-21T12:17:00.820251 | 2017-06-19T10:37:01 | 2017-06-19T10:37:01 | 90,856,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 718 | java | package cn.itcast.bos.mq;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;
import org.springframework.stereotype.Service;
import cn.itcast.bos.utils.MailUtils;
/**
* mq邮件
* @author May
*
*/
@Service("mailConsumer")
public class MailConsumer implements MessageListener {
@Override
public void onMessage(Message message) {
// 获取参数
MapMessage mapMessage = (MapMessage) message;
try {
MailUtils.sendMail(mapMessage.getString("email"),mapMessage.getString("content") );
} catch (JMSException e) {
e.printStackTrace();
throw new RuntimeException("邮件发送失败");
}
}
}
| [
"mbacsx@163.com"
] | mbacsx@163.com |
e50999c4412f5d0b2d45544087ef99cd6fc51527 | 8884a4768755c5100232d6ece2b075929ba092f0 | /webapp/src/main/java/ms/shopping/webapp/controller/ServletController.java | c2ac4687aa68923448d2c10d5e817372089504dd | [] | no_license | munishmrt16/msecommerce | 552a13147c69bd73f91cb6368d2dbd8bc1a1f6d2 | 6b13c44c0f77d42a112cd2a62f43079f059fa106 | refs/heads/master | 2021-01-11T03:27:16.047931 | 2016-10-20T04:23:36 | 2016-10-20T04:23:36 | 71,031,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,662 | java | package ms.shopping.webapp.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.PathVariable;
@Controller
public class ServletController {
@RequestMapping(value={"/"})
public ModelAndView gotoindex()
{
ModelAndView obj = new ModelAndView();
obj.setViewName("homepage");
return obj;
}
@RequestMapping("/aboutus")
public ModelAndView aboutUs(){
ModelAndView obj = new ModelAndView();
obj.setViewName("aboutus");
return obj;
}
@RequestMapping("/contact")
public ModelAndView contactus(){
ModelAndView obj = new ModelAndView();
obj.setViewName("contactus");
return obj;
}
@RequestMapping(value="/viewall/{pid}")
public ModelAndView viewallprod(@PathVariable("pid") String pid)
{
ModelAndView obj = new ModelAndView("viewall");
obj.addObject("pid",""+pid);
return obj;
}
@RequestMapping(value="/view/{pid}")
public ModelAndView display(@PathVariable("pid") String pid)
{
ModelAndView obj = new ModelAndView("view");
obj.addObject("pid",""+pid);
return obj;
}
@RequestMapping(value="/viewall")
public ModelAndView viewallmenu()
{
ModelAndView obj = new ModelAndView();
obj.setViewName("viewall");
return obj;
}
@RequestMapping("/signin")
public ModelAndView signin(){
ModelAndView obj = new ModelAndView();
obj.setViewName("signin");
return obj;
}
@RequestMapping("/signup")
public ModelAndView signup(){
ModelAndView obj = new ModelAndView();
obj.setViewName("signup");
return obj;
}
}
| [
"munishs.niit@gmail.com"
] | munishs.niit@gmail.com |
9e1ee6110cbf51e3e0131fbea469ab81be767fb9 | 23a4a438e90bb59facea5a35eea8713b93193ba7 | /app/src/main/java/info/tobidsn/cardview/MainActivity.java | d6ef382eb25d6a1e3c9c41072554f88960f94be3 | [] | no_license | tob47/CardView | 4f88f3b41cf4e3f57dded28e425ba279f9035a6b | fd89eb5d58b1f6a1429ea85c3b681ae169ac17eb | refs/heads/master | 2021-01-10T23:37:54.616674 | 2016-10-09T15:57:20 | 2016-10-09T15:57:20 | 70,414,003 | 0 | 0 | null | 2016-10-09T15:58:12 | 2016-10-09T15:58:12 | null | UTF-8 | Java | false | false | 6,320 | java | package info.tobidsn.cardview;
import android.content.res.Resources;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private RecyclerView recyclerView;
private AlbumsAdapter adapter;
private List<Album> albumList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
initCollapsingToolbar();
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
albumList = new ArrayList<>();
adapter = new AlbumsAdapter(this, albumList);
RecyclerView.LayoutManager mLayoutManager = new GridLayoutManager(this, 2);
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.addItemDecoration(new GridSpacingItemDecoration(2, dpToPx(10), true));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
prepareAlbums();
try {
Glide.with(this).load(R.drawable.cover).into((ImageView) findViewById(R.id.backdrop));
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Initializing collapsing toolbar
* Will show and hide the toolbar title on scroll
*/
private void initCollapsingToolbar() {
final CollapsingToolbarLayout collapsingToolbar =
(CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle(" ");
AppBarLayout appBarLayout = (AppBarLayout) findViewById(R.id.appbar);
appBarLayout.setExpanded(true);
// hiding & showing the title when toolbar expanded & collapsed
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
boolean isShow = false;
int scrollRange = -1;
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (scrollRange == -1) {
scrollRange = appBarLayout.getTotalScrollRange();
}
if (scrollRange + verticalOffset == 0) {
collapsingToolbar.setTitle(getString(R.string.app_name));
isShow = true;
} else if (isShow) {
collapsingToolbar.setTitle(" ");
isShow = false;
}
}
});
}
/**
* Adding few albums for testing
*/
private void prepareAlbums() {
int[] covers = new int[]{
R.drawable.album1,
R.drawable.album2,
R.drawable.album3,
R.drawable.album4,
R.drawable.album5,
R.drawable.album6,
R.drawable.album7,
R.drawable.album8,
R.drawable.album9,
R.drawable.album10,
R.drawable.album11};
Album a = new Album("True Romance", 13, covers[0]);
albumList.add(a);
a = new Album("Xscpae", 8, covers[1]);
albumList.add(a);
a = new Album("Maroon 5", 11, covers[2]);
albumList.add(a);
a = new Album("Born to Die", 12, covers[3]);
albumList.add(a);
a = new Album("Honeymoon", 14, covers[4]);
albumList.add(a);
a = new Album("I Need a Doctor", 1, covers[5]);
albumList.add(a);
a = new Album("Loud", 11, covers[6]);
albumList.add(a);
a = new Album("Legend", 14, covers[7]);
albumList.add(a);
a = new Album("Hello", 11, covers[8]);
albumList.add(a);
a = new Album("Greatest Hits", 17, covers[9]);
albumList.add(a);
adapter.notifyDataSetChanged();
}
/**
* RecyclerView item decoration - give equal margin around grid item
*/
public class GridSpacingItemDecoration extends RecyclerView.ItemDecoration {
private int spanCount;
private int spacing;
private boolean includeEdge;
public GridSpacingItemDecoration(int spanCount, int spacing, boolean includeEdge) {
this.spanCount = spanCount;
this.spacing = spacing;
this.includeEdge = includeEdge;
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
int position = parent.getChildAdapterPosition(view); // item position
int column = position % spanCount; // item column
if (includeEdge) {
outRect.left = spacing - column * spacing / spanCount; // spacing - column * ((1f / spanCount) * spacing)
outRect.right = (column + 1) * spacing / spanCount; // (column + 1) * ((1f / spanCount) * spacing)
if (position < spanCount) { // top edge
outRect.top = spacing;
}
outRect.bottom = spacing; // item bottom
} else {
outRect.left = column * spacing / spanCount; // column * ((1f / spanCount) * spacing)
outRect.right = spacing - (column + 1) * spacing / spanCount; // spacing - (column + 1) * ((1f / spanCount) * spacing)
if (position >= spanCount) {
outRect.top = spacing; // item top
}
}
}
}
/**
* Converting dp to pixel
*/
private int dpToPx(int dp) {
Resources r = getResources();
return Math.round(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, r.getDisplayMetrics()));
}
}
| [
"muhamadtobiin407@gmail.com"
] | muhamadtobiin407@gmail.com |
7d25afeeb6647c6846d6e572d9a84a51cf9ea4cb | 55b5730fc0c12e97d790d4d312c916147ae65806 | /app/src/main/java/com/mibtech/nirmalBakery/activity/LoginActivity.java | 4d7e6c34b62028662f0e78c8a0f5ad45723433f7 | [] | no_license | mibtechnologies/nirmal-app-final | 8300a1317898a1fab3e97c049e1555969c0d8430 | 94c74e3e18dc199eda40cd9e5a1a4fd6a5d22761 | refs/heads/master | 2023-02-27T05:39:50.429019 | 2021-02-05T19:39:56 | 2021-02-05T19:39:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44,956 | java | package com.mibtech.nirmalBakery.activity;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextPaint;
import android.text.method.LinkMovementMethod;
import android.text.style.ClickableSpan;
import android.text.style.UnderlineSpan;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatSpinner;
import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.FirebaseException;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthInvalidCredentialsException;
import com.google.firebase.auth.PhoneAuthCredential;
import com.google.firebase.auth.PhoneAuthProvider;
import org.jetbrains.annotations.NotNull;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import com.mibtech.nirmalBakery.R;
import com.mibtech.nirmalBakery.helper.ApiConfig;
import com.mibtech.nirmalBakery.helper.AppController;
import com.mibtech.nirmalBakery.helper.Constant;
import com.mibtech.nirmalBakery.helper.GPSTracker;
import com.mibtech.nirmalBakery.helper.PinView;
import com.mibtech.nirmalBakery.helper.ProgressDisplay;
import com.mibtech.nirmalBakery.helper.Session;
import com.mibtech.nirmalBakery.helper.Utils;
import com.mibtech.nirmalBakery.helper.VolleyCallback;
import com.mibtech.nirmalBakery.model.City;
public class LoginActivity extends AppCompatActivity implements OnMapReadyCallback {
ProgressDisplay progress;
LinearLayout lytchangpsw, lytforgot, lytlogin, signUpLyt, lytotp, lytverify, lytResetPass, lytPrivacy;
EditText edtCode, edtFCode, edtResetPass, edtResetCPass, edtnewpsw, edtRefer, edtoldpsw, edtforgotmobile, edtloginpassword, edtLoginMobile, edtname, edtemail, edtmobile, edtcity, edtPinCode, edtaddress, edtpsw, edtcpsw, edtMobVerify;//edtpincode
Button btnotpverify, btnEmailVerify, btnsubmit, btnResetPass;
String from, mobile, fromto, pincode, city, area, cityId = "0", areaId = "0";
PinView edtotp;
TextView txtmobileno, tvResend, tvSignUp, tvForgotPass, tvPrivacyPolicy, tvResendPass, tvTime;
ScrollView scrollView;
AppCompatSpinner cityspinner, areaSpinner;
ArrayList<City> cityArrayList, areaList;
SupportMapFragment mapFragment;
GPSTracker gps;
int selectedCityId = 0;
Session session;
Toolbar toolbar;
CheckBox chPrivacy;
////Firebase
String phoneNumber, firebase_otp, otpFor = "";
boolean isResendCall, isTimerStop;
FirebaseAuth auth;
PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallback;
public long leftTime;
Timer timer;
@SuppressLint("SetTextI18n")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
from = getIntent().getStringExtra("from");
fromto = getIntent().getStringExtra("fromto");
mobile = getIntent().getStringExtra("txtmobile");
firebase_otp = getIntent().getStringExtra("OTP");
gps = new GPSTracker(LoginActivity.this);
session = new Session(getApplicationContext());
cityArrayList = new ArrayList<>();
areaList = new ArrayList<>();
chPrivacy = findViewById(R.id.chPrivacy);
txtmobileno = findViewById(R.id.txtmobileno);
cityspinner = findViewById(R.id.cityspinner);
areaSpinner = findViewById(R.id.areaSpinner);
edtnewpsw = findViewById(R.id.edtnewpsw);
edtoldpsw = findViewById(R.id.edtoldpsw);
edtCode = findViewById(R.id.edtCode);
edtFCode = findViewById(R.id.edtFCode);
edtResetPass = findViewById(R.id.edtResetPass);
edtResetCPass = findViewById(R.id.edtResetCPass);
edtforgotmobile = findViewById(R.id.edtforgotmobile);
edtloginpassword = findViewById(R.id.edtloginpassword);
edtLoginMobile = findViewById(R.id.edtLoginMobile);
lytchangpsw = findViewById(R.id.lytchangpsw);
lytforgot = findViewById(R.id.lytforgot);
lytlogin = findViewById(R.id.lytlogin);
lytResetPass = findViewById(R.id.lytResetPass);
lytPrivacy = findViewById(R.id.lytPrivacy);
scrollView = findViewById(R.id.scrollView);
edtotp = findViewById(R.id.edtotp);
btnResetPass = findViewById(R.id.btnResetPass);
btnsubmit = findViewById(R.id.btnsubmit);
btnEmailVerify = findViewById(R.id.btnEmailVerify);
btnotpverify = findViewById(R.id.btnotpverify);
edtMobVerify = findViewById(R.id.edtMobVerify);
lytverify = findViewById(R.id.lytverify);
signUpLyt = findViewById(R.id.signUpLyt);
lytotp = findViewById(R.id.lytotp);
edtotp = findViewById(R.id.edtotp);
edtname = findViewById(R.id.edtname);
edtemail = findViewById(R.id.edtemail);
edtmobile = findViewById(R.id.edtmobile);
edtaddress = findViewById(R.id.edtaddress);
edtPinCode = findViewById(R.id.edtPinCode);
edtpsw = findViewById(R.id.edtpsw);
edtcpsw = findViewById(R.id.edtcpsw);
edtRefer = findViewById(R.id.edtRefer);
tvResend = findViewById(R.id.tvResend);
tvSignUp = findViewById(R.id.tvSignUp);
tvForgotPass = findViewById(R.id.tvForgotPass);
tvPrivacyPolicy = findViewById(R.id.tvPrivacy);
tvResendPass = findViewById(R.id.tvResendPass);
tvTime = findViewById(R.id.tvTime);
tvSignUp.setText(underlineSpannable(getString(R.string.not_registered)));
tvForgotPass.setText(underlineSpannable(getString(R.string.forgottext)));
tvResendPass.setText(underlineSpannable(getString(R.string.resend_cap)));
edtLoginMobile.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_phone, 0, 0, 0);
edtoldpsw.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_password, 0, R.drawable.ic_show, 0);
edtnewpsw.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_password, 0, R.drawable.ic_show, 0);
edtloginpassword.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_password, 0, R.drawable.ic_show, 0);
edtpsw.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_password, 0, R.drawable.ic_show, 0);
edtcpsw.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_password, 0, R.drawable.ic_show, 0);
edtResetPass.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_password, 0, R.drawable.ic_show, 0);
edtResetCPass.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_password, 0, R.drawable.ic_show, 0);
Utils.setHideShowPassword(edtpsw);
Utils.setHideShowPassword(edtcpsw);
Utils.setHideShowPassword(edtloginpassword);
Utils.setHideShowPassword(edtoldpsw);
Utils.setHideShowPassword(edtnewpsw);
Utils.setHideShowPassword(edtResetPass);
Utils.setHideShowPassword(edtResetCPass);
progress = new ProgressDisplay(this);
// Constant.country_code ="91"; // your country code
// edtCode.setText(Constant.country_code);
// edtFCode.setText(Constant.country_code);
if (from != null) {
switch (from) {
case "forgot":
lytforgot.setVisibility(View.VISIBLE);
break;
case "changepsw":
lytchangpsw.setVisibility(View.VISIBLE);
break;
case "reset_pass":
lytResetPass.setVisibility(View.VISIBLE);
break;
case "register":
lytverify.setVisibility(View.VISIBLE);
break;
case "otp_verify":
case "otp_forgot":
lytotp.setVisibility(View.VISIBLE);
txtmobileno.setText(getResources().getString(R.string.please_type_verification_code_sent_to) + " " + Constant.country_code + " " + mobile);
break;
default:
signUpLyt.setVisibility(View.VISIBLE);
edtmobile.setText(mobile);
edtRefer.setText(Constant.FRND_CODE);
SetCitySpinnerData();
break;
}
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} else {
lytlogin.setVisibility(View.VISIBLE);
}
cityspinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
city = cityspinner.getSelectedItem().toString();
cityId = cityArrayList.get(position).getCity_id();
SetAreaSpinnerData(cityId);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
areaSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
area = areaSpinner.getSelectedItem().toString();
areaId = areaList.get(position).getCity_id();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
ApiConfig.displayLocationSettingsRequest(LoginActivity.this);
ApiConfig.getLocation(LoginActivity.this);
mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
assert mapFragment != null;
mapFragment.getMapAsync(this);
StartFirebaseLogin();
PrivacyPolicy();
}
public void generateOTP() {
final String mobile = edtMobVerify.getText().toString().trim();
final String code = edtCode.getText().toString().trim();
if (ApiConfig.CheckValidattion(code, false, false)) {
edtCode.setError(getString(R.string.enter_country_code));
} else if (ApiConfig.CheckValidattion(mobile, false, false)) {
edtMobVerify.setError(getString(R.string.enter_mobile_no));
} else if (ApiConfig.CheckValidattion(mobile, false, true)) {
edtMobVerify.setError(getString(R.string.enter_valid_mobile_no));
} else if (AppController.isConnected(LoginActivity.this)) {
Constant.country_code = code;
Map<String, String> params = new HashMap<String, String>();
params.put(Constant.TYPE, Constant.VERIFY_USER);
params.put(Constant.MOBILE, mobile);
ApiConfig.RequestToVolley(new VolleyCallback() {
@Override
public void onSuccess(boolean result, String response) {
if (result) {
try {
System.out.println("=================*verify " + response);
JSONObject object = new JSONObject(response);
otpFor = "otp_verify";
phoneNumber = "+" + (Constant.country_code + mobile);
if (!object.getBoolean(Constant.ERROR)) {
sentRequest(phoneNumber);
} else {
setSnackBar(getString(R.string.verify_alert_1) + getString(R.string.app_name) + getString(R.string.verify_alert_2), getString(R.string.btn_ok), from);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, LoginActivity.this, Constant.RegisterUrl, params, true);
}
}
public void sentRequest(String phoneNumber) {
PhoneAuthProvider.getInstance().verifyPhoneNumber(
phoneNumber, // Phone number to verify
60, // Timeout duration
TimeUnit.SECONDS, // Unit of timeout
LoginActivity.this, // Activity (for callback binding)
mCallback);
}
private void StartFirebaseLogin() {
auth = FirebaseAuth.getInstance();
mCallback = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
@Override
public void onVerificationCompleted(@NotNull PhoneAuthCredential phoneAuthCredential) {
System.out.println("====verification complete call " + phoneAuthCredential.getSmsCode());
}
@Override
public void onVerificationFailed(@NotNull FirebaseException e) {
setSnackBar(e.getLocalizedMessage(), getString(R.string.btn_ok), "failed");
}
@Override
public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
super.onCodeSent(s, forceResendingToken);
Constant.verificationCode = s;
String mobileno = "";
starTimer();
if (!isResendCall) {
if (!isTimerStop) {
if (otpFor.equals("otp_forgot"))
mobileno = edtforgotmobile.getText().toString();
else
mobileno = edtMobVerify.getText().toString();
startActivity(new Intent(LoginActivity.this, LoginActivity.class)
.putExtra("from", otpFor)
.putExtra("txtmobile", mobileno)
.putExtra("OTP", s));
}
} else {
Toast.makeText(LoginActivity.this, R.string.resend_alert, Toast.LENGTH_SHORT).show();
}
}
};
}
public void ChangePassword() {
final Session sessionpsw = new Session(LoginActivity.this);
String oldpsw = edtoldpsw.getText().toString();
String password = edtnewpsw.getText().toString();
if (ApiConfig.CheckValidattion(oldpsw, false, false)) {
edtoldpsw.setError(getString(R.string.enter_old_pass));
} else if (ApiConfig.CheckValidattion(password, false, false)) {
edtnewpsw.setError(getString(R.string.enter_new_pass));
} else if (!oldpsw.equals(sessionpsw.getData(Session.KEY_Password))) {
edtoldpsw.setError(getString(R.string.no_match_old_pass));
} else if (AppController.isConnected(LoginActivity.this)) {
final Map<String, String> params = new HashMap<String, String>();
params.put(Constant.TYPE, Constant.CHANGE_PASSWORD);
params.put(Constant.PASSWORD, password);
params.put(Constant.ID, sessionpsw.getData(Session.KEY_ID));
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(LoginActivity.this);
// Setting Dialog Message
alertDialog.setTitle(getString(R.string.change_pass));
alertDialog.setMessage(getString(R.string.reset_alert_msg));
alertDialog.setCancelable(false);
final AlertDialog alertDialog1 = alertDialog.create();
// Setting OK Button
alertDialog.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
ApiConfig.RequestToVolley(new VolleyCallback() {
@Override
public void onSuccess(boolean result, String response) {
// System.out.println("=================*changepsw " + response);
if (result) {
try {
JSONObject object = new JSONObject(response);
if (!object.getBoolean(Constant.ERROR)) {
sessionpsw.logoutUser(LoginActivity.this);
}
Toast.makeText(LoginActivity.this, object.getString("message"), Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, LoginActivity.this, Constant.RegisterUrl, params, true);
}
});
alertDialog.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog1.dismiss();
}
});
// Showing Alert Message
alertDialog.show();
}
}
public void ResetPassword() {
String reset_psw = edtResetPass.getText().toString();
String reset_c_psw = edtResetCPass.getText().toString();
if (ApiConfig.CheckValidattion(reset_psw, false, false)) {
edtResetPass.setError(getString(R.string.enter_new_pass));
} else if (ApiConfig.CheckValidattion(reset_c_psw, false, false)) {
edtResetCPass.setError(getString(R.string.enter_confirm_pass));
} else if (!reset_psw.equals(reset_c_psw)) {
edtResetPass.setError(getString(R.string.pass_not_match));
} else if (AppController.isConnected(LoginActivity.this)) {
final Map<String, String> params = new HashMap<String, String>();
params.put(Constant.TYPE, Constant.CHANGE_PASSWORD);
params.put(Constant.PASSWORD, reset_c_psw);
//params.put(Constant.ID, session.getData(Session.KEY_ID));
params.put(Constant.ID, Constant.U_ID);
final AlertDialog.Builder alertDialog = new AlertDialog.Builder(LoginActivity.this);
// Setting Dialog Message
alertDialog.setTitle(getString(R.string.reset_pass));
alertDialog.setMessage(getString(R.string.reset_alert_msg));
alertDialog.setCancelable(false);
final AlertDialog alertDialog1 = alertDialog.create();
// Setting OK Button
alertDialog.setPositiveButton(getString(R.string.yes), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
ApiConfig.RequestToVolley(new VolleyCallback() {
@Override
public void onSuccess(boolean result, String response) {
if (result) {
try {
JSONObject object = new JSONObject(response);
if (!object.getBoolean(Constant.ERROR)) {
setSnackBar(getString(R.string.msg_reset_pass_success), getString(R.string.btn_ok), from);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, LoginActivity.this, Constant.RegisterUrl, params, true);
}
});
alertDialog.setNegativeButton(getString(R.string.no), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
alertDialog1.dismiss();
}
});
// Showing Alert Message
alertDialog.show();
}
}
public void RecoverPassword() {
isResendCall = false;
final String mobile = edtforgotmobile.getText().toString().trim();
String code = edtFCode.getText().toString().trim();
if (ApiConfig.CheckValidattion(code, false, false)) {
edtFCode.setError(getString(R.string.enter_country_code));
} else if (ApiConfig.CheckValidattion(mobile, false, false)) {
edtforgotmobile.setError(getString(R.string.enter_mobile_no));
} else if (mobile.length() != 0 && ApiConfig.CheckValidattion(mobile, false, true)) {
edtforgotmobile.setError(getString(R.string.enter_valid_mobile_no));
} else {
Constant.country_code = code;
Map<String, String> params = new HashMap<String, String>();
params.put(Constant.TYPE, Constant.VERIFY_USER);
params.put(Constant.MOBILE, mobile);
ApiConfig.RequestToVolley(new VolleyCallback() {
@Override
public void onSuccess(boolean result, String response) {
if (result) {
try {
//System.out.println("=================*verify " + response);
JSONObject object = new JSONObject(response);
otpFor = "otp_forgot";
phoneNumber = ("+" + Constant.country_code + mobile);
if (object.getBoolean(Constant.ERROR)) {
Constant.U_ID = object.getString(Constant.ID);
sentRequest(phoneNumber);
} else {
setSnackBar(getString(R.string.alert_register_num1) + getString(R.string.app_name) + getString(R.string.alert_register_num2), getString(R.string.btn_ok), from);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, LoginActivity.this, Constant.RegisterUrl, params, true);
}
}
public void UserLogin() {
String email = edtLoginMobile.getText().toString();
final String password = edtloginpassword.getText().toString();
if (ApiConfig.CheckValidattion(email, false, false)) {
edtLoginMobile.setError(getString(R.string.enter_mobile_no));
} else if (ApiConfig.CheckValidattion(email, false, true)) {
edtLoginMobile.setError(getString(R.string.enter_valid_mobile_no));
} else if (ApiConfig.CheckValidattion(password, false, false)) {
edtloginpassword.setError(getString(R.string.enter_pass));
} else if (AppController.isConnected(LoginActivity.this)) {
Map<String, String> params = new HashMap<String, String>();
params.put(Constant.MOBILE, email);
params.put(Constant.PASSWORD, password);
params.put(Constant.FCM_ID, "" + AppController.getInstance().getDeviceToken());
ApiConfig.RequestToVolley(new VolleyCallback() {
@Override
public void onSuccess(boolean result, String response) {
System.out.println("============login res " + response);
if (result) {
try {
JSONObject objectbject = new JSONObject(response);
if (!objectbject.getBoolean(Constant.ERROR)) {
StartMainActivity(objectbject, password);
}
Toast.makeText(LoginActivity.this, objectbject.getString("message"), Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, LoginActivity.this, Constant.LoginUrl, params, true);
}
}
public void setSnackBar(String message, String action, final String type) {
final Snackbar snackbar = Snackbar.make(findViewById(android.R.id.content), message, Snackbar.LENGTH_INDEFINITE);
snackbar.setAction(action, new View.OnClickListener() {
@Override
public void onClick(View view) {
if (type.equals("reset_pass") || type.equals("forgot") || type.equals("register")) {
Intent intent = new Intent(LoginActivity.this, LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
snackbar.dismiss();
}
});
snackbar.setActionTextColor(Color.RED);
View snackbarView = snackbar.getView();
TextView textView = snackbarView.findViewById(com.google.android.material.R.id.snackbar_text);
textView.setMaxLines(5);
snackbar.show();
}
public void OTP_Varification() {
String otptext = edtotp.getText().toString().trim();
if (ApiConfig.CheckValidattion(otptext, false, false)) {
edtotp.setError(getString(R.string.enter_otp));
} else {
PhoneAuthCredential credential = PhoneAuthProvider.getCredential(firebase_otp, otptext);
signInWithPhoneAuthCredential(credential, otptext);
}
}
private void signInWithPhoneAuthCredential(PhoneAuthCredential credential, final String otptext) {
auth.signInWithCredential(credential)
.addOnCompleteListener(LoginActivity.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
//verification successful we will start the profile activity
if (from.equalsIgnoreCase("otp_verify")) {
startActivity(new Intent(LoginActivity.this, LoginActivity.class).putExtra("from", "info").putExtra("txtmobile", mobile).putExtra("OTP", otptext));
} else {
startActivity(new Intent(LoginActivity.this, LoginActivity.class).putExtra("from", "reset_pass"));
}
edtotp.setError(null);
} else {
//verification unsuccessful.. display an error message
String message = "Something is wrong, we will fix it soon...";
if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
message = "Invalid code entered...";
}
edtotp.setError(message);
}
}
});
}
public void UserSignUpSubmit(String latitude, String longitude) {
String name = edtname.getText().toString().trim();
String email = "" + edtemail.getText().toString().trim();
String mobile = edtmobile.getText().toString().trim();
String address = edtaddress.getText().toString().trim();
String pincode = edtPinCode.getText().toString().trim();
final String password = edtpsw.getText().toString().trim();
String cpassword = edtcpsw.getText().toString().trim();
if (ApiConfig.CheckValidattion(name, false, false)) {
edtname.setError(getString(R.string.enter_name));
scrollView.scrollTo(0, edtname.getBottom());
} else if (ApiConfig.CheckValidattion(email, false, false))
edtemail.setError(getString(R.string.enter_email));
else if (ApiConfig.CheckValidattion(email, true, false))
edtemail.setError(getString(R.string.enter_valid_email));
else if (cityId.equals("0")) {
Toast.makeText(LoginActivity.this, getResources().getString(R.string.selectcity), Toast.LENGTH_LONG).show();
scrollView.scrollTo(0, cityspinner.getBottom());
} else if (areaId.equals("0")) {
Toast.makeText(LoginActivity.this, getResources().getString(R.string.selectarea), Toast.LENGTH_LONG).show();
scrollView.scrollTo(0, areaSpinner.getBottom());
} else if (ApiConfig.CheckValidattion(pincode, false, false)) {
edtPinCode.setError(getString(R.string.enter_pincode));
scrollView.scrollTo(0, edtPinCode.getBottom());
} else if (ApiConfig.CheckValidattion(address, false, false)) {
edtaddress.setError(getString(R.string.enter_address));
scrollView.scrollTo(0, edtaddress.getBottom());
} else if (ApiConfig.CheckValidattion(password, false, false)) {
edtpsw.setError(getString(R.string.enter_pass));
scrollView.scrollTo(0, edtpsw.getBottom());
} else if (ApiConfig.CheckValidattion(cpassword, false, false)) {
edtcpsw.setError(getString(R.string.enter_confirm_pass));
scrollView.scrollTo(0, edtcpsw.getBottom());
} else if (!password.equals(cpassword)) {
edtcpsw.setError(getString(R.string.pass_not_match));
scrollView.scrollTo(0, edtcpsw.getBottom());
} else if (latitude.equals("0") || longitude.equals("0"))
Toast.makeText(LoginActivity.this, getString(R.string.alert_select_location), Toast.LENGTH_LONG).show();
else if (!chPrivacy.isChecked()) {
Toast.makeText(LoginActivity.this, getString(R.string.alert_privacy_msg), Toast.LENGTH_LONG).show();
} else if (AppController.isConnected(LoginActivity.this)) {
Map<String, String> params = new HashMap<String, String>();
params.put(Constant.TYPE, Constant.REGISTER);
params.put(Constant.NAME, name);
params.put(Constant.EMAIL, email);
params.put(Constant.MOBILE, mobile);
params.put(Constant.PASSWORD, password);
params.put(Constant.PINCODE, pincode);
params.put(Constant.CITY_ID, cityId);
params.put(Constant.AREA_ID, areaId);
params.put(Constant.STREET, address);
params.put(Constant.LONGITUDE, longitude);
params.put(Constant.LATITUDE, latitude);
params.put(Constant.COUNTRY_CODE, Constant.country_code);
params.put(Constant.REFERRAL_CODE, Constant.randomAlphaNumeric(8));
params.put(Constant.FRIEND_CODE, edtRefer.getText().toString().trim());
params.put(Constant.FCM_ID, "" + AppController.getInstance().getDeviceToken());
// System.out.println("==========params " + params);
ApiConfig.RequestToVolley(new VolleyCallback() {
@Override
public void onSuccess(boolean result, String response) {
// System.out.println("=================*register " + response);
if (result) {
try {
JSONObject objectbject = new JSONObject(response);
if (!objectbject.getBoolean(Constant.ERROR)) {
StartMainActivity(objectbject, password);
}
Toast.makeText(LoginActivity.this, objectbject.getString("message"), Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, LoginActivity.this, Constant.RegisterUrl, params, true);
}
}
public void OnBtnClick(View view) {
int id = view.getId();
if (id == R.id.tvSignUp) {
startActivity(new Intent(LoginActivity.this, LoginActivity.class).putExtra("from", "register").putExtra("from", "register"));
} else if (id == R.id.tvForgotPass) {
startActivity(new Intent(LoginActivity.this, LoginActivity.class).putExtra("from", "forgot"));
} else if (id == R.id.btnchangepsw) {
ChangePassword();
} else if (id == R.id.btnResetPass) {
hideKeyboard(view);
ResetPassword();
} else if (id == R.id.btnrecover) {
hideKeyboard(view);
RecoverPassword();
} else if (id == R.id.tvResendPass) {
hideKeyboard(view);
RecoverPassword();
} else if (id == R.id.btnlogin) {
hideKeyboard(view);
UserLogin();
} else if (id == R.id.btnEmailVerify) {
// MobileVerification();
hideKeyboard(view);
generateOTP();
} else if (id == R.id.tvResend) {
generateOTP();
} else if (id == R.id.btnotpverify) {
hideKeyboard(view);
OTP_Varification();
} else if (id == R.id.btnsubmit) {
double saveLatitude = Double.parseDouble(new Session(getApplicationContext()).getCoordinates(Session.KEY_LATITUDE));
double saveLongitude = Double.parseDouble(new Session(getApplicationContext()).getCoordinates(Session.KEY_LONGITUDE));
if (saveLatitude == 0 || saveLongitude == 0) {
UserSignUpSubmit(String.valueOf(gps.latitude), String.valueOf(gps.longitude));
} else {
UserSignUpSubmit(new Session(getApplicationContext()).getCoordinates(Session.KEY_LATITUDE), new Session(getApplicationContext()).getCoordinates(Session.KEY_LONGITUDE));
}
} else if (id == R.id.tvUpdate) {
if (ApiConfig.isGPSEnable(LoginActivity.this))
startActivity(new Intent(LoginActivity.this, MapActivity.class));
else
ApiConfig.displayLocationSettingsRequest(LoginActivity.this);
}
}
public void StartMainActivity(JSONObject objectbject, String password) {
try {
new Session(LoginActivity.this).createUserLoginSession(AppController.getInstance().getDeviceToken(),
objectbject.getString(Constant.USER_ID),
objectbject.getString(Constant.NAME), objectbject.getString(Constant.EMAIL),
objectbject.getString(Constant.MOBILE), objectbject.getString(Constant.DOB),
objectbject.getString(Constant.CITY_NAME), objectbject.getString(Constant.AREA_NAME),
objectbject.getString(Constant.CITY_ID), objectbject.getString(Constant.AREA_ID),
objectbject.getString(Constant.STREET), objectbject.getString(Constant.PINCODE),
objectbject.getString(Constant.STATUS), objectbject.getString(Constant.CREATEDATE),
objectbject.getString(Constant.APIKEY), password, objectbject.getString(Constant.REFERRAL_CODE),
objectbject.getString(Constant.LATITUDE), objectbject.getString(Constant.LONGITUDE));
if (fromto != null && fromto.equals("checkout"))
startActivity(new Intent(LoginActivity.this, CheckoutActivity.class));
else {
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
//finishAffinity();
finish();
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return super.onSupportNavigateUp();
}
@Override
public void onMapReady(GoogleMap googleMap) {
final GoogleMap mMap = googleMap;
mMap.clear();
LatLng latLng;
double saveLatitude = Double.parseDouble(new Session(getApplicationContext()).getCoordinates(Session.KEY_LATITUDE));
double saveLongitude = Double.parseDouble(new Session(getApplicationContext()).getCoordinates(Session.KEY_LONGITUDE));
if (saveLatitude == 0 || saveLongitude == 0) {
latLng = new LatLng(gps.latitude, gps.longitude);
} else {
latLng = new LatLng(saveLatitude, saveLongitude);
}
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.addMarker(new MarkerOptions()
.position(latLng)
.draggable(true)
.title(getString(R.string.current_location)));
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomTo(17));
}
public void hideKeyboard(View v) {
try {
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
assert inputMethodManager != null;
inputMethodManager.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0);
} catch (Exception e) {
e.printStackTrace();
}
}
public class Timer extends CountDownTimer {
private Timer(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
@SuppressLint({"SetTextI18n", "DefaultLocale"})
@Override
public void onTick(long millisUntilFinished) {
leftTime = millisUntilFinished;
long totalSecs = (long) (millisUntilFinished / 1000.0);
long minutes = (totalSecs / 60);
long seconds = totalSecs % 60;
tvTime.setText("OTP expire in " + String.format("%02d", minutes) + ":" + String.format("%02d", seconds));
}
@SuppressLint("SetTextI18n")
@Override
public void onFinish() {
stopTimer();
tvTime.setText(getString(R.string.otp_receive_alert));
}
}
public void starTimer() {
isTimerStop = false;
timer = new Timer(60 * 1000, 1000);
timer.start();
}
public void stopTimer() {
if (timer != null) {
isTimerStop = true;
timer.cancel();
}
}
public SpannableString underlineSpannable(String text) {
SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new UnderlineSpan(), 0, text.length(), 0);
return spannableString;
}
public void PrivacyPolicy() {
tvPrivacyPolicy.setClickable(true);
tvPrivacyPolicy.setMovementMethod(LinkMovementMethod.getInstance());
String message = getString(R.string.msg_privacy_terms);
String s2 = getString(R.string.terms_conditions);
String s1 = getString(R.string.privacy_policy);
final Spannable wordtoSpan = new SpannableString(message);
wordtoSpan.setSpan(new ClickableSpan() {
@Override
public void onClick(View view) {
Intent privacy = new Intent(LoginActivity.this, WebViewActivity.class);
privacy.putExtra("type", "privacy");
startActivity(privacy);
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary));
ds.isUnderlineText();
}
}, message.indexOf(s1), message.indexOf(s1) + s1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
wordtoSpan.setSpan(new ClickableSpan() {
@Override
public void onClick(View view) {
Intent terms = new Intent(LoginActivity.this, WebViewActivity.class);
terms.putExtra("type", "terms");
startActivity(terms);
}
@Override
public void updateDrawState(TextPaint ds) {
super.updateDrawState(ds);
ds.setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary));
ds.isUnderlineText();
}
}, message.indexOf(s2), message.indexOf(s2) + s2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
tvPrivacyPolicy.setText(wordtoSpan);
}
private void SetCitySpinnerData() {
Map<String, String> params = new HashMap<String, String>();
cityArrayList.clear();
ApiConfig.RequestToVolley(new VolleyCallback() {
@Override
public void onSuccess(boolean result, String response) {
if (result) {
try {
// System.out.println("====res city " + response);
JSONObject objectbject = new JSONObject(response);
if (!objectbject.getBoolean(Constant.ERROR)) {
cityArrayList.add(0, new City("0", getString(R.string.select_city)));
JSONArray jsonArray = objectbject.getJSONArray(Constant.DATA);
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
if (session.getData(Session.KEY_CITY_ID).equals(jsonObject.getString(Constant.ID))) {
selectedCityId = i;
}
cityArrayList.add(new City(jsonObject.getString(Constant.ID), jsonObject.getString(Constant.NAME)));
}
cityspinner.setAdapter(new ArrayAdapter<City>(LoginActivity.this, R.layout.spinner_item, cityArrayList));
cityspinner.setSelection(selectedCityId);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, LoginActivity.this, Constant.CITY_URL, params, false);
}
private void SetAreaSpinnerData(String cityId) {
Map<String, String> params = new HashMap<String, String>();
params.put(Constant.CITY_ID, cityId);
areaList.clear();
ApiConfig.RequestToVolley(new VolleyCallback() {
@Override
public void onSuccess(boolean result, String response) {
if (result) {
try {
// System.out.println("====res area " + response);
JSONObject objectbject = new JSONObject(response);
if (!objectbject.getBoolean(Constant.ERROR)) {
JSONArray jsonArray = objectbject.getJSONArray(Constant.DATA);
areaList.add(0, new City("0", getString(R.string.select_area)));
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
areaList.add(new City(jsonObject.getString(Constant.ID), jsonObject.getString(Constant.NAME)));
}
areaSpinner.setAdapter(new ArrayAdapter<City>(LoginActivity.this, R.layout.spinner_item, areaList));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
}, LoginActivity.this, Constant.GET_AREA_BY_CITY, params, false);
}
@Override
public void onResume() {
mapFragment.getMapAsync(this);
super.onResume();
}
@Override
public void onPause() {
super.onPause();
}
}
| [
"Anfaas@123"
] | Anfaas@123 |
918f6e7c99f2106cc01ba99a9d5784edafbdb7b5 | 3940cc9b8238f0b7a8ff04fc29056974dc9c613b | /src/main/java/com/example/polls/payload/ForgotPasswordRequest.java | 8fb660a4f950360f09f9cc526916931569365b86 | [] | no_license | brodarnikola/SpringBoot_React | ca952d2c2988c4f0582d10fbd6aa0cb1f9276a63 | d978987ddae278241975b7cc46da65653bd306d9 | refs/heads/master | 2020-04-11T19:21:32.348643 | 2019-01-03T13:51:22 | 2019-01-03T13:51:22 | 162,031,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package com.example.polls.payload;
public class ForgotPasswordRequest {
private String email;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| [
"brodarnikola@gmail.com"
] | brodarnikola@gmail.com |
b3313c571485ac6cbe6a5b4a34206eb769bca6cd | 7d061da2921a0ac571d5d2ecb2f8107fd0af08ca | /src/interfaceBuilder/itemListeners/ChangeConfigListener.java | 3361f6836195735b7f231f83d3484c5b9f16e86d | [] | no_license | levanh/twitter | 32faf1f67468bc2c2d07f238cca2ce0ce047fb4c | f37cee2e0689e262d8ac249dd0ce9a90d9506a6a | refs/heads/master | 2021-01-10T08:39:31.581275 | 2015-12-14T15:04:54 | 2015-12-14T15:04:54 | 45,897,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package interfaceBuilder.itemListeners;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import utility.ChangeConfig;
public class ChangeConfigListener implements ItemListener{
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.DESELECTED) {
ChangeConfig.standardConfig();
}
else{
ChangeConfig.proxyConfig();
}
}
}
| [
"alexis.pernet@gmail.com"
] | alexis.pernet@gmail.com |
53e081592f45aac6882a6cbfd8775b315444d37e | 88e698e60d8c2eb939d515163a88ed5207ce06d1 | /app/src/main/java/com/yaksha/nota/adapter/DialogsListAdapter.java | c92849a1f37928e336112d87669977dc87e3567c | [] | no_license | yakshanota/MobileAppPreRelesae | 9a20790d110e7482d959cb4ff2d43a74a23b9f32 | 7b8c396b81268e17c91efaa3b86e8c913decfa8c | refs/heads/main | 2023-04-07T20:52:23.599883 | 2021-04-12T03:43:39 | 2021-04-12T03:43:39 | 357,047,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,430 | java | package com.yaksha.nota.adapter;
import android.content.Context;
import android.content.Intent;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.mikhaellopez.circularimageview.CircularImageView;
import java.util.List;
import github.ankushsachdeva.emojicon.EmojiconTextView;
import com.yaksha.nota.ProfileActivity;
import com.yaksha.nota.model.Chat;
import com.yaksha.nota.R;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
public class DialogsListAdapter extends RecyclerView.Adapter<DialogsListAdapter.ViewHolder> {
private Context ctx;
private List<Chat> items;
private OnItemClickListener mOnItemClickListener;
public interface OnItemClickListener {
void onItemClick(View view, Chat item, int position);
}
public void setOnItemClickListener(final OnItemClickListener mItemClickListener) {
this.mOnItemClickListener = mItemClickListener;
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView title, subtitle, count, time;
public CircularImageView image, online, verified;
public LinearLayout parent;
public EmojiconTextView message;
public ViewHolder(View view) {
super(view);
title = (TextView) view.findViewById(R.id.title);
subtitle = (TextView) view.findViewById(R.id.subtitle);
message = (EmojiconTextView) view.findViewById(R.id.message);
count = (TextView) view.findViewById(R.id.count);
time = (TextView) view.findViewById(R.id.time);
image = (CircularImageView) view.findViewById(R.id.image);
parent = (LinearLayout) view.findViewById(R.id.parent);
online = (CircularImageView) view.findViewById(R.id.online);
verified = (CircularImageView) view.findViewById(R.id.verified);
}
}
public DialogsListAdapter(Context mContext, List<Chat> items) {
this.ctx = mContext;
this.items = items;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_dialog_list_row, parent, false);
return new ViewHolder(itemView);
}
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
final Chat item = items.get(position);
holder.online.setVisibility(View.GONE);
if (item.getWithUserVerify() != 0) {
holder.verified.setVisibility(View.VISIBLE);
} else {
holder.verified.setVisibility(View.GONE);
}
if (item.getWithUserPhotoUrl().length() > 0) {
final ImageView img = holder.image;
try {
Glide.with(ctx)
.load(item.getWithUserPhotoUrl())
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
img.setImageResource(R.drawable.profile_default_photo);
img.setVisibility(View.VISIBLE);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
img.setVisibility(View.VISIBLE);
return false;
}
})
.into(holder.image);
} catch (Exception e) {
Log.e("DialogsListAdapter", e.toString());
}
} else {
holder.image.setImageResource(R.drawable.profile_default_photo);
}
holder.title.setText(item.getWithUserFullname());
holder.subtitle.setVisibility(View.GONE);
if (item.getLastMessage().length() != 0) {
holder.message.setText(item.getLastMessage().replaceAll("<br>", " "));
} else {
holder.message.setText(ctx.getString(R.string.label_last_message_image));
}
if (item.getLastMessageAgo().length() != 0) {
holder.time.setText(item.getLastMessageAgo());
} else {
holder.time.setText("");
}
if (item.getNewMessagesCount() == 0) {
holder.count.setVisibility(View.GONE);
holder.count.setText(Integer.toString(item.getNewMessagesCount()));
} else {
holder.count.setVisibility(View.VISIBLE);
holder.count.setText(Integer.toString(item.getNewMessagesCount()));
}
holder.parent.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mOnItemClickListener != null) {
mOnItemClickListener.onItemClick(v, items.get(position), position);
}
}
});
holder.image.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Chat chat = items.get(position);
Intent intent = new Intent(ctx, ProfileActivity.class);
intent.putExtra("profileId", chat.getWithUserId());
ctx.startActivity(intent);
}
});
}
public Chat getItem(int position) {
return items.get(position);
}
@Override
public int getItemCount() {
return items.size();
}
public interface OnClickListener {
void onItemClick(View view, Chat item, int pos);
}
} | [
"yaksha.nota@gmail.com"
] | yaksha.nota@gmail.com |
e44a7df4d7e23cf8303166c4b6ccef608d34a5e6 | 3b2a6594e734f23937e82289930b109cff6fbc99 | /src/main/java/br/gov/rn/saogoncalo/telecentro/dao/CoordenadorGeralDAO.java | f4f33ecdc700215f426d4dadc7badc0f1861278d | [
"MIT"
] | permissive | lucasnr/SAT | 39cdbc3a34d9e945e7770b7b2b9a52622e310f18 | 39dd07d5f931774008d3eac449749e32a61b32fb | refs/heads/master | 2022-11-27T23:42:08.857355 | 2021-03-04T14:52:42 | 2021-03-04T14:52:42 | 206,361,951 | 3 | 0 | MIT | 2022-11-24T10:01:15 | 2019-09-04T16:16:54 | Java | UTF-8 | Java | false | false | 193 | java | package br.gov.rn.saogoncalo.telecentro.dao;
import br.gov.rn.saogoncalo.telecentro.model.CoordenadorGeral;
public interface CoordenadorGeralDAO extends CoordenadorDAO<CoordenadorGeral> {
}
| [
"lucasnascimentoribeiro13@gmail.com"
] | lucasnascimentoribeiro13@gmail.com |
44f438c383171464356a51f20622fbecc3db69e8 | 6dd082d70c68269cd5e42dbf76a37ab6217e8332 | /jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/AnimationList.java | 6ca884b8c8c098e6e97122a616d50cbcb51a7aa1 | [
"BSD-3-Clause"
] | permissive | abc12345678910111/jmonkeyengine | e2e8eff719675fcab1d6676ac7fc9b8a08095158 | 017800251b2187117215c52c70d1db0f2f99ea25 | refs/heads/master | 2020-04-12T15:44:47.515916 | 2018-12-17T02:01:53 | 2018-12-17T02:01:53 | 162,591,057 | 0 | 0 | NOASSERTION | 2018-12-20T14:34:48 | 2018-12-20T14:34:47 | null | UTF-8 | Java | false | false | 3,033 | java | /*
* Copyright (c) 2009-2014 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of 'jMonkeyEngine' nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package com.jme3.scene.plugins.fbx;
import java.util.ArrayList;
import java.util.List;
/**
* Defines animations set that will be created while loading FBX scene
* <p>Animation <code>name</code> is using to access animation via {@link AnimControl}.<br>
* <code>firstFrame</code> and <code>lastFrame</code> defines animation time interval.<br>
* Use <code>layerName</code> also to define source animation layer in the case of multiple layers in the scene.<br>
* Skeletal animations will be created if only scene contain skeletal bones</p>
*/
public class AnimationList {
List<AnimInverval> list = new ArrayList<AnimInverval>();
/**
* Use in the case of multiple animation layers in FBX asset
* @param name - animation name to assess via {@link AnimControl}
* @param layerName - source layer
*/
public void add(String name, int firstFrame, int lastFrame) {
add(name, null, firstFrame, lastFrame);
}
/**
* Use in the case of multiple animation layers in FBX asset
* @param name - animation name to assess via {@link AnimControl}
* @param layerName - source layer
*/
public void add(String name, String layerName, int firstFrame, int lastFrame) {
AnimInverval cue = new AnimInverval();
cue.name = name;
cue.layerName = layerName;
cue.firstFrame = firstFrame;
cue.lastFrame = lastFrame;
list.add(cue);
}
static class AnimInverval {
String name;
String layerName;
int firstFrame;
int lastFrame;
}
}
| [
"anya.a.net@gmail.com"
] | anya.a.net@gmail.com |
5de89f3f0faeabeb877baf14af210b9d4d9f1425 | c9d7f105512d9d3d17f3917e07ef088fc56cbb79 | /src/main/java/com/carfactory/hatchback/cotroller/HatchbackController.java | 81d45f1af44cf322b5671f966c28670d067c526a | [] | no_license | gorertugrul/carfactory | a7be426e0b513fe63ebb590c00f78cb4966bbfe5 | f57060ff7cac6784780e4e27750ee370b441151f | refs/heads/master | 2023-04-26T21:56:19.942540 | 2021-05-09T11:46:31 | 2021-05-09T11:46:31 | 365,737,205 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package com.carfactory.hatchback.cotroller;
import com.carfactory.car.controller.CarController;
import com.carfactory.car.service.CarService;
import com.carfactory.hatchback.service.HatchbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/hatchback")
@CrossOrigin(origins = "*")
public class HatchbackController extends CarController {
@Autowired
HatchbackService service;
@Override
public CarService getService() {
return service;
}
}
| [
"ertgrlgor@gmail.com"
] | ertgrlgor@gmail.com |
7d183b9b18ac14526ccdd154f71a775a8d6a26a8 | a93090107506e94dc50c994079060790b078d087 | /app/src/main/java/arndt/com/workoutapp/activites/objects/workout/WorkoutGroup.java | dd2c4756b30112885122b0a28aa2549eda94393e | [] | no_license | unsupo/exerciseapp | cb2dc21e33b0a1c9616cc2310a5e6793b0436318 | 6ea0f1614c733de220cc4ca92e60baf3af373673 | refs/heads/master | 2020-06-20T07:04:53.066966 | 2019-07-15T18:19:28 | 2019-07-15T18:19:28 | 197,036,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package arndt.com.workoutapp.activites.objects.workout;
import arndt.com.workoutapp.activites.objects.Days;
public class WorkoutGroup {
/**
* WorkoutGroup
* String: name
* days: SuMTuWThFSa
* Even, Odd, Interval (every n days)
* GPS: AT (ie vasa location optional)
*/
String name;
Days days;
}
| [
"jarndt@demandware.com"
] | jarndt@demandware.com |
d407026e934515370aa7c1ec8cce1a3eb45e23ca | b5c485493f675bcc19dcadfecf9e775b7bb700ed | /jee-utility-client-controller/src/main/java/org/cyk/utility/client/controller/ControllerFunction.java | 0c24f2c582a8388bca23f5e94b5ad14367b119e8 | [] | no_license | devlopper/org.cyk.utility | 148a1aafccfc4af23a941585cae61229630b96ec | 14ec3ba5cfe0fa14f0e2b1439ef0f728c52ec775 | refs/heads/master | 2023-03-05T23:45:40.165701 | 2021-04-03T16:34:06 | 2021-04-03T16:34:06 | 16,252,993 | 1 | 0 | null | 2022-10-12T20:09:48 | 2014-01-26T12:52:24 | Java | UTF-8 | Java | false | false | 575 | java | package org.cyk.utility.client.controller;
import java.util.Collection;
import org.cyk.utility.system.SystemFunctionClient;
public interface ControllerFunction extends SystemFunctionClient {
ControllerFunction setActionEntityClass(Class<?> entityClass);
ControllerFunction addActionEntities(Object...entities);
ControllerFunction setActionEntityIdentifierClass(Class<?> entityIdentifierClass);
ControllerFunction addActionEntitiesIdentifiers(Collection<Object> entitiesIdentifiers);
ControllerFunction addActionEntitiesIdentifiers(Object...entitiesIdentifiers);
}
| [
"kycdev@gmail.com"
] | kycdev@gmail.com |
e647eeeaa86037e0640a8523c1c6bfbc47aa75e4 | ed55d5617bb267d423d25d6d0e3a4bea8e373126 | /src/Switch1.java | a8169a8b994a274a6928c47287dd9b239bb80c74 | [] | no_license | AmrutTrivedi/MyPrograms | 597fca33739cbc0e5b55338544900354b146e209 | 4bd7c62a472ff483b555e6efc28ecd616783ae81 | refs/heads/master | 2020-05-05T02:57:28.264628 | 2019-05-07T14:04:17 | 2019-05-07T14:04:17 | 179,656,371 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java |
public class Switch1 {
public static void main(String[] args) {
String levelString="Intermediate";
int level=4, l;
switch(levelString){
case "Beginner":
level=0;
l=level - 3;
break;
case "Intermediate":
level=1;
l=level - 2;
break;
case "Expert":
level=2;
l=level - 3;
break;
default: level=0;
l=level - 4;
break;
}
System.out.println("Your Level is: "+level);
}
}
| [
"amrut.trivedi@revature.com"
] | amrut.trivedi@revature.com |
92849b34ad6cf541223624012456c7bb519c61a9 | 00495a43d371c0660a7465b679c99dd4586275df | /manage-order-application/src/main/java/com/smartup/manageorderapplication/utils/mappers/ApiErrorDtoMapper.java | fb39aaaa0ee2a93b39166d436f57ef9f886020f3 | [] | no_license | alejandrocab/java8 | 1dec54c83bebee85c2fb28554e79448b6d9d7b17 | aea8fb41270f159da481d2948a59db351e4cf37e | refs/heads/master | 2021-05-19T09:32:22.743939 | 2020-03-31T14:44:22 | 2020-03-31T14:44:22 | 251,631,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,531 | java | package com.smartup.manageorderapplication.utils.mappers;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.springframework.context.MessageSource;
import org.springframework.context.support.DefaultMessageSourceResolvable;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.MethodArgumentNotValidException;
import com.smartup.manageorderapplication.dto.ApiErrorDto;
import com.smartup.manageorderapplication.exceptions.ClientNotFoundException;
import com.smartup.manageorderapplication.exceptions.OrderIdsInputInvalidException;
import com.smartup.manageorderapplication.exceptions.OrderUnavailableException;
import com.smartup.manageorderapplication.exceptions.ProductNotFoundException;
import com.smartup.manageorderapplication.exceptions.ShippingCityUnavailableException;
@Component
public class ApiErrorDtoMapper {
private MessageSource messageSource;
public ApiErrorDtoMapper(MessageSource messageSource) {
this.messageSource=messageSource;
}
public ApiErrorDto runtimeException2Dto(RuntimeException ex){
return ApiErrorDto.builder()
.errorCode("000")
.message(ex.getMessage())
.build();
}
public ApiErrorDto constraintViolationException2Dto(MethodArgumentNotValidException ex, HttpServletRequest request){
return ApiErrorDto.builder()
.errorCode("999")
.message(messageSource.getMessage("validation.errors", null, request.getLocale()))
.validationErrors(ex.getBindingResult().getAllErrors().stream().map(DefaultMessageSourceResolvable::getDefaultMessage).collect(Collectors.toList()))
.build();
}
public ApiErrorDto shippingCityUnavailableException2Dto(ShippingCityUnavailableException ex, HttpServletRequest request){
String errorMessage = messageSource.getMessage(ShippingCityUnavailableException.ERROR_CODE, new String[] {ex.getCityName()}, request.getLocale());
return ApiErrorDto.builder()
.errorCode(ShippingCityUnavailableException.ERROR_CODE)
.message(errorMessage)
.build();
}
public ApiErrorDto clientNotFoundException2Dto(ClientNotFoundException ex, HttpServletRequest request){
String errorMessage = messageSource.getMessage(ClientNotFoundException.ERROR_CODE, new Long[] {ex.getIdClient()}, request.getLocale());
return ApiErrorDto.builder()
.errorCode(ClientNotFoundException.ERROR_CODE)
.message(errorMessage)
.build();
}
public ApiErrorDto productNotFoundException2Dto(ProductNotFoundException ex, HttpServletRequest request){
String errorMessage = messageSource.getMessage(ProductNotFoundException.ERROR_CODE, new Long[] {ex.getIdProduct()}, request.getLocale());
return ApiErrorDto.builder()
.errorCode(ProductNotFoundException.ERROR_CODE)
.message(errorMessage)
.build();
}
public ApiErrorDto orderUnavailableException2Dto(OrderUnavailableException ex, HttpServletRequest request){
String errorMessage = messageSource.getMessage(OrderUnavailableException.ERROR_CODE, new Long[] {ex.getIdClient()}, request.getLocale());
return ApiErrorDto.builder()
.errorCode(OrderUnavailableException.ERROR_CODE)
.message(errorMessage)
.build();
}
public ApiErrorDto orderIdsInputInvalidException2Dto(OrderIdsInputInvalidException ex, HttpServletRequest request){
String errorMessage = messageSource.getMessage(OrderIdsInputInvalidException.ERROR_CODE, null, request.getLocale());
return ApiErrorDto.builder()
.errorCode(OrderIdsInputInvalidException.ERROR_CODE)
.message(errorMessage)
.build();
}
}
| [
"alejandro.aranguez@soprasteria.com"
] | alejandro.aranguez@soprasteria.com |
db4f1026d2ddff888046b8434fcda9b7378acd2f | fbf27d453d933352a2c8ef76e0445f59e6b5d304 | /server/src/com/fy/engineserver/activity/silvercar/SilvercarManager.java | 4c8862674219c26e01034f793b7c81ebb8b0a2ae | [] | no_license | JoyPanda/wangxian_server | 0996a03d86fa12a5a884a4c792100b04980d3445 | d4a526ecb29dc1babffaf607859b2ed6947480bb | refs/heads/main | 2023-06-29T05:33:57.988077 | 2021-04-06T07:29:03 | 2021-04-06T07:29:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,619 | java | package com.fy.engineserver.activity.silvercar;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fy.engineserver.activity.CheckAttribute;
import com.fy.engineserver.chat.ChatMessage;
import com.fy.engineserver.chat.ChatMessageService;
import com.fy.engineserver.country.manager.CountryManager;
import com.fy.engineserver.datasource.article.manager.ArticleManager;
import com.fy.engineserver.datasource.language.Translate;
import com.fy.engineserver.newtask.service.TaskSubSystem;
import com.fy.engineserver.sprite.Player;
import com.fy.engineserver.util.ServiceStartRecord;
import com.fy.engineserver.util.StringTool;
import com.fy.engineserver.util.TimeTool;
/**
* 押镖活动配置管理器
*
*/
@CheckAttribute("押镖活动配置")
public class SilvercarManager {
public static Logger logger = LoggerFactory.getLogger(TaskSubSystem.class);
@CheckAttribute("文件路径")
private String filePath;
@CheckAttribute(value = "任务配置", des = "<任务名,配置>")
private HashMap<String, SilvercarTaskCfg> taskCfgMap = new HashMap<String, SilvercarTaskCfg>();
@CheckAttribute(value = "掉落配置", des = "<NPC模板ID,掉率>")
private HashMap<Integer, List<SilvercarDropCfg>> dropMap = new HashMap<Integer, List<SilvercarDropCfg>>();
@CheckAttribute(value = "加货刷新规则")
private double[] refreshRate;
@CheckAttribute(value = "家族运镖任务名字")
private String masterTask;
@CheckAttribute(value = "家族运镖任务扣钱")
private int masterTaskMoney;
@CheckAttribute(value = "个人镖车ID")
private int selfCarId;
@CheckAttribute(value = "家族镖车ID")
private int jiazuCarId;
@CheckAttribute(value = "个人运镖任务组名")
private String selfCarTaskGroupName;
@CheckAttribute(value = "家族运镖任务组名")
private String jiazuCarTaskGroupName;
@CheckAttribute(value = "国运经验加成")
private double countryTrafficRate;
@CheckAttribute(value = "镖车求救间隔")
private long carCallForhelpDistance;
@CheckAttribute(value = "角色救车的时间间隔")
private long playerHelpSilvercarDistance = 30 * TimeTool.TimeDistance.SECOND.getTimeMillis();
@CheckAttribute(value = "角色救车的时间间隔")
private double noticeHPLimit = 0.9;
@CheckAttribute(value = "各种颜色车大小")
private double[] carSize;
@CheckAttribute(value = "家族运镖奖励物品")
private String jiazuSilvercarOtherPrize;;
@CheckAttribute(value = "家族运镖奖励物品颜色几率")
private double[] jiazuSilvercarOtherPrizeRate;
@CheckAttribute(value = "破碎镖车")
private double[] jiazuSilvercarOtherPrizeRate4posui;
@CheckAttribute(value = "白色镖车")
private double[] jiazuSilvercarOtherPrizeRate4bai;
@CheckAttribute(value = "绿色镖车")
private double[] jiazuSilvercarOtherPrizeRate4lv;
@CheckAttribute(value = "蓝色镖车")
private double[] jiazuSilvercarOtherPrizeRate4lan;
@CheckAttribute(value = "紫色镖车")
private double[] jiazuSilvercarOtherPrizeRate4zi;
@CheckAttribute(value = "橙色镖车")
private double[] jiazuSilvercarOtherPrizeRate4cheng;
private static SilvercarManager instance;
private SilvercarManager() {
}
public static SilvercarManager getInstance() {
return instance;
}
public static Logger getLogger() {
return logger;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public HashMap<String, SilvercarTaskCfg> getTaskCfgMap() {
return taskCfgMap;
}
public HashMap<Integer, List<SilvercarDropCfg>> getDropMap() {
return dropMap;
}
public double[] getRefreshRate() {
return refreshRate;
}
public String getMasterTask() {
return masterTask;
}
public int getMasterTaskMoney() {
return masterTaskMoney;
}
public int getSelfCarId() {
return selfCarId;
}
public int getJiazuCarId() {
return jiazuCarId;
}
public String getSelfCarTaskGroupName() {
return selfCarTaskGroupName;
}
public String getJiazuCarTaskGroupName() {
return jiazuCarTaskGroupName;
}
public double getCountryTrafficRate() {
return countryTrafficRate;
}
public long getCarCallForhelpDistance() {
return carCallForhelpDistance;
}
public long getPlayerHelpSilvercarDistance() {
return playerHelpSilvercarDistance;
}
public double getNoticeHPLimit() {
return noticeHPLimit;
}
public double[] getCarSize() {
return carSize;
}
public String getJiazuSilvercarOtherPrize() {
return jiazuSilvercarOtherPrize;
}
public double[] getJiazuSilvercarOtherPrizeRate() {
return jiazuSilvercarOtherPrizeRate;
}
private void load() throws Exception {
try {
File file = new File(getFilePath());
if (!file.exists()) {
logger.error("[押镖文件加载][异常][文件不存在]");
throw new Exception();
}
InputStream is = new FileInputStream(file);
POIFSFileSystem pss = new POIFSFileSystem(is);
HSSFWorkbook workbook = new HSSFWorkbook(pss);
HSSFSheet sheet = workbook.getSheetAt(0);
int maxRow = sheet.getPhysicalNumberOfRows();
for (int i = 1; i < maxRow; i++) {
HSSFRow row = sheet.getRow(i);
int index = 0;
String taskName = row.getCell(index++).getStringCellValue();
String needArticleName = row.getCell(index++).getStringCellValue();
int needArticleColor = (int) row.getCell(index++).getNumericCellValue();
int needMoney = (int) row.getCell(index++).getNumericCellValue();
SilvercarTaskCfg cfg = new SilvercarTaskCfg(taskName, needArticleName, needArticleColor, needMoney);
taskCfgMap.put(cfg.getTaskName(), cfg);
}
sheet = workbook.getSheetAt(1);
maxRow = sheet.getPhysicalNumberOfRows();
for (int i = 1; i < maxRow; i++) {
HSSFRow row = sheet.getRow(i);
int index = 0;
int npcTempletId = (int) row.getCell(index++).getNumericCellValue();
int carColor = (int) row.getCell(index++).getNumericCellValue();
int[] dropColor = new int[]{StringTool.getCellValue(row.getCell(index++), int.class)};
double[] dropRate = Double2double(StringTool.string2Array(StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
String[] dropName = StringTool.string2Array(StringTool.getCellValue(row.getCell(index++), String.class), ",", String.class);
SilvercarDropCfg cfg = new SilvercarDropCfg(npcTempletId, carColor, dropColor, dropName, dropRate);
if (!dropMap.containsKey(cfg.getNpcTempletId())) {
dropMap.put(cfg.getNpcTempletId(), new ArrayList<SilvercarDropCfg>());
}
dropMap.get(cfg.getNpcTempletId()).add(cfg);
}
sheet = workbook.getSheetAt(2);
int index = 0;
HSSFRow row = sheet.getRow(1);
refreshRate = Double2double(StringTool.string2Array(StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
masterTask = row.getCell(index++).getStringCellValue();
masterTaskMoney = StringTool.getCellValue(row.getCell(index++), int.class);
selfCarId = StringTool.getCellValue(row.getCell(index++), int.class);
jiazuCarId = StringTool.getCellValue(row.getCell(index++), int.class);
selfCarTaskGroupName = row.getCell(index++).getStringCellValue();
jiazuCarTaskGroupName = row.getCell(index++).getStringCellValue();
countryTrafficRate = StringTool.getCellValue(row.getCell(index++), double.class);
carCallForhelpDistance = StringTool.getCellValue(row.getCell(index++), long.class) * TimeTool.TimeDistance.SECOND.getTimeMillis();
carSize = Double2double(StringTool.string2Array(StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
jiazuSilvercarOtherPrize = StringTool.getCellValue(row.getCell(index++), String.class);
jiazuSilvercarOtherPrizeRate = Double2double(StringTool.string2Array( StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
jiazuSilvercarOtherPrizeRate4posui = Double2double(StringTool.string2Array( StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
jiazuSilvercarOtherPrizeRate4bai = Double2double(StringTool.string2Array( StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
jiazuSilvercarOtherPrizeRate4lv = Double2double(StringTool.string2Array( StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
jiazuSilvercarOtherPrizeRate4lan = Double2double(StringTool.string2Array( StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
jiazuSilvercarOtherPrizeRate4zi = Double2double(StringTool.string2Array( StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
jiazuSilvercarOtherPrizeRate4cheng = Double2double(StringTool.string2Array( StringTool.getCellValue(row.getCell(index++), String.class), ",", Double.class));
} catch (Exception e) {
logger.error("[押镖配置异常]", e);
throw e;
}
}
public double[] getRateByColor(int color) {
if (color <= 0) {
return jiazuSilvercarOtherPrizeRate4posui;
} else if (color <= 1) {
return jiazuSilvercarOtherPrizeRate4bai;
} else if (color <= 2) {
return jiazuSilvercarOtherPrizeRate4lv;
} else if (color <= 3) {
return jiazuSilvercarOtherPrizeRate4lan;
} else if (color <= 4) {
return jiazuSilvercarOtherPrizeRate4zi;
} else {
return jiazuSilvercarOtherPrizeRate4cheng;
}
}
private double[] Double2double(Double[] value) {
double[] res = new double[value.length];
for (int i = 0; i < value.length; i++) {
res[i] = value[i];
}
return res;
}
private int[] Integer2int(Integer[] value) {
int[] res = new int[value.length];
for (int i = 0; i < value.length; i++) {
res[i] = value[i];
}
return res;
}
/**
* 通知世界某人得到了某颜色的镖车
* @param player
* @param color
*/
public static void sneerAt(Player player, int color) {
if (logger.isInfoEnabled()) logger.info(player.getLogString() + "[接到了镖车颜色:{}]", new Object[] { color });
if (color >= ArticleManager.equipment_color_紫) {// 紫色和紫色以上的通知
ChatMessage msg = new ChatMessage();
StringBuffer sbf = new StringBuffer();
// 恭喜@STRING_1@ 的 @STRING_2@得到了@STRING_3@镖车!
Translate.translateString(Translate.镖车公告, new String[][] { { Translate.STRING_1, CountryManager.得到国家名(player.getCountry()) }, { Translate.STRING_2, player.getName() }, { Translate.STRING_3, ArticleManager.color_article_Strings[color] } });
// sbf.append("<f color='").append(ArticleManager.color_article[color]).append("'>").append("恭喜").append(CountryManager.得到国家名(player.getCountry())).append(" 的 ").append(player.getName()).append(" 得到了 ").append(ArticleManager.color_article_Strings[color]).append("镖车").append("</f>");
sbf.append("<f color='").append(ArticleManager.color_article[color]).append("'>").append(Translate.translateString(Translate.镖车公告, new String[][] { { Translate.STRING_1, CountryManager.得到国家名(player.getCountry()) }, { Translate.STRING_2, player.getName() }, { Translate.STRING_3, ArticleManager.color_article_Strings[color] } })).append("</f>");
msg.setMessageText(sbf.toString());
if (logger.isInfoEnabled()) logger.info(player.getLogString() + "[接到了镖车颜色:{}][发送消息:{}]", new Object[] { color, msg.getMessageText() });
try {
ChatMessageService.getInstance().sendMessageToSystem(msg);
} catch (Exception e) {
e.printStackTrace();
}
}
}
public void init() throws Exception {
instance = this;
instance.load();
ServiceStartRecord.startLog(this);
}
public double[] getJiazuSilvercarOtherPrizeRate4posui() {
return jiazuSilvercarOtherPrizeRate4posui;
}
public void setJiazuSilvercarOtherPrizeRate4posui(double[] jiazuSilvercarOtherPrizeRate4posui) {
this.jiazuSilvercarOtherPrizeRate4posui = jiazuSilvercarOtherPrizeRate4posui;
}
public double[] getJiazuSilvercarOtherPrizeRate4bai() {
return jiazuSilvercarOtherPrizeRate4bai;
}
public void setJiazuSilvercarOtherPrizeRate4bai(double[] jiazuSilvercarOtherPrizeRate4bai) {
this.jiazuSilvercarOtherPrizeRate4bai = jiazuSilvercarOtherPrizeRate4bai;
}
public double[] getJiazuSilvercarOtherPrizeRate4lv() {
return jiazuSilvercarOtherPrizeRate4lv;
}
public void setJiazuSilvercarOtherPrizeRate4lv(double[] jiazuSilvercarOtherPrizeRate4lv) {
this.jiazuSilvercarOtherPrizeRate4lv = jiazuSilvercarOtherPrizeRate4lv;
}
public double[] getJiazuSilvercarOtherPrizeRate4lan() {
return jiazuSilvercarOtherPrizeRate4lan;
}
public void setJiazuSilvercarOtherPrizeRate4lan(double[] jiazuSilvercarOtherPrizeRate4lan) {
this.jiazuSilvercarOtherPrizeRate4lan = jiazuSilvercarOtherPrizeRate4lan;
}
public double[] getJiazuSilvercarOtherPrizeRate4zi() {
return jiazuSilvercarOtherPrizeRate4zi;
}
public void setJiazuSilvercarOtherPrizeRate4zi(double[] jiazuSilvercarOtherPrizeRate4zi) {
this.jiazuSilvercarOtherPrizeRate4zi = jiazuSilvercarOtherPrizeRate4zi;
}
public double[] getJiazuSilvercarOtherPrizeRate4cheng() {
return jiazuSilvercarOtherPrizeRate4cheng;
}
public void setJiazuSilvercarOtherPrizeRate4cheng(double[] jiazuSilvercarOtherPrizeRate4cheng) {
this.jiazuSilvercarOtherPrizeRate4cheng = jiazuSilvercarOtherPrizeRate4cheng;
}
}
| [
"1414464063@qq.com"
] | 1414464063@qq.com |
3d3097a1640649f153cf8fac5a144ecfaa2d37fe | 7f383314fe0211526f8d743528c034fd50af64da | /app/src/main/java/com/poovarasan/miu/widget/FrameLayoutFixed.java | 2db1be2aaa70aa0219036de7237650f0c0544f21 | [] | no_license | poovarasanvasudevan/SHPT-AA | 0f67142f60cac411dea1bc3644257fea4b12b8fc | 183056d9c73938bbd8dd78292f32d59b32df7d02 | refs/heads/master | 2020-06-25T14:21:52.777602 | 2016-11-11T12:29:13 | 2016-11-11T12:29:13 | 66,633,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,194 | java | package com.poovarasan.miu.widget;
/**
* Created by poovarasanv on 3/11/16.
*/
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import java.util.ArrayList;
public class FrameLayoutFixed extends FrameLayout {
private final ArrayList<View> mMatchParentChildren = new ArrayList<View>(1);
public FrameLayoutFixed(Context context) {
super(context);
}
public FrameLayoutFixed(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FrameLayoutFixed(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public final int getMeasuredStateFixed(View view) {
return (view.getMeasuredWidth() & 0xff000000)
| ((view.getMeasuredHeight() >> 16)
& (0xff000000 >> 16));
}
public static int resolveSizeAndStateFixed(int size, int measureSpec, int childMeasuredState) {
int result = size;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);
switch (specMode) {
case MeasureSpec.UNSPECIFIED:
result = size;
break;
case MeasureSpec.AT_MOST:
if (specSize < size) {
result = specSize | 0x01000000;
} else {
result = size;
}
break;
case MeasureSpec.EXACTLY:
result = specSize;
break;
}
return result | (childMeasuredState & 0xff000000);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
try {
int count = getChildCount();
final boolean measureMatchParentChildren =
MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.EXACTLY ||
MeasureSpec.getMode(heightMeasureSpec) != MeasureSpec.EXACTLY;
mMatchParentChildren.clear();
int maxHeight = 0;
int maxWidth = 0;
int childState = 0;
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() != GONE) {
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
maxWidth = Math.max(maxWidth,
child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin);
maxHeight = Math.max(maxHeight,
child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin);
childState |= getMeasuredStateFixed(child);
if (measureMatchParentChildren) {
if (lp.width == LayoutParams.MATCH_PARENT ||
lp.height == LayoutParams.MATCH_PARENT) {
mMatchParentChildren.add(child);
}
}
}
}
// Account for padding too
maxWidth += getPaddingLeft() + getPaddingRight();
maxHeight += getPaddingTop() + getPaddingBottom();
// Check against our minimum height and width
maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight());
maxWidth = Math.max(maxWidth, getSuggestedMinimumWidth());
// Check against our foreground's minimum height and width
final Drawable drawable = getForeground();
if (drawable != null) {
maxHeight = Math.max(maxHeight, drawable.getMinimumHeight());
maxWidth = Math.max(maxWidth, drawable.getMinimumWidth());
}
setMeasuredDimension(resolveSizeAndStateFixed(maxWidth, widthMeasureSpec, childState),
resolveSizeAndStateFixed(maxHeight, heightMeasureSpec, childState << MEASURED_HEIGHT_STATE_SHIFT));
count = mMatchParentChildren.size();
if (count > 1) {
for (int i = 0; i < count; i++) {
final View child = mMatchParentChildren.get(i);
final MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
int childWidthMeasureSpec;
int childHeightMeasureSpec;
if (lp.width == LayoutParams.MATCH_PARENT) {
childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth() -
getPaddingLeft() - getPaddingRight() -
lp.leftMargin - lp.rightMargin,
MeasureSpec.EXACTLY);
} else {
childWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec,
getPaddingLeft() + getPaddingRight() +
lp.leftMargin + lp.rightMargin,
lp.width);
}
if (lp.height == LayoutParams.MATCH_PARENT) {
childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight() -
getPaddingTop() - getPaddingBottom() -
lp.topMargin - lp.bottomMargin,
MeasureSpec.EXACTLY);
} else {
childHeightMeasureSpec = getChildMeasureSpec(heightMeasureSpec,
getPaddingTop() + getPaddingBottom() +
lp.topMargin + lp.bottomMargin,
lp.height);
}
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
}
}
} catch (Exception e) {
// FileLog.e("tmessages", e);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
} | [
"poosan9@gmail.com"
] | poosan9@gmail.com |
01e7e449e19d2383796a09921b51b88285fe5a6c | 49433263dddaa834b7be5e21a591db5176775fbb | /SpringCore/SpringCoreDemo/src/main/java/com/techstack/spring/annotations/autowired/setter/AppConfig.java | fb9a5aa4d48dd7ad84b05edd6121135a49035f81 | [] | no_license | andrewsselvaraj/spring-boot-demo | 120f3427fdf5be89e017729b1c0d09b2b28ebbb1 | a13741d8c4e7b603aa6eaf0f6013d20808637143 | refs/heads/master | 2022-09-10T05:49:30.078730 | 2020-06-03T16:20:22 | 2020-06-03T16:20:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 372 | java | /**
*
*/
package com.techstack.spring.annotations.autowired.setter;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
* @author KARTHIKEYAN N
*
*/
@Configuration
@ComponentScan(basePackages = "com.techstack.spring.annotations.autowired.setter")
public class AppConfig {
} | [
"karthikeyan.ng@gmail.com"
] | karthikeyan.ng@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.