blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
โ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
478f7570bb15fcacaacd9fa9e81e048436df1850 | 86bdb73c1a97747c4aba6589e74ef5f86b1a4fa7 | /modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/diagnostic/pagelocktracker/DumpSupported.java | d2f937ed3707ebf9809c17e3439e8df57f2b4a19 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-gutenberg-2020",
"CC0-1.0"
] | permissive | hawkore/ignite-hk | 72f7b4f345e814ea1e20be148ec8af16ed1d7cef | 8084a90c0fc80a667fa4387f60b4bf8f925b5590 | refs/heads/master | 2022-11-11T03:20:28.228882 | 2022-10-21T04:31:03 | 2022-10-21T04:31:03 | 164,684,281 | 6 | 3 | Apache-2.0 | 2022-04-12T22:00:58 | 2019-01-08T15:59:41 | Java | UTF-8 | Java | false | false | 1,329 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.processors.cache.persistence.diagnostic.pagelocktracker;
import org.apache.ignite.lang.IgniteFuture;
/**
* Interface for all page lock tracker entries which support dumping.
*/
public interface DumpSupported<T extends PageLockDump> {
/** */
boolean acquireSafePoint();
/** */
boolean releaseSafePoint();
/**
* Create dump.
*/
T dump();
/**
* Create dump async.
*
* @return Ignite future.
*/
IgniteFuture<T> dumpSync();
}
| [
"[email protected]"
] | |
8602c08970cb424882d9403e0abffc5b33a77ec6 | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-f5444.java | 03a3775517067448e86666e9c487917b4ef5c300 | [] | no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
5440079053348 | [
"[email protected]"
] | |
fa279fc08064e59063fe96044e527cddf32dac47 | e7861c0ed1b49224b6c4ccf6dbfc63be61a026e5 | /FRONT/web_workspace/animalProject/src/tipboard/controller/TipBoardOriginUpdateServlet.java | 409e3c8bc7c3e5aed16ab3e4a2682a4e1377a570 | [] | no_license | kdw912001/kh | 7d7610b4ddaab286714131d1c9108373f6c920a9 | 73c511db0723e0bc49258d8d146ba6f8ee9db762 | refs/heads/master | 2020-04-06T10:19:58.220792 | 2019-05-03T18:41:57 | 2019-05-03T18:41:57 | 157,376,594 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,486 | java | package tipboard.controller;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.tomcat.util.http.fileupload.servlet.ServletFileUpload;
import tipboard.model.service.TipBoardService;
import tipboard.model.vo.TipBoard;
/**
* Servlet implementation class TipBoardOriginUpdateServlet
*/
@WebServlet("/toriginup")
public class TipBoardOriginUpdateServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public TipBoardOriginUpdateServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//๊ฒ์ ์๊ธ ์์ ์ฒ๋ฆฌ์ฉ ์ปจํธ๋กค๋ฌ
// enctype="multipart/form-data" ๋ก ์ ์ก๋์๋์ง ํ์ธ
RequestDispatcher view = null;
if (!ServletFileUpload.isMultipartContent(request)) {
view = request.getRequestDispatcher("views/tipboard/tipBoardError.jsp");
request.setAttribute("message", "form์ enctype ์์ฑ ์ฌ์ฉ ์ ๋์์.");
view.forward(request, response);
}
// ์
๋ก๋ํ ํ์ผ์ ์ฉ๋ ์ ํ : 10Mbyte ๋ก ์ ํํ๋ค๋ฉด
int maxSize = 1024 * 1024 * 10;
// ํ์ผ์ด ์ ์ฅ๋ ํด๋ ์ง์ :
// content directory ์์ ํ์ผ์ ์ฅํด๋๋ฅผ ์ ํ ๊ฒฝ์ฐ
// ํ์ฌ ์น ์ปจํ
์ด๋์์ ๊ตฌ๋์ค์ธ ์น ์ํ๋ฆฌ์ผ์ด์
์
// ๋ฃจํธ ํด๋์ ๋ํ ๊ฒฝ๋ก ์์๋
String root = request.getSession().getServletContext().getRealPath("/");
// ์
๋ก๋๋๋ ํ์ผ์ ์ ์ฅ ํด๋๋ฅผ ๋ฃจํธ์ ์ฐ๊ฒฐํจ
String savePath = root + "files/tipboard";
// request ๋ฅผ MultipartRequest ๊ฐ์ฒด๋ก ๋ณํํจ
MultipartRequest mrequest = new MultipartRequest(request, savePath, maxSize, "UTF-8",
new DefaultFileRenamePolicy());
// ์ ์ก ์จ ๊ฐ ๊บผ๋ด์ ๊ฐ์ฒด์ ์ ์ฅ
TipBoard tboard = new TipBoard();
tboard.setBoardNum(Integer.parseInt(mrequest.getParameter("tnum")));
tboard.setBoardTitle(mrequest.getParameter("ttitle"));
tboard.setBoardContent(mrequest.getParameter("tcontent"));
//hidden ์ ๋ด๊ฒจ์ ์ ์ก์จ ์ํ์ผ๋ช
๊ณผ ๋ฐ๋ํ์ผ๋ช
๊บผ๋ด์ ์ ์ฅ
String toriginFileName = mrequest.getParameter("tofile");
String trenameFileName = mrequest.getParameter("trfile");
// ์ ์ก์จ ํ์ผ์ ํ์ผ๋ช
๋ง ์ถ์ถํ๊ณ , ์ด๋ฆ๋ฐ๊พธ๊ธฐ ์ฒ๋ฆฌ
String originalFileName = mrequest.getFilesystemName("tupfile");
// ์ ์ก์จ ํ์ผ์ด ์์ ๋๋ง ์ด๋ฆ๋ฐ๊พธ๊ธฐ ์งํํจ
if (originalFileName != null) {
// ๋ฐ๊ฟ ํ์ผ๋ช
๋ง๋ค๊ธฐ
// "๋
์์ผ์๋ถ์ด.ํ์ฅ์"
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String renameFileName = sdf.format(new java.sql.Date(System.currentTimeMillis())) + "."
+ originalFileName.substring(originalFileName.lastIndexOf(".") + 1);
// java.io.File ๊ฐ์ฒด์ renameTo() ๋ฉ์๋ ์ฌ์ฉ
File originFile = new File(savePath + "\\" + originalFileName);
File renameFile = new File(savePath + "\\" + renameFileName);
if (!originFile.renameTo(renameFile)) {
// ํ์ผ๋ช
์ง์ ๋ฐ๊พธ๊ธฐํจ
// ์๋ณธ ํ์ผ์ ๋ด์ฉ ์ฝ์ด์, ๋ฆฌ๋ค์ ํ์ผ์ ๋ณต์ฌ ๊ธฐ๋กํ๊ธฐ
// ์๋ณธ ํ์ผ ์ญ์ ํจ
int read = -1;
byte[] buf = new byte[1024];
FileInputStream fin = new FileInputStream(originFile);
FileOutputStream fout = new FileOutputStream(renameFile);
while ((read = fin.read(buf, 0, buf.length)) != -1) {
fout.write(buf, 0, read);
}
fin.close();
fout.close();
originFile.delete();
} // renameTo
//์ฒจ๋ถํ์ผ์ด ๋ณ๊ฒฝ๋์์ผ๋ฏ๋ก, ์ ์ฅ๋ ์ด์ ํ์ผ์ ์ญ์ ํจ
if(trenameFileName != null) {
(new File(savePath + "\\" + trenameFileName)).delete();
}
tboard.setTipBoardOriginFile(originalFileName);
tboard.setTipBoardReFile(renameFileName);
}else {
//์๋ก์ด ์ฒจ๋ถํ์ผ์ด ์์ ๋
tboard.setTipBoardOriginFile(toriginFileName);
tboard.setTipBoardReFile(trenameFileName);
}
// ์๋น์ค๋ชจ๋ธ๋ก ๊ฐ์ฒด ์ ๋ฌํ๊ณ ๊ฒฐ๊ณผ๋ฐ๊ธฐ
int result = new TipBoardService().updateTipBoard(tboard);
if (result > 0) {
// ์๊ธ ์์ ์ด ์ฑ๊ณตํ๋ฉด, ๊ฒ์๊ธ ๋ชฉ๋ก๋ณด๊ธฐ๊ฐ ์คํ๋๊ฒ ํจ
response.sendRedirect("/first/tlist?tpage=" + Integer.parseInt(mrequest.getParameter("tpage")));
} else {
view = request.getRequestDispatcher("views/tipboard/tipBoardError.jsp");
request.setAttribute("message", tboard.getTipBoardNo() + "๋ฒ ๊ฐ์ ์๊ธ ์์ ์คํจ!");
view.forward(request, response);
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"[email protected]"
] | |
62938050a2cf9307a90ff42a0a49643a702c66ed | c52ff5ec6b499dc027f119a90c5b166f35052658 | /src/textprocessing/SplitString.java | a802dc772c203336ecef99087fe843df5c845aed | [] | no_license | Legilos/trying-again | 98a6d353b3fee15046a297c1de18355a34ded3d0 | 9a4a40b6329d0c9ed072dbb3e50acfe5192d2b5e | refs/heads/master | 2021-01-12T13:23:36.892076 | 2016-09-23T00:29:14 | 2016-09-23T00:29:14 | 68,973,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,374 | java | package textprocessing;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
/**
* @author Robert Kline
*/
public class SplitString {
/**
* read the file "tell-tale-heart.txt" and "tokenize" it,
* generating an array of Strings split by the given
* regular expression
*
* @param args the command line arguments
* @throws java.io.IOException: if the file does not exist
*/
public static void main(String[] args) throws IOException {
String target = "tell-tale-heart.txt";
String content = new String(Files.readAllBytes(Paths.get(target)));
String regex;
regex = "\\W+"; // non-identifier sequences
//regex = "\\s+"; // whitespace sequences
//regex = "\\n+"; // newline sequences
// spit the file content string by regex sequences
String[] pieces = content.split(regex);
// construct the format sting to be used to print lines
Integer num_pieces = pieces.length;
int field_len = num_pieces.toString().length();
String format_str = "%" + field_len + "d: %s\n";
System.out.println(format_str);
StringBuilder output = new StringBuilder("");
int line = 0;
for (String piece : pieces) {
String str = String.format(format_str, ++line, piece);
output.append( str );
}
System.out.println(output.toString());
}
}
| [
"[email protected]"
] | |
e4eb9c9e9949cc014c4cfa78ca4ea4d6aa8a8552 | c68d6470fc624dfb6e60b1819d487ab5b637dea2 | /src/main/java/LeetCode/code_155.java | f4c0dcf7a8064785d805b1cf5327475c733d9150 | [] | no_license | ZNWhahaha/LeetCodes | 964598d46ac59b410a5bfb962689d17bf345eb0e | f1e48f90688d07a3126cece32d023019958da609 | refs/heads/main | 2023-08-28T18:55:34.832180 | 2021-10-23T06:05:53 | 2021-10-23T06:05:53 | 262,456,817 | 0 | 0 | null | 2020-10-13T21:50:46 | 2020-05-09T00:35:30 | Java | UTF-8 | Java | false | false | 1,659 | java | package LeetCode;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Stack;
public class code_155 {
/** initialize your data structure here. */
Deque<Integer> xStack;
Deque<Integer> minStack;
public code_155() {
xStack = new LinkedList<Integer>();
minStack = new LinkedList<Integer>();
minStack.push(Integer.MAX_VALUE);
}
public void push(int x) {
xStack.push(x);
minStack.push(Math.min(minStack.peek(), x));
}
public void pop() {
xStack.pop();
minStack.pop();
}
public int top() {
return xStack.peek();
}
public int getMin() {
return minStack.peek();
}
}
class MinStack {
Integer min = null;
Stack<Long> data = new Stack<>();
/**
* initialize your data structure here.
*/
public MinStack() {
}
public void push(int x) {
if (data.isEmpty()) {
data.push(0L);
min = x;
} else {
//ๅฆๆxๆฏๆๅฐ็ๆฐ๏ผ่ฟ้ๅฏ่ฝ่ถ็๏ผๆไปฅ็จLongๆฅไฟๅญ
data.push(Long.valueOf(x) - min);
min = Math.min(x, min);
}
}
public void pop() {
Long diff = data.pop();
if (diff >= 0) {
//return min + diff;
} else {
int res = min;
min = (int) (min - diff);
//return res;
}
}
public int top() {
Long diff = data.peek();
if (diff >= 0) {
return (int) (min + diff);
} else {
return min;
}
}
public int getMin() {
return min;
}
}
| [
"[email protected]"
] | |
be9c07097c752e52e28d78392ae1cbfeaff1b741 | ed81c54402a5730f8a310ea24a1a7dd7fe797f57 | /Client.java | 9740c6557920968eae39e4c95b23d51a141d6655 | [] | no_license | ManishaaMartina/thread | 96cef8c8a048a17fb99d6286050435a53825e29d | 8bdc9b46be898a3483f2faa284615bef2fadad6e | refs/heads/master | 2021-01-01T04:03:52.573603 | 2017-09-14T05:40:50 | 2017-09-14T05:40:50 | 97,117,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package com.kgfsl.abc;
import org.apache.log4j.Appender;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Layout;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.PropertyConfigurator;
public class Client
{
static Logger l=Logger.getLogger(Client.class.getName());
public static void main(String args[])
{
Layout l1=new SimpleLayout();
Appender c=new ConsoleAppender(l1);
try
{
Appender a=new FileAppender(l1,"my.txt",false);
l.addAppender(a);
l.addAppender(c);
}
catch(Exception e)
{}
l.debug("This is debug message");
l.info("This is info message");
l.warn("This is warn message");
l.fatal("This is fatal message");
l.error("This is error message");
// l.fatal("this is error msg");
System.out.println("executed successfully");
}
} | [
"[email protected]"
] | |
6abc4c84836629ff0755a75f3dcdcc0f77b9fc7b | 60eca1269862639f827168cf78d7da6295bb478f | /benchmarks/example-soot-c/ca/mcgill/sable/soot/jimple/InvokeStmt.java | c71fe865fdff84795f9820136880fb4ec0702777 | [] | no_license | jrgse/jrgse | 9f4045b3058a8e250218e47c4bb69c67f38e06ab | 3c7342c8906c8ffcdea4f383745019f7170933e7 | refs/heads/master | 2020-12-25T18:42:54.837282 | 2017-07-06T20:02:21 | 2017-07-06T20:02:21 | 93,979,358 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,310 | java | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Jimple, a 3-address code Java(TM) bytecode representation. *
* Copyright (C) 1997, 1998 Raja Vallee-Rai ([email protected]) *
* All rights reserved. *
* *
* Modifications by Patrick Lam ([email protected]) are *
* Copyright (C) 1999 Patrick Lam. All rights reserved. *
* *
* This work was done as a project of the Sable Research Group, *
* School of Computer Science, McGill University, Canada *
* (http://www.sable.mcgill.ca/). It is understood that any *
* modification not identified as such is not covered by the *
* preceding statement. *
* *
* This work is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This work 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 *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; if not, write to the *
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, *
* Boston, MA 02111-1307, USA. *
* *
* Java is a trademark of Sun Microsystems, Inc. *
* *
* To submit a bug report, send a comment, or get the latest news on *
* this project and other Sable Research Group projects, please *
* visit the web site: http://www.sable.mcgill.ca/ *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
Reference Version
-----------------
This is the latest official version on which this file is based.
The reference version is: $SootVersion: 1.beta.4.dev.7 $
Change History
--------------
A) Notes:
Please use the following template. Most recent changes should
appear at the top of the list.
- Modified on [date (March 1, 1900)] by [name]. [(*) if appropriate]
[description of modification].
Any Modification flagged with "(*)" was done as a project of the
Sable Research Group, School of Computer Science,
McGill University, Canada (http://www.sable.mcgill.ca/).
You should add your copyright, using the following template, at
the top of this file, along with other copyrights.
* *
* Modifications by [name] are *
* Copyright (C) [year(s)] [your name (or company)]. All rights *
* reserved. *
* *
B) Changes:
- Modified on February 3, 1999 by Patrick Lam ([email protected]) (*)
Added changes in support of the Grimp intermediate
representation (with aggregated-expressions).
- Modified on November 2, 1998 by Raja Vallee-Rai ([email protected]) (*)
Repackaged all source files and performed extensive modifications.
First initial release of Soot.
- Modified on 15-Jun-1998 by Raja Vallee-Rai ([email protected]). (*)
First internal release (Version 0.1).
*/
package ca.mcgill.sable.soot.jimple;
import ca.mcgill.sable.soot.*;
import ca.mcgill.sable.util.*;
public interface InvokeStmt extends Stmt
{
public void setInvokeExpr(Value invokeExpr);
public Value getInvokeExpr();
public ValueBox getInvokeExprBox();
}
| [
"[email protected]"
] | |
72879f6a5cd1ee80f2e386719ff0de47a96c23d0 | cacec52e5653ab773d35d7f1b4f4f660580d7826 | /web-admin/src/main/java/com/lyh/admin/tools/pay/webchat/XmlUtils.java | 0c6af9d75b6a11205bdf1a48d5cb337335e65377 | [] | no_license | liuyuhua1984/GameAdminWeb | 6d830e7ad1551ac1803abd12e9359c6bfd5965ec | c590fd88d768c8231e2160bf7415996b0027ac98 | refs/heads/master | 2021-08-28T13:40:50.540862 | 2017-12-12T10:20:06 | 2017-12-12T10:20:06 | 106,268,614 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,784 | java | package com.lyh.admin.tools.pay.webchat;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.JDOMException;
import org.jdom2.input.SAXBuilder;
/**
* ClassName:XmlUtils <br/>
* Function: TODO (). <br/>
* Reason: TODO (). <br/>
* Date: 2017ๅนด7ๆ24ๆฅ ไธๅ11:25:18 <br/>
*
* @author lyh
* @version
* @see
*/
public class XmlUtils {
/**
* ่งฃๆxml,่ฟๅ็ฌฌไธ็บงๅ
็ด ้ฎๅผๅฏนใๅฆๆ็ฌฌไธ็บงๅ
็ด ๆๅญ่็น๏ผๅๆญค่็น็ๅผๆฏๅญ่็น็xmlๆฐๆฎใ
*
* @param strxml
* @return
* @throws JDOMException
* @throws IOException
*/
public static Map doXMLParse(String strxml) throws IOException {
strxml = strxml.replaceFirst("encoding=\".*\"", "encoding=\"UTF-8\"");
if (null == strxml || "".equals(strxml)) {
return null;
}
Map m = new HashMap();
InputStream in = new ByteArrayInputStream(strxml.getBytes("UTF-8"));
SAXBuilder builder = new SAXBuilder();
Document doc;
try {
doc = builder.build(in);
Element root = doc.getRootElement();
List list = root.getChildren();
Iterator it = list.iterator();
while (it.hasNext()) {
Element e = (Element) it.next();
String k = e.getName();
String v = "";
List children = e.getChildren();
if (children.isEmpty()) {
v = e.getTextNormalize();
} else {
v = XmlUtils.getChildrenText(children);
}
m.put(k, v);
}
} catch (JDOMException e1) {
e1.printStackTrace();
}finally{
// ๅ
ณ้ญๆต
in.close();
}
return m;
}
/**
* ่ทๅๅญ็ป็น็xml
*
* @param children
* @return String
*/
public static String getChildrenText(List children) {
StringBuffer sb = new StringBuffer();
if (!children.isEmpty()) {
Iterator it = children.iterator();
while (it.hasNext()) {
Element e = (Element) it.next();
String name = e.getName();
String value = e.getTextNormalize();
List list = e.getChildren();
sb.append("<" + name + ">");
if (!list.isEmpty()) {
sb.append(XmlUtils.getChildrenText(list));
}
sb.append(value);
sb.append("</" + name + ">");
}
}
return sb.toString();
}
// /**
// * ่ทๅxml็ผ็ ๅญ็ฌฆ้
// *
// * @param strxml
// * @return
// * @throws IOException
// * @throws JDOMException
// */
// public static String getXMLEncoding(String strxml) throws JDOMException, IOException {
// InputStream in = HttpClientUtil.String2Inputstream(strxml);
// SAXBuilder builder = new SAXBuilder();
// Document doc = builder.build(in);
// in.close();
// return (String) doc.getProperty("encoding");
// }
}
| [
"[email protected]"
] | |
1a618a81ea1e0d2be397c35471764225d149c0b4 | 92225460ebca1bb6a594d77b6559b3629b7a94fa | /src/com/kingdee/eas/fdc/schedule/ProjectMonthReportEntry.java | 3e0ee9d057c66c83b9d5aa1216b626fbee0bb6ac | [] | no_license | yangfan0725/sd | 45182d34575381be3bbdd55f3f68854a6900a362 | 39ebad6e2eb76286d551a9e21967f3f5dc4880da | refs/heads/master | 2023-04-29T01:56:43.770005 | 2023-04-24T05:41:13 | 2023-04-24T05:41:13 | 512,073,641 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,017 | java | package com.kingdee.eas.fdc.schedule;
import com.kingdee.bos.framework.ejb.EJBRemoteException;
import com.kingdee.bos.util.BOSObjectType;
import java.rmi.RemoteException;
import com.kingdee.bos.framework.AbstractBizCtrl;
import com.kingdee.bos.orm.template.ORMObject;
import java.lang.String;
import com.kingdee.bos.util.*;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.eas.fdc.schedule.app.*;
import com.kingdee.bos.dao.IObjectPK;
import com.kingdee.bos.Context;
import com.kingdee.bos.BOSException;
import com.kingdee.eas.framework.CoreBaseInfo;
import com.kingdee.bos.framework.*;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.eas.framework.CoreBaseCollection;
public class ProjectMonthReportEntry extends OpReportEntryBase implements IProjectMonthReportEntry
{
public ProjectMonthReportEntry()
{
super();
registerInterface(IProjectMonthReportEntry.class, this);
}
public ProjectMonthReportEntry(Context ctx)
{
super(ctx);
registerInterface(IProjectMonthReportEntry.class, this);
}
public BOSObjectType getType()
{
return new BOSObjectType("5285F9A1");
}
private ProjectMonthReportEntryController getController() throws BOSException
{
return (ProjectMonthReportEntryController)getBizController();
}
/**
*getValue-System defined method
*@param oql oql
*@return
*/
public ProjectMonthReportEntryInfo getProjectMonthReportEntryInfo(String oql) throws BOSException, EASBizException
{
try {
return getController().getProjectMonthReportEntryInfo(getContext(), oql);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getValue-System defined method
*@param pk pk
*@param selector selector
*@return
*/
public ProjectMonthReportEntryInfo getProjectMonthReportEntryInfo(IObjectPK pk, SelectorItemCollection selector) throws BOSException, EASBizException
{
try {
return getController().getProjectMonthReportEntryInfo(getContext(), pk, selector);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getValue-System defined method
*@param pk pk
*@return
*/
public ProjectMonthReportEntryInfo getProjectMonthReportEntryInfo(IObjectPK pk) throws BOSException, EASBizException
{
try {
return getController().getProjectMonthReportEntryInfo(getContext(), pk);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getCollection-System defined method
*@param oql oql
*@return
*/
public ProjectMonthReportEntryCollection getProjectMonthReportEntryCollection(String oql) throws BOSException
{
try {
return getController().getProjectMonthReportEntryCollection(getContext(), oql);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getCollection-System defined method
*@param view view
*@return
*/
public ProjectMonthReportEntryCollection getProjectMonthReportEntryCollection(EntityViewInfo view) throws BOSException
{
try {
return getController().getProjectMonthReportEntryCollection(getContext(), view);
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
/**
*getCollection-System defined method
*@return
*/
public ProjectMonthReportEntryCollection getProjectMonthReportEntryCollection() throws BOSException
{
try {
return getController().getProjectMonthReportEntryCollection(getContext());
}
catch(RemoteException err) {
throw new EJBRemoteException(err);
}
}
} | [
"[email protected]"
] | |
c7dbb378e977b577bf040d5c78fbeaa51a95598e | acffe3a74708c99a7925ac0267201b6c76ec13f2 | /server/src/so/DeleteRecipe.java | d139f3258b7ea0c8efd18e53ea1506405375ed7d | [] | no_license | ljuba95/ps-project | ea07aeeaa05412b0fc5515a1aae50aadf6d8be3d | 6a0c4eada0dc79ba1d8d4573421a72aabb7bffe6 | refs/heads/master | 2020-03-18T15:09:53.040782 | 2018-06-26T14:54:05 | 2018-06-26T14:54:05 | 134,890,673 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package so;
import domain.general.IDomainEntity;
import java.util.List;
import so.general.AbstractGenericOperation;
/**
*
* @author Milos
*/
public class DeleteRecipe extends AbstractGenericOperation{
@Override
protected void validate(IDomainEntity ide) throws Exception {
}
@Override
protected void execute(IDomainEntity ide) throws Exception {
if(!db.delete(ide)) throw new Exception("Recipe could not be deleted.");
}
@Override
protected void execute(IDomainEntity ide, List<IDomainEntity> ides) throws Exception {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"[email protected]"
] | |
d75124cbb0ccf0040414a42e6241f52ad159edbd | fe4cc622374ce18742d28e47b512b42a813f327d | /src/main/java/com/bals/kakaologin/service/KakaoAPI.java | 4ea0fe3c07680e865ad8d47684c8887983ead717 | [] | no_license | EricSeokgon/kakaologin | 2c6947016c64c1bb63bd587fcdee200ec144fcfb | d400569819a5caeabd48984b0013662e2d374bc2 | refs/heads/master | 2022-12-04T11:45:34.752972 | 2020-08-26T08:52:26 | 2020-08-26T08:52:26 | 288,607,312 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,557 | java | package com.bals.kakaologin.service;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import com.google.gson.JsonObject;
import org.springframework.stereotype.Service;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
@Service
public class KakaoAPI {
public String getAccessToken (String authorize_code) {
String access_Token = "";
String refresh_Token = "";
String reqURL = "https://kauth.kakao.com/oauth/token";
try {
URL url = new URL(reqURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// POST ์์ฒญ์ ์ํด ๊ธฐ๋ณธ๊ฐ์ด false์ธ setDoOutput์ true๋ก
conn.setRequestMethod("POST");
conn.setDoOutput(true);
// POST ์์ฒญ์ ํ์๋ก ์๊ตฌํ๋ ํ๋ผ๋ฏธํฐ ์คํธ๋ฆผ์ ํตํด ์ ์ก
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream()));
StringBuilder sb = new StringBuilder();
sb.append("grant_type=authorization_code");
sb.append("&client_id=90a4d5e63b6a29255df89da36fd88c60");
sb.append("&redirect_uri=http://localhost:8000/login");
sb.append("&code=" + authorize_code);
bw.write(sb.toString());
bw.flush();
// ๊ฒฐ๊ณผ ์ฝ๋๊ฐ 200์ด๋ผ๋ฉด ์ฑ๊ณต
int responseCode = conn.getResponseCode();
System.out.println("responseCode : " + responseCode);
// ์์ฒญ์ ํตํด ์ป์ JSONํ์
์ Response ๋ฉ์ธ์ง ์ฝ์ด์ค๊ธฐ
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = "";
String result = "";
while ((line = br.readLine()) != null) {
result += line;
}
System.out.println("response body : " + result);
// Gson ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ํฌํจ๋ ํด๋์ค๋ก JSONํ์ฑ ๊ฐ์ฒด ์์ฑ
JsonParser parser = new JsonParser();
JsonElement element = parser.parse(result);
access_Token = element.getAsJsonObject().get("access_token").getAsString();
refresh_Token = element.getAsJsonObject().get("refresh_token").getAsString();
System.out.println("access_token : " + access_Token);
System.out.println("refresh_token : " + refresh_Token);
br.close();
bw.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return access_Token;
}
public HashMap<String, Object> getUserInfo (String access_Token) {
// ์์ฒญํ๋ ํด๋ผ์ด์ธํธ๋ง๋ค ๊ฐ์ง ์ ๋ณด๊ฐ ๋ค๋ฅผ ์ ์๊ธฐ์ HashMapํ์
์ผ๋ก ์ ์ธ
HashMap<String, Object> userInfo = new HashMap<>();
String reqURL = "https://kapi.kakao.com/v2/user/me";
try {
URL url = new URL(reqURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
// ์์ฒญ์ ํ์ํ Header์ ํฌํจ๋ ๋ด์ฉ
conn.setRequestProperty("Authorization", "Bearer " + access_Token);
int responseCode = conn.getResponseCode();
System.out.println("responseCode : " + responseCode);
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = "";
String result = "";
while ((line = br.readLine()) != null) {
result += line;
}
System.out.println("response body : " + result);
JsonParser parser = new JsonParser();
JsonElement element = parser.parse(result);
JsonObject properties = element.getAsJsonObject().get("properties").getAsJsonObject();
JsonObject kakao_account = element.getAsJsonObject().get("kakao_account").getAsJsonObject();
String nickname = properties.getAsJsonObject().get("nickname").getAsString();
String email = kakao_account.getAsJsonObject().get("email").getAsString();
userInfo.put("nickname", nickname);
userInfo.put("email", email);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return userInfo;
}
public void kakaoLogout(String access_Token) {
String reqURL = "https://kapi.kakao.com/v1/user/logout";
try {
URL url = new URL(reqURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer " + access_Token);
int responseCode = conn.getResponseCode();
System.out.println("responseCode : " + responseCode);
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String result = "";
String line = "";
while ((line = br.readLine()) != null) {
result += line;
}
System.out.println(result);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
87a91a66b05f5370f9805279f06cc857fbc5b5c9 | 447520f40e82a060368a0802a391697bc00be96f | /apks/malware/app98/source/android/support/v4/app/Watson.java | 208e9410dc896df8b0d55538ee9e39568970b38e | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 5,972 | java | package android.support.v4.app;
import android.view.View;
import com.actionbarsherlock.ActionBarSherlock.OnCreatePanelMenuListener;
import com.actionbarsherlock.ActionBarSherlock.OnMenuItemSelectedListener;
import com.actionbarsherlock.ActionBarSherlock.OnPreparePanelListener;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import java.util.ArrayList;
public abstract class Watson
extends FragmentActivity
implements ActionBarSherlock.OnCreatePanelMenuListener, ActionBarSherlock.OnPreparePanelListener, ActionBarSherlock.OnMenuItemSelectedListener
{
private static final String TAG = "Watson";
private ArrayList<Fragment> mCreatedMenus;
public Watson() {}
public abstract MenuInflater getSupportMenuInflater();
public abstract boolean onCreateOptionsMenu(Menu paramMenu);
public boolean onCreatePanelMenu(int paramInt, Menu paramMenu)
{
if (paramInt == 0)
{
int k = onCreateOptionsMenu(paramMenu);
MenuInflater localMenuInflater = getSupportMenuInflater();
int i = 0;
paramInt = 0;
Object localObject2 = null;
Object localObject1 = null;
if (this.mFragments.mAdded != null)
{
int j = 0;
for (;;)
{
localObject2 = localObject1;
i = paramInt;
if (j >= this.mFragments.mAdded.size()) {
break;
}
Fragment localFragment = (Fragment)this.mFragments.mAdded.get(j);
localObject2 = localObject1;
i = paramInt;
if (localFragment != null)
{
localObject2 = localObject1;
i = paramInt;
if (!localFragment.mHidden)
{
localObject2 = localObject1;
i = paramInt;
if (localFragment.mHasMenu)
{
localObject2 = localObject1;
i = paramInt;
if (localFragment.mMenuVisible)
{
localObject2 = localObject1;
i = paramInt;
if ((localFragment instanceof OnCreateOptionsMenuListener))
{
i = 1;
((OnCreateOptionsMenuListener)localFragment).onCreateOptionsMenu(paramMenu, localMenuInflater);
localObject2 = localObject1;
if (localObject1 == null) {
localObject2 = new ArrayList();
}
((ArrayList)localObject2).add(localFragment);
}
}
}
}
}
j += 1;
localObject1 = localObject2;
paramInt = i;
}
}
if (this.mCreatedMenus != null)
{
paramInt = 0;
while (paramInt < this.mCreatedMenus.size())
{
paramMenu = (Fragment)this.mCreatedMenus.get(paramInt);
if ((localObject2 == null) || (!((ArrayList)localObject2).contains(paramMenu))) {
paramMenu.onDestroyOptionsMenu();
}
paramInt += 1;
}
}
this.mCreatedMenus = ((ArrayList)localObject2);
return k | i;
}
return false;
}
public boolean onMenuItemSelected(int paramInt, MenuItem paramMenuItem)
{
if (paramInt == 0)
{
if (onOptionsItemSelected(paramMenuItem)) {
return true;
}
if (this.mFragments.mAdded != null)
{
paramInt = 0;
for (;;)
{
if (paramInt >= this.mFragments.mAdded.size()) {
break label107;
}
Fragment localFragment = (Fragment)this.mFragments.mAdded.get(paramInt);
if ((localFragment != null) && (!localFragment.mHidden) && (localFragment.mHasMenu) && (localFragment.mMenuVisible) && ((localFragment instanceof OnOptionsItemSelectedListener)) && (((OnOptionsItemSelectedListener)localFragment).onOptionsItemSelected(paramMenuItem))) {
break;
}
paramInt += 1;
}
}
}
label107:
return false;
}
public abstract boolean onOptionsItemSelected(MenuItem paramMenuItem);
public abstract boolean onPrepareOptionsMenu(Menu paramMenu);
public boolean onPreparePanel(int paramInt, View paramView, Menu paramMenu)
{
if (paramInt == 0)
{
int k = onPrepareOptionsMenu(paramMenu);
int j = 0;
paramInt = 0;
if (this.mFragments.mAdded != null)
{
int i = 0;
for (;;)
{
j = paramInt;
if (i >= this.mFragments.mAdded.size()) {
break;
}
paramView = (Fragment)this.mFragments.mAdded.get(i);
j = paramInt;
if (paramView != null)
{
j = paramInt;
if (!paramView.mHidden)
{
j = paramInt;
if (paramView.mHasMenu)
{
j = paramInt;
if (paramView.mMenuVisible)
{
j = paramInt;
if ((paramView instanceof OnPrepareOptionsMenuListener))
{
j = 1;
((OnPrepareOptionsMenuListener)paramView).onPrepareOptionsMenu(paramMenu);
}
}
}
}
}
i += 1;
paramInt = j;
}
}
return (k | j) & paramMenu.hasVisibleItems();
}
return false;
}
public static abstract interface OnCreateOptionsMenuListener
{
public abstract void onCreateOptionsMenu(Menu paramMenu, MenuInflater paramMenuInflater);
}
public static abstract interface OnOptionsItemSelectedListener
{
public abstract boolean onOptionsItemSelected(MenuItem paramMenuItem);
}
public static abstract interface OnPrepareOptionsMenuListener
{
public abstract void onPrepareOptionsMenu(Menu paramMenu);
}
}
| [
"[email protected]"
] | |
2027e69bae865dc952cbf7cc2bed7c0bfeeaf200 | 15d55ff9cddff64dd1460b0134d98803adac2f44 | /gulimall-member/src/main/java/cn/lxtkj/gulimall/member/dao/GrowthChangeHistoryDao.java | 99939ef792e007383c6e350040aaeded290c0964 | [
"Apache-2.0"
] | permissive | leiphp/gulimall | b70bb4ac62b09bca61b5d321240ad4018401ab4c | 6c53e6db69444cac73899f97e1d5c47b8d5fb43a | refs/heads/master | 2023-08-22T22:14:29.676944 | 2021-10-18T09:42:47 | 2021-10-18T09:42:47 | 394,718,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | package cn.lxtkj.gulimall.member.dao;
import cn.lxtkj.gulimall.member.entity.GrowthChangeHistoryEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ๆ้ฟๅผๅๅๅๅฒ่ฎฐๅฝ
*
* @author leixiaotian
* @email [email protected]
* @date 2021-08-12 22:49:16
*/
@Mapper
public interface GrowthChangeHistoryDao extends BaseMapper<GrowthChangeHistoryEntity> {
}
| [
"[email protected]"
] | |
39bd7b9fb0305f023b60e097605ed9ff384b9816 | 34c395465ea53a3aed84cbaeb07f8fc4ebbb2985 | /.svn/pristine/56/56f11ac9d2abb22ae3779dcb93edc64aeb0bdefa.svn-base | 4831721f52b3b34fe7bdf48adfc3e06743ea7f52 | [] | no_license | SoyeonJO/TilesSpring_board | 37f9db93a4a0720c003cb10f1d990c3930b5c903 | ebb3648527132d35fb8661a96bea731bfde9f509 | refs/heads/master | 2020-09-15T07:47:14.103462 | 2019-11-22T11:21:53 | 2019-11-22T11:21:53 | 223,384,449 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 367 | package kr.or.ddit.user.noticeitem.dao;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import kr.or.ddit.vo.NoticeItemVO;
public interface INoticeItemDao {
public void insertNoticeItemInfo(List<NoticeItemVO> noticeItemList) throws SQLException;
public NoticeItemVO noticeItemInfo(Map<String, String> params) throws SQLException;
}
| [
"[email protected]"
] | ||
4b80e37c85d969827619d47787cfed5a9f7808a0 | 8e56c636b5ef5f37946047b716976366b3c8c588 | /TrelloMachingCoding/src/com/machine/coding/service/CardListService.java | c2c7d15978e5dbea848ebb46a065d5d44b4f785a | [] | no_license | hakimsaifee/mock-machine-coding-3 | f66ed632ec81e523e3a6d05300cd2db4d7f43090 | e7d693f5729cf0f2a1889fe8271aa663b33708f7 | refs/heads/master | 2020-08-12T18:18:05.360543 | 2019-10-13T12:50:29 | 2019-10-13T12:50:29 | 214,818,027 | 1 | 0 | null | 2019-10-13T12:42:23 | 2019-10-13T12:42:23 | null | UTF-8 | Java | false | false | 1,379 | java | package com.machine.coding.service;
import java.io.Serializable;
import com.machine.coding.common.ServiceFactory;
import com.machine.coding.model.Base;
import com.machine.coding.model.Card;
import com.machine.coding.model.CardList;
import com.machine.coding.repository.CardListRepository;
public class CardListService<K extends Serializable, V extends Base> extends GenericService<K, V> {
private CardService cardService;
public CardListService() {
this.repository = CardListRepository.getInstance();
this.cardService = (CardService) ServiceFactory.getService("CARD_SERVICE");
}
public void addCard(K cardListId, String cardId) {
CardList cardList = (CardList) getById(cardListId);
Card card = (Card) cardService.getById(cardId);
cardList.addCard(card);
}
@SuppressWarnings("unchecked")
public void delete(K id, boolean isCascadeDelete) {
V object = getById(id);
super.delete(id);
CardList cardList = (CardList) object;
cardList.getBoard().removeCardList(cardList);
if (isCascadeDelete) {
for (Card card : cardList.getCards()) {
cardService.delete(card);
}
}
}
public void moveCard(K cardId, K cardListId) {
Card card = (Card) cardService.getById(cardId);
card.getCardList().removeCard(card);
CardList newCardList = (CardList) getById(cardListId);
newCardList.addCard(card);
card.setCardList(newCardList);
}
}
| [
"[email protected]"
] | |
9679ee261d1e64cfb0d4a77e82280d9301f52cac | c9e73949f7a51669ed3113e0411e1d16dfac574e | /java/flatten-array/src/main/java/Flattener.java | cbb5232ffe218142e1da4166b1d23b37edf3ec20 | [] | no_license | mawis/my-exercism | 8fbc880f1e57c457feef06e0e401096ca98421d8 | c2f191cbcffcc4c930d3490676e33f93252595d5 | refs/heads/master | 2021-01-20T05:44:13.891701 | 2018-08-12T20:17:06 | 2018-08-12T20:17:06 | 89,802,855 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | import com.google.common.collect.ImmutableList;
import java.util.List;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.util.stream.Stream.of;
final class Flattener {
public ImmutableList<?> flatten(List<?> input) {
return input.stream()
.filter(e -> e != null)
.flatMap(el -> el instanceof List ? flatten((List) el).stream() : of(el))
.collect(toImmutableList());
}
}
| [
"[email protected]"
] | |
43fd7c4da2d855019713d10d4af134113f1c98f2 | 34d433d9911510a1e0bd17ea48f51fcd5500461d | /Labs/Objective6Lab5.java | fc948e678e2cea1ccc0a3d21ab0ad13a7229b717 | [] | no_license | Briman-Jag/SDPre | 515a943b7ec7d45ddedc34707009050c64a339ff | 7b823a2627925a9e26000ab4d6580e5b2df8dac5 | refs/heads/master | 2020-07-10T19:13:52.686014 | 2019-09-03T03:57:11 | 2019-09-03T03:57:11 | 204,344,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 733 | java | import java.util.Scanner;
public class Objective6Lab5 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int selection;
while (true) {
System.out.println("____Menu____");
System.out.println("1: Say Hello");
System.out.println("2: List My favorite foods");
System.out.println("3: Exit");
System.out.println();
selection = scanner.nextInt();
if (selection == 1){
System.out.println("Hello");
}
else if (selection == 2){
System.out.println("Apples, Bananas, Coconuts");
}
else if (selection == 3){
System.out.println("Goodbye");
scanner.close();
break;
}
}
}
}
| [
"[email protected]"
] | |
fd30c0d8cdb285dffd686ab1245e9e75feca29ed | a4bf5cd032ccb8ab55d2026621cdf6227b808387 | /app/src/main/java/com/li/utils/ui/preload/TextViewState.java | e27e6839c633f4ae5a1ada642f8ee1a7d66956a3 | [] | no_license | xiao00kang/RxOperation | 138dceba8f12efe51ef113a28c11b64d63f62d0c | 02f9581d698c826707c182fc7a020c0471cdb8b0 | refs/heads/master | 2021-06-11T08:27:26.894524 | 2017-02-06T06:18:43 | 2017-02-06T06:18:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.li.utils.ui.preload;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.widget.TextView;
public class TextViewState extends ViewState<TextView> {
ColorStateList textColor;
public TextViewState(TextView textView) {
super(textView);
}
@Override
protected void init() {
super.init();
this.textColor = view.getTextColors();
this.darker = view.getTypeface() != null && view.getTypeface().isBold();
}
@Override
protected void restore() {
this.view.setTextColor(textColor);
}
@Override
public void start(boolean fadein) {
super.start(fadein);
view.setTextColor(Color.TRANSPARENT);
}
}
| [
"[email protected]"
] | |
8b4cecf0d8644be3f896e71b9499d2f83d3530a0 | 8a2f66dc1ce862528762ee316ce595cda62a9565 | /examenNC/src/main/java/com/uca/capas/domain/Categoria.java | 32f0aeb6b99f28f93f9dc63f5852ac3dbc8765b4 | [] | no_license | 00209317/Parcial02NC | e02d489e6f4bcdc1c8f12e7ac24b03e6ae770850 | cdba76d8f2cf67a0a706aa8d41f84621a3a65175 | refs/heads/master | 2022-08-12T10:39:39.159464 | 2020-05-26T03:57:18 | 2020-05-26T03:57:18 | 266,931,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,392 | java | package com.uca.capas.domain;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
@Entity
@Table(schema="public",name="cat_categoria")
public class Categoria {
@Id
@Column(name = "c_categoria")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer c_categoria;
@Column(name = "s_categoria")
@Size(message = "El campo nombre no debe tener mรกs de 50 caracteres", max=50)
@NotEmpty(message = "El campo nombre de categorรญa no puede ser vacรญo")
private String s_categoria;
@OneToMany(mappedBy = "categoria", fetch = FetchType.EAGER)
private List<Libro> libros;
public Categoria() {
}
public Integer getC_categoria() {
return c_categoria;
}
public void setC_categoria(Integer c_categoria) {
this.c_categoria = c_categoria;
}
public String getS_categoria() {
return s_categoria;
}
public void setS_categoria(String s_categoria) {
this.s_categoria = s_categoria;
}
public List<Libro> getLibros() {
return libros;
}
public void setLibros(List<Libro> libros) {
this.libros = libros;
}
}
| [
"[email protected]"
] | |
8184e2369f0f0bd52b46937a32ac0d129ed30684 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/cloudvoip/cloudvoice/c/j$17.java | 7cf93648bdc806166e3f7cb5a21ed1b48e6563be | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,191 | java | package com.tencent.mm.plugin.cloudvoip.cloudvoice.c;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.protocal.protobuf.tr;
import com.tencent.mm.sdk.platformtools.ab;
import java.io.IOException;
final class j$17
implements f.a<tr, String>
{
j$17(j paramj, a parama)
{
}
private static tr aB(byte[] paramArrayOfByte)
{
AppMethodBeat.i(135542);
tr localtr = new tr();
try
{
localtr.parseFrom(paramArrayOfByte);
AppMethodBeat.o(135542);
paramArrayOfByte = localtr;
return paramArrayOfByte;
}
catch (IOException paramArrayOfByte)
{
while (true)
{
ab.printErrStackTrace("MicroMsg.OpenVoice.OpenVoiceService", paramArrayOfByte, "hy: unable to parse from data", new Object[0]);
paramArrayOfByte = null;
AppMethodBeat.o(135542);
}
}
}
public final boolean bgp()
{
return false;
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes3-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.cloudvoip.cloudvoice.c.j.17
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
f4ff46ee0e46941bf2f6020687dd38a4ca19bf6c | aeb93770da999e852a939589146822d5d33bc52e | /src/main/java/JsonNodeVisitor.java | 451ad75b8f9145ba11a048606acd4fcb9a77afab | [
"MIT"
] | permissive | Siegrift/simple-json | 0da505494e4ae7acac7cbaa8bd2b538c633cecef | a488568c4227bd5051f066147b2402c7f6a2acc4 | refs/heads/master | 2021-05-01T11:17:28.960707 | 2018-02-11T12:59:23 | 2018-02-11T12:59:23 | 121,116,558 | 0 | 0 | MIT | 2018-02-11T13:08:01 | 2018-02-11T11:27:07 | Java | UTF-8 | Java | false | false | 409 | java | /**
* The interface Json node visitor.
*/
interface JsonNodeVisitor {
/**
* @param jsonArray the json array to visit
*/
void visit(JsonArray jsonArray);
/**
* Visit.
*
* @param jsonObject the json object to visit
*/
void visit(JsonObject jsonObject);
/**
* Visit.
*
* @param jsonPrimitive the json primitive to visit
*/
void visit(JsonPrimitive jsonPrimitive);
}
| [
"[email protected]"
] | |
5fcd3475b129605f43762a9e923af7ff32d170b9 | e75be673baeeddee986ece49ef6e1c718a8e7a5d | /submissions/blizzard/Corpus/ecf/83.java | 8bb75e8ed8953a5eec15d35edfa201aa41dc74f7 | [
"MIT"
] | permissive | zhendong2050/fse18 | edbea132be9122b57e272a20c20fae2bb949e63e | f0f016140489961c9e3c2e837577f698c2d4cf44 | refs/heads/master | 2020-12-21T11:31:53.800358 | 2018-07-23T10:10:57 | 2018-07-23T10:10:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,097 | java | /*******************************************************************************
* Copyright (c) 2009 Composent, Inc. and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Composent, Inc. - initial API and implementation
******************************************************************************/
package org.eclipse.ecf.remoteservice.rest.client;
import org.eclipse.ecf.remoteservice.client.IRemoteCallableRequestType;
import java.util.Map;
public abstract class AbstractRequestType implements IRemoteCallableRequestType {
protected Map defaultRequestHeaders;
public AbstractRequestType(Map defaultRequestHeaders) {
this.defaultRequestHeaders = defaultRequestHeaders;
}
public AbstractRequestType() {
// nothing to do
}
public Map getDefaultRequestHeaders() {
return defaultRequestHeaders;
}
}
| [
"[email protected]"
] | |
edce84add59699d8d789eec4c2601690ec37fe0d | ee5f9e491ee94cd28f53b73628bb16693afd10d3 | /weatherclient/src/main/java/de/jonashackt/controller/WeatherclientController.java | a3fb37118d9d3eb70eeb4cac861d6be415f978f6 | [
"MIT"
] | permissive | jonashackt/traefik-cache-nginx-spring-boot | b07fa1117a603120dc38a3c310c9ccc1e310b681 | 1b7603c3afc3c47a4255599efbe9ed9698b30c42 | refs/heads/master | 2023-08-28T06:02:49.735012 | 2023-08-24T10:41:59 | 2023-08-24T10:41:59 | 125,065,067 | 20 | 5 | MIT | 2023-09-04T13:42:38 | 2018-03-13T14:33:16 | Java | UTF-8 | Java | false | false | 2,050 | java | package de.jonashackt.controller;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
@RestController
public class WeatherclientController {
private RestTemplate restTemplate = new RestTemplate();
/*
* Without the System property, we wonยดt be able to set the Host header, see
* https://stackoverflow.com/questions/43223261/setting-host-header-for-spring-resttemplate-doesnt-work/43224279
* and https://stackoverflow.com/a/8172736/4964553
*/
@PostConstruct
public void setProperty() {
System.setProperty("sun.net.http.allowRestrictedHeaders", "true");
}
@GetMapping("/forecast/{cityname}")
@ResponseStatus(HttpStatus.OK)
public String forecast(@PathVariable("cityname") String cityname) {
HttpHeaders headers = new HttpHeaders();
headers.set("Host", "weatherbackend.server.test");
ResponseEntity<String> responseEntity = restTemplate.exchange("http://nginx:80/weather/" + cityname,
HttpMethod.GET,
new HttpEntity<String>(null, headers),
String.class);
return responseEntity.getBody();
}
@GetMapping("/traefik/forecast/{cityname}")
@ResponseStatus(HttpStatus.OK)
public String forecastTraefikOnly(@PathVariable("cityname") String cityname) {
return restTemplate.getForEntity("http://weatherbackend.server.test/weather/" + cityname, String.class).getBody();
}
@GetMapping("/noproxy/forecast/{cityname}")
@ResponseStatus(HttpStatus.OK)
public String forecastWithoutProxy(@PathVariable("cityname") String cityname) {
return restTemplate.getForEntity("http://weatherbackend:8095/weather/" + cityname, String.class).getBody();
}
}
| [
"[email protected]"
] | |
640e27cf80dc89071b4285936c7d09a1334b3af9 | a8049968bc7e57e4b830080e12b2aa0a081bb89d | /src/main/java/work/iruby/nowcoder/jz/JZ9.java | 291a26f012bac0f4ca5ca080ed18d3a7bdff800a | [] | no_license | i-ruby/javare0 | 0f8db3ada7c78b23536d59dacd9483381dc28177 | 3daed928de4ca1cb8111300171aec79276d460eb | refs/heads/master | 2023-06-26T23:25:54.346338 | 2021-07-23T08:53:28 | 2021-07-23T08:53:28 | 362,656,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 821 | java | package work.iruby.nowcoder.jz;
public class JZ9 {
public int jumpFloorII(int target) {
if (target ==1){
return 1;
}
if (target ==2){
return 2;
}
int[] mem = new int[target + 1];
mem[1] = 1;
mem[2] = 2;
for (int i = 3; i < target + 1; i++) {
for (int j = 1; j < i; j++) {
mem[i] += mem[j];
}
mem[i] += 1;
}
return mem[target];
}
static class Test {
public static void main(String[] args) {
JZ9 test = new JZ9();
long start = System.currentTimeMillis();
System.out.println(test.jumpFloorII(19));
long end = System.currentTimeMillis();
System.out.println(end - start);
}
}
} | [
"[email protected]"
] | |
b4fb95cd4d1bc21e0e818cc0bc5c9cddae2e9dd3 | 5f0718d1fc0067415e1b7dcdfe317a4dcd9893b4 | /src/test/java/com/desafio/api/resource/ClienteResourceTest.java | 4563ef58e102558f73779af687e7f3dc70b2d8f7 | [] | no_license | gtorre2/cliente-api | 35bea045bf4065a3f8a2b00cdde724a0c2dea2a9 | 991a2b27f7ed225bcdea29083fa69a94b42f66ef | refs/heads/main | 2023-03-01T08:58:17.759905 | 2021-02-13T19:17:27 | 2021-02-13T19:17:27 | 338,637,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,393 | java | package com.desafio.api.resource;
import java.math.BigInteger;
import java.time.LocalDate;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import com.desafio.api.dto.ClienteDTO;
import com.desafio.model.entity.Cliente;
import com.desafio.model.enums.TipoTelefone;
import com.desafio.service.ClienteService;
import com.desafio.service.UsuarioService;
import com.fasterxml.jackson.databind.ObjectMapper;
@ExtendWith(SpringExtension.class)
@ActiveProfiles("test")
@WebMvcTest( controllers = ClienteResource.class )
@AutoConfigureMockMvc
public class ClienteResourceTest {
static final String API = "/api/clientes";
static final MediaType JSON = MediaType.APPLICATION_JSON;
static final String NOME = "Ricardo";
static final BigInteger CPF = new BigInteger("11111111111");
static final String EMAIL = "[email protected]";
static final TipoTelefone TIPO_TELEFONE = TipoTelefone.CELULAR;
static final BigInteger NUMERO_TELEFONE = new BigInteger("12111111111");
static final BigInteger CEP = new BigInteger("12345777");
static final String LOGRADOURO = "Teste";
static final String BAIRRO = "Asa Norte";
static final String CIDADE = "Brasรญlia";
static final String UF = "DF";
static final String USUARIO = "admin";
@Autowired
MockMvc mvc;
@MockBean
ClienteService service;
@MockBean
UsuarioService usuarioService;
@Test
public void criarCliente() throws Exception {
ClienteDTO dto = ClienteDTO.builder()
.nome(NOME)
.cpf(CPF)
.email(EMAIL)
.tipo(TIPO_TELEFONE.name())
.numeroTelefone(NUMERO_TELEFONE)
.cep(CEP)
.logradouro(LOGRADOURO)
.bairro(BAIRRO)
.cidade(CIDADE)
.uf(UF)
.usuario(1l)
.build();
Cliente cliente = Cliente.builder()
.id(1l)
.nome(NOME)
.cpf(CPF)
.email(EMAIL)
.tipoTelefone(TIPO_TELEFONE)
.numeroTelefone(NUMERO_TELEFONE)
.cep(CEP)
.logradouro(LOGRADOURO)
.bairro(BAIRRO)
.cidade(CIDADE)
.uf(UF)
.dataCadastro(LocalDate.now())
.usuario(USUARIO)
.build();
Mockito.when(service.salvar(Mockito.any(Cliente.class))).thenReturn(cliente);
String json = new ObjectMapper().writeValueAsString(dto);
MockHttpServletRequestBuilder request = MockMvcRequestBuilders
.post(API)
.accept(JSON)
.contentType(JSON)
.content(json);
mvc.perform(request)
.andExpect(MockMvcResultMatchers.status().isCreated())
.andExpect(MockMvcResultMatchers.jsonPath("id").value(cliente.getId()))
.andExpect(MockMvcResultMatchers.jsonPath("nome").value(cliente.getNome()));
}
}
| [
"[email protected]"
] | |
d7c3e1157725b2e44887c45d032e6cc3165e4dc7 | 849e7a457380676b4dd208e9ceca1996839ba67a | /app/src/main/java/com/example/yehoon/sorting_show/CodeFragment.java | e6848684bef453f163fffda012fb58c86a5f2115 | [] | no_license | yoonK94/sorting.show | 244f369f7fdba1e527ee7416041f8bc394546227 | d1b6771516a1daac2c279ebe6752b7bc468c4ce4 | refs/heads/master | 2020-04-08T21:05:56.254832 | 2018-12-03T21:06:07 | 2018-12-03T21:06:07 | 159,728,771 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,125 | java | package com.example.yehoon.sorting_show;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
public class CodeFragment extends Fragment {
LinearLayout codeLayout;
public static CodeFragment newInstance(String algorithm) {
CodeFragment fragment = new CodeFragment();
Bundle bundle = new Bundle();
bundle.putString(VisualizerController.KEY_ALGORITHM, algorithm);
fragment.setArguments(bundle);
return fragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_code, container, false);
codeLayout = (LinearLayout) rootView.findViewById(R.id.codeLayout);
// setCode(getArguments().getString(VisualizerController.KEY_ALGORITHM));
return rootView;
}
//
// public void setCode(String key) {
// if (codeLayout != null) {
// codeLayout.removeAllViews();
// switch (key) {
// case VisualizerController.INSERTION_SORT:
// addCodeItem(VisualizerController.CODE_INSERTION_SORT, "Insertion sort");
// break;
// }
// }
//
// }
//
// private void addCodeItem(String code, String title) {
// View codeitem = LayoutInflater.from(getActivity()).inflate(R.layout.item_code_view, codeLayout, false);
//
// CodeView codeView = (CodeView) codeitem.findViewById(R.id.code_view);
// TextView titleText = (TextView) codeitem.findViewById(R.id.title);
//
// titleText.setText(title);
//
// codeView.setTheme(CodeViewTheme.GITHUB);
// codeView.setHorizontalScrollBarEnabled(true);
//
// codeView.setOnTouchListener(new HorizontalMoveListener());
//
// codeView.showCode(code);
//
// codeLayout.addView(codeitem);
//
// }
/**
* handle horizontal move
*/
class HorizontalMoveListener implements View.OnTouchListener {
float downX = 0;
float downY = 0;
@Override
public boolean onTouch(View v, MotionEvent event) {
int action = event.getAction();
switch (action){
case MotionEvent.ACTION_DOWN:
downX = event.getX();
downY = event.getY();
break;
case MotionEvent.ACTION_MOVE:
float dx = Math.abs(event.getX() - downX);
float dy = Math.abs(event.getY() - downY);
if(dx > dy){
v.getParent().requestDisallowInterceptTouchEvent(true);
}
downX = event.getX();
downY = event.getY();
break;
}
return false;
}
}
}
| [
"[email protected]"
] | |
49da43e30f3bf0c1cc313024e89a80c1eac07338 | bc9980f740885c9e74f53c72b3c4802f1db5291a | /app/src/main/java/com/sk/maiqian/module/my/activity/ResetPWDActivity.java | 5929d4e0b19e91368095c349c7d6b7bd1ee81635 | [] | no_license | 20180910/maiqian | 415bb2e0ff3221e93314bef49696081accc819a7 | 7a049079a20697d62012c5378b01e82f5b0a99a7 | refs/heads/master | 2020-03-28T10:20:56.371623 | 2018-08-27T05:17:32 | 2018-08-27T05:17:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,451 | java | package com.sk.maiqian.module.my.activity;
import android.text.TextUtils;
import android.view.View;
import com.github.customview.MyEditText;
import com.library.base.BaseObj;
import com.library.base.tools.ZhengZeUtils;
import com.sk.maiqian.IntentParam;
import com.sk.maiqian.R;
import com.sk.maiqian.base.BaseActivity;
import com.sk.maiqian.base.MyCallBack;
import com.sk.maiqian.module.my.network.ApiRequest;
import java.util.HashMap;
import java.util.Map;
import butterknife.BindView;
import butterknife.OnClick;
/**
* Created by Administrator on 2018/3/27.
*/
public class ResetPWDActivity extends BaseActivity {
@BindView(R.id.et_resetpwd_pwd)
MyEditText et_resetpwd_pwd;
@BindView(R.id.et_resetpwd_repwd)
MyEditText et_resetpwd_repwd;
private String phone,smsCode;
@Override
protected int getContentView() {
setAppTitle("้็ฝฎๅฏ็ ");
setAppRightImg(R.drawable.share);
return R.layout.resetpwd_act;
}
@Override
protected void initView() {
phone = getIntent().getStringExtra(IntentParam.phone);
smsCode = getIntent().getStringExtra(IntentParam.smsCode);
}
@Override
protected void initData() {
}
@OnClick(R.id.tv_resetpwd_commit)
public void onViewClick(View v) {
switch (v.getId()){
case R.id.tv_resetpwd_commit:
String pwd = getSStr(et_resetpwd_pwd);
String repwd = getSStr(et_resetpwd_repwd);
if(!ZhengZeUtils.isShuZiAndZiMu(pwd)||pwd.length()>12||pwd.length()<6){
showMsg("่ฏท่พๅ
ฅ6-12ไฝๆฐๅญๅ ๅญๆฏ็ๅฏ็ ");
return;
}else if(!TextUtils.equals(pwd,repwd)){
showMsg("ไธคๆฌกๅฏ็ ไธไธๆ ท");
return;
}
updatePWD(pwd);
break;
}
}
private void updatePWD(String pwd) {
showLoading();
Map<String,String> map=new HashMap<String,String>();
map.put("username",phone);
map.put("sms_code",smsCode);
map.put("newPassword",pwd);
map.put("sign",getSign(map));
ApiRequest.forgetPWD(map, new MyCallBack<BaseObj>(mContext) {
@Override
public void onSuccess(BaseObj obj, int errorCode, String msg) {
showMsg(msg);
setResult(RESULT_OK);
finish();
}
});
}
}
| [
"[email protected]"
] | |
15bf5ecfd319161b33d09fd919ed6be3a5e59c4e | 7d483756b487d443ccd539440b7ba0674d29068c | /src/main/java/eu/hansolo/fx/charts/CircularPlot.java | 07410d0001b058067c88eb7f6c63d8f88cd60834 | [
"Apache-2.0"
] | permissive | phamvanthanh/charts | 48e05b3b6b1bce398f12400c78b71e91216cfb0e | 2999a8426100967ccb2198c2c43ee94501fc104d | refs/heads/master | 2022-12-07T04:14:41.637196 | 2020-09-04T06:29:09 | 2020-09-04T06:29:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46,081 | java | /*
* Copyright (c) 2017 by Gerrit Grunwald
*
* 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 eu.hansolo.fx.charts;
import eu.hansolo.fx.charts.data.Connection;
import eu.hansolo.fx.charts.data.PlotItem;
import eu.hansolo.fx.charts.event.EventType;
import eu.hansolo.fx.charts.event.ItemEvent;
import eu.hansolo.fx.charts.event.ItemEventListener;
import eu.hansolo.fx.charts.font.Fonts;
import eu.hansolo.fx.charts.tools.Helper;
import eu.hansolo.fx.charts.tools.Point;
import eu.hansolo.fx.geometry.Path;
import javafx.application.Platform;
import javafx.beans.DefaultProperty;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.BooleanPropertyBase;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.DoublePropertyBase;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.IntegerPropertyBase;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.ObjectPropertyBase;
import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import javafx.geometry.VPos;
import javafx.scene.Node;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import javafx.scene.shape.ArcType;
import javafx.scene.shape.StrokeLineCap;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
* User: hansolo
* Date: 17.11.17
* Time: 10:41
*/
@DefaultProperty("children")
public class CircularPlot extends Region {
private static final double PREFERRED_WIDTH = 500;
private static final double PREFERRED_HEIGHT = 500;
private static final double MINIMUM_WIDTH = 50;
private static final double MINIMUM_HEIGHT = 50;
private static final double MAXIMUM_WIDTH = 4096;
private static final double MAXIMUM_HEIGHT = 4096;
private static final double DEFAULT_SEGMENT_GAP = 4;
private static final double DEFAULT_CONNECTION_OPACITY = 0.65;
private static final double MAJOR_TICK_MARK_LENGTH = 0.0125;
private static final double MEDIUM_TICK_MARK_LENGTH = 0.01;
private static final double MINOR_TICK_MARK_LENGTH = 0.0075;
private static final double TICK_MARK_WIDTH = 0.001;
private static final double ANGLE_OFFSET = 90;
private double size;
private double width;
private double height;
private Canvas canvas;
private GraphicsContext ctx;
private double mainLineWidth;
private double outgoingLineWidth;
private double tickMarkWidth;
private double chartSize;
private double chartOffset;
private double innerChartSize;
private double innerChartOffset;
private double centerX;
private double centerY;
private Color _tickMarkColor;
private ObjectProperty<Color> tickMarkColor;
private Color _textColor;
private ObjectProperty<Color> textColor;
private int _decimals;
private IntegerProperty decimals;
private double _segmentGap;
private DoubleProperty segmentGap;
private boolean _showFlowDirection;
private BooleanProperty showFlowDirection;
private boolean _minorTickMarksVisible;
private boolean _mediumTickMarksVisible;
private boolean _majorTickMarksVisible;
private boolean _tickLabelsVisible;
private TickLabelOrientation _tickLabelOrientation;
private boolean _onlyFirstAndLastTickLabelVisible;
private double _connectionOpacity;
private DoubleProperty connectionOpacity;
private Locale _locale;
private ObjectProperty<Locale> locale;
private ObservableList<PlotItem> items;
private ItemEventListener itemListener;
private ListChangeListener<PlotItem> itemListListener;
private Map<Path, PlotItem> itemPaths;
private Map<Path, String> paths;
private Map<Path, PlotItem[]> connectionMap;
private Tooltip tooltip;
private String formatString;
private ObservableList<Connection> connections;
// ******************** Constructors **************************************
public CircularPlot() {
_tickMarkColor = Color.BLACK;
_textColor = Color.BLACK;
_segmentGap = DEFAULT_SEGMENT_GAP;
_decimals = 0;
_showFlowDirection = false;
_minorTickMarksVisible = true;
_mediumTickMarksVisible = true;
_majorTickMarksVisible = true;
_tickLabelsVisible = true;
_tickLabelOrientation = TickLabelOrientation.TANGENT;
_onlyFirstAndLastTickLabelVisible = true;
_connectionOpacity = DEFAULT_CONNECTION_OPACITY;
_locale = Locale.getDefault();
items = FXCollections.observableArrayList();
itemListener = e -> redraw();
itemListListener = c -> {
while (c.next()) {
if (c.wasAdded()) {
c.getAddedSubList().forEach(addedItem -> addedItem.setOnItemEvent(itemListener));
} else if (c.wasRemoved()) {
c.getRemoved().forEach(removedItem -> removedItem.removeItemEventListener(itemListener));
}
}
validateData();
redraw();
};
formatString = "%." + _decimals + "f";
connections = FXCollections.observableArrayList();
itemPaths = new LinkedHashMap<>();
paths = new LinkedHashMap<>();
connectionMap = new LinkedHashMap<>();
initGraphics();
registerListeners();
}
// ******************** Initialization ************************************
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ctx = canvas.getGraphicsContext2D();
ctx.setLineCap(StrokeLineCap.BUTT);
tooltip = new Tooltip();
tooltip.setAutoHide(true);
getChildren().setAll(canvas);
}
private void registerListeners() {
widthProperty().addListener(o -> resize());
heightProperty().addListener(o -> resize());
items.addListener(itemListListener);
canvas.setOnMouseClicked(e -> {
paths.forEach((path, tooltipText) -> {
double eventX = e.getX();
double eventY = e.getY();
if (path.contains(eventX, eventY)) {
double tooltipX = eventX + canvas.getScene().getX() + canvas.getScene().getWindow().getX();
double tooltipY = eventY + canvas.getScene().getY() + canvas.getScene().getWindow().getY() - 25;
tooltip.setText(tooltipText);
tooltip.setX(tooltipX);
tooltip.setY(tooltipY);
tooltip.show(getScene().getWindow());
if (connectionMap.get(path).length > 1) {
PlotItem item0 = connectionMap.get(path)[0];
PlotItem item1 = connectionMap.get(path)[1];
Platform.runLater(() -> {
item0.fireItemEvent(new ItemEvent(item0, EventType.CONNECTION_SELECTED_FROM));
item1.fireItemEvent(new ItemEvent(item1, EventType.CONNECTION_SELECTED_TO));
});
}
}
});
itemPaths.forEach((itemPath, plotItem) -> {
double eventX = e.getX();
double eventY = e.getY();
if (itemPath.contains(eventX, eventY)) {
Platform.runLater(() -> plotItem.fireItemEvent(new ItemEvent(plotItem, EventType.SELECTED)));
}
});
});
}
// ******************** Methods *******************************************
@Override public void layoutChildren() {
super.layoutChildren();
}
@Override protected double computeMinWidth(final double HEIGHT) { return MINIMUM_WIDTH; }
@Override protected double computeMinHeight(final double WIDTH) { return MINIMUM_HEIGHT; }
@Override protected double computePrefWidth(final double HEIGHT) { return super.computePrefWidth(HEIGHT); }
@Override protected double computePrefHeight(final double WIDTH) { return super.computePrefHeight(WIDTH); }
@Override protected double computeMaxWidth(final double HEIGHT) { return MAXIMUM_WIDTH; }
@Override protected double computeMaxHeight(final double WIDTH) { return MAXIMUM_HEIGHT; }
private void handleControlPropertyChanged(final String PROPERTY) {
if ("".equals(PROPERTY)) {
}
}
@Override public ObservableList<Node> getChildren() { return super.getChildren(); }
public void dispose() {
items.forEach(item -> item.removeItemEventListener(itemListener));
items.removeListener(itemListListener);
}
public Color getTickMarkColor() { return null == tickMarkColor ? _tickMarkColor : tickMarkColor.get(); }
public void setTickMarkColor(final Color COLOR) {
if (null == tickMarkColor) {
_tickMarkColor = COLOR;
redraw();
} else {
tickMarkColor.set(COLOR);
}
}
public ObjectProperty<Color> tickMarkColorProperty() {
if (null == tickMarkColor) {
tickMarkColor = new ObjectPropertyBase<Color>(_tickMarkColor) {
@Override protected void invalidated() { redraw(); }
@Override public Object getBean() { return CircularPlot.this; }
@Override public String getName() { return "tickMarkColor"; }
};
_tickMarkColor = null;
}
return tickMarkColor;
}
public Color getTextColor() { return null == textColor ? _textColor : textColor.get(); }
public void setTextColor(final Color COLOR) {
if (null == textColor) {
_textColor = COLOR;
redraw();
} else {
textColor.set(COLOR);
}
}
public ObjectProperty<Color> textColorProperty() {
if (null == textColor) {
textColor = new ObjectPropertyBase<Color>(_textColor) {
@Override protected void invalidated() { redraw(); }
@Override public Object getBean() { return CircularPlot.this; }
@Override public String getName() { return "textColor"; }
};
_textColor = null;
}
return textColor;
}
public int getDecimals() { return null == decimals ? _decimals : decimals.get(); }
public void setDecimals(final int DECIMALS) {
if (null == decimals) {
_decimals = Helper.clamp(0, 6, DECIMALS);
formatString = new StringBuilder("%.").append(getDecimals()).append("f").toString();
redraw();
} else {
decimals.set(DECIMALS);
}
}
public IntegerProperty decimalsProperty() {
if (null == decimals) {
decimals = new IntegerPropertyBase(_decimals) {
@Override protected void invalidated() {
set(Helper.clamp(0, 6, get()));
formatString = new StringBuilder("%.").append(get()).append("f").toString();
redraw();
}
@Override public Object getBean() { return CircularPlot.this; }
@Override public String getName() { return "decimals"; }
};
}
return decimals;
}
public double getSegmentGap() { return null == segmentGap ? _segmentGap : segmentGap.get(); }
public void setSegmentGap(final double GAP) {
if (null == segmentGap) {
_segmentGap = Helper.clamp(0, 10, GAP);
redraw();
} else {
segmentGap.set(GAP);
}
}
public DoubleProperty segmentGapProperty() {
if (null == segmentGap) {
segmentGap = new DoublePropertyBase(_segmentGap) {
@Override protected void invalidated() {
set(Helper.clamp(0, 10, get()));
redraw();
}
@Override public Object getBean() { return CircularPlot.this; }
@Override public String getName() { return "segmentGap"; }
};
}
return segmentGap;
}
public boolean getShowFlowDirection() { return null == showFlowDirection ? _showFlowDirection : showFlowDirection.get(); }
public void setShowFlowDirection(final boolean SHOW) {
if (null == showFlowDirection) {
_showFlowDirection = SHOW;
drawChart();
} else {
showFlowDirection.set(SHOW);
}
}
public BooleanProperty showFlowDirectionProperty() {
if (null == showFlowDirection) {
showFlowDirection = new BooleanPropertyBase(_showFlowDirection) {
@Override protected void invalidated() { drawChart(); }
@Override public Object getBean() { return CircularPlot.this; }
@Override public String getName() { return "showFlowDirection"; }
};
}
return showFlowDirection;
}
public boolean getMinorTickMarksVisible() { return _minorTickMarksVisible; }
public void setMinorTickMarksVisible(final boolean VISIBLE) {
_minorTickMarksVisible = VISIBLE;
redraw();
}
public boolean getMediumTickMarksVisible() { return _mediumTickMarksVisible; }
public void setMediumTickMarksVisible(final boolean VISIBLE) {
_mediumTickMarksVisible = VISIBLE;
redraw();
}
public boolean getMajorTickMarksVisible() { return _majorTickMarksVisible; }
public void setMajorTickMarksVisible(final boolean VISIBLE) {
_majorTickMarksVisible = VISIBLE;
redraw();
}
public boolean getTickLabelsVisible() { return _tickLabelsVisible; }
public void setTickLabelsVisible(final boolean VISIBLE) {
_tickLabelsVisible = VISIBLE;
redraw();
}
public TickLabelOrientation getTickLabelOrientation() { return _tickLabelOrientation; }
public void setTickLabelOrientation(final TickLabelOrientation ORIENTATION) {
_tickLabelOrientation = ORIENTATION;
redraw();
}
public boolean isOnlyFirstAndLastTickLabelVisible() { return _onlyFirstAndLastTickLabelVisible; }
public void setOnlyFirstAndLastTickLabelVisible(final boolean VISIBLE) {
_onlyFirstAndLastTickLabelVisible = VISIBLE;
redraw();
}
public double getConnectionOpacity() { return null == connectionOpacity ? _connectionOpacity : connectionOpacity.get(); }
public void setConnectionOpacity(final double OPACITY) {
if (null == connectionOpacity) {
_connectionOpacity = Helper.clamp(0.1, 1.0, OPACITY);
redraw();
} else {
connectionOpacity.set(OPACITY);
}
}
public DoubleProperty connectionOpacityProperty() {
if (null == connectionOpacity) {
connectionOpacity = new DoublePropertyBase(_connectionOpacity) {
@Override protected void invalidated() {
set(Helper.clamp(0.1, 1.0, get()));
redraw();
}
@Override public Object getBean() { return CircularPlot.this; }
@Override public String getName() { return "connectionOpacity"; }
};
}
return connectionOpacity;
}
public Locale getLocale() { return null == locale ? _locale : locale.get(); }
public void setLocale(final Locale LOCALE) {
if (null == locale) {
_locale = LOCALE;
redraw();
} else {
locale.set(LOCALE);
}
}
public ObjectProperty<Locale> localeProperty() {
if (null == locale) {
locale = new ObjectPropertyBase<Locale>(_locale) {
@Override protected void invalidated() { redraw(); }
@Override public Object getBean() { return CircularPlot.this; }
@Override public String getName() { return "locale"; }
};
}
_locale = null;
return locale;
}
public List<PlotItem> getItems() { return items; }
public void setItems(final PlotItem... ITEMS) { setItems(Arrays.asList(ITEMS)); }
public void setItems(final List<PlotItem> ITEMS) {
items.setAll(ITEMS);
validateData();
}
public void addItem(final PlotItem ITEM) {
if (!items.contains(ITEM)) { items.add(ITEM); }
validateData();
}
public void removeItem(final PlotItem ITEM) { if (items.contains(ITEM)) { items.remove(ITEM); } }
public void sortAscending() {
Collections.sort(getItems(), Comparator.comparingDouble(PlotItem::getValue));
}
public void sortDescending() {
Collections.sort(getItems(), (item1, item2) -> Double.compare(item2.getValue(), item1.getValue()));
}
public ObservableList<Connection> getConnections() { return connections; }
public Connection getConnection(final PlotItem FROM, final PlotItem TO) {
return connections.stream().filter(connection -> connection.getOutgoingItem().equals(FROM) && connection.getIncomingItem().equals(TO)).findFirst().orElse(null);
}
private void validateData() {
connections.clear();
Map<PlotItem, Double> incoming = new HashMap<>(getItems().size());
for (PlotItem item : getItems()) {
item.getOutgoing().forEach((outgoingItem, value) -> {
if (incoming.containsKey(outgoingItem)) {
incoming.put(outgoingItem, incoming.get(outgoingItem) + value);
connections.add(new Connection(item, outgoingItem, Color.TRANSPARENT));
} else {
incoming.put(outgoingItem, value);
connections.add(new Connection(outgoingItem, item, Color.TRANSPARENT));
}
});
}
for (PlotItem item : getItems()) {
if (incoming.containsKey(item)) {
double sumOfIncoming = incoming.get(item);
if (item.getValue() < sumOfIncoming) {
item.setValue(sumOfIncoming);
}
}
}
}
private void drawChart() {
itemPaths.clear();
paths.clear();
connectionMap.clear();
TickLabelOrientation tickLabelOrientation = getTickLabelOrientation();
if (TickLabelOrientation.ORTHOGONAL == tickLabelOrientation) {
chartSize = size * 0.75;
mainLineWidth = chartSize * 0.045;
outgoingLineWidth = chartSize * 0.015;
tickMarkWidth = chartSize * TICK_MARK_WIDTH;
chartOffset = (size - chartSize) * 0.5;
innerChartOffset = chartOffset + chartSize * 0.032;
innerChartSize = chartSize - chartSize * 0.064;
centerX = size * 0.5;
centerY = size * 0.5;
}
ctx.clearRect(0, 0, size, size);
double sum = items.stream().mapToDouble(PlotItem::getValue).sum();
int noOfItems = items.size();
double innerRadius = chartSize * 0.5 - mainLineWidth * 0.5;
double outerRadius = chartSize * 0.5 + mainLineWidth * 0.5;
Map<PlotItem, ChartItemParameter> parameterMap = new HashMap<>(items.size());
// Draw outer circle segments and tickmarks
double angleStep = (360.0 - (noOfItems * getSegmentGap())) / sum;
double angle = -ANGLE_OFFSET;
for (int i = 0 ; i < noOfItems ; i++) {
PlotItem item = items.get(i);
double angleRange = item.getValue() * angleStep;
double sumOfOutgoing = item.getOutgoing().values().stream().mapToDouble(Double::doubleValue).sum();
// Store item specific angle and angleRange for later use
parameterMap.put(item, new ChartItemParameter(angle + ANGLE_OFFSET, angleRange));
// Draw outer circle segments
ctx.setLineWidth(mainLineWidth);
ctx.setStroke(item.getFill());
ctx.strokeArc(chartOffset, chartOffset, chartSize, chartSize, -angle, -angleRange, ArcType.OPEN);
// Create paths for click detection
double[] xy1 = Helper.rotatePointAroundRotationCenter(centerX - outerRadius, centerY, centerX, centerY, angle - 180);
double[] xy2 = Helper.rotatePointAroundRotationCenter(centerX - outerRadius, centerY, centerX, centerY, angle + angleRange - 180);
double[] xy3 = Helper.rotatePointAroundRotationCenter(centerX - innerRadius, centerY, centerX, centerY, angle + angleRange - 180);
double[] xy4 = Helper.rotatePointAroundRotationCenter(centerX - innerRadius, centerY, centerX, centerY, angle - 180);
Path itemPath = new Path();
itemPath.setFill(Color.TRANSPARENT);
itemPath.moveTo(xy1[0], xy1[1]);
itemPath.arcTo(outerRadius, outerRadius, angle + angleRange - 180, false, true, xy2[0], xy2[1]);
itemPath.lineTo(xy3[0], xy3[1]);
itemPath.arcTo(innerRadius, innerRadius, -angle - angleRange - 180, false, false, xy4[0], xy4[1]);
itemPath.lineTo(xy1[0], xy1[1]);
itemPath.closePath();
itemPath.draw(ctx, true, false);
itemPaths.put(itemPath, item);
// Draw sum of outgoing at the end of the segment
double outgoingAngleRange = sumOfOutgoing * angleStep;
ctx.setLineWidth(outgoingLineWidth);
ctx.strokeArc(innerChartOffset, innerChartOffset, innerChartSize, innerChartSize, -angle - angleRange + outgoingAngleRange, -outgoingAngleRange, ArcType.OPEN);
// Draw tickmarks
ctx.setLineWidth(tickMarkWidth);
ctx.setStroke(getTickMarkColor());
ctx.strokeArc(chartOffset - mainLineWidth * 0.5, chartOffset - mainLineWidth * 0.5, chartSize + mainLineWidth, chartSize + mainLineWidth, -angle, -angleRange, ArcType.OPEN);
drawTickMarks(item, angle, angleRange);
// Increment angle
angle += angleRange + getSegmentGap();
}
// Draw incoming and outgoing
double sinValue;
double cosValue;
double innerRingRadius = chartSize * 0.462;
double innerRingRadius2 = chartSize * 0.475;
double outerPointRadius = chartSize * 0.26;
double innerPointRadius = chartSize * 0.20;
for (int i = 0 ; i < noOfItems ; i++) {
PlotItem item = items.get(i);
ChartItemParameter itemParameter = parameterMap.get(item);
double itemStartAngle = itemParameter.getStartAngle();
double itemAngleRange = itemParameter.getAngleRange();
double itemEndAngle = itemParameter.getEndAngle();
// Draw item name
ctx.save();
ctx.setFill(getTextColor());
ctx.setFont(Fonts.latoRegular(size * 0.02));
ctx.setTextAlign(TextAlignment.CENTER);
ctx.setTextBaseline(VPos.CENTER);
sinValue = Math.sin(Math.toRadians(-itemStartAngle - itemAngleRange * 0.5 - 180));
cosValue = Math.cos(Math.toRadians(-itemStartAngle - itemAngleRange * 0.5 - 180));
double itemNamePointX = centerX + chartSize * 0.56 * sinValue;
double itemNamePointY = centerY + chartSize * 0.56 * cosValue;
if (TickLabelOrientation.ORTHOGONAL == tickLabelOrientation) {
Font font = Fonts.latoRegular(size * 0.02);
Text measureText = new Text(item.getName());
measureText.setFont(font);
double textWidth = measureText.getLayoutBounds().getWidth();
itemNamePointX += textWidth * 0.33 * sinValue;
itemNamePointY += textWidth * 0.33 * cosValue;
}
ctx.translate(itemNamePointX, itemNamePointY);
rotateContextForText(ctx, -itemStartAngle, -itemAngleRange * 0.5 + ANGLE_OFFSET, tickLabelOrientation);
ctx.fillText(item.getName(), 0, 0);
ctx.restore();
// Draw connections between items
for (PlotItem outgoingItem : item.getOutgoing().keySet()) {
ChartItemParameter outgoingItemParameter = parameterMap.get(outgoingItem);
double outgoingValue = item.getOutgoing().get(outgoingItem);
double outgoingAngleRange = outgoingValue * angleStep;
int indexDelta = items.indexOf(item) - items.indexOf(outgoingItem);
outerPointRadius = outerPointRadius / (Math.abs(indexDelta) + 0.75);
innerPointRadius = innerPointRadius / (Math.abs(indexDelta) + 0.75);
// Points in source chart item
sinValue = Math.sin(Math.toRadians(-itemEndAngle + 180 + itemParameter.getNextOutgoingStartAngle()));
cosValue = Math.cos(Math.toRadians(-itemEndAngle + 180 + itemParameter.getNextOutgoingStartAngle()));
Point p0 = new Point(centerX + innerRingRadius * sinValue, centerY + innerRingRadius * cosValue);
sinValue = Math.sin(Math.toRadians(-itemEndAngle + 180 + outgoingAngleRange + itemParameter.getNextOutgoingStartAngle()));
cosValue = Math.cos(Math.toRadians(-itemEndAngle + 180 + outgoingAngleRange + itemParameter.getNextOutgoingStartAngle()));
Point p1 = new Point(centerX + innerRingRadius * sinValue, centerY + innerRingRadius * cosValue);
// Point between p0 and p1
sinValue = Math.sin(Math.toRadians(-itemEndAngle + outgoingAngleRange * 0.5 + 180 + itemParameter.getNextOutgoingStartAngle()));
cosValue = Math.cos(Math.toRadians(-itemEndAngle + outgoingAngleRange * 0.5 + 180 + itemParameter.getNextOutgoingStartAngle()));
Point p01 = new Point(centerX + innerRingRadius * sinValue, centerY + innerRingRadius * cosValue);
// Points in target chart item
sinValue = Math.sin(Math.toRadians(-outgoingItemParameter.getNextIncomingStartAngle() + 180));
cosValue = Math.cos(Math.toRadians(-outgoingItemParameter.getNextIncomingStartAngle() + 180));
Point p2 = new Point(centerX + innerRingRadius * sinValue, centerY + innerRingRadius * cosValue);
sinValue = Math.sin(Math.toRadians(-outgoingItemParameter.getNextIncomingStartAngle() - outgoingAngleRange + 180));
cosValue = Math.cos(Math.toRadians(-outgoingItemParameter.getNextIncomingStartAngle() - outgoingAngleRange + 180));
Point p3 = new Point(centerX + innerRingRadius * sinValue, centerY + innerRingRadius * cosValue);
// Point between p2 and p3
sinValue = Math.sin(Math.toRadians(-outgoingItemParameter.getNextIncomingStartAngle() - outgoingAngleRange * 0.5 + 180));
cosValue = Math.cos(Math.toRadians(-outgoingItemParameter.getNextIncomingStartAngle() - outgoingAngleRange * 0.5 + 180));
Point p23;
if (getShowFlowDirection()) {
p23 = new Point(centerX + innerRingRadius2 * sinValue, centerY + innerRingRadius2 * cosValue);
} else {
p23 = new Point(centerX + innerRingRadius * sinValue, centerY + innerRingRadius * cosValue);
}
// Points between source and target chart item
sinValue = Math.sin(Math.toRadians((-itemEndAngle - outgoingItemParameter.getNextIncomingStartAngle()) * 0.5 + 180 + itemParameter.getNextOutgoingStartAngle()));
cosValue = Math.cos(Math.toRadians((-itemEndAngle - outgoingItemParameter.getNextIncomingStartAngle()) * 0.5 + 180 + itemParameter.getNextOutgoingStartAngle()));
Point p4, p5;
if (indexDelta < 0) {
p4 = new Point(centerX + outerPointRadius * sinValue, centerY + outerPointRadius * cosValue);
p5 = new Point(centerX + innerPointRadius * sinValue, centerY + innerPointRadius * cosValue);
} else {
p4 = new Point(centerX + innerPointRadius * sinValue, centerY + innerPointRadius * cosValue);
p5 = new Point(centerX + outerPointRadius * sinValue, centerY + outerPointRadius * cosValue);
}
// Store next incoming start angle
outgoingItemParameter.setNextIncomingStartAngle(outgoingItemParameter.getNextIncomingStartAngle() + outgoingAngleRange);
// Store next outgoing start angle
itemParameter.setNextOutgoingStartAngle(itemParameter.getNextOutgoingStartAngle() + outgoingAngleRange);
Color connectionFill;
Connection connection = getConnection(item, outgoingItem);
if (null != connection && !connection.getFill().equals(Color.TRANSPARENT)) {
connectionFill = Helper.getColorWithOpacity(connection.getFill(), getConnectionOpacity());
} else {
connectionFill = Helper.getColorWithOpacity(item.getFill(), getConnectionOpacity());
}
// Draw flow
Path path = new Path();
//path.setFill(Helper.getColorWithOpacity(item.getFill(), getConnectionOpacity()));
path.setFill(connectionFill);
path.moveTo(p0.getX(), p0.getY());
path.quadraticCurveTo(p4.getX(), p4.getY(), p2.getX(), p2.getY()); // curve from p4 -> p4 -> p2
if (getShowFlowDirection()) {
path.lineTo(p23.getX(), p23.getY()); // line from p2 -> p23
path.lineTo(p3.getX(), p3.getY()); // line from p23 -> p3
} else {
path.quadraticCurveTo(p23.getX(), p23.getY(), p3.getX(), p3.getY()); // curve from p2 -> p23 -> p3
}
path.quadraticCurveTo(p5.getX(), p5.getY(), p1.getX(), p1.getY()); // curve from p3 -> p5 -> p1
path.quadraticCurveTo(p01.getX(), p01.getY(), p0.getX(), p0.getY()); // curve from p1 -> p01 -> p0
path.closePath();
path.draw(ctx, true, false);
String tooltipText = new StringBuilder().append(item.getName())
.append(" -> ")
.append(outgoingItem.getName())
.append(" ")
.append(String.format(getLocale(), formatString, outgoingValue))
.toString();
paths.put(path, tooltipText);
connectionMap.put(path, new PlotItem[]{ item, outgoingItem });
/*
ctx.setFill(Helper.getColorWithOpacity(item.getFillColor(), getConnectionOpacity()));
ctx.beginPath();
ctx.moveTo(p0.getX(), p0.getY());
ctx.quadraticCurveTo(p4.getX(), p4.getY(), p2.getX(), p2.getY()); // curve from p4 -> p4 -> p2
if (getShowFlowDirection()) {
ctx.lineTo(p23.getX(), p23.getY()); // line from p2 -> p23
ctx.lineTo(p3.getX(), p3.getY()); // line from p23 -> p3
} else {
ctx.quadraticCurveTo(p23.getX(), p23.getY(), p3.getX(), p3.getY()); // curve from p2 -> p23 -> p3
}
ctx.quadraticCurveTo(p5.getX(), p5.getY(), p1.getX(), p1.getY()); // curve from p3 -> p5 -> p1
ctx.quadraticCurveTo(p01.getX(), p01.getY(), p0.getX(), p0.getY()); // curve from p1 -> p01 -> p0
ctx.closePath();
ctx.fill();
*/
}
}
}
private void drawTickMarks(final PlotItem ITEM, final double START_ANGLE, final double ANGLE_RANGE) {
double sinValue;
double cosValue;
double[] scaleParameters = Helper.calcAutoScale(0, ITEM.getValue());
double minorTickSpace = scaleParameters[0];
double majorTickSpace = scaleParameters[1];
double minValue = 0; //scaleParameters[2];
double maxValue = ITEM.getValue(); //scaleParameters[3];
double range = maxValue - minValue;
double angleStep = (ANGLE_RANGE / range) * minorTickSpace;
BigDecimal minorTickSpaceBD = BigDecimal.valueOf(minorTickSpace);
BigDecimal majorTickSpaceBD = BigDecimal.valueOf(majorTickSpace);
BigDecimal mediumCheck2 = BigDecimal.valueOf(2 * minorTickSpace);
BigDecimal mediumCheck5 = BigDecimal.valueOf(5 * minorTickSpace);
BigDecimal counterBD = BigDecimal.valueOf(0);
double counter = 0;
boolean majorTickMarksVisible = getMajorTickMarksVisible();
boolean mediumTickMarksVisible = getMediumTickMarksVisible();
boolean minorTickMarksVisible = getMinorTickMarksVisible();
boolean tickLabelsVisible = getTickLabelsVisible();
boolean onlyFirstAndLastLabelVisible = isOnlyFirstAndLastTickLabelVisible();
double orthTextFactor = 0.542;
double tickLabelFontSize = getDecimals() == 0 ? 0.018 * chartSize : 0.017 * chartSize;
double tickLabelOrientationFactor = TickLabelOrientation.HORIZONTAL == getTickLabelOrientation() ? 0.9 : 1.0;
Font tickLabelFont = Fonts.latoRegular(tickLabelFontSize * tickLabelOrientationFactor);
// Variables needed for tickmarks
double innerPointX, innerPointY;
double outerPointX, outerPointY;
double outerMediumPointX, outerMediumPointY;
double outerMinorPointX, outerMinorPointY;
double textPointX, textPointY;
// Set the general tickmark color
ctx.setStroke(getTickMarkColor());
ctx.setFill(getTickMarkColor());
ctx.setLineCap(StrokeLineCap.BUTT);
ctx.setLineWidth(size * TICK_MARK_WIDTH);
ctx.setTextAlign(TextAlignment.CENTER);
ctx.setTextBaseline(VPos.CENTER);
// Main loop
BigDecimal tmpStepBD = new BigDecimal(angleStep);
tmpStepBD = tmpStepBD.setScale(3, BigDecimal.ROUND_HALF_UP);
double tmpStep = tmpStepBD.doubleValue();
double angle = 0;
for (double i = 0 ; Double.compare(-ANGLE_RANGE - tmpStep, i) <= 0 ; i -= tmpStep) {
sinValue = Math.sin(Math.toRadians(-START_ANGLE + angle + ANGLE_OFFSET));
cosValue = Math.cos(Math.toRadians(-START_ANGLE + angle + ANGLE_OFFSET));
innerPointX = centerX + chartSize * 0.5225 * sinValue;
innerPointY = centerY + chartSize * 0.5225 * cosValue;
outerPointX = centerX + chartSize * (0.5175 + MAJOR_TICK_MARK_LENGTH) * sinValue;
outerPointY = centerY + chartSize * (0.5175 + MAJOR_TICK_MARK_LENGTH) * cosValue;
outerMediumPointX = centerX + chartSize * (0.5175 + MEDIUM_TICK_MARK_LENGTH) * sinValue;
outerMediumPointY = centerY + chartSize * (0.5175 + MEDIUM_TICK_MARK_LENGTH) * cosValue;
outerMinorPointX = centerX + chartSize * (0.5175 + MINOR_TICK_MARK_LENGTH) * sinValue;
outerMinorPointY = centerY + chartSize * (0.5175 + MINOR_TICK_MARK_LENGTH) * cosValue;
textPointX = centerX + chartSize * orthTextFactor * sinValue;
textPointY = centerY + chartSize * orthTextFactor * cosValue;
if (Double.compare(counterBD.remainder(majorTickSpaceBD).doubleValue(), 0.0) == 0) {
// Draw major tick mark
if (majorTickMarksVisible) {
ctx.strokeLine(innerPointX, innerPointY, outerPointX, outerPointY);
} else if (minorTickMarksVisible) {
ctx.strokeLine(innerPointX, innerPointY, outerMinorPointX, outerMinorPointY);
}
// Draw tick label text
if (tickLabelsVisible) {
ctx.save();
ctx.translate(textPointX, textPointY);
rotateContextForText(ctx, -START_ANGLE, angle, getTickLabelOrientation());
ctx.setFont(tickLabelFont);
if (!onlyFirstAndLastLabelVisible) {
ctx.setFill(getTextColor());
} else {
if ((Double.compare(counter, minValue) == 0 ||
counter + majorTickSpace > maxValue)) {
//Double.compare(counter, maxValue) == 0)) { // only if nice min-max values will be used
ctx.setFill(getTextColor());
} else {
ctx.setFill(Color.TRANSPARENT);
}
}
ctx.fillText(Helper.format(counter, getDecimals(), getLocale()), 0, 0);
ctx.restore();
}
} else if (mediumTickMarksVisible &&
Double.compare(minorTickSpaceBD.remainder(mediumCheck2).doubleValue(), 0.0) != 0.0 &&
Double.compare(counterBD.remainder(mediumCheck5).doubleValue(), 0.0) == 0.0) {
// Draw medium tick mark
ctx.strokeLine(innerPointX, innerPointY, outerMediumPointX, outerMediumPointY);
} else if (minorTickMarksVisible && Double.compare(counterBD.remainder(minorTickSpaceBD).doubleValue(), 0.0) == 0) {
// Draw minor tick mark
ctx.strokeLine(innerPointX, innerPointY, outerMinorPointX, outerMinorPointY);
}
counterBD = counterBD.add(minorTickSpaceBD);
counter = counterBD.doubleValue();
if (counter > maxValue) break;
angle = (angle - angleStep);
}
}
private void rotateContextForText(final GraphicsContext CTX, final double START_ANGLE, final double TEXT_ANGLE, final TickLabelOrientation ORIENTATION) {
switch (ORIENTATION) {
case ORTHOGONAL:
if ((360 - START_ANGLE - TEXT_ANGLE) % 360 > 90 && (360 - START_ANGLE - TEXT_ANGLE) % 360 < 270) {
CTX.rotate((180 - START_ANGLE - TEXT_ANGLE) % 360);
} else {
CTX.rotate((360 - START_ANGLE - TEXT_ANGLE) % 360);
}
break;
case TANGENT:
if ((360 - START_ANGLE - TEXT_ANGLE - 90) % 360 > 90 && (360 - START_ANGLE - TEXT_ANGLE - 90) % 360 < 270) {
CTX.rotate((90 - START_ANGLE - TEXT_ANGLE) % 360);
} else {
CTX.rotate((270 - START_ANGLE - TEXT_ANGLE) % 360);
}
break;
case HORIZONTAL:
default:
break;
}
}
// ******************** Resizing ******************************************
private void resize() {
width = getWidth() - getInsets().getLeft() - getInsets().getRight();
height = getHeight() - getInsets().getTop() - getInsets().getBottom();
size = width < height ? width : height;
chartSize = size * 0.85;
mainLineWidth = chartSize * 0.045;
outgoingLineWidth = chartSize * 0.015;
tickMarkWidth = chartSize * TICK_MARK_WIDTH;
chartOffset = (size - chartSize) * 0.5;
innerChartOffset = chartOffset + chartSize * 0.032;
innerChartSize = chartSize - chartSize * 0.064;
centerX = size * 0.5;
centerY = size * 0.5;
if (width > 0 && height > 0) {
canvas.setWidth(size);
canvas.setHeight(size);
canvas.relocate((getWidth() - size) * 0.5, (getHeight() - size) * 0.5);
redraw();
}
}
private void redraw() {
drawChart();
}
// ******************** Inner Classes *************************************
private class ChartItemParameter {
private double startAngle;
private double angleRange;
private double endAngle;
private double nextIncomingStartAngle;
private double nextOutgoingStartAngle;
// ******************** Constructors **********************************
public ChartItemParameter() {
this(0, 0);
}
public ChartItemParameter(final double START_ANGLE, final double ANGLE_RANGE) {
startAngle = START_ANGLE;
angleRange = ANGLE_RANGE;
endAngle = START_ANGLE + ANGLE_RANGE;
nextIncomingStartAngle = START_ANGLE;
nextOutgoingStartAngle = 0;
}
// ******************** Methods ***************************************
public double getStartAngle() { return startAngle; }
public void setStartAngle(final double START_ANGLE) {
startAngle = START_ANGLE;
endAngle = startAngle + getAngleRange();
nextIncomingStartAngle = startAngle;
nextOutgoingStartAngle = 0;
}
public double getAngleRange() { return angleRange; }
public void setAngleRange(final double ANGLE_RANGE) {
angleRange = ANGLE_RANGE;
endAngle = getStartAngle() + angleRange;
nextOutgoingStartAngle = 0;
}
public double getEndAngle() { return endAngle; }
public double getNextIncomingStartAngle() { return nextIncomingStartAngle; }
public void setNextIncomingStartAngle(final double ANGLE) {
nextIncomingStartAngle = ANGLE;
}
public double getNextOutgoingStartAngle() { return nextOutgoingStartAngle; }
public void setNextOutgoingStartAngle(final double ANGLE) { nextOutgoingStartAngle = ANGLE; }
}
}
| [
"[email protected]"
] | |
e687c1424b8ef579bc32f327b0aacc2522c67647 | ec9b07943447a32c8b82c86a57b449aba670831f | /src/main/java/Mrchenli/dao/step2_ugly/UglyInsuranceDao.java | 7e3e9bf2fb343cd046617d1db7c5a83264967463 | [] | no_license | Mrchenli/transaction-serial | 83215ddabe3a452c50d4d14b0da5874ddfa0db76 | 3c9b5fcd7fcdaccbf9aa3bd106d56b6da745e9ea | refs/heads/master | 2021-01-20T04:21:26.628222 | 2017-09-01T10:31:52 | 2017-09-01T10:31:52 | 101,386,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package Mrchenli.dao.step2_ugly;
import Mrchenli.dao.AbstractInsuranceDao;
public class UglyInsuranceDao extends AbstractInsuranceDao{
@Override
public boolean isConnectionClose() {
return false;
}
}
| [
"[email protected]"
] | |
b46cdeaf8e747e8f8fc12a4a5c0e3c942c1e1582 | b6a0155a27d55b0ff696092d18efd479c4564ed2 | /UnexpectedOrcs/src/Levels/Generator.java | b85a70baf16fd9deaa147ed63a1118fa3085f195 | [] | no_license | Gorge-Studios/Unexpected-Orcs | 2d2c9eb2b015d5a63d70304fcfc9f65f5d1b76fc | 79c3da08360a72a7036789571a7341d75a12e883 | refs/heads/master | 2020-04-05T07:23:47.723575 | 2020-02-16T06:31:20 | 2020-02-16T06:31:20 | 156,674,020 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 37,028 | java | package Levels;
import Enemies.Static.MoneyBag;
import Entities.Drops.Chest;
import Sprites.TileSet;
import Tiles.Tile;
import Utility.Util;
import Utility.Vec2;
import processing.core.PGraphics;
import processing.core.PVector;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import static Tiles.Tiles.*;
import static Utility.Constants.*;
public class Generator {
private static final int treasureRoomMaxSize = 150;
private static final int treasureRoomMinSize = 10;
//------CAVE GENERATION--------
public static void generateCave(Level level, int w, int h, int iterations, float chance) {
game.noiseSeed(game.millis());
float lod = 0.1f;
int[][] tiles = new int[w][h];
int[][] oldTiles = new int[w][h];
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
if (game.random(1) < chance) tiles[i][j] = WALL;
else {
tiles[i][j] = FLOOR;
}
//tiles[i][j] = (game.noise(i * lod, j * lod) > 0.5) ? FLOOR : WALL;
}
}
//Cellular Automata
for (int i = 0; i < iterations; i++) {
iterateGeneration(tiles, oldTiles, w, h, i < iterations - 2);
}
//Flood fill to find regions
int[][] regions = new int[w][h];
ArrayList<ArrayList<PVector>> regionList = new ArrayList<>();
int regionCount = 1; //start at 1 (0 is default value. ie not assigned yet)
ArrayList<PVector> queue = new ArrayList<>();
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
if (tiles[i][j] == WALL || regions[i][j] != 0) continue;
queue.add(new PVector(i, j));
regionList.add(new ArrayList<PVector>());
while (queue.size() > 0) {
PVector current = queue.get(0);
int x = (int) current.x;
int y = (int) current.y;
queue.remove(0);
regions[x][y] = regionCount;
regionList.get(regionList.size() - 1).add(new PVector(x, y));
try {
if (regions[x + 1][y] == 0 && tiles[x + 1][y] != WALL && !queue.contains(new PVector(x + 1, y))) queue.add(new PVector(x + 1, y));
} catch (Exception ignored) {
}
try {
if (regions[x - 1][y] == 0 && tiles[x - 1][y] != WALL && !queue.contains(new PVector(x - 1, y))) queue.add(new PVector(x - 1, y));
} catch (Exception ignored) {
}
try {
if (regions[x][y + 1] == 0 && tiles[x][y + 1] != WALL && !queue.contains(new PVector(x, y + 1))) queue.add(new PVector(x, y + 1));
} catch (Exception ignored) {
}
try {
if (regions[x][y - 1] == 0 && tiles[x][y - 1] != WALL && !queue.contains(new PVector(x, y - 1))) queue.add(new PVector(x, y - 1));
} catch (Exception ignored) {
}
}
regionCount++;
}
}
saveCaveRegions(regionList, w, h);
String[][] newTiles = connectRegions(level, regionList, intsToTileStrings(tiles));
level.setTiles(finishingPass(newTiles, level.tileset));
}
private static void saveCaveRegions(ArrayList<ArrayList<PVector>> regions, int w, int h) {
PGraphics img = game.createGraphics(w, h);
img.beginDraw();
img.colorMode(game.HSB);
img.background(0);
for (ArrayList<PVector> region : regions) {
for (PVector tile : region) {
img.stroke(regions.indexOf(region) / (float) regions.size() * 255, 255, 255);
img.point(tile.x, tile.y);
}
}
img.endDraw();
img.save("./out/level/caveRegions.png");
}
private static String[][] connectRegions(Level level, ArrayList<ArrayList<PVector>> regionList, String[][] tiles) {
Collections.sort(regionList, new Comparator<ArrayList<PVector>>() {
@Override
public int compare(ArrayList<PVector> o1, ArrayList<PVector> o2) {
return o1.size() - o2.size();
}
});
level.start = regionList.get(regionList.size() - 1).get((int)game.random(regionList.get(regionList.size() - 1).size())).add(0.5f, 0.5f);
tiles[(int)level.start.x][(int)level.start.y] = level.tileset.spawn();
while(regionList.size() > 1) {
ArrayList<PVector> region = regionList.get(0);
if(region.size() < treasureRoomMaxSize) {
tiles = treasureRoom(level, region, tiles);
}
if(region.size() < treasureRoomMinSize) {
tiles = fillInRegion(level, region, tiles);
regionList.remove(0);
game.println("region too small");
continue;
}
int startIndex = (int)game.random(region.size());
int x = (int)region.get(startIndex).x;
int y = (int)region.get(startIndex).y;
int targetIndex = (int)game.random(regionList.get(1).size());
int tx = (int)regionList.get(1).get(targetIndex).x;//target x
int ty = (int)regionList.get(1).get(targetIndex).y;//target x
while(region.contains(new PVector(x, y)) || Tiles.get(tiles[x][y]).solid) {
//Biased random walk towards target
if(Tiles.get(tiles[x][y]).solid) {
tiles[x][y] = level.tileset.connectionPath();
region.add(new PVector(x, y));
}
try {
if(!Tiles.get(tiles[x + 1][y]).solid && !region.contains(new PVector(x + 1, y))) {
x += 1;
break;
}
if(!Tiles.get(tiles[x - 1][y]).solid && !region.contains(new PVector(x - 1, y))) {
x -= 1;
break;
}
if(!Tiles.get(tiles[x][y + 1]).solid && !region.contains(new PVector(x, y + 1))) {
y += 1;
break;
}
if(!Tiles.get(tiles[x][y - 1]).solid && !region.contains(new PVector(x, y - 1))) {
y -= 1;
break;
}
}catch (Exception e) {}
int dx = game.abs(tx - x);
int dy = game.abs(ty - y);
float chance = game.random(dx + dy);
if(chance <= dx) {
x += x < tx ? 1 : -1;
} else {
y += y < ty ? 1 : -1;
}
}
int regionIndex = getTileRegion(regionList, x, y);
game.println("ended in region " + regionIndex);
if(regionIndex != -1) {
regionList.get(regionIndex).addAll(regionList.get(0));
}
regionList.remove(0);
}
return tiles;
}
private static int getTileRegion(ArrayList<ArrayList<PVector>> regionList, int x, int y) {
PVector tile = new PVector(x, y);
for(int i = 0; i < regionList.size(); i ++) {
if(regionList.get(i).contains(tile)) {
return i;
}
}
return -1;
}
private static String[][] treasureRoom(Level level, ArrayList<PVector> region, String[][] tiles) {
for(int i = 0; i < region.size(); i ++) {
PVector tile = region.get(i);
if(tiles[(int)tile.x][(int)tile.y] != level.tileset.connectionPath()) {
tiles[(int) tile.x][(int) tile.y] = level.tileset.treasureFloor();
//add money bags in the treasure room
if(game.random(1) < 0.4) {
level.addEnemy(new MoneyBag(tile.x + 0.5f, tile.y + 0.5f));
}
}
}
//Add monsters in random points of the region
//level.addEnemies();
game.println("Treasure Room Generated!");
PVector tile = region.get((int)game.random(region.size()));
engine.addDrop(new Chest((int)tile.x, (int)tile.y));
return tiles;
}
private static String[][] fillInRegion(Level level, ArrayList<PVector> region, String[][] tiles) {
for(int i = 0; i < region.size(); i ++) {
PVector tile = region.get(i);
tiles[(int)tile.x][(int)tile.y] = level.tileset.wall();
}
return tiles;
}
private static void iterateGeneration(int[][] tiles, int[][] oldTiles, int w, int h, boolean firstPhase) {
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
oldTiles[i][j] = tiles[i][j];
}
}
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
int num = numNeighbours(oldTiles, i, j, 1); //neighbours in one step
int num2 = numNeighbours(oldTiles, i, j, 2); //neighbours in two steps
tiles[i][j] = FLOOR;
if (num >= 5 || (firstPhase && num2 <= 2)) {
tiles[i][j] = WALL;
}
if (i < edgeSize || i >= w - edgeSize || j < edgeSize || j >= h - edgeSize) { //edge tiles
tiles[i][j] = WALL;
}
}
}
}
private static int numNeighbours(int[][] tiles, int x, int y, int dist) {
//counts the number of walls in a square centred at x, y, spanning dist in each direction
int num = 0;
for (int i = -dist; i <= dist; i++) {
for (int j = -dist; j <= dist; j++) {
if (i == 0 && j == 0) continue; //skip if on the centre tile
try {
if (tiles[x + i][y + j] == WALL) num++; //if the tile is a wall
} catch (Exception ignored) {
}
}
}
return num;
}
private static int numNeighboursSimple(int[][] tiles, int x, int y) {
//counts the number of walls in a square centred at x, y, only looks in cardianl directions
int num = 0;
try {
if (tiles[x - 1][y] == WALL) num++;
} catch (Exception ignored) {
}
try {
if (tiles[x + 1][y] == WALL) num++;
} catch (Exception ignored) {
}
try {
if (tiles[x][y - 1] == WALL) num++;
} catch (Exception ignored) {
}
try {
if (tiles[x][y + 1] == WALL) num++;
} catch (Exception ignored) {
}
return num;
}
private static int numNeighboursSimple(Tile[][] tiles, int x, int y) {
//counts the number of walls in a square centred at x, y, only looks in cardianl directions
int num = 0;
try {
if (tiles[x - 1][y].solid) num++;
} catch (Exception ignored) {
}
try {
if (tiles[x + 1][y].solid) num++;
} catch (Exception ignored) {
}
try {
if (tiles[x][y - 1].solid) num++;
} catch (Exception ignored) {
}
try {
if (tiles[x][y + 1].solid) num++;
} catch (Exception ignored) {
}
return num;
}
//------DUNGEON GENERATION---------
public static void generateWindyDungeon(Level level, int w, int h, int roomAttempts, int minSize, int maxSize, float straightChance, float loopChance) {
int[][] tiles = new int[w][h];
int[][] region = new int[w][h];
int regionCount = 0;
ArrayList<int[]> rooms = placeRooms(w, h, roomAttempts, minSize, maxSize);
ArrayList<int[]> stack = new ArrayList<int[]>();
//add rooms to tile map
for (int r = 0; r < rooms.size(); r++) {
int[] room = rooms.get(r);
for (int i = room[0]; i < room[0] + room[2]; i++) {
for (int j = room[1]; j < room[1] + room[3]; j++) {
tiles[i][j] = FLOOR;
region[i][j] = regionCount;
}
}
regionCount++;
}
PVector start = null;
while(start == null) {
int x = (int)game.random(w);
int y = (int)game.random(h);
if(tiles[x][y] == FLOOR) {
start = new PVector(x, y);
}
}
//find maze seed points and run each maze to completion
for (int i = edgeSize; i < w - edgeSize; i++) {
for (int j = edgeSize; j < h - edgeSize; j++) {
if (numNeighbours(tiles, i, j, 1) == 8 && tiles[i][j] == WALL) { //seed point found
int x, y, dir = 0;
stack.add(0, new int[]{i, j});
while (stack.size() > 0) { //while there are still valid points
x = stack.get(0)[0]; //get the most recent one
y = stack.get(0)[1];
tiles[x][y] = FLOOR;
region[x][y] = regionCount;
ArrayList<int[]> valid = validNeighbours(tiles, x, y);
if (valid.size() == 0) {
stack.remove(0);
continue;
} else {
int n = 0, d = -1;
for (int v = 0; v < valid.size(); v++) {
if (dir == direction(new int[]{x, y}, new int[]{valid.get(v)[0], valid.get(v)[0]}) &&
game.random(1) < straightChance) {
d = dir;
n = v;
break;
}
}
if (d == -1) {
n = (int) game.random(valid.size());
d = direction(new int[]{x, y}, new int[]{valid.get(n)[0], valid.get(n)[0]});
}
stack.add(0, new int[]{valid.get(n)[0], valid.get(n)[1]});
dir = d;
}
}
regionCount++;
}
}
}
//get all connectors
ArrayList<int[]> connectors = getConnectors(tiles, region);
ArrayList<Integer> connected = new ArrayList<Integer>(); //all regions that have been connected
//connect all rooms to the maze
connected.add(0);
while (connected.size() < regionCount) {
int n = (int) game.random(connectors.size());
int[] connector = connectors.get(n);
int c = 0;
if (!connected.contains(connector[2]) && connected.contains(connector[3])) c = 2;
if (connected.contains(connector[2]) && !connected.contains(connector[3])) c = 3;
if (c == 2 || c == 3) {
connectors.remove(n);
connected.add(connector[c]);
tiles[connector[0]][connector[1]] = FLOOR;
}
}
//add game.random connections to make dungeon more interesting
for (int i = 0; i < connectors.size(); i++) {
if (game.random(1) < loopChance) {
tiles[connectors.get(i)[0]][connectors.get(i)[1]] = FLOOR;
}
}
//remove deadends
for (int i = edgeSize; i < w - edgeSize; i++) {
for (int j = edgeSize; j < h - edgeSize; j++) {
if (tiles[i][j] == WALL) continue;
int x = i;
int y = j;
int dir = getEndDirection(tiles, i, j);
while (dir != -1) { //deadend found
tiles[x][y] = WALL;
if (dir == 0) y -= 1;
if (dir == 2) y += 1;
if (dir == 3) x -= 1;
if (dir == 1) x += 1;
dir = getEndDirection(tiles, x, y);
}
}
}
String[][] newTiles = intsToTileStrings(tiles);
level.start = start;
newTiles[(int)start.x][(int)start.y] = level.tileset.spawn();
level.setTiles(finishingPass(newTiles, level.tileset));
}
private static ArrayList<int[]> placeRooms(int w, int h, int roomAttempts, int minSize, int maxSize) {
ArrayList<int[]> rooms = new ArrayList<int[]>(); //stores all rooms
//generate rooms
for (int i = 0; i < roomAttempts; i++) {
int x, y, xl, yl; //room position and dimensions
xl = game.floor(game.random(minSize, maxSize)); //room width
yl = game.floor(game.random(minSize, maxSize)); //room height
x = game.floor(game.random(edgeSize, w - xl - edgeSize)); //room x pos - avoid edges
y = game.floor(game.random(edgeSize, h - yl - edgeSize)); //toom y pos - avoid edges
int[] room = {x, y, xl, yl};
boolean hit = false;
for (int j = 0; j < rooms.size(); j++) {
if (roomOverlap(rooms.get(j), room)) {
hit = true;
break;
}
}
if (hit) continue;
rooms.add(room);
}
return rooms;
}
private static int getEndDirection(int[][] tiles, int i, int j) {
if (numNeighboursSimple(tiles, i, j) < 3 || tiles[i][j] == WALL) return -1; //not dead end
//returns the direction of the corridor from a dead end
if (tiles[i][j - 1] == FLOOR) return 0; //up
if (tiles[i][j + 1] == FLOOR) return 2; //down
if (tiles[i - 1][j] == FLOOR) return 3; //left
if (tiles[i + 1][j] == FLOOR) return 1; //right
return -1;
}
private static int direction(int[] t1, int[] t2) {
//returns the direction from t1 cell to t2
if (t1[1] < t2[1] && t1[0] == t2[0]) return 0; //up
if (t1[1] > t2[1] && t1[0] == t2[0]) return 2; //down
if (t1[1] == t2[1] && t1[0] < t2[0]) return 3; //left
if (t1[1] == t2[1] && t1[0] > t2[0]) return 1; //right
return -1;
}
private static boolean roomOverlap(int[] r1, int[] r2) {
//x, y, xl, yl
return (r1[0] + r1[2] >= r2[0] && // r1 right edge past r2 left
r1[0] <= r2[0] + r2[2] && // r1 left edge past r2 right
r1[1] + r1[3] >= r2[1] && // r1 top edge past r2 bottom
r1[1] <= r2[1] + r2[3]); // r1 bottom edge past r2 top
}
private static ArrayList<int[]> validNeighbours(int[][] tiles, int i, int j) {
ArrayList<int[]> neighbours = new ArrayList<int[]>();
if (validTile(tiles, i, j, 0, 1)) { //up dx = 0; dy = 1
neighbours.add(new int[]{i, j - 1});
}
if (validTile(tiles, i, j, 0, -1)) { //down dx = 0; dy = -1
neighbours.add(new int[]{i, j + 1});
}
if (validTile(tiles, i, j, 1, 0)) { //left dx = 1; dy = 0
neighbours.add(new int[]{i - 1, j});
}
if (validTile(tiles, i, j, -1, 0)) { //right dx = -1; dy = 0
neighbours.add(new int[]{i + 1, j});
}
return neighbours;
}
private static boolean validTile(int[][] tiles, int x, int y, int dx, int dy) {
x -= dx;
y -= dy;
if (isEdgeTile(tiles, x, y)) return false;
for (int i = -1; i <= 1; i++) {
for (int j = -1; j <= 1; j++) {
if (dx != 0 && dx == i) continue;
if (dy != 0 && dy == j) continue;
try {
if (tiles[x + i][y + j] >= FLOOR) return false; //if the tile is a floor
} catch (Exception ignored) {
return false;
}
}
}
return true;
}
private static ArrayList<int[]> getConnectors(int[][] tiles, int[][] region) {
ArrayList<int[]> connectors = new ArrayList<int[]>();
for (int i = edgeSize; i < tiles.length - edgeSize; i++) {
for (int j = edgeSize; j < tiles[0].length - edgeSize; j++) {
addConnector(connectors, tiles, region, i, j);
}
}
return connectors;
}
private static void addConnector(ArrayList<int[]> connectors, int[][] tiles, int[][] region, int i, int j) {
if (tiles[i][j] != WALL) return;
if (numNeighboursSimple(tiles, i, j) != 2) return;
int t = -1, b = -1, l = -1, r = -1;
int tr = -1, br = -1, lr = -1, rr = -1;
try {
t = tiles[i][j - 1];
tr = region[i][j - 1];
} catch (Exception ignored) {
}
try {
b = tiles[i][j + 1];
br = region[i][j + 1];
} catch (Exception ignored) {
}
try {
l = tiles[i - 1][j];
lr = region[i - 1][j];
} catch (Exception ignored) {
}
try {
r = tiles[i + 1][j];
rr = region[i + 1][j];
} catch (Exception ignored) {
}
if ((t >= FLOOR && b >= FLOOR) && tr != br) { // >= FLOOR is non-solid block
connectors.add(new int[]{i, j, tr, br});
} else if ((l >= FLOOR && r >= FLOOR) && lr != rr) {
connectors.add(new int[]{i, j, lr, rr});
}
}
private static boolean isEdgeTile(int[][] tiles, int i, int j) {
return (i < edgeSize || j < edgeSize || i >= tiles.length - edgeSize || j >= tiles[0].length - edgeSize);
}
public static boolean isBorder(int[][] tiles, int i, int j) {
boolean edge = (i < 1 || j < 1 || i >= tiles.length - 1 || j >= tiles[0].length - 1);
boolean border = false;
try {
border = ((numNeighbours(tiles, i, j, 1) < 8 && tiles[i][j] == WALL));
} catch (Exception ignored) {
}
return (!edge && border);
}
/***
Creates a dungeon and appends the tiles to the Level it's been given.
level - The level being generated for
maxRooms - Number of rooms the dungeon will have
spread - Angle variation of the rooms from existing rooms
minRadius - minimum distance between rooms
maxRadius - maximum distance between rooms
spawnRoom - Preset for the spawn room
bossRoom - Preset for the boss romm
rooms - Presets for all other rooms
***/
public static void generateConnectedDungeon(Level level, int maxRooms, float spread, int minRadius, int maxRadius, Room spawnRoom, Room bossRoom, Room[] rooms) {
/* ---Pseudo---
1. LOOP while num rooms != max
- get a game.random room from the graph
- create a new room within a radius of that room and connect it to the previously selected room
- determine depth of current room
2. Attach boss room to the deepest room in the dungeon
3. Get the bounds of the graph (min/max for x and y) to determine the size of the level
4. Go through list of rooms and copy their tiles into the tile map
5. While adding tiles, add regions to the region lists.
*/
ArrayList<PVector> bossRegions = new ArrayList<>();
ArrayList<PVector> generalRegions = new ArrayList<>();
ArrayList<Room> placedRooms = new ArrayList<>();
ArrayList<Corridor> corridors = new ArrayList<>();
ArrayList<Integer> depth = new ArrayList<>();
ArrayList<ArrayList<Integer>> graph = new ArrayList<>();
float dir = game.random(game.TAU); //game.random direction for the dungeon to branch in.
//add initial room
Room initial = new Room(spawnRoom);
initial.x = 0;
initial.y = 0;
placedRooms.add(initial);
depth.add(0);
graph.add(new ArrayList<>());
int minX = initial.x, minY = initial.y, maxX = initial.x + initial.w, maxY = initial.y + initial.h;
//Generate graph
while (placedRooms.size() < maxRooms) {
int startPos = (int) game.random(placedRooms.size()); //get a game.random room;
int sx = placedRooms.get(startPos).x;
int sy = placedRooms.get(startPos).y;
int newPos = placedRooms.size();
boolean hit = true;
Room room = new Room(rooms[(int) game.random(rooms.length)]);
//find a place to put the room
int tries = 0;
boolean success = true;
while (hit) {
hit = false;
float ang = game.random(dir - spread, dir + spread);
float r = game.random(minRadius, maxRadius) + game.max(game.max(placedRooms.get(startPos).w, placedRooms.get(startPos).h), game.max(room.w, room.h));
room.x = (int) (sx + game.cos(ang) * r);
room.y = (int) (sy + game.sin(ang) * r);
for (int i = 0; i < placedRooms.size(); i++) {
if (placedRooms.get(i).collides(room) || placedRooms.get(i).distance(room) < 3) {
hit = true;
break;
}
}
tries++;
if (tries >= 100) {
success = false;
break;
}
}
if (!success) continue;
if (room.x < minX) minX = room.x;
if (room.y < minY) minY = room.y;
if (room.x + room.w > maxX) maxX = room.x + room.w;
if (room.y + room.h > maxY) maxY = room.y + room.h;
int minDist = maxRadius; //find closest room
for (int i = 0; i < placedRooms.size(); i++) {
int dist = room.distanceSquare(placedRooms.get(i));
if (dist < minDist) {
minDist = dist;
startPos = i;
}
}
//add the new room to the graph;
placedRooms.add(new Room(room));
depth.add(depth.get(startPos) + 1);
graph.add(new ArrayList<Integer>());
//add the connections between rooms
graph.get(startPos).add(newPos);
//graph.get(newPos).add(startPos);
}
//find deepest room and attach the boss room to it
int deepest = -1;
int maxDepth = -1;
for (int i = 0; i < depth.size(); i++) {
if (depth.get(i) > maxDepth) {
deepest = i;
maxDepth = depth.get(i);
}
}
if (deepest != -1) {
int sx = placedRooms.get(deepest).x;
int sy = placedRooms.get(deepest).y;
int newPos = placedRooms.size();
boolean hit = true;
Room boss = new Room(bossRoom);
//find a place to put the room
int tries = 0;
while (hit) {
hit = false;
float ang = game.random(dir - spread, dir + spread);
float r = game.random(minRadius, maxRadius);
boss.x = (int) (sx + game.cos(ang) * r);
boss.y = (int) (sy + game.sin(ang) * r);
for (int i = 0; i < placedRooms.size(); i++) {
//Issue here
if (placedRooms.get(i).collides(boss)) {
hit = true;
if ((tries++) > 10) {
minRadius += 1;
maxRadius += 1;
}
break;
}
}
}
if (boss.x < minX) minX = boss.x;
if (boss.y < minY) minY = boss.y;
if (boss.x + boss.w > maxX) maxX = boss.x + boss.w;
if (boss.y + boss.h > maxY) maxY = boss.y + boss.h;
//add the new room to the graph;
placedRooms.add(new Room(boss));
depth.add(depth.get(deepest) + 1);
graph.add(new ArrayList<Integer>());
//add the connections between rooms
graph.get(deepest).add(newPos);
//graph.get(newPos).add(deepest);
}
//addLoops(graph);
for (int i = 0; i < placedRooms.size(); i++) {
for (int j = 0; j < graph.get(i).size(); j++) {
corridors.add(Corridor.generateCorridor(placedRooms, i, graph.get(i).get(j)));
if (corridors.get(corridors.size() - 1).minX < minX) minX = corridors.get(corridors.size() - 1).minX;
if (corridors.get(corridors.size() - 1).maxX > maxX) maxX = corridors.get(corridors.size() - 1).maxX;
if (corridors.get(corridors.size() - 1).minY < minY) minY = corridors.get(corridors.size() - 1).minY;
if (corridors.get(corridors.size() - 1).maxY > maxY) maxY = corridors.get(corridors.size() - 1).maxY;
}
}
minX -= 1;
minY -= 1;
maxX += 1;
maxY += 1;
//offset all rooms to make them fit into the tile grid
//MUST do this first so that all rooms are offset
for (int i = 0; i < placedRooms.size(); i++) {
placedRooms.get(i).x -= minX;
placedRooms.get(i).y -= minY;
}
for (int i = 0; i < corridors.size(); i++) {
corridors.get(i).offset(-minX, -minY);
}
saveLevel(minX, maxX, minY, maxY, placedRooms, corridors);
saveRoomGraph(minX, maxX, minY, maxY, placedRooms, graph);
int w = maxX - minX;
int h = maxY - minY;
String[][] tiles = new String[w][h];
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
tiles[i][j] = "WALL";
}
}
//place rooms into tile grid
for (int i = 0; i < placedRooms.size(); i++) {
Room room = placedRooms.get(i);
for (int x = 0; x < room.w; x++) {
for (int y = 0; y < room.h; y++) {
try {
String tile = room.tiles[x][y];
tiles[x + room.x][y + room.y] = tile;
if (i > 0 && i < placedRooms.size() - 1) {
//General room (not spawn or boss room)
generalRegions.add(new PVector(x + room.x, y + room.y));
} else if (i == placedRooms.size() - 1) {
//Boss room
bossRegions.add(new PVector(x + room.x, y + room.y));
}
} catch(Exception e) {
game.println(x, room.x, y, room.y);
}
}
}
}
//place corridors into tile grid
for (Corridor c : corridors) {
for (Vec2 pos : c.path) {
if (Tiles.get(tiles[(int) pos.x][(int) pos.y]).solid) {
tiles[(int) pos.x][(int) pos.y] = "FLOOR";
}
}
}
level.setTiles(finishingPass(tiles, level.tileset));
level.setStart(placedRooms.get(0).midPoint());
level.setZones(bossRegions, generalRegions);
}
private static void addLoops(ArrayList<ArrayList<Integer>> graph) {
ArrayList<Integer> deadEnds = new ArrayList<Integer>();
for(int i = 0; i < graph.size() - 1; i ++) { //skip the boss room
if(graph.get(i).size() == 0) deadEnds.add(i);
}
if(deadEnds.size() == 2) {
int a = deadEnds.get(0);
int b = deadEnds.get(1);
graph.get(a).add(b);
graph.get(a).add(b);
}
while(deadEnds.size()/3 >= 1 ) {
//add random connections between dead ends
int a = deadEnds.remove((int)game.random(deadEnds.size()));
int b = deadEnds.remove((int)game.random(deadEnds.size()));
graph.get(a).add(b);
graph.get(a).add(b);
}
}
public static String[][] intsToTileStrings(int[][]ints) {
String[][] tiles = new String[ints.length][ints[0].length];
for(int i = 0; i < tiles.length; i ++) {
for(int j = 0; j < tiles[0].length; j ++) {
if(ints[i][j] == WALL) {
tiles[i][j] = "WALL";
} else {
tiles[i][j] = "FLOOR";
}
}
}
return tiles;
}
public static Tile[][] finishingPass(String[][] tiles, TileSet tileset) {
int w = tiles.length;
int h = tiles[0].length;
Tile[][] newTiles = new Tile[w][h];
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
if (tiles[i][j].equals("WALL")) {
newTiles[i][j] = new Tile(tileset.wall());
} else if (tiles[i][j].equals("FLOOR")) {
if (tileset.extras.size() > 0 && game.random(1) < tileset.chance) {
newTiles[i][j] = new Tile(tileset.randomTile());
} else newTiles[i][j] = new Tile(tileset.floor());
} else {
newTiles[i][j] = new Tile(tiles[i][j]);
}
}
}
return bitMask(newTiles);
}
public static short getBitMaskValue(Tile[][] tiles, int i, int j) {
String groupID = tiles[i][j].groupID;
int val = 0;
for (int y = -1; y <= 1; y++) {
for (int x = -1; x <= 1; x++) {
if (x == 0 && y == 0) continue;
val = val << 1;
try {
if (tiles[i - x][j - y].groupID.equals(groupID)) val += 1;
} catch(Exception e) {}
}
}
return (short) val;
}
public static Tile[][] bitMask(Tile[][] tiles) {
for(int i = 0; i < tiles.length; i ++) {
for(int j = 0; j < tiles[0].length; j ++) {
tiles[i][j] = new Tile(tiles[i][j]);
tiles[i][j].bitmask(getBitMaskValue(tiles, i, j));
}
}
return tiles;
}
private static void saveRoomGraph(int minX, int maxX, int minY, int maxY, ArrayList<Room> placedRooms, ArrayList<ArrayList<Integer>> graph) {
PGraphics pg = game.createGraphics((maxX - minX) * 10, (maxY - minY) * 10);
pg.beginDraw();
pg.background(0);
pg.textAlign(game.CENTER, game.CENTER);
pg.textSize(20);
pg.stroke(255);
for (int i = 0; i < graph.size(); i++) {
pg.fill(255);
Room room = placedRooms.get(i);
pg.rect(room.x * 10, room.y * 10, room.w * 10, room.h * 10);
for (int j = 0; j < graph.get(i).size(); j++) {
Room room2 = placedRooms.get(graph.get(i).get(j));
pg.line(room.midPoint().x * 10, room.midPoint().y * 10, room2.midPoint().x * 10, room2.midPoint().y * 10);
}
pg.fill(0);
pg.text(i, room.midPoint().x * 10, room.midPoint().y * 10);
}
pg.endDraw();
pg.save("/out/level/LevelGraph.png");
}
private static void saveLevel(int minX, int maxX, int minY, int maxY, ArrayList<Room> placedRooms, ArrayList<Corridor> corridors) {
PGraphics pg = game.createGraphics((maxX - minX) * 10, (maxY - minY) * 10);
pg.beginDraw();
pg.background(0);
pg.textAlign(game.CENTER, game.CENTER);
pg.textSize(20);
pg.noStroke();
for (int i = 0; i < placedRooms.size(); i++) {
Room room = placedRooms.get(i);
pg.fill(255);
pg.rect(room.x * 10, room.y * 10, room.w * 10, room.h * 10);
pg.fill(0);
pg.text(i, room.midPoint().x * 10, room.midPoint().y * 10);
}
pg.fill(255);
for (int i = 0; i < corridors.size(); i++) {
for (Vec2 vec : corridors.get(i).path) {
pg.rect(vec.x * 10, vec.y * 10, 10, 10);
}
}
pg.endDraw();
pg.save("/out/level/LevelMap.png");
}
private static void saveLevel(int[][] tiles) {
saveLevel(tiles, "LevelPartial");
}
private static void saveLevel(int[][] tiles, String name) {
PGraphics pg = game.createGraphics(tiles.length, tiles[0].length);
pg.beginDraw();
pg.background(0);
pg.textAlign(game.CENTER, game.CENTER);
pg.textSize(20);
pg.stroke(255, 0, 0);
for (int i = 0; i < tiles.length; i++) {
for (int j = 0; j < tiles[0].length; j++) {
if (tiles[i][j] <= WALL) continue;
pg.fill(255);
pg.rect(i, j, 1, 1);
}
}
pg.endDraw();
pg.save("/out/level/" + name + ".png");
}
}
| [
"[email protected]"
] | |
6e429af9efd5270bb12af52f3a6e4adc501e8dcc | 9d78b741c72d432407caf02b92c643410bf18597 | /skybet-form-handler-core/src/test/java/net/jaggerl/person/model/PersonBuilderTest.java | 7d0c4a67bcf5c6351d5de925482d89d564fa35dc | [] | no_license | Leanne182x/form-handler | 670f3a8f0bb76e32220373e288e36e490da1eb15 | f0c088ab2a1c1b811b252f8922ebef5699bb3cca | refs/heads/master | 2021-01-01T04:20:09.425863 | 2016-05-22T19:47:02 | 2016-05-22T19:47:02 | 59,139,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,267 | java | package net.jaggerl.person.model;
import net.jaggerl.person.repository.PersonIdGenerator;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
public class PersonBuilderTest {
private PersonIdGenerator personIdGenerator;
private PersonBuilder personBuilder;
@Before
public void setUp() {
personIdGenerator = Mockito.mock(PersonIdGenerator.class);
personBuilder = new PersonBuilder(personIdGenerator);
}
@Test
public void testPersonIsCreatedWithCorrectValues() {
// Arrange
final int personId = 1;
final String firstName = "Leanne";
final String surname = "Jagger";
when(personIdGenerator.getNextSequence()).thenReturn(personId);
// Act
Person person = personBuilder.withFirstname(firstName).withSurname(surname).build();
// Assert
verify(personIdGenerator).getNextSequence();
assertThat(person.getId(), is(personId));
assertThat(person.getFirstname(), is(firstName));
assertThat(person.getSurname(), is(surname));
}
}
| [
"[email protected]"
] | |
28abfd2c0a630040cda123e32db79dab77477f42 | f2cf3d95e2775683b169c04a83be8f68811cafeb | /gulimall-product/src/main/java/com/atguigu/gulimall/product/dao/AttrGroupDao.java | bc9aea0b975b6a65f482a0db40a6dd9dfb454647 | [
"Apache-2.0"
] | permissive | sharonchen0427/gulimall | eab24535642ff8da2471e6439b336f8cc64addbc | fea6e90491c51d7b3edffec3ccfa3656578b18b6 | refs/heads/main | 2023-06-23T01:22:29.414695 | 2021-06-30T02:13:28 | 2021-06-30T02:13:28 | 317,004,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.atguigu.gulimall.product.dao;
import com.atguigu.gulimall.product.entity.AttrGroupEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ๅฑๆงๅ็ป
*
* @author chensh
* @email [email protected]
* @date 2020-12-31 13:13:42
*/
@Mapper
public interface AttrGroupDao extends BaseMapper<AttrGroupEntity> {
}
| [
"[email protected]"
] | |
38542d9664befd0c6c0cd17cc1d59e3bb54b8126 | 2b0694f0563192e2d148d130164e94faf3b4e12f | /Android็งปๅจๅผๅๆกไพ่ฏฆ่งฃ/ch04/contact/src/com/xmobileapp/contact/Contact.java | f8484d375270438c45516876051e69d76b57ce8d | [] | no_license | bxh7425014/BookCode | 4757956275cf540e9996b9064d981f6da75c9602 | 8996b36e689861d55662d15c5db8b0eb498c864b | refs/heads/master | 2020-05-23T00:48:51.430340 | 2017-02-06T01:04:25 | 2017-02-06T01:04:25 | 84,735,079 | 9 | 3 | null | null | null | null | GB18030 | Java | false | false | 6,568 | java | /*
* [็จๅบๅ็งฐ] Android ้่ฎฏๅฝ
* [ไฝ่
] xmobileappๅข้
* [ๅ่่ตๆ] Google Android Samples
* [ๅผๆบๅ่ฎฎ] Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
*
* 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.xmobileapp.contact;
import com.xmobileapp.contact.R;
import android.app.ListActivity;
import android.content.ContentUris;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
public class Contact extends ListActivity {
private static final String TAG = "Contacts";
private static final int AddContact_ID = Menu.FIRST;
private static final int EditContact_ID = Menu.FIRST+1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//ๅฏ็จๅฟซๆท้ฎๆฏๆ
setDefaultKeyMode(DEFAULT_KEYS_SHORTCUT);
//่ทๅ/่ฎพ็ฝฎIntent๏ผ็จไบไปContactsProviderไธญๆๅ้่ฎฏๅฝๅ
ๅฎน
Intent intent = getIntent();
if (intent.getData() == null) {
intent.setData(ContactsProvider.CONTENT_URI);
}
//ๅฏ็จ้ฟๆๆฏๆ๏ผๅผนๅบ็ไธไธๆ่ๅๅจ
getListView().setOnCreateContextMenuListener(this);
//ไฝฟ็จmanagedQuery่ทๅContactsProvider็Cursor
Cursor cursor = managedQuery(getIntent().getData(), ContactColumn.PROJECTION, null, null,null);
//ไฝฟ็จSimpleCursorAdapterๅปบ็ซCursor็Adapterไปฅไพฟไฝฟ็จ๏ผๆฐๆฎ่กจ็คบๅฝขๅผไธบ๏ผๅงๅ - ๆๆบๅท็
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.contact_list_item, cursor,
new String[] { ContactColumn.NAME,ContactColumn.MOBILE }, new int[] { R.id.name, R.id.contactinfo });
//ไธบๅฝๅListViewๅ
ณ่Adapter
setListAdapter(adapter);
Log.e(TAG+"onCreate"," is ok");
}
//็ฎๅฝๅปบ็ซ็ๅ่ฐๅฝๆฐ
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
// ๅจ็ฎๅฝไธญๅขๅ โๆทปๅ โๆ้ฎๅนถไธบไน่ฎพๅฎๅฟซๆท้ฎๅๅพๆ
menu.add(0, AddContact_ID, 0, R.string.menu_add)
.setShortcut('3', 'a')
.setIcon(android.R.drawable.ic_menu_add);
return true;
}
//็ฎๅฝๆพ็คบไนๅ็ๅ่ฐๅฝๆฐ
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
final boolean haveItems = getListAdapter().getCount() > 0;
//ๅฆๆๅฝๅๅ่กจไธไธบ็ฉบ
if (haveItems) {
Uri uri = ContentUris.withAppendedId(getIntent().getData(), getSelectedItemId());
Intent[] specifics = new Intent[1];
specifics[0] = new Intent(Intent.ACTION_EDIT, uri);
MenuItem[] items = new MenuItem[1];
Intent intent = new Intent(null, uri);
intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
menu.addIntentOptions(Menu.CATEGORY_ALTERNATIVE, 0, 0,
null, specifics, intent, 0,items);
//ๅฆๆๆCATEGORY_ALTERNATIVE็ฑปๅ็่ๅ้กน,ๅณ็ผ่พ้้กน๏ผ่ขซๅ ๅ
ฅ๏ผๅไธบไนๆทปๅ ๅฟซๆท้ฎ
if (items[0] != null) {
items[0].setShortcut('1', 'e');
}
} else {
menu.removeGroup(Menu.CATEGORY_ALTERNATIVE);
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case AddContact_ID:
//ๆทปๅ ๆก็ฎ
startActivity(new Intent(Intent.ACTION_INSERT, getIntent().getData()));
return true;
}
return super.onOptionsItemSelected(item);
}
//ไธไธๆ่ๅ๏ผๆฌไพไผ้่ฟ้ฟๆๆก็ฎๆฟๆดปไธไธๆ่ๅ
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
AdapterView.AdapterContextMenuInfo info;
try {
info = (AdapterView.AdapterContextMenuInfo) menuInfo;
} catch (ClassCastException e) {
return;
}
Cursor cursor = (Cursor) getListAdapter().getItem(info.position);
if (cursor == null) {
return;
}
menu.setHeaderTitle(cursor.getString(1));
menu.add(0, EditContact_ID, 0, R.string.menu_delete);
}
//ไธไธๆ่ๅ้ๆฉ็ๅ่ฐๅฝๆฐ
@Override
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo info;
try {
info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
} catch (ClassCastException e) {
return false;
}
switch (item.getItemId()) {
//้ๆฉ็ผ่พๆก็ฎ
case EditContact_ID: {
Uri noteUri = ContentUris.withAppendedId(getIntent().getData(), info.id);
getContentResolver().delete(noteUri, null, null);
return true;
}
}
return false;
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
Uri uri = ContentUris.withAppendedId(getIntent().getData(), id);
String action = getIntent().getAction();
if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_GET_CONTENT.equals(action)) {
// ๅฆๆ้่ฎฏๅฝๅ่กจ็Activityๆฏ่ขซๅ
ถไปActivity่ฐ็จไปฅ่ฟๅ้ๆฉ็้่ฎฏไฟกๆฏ
// ๆฏๅฆ๏ผ็ญไฟก็จๅบ้่ฟๆฌไพๆฅ่ทๅๆไบบ็็ต่ฏๅท็
setResult(RESULT_OK, new Intent().setData(uri));
} else {
//็ผ่พ ่็ณปไบบ
startActivity(new Intent(Intent.ACTION_EDIT, uri));
}
}
} | [
"[email protected]"
] | |
0bac0f53ef9f6227747124525bfcfa3fc5e0c223 | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Hibernate/Hibernate1659.java | ba3f262d6048c7959a50b1ac8adb0547685c3e38 | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | protected void appendPropertyCondition(
String propertyName,
Object propertyValue,
Criteria criteria,
CriteriaQuery cq,
StringBuilder buf) {
final Criterion condition;
if ( propertyValue != null ) {
final boolean isString = propertyValue instanceof String;
if ( isLikeEnabled && isString ) {
condition = new LikeExpression(
propertyName,
(String) propertyValue,
matchMode,
escapeCharacter,
isIgnoreCaseEnabled
);
}
else {
condition = new SimpleExpression( propertyName, propertyValue, "=", isIgnoreCaseEnabled && isString );
}
}
else {
condition = new NullExpression(propertyName);
}
final String conditionFragment = condition.toSqlString( criteria, cq );
if ( conditionFragment.trim().length() > 0 ) {
if ( buf.length() > 1 ) {
buf.append( " and " );
}
buf.append( conditionFragment );
}
}
| [
"[email protected]"
] | |
970ecb3504e5d149c976effe7132abe975403109 | 512913155f4c48c8afc31df2ec1f54dddf522f2d | /junit-gen/src/com/generator/core/util/Util.java | 045fc0c3abe63ac8c5d85149e7f038abd8cb2291 | [] | no_license | samueldeschamps/tcc-pges-samuel | fb0be47c2b571705e6b2ae081f3b211d3c41d23a | 7faefba3a05a404064221f83b3f8cd016065393b | refs/heads/master | 2020-06-04T01:03:25.094951 | 2014-11-17T22:29:38 | 2014-11-17T22:29:38 | 40,632,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,666 | java | package com.generator.core.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class Util {
private static final String[] UVOWELS = new String[] { "A", "E", "I", "O", "U" };
private static final String[] LVOWELS = new String[] { "a", "e", "i", "o", "u" };
public static boolean startsWithVowel(String str) {
for (String vowel : UVOWELS) {
if (str.startsWith(vowel)) {
return true;
}
}
for (String vowel : LVOWELS) {
if (str.startsWith(vowel)) {
return true;
}
}
return false;
}
public static int intPow(int base, int exp) {
if (exp < 0) {
throw new IllegalArgumentException("Negative exponents not supported!");
}
int res = 1;
while (exp-- > 0) {
res *= base;
}
return res;
}
public static InputStream getClassBytecodeAsStream(Class<?> clazz) {
final String resource = '/' + clazz.getName().replace('.', '/') + ".class";
return clazz.getResourceAsStream(resource);
}
public static InputStream getClassSourceAsStream(Class<?> clazz) {
File sourceFile = getSourceFile(clazz);
try {
return new FileInputStream(sourceFile);
} catch (FileNotFoundException e) {
return null;
}
}
public static File getSourceFile(Class<?> clazz) {
String srcDir = getSourceDirLocation(clazz);
if (!srcDir.endsWith("/")) {
srcDir += "/";
}
String javaFilePath = clazz.getName().replace('.', '/') + ".java";
return new File(srcDir + javaFilePath);
}
public static String getBytecodeFilePath(Class<?> clazz) {
final String resource = '/' + clazz.getName().replace('.', '/') + ".class";
final String path = clazz.getResource(resource).getPath();
return path;
}
public static String getSourceDirLocation(Class<?> clazz) {
return getSourceDirLocation(clazz, "src");
}
public static String getSourceDirLocation(Class<?> clazz, String srcDirSimpleName) {
final String resource = '/' + clazz.getName().replace('.', '/') + ".class";
final String path = clazz.getResource(resource).getPath();
final String projectPath = path.substring(0, path.length() - resource.length() - "bin".length());
return projectPath + srcDirSimpleName;
}
@SuppressWarnings("unchecked")
public static <T> T[] arrayConcat(Class<T> elementType, T[]... arrays) {
int totalLen = 0;
for (T[] array : arrays) {
totalLen += array.length;
}
T[] result = (T[]) Array.newInstance(elementType, totalLen);
int pos = 0;
for (T[] array : arrays) {
System.arraycopy(array, 0, result, pos, array.length);
pos += array.length;
}
return result;
}
public static String capitalize(String str) {
if (str == null || str.isEmpty()) {
return str;
}
if (Character.isUpperCase(str.charAt(0))) {
return str;
}
return Character.toUpperCase(str.charAt(0)) + str.substring(1);
}
private static final Map<Class<?>, Class<?>> WRAPPERS = new HashMap<Class<?>, Class<?>>();
static {
WRAPPERS.put(boolean.class, Boolean.class);
WRAPPERS.put(byte.class, Byte.class);
WRAPPERS.put(char.class, Character.class);
WRAPPERS.put(double.class, Double.class);
WRAPPERS.put(float.class, Float.class);
WRAPPERS.put(int.class, Integer.class);
WRAPPERS.put(long.class, Long.class);
WRAPPERS.put(short.class, Short.class);
WRAPPERS.put(void.class, Void.class);
}
@SuppressWarnings("unchecked")
public static <T> Class<T> primitiveToWrapper(Class<T> c) {
return (Class<T>) WRAPPERS.get(c);
}
public static double round(double x, int scale) {
return round(x, scale, BigDecimal.ROUND_HALF_EVEN);
}
public static double round(double x, int scale, int roundingMethod) {
try {
return (new BigDecimal(Double.toString(x)).setScale(scale, roundingMethod)).doubleValue();
} catch (NumberFormatException ex) {
if (Double.isInfinite(x)) {
return x;
} else {
return Double.NaN;
}
}
}
public static String getSignatureDesc(Method m) {
StringBuilder res = new StringBuilder();
res.append("(");
for (Class<?> param : m.getParameterTypes()) {
res.append(getTypeDesc(param));
}
res.append(")");
res.append(getTypeDesc(m.getReturnType()));
return res.toString();
}
public static String getTypeDesc(Class<?> type) {
if (type == boolean.class) {
return "Z";
}
if (type == byte.class) {
return "B";
}
if (type == short.class) {
return "S";
}
if (type == char.class) {
return "C";
}
if (type == int.class) {
return "I";
}
if (type == long.class) {
return "J";
}
if (type == float.class) {
return "F";
}
if (type == Double.TYPE) {
return "D";
}
if (type.isArray()) {
return "[" + getTypeDesc(type.getComponentType());
}
if (type == Void.TYPE) {
return "V";
}
return "L" + type.getName().replace(".", "/") + ";";
}
public static <K, V> void putListItem(Map<K, List<V>> map, K key, V value) {
List<V> list = map.get(key);
if (list == null) {
list = new ArrayList<>();
map.put(key, list);
}
list.add(value);
}
public static <K, V> void putSetItem(Map<K, Set<V>> map, K key, V value) {
Set<V> set = map.get(key);
if (set == null) {
set = new LinkedHashSet<>();
map.put(key, set);
}
set.add(value);
}
}
| [
"[email protected]"
] | |
52de7b58de74bff35f5ab17b4d7a5e4307603ae7 | a8e9d2b6fa7fe2f98efccbf2335db7e725519836 | /src/Basico/Pecas2.java | 27b65adb1ff9a02ea2c79fc674deffd0adfc4138 | [] | no_license | taboadavictor/Lista-Exercicios-1 | 8ee928c4521de49c1bfd21a0f60fbd88a4ab7856 | ce05bedd326421c74b21ca7af81e884e77e0a98f | refs/heads/master | 2023-03-26T23:07:30.911975 | 2021-03-23T14:23:22 | 2021-03-23T14:23:22 | 350,740,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 102 | java | package Basico;
public class Pecas2 {
public int quant;
public double valor;
public int cod;
} | [
"[email protected]"
] | |
902ff59efeff0071594fbb1e7d6091bb3e26fd7a | df512cfc500142d5f2a9792d15814faf842304b9 | /JMEPlay/JMEPlayAssets/src/main/java/com/jmeplay/plugin/assets/Resources.java | 7561e592966957c1425a87a7b5346774dc62f649 | [
"BSD-3-Clause"
] | permissive | vp-byte/JMEPlayProjectOLD | 33f2e6415ad197f5face97edb72088752ca05d6e | 23e6e23634d344b592d3ae87ab874d37add620a0 | refs/heads/master | 2021-06-23T17:35:24.718775 | 2017-08-30T22:28:25 | 2017-08-30T22:28:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.jmeplay.plugin.assets;
public class Resources {
public final static String iconsAssets = "/com/jmeplay/plugin/assets/";
public final static String iconsHandler = "/com/jmeplay/plugin/handler/";
}
| [
"[email protected]"
] | |
ca73c70e083fd6be38e9310e44b52db6e8acb426 | 2f870b51e1daa98b15eeb437cc014e5974b17d2c | /app/src/main/java/com/pllug/course/ivankiv/recruitmenthelper/data/model/RecruiterNotes.java | e689f7daf572fc9505acdb6a87f03b0285759317 | [] | no_license | Dimonkiv/Recruitmenthelper | c60cc855cca65608e13b141fcf06b8bd1803d921 | 578ff43bfeeeea46e3321825d3819bd7e9d0558f | refs/heads/master | 2020-03-08T08:37:46.658511 | 2018-06-11T13:44:14 | 2018-06-11T13:44:14 | 128,024,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,035 | java | package com.pllug.course.ivankiv.recruitmenthelper.data.model;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
@Entity
public class RecruiterNotes {
@PrimaryKey(autoGenerate = true)
private long id;
private String typeOfEmployment;
private String profession;
private String experience;
private String jobOrUniversity;
private String jobInterests;
private String advantages;
private String disadvantages;
private String notes;
public String getTypeOfEmployment() {
return typeOfEmployment;
}
public void setTypeOfEmployment(String typeOfEmployment) {
this.typeOfEmployment = typeOfEmployment;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
}
public String getJobOrUniversity() {
return jobOrUniversity;
}
public void setJobOrUniversity(String jobOrUniversity) {
this.jobOrUniversity = jobOrUniversity;
}
public String getJobInterests() {
return jobInterests;
}
public void setJobInterests(String jobInterests) {
this.jobInterests = jobInterests;
}
public String getExperience() {
return experience;
}
public void setExperience(String experience) {
this.experience = experience;
}
public String getAdvantages() {
return advantages;
}
public void setAdvantages(String advantages) {
this.advantages = advantages;
}
public String getDisadvantages() {
return disadvantages;
}
public void setDisadvantages(String disadvantages) {
this.disadvantages = disadvantages;
}
public String getNotes() {
return notes;
}
public void setNotes(String notes) {
this.notes = notes;
}
}
| [
"[email protected]"
] | |
7139404d80afb59d8db17482de87f92a77b54b4a | a610fcb9c883118f88817f2ab961e934eaa3fef6 | /src/main/java/com/klinziuk/screenshot/Main.java | eeba3d3941a1d940fdbf8424fe5576049732a9e9 | [] | no_license | therealphoenix/ScreenAndMail | f5edb1b77f9fc794beb12977bf4f3d4011d0cedd | 29069731f098ec8a47ff8d13e1ff074b1478a498 | refs/heads/master | 2021-01-25T06:35:59.390901 | 2017-06-07T04:46:11 | 2017-06-07T04:46:11 | 93,591,984 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.klinziuk.screenshot;
import org.openqa.selenium.WebDriver;
public class Main {
public static void main(String[] args) {
WebDriver driver = BrowserDriver.CHROME.selectDriver();
driver.manage().window().maximize();
driver.get(BrowserDriver.BASEURL);
new ScreenShotMaker(driver).makeScreenShot();
driver.close();
driver.quit();
BrowserDriver.CHROME.killDriver();
new Mail().sendMessage();
}
}
| [
"[email protected]"
] | |
5887df37da0a95313e41ca86555cf4c8ed5f7259 | 5fdd2d0ad9b1960ab8c4eb0efb679e02982b5b9a | /ebatis-core/src/main/java/com/ymm/ebatis/core/domain/Script.java | 153f58ce47fdf9e86b590712d0cff21614c4832f | [
"MIT"
] | permissive | sdgdsffdsfff/ebatis | c64355b075bcc5cbc8901027415f335e72d3de4a | 94ad23141f02aca11d0a6f6471d51ab351a754d9 | refs/heads/master | 2022-12-28T08:32:55.231403 | 2020-07-23T06:41:17 | 2020-07-23T06:41:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,044 | java | package com.ymm.ebatis.core.domain;
import java.util.Collections;
import java.util.Map;
/**
* ่ๆฌ
*
* @author duoliang.zhang
*/
public interface Script {
/**
* ๅๅปบๆๅๅ
่่ๆฌ
*
* @param content ่ๆฌๅ
ๅฎน
* @param params ๅๆฐ
* @return ่ๆฌ
*/
static Script inline(String content, Object params) {
return new InlineScript(content, params);
}
/**
* ๅๅปบๆ ๆจๅ
่่ๆฌ
*
* @param content ่ๆฌๅ
ๅฎน
* @return ่ๆฌ
*/
static Script inline(String content) {
return new InlineScript(content, Collections.emptyMap());
}
/**
* ๅๅปบๅญๅจ่ๆฌ
*
* @param id ่ๆฌId
* @param params ๅๆฐ
* @return ่ๆฌ
*/
static Script stored(String id, Object params) {
return new StoredScript(id, params);
}
/**
* ๅๅปบๆ ๅ่ๆฌ
*
* @param id ่ๆฌId
* @return ่ๆฌ
*/
static Script stored(String id) {
return new StoredScript(id, Collections.emptyMap());
}
/**
* ่ทๅๅฏ้ๅๆฐ
*
* @return ๅฏ้ๅๆฐ
*/
Map<String, String> getOptions();
/**
* ่ฎพ็ฝฎๅฏ้ๅๆฐ
*
* @param options ๅฏ้ๅๆฐ
*/
void setOptions(Map<String, String> options);
/**
* ่ฟไธชๅๆฐๆฏไธชVoๅฏน่ฑก๏ผไผ่ชๅจ่ฝฌๆ๏ผไฝไธบEs็่ๆฌๅ
ฅๅ
*
* @param params ๅๆฐ
*/
void setParams(Object params);
/**
* ่ฎพ็ฝฎMapๅๆฐ
*
* @param params ๅๆฐ
*/
void setParams(Map<String, Object> params);
/**
* ่ทๅ่ๆฌ้ข็ ๏ผ้ป่ฎคๆฏ<code>painless</code>
*
* @return ่ๆฌ่ฏญ่จ
*/
default String getLang() {
return "painless";
}
/**
* ่ฎพ็ฝฎ่ๆฌ่ฏญ่จ
*
* @param lang ่ๆฌ่ฏญ่จ
*/
void setLang(String lang);
/**
* ่ฝฌๆขๆEs็่ๆฌๅฏน่ฑก
*
* @return Es่ๆฌ
*/
org.elasticsearch.script.Script toEsScript();
}
| [
"[email protected]"
] | |
79851f275718d6af9d94548518a7d4251c0dcc5d | a1dcd33e31236352bfdb8742e65bdbd154d44219 | /src/main/java/chav1961/purelib/enumerations/package-info.java | 51f3064c60955f40b01e7c8a9bcfa454561d9a00 | [
"MIT"
] | permissive | chav1961/purelib | 6fae31358794aaf9d814c0f73f53965c280453c4 | 8a488d5f86f1b8b96d2049499ba0c62a6201ae8a | refs/heads/master | 2023-08-15T06:33:44.676553 | 2023-08-10T11:26:44 | 2023-08-10T11:26:44 | 68,230,362 | 2 | 0 | MIT | 2020-10-12T18:28:38 | 2016-09-14T18:01:31 | Java | UTF-8 | Java | false | false | 215 | java | /**
*<p>This package contains all popular enumerations used in the Pure Library</p>
*
* @author Alexander Chernomyrdin aka chav1961
* @since 0.0.1 last updated 0.0.2
*/
package chav1961.purelib.enumerations; | [
"[email protected]"
] | |
58252c1498fbb2a9e1ccc41d032fea6a7f39f5f6 | 9e6a36ec7525280a09d4bb348947eb263f1bd9da | /src/main/java/com/revature/servlet/ApproveServlet.java | 0ca21d25779d051c97cb38a8bb9c76a26c9afc11 | [] | no_license | bzh4bzh/Project_1 | 2cb6256e642c8b041d5f84a165f9ffb7c01bff89 | 09d3b56a59bc07ad89291df8ed82002f8ec0abdd | refs/heads/master | 2021-03-13T07:21:18.648635 | 2020-03-11T18:42:15 | 2020-03-11T18:42:15 | 246,652,681 | 0 | 0 | null | 2020-03-11T18:41:10 | 2020-03-11T18:41:09 | null | UTF-8 | Java | false | false | 2,073 | java | package com.revature.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.revature.daoimpl.EmployeeDaoImpl;
import com.revature.daoimpl.RequestsDaoImipl;
/**
* Servlet implementation class ApproveServlet
*/
public class ApproveServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
System.out.println("In doPost of ApproveServlet");
if (request.getSession(false) == null) {
response.sendRedirect("login.html");
}
EmployeeDaoImpl edi = new EmployeeDaoImpl();
RequestsDaoImipl rdi = new RequestsDaoImipl();
int id = edi.getUserID((String) request.getSession().getAttribute("name"));
int recid = Integer.parseInt(request.getParameter("requestId"));
int auth = edi.checkAthority(id);
if (rdi.getApplicationStatus(recid) == 4) {
rdi.updateStatus(5, recid);
int userid = rdi.getUserId(recid);
edi.updateRemainingBalance(userid, edi.getRemainingBalance(userid) - rdi.getRem(recid));
if (auth == 3 || auth == 1) {
rdi.updateStatus(edi.checkAthority(id), recid);
response.sendRedirect("supHomeSubmit.html");
} else if (auth == 2){
rdi.updateStatus(edi.checkAthority(id), recid);
response.sendRedirect("DeptHomeSubmit.html");
}else {
rdi.updateStatus(edi.checkAthority(id), recid);
response.sendRedirect("homeSubmit.html");
}
// RequestDispatcher rd = request.getRequestDispatcher("home.html");
// rd.forward(request, response);
} else {
if (auth == 3 || auth == 1) {
rdi.updateStatus(edi.checkAthority(id), recid);
response.sendRedirect("supHomeSubmit.html");
} else if (auth == 2){
rdi.updateStatus(2, recid);
response.sendRedirect("DeptHomeSubmit.html");
}else {
rdi.updateStatus(0, recid);
response.sendRedirect("homeSubmit.html");
}
}
}
}
| [
"[email protected]"
] | |
606a846f62a73b303e06d6f4a64f101b5e52960a | 6f7a0993ab09f080e11702d1e089e27282d986bf | /app/src/main/java/com/zhenghui/zhqb/zhenghuiqianbaomember/model/ShopDetailsModel.java | 3bd725e66b025afaacce35b965b6185a7ca15497 | [] | no_license | ibisTime/xn-zhpay-candroid | 350744004f93d4258e440044208ff8faef315fd6 | 6f6ad9b25dda89bbb3786a80beb5c72e13929520 | refs/heads/master | 2020-05-26T23:38:20.081628 | 2017-11-01T02:10:11 | 2017-11-01T02:11:40 | 82,509,573 | 0 | 0 | null | 2017-06-07T05:52:46 | 2017-02-20T02:47:08 | Java | UTF-8 | Java | false | false | 8,024 | java | package com.zhenghui.zhqb.zhenghuiqianbaomember.model;
import java.util.List;
public class ShopDetailsModel {
private String code;
private String name;
private String type;
private String legalPersonName;
private String userReferee;
private double rate1;
private double rate2;
private String slogan;
private String advPic;
private String pic;
private String description;
private String province;
private String city;
private String area;
private String address;
private String longitude;
private String latitude;
private String bookMobile;
private String status;
private String updateDatetime;
private String owner;
private String payCurrency;
private int totalJfNum;
private int totalDzNum;
private String systemCode;
private List<StoreTicketsBean> storeTickets;
public String getPayCurrency() {
return payCurrency;
}
public void setPayCurrency(String payCurrency) {
this.payCurrency = payCurrency;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getLegalPersonName() {
return legalPersonName;
}
public void setLegalPersonName(String legalPersonName) {
this.legalPersonName = legalPersonName;
}
public String getUserReferee() {
return userReferee;
}
public void setUserReferee(String userReferee) {
this.userReferee = userReferee;
}
public double getRate1() {
return rate1;
}
public void setRate1(double rate1) {
this.rate1 = rate1;
}
public double getRate2() {
return rate2;
}
public void setRate2(double rate2) {
this.rate2 = rate2;
}
public String getSlogan() {
return slogan;
}
public void setSlogan(String slogan) {
this.slogan = slogan;
}
public String getAdvPic() {
return advPic;
}
public void setAdvPic(String adPic) {
this.advPic = adPic;
}
public String getPic() {
return pic;
}
public void setPic(String pic) {
this.pic = pic;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getBookMobile() {
return bookMobile;
}
public void setBookMobile(String bookMobile) {
this.bookMobile = bookMobile;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getUpdateDatetime() {
return updateDatetime;
}
public void setUpdateDatetime(String updateDatetime) {
this.updateDatetime = updateDatetime;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public int getTotalJfNum() {
return totalJfNum;
}
public void setTotalJfNum(int totalJfNum) {
this.totalJfNum = totalJfNum;
}
public int getTotalDzNum() {
return totalDzNum;
}
public void setTotalDzNum(int totalDzNum) {
this.totalDzNum = totalDzNum;
}
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
public List<StoreTicketsBean> getStoreTickets() {
return storeTickets;
}
public void setStoreTickets(List<StoreTicketsBean> storeTickets) {
this.storeTickets = storeTickets;
}
public static class StoreTicketsBean {
private String code;
private String name;
private String type;
private double key1;
private double key2;
private String description;
private int price;
private String currency;
private String validateStart;
private String validateEnd;
private String createDatetime;
private String status;
private String storeCode;
private String systemCode;
private String isExist;
public String getIsExist() {
return isExist;
}
public void setIsExist(String isExist) {
this.isExist = isExist;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public double getKey1() {
return key1;
}
public void setKey1(double key1) {
this.key1 = key1;
}
public double getKey2() {
return key2;
}
public void setKey2(double key2) {
this.key2 = key2;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getValidateStart() {
return validateStart;
}
public void setValidateStart(String validateStart) {
this.validateStart = validateStart;
}
public String getValidateEnd() {
return validateEnd;
}
public void setValidateEnd(String validateEnd) {
this.validateEnd = validateEnd;
}
public String getCreateDatetime() {
return createDatetime;
}
public void setCreateDatetime(String createDatetime) {
this.createDatetime = createDatetime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getStoreCode() {
return storeCode;
}
public void setStoreCode(String storeCode) {
this.storeCode = storeCode;
}
public String getSystemCode() {
return systemCode;
}
public void setSystemCode(String systemCode) {
this.systemCode = systemCode;
}
}
}
| [
"[email protected]"
] | |
438635b1f11790afc81a07d9dc729aeedb046a4d | 179c4177a0e44e59a95db6c25a948ed7f43d1c20 | /src/test/java/com/avaya/journey/repository/CustomAuditEventRepositoryIntTest.java | c44db3670fe16d655d97cff6fcbc6664ca13c527 | [] | no_license | ShivDerv/CustomerJourneyService | 78c9fa88c7c0fe661fa85f2e3ca54b0e8280c810 | f743caf073d2c66da64dc56e94b80b330013a44d | refs/heads/master | 2021-04-15T12:17:20.697455 | 2018-03-21T19:06:03 | 2018-03-21T19:06:03 | 126,227,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,603 | java | package com.avaya.journey.repository;
import com.avaya.journey.CustomerJourneyServiceApp;
import com.avaya.journey.config.Constants;
import com.avaya.journey.config.audit.AuditEventConverter;
import com.avaya.journey.domain.PersistentAuditEvent;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.audit.AuditEvent;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpSession;
import java.time.Instant;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static com.avaya.journey.repository.CustomAuditEventRepository.EVENT_DATA_COLUMN_MAX_LENGTH;
/**
* Test class for the CustomAuditEventRepository class.
*
* @see CustomAuditEventRepository
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = CustomerJourneyServiceApp.class)
@Transactional
public class CustomAuditEventRepositoryIntTest {
@Autowired
private PersistenceAuditEventRepository persistenceAuditEventRepository;
@Autowired
private AuditEventConverter auditEventConverter;
private CustomAuditEventRepository customAuditEventRepository;
private PersistentAuditEvent testUserEvent;
private PersistentAuditEvent testOtherUserEvent;
private PersistentAuditEvent testOldUserEvent;
@Before
public void setup() {
customAuditEventRepository = new CustomAuditEventRepository(persistenceAuditEventRepository, auditEventConverter);
persistenceAuditEventRepository.deleteAll();
Instant oneHourAgo = Instant.now().minusSeconds(3600);
testUserEvent = new PersistentAuditEvent();
testUserEvent.setPrincipal("test-user");
testUserEvent.setAuditEventType("test-type");
testUserEvent.setAuditEventDate(oneHourAgo);
Map<String, String> data = new HashMap<>();
data.put("test-key", "test-value");
testUserEvent.setData(data);
testOldUserEvent = new PersistentAuditEvent();
testOldUserEvent.setPrincipal("test-user");
testOldUserEvent.setAuditEventType("test-type");
testOldUserEvent.setAuditEventDate(oneHourAgo.minusSeconds(10000));
testOtherUserEvent = new PersistentAuditEvent();
testOtherUserEvent.setPrincipal("other-test-user");
testOtherUserEvent.setAuditEventType("test-type");
testOtherUserEvent.setAuditEventDate(oneHourAgo);
}
@Test
public void testFindAfter() {
persistenceAuditEventRepository.save(testUserEvent);
persistenceAuditEventRepository.save(testOldUserEvent);
List<AuditEvent> events =
customAuditEventRepository.find(Date.from(testUserEvent.getAuditEventDate().minusSeconds(3600)));
assertThat(events).hasSize(1);
AuditEvent event = events.get(0);
assertThat(event.getPrincipal()).isEqualTo(testUserEvent.getPrincipal());
assertThat(event.getType()).isEqualTo(testUserEvent.getAuditEventType());
assertThat(event.getData()).containsKey("test-key");
assertThat(event.getData().get("test-key").toString()).isEqualTo("test-value");
assertThat(event.getTimestamp()).isEqualTo(Date.from(testUserEvent.getAuditEventDate()));
}
@Test
public void testFindByPrincipal() {
persistenceAuditEventRepository.save(testUserEvent);
persistenceAuditEventRepository.save(testOldUserEvent);
persistenceAuditEventRepository.save(testOtherUserEvent);
List<AuditEvent> events = customAuditEventRepository
.find("test-user", Date.from(testUserEvent.getAuditEventDate().minusSeconds(3600)));
assertThat(events).hasSize(1);
AuditEvent event = events.get(0);
assertThat(event.getPrincipal()).isEqualTo(testUserEvent.getPrincipal());
assertThat(event.getType()).isEqualTo(testUserEvent.getAuditEventType());
assertThat(event.getData()).containsKey("test-key");
assertThat(event.getData().get("test-key").toString()).isEqualTo("test-value");
assertThat(event.getTimestamp()).isEqualTo(Date.from(testUserEvent.getAuditEventDate()));
}
@Test
public void testFindByPrincipalNotNullAndAfterIsNull() {
persistenceAuditEventRepository.save(testUserEvent);
persistenceAuditEventRepository.save(testOtherUserEvent);
List<AuditEvent> events = customAuditEventRepository.find("test-user", null);
assertThat(events).hasSize(1);
assertThat(events.get(0).getPrincipal()).isEqualTo("test-user");
}
@Test
public void testFindByPrincipalIsNullAndAfterIsNull() {
persistenceAuditEventRepository.save(testUserEvent);
persistenceAuditEventRepository.save(testOtherUserEvent);
List<AuditEvent> events = customAuditEventRepository.find(null, null);
assertThat(events).hasSize(2);
assertThat(events).extracting("principal")
.containsExactlyInAnyOrder("test-user", "other-test-user");
}
@Test
public void findByPrincipalAndType() {
persistenceAuditEventRepository.save(testUserEvent);
persistenceAuditEventRepository.save(testOldUserEvent);
testOtherUserEvent.setAuditEventType(testUserEvent.getAuditEventType());
persistenceAuditEventRepository.save(testOtherUserEvent);
PersistentAuditEvent testUserOtherTypeEvent = new PersistentAuditEvent();
testUserOtherTypeEvent.setPrincipal(testUserEvent.getPrincipal());
testUserOtherTypeEvent.setAuditEventType("test-other-type");
testUserOtherTypeEvent.setAuditEventDate(testUserEvent.getAuditEventDate());
persistenceAuditEventRepository.save(testUserOtherTypeEvent);
List<AuditEvent> events = customAuditEventRepository.find("test-user",
Date.from(testUserEvent.getAuditEventDate().minusSeconds(3600)), "test-type");
assertThat(events).hasSize(1);
AuditEvent event = events.get(0);
assertThat(event.getPrincipal()).isEqualTo(testUserEvent.getPrincipal());
assertThat(event.getType()).isEqualTo(testUserEvent.getAuditEventType());
assertThat(event.getData()).containsKey("test-key");
assertThat(event.getData().get("test-key").toString()).isEqualTo("test-value");
assertThat(event.getTimestamp()).isEqualTo(Date.from(testUserEvent.getAuditEventDate()));
}
@Test
public void addAuditEvent() {
Map<String, Object> data = new HashMap<>();
data.put("test-key", "test-value");
AuditEvent event = new AuditEvent("test-user", "test-type", data);
customAuditEventRepository.add(event);
List<PersistentAuditEvent> persistentAuditEvents = persistenceAuditEventRepository.findAll();
assertThat(persistentAuditEvents).hasSize(1);
PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0);
assertThat(persistentAuditEvent.getPrincipal()).isEqualTo(event.getPrincipal());
assertThat(persistentAuditEvent.getAuditEventType()).isEqualTo(event.getType());
assertThat(persistentAuditEvent.getData()).containsKey("test-key");
assertThat(persistentAuditEvent.getData().get("test-key")).isEqualTo("test-value");
assertThat(persistentAuditEvent.getAuditEventDate()).isEqualTo(event.getTimestamp().toInstant());
}
@Test
public void addAuditEventTruncateLargeData() {
Map<String, Object> data = new HashMap<>();
StringBuilder largeData = new StringBuilder();
for (int i = 0; i < EVENT_DATA_COLUMN_MAX_LENGTH + 10; i++) {
largeData.append("a");
}
data.put("test-key", largeData);
AuditEvent event = new AuditEvent("test-user", "test-type", data);
customAuditEventRepository.add(event);
List<PersistentAuditEvent> persistentAuditEvents = persistenceAuditEventRepository.findAll();
assertThat(persistentAuditEvents).hasSize(1);
PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0);
assertThat(persistentAuditEvent.getPrincipal()).isEqualTo(event.getPrincipal());
assertThat(persistentAuditEvent.getAuditEventType()).isEqualTo(event.getType());
assertThat(persistentAuditEvent.getData()).containsKey("test-key");
String actualData = persistentAuditEvent.getData().get("test-key");
assertThat(actualData.length()).isEqualTo(EVENT_DATA_COLUMN_MAX_LENGTH);
assertThat(actualData).isSubstringOf(largeData);
assertThat(persistentAuditEvent.getAuditEventDate()).isEqualTo(event.getTimestamp().toInstant());
}
@Test
public void testAddEventWithWebAuthenticationDetails() {
HttpSession session = new MockHttpSession(null, "test-session-id");
MockHttpServletRequest request = new MockHttpServletRequest();
request.setSession(session);
request.setRemoteAddr("1.2.3.4");
WebAuthenticationDetails details = new WebAuthenticationDetails(request);
Map<String, Object> data = new HashMap<>();
data.put("test-key", details);
AuditEvent event = new AuditEvent("test-user", "test-type", data);
customAuditEventRepository.add(event);
List<PersistentAuditEvent> persistentAuditEvents = persistenceAuditEventRepository.findAll();
assertThat(persistentAuditEvents).hasSize(1);
PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0);
assertThat(persistentAuditEvent.getData().get("remoteAddress")).isEqualTo("1.2.3.4");
assertThat(persistentAuditEvent.getData().get("sessionId")).isEqualTo("test-session-id");
}
@Test
public void testAddEventWithNullData() {
Map<String, Object> data = new HashMap<>();
data.put("test-key", null);
AuditEvent event = new AuditEvent("test-user", "test-type", data);
customAuditEventRepository.add(event);
List<PersistentAuditEvent> persistentAuditEvents = persistenceAuditEventRepository.findAll();
assertThat(persistentAuditEvents).hasSize(1);
PersistentAuditEvent persistentAuditEvent = persistentAuditEvents.get(0);
assertThat(persistentAuditEvent.getData().get("test-key")).isEqualTo("null");
}
@Test
public void addAuditEventWithAnonymousUser() {
Map<String, Object> data = new HashMap<>();
data.put("test-key", "test-value");
AuditEvent event = new AuditEvent(Constants.ANONYMOUS_USER, "test-type", data);
customAuditEventRepository.add(event);
List<PersistentAuditEvent> persistentAuditEvents = persistenceAuditEventRepository.findAll();
assertThat(persistentAuditEvents).hasSize(0);
}
@Test
public void addAuditEventWithAuthorizationFailureType() {
Map<String, Object> data = new HashMap<>();
data.put("test-key", "test-value");
AuditEvent event = new AuditEvent("test-user", "AUTHORIZATION_FAILURE", data);
customAuditEventRepository.add(event);
List<PersistentAuditEvent> persistentAuditEvents = persistenceAuditEventRepository.findAll();
assertThat(persistentAuditEvents).hasSize(0);
}
}
| [
"[email protected]"
] | |
74df0f89faf5811bac4f2ad89e333ffa289c9ee8 | 46680ab474f3d491646498d1cb7d3da8977d650c | /bussiness/src/main/java/com/server/cx/entity/cx/CXCoinTotalItem.java | 8b772076b1aa68d6f3166c6966628b820735cb52 | [] | no_license | joesmart/cx_server | 4dfd32642bf00e3383a5448661198e0ab285fcb7 | 0800d7e308e2d42b0a858fc066fea0a6330afb99 | refs/heads/master | 2022-10-20T10:13:59.455779 | 2012-10-30T05:00:19 | 2012-10-30T05:00:19 | 5,118,438 | 0 | 0 | null | 2022-10-12T20:12:58 | 2012-07-20T02:45:50 | Java | UTF-8 | Java | false | false | 441 | java | package com.server.cx.entity.cx;
import javax.persistence.Entity;
import com.server.cx.entity.basic.AuditableEntity;
import lombok.ToString;
@Entity
@ToString
public class CXCoinTotalItem extends AuditableEntity {
private Double cxCoinCount;
public Double getCxCoinCount() {
return cxCoinCount;
}
public void setCxCoinCount(Double cxCoinCount) {
this.cxCoinCount = cxCoinCount;
}
}
| [
"jinhui@f47374ae-05c8-11e1-8c5d-33d49f259814"
] | jinhui@f47374ae-05c8-11e1-8c5d-33d49f259814 |
32573de4b7dc0a45c7b6b295c9bc2da5d4229114 | 18916260f0e8a4746046f1c9062a773ead2ed361 | /src/main/java/PlayerProperties/Spell.java | 52b64071501442d91dc9322e24f19dba5b7aa73d | [] | no_license | AlvaroAlonsoFlor/FantasyAdventure-Java | 3ed8c4f157d9626d6942be85debd1564a73627cc | 96512c969cc95cdf31ab4a302adcb05374c76a0c | refs/heads/master | 2021-09-25T15:16:13.826096 | 2018-10-23T14:18:36 | 2018-10-23T14:18:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 492 | java | package PlayerProperties;
public class Spell {
private String name;
private int damage;
private int level;
public Spell(String name, int damage, int level) {
this.name = name;
this.damage = damage;
this.level = level;
}
public String getName() {
return name;
}
public int getDamage() {
return damage * level;
}
public int getLevel() { return level; }
public void levelUp() {
level++;
}
}
| [
"[email protected]"
] | |
2ed2d4ef2a774e993aea1f7283deff655029b2e9 | a4e56745257257bd79f78ad9ffe2ec4693bef3be | /androids-master/part2/ad04-01.ScrollView/app/src/main/java/com/android/scrollview/AddButtonActivity.java | 2700db8d7972e81fdc4be18d4990f3539b142e97 | [] | no_license | sayforyou12/androids | 671b27ad5e7712ec2b3bbd8b074f8d36fe8b51b7 | 530bfc18488d839d4116637791e1f951f71c0439 | refs/heads/master | 2021-08-23T00:25:11.296145 | 2017-12-01T21:51:24 | 2017-12-01T21:51:24 | 101,364,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,285 | java | package com.android.scrollview;
import android.app.ActionBar;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Toast;
public class AddButtonActivity extends AppCompatActivity {
private LinearLayout layout1;
private Button addButton1;
private Button addButton5;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_button);
layout1 = (LinearLayout) findViewById(R.id.lay1);
addButton1 = (Button) findViewById(R.id.btn1);
addButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//๋ฒํผ์ด ํด๋ฆญ๋๋ฉด layout์ ๋ฒํผ์ ์ถ๊ฐํ๋ค.
//๋ฒํผ์ ๋ง๋ค๊ณ layout์ ์ถ๊ฐ
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
Button btn = new Button(getApplicationContext());
btn.setText("Push Me");
btn.setLayoutParams(lp);
btn.setBackgroundColor(Color.CYAN);
layout1.addView(btn);
}
});
addButton5 = (Button) findViewById(R.id.btn5);
addButton5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//๋ฒํผ์ด ํด๋ฆญ๋๋ฉด layout์ ๋ฒํผ์ ์ถ๊ฐํ๋ค.
//๋ฒํผ์ ๋ง๋ค๊ณ layout์ ์ถ๊ฐ
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
for(int i = 0; i < 5; i++) {
Button btn = new Button(getApplicationContext());
btn.setText("Push Me"+i);
btn.setLayoutParams(lp);
btn.setBackgroundColor(Color.GREEN);
layout1.addView(btn);
}
}
});
}
}
| [
"[email protected]"
] | |
0e17394a8422732f4e6ecff671f22f955950f90a | 939b82543ccfdafd1dbb5fb349481aa48c873548 | /RottenEggs/src/com/badlogic/androidgames/framework/impl/SingleTouchHandler.java | f37c1f511b36a77f793c3549c384f4bff2611f2e | [] | no_license | ricardolopez/RottenEggs | afc4115e48525967265e857565aa7daa844c40ba | c8bab341fdf7cbcdca7b7d4d84c7095fdb960510 | refs/heads/master | 2020-05-26T20:20:23.231193 | 2012-12-10T06:13:54 | 2012-12-10T06:13:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,077 | java | package com.badlogic.androidgames.framework.impl;
import java.util.ArrayList;
import java.util.List;
import android.view.MotionEvent;
import android.view.View;
import com.badlogic.androidgames.framework.Pool;
import com.badlogic.androidgames.framework.Input.TouchEvent;
import com.badlogic.androidgames.framework.Pool.PoolObjectFactory;
public class SingleTouchHandler implements TouchHandler {
boolean isTouched;
int touchX;
int touchY;
Pool<TouchEvent> touchEventPool;
List<TouchEvent> touchEvents = new ArrayList<TouchEvent>();
List<TouchEvent> touchEventsBuffer = new ArrayList<TouchEvent>();
float scaleX;
float scaleY;
public SingleTouchHandler(View view, float scaleX, float scaleY) {
PoolObjectFactory<TouchEvent> factory = new PoolObjectFactory<TouchEvent>() {
public TouchEvent createObject() {
return new TouchEvent();
}
};
touchEventPool = new Pool<TouchEvent>(factory, 100);
view.setOnTouchListener(this);
this.scaleX = scaleX;
this.scaleY = scaleY;
}
public boolean onTouch(View v, MotionEvent event) {
synchronized(this) {
TouchEvent touchEvent = touchEventPool.newObject();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
touchEvent.type = TouchEvent.TOUCH_DOWN;
isTouched = true;
break;
case MotionEvent.ACTION_MOVE:
touchEvent.type = TouchEvent.TOUCH_DRAGGED;
isTouched = true;
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
touchEvent.type = TouchEvent.TOUCH_UP;
isTouched = false;
break;
}
touchEvent.x = touchX = (int)(event.getX() * scaleX);
touchEvent.y = touchY = (int)(event.getY() * scaleY);
touchEventsBuffer.add(touchEvent);
return true;
}
}
public boolean isTouchDown(int pointer) {
synchronized(this) {
if(pointer == 0)
return isTouched;
else
return false;
}
}
public int getTouchX(int pointer) {
synchronized(this) {
return touchX;
}
}
public int getTouchY(int pointer) {
synchronized(this) {
return touchY;
}
}
public List<TouchEvent> getTouchEvents() {
synchronized(this) {
int len = touchEvents.size();
for( int i = 0; i < len; i++ )
touchEventPool.free(touchEvents.get(i));
touchEvents.clear();
touchEvents.addAll(touchEventsBuffer);
touchEventsBuffer.clear();
return touchEvents;
}
}
} | [
"[email protected]"
] | |
913b28f686c22228b1a45d3509b0126354e2e76f | 785431ab8b7c1d6f6259454ed29148b8586a6e1b | /self-dubbo-application/src/main/java/framework/Protocol.java | 75a257b03a0da0300b8a61466da73f1d03c79ab5 | [] | no_license | wangchirl/shadow-dubbo | 50a6bba253bc104d73130b392337430a1f1a16ff | 80a28639faccfd83e09a429c2c9418489d95c4b2 | refs/heads/master | 2021-04-10T08:10:09.396958 | 2020-04-09T12:51:18 | 2020-04-09T12:51:18 | 248,921,775 | 1 | 0 | null | 2020-03-21T06:45:45 | 2020-03-21T06:42:47 | Java | UTF-8 | Java | false | false | 179 | java | package framework;
public interface Protocol {
// ๅฏๅจๅ่ฎฎๆนๆณ
void start(URL url);
// ๅ้ๆฐๆฎๆนๆณ
String send(URL url,Invocation invocation);
}
| [
"โ[email protected]"
] | |
43e4402f56698934d4cfa0b2bc118e2e2eb64c5a | 0712739a06210326427145850869b30bf9313373 | /jasperReportAdapter/src/main/java/org/notima/businessobjects/adapter/jasperreports/ds/OrderListXmlDataSource.java | 92827d7756b7091539a692d6bae74e0e29ac0fae | [
"Apache-2.0"
] | permissive | notima/businessObjectAdapters | 7a60406159c019ec4d7bcd040d4ff5bf7391b91e | 15aae4dc67c84e8be97a2bdf3e858010018fa0ca | refs/heads/master | 2023-08-31T03:25:14.380806 | 2023-08-25T13:44:20 | 2023-08-25T13:44:20 | 227,064,238 | 0 | 3 | Apache-2.0 | 2023-07-07T13:51:06 | 2019-12-10T08:16:15 | Java | UTF-8 | Java | false | false | 1,084 | java | package org.notima.businessobjects.adapter.jasperreports.ds;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.JAXB;
import org.notima.generic.businessobjects.Order;
import org.notima.generic.businessobjects.OrderList;
public class OrderListXmlDataSource {
public static final String ORDERLIST_XML_FILE = "ORDERLIST_XML_FILE";
public static Collection<Order<?>> getOrderList() throws Exception {
List<Order<?>> orderList = new ArrayList<Order<?>>();
String xmlFile = System.getenv(ORDERLIST_XML_FILE);
if (xmlFile==null) {
xmlFile = System.getProperty(ORDERLIST_XML_FILE);
}
File inFile = null;
if (xmlFile==null) {
throw new Exception("Environment variable " + ORDERLIST_XML_FILE + " is not set.");
} else {
inFile = new File(xmlFile);
if (!inFile.canRead()) {
throw new Exception(xmlFile + " can't be read.");
}
}
OrderList result = JAXB.unmarshal(inFile, OrderList.class);
orderList.addAll(result.getOrderList());
return orderList;
}
}
| [
"[email protected]"
] | |
7dc4dbcd8b5e7bdbb9b9c86fd4f738426bc9168c | 47fa77e1936ef72b53885a0ed3de3fa960db65ec | /practise/Practise3/src/pract/Second (2020_11_23 15_04_39 UTC).java | b571fc5422b9d98c7240f7f601fe103bf46dcff3 | [] | no_license | Himanshu-abc/Eclipse_workspaces_2018 | afded2cf43831494df02861ee4e515c7e24f00f8 | 87d744ad74b5908cb51d2dea044056ee8f8a5e55 | refs/heads/master | 2023-07-03T20:48:55.594079 | 2021-08-14T16:52:17 | 2021-08-14T16:52:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 546 | java | package pract;
public class Second {
public static void main(String args[]){
try{
try{
System.out.println("going to divide");
int b =39/0;
}catch(ArithmeticException e){System.out.println(e);}
try{
int a[]=new int[5];
a[5]=4;
}catch(ArrayIndexOutOfBoundsException e){System.out.println(e);}
System.out.println("other statement");
}catch(Exception e){System.out.println("handeled");}
System.out.println("normal flow..");
}
}
| [
"[email protected]"
] | |
d9eb737aa1e7e863f9cbb588890c59399f0bbde6 | a522684cd8ac73aa70a774beef0a8135fe5da8a5 | /src/automationTestCases/automationTestCases/FLTY_17_Gas_Suitable_For_Smart_Installation_Abort_IE.java | 114466d8bd3bd8cb3df3827182f5f932772406c3 | [] | no_license | JonesC1/MobilityAutomation | 53f55794236c968195e96744e6a12495a0ebffd3 | 665156e3f92c7d07de4951ab90bc147c459178cd | refs/heads/master | 2021-01-02T09:03:37.965576 | 2017-08-02T12:04:50 | 2017-08-02T12:04:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,664 | java | /* *******************************************************************
* Test Case Name: FLTY_17_Suitable_For_Smart_Installation_Abort_IE
* Author: Iain Storrie
* Date: 03/07/2017
* Purpose: This test ensure that a user can abort an appointment from the
* Gas Suitable For Smart Installation page where the smart meter suitability
* fails on the IE browser for a Faulty 17 job
*
**********************************************************************
* Change Log:
*
* Date:
* Author:
* Details:
*
*********************************************************************/
package automationTestCases.automationTestCases;
import java.util.concurrent.TimeUnit;
import org.apache.log4j.xml.DOMConfigurator;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import utility.*;
import webModule.*;
import pageObjectRepositories.Objects_Abort_Page;
import pageObjectRepositories.Objects_Appointment_Details_Page;
import pageObjectRepositories.Objects_Doorstep_Protocol_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Initial_Risk_Assessment_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Risk_Assessment_Elec_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Suitable_For_Smart_Installation_Page;
import pageObjectRepositories.Objects_Gas_Meter_Capture_Warrant_Call_Data_Gas_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Capture_Initial_Photo_Of_Elec_Installation_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Capture_Warrant_Call_Data_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Initial_Polarity_Check_Martindale_Test_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Initial_Polarity_Check_At_Meter_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Current_Meter_Details_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Remove_Meter_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Remove_Asset_Page;
import pageObjectRepositories.Objects_Electricity_Meter_New_Meter_Details_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Additional_Electricity_Tests_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Initial_Meter_Reading_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Commissioning_Page;
import pageObjectRepositories.Objects_Electricity_Meter_Post_Installation_Checks_Page;
import pageObjectRepositories.Objects_Gas_Meter_Risk_Assessment_Gas_Page;
import pageObjectRepositories.Objects_Gas_Meter_Suitable_For_Smart_Installation_Page;
import pageObjectRepositories.Objects_Login_Page;
public class FLTY_17_Gas_Suitable_For_Smart_Installation_Abort_IE {
//Declare our test variables
public WebDriver driver;
private String sTestCaseName;
private int iTestCaseRow;
//Get data and open the browser
@BeforeMethod
public void beforeMethod() throws Exception {
DOMConfigurator.configure("log4j.xml");
sTestCaseName = this.toString();
sTestCaseName = Utils.getTestCaseName(this.toString());
Log.startTestCase(sTestCaseName);
ExcelUtils.setExcelFile(Constant.Path_TestData + "Mobility_Automation_Test_Data" + ".xlsm","Data");
iTestCaseRow = ExcelUtils.getRowContains(sTestCaseName,Constant.Col_Test_Case_Name);
driver = Utils.openBrowser(iTestCaseRow);
//Verify that we are on the correct page
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
Objects_Login_Page.btn_Login(driver).isDisplayed();
Log.info("Login button displayed");
}
//Run the test
@Test
public void main() throws Exception {
Methods_Login.viewPage(driver, sTestCaseName);
Methods_Login.addSuccessValues(driver, sTestCaseName);
Methods_Appointments_List.viewPage(driver, sTestCaseName);
//Select the correct appointment
driver.findElement(By.xpath(".//*[@id='app']/div/div/workorderlistitem[60]/div/div[1]/div/div[1]/span[1]/span")).click();
//Verify that we are on the Appointment Details page
Objects_Appointment_Details_Page.btn_Call_Forward(driver).isDisplayed();
Log.info("Appointment Details page displayed as expected");
Methods_Appointment_Details.viewPage(driver, sTestCaseName);
//Verify correct Customer Details displayed
Objects_Appointment_Details_Page.lnk_Customer_Details(driver).click();
Methods_Appointment_Details.viewCustomerDetails(driver, sTestCaseName, 166);
//Verify correct Job Details displayed
Objects_Appointment_Details_Page.lnk_Job_Details(driver).click();
Methods_Appointment_Details.viewJobDetails(driver, sTestCaseName, 166);
//Verify correct Meter Details displayed
Objects_Appointment_Details_Page.lnk_Meter_Details(driver).click();
Methods_Appointment_Details.viewMeterDetails(driver, sTestCaseName, 166);
//Click Call Forward to bring up Contact options
Objects_Appointment_Details_Page.btn_Call_Forward(driver).click();
//Complete Remaining Customer Contact questions
Objects_Appointment_Details_Page.btn_Contact_Made_Yes(driver).click();
Objects_Appointment_Details_Page.btn_Appointment_Confirm_Yes(driver).click();
//Click Depart Button to progress to Doorstep Protocol Page
Objects_Appointment_Details_Page.btn_Depart(driver).click();
Objects_Appointment_Details_Page.btn_Depart_For_Appointment_OK(driver).click();
//Verify that we are on the Doorstep Protocol page
Objects_Doorstep_Protocol_Page.btn_Arrive(driver).isDisplayed();
Log.info("Doorstep Protocol page displayed as expected");
//Verify that Doorstep Sidebar displayed
Methods_Doorstep_Protocol.viewSidebar(driver, sTestCaseName);
//Verify Arrive button displayed
Methods_Doorstep_Protocol.viewPage(driver, sTestCaseName);
Objects_Doorstep_Protocol_Page.btn_Arrive(driver).click();
//Verify Arrive elements displayed
Methods_Doorstep_Protocol.viewArrivePage(driver, sTestCaseName);
Log.info("Doorstep Protocol page arrive elements displayed as expected");
//Invoke Method to complete doorstep protocol questions for a success outcome
Methods_Doorstep_Protocol.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Initial Risk Assessment page
Objects_Electricity_Meter_Initial_Risk_Assessment_Page.lbl_Initial_Risk_Assessment(driver).isDisplayed();
Log.info("Electricity Meter Initial Risk Assessment page displayed as expected");
//Invoke Method to complete a successful initial risk assessment
Methods_Electricity_Meter_Initial_Risk_Assessment.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Risk Assessment - Elec page
Objects_Electricity_Meter_Risk_Assessment_Elec_Page.lbl_Risk_Assessment_Elec(driver).isDisplayed();
Log.info("Risk Assessment - Elec page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Risk_Assessment_Elec.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Risk Assessment Elec initial elements displayed as expected");
//Verify correct page elements displayed after Risk Assessment - Yes clicked
Methods_Electricity_Meter_Risk_Assessment_Elec.viewRiskAssessmentYesPage(driver, sTestCaseName);
Log.info("Electricity Meter Risk Assessment Yes elements displayed as expected");
//Invoke Method to complete a successful risk assessment
Methods_Electricity_Meter_Risk_Assessment_Elec.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Capture Warrant Call Data - Elec page
Objects_Electricity_Meter_Capture_Warrant_Call_Data_Page.lbl_Capture_Warrant_Call_Data_Elec(driver).isDisplayed();
Log.info("Capture Warrant Call Data - Elec page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Capture_Warrant_Call_Data_Elec.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Capture warrant Call Data - Elec initial elements displayed as expected");
//Invoke Method to complete a successful capture warrant call data
Methods_Electricity_Meter_Capture_Warrant_Call_Data_Elec.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Suitable For Smart Installation page
Objects_Electricity_Meter_Suitable_For_Smart_Installation_Page.lbl_Suitable_For_Smart_Installation(driver).isDisplayed();
Log.info("Suitable for Smart Installation page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Suitable_For_Smart_Installation.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Suitable for Smart Installation initial elements displayed as expected");
//Verify correct page elements displayed after Suitable For Smart Installation - Yes clicked
Methods_Electricity_Meter_Suitable_For_Smart_Installation.viewSuitableYesPage(driver, sTestCaseName);
Log.info("Electricity Meter Suitable for Smart Installation Yes elements displayed as expected");
//Invoke Method to complete a successful suitable for smart installation
Methods_Electricity_Meter_Suitable_For_Smart_Installation.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Capture Initial Photo Of Elec Installation page
Objects_Electricity_Meter_Capture_Initial_Photo_Of_Elec_Installation_Page.lbl_Capture_Initial_Photo_Of_Elec_Installation(driver).isDisplayed();
Log.info("Capture Initial Photo Of Elec Installation page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Capture_Initial_Photo_Of_Elec_Installation.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Suitable for Smart Installation initial elements displayed as expected");
//Invoke Method to complete a successful photo capture
Methods_Electricity_Meter_Capture_Initial_Photo_Of_Elec_Installation.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Capture Initial Polarity Check - Martindale Test page
Objects_Electricity_Meter_Initial_Polarity_Check_Martindale_Test_Page.lbl_Initial_Polarity_Check_Martindale_Test(driver).isDisplayed();
Log.info("Initial Polarity Check - Martindale Test page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Initial_Polarity_Check_Martindale_Test.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Initial Polarity Check - Martindale Test initial elements displayed as expected");
//Invoke Method to complete a successful Martindale Test
Methods_Electricity_Meter_Initial_Polarity_Check_Martindale_Test.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Capture Initial Polarity Check - At Meter page
Objects_Electricity_Meter_Initial_Polarity_Check_At_Meter_Page.lbl_Initial_Polarity_Check_At_Meter(driver).isDisplayed();
Log.info("Initial Polarity Check At Meter page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Initial_Polarity_Check_At_Meter.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Initial Polarity check At Meter initial elements displayed as expected");
//Invoke Method to complete a successful polarity check
Methods_Electricity_Meter_Initial_Polarity_Check_At_Meter.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Current Meter Details page
Objects_Electricity_Meter_Current_Meter_Details_Page.lbl_Current_Meter_Details(driver).isDisplayed();
Log.info("Current Meter Details page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Current_Meter_Details.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Current Meter Details initial elements displayed as expected");
//Invoke Method to complete current meter details page
Methods_Electricity_Meter_Current_Meter_Details.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Remove Meter page
Objects_Electricity_Meter_Remove_Meter_Page.lbl_Remove_Meter(driver).isDisplayed();
Log.info("Remove Meter page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Remove_Meter.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Remove Meter initial elements displayed as expected");
//Invoke Method to complete remove meter page
Methods_Electricity_Meter_Remove_Meter.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Remove Asset page
Objects_Electricity_Meter_Remove_Asset_Page.lbl_Remove_Asset(driver).isDisplayed();
Log.info("Remove Asset page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Remove_Asset.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Remove Asset initial elements displayed as expected");
//Invoke Method to complete remove asset page
Methods_Electricity_Meter_Remove_Asset.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter New Meter Details page
Objects_Electricity_Meter_New_Meter_Details_Page.lbl_New_Meter_Details(driver).isDisplayed();
Log.info("New Meter Details page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_New_Meter_Details.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter New Meter Details initial elements displayed as expected");
//Invoke Method to complete remove asset page
Methods_Electricity_Meter_New_Meter_Details.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Additional Electricity Tests & Checks page
Objects_Electricity_Meter_Additional_Electricity_Tests_Page.lbl_Additional_Electricity_Tests(driver).isDisplayed();
Log.info("New Meter Details page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Additional_Electricity_Tests.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Additional Electricity Tests initial elements displayed as expected");
//Invoke Method to complete Additional Electricity Tests page
Methods_Electricity_Meter_Additional_Electricity_Tests.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Initial Meter Reading page
Objects_Electricity_Meter_Initial_Meter_Reading_Page.lbl_Inital_Meter_Reading(driver).isDisplayed();
Log.info("Initial Meter Reading page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Initial_Meter_Reading.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Initial Meter Reading initial elements displayed as expected");
//Invoke Method to complete Initial Meter Reading page
Methods_Electricity_Meter_Initial_Meter_Reading.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Commissioning page
Objects_Electricity_Meter_Commissioning_Page.lbl_Commissioning(driver).isDisplayed();
Log.info("Initial Meter Reading page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Commissioning.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Commissioning initial elements displayed as expected");
//Invoke Method to complete Commissioning page
Methods_Electricity_Meter_Commissioning.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Electricity Meter Post Installation Checks page
Objects_Electricity_Meter_Post_Installation_Checks_Page.lbl_Post_Installation_Checks(driver).isDisplayed();
Log.info("Initial Meter Reading page displayed as expected");
//Verify Initial page elements displayed
Methods_Electricity_Meter_Post_Installation_Checks.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Post Installation Checks initial elements displayed as expected");
//Invoke Method to complete Post Installation Checks page
Methods_Electricity_Meter_Post_Installation_Checks.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Gas Meter Risk Assessment - Gas page
Objects_Gas_Meter_Risk_Assessment_Gas_Page.lbl_Risk_Assessment_Gas(driver).isDisplayed();
Log.info("Risk Assessment - Gas page displayed as expected");
//Verify Initial page elements displayed
Methods_Gas_Meter_Risk_Assessment_Gas.viewPage(driver, sTestCaseName);
Log.info("Gas Meter Risk Assessment - Gas initial elements displayed as expected");
//Invoke Method to complete a successful risk assessment - gas
Methods_Gas_Meter_Risk_Assessment_Gas.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Gas Meter Capture Warrant Call Data - Gas page
Objects_Gas_Meter_Capture_Warrant_Call_Data_Gas_Page.lbl_Capture_Warrant_Call_Data_Gas(driver).isDisplayed();
Log.info("Capture Warrant Call Data - Gas page displayed as expected");
//Verify Initial page elements displayed
Methods_Gas_Meter_Capture_Warrant_Call_Data_Gas.viewPage(driver, sTestCaseName);
Log.info("Electricity Meter Capture warrant Call Data - Gas initial elements displayed as expected");
//Invoke Method to complete a successful capture warrant call data
Methods_Gas_Meter_Capture_Warrant_Call_Data_Gas.addSuccessValues(driver, sTestCaseName);
//Verify that we are on the Gas Meter Suitable for Smart Installation page
Objects_Gas_Meter_Suitable_For_Smart_Installation_Page.lbl_Suitable_For_Smart_Installation(driver).isDisplayed();
Log.info("Gas Meter Suitable For Smart Installation page displayed as expected");
//Verify Initial page elements displayed
Methods_Gas_Meter_Suitable_For_Smart_Installation.viewPage(driver, sTestCaseName);
Log.info("Gas Meter Suitable for Smart Installation initial elements displayed as expected");
//Verify correct page elements displayed after Suitable for Smart Installation - No clicked
Methods_Gas_Meter_Suitable_For_Smart_Installation.viewSuitableNoPage(driver, sTestCaseName);
Log.info("Gas Meter Suitable for Smart Installation No elements displayed as expected");
//Invoke Method to complete an aborted suitable for smart installation
Methods_Gas_Meter_Suitable_For_Smart_Installation.addAbortValues(driver, sTestCaseName);
//Click Abort button to bring up Abort page
Objects_Gas_Meter_Suitable_For_Smart_Installation_Page.btn_Abort(driver).click();
Log.info("Abort button clicked");
//Verify Abort page displayed
Objects_Abort_Page.First_Utility_Additional_Questions.btn_Gas_Meter_Accessible_Yes(driver).isDisplayed();
Log.info("Abort page displayed as expected");
}
//Log out
@AfterMethod
public void afterMethod() {
driver.quit();
Log.endTestCase(sTestCaseName);
}
}
| [
"[email protected]"
] | |
f8694c49625a92914ff4c6be266c7095f7efe807 | d3e05fee35affc88c6b7e309c5aa665b7eaa401d | /securebootstrapper/src/org/cougaar/core/security/securebootstrap/CertificateVerifier.java | 7091872ada589b564021db00647f05d32919ccfc | [] | no_license | djw1149/cougaar-securebootstrap | 5800eea21690ac2c69e70c2fb50f9aff78fc1b45 | 659cbce184abb7d7a7d11f913255a6e6c377b0ab | refs/heads/master | 2021-01-15T11:40:48.545803 | 2012-06-05T20:37:50 | 2012-06-05T20:37:50 | 40,079,680 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,370 | java | /*
* <copyright>
* Copyright 1999-2004 Cougaar Software, Inc.
* under sponsorship of the Defense Advanced Research Projects
* Agency (DARPA).
*
* You can redistribute this software and/or modify it under the
* terms of the Cougaar Open Source License as published on the
* Cougaar Open Source Website (www.cougaar.org).
*
* 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.
*
* </copyright>
*/
package org.cougaar.core.security.securebootstrap;
import java.util.jar.JarFile;
public interface CertificateVerifier
{
void verify(JarFile jf)
throws CertificateVerificationException;
}
| [
"srosset"
] | srosset |
d864364f57e663daec9a2efd0199e04f0d021805 | 0cb07e2674fc4c392c6eac910ad2d7d812ee7f97 | /app/src/main/java/com/example/audiovideostreamingmubs/AudioAdapter.java | dc799fbf82dfe92ba85d88b066811f30c6441d4f | [] | no_license | MubsCompany/AudioVideoStreamingMubs | 32bf03944bd381c5c50b23d4ede2b9fae0bfa5a7 | 768e5e93967652c26531936936bf3b16e8f13606 | refs/heads/master | 2020-04-27T07:56:49.221084 | 2019-03-06T13:48:49 | 2019-03-06T13:48:49 | 174,153,830 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,775 | java | package com.example.audiovideostreamingmubs;
import android.content.Context;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
class AudioAdapter extends RecyclerView.Adapter<AudioAdapter.AudioViewHolder> {
Context context;
String[] arrayAudioUrl = {"http://mic.duytan.edu.vn:86/ncs.mp3"};
String[] arrayNamaAudio = {"First Audio","Second Audio","Third Audio","Fourth Audio","Fifth Audio","Sixth Audio","Seventh Audio","Eighth Audio","Ninth Audio","Tenth Audio","Eleventh Audio","Twelveth Audio"};
public AudioAdapter(Context context) {
this.context = context;
}
@NonNull
@Override
public AudioViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View v = LayoutInflater.from( context ).inflate( R.layout.rv_layout,viewGroup,false );
return new AudioViewHolder( v );
}
@Override
public void onBindViewHolder(@NonNull AudioViewHolder audioViewHolder, int i) {
audioViewHolder.tvLayoutAudio.setText( arrayNamaAudio[i] );
audioViewHolder.itemView.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View v) {
context.startActivity( new Intent( context,DetailActivity.class ) );
}
} );
}
@Override
public int getItemCount() {
return arrayNamaAudio.length;
}
public class AudioViewHolder extends RecyclerView.ViewHolder {
TextView tvLayoutAudio;
public AudioViewHolder(@NonNull View itemView) {
super( itemView );
tvLayoutAudio = itemView.findViewById( R.id.tv_nama );
}
}
}
| [
"[email protected]"
] | |
2681f11f78c86a454d9ea340a9675085f4b2c516 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/tencent/mm/plugin/sns/ui/SnsPermissionUI$2.java | dc87eb691a99e1015bfc6ecc964d4c4ee1c22fba | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | package com.tencent.mm.plugin.sns.ui;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.ai.p;
import com.tencent.mm.kernel.b;
import com.tencent.mm.kernel.g;
import com.tencent.mm.plugin.sns.model.w;
final class SnsPermissionUI$2
implements DialogInterface.OnCancelListener
{
SnsPermissionUI$2(SnsPermissionUI paramSnsPermissionUI, w paramw)
{
}
public final void onCancel(DialogInterface paramDialogInterface)
{
AppMethodBeat.i(39176);
SnsPermissionUI.a(this.rvk);
g.RQ();
g.RO().eJo.c(this.rvl);
AppMethodBeat.o(39176);
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes4-dex2jar.jar
* Qualified Name: com.tencent.mm.plugin.sns.ui.SnsPermissionUI.2
* JD-Core Version: 0.6.2
*/ | [
"[email protected]"
] | |
85b4219de96ceed82ad6b0700c5a43e1d73f15c0 | 5d7d9d0d686cb5f2bd9e38afa3ca017e7482ea9b | /src/main/java/ifsp/domain/usercases/utils/DAO.java | 91a0aaa181316bda890d1efa69d290932600a721 | [] | no_license | GJayme/p2-poo | c78133a9d56ed4872e676f05d782b893858efd1c | c674cdf858a938b1d4f116fefd3ebd0731c78e5b | refs/heads/master | 2023-02-25T14:12:02.652436 | 2021-01-29T20:16:43 | 2021-01-29T20:16:43 | 332,037,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package ifsp.domain.usercases.utils;
import java.util.List;
import java.util.Optional;
public interface DAO <T, K>{
K create(T type);
Optional<T> readOne(K key);
List<T> readAll();
boolean update(T type);
boolean delete(T type);
boolean deleteByKey(K key);
}
| [
"[email protected]"
] | |
4234050cc3fecd96becf949ceea7629ffe5ef071 | c426a8fb712739af2091a608bad70ee0739d5d5a | /src/test/java/ru/job4j/stream/EasyStreamTest.java | 032772dba93823800f894bb6f53346872c39935d | [] | no_license | Dm-prog/job4j_tracker | 1add62875e22d38e8dc14b48919e6f6b6729a9df | 7217692768e5eadcdfd3c4363bd9e9ad52aa2027 | refs/heads/master | 2023-05-06T21:56:58.455329 | 2021-05-20T19:43:31 | 2021-05-20T19:43:31 | 250,185,277 | 0 | 0 | null | 2020-03-26T07:05:45 | 2020-03-26T07:05:44 | null | UTF-8 | Java | false | false | 1,453 | java | package ru.job4j.stream;
import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.is;
import org.junit.Test;
import java.util.List;
public class EasyStreamTest {
@Test
public void whenEmptySource() {
var rsl = EasyStream.of(List.of()).collect();
assertThat(rsl, is(List.of()));
}
@Test
public void whenFilledSource() {
var rsl = EasyStream.of(List.of(1, 2, 3))
.collect();
assertThat(rsl, is(List.of(1, 2, 3)));
}
@Test
public void whenFilteredSource() {
var rsl = EasyStream.of(List.of(1, 2, 3))
.filter(e -> e == 2)
.collect();
assertThat(rsl, is(List.of(2)));
}
@Test
public void whenMappedSource() {
var rsl = EasyStream.of(List.of(1, 2, 3))
.map(e -> e * 2)
.collect();
assertThat(rsl, is(List.of(2, 4, 6)));
}
@Test
public void whenFilteredMappedSource() {
var rsl = EasyStream.of(List.of(1, 2, 3))
.filter(e -> e == 2)
.map(e -> e * 2)
.collect();
assertThat(rsl, is(List.of(4)));
}
@Test
public void whenMultyFilterSource() {
var rsl = EasyStream.of(List.of(1, 2, 3, 4, 5))
.filter(e -> e >= 2)
.filter(e -> e <= 4)
.collect();
assertThat(rsl, is(List.of(2, 3, 4)));
}
}
| [
"[email protected]"
] | |
4425cb8a3d0adc7741b78ec550dfad05c8810842 | b6d8de40417600ab0d0f56bf0532d25c8ab32244 | /SimpleAlgo/src/algo1223/Code06_Queue.java | 7602df0ecd9586204662eec30c216b01482027f0 | [] | no_license | Hoan1993/DailyAlgo | 54cc201299f95ee4e4ee2102924110295597abc2 | a46c5eb1857dc462cd792133371fe39fdc10728d | refs/heads/master | 2021-02-04T16:42:56.766440 | 2020-03-29T11:46:00 | 2020-03-29T11:46:00 | 243,687,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | package algo1223;
import java.util.LinkedList;
import java.util.ListIterator;
public class Code06_Queue {
public static void main(String[] args) {
LinkedList<Integer> queue = new LinkedList<>();
queue.offer(11);
queue.offer(22);
queue.offer(33);
queue.offer(44);
queue.offer(55);
System.out.println(queue);
System.out.println(queue.poll());
System.out.println(queue);
System.out.println(queue.peek());
System.out.println(queue);
ListIterator<Integer> it = queue.listIterator();
if(it.hasNext()) {
System.out.println(it.next());
System.out.println(it.next());
System.out.println(it.previous());
System.out.println(it.previous());
}
}
}
| [
"sist@DESKTOP-3J6RDRE"
] | sist@DESKTOP-3J6RDRE |
acad365bbe96dcfbb4f2b9d98f1df219c3198a22 | 18af2657c3cde43684c4cc4d6214590ea46b3092 | /src/main/java/org/mumyoutube/model/Video.java | bbe5fe62a42500dbb21aa3a00d3edfaf20458b6b | [] | no_license | sameermaharjan3/MumTube | 62c94fd4842cc2205771444f96d56d6f05c19cf2 | 8609e643f6e7a92c56b26ee6db952a8f11ea340f | refs/heads/master | 2021-01-03T17:28:16.200634 | 2020-02-13T03:40:15 | 2020-02-13T03:40:15 | 240,169,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,962 | java | package org.mumyoutube.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import org.mumyoutube.constants.AppConstant;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.nio.file.Path;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@Entity()
@Table(name = AppConstant.Tb_Video)
public class Video {
@Id
@GeneratedValue
private Long videoId ;
@NonNull
private long userId;
@NotBlank
private String videoPath;
private Long no_dislikes = 0l;
private Long no_likes = 0l;
private String comment = "";
private String videoDescription = "";
@JoinTable
@OneToMany
private List<Comment> comments;
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public String getVideoPath() {
return videoPath;
}
public void setVideoPath(String videoPath) {
this.videoPath = videoPath;
}
public Long getNo_dislikes() {
return no_dislikes;
}
public void setNo_dislikes(Long no_dislikes) {
this.no_dislikes = no_dislikes;
}
public Long getNo_likes() {
return no_likes;
}
public void setNo_likes(Long no_likes) {
this.no_likes = no_likes;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public Long getVideoId() {
return videoId;
}
public void setVideoId(Long videoId) {
this.videoId = videoId;
}
public String getVideoDescription() {
return this.videoDescription;
}
public void setVideoDescription(String videoDescription) {
this.videoDescription = videoDescription;
}
}
| [
"[email protected]"
] | |
62e51181ad53e49939db0b18b2b96f06a215183e | 6c84838e69ae075244700f6c67f87292dcfa0991 | /src/main/java/week15d03/Post.java | dc962aa92adfa0f45ea1450f9cb823fbceeebaaa | [] | no_license | vkrisztianx86/training-solutions | e4fca2d35dd3cfd37572de9eef52b972f2f0385a | 1f775a631979b51430f1f84f9689e9cbbe015e9e | refs/heads/master | 2023-05-26T10:19:33.137529 | 2021-06-08T11:41:55 | 2021-06-08T11:41:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package week15d03;
import java.time.LocalDate;
public class Post {
private String title;
private LocalDate publishedAt;
private String content;
private String owner;
public Post(String title, LocalDate publishedAt, String content, String owner) {
this.title = title;
this.publishedAt = publishedAt;
this.content = content;
this.owner = owner;
}
public String getTitle() {
return title;
}
public LocalDate getPublishedAt() {
return publishedAt;
}
public String getContent() {
return content;
}
public String getOwner() {
return owner;
}
@Override
public String toString() {
return "Post{" +
"title='" + title + '\'' +
", publishedAt=" + publishedAt +
", content='" + content + '\'' +
", owner='" + owner + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
c55b7b430a39e1fb875bc7d2e6d9773f6cd03e4c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/23/23_3a3bb1034bb7b3a9710220e9c7359d8a644fa0c2/ShooterInjector/23_3a3bb1034bb7b3a9710220e9c7359d8a644fa0c2_ShooterInjector_t.java | 1338d8d95f086f8c3aafc28f6997926046fdff89 | [] | 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 | 3,513 | java | package org.usfirst.frc2022.subsystems;
import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.command.PIDSubsystem;
import org.usfirst.frc2022.RobotMap;
import org.usfirst.frc2022.Utils;
import org.usfirst.frc2022.commands.ShooterCommand;
/**
* This code is used to control the speed of Jaguars controlling the shooter for
* picking up Frisbees by taking input as the rotation speed of the encoder And
* for output giving ability to modify speed. Note: names with "_" are from the
* program, no "_" are from RobotMap
*
* @author Malachi Loviska
*/
public class ShooterInjector extends PIDSubsystem {
Encoder shooter_Endcoder;
Jaguar shooter_Jaguar;
Solenoid shooter_Solenoid;
/*
* Initialize Jaguar, Encoder and Solenoid
*/
private static final double Kp = 0.1;
private static final double Ki = 0.0;
private static final double Kd = 0.0;
/**
* Constructs the Jaguar, Encoder, and Solenoid and assigns ports from robot
* map. It also starts the Encoder
*/
public ShooterInjector() {
super("ShooterJaguar", Kp, Ki, Kd);
shooter_Solenoid = new Solenoid(RobotMap.shooterSolenoid);
shooter_Jaguar = new Jaguar(RobotMap.shooterJaguar);
shooter_Endcoder = new Encoder(RobotMap.shooterEndcoder[0],
RobotMap.shooterEndcoder[1]);
//TODO: Set DistancePerPulse() for the Encoder!!!
shooter_Endcoder.start();
}
public double getJagSpeed(){
return shooter_Jaguar.get();
}
///////////////////// Injection Functions /////////////////////////
/*
* Activate Solenoid if the Jaguar is on
*
*/
public void activate() {
if (shooter_Jaguar.get() != 0);
{
shooter_Solenoid.set(true);
}
}
/*
* Deactivate Solenoid if Jaguar is off.
*
*/
public void deactivate() {
shooter_Solenoid.set(false);
}
///////////////////// PID Functions /////////////////////////
/*
* Get the value to be used for the PID Input
*
* @return the rotation speed of encoder for use of Jaguar
*/
protected double returnPIDInput() {
return shooter_Endcoder.getRate();
}
/**
*
* Using the output from encoder to give to change the acceleration of the
* Jaguar
*
* @retun encoder values to jaguar between 1 and -1
*/
protected void usePIDOutput(double output) {
double shoot = Utils.clamp(shooter_Jaguar.get(), 1, -1);
shooter_Jaguar.set(output + shoot);
}
/**
* Set state of PID Loop
*
* @param pid Whether to enable PID loop or not
*/
public void usePID(boolean pid) {
if(pid) {
this.enable();
}
else {
this.disable();
}
}
///////////////////// Manual Functions /////////////////////////
/**
*
* Used for Manual control of the shooter.
* Also turns of PID loop if running.
*
* @param percent Value -1 to 1 for speed of the shooter.
*/
public void setShooter(double percent) {
this.usePID(false);
shooter_Jaguar.set(Utils.clamp(percent, 1, -1));
}
public void initDefaultCommand() {
setDefaultCommand(new ShooterCommand());
}
}
| [
"[email protected]"
] | |
69fb06fa3e9401e526e4fa935dfc700e9e118b6e | dd78788e8811c296441ff925dd5c5e2bac315374 | /Java/19.Java String Tokens.java | 8b0201db83ada2e82b85b4802db3ccdbb8648324 | [
"MIT"
] | permissive | rayrone/hacker_rank | a8f766bdda43621837c7fd52519871668f09ad61 | fc3cbe96cb9fab6df1e8f80b5987f2ec25462cc5 | refs/heads/master | 2020-07-15T04:16:09.396621 | 2019-12-17T19:01:03 | 2019-12-17T19:01:03 | 205,477,031 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 744 | java | /*
Java String Tokens
URL: https://www.hackerrank.com/challenges/java-string-tokens/problem
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String s = scan.nextLine().trim();
if(s.isEmpty()) {
System.out.println('0');
} else {
String[] tokens = s.split("[\\p{Punct}\\p{Blank}]+");
System.out.println(tokens.length);
for(int i = 0 ; i < tokens.length ; i++) {
if(i != 0) {
System.out.println("");
}
System.out.print(tokens[i]);
}
}
scan.close();
}
}
| [
"[email protected]"
] | |
2847114050326a8d3eb95a41c320cb1dcfd8a81a | d0a3cbb49359f725a3211c926abf4906243561ca | /modules/app/src/main/java/br/com/kerubin/api/financeiro/fluxocaixa/service/CaixaDiarioRuleFunctionsImpl.java | 9275131a0e9f3f6c40a0e5dcac49ed18b9538fd2 | [] | no_license | lobokoch/fluxo-caixa | d44f071a7727cf74d48ec2d50f612a33a89b4b47 | 7cc85f35c6b70b97751ea4aaba565cfa261ac5b7 | refs/heads/master | 2020-06-04T21:16:58.772645 | 2020-05-18T10:47:57 | 2020-05-18T10:47:57 | 192,193,801 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package br.com.kerubin.api.financeiro.fluxocaixa.service;
import java.util.UUID;
import javax.inject.Inject;
import javax.transaction.Transactional;
import org.springframework.stereotype.Service;
import br.com.kerubin.api.financeiro.fluxocaixa.entity.caixadiario.CaixaDiario;
import br.com.kerubin.api.financeiro.fluxocaixa.entity.caixadiario.CaixaDiarioEntity;
import br.com.kerubin.api.financeiro.fluxocaixa.entity.caixadiario.CaixaDiarioRuleFunctions;
@Service
public class CaixaDiarioRuleFunctionsImpl implements CaixaDiarioRuleFunctions {
@Inject
private CustomCaixaDiarioServiceImpl customCaixaDiarioServiceImpl;
@Transactional
@Override
public CaixaDiarioEntity abrirCaixa(UUID id, CaixaDiario caixaDiario) {
return customCaixaDiarioServiceImpl.abrirCaixa(id, caixaDiario);
}
@Override
public CaixaDiarioEntity fecharCaixa(UUID id, CaixaDiario caixaDiario) {
return customCaixaDiarioServiceImpl.fecharCaixa(id, caixaDiario);
}
}
| [
"[email protected]"
] | |
3b5316aa3d93e047e9746c32a671ac50c72db0c1 | be410dde7cb0920cee63a77715a01561cb2cfc2b | /core/src/com/aghacks/dragoncave/handlers/SlowMotionBar.java | 286712ed50243aaf38796273601111c291100429 | [] | no_license | Pastew/DragonCave | 2bb8ec2f27419d445f756524a8857cffddbb01d1 | 4ccdc537d8c30d28af50d2d79c67a26a8e3a977a | refs/heads/master | 2020-12-30T09:57:33.347946 | 2018-09-05T07:07:22 | 2018-09-05T07:07:22 | 25,713,204 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,369 | java | package com.aghacks.dragoncave.handlers;
import com.aghacks.dragoncave.Game;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
public class SlowMotionBar {
private final int amountMax = 9000;
public static final int FROZEN_TIME = 2000;
private int amount;
private ShapeRenderer sr;
long lastUpdateTime;
private Sprite sprite;
private long lastClick;
private State state;
private Color color;
public SlowMotionBar(){
this.state = State.NOT_RUNNING;
this.amount = amountMax;
sr = new ShapeRenderer();
sprite = new Sprite(Game.res.getTexture("slowMotion"));
sprite.setSize(Game.V_WIDTH / 17, Game.V_HEIGHT);
sprite.setPosition(Game.V_WIDTH - sprite.getWidth(),0);
}
public void render(SpriteBatch sb){
// ramka
sr.begin(ShapeType.Line);
sr.setColor(color);
sr.rect(Game.V_WIDTH - Game.V_WIDTH/16,
0,
Game.V_WIDTH/16,
Game.V_HEIGHT);
sr.end();
// srodek
sr.begin(ShapeType.Filled);
sr.rect(Game.V_WIDTH-Game.V_WIDTH/16,
1,
Game.V_WIDTH/16-1,
(Game.V_HEIGHT-1) * ((float)amount/amountMax));
sr.end();
// napis
sb.begin();
sprite.draw(sb);
sb.end();
}
public void update(){
long currentTime = System.currentTimeMillis();
float difference = currentTime - lastUpdateTime;
if(lastUpdateTime != 0) {
if(state == State.DECREASING && amount > 0){
amount -= 3*difference;
}
else if (state == State.INCREASING && amount < amountMax){
amount += difference;
}
}
lastUpdateTime = System.currentTimeMillis();
if(lastUpdateTime - lastClick >= SlowMotionBar.FROZEN_TIME) {
color = new Color(0.2f, 0.2f, 0.2f, 0.4f);
}
}
public void decrease(){
state = State.DECREASING;
}
public void increase() {
state = State.INCREASING;
//timer.setTime(0);
//timer.start();
}
public void froze() {
color = new Color(0.4f, 0.4f, 0.4f, 0.8f);
}
public long getLastClick() { return lastClick; }
public void setLastClick(long time) {
this.lastClick = time;
}
enum State { NOT_RUNNING, INCREASING, DECREASING }
public boolean isEmpty(){
if(amount <3)
return true;
else
return false;
}
}
| [
"[email protected]"
] | |
4d1186b1081611f1d9860e1d5ee2ed64b5fcafdf | 3f9ca534451e8c37af060b60e0f9738cb2001b59 | /openapi-generator-for-spring-test/src/test/java/de/qaware/openapigeneratorforspring/test/app18/App18Configuration.java | 1f69decc9d54bcc49f51e5275e5eff3ba5fac995 | [
"Apache-2.0"
] | permissive | norberto-enomoto/openapi-generator-for-spring | 69538e712c1f220ccb0993a8223f0666c58daa95 | 70562323ddb26dd0d2acf0077f5ddda47e636277 | refs/heads/master | 2023-02-09T21:31:58.532958 | 2021-01-12T16:49:02 | 2021-01-12T16:50:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,231 | java | package de.qaware.openapigeneratorforspring.test.app18;
import de.qaware.openapigeneratorforspring.common.OpenApiRequestParameterProvider;
import de.qaware.openapigeneratorforspring.common.filter.handlermethod.HandlerMethodFilter;
import de.qaware.openapigeneratorforspring.ui.OpenApiSwaggerUiApiDocsUrisSupplier;
import de.qaware.openapigeneratorforspring.ui.OpenApiSwaggerUiApiDocsUrisSupplier.ApiDocsUriWithName;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.util.UriComponentsBuilder;
import java.util.Arrays;
@Configuration
public class App18Configuration {
@Bean
public HandlerMethodFilter handlerMethodFilterForGroupsQueryParam(OpenApiRequestParameterProvider parameterProvider) {
return handlerMethodWithInfo -> {
// important to get group inside the lambda, otherwise we're outside of request scope
return parameterProvider.getFirstQueryParameter("pathPrefix")
.map(pathPrefix -> handlerMethodWithInfo.getPathPatterns().stream().allMatch(path -> path.startsWith(pathPrefix)))
.orElse(true);
};
}
@Bean
public HandlerMethodFilter handlerMethodFilterForGroupsHeaderParam(OpenApiRequestParameterProvider parameterProvider) {
return handlerMethodWithInfo -> {
// important to get group inside the lambda, otherwise we're outside of request scope
return parameterProvider.getFirstHeaderValue("x-path-prefix")
.map(pathPrefix -> handlerMethodWithInfo.getPathPatterns().stream().allMatch(path -> path.startsWith(pathPrefix)))
.orElse(true);
};
}
@Bean
public OpenApiSwaggerUiApiDocsUrisSupplier openApiSwaggerUiApiDocsUrisSupplier() {
return apiDocsUri -> {
UriComponentsBuilder apiDocsUriBuilder = UriComponentsBuilder.fromUri(apiDocsUri).query("pathPrefix={pathPrefix}");
return Arrays.asList(
ApiDocsUriWithName.of("User", apiDocsUriBuilder.build("/user")),
ApiDocsUriWithName.of("Admin", apiDocsUriBuilder.build("/admin"))
);
};
}
}
| [
"[email protected]"
] | |
1855bb8ab50024a4374574e6f677247ac27e2f52 | cea6f584f44e89287b5928ddbbf224622005400b | /app/src/androidTest/java/com/example/waterresource/ExampleInstrumentedTest.java | c304cca97ba8695c39d04c3e0089fc62b436d074 | [] | no_license | shubham1499/Water-Resources-Android-and-Web | ea76f3c2c45c352fa4f58a7cbd4290511036f10a | 969a38e79a316e7010f74a0612ab4e8443ef8b38 | refs/heads/master | 2021-03-24T14:16:53.432176 | 2020-03-18T10:41:05 | 2020-03-18T10:41:05 | 247,537,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package com.example.waterresource;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.waterresource", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
e3fe61976174e4a6a71e7aae90ea7e8315a9a07b | 9fd0203e7ba92bc14a059ec2790b1892da75f976 | /httpserver/src/main/java/study/httpserver/io/config/HttpRequestDispatcher.java | d883976fd4bd07e96393471f44f2ab32a17c88b7 | [] | no_license | grabarViacek/http_server | d65f1508af9dd632eb74a35c3a750240827a8242 | 60c8c8ce19439369f8ac3e9a6d10e40b64208725 | refs/heads/master | 2020-04-20T22:37:06.419333 | 2019-03-04T14:08:59 | 2019-03-04T14:08:59 | 169,121,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 417 | java | package study.httpserver.io.config;
import java.io.IOException;
import study.httpserver.io.HttpHandler;
import study.httpserver.io.HttpRequest;
import study.httpserver.io.HttpResponse;
import study.httpserver.io.HttpServerContext;
public interface HttpRequestDispatcher extends HttpHandler {
void handle(HttpServerContext context, HttpRequest request, HttpResponse response) throws IOException;
}
| [
"[email protected]"
] | |
851b1a47318d914be76b95773034d0a77d574790 | 4b5b19990772bf451701f5df433d9383094a0535 | /src/main/java/com/backend/repositorio/CarreraRepository.java | bd7de6b86542c1fa358f263511534083edd4cad6 | [] | no_license | ErickIMT/GuiaUniverSitariaBack | a1a31aaec95387cfe1381296ed3f21df4269c565 | bedc4a04d2333947340a7c2f9b705fcee5f6ea7e | refs/heads/main | 2023-07-24T22:37:23.065522 | 2021-08-31T22:58:08 | 2021-08-31T22:58:08 | 401,851,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 415 | java | package com.backend.repositorio;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.backend.modelo.Carrera;
@Repository
public interface CarreraRepository extends JpaRepository<Carrera, Integer> {
//Busquedas por Carrera
//Por Nombre
public List<Carrera> findByNombreContaining(String nombre);
}
| [
"[email protected]"
] | |
a5975dc324a7595961434f43eefe992a60de484e | c8404d9ba15f981ad96afe2a3adabbdc7a4da36f | /Movie/src/main/java/com/jay/po/RectabExample.java | 2b95523f4e6ac3e057cb5c2a22806d7b68d91dce | [] | no_license | jaywongs/Find_Movie | b2c13c82c2fc3cf822f28526beb947c782ce85e6 | e249695ed73a7310858f3410faa98f2368c505fd | refs/heads/master | 2020-04-26T05:01:53.027177 | 2019-05-16T15:18:21 | 2019-05-16T15:18:21 | 173,320,735 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,466 | java | package com.jay.po;
import java.util.ArrayList;
import java.util.List;
public class RectabExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public RectabExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andUseridIsNull() {
addCriterion("userid is null");
return (Criteria) this;
}
public Criteria andUseridIsNotNull() {
addCriterion("userid is not null");
return (Criteria) this;
}
public Criteria andUseridEqualTo(Integer value) {
addCriterion("userid =", value, "userid");
return (Criteria) this;
}
public Criteria andUseridNotEqualTo(Integer value) {
addCriterion("userid <>", value, "userid");
return (Criteria) this;
}
public Criteria andUseridGreaterThan(Integer value) {
addCriterion("userid >", value, "userid");
return (Criteria) this;
}
public Criteria andUseridGreaterThanOrEqualTo(Integer value) {
addCriterion("userid >=", value, "userid");
return (Criteria) this;
}
public Criteria andUseridLessThan(Integer value) {
addCriterion("userid <", value, "userid");
return (Criteria) this;
}
public Criteria andUseridLessThanOrEqualTo(Integer value) {
addCriterion("userid <=", value, "userid");
return (Criteria) this;
}
public Criteria andUseridIn(List<Integer> values) {
addCriterion("userid in", values, "userid");
return (Criteria) this;
}
public Criteria andUseridNotIn(List<Integer> values) {
addCriterion("userid not in", values, "userid");
return (Criteria) this;
}
public Criteria andUseridBetween(Integer value1, Integer value2) {
addCriterion("userid between", value1, value2, "userid");
return (Criteria) this;
}
public Criteria andUseridNotBetween(Integer value1, Integer value2) {
addCriterion("userid not between", value1, value2, "userid");
return (Criteria) this;
}
public Criteria andMovieidsIsNull() {
addCriterion("movieids is null");
return (Criteria) this;
}
public Criteria andMovieidsIsNotNull() {
addCriterion("movieids is not null");
return (Criteria) this;
}
public Criteria andMovieidsEqualTo(String value) {
addCriterion("movieids =", value, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsNotEqualTo(String value) {
addCriterion("movieids <>", value, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsGreaterThan(String value) {
addCriterion("movieids >", value, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsGreaterThanOrEqualTo(String value) {
addCriterion("movieids >=", value, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsLessThan(String value) {
addCriterion("movieids <", value, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsLessThanOrEqualTo(String value) {
addCriterion("movieids <=", value, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsLike(String value) {
addCriterion("movieids like", value, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsNotLike(String value) {
addCriterion("movieids not like", value, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsIn(List<String> values) {
addCriterion("movieids in", values, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsNotIn(List<String> values) {
addCriterion("movieids not in", values, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsBetween(String value1, String value2) {
addCriterion("movieids between", value1, value2, "movieids");
return (Criteria) this;
}
public Criteria andMovieidsNotBetween(String value1, String value2) {
addCriterion("movieids not between", value1, value2, "movieids");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"[email protected]"
] | |
0806ddfaee2a88af37b3edefa0734693251b519a | ebdcd98189ecf66ff762af14227c90989ff7992f | /Java/ControlFlow/monthCode.java | 977348b76da553295d08533f4eb86251e817950f | [] | no_license | rahulthankachan/CodeSol | 9521ccf8b39c8b1e8e8d147913f40e67fddf272a | ffc0391f4331afd798de3a6ba89631de9da26a4c | refs/heads/master | 2020-04-15T14:30:18.278470 | 2016-11-07T08:35:21 | 2016-11-07T08:35:21 | 48,138,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,404 | java | public class TestPad{
public static void main(String[] args){
UtilClass util = new UtilClass();
int year = Integer.parseInt(args[0]);
System.out.println("The ans is " + util.isLeapYear(year));
System.out.println("Checking to see the month code....");
int letMonthInt = Integer.parseInt(args[1]);
String monthCodeValue = util.monthCode(letMonthInt);
System.out.println("The month code for the value " + args[1] + " is " + monthCodeValue);
}
}
class UtilClass{
public boolean isLeapYear(int year){
if (year % 400 == 0){
return true;
}
else if ((year % 4 == 0) && (year % 100 != 0)) {
return true;
}
else{
return false;
}
}
public String monthCode(int monthCode){
String name = "";
if (monthCode == 1){
name = "January";
}else if (monthCode == 2){
name = "February";
}else if (monthCode == 3){
name = "March";
}else if (monthCode == 4){
name = "April";
}else if (monthCode == 5){
name = "May";
}else if (monthCode == 6){
name = "June";
}else if (monthCode == 7){
name = "July";
}else if (monthCode == 8){
name = "August";
}else if (monthCode == 9){
name = "September";
}else if (monthCode == 10){
name = "October";
}else if (monthCode == 11){
name = "November";
}else if (monthCode == 12){
name = "December";
} else{
name = "NOT FOUND"; /// WRONG INPUT
}
return name;
}
}
| [
"[email protected]"
] | |
a82656e6a969909bb6201275c58868aed663e9d1 | c61110b60ca6f38f63a9dfe894c8e70b17499062 | /POSTORY/src/com/codeest/postory/presentation/AppMain.java | e7bb90e7023439f6b7d00619502aea36abf3f0bb | [] | no_license | prashant920/postory | 1fee651a12bf5a30e5f1b13ba43e571a4a2c7db7 | 96e6bdf05eefecde029ccdebbf56d6a0e0aaca4c | refs/heads/master | 2021-01-10T05:18:26.563493 | 2016-01-12T06:09:53 | 2016-01-12T06:11:49 | 48,742,542 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,476 | java | package com.codeest.postory.presentation;
import com.codeest.postory.dao.PosProfileDAO;
import com.codeest.postory.pojo.PosProfile;
import com.codeest.postory.presentation.control.IconicButton;
import com.codeest.postory.presentation.control.LeftMenuToolBar;
import com.codeest.postory.presentation.control.SlideBar;
import com.codeest.postory.presentation.control.TopMenuBox;
import com.codeest.postory.presentation.controller.BluetoothController;
import com.codeest.postory.presentation.controller.NewBarcodeInvoicePaneController;
import com.codeest.postory.presentation.controller.NewInvoicePaneController;
import com.codeest.postory.presentation.controller.PostoryModalWindow;
import com.codeest.postory.presentation.font.FlatIcons;
import com.codeest.postory.presentation.font.Iconics;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Pos;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import org.apache.commons.lang3.StringUtils;
/**
*
* @author Prashant
*/
public class AppMain extends Application {
SlideBar bar;
TopMenuBox tmb;
@Override
public void start(Stage primaryStage) throws Exception {
StackPane root = new StackPane();
bar = new SlideBar();
Label content = new Label("DASHBOARD----TBI");
content.setStyle("-fx-background-color: #F2F2F2; -fx-border-color: black;");
content.setAlignment(Pos.CENTER);
content.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
//try {
// Parent rootCenter = FXMLLoader.load(getClass().getResource("test.fxml"));
// bar.setContent(rootCenter);
//} catch (IOException ex) {
// Logger.getLogger(AppMain.class.getName()).log(Level.SEVERE, null, ex);
// }
bar.setContent(content);
// loadItemPaneInCOntent();
LeftMenuToolBar lmtb = new LeftMenuToolBar();
lmtb.setGlobaActionCallBack((String source) -> {
selectMenuAndHideMenuBar(source);
});
bar.setLeft(lmtb);
//topLabelR.setStyle("-fx-background-color: rgba(0,255,0,.25);");
IconicButton testButton = new IconicButton();
testButton.getStyleClass().setAll("");
Iconics.setFlatIcon(testButton, FlatIcons.Icons.ICON_MENU.toString(), "2em", "white", "Menu");
testButton.setOnAction(e -> {
if (bar.isShowing()) {
bar.setShowing(Boolean.FALSE);
tmb.setShowing(Boolean.FALSE);
} else {
bar.setShowing(Boolean.TRUE);
tmb.setShowing(Boolean.TRUE);
}
});
HBox topRightBox = new HBox();
topRightBox.setAlignment(Pos.CENTER_RIGHT);
IconicButton newInvoiceButton = new IconicButton();
newInvoiceButton.getStyleClass().setAll("");
Iconics.setFlatIcon(newInvoiceButton, FlatIcons.Icons.ICON_INVOICE_NEW.toString(), "2em", "white", "Add New Invoice");
newInvoiceButton.setOnAction(e -> {
openNewInvoicePane(e);
});
IconicButton newBarcodeInvoice = new IconicButton();
newBarcodeInvoice.getStyleClass().setAll("");
Iconics.setFlatIcon(newBarcodeInvoice, FlatIcons.Icons.ICON_BARCODE_SCAN.toString(), "2em", "white", "New Barcode Invoice");
newBarcodeInvoice.setOnAction(e -> {
openNewBarcodeInvoicePane(e);
});
VBox posProfileBox = new VBox(2);
posProfileBox.setFillWidth(true);
posProfileBox.setAlignment(Pos.CENTER_LEFT);
HBox.setHgrow(posProfileBox, Priority.ALWAYS);
PosProfileDAO posProfileDAO = new PosProfileDAO();
PosProfile profile = posProfileDAO.getPosProfile();
Text posNameText = new Text(profile.getName());
Text posAdressText = new Text(profile.getAddress());
Text posCityText = new Text(profile.getCity()+","+profile.getPincode());
posProfileBox.getChildren().addAll(posNameText,posAdressText,posCityText);
topRightBox.getChildren().addAll(posProfileBox,newInvoiceButton, newBarcodeInvoice);
tmb = new TopMenuBox(testButton, topRightBox);
SetHoverEffect(testButton);
SetHoverEffect(newInvoiceButton);
SetHoverEffect(newBarcodeInvoice);
bar.setTop(tmb);
root.getChildren().addAll(bar);
Scene scene = new Scene(root, 300, 250);
scene.getStylesheets().add(AppMain.class.getResource("fxt-default.css").toExternalForm());
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.setMaximized(true);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
private void selectMenuAndHideMenuBar(String source) {
if (!StringUtils.isEmpty(source)) {
try {
Parent rootCenter = FXMLLoader.load(getClass().getResource("fxml/" + source + ".fxml"));
bar.setContent(rootCenter);
} catch (IOException ex) {
Logger.getLogger(AppMain.class.getName()).log(Level.SEVERE, null, ex);
}
}
if (bar.isShowing()) {
bar.setShowing(Boolean.FALSE);
tmb.setShowing(Boolean.FALSE);
}
}
private void loadItemPaneInCOntent() {
try {
Parent rootCenter = FXMLLoader.load(getClass().getResource("fxml/itempane.fxml"));
bar.setContent(rootCenter);
} catch (IOException ex) {
Logger.getLogger(AppMain.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void openNewInvoicePane(ActionEvent ae) {
PostoryModalWindow modalWindow = new PostoryModalWindow();
modalWindow.openNewModalPaneWithParent("New Invoice", "fxml/newinvoicepane.fxml", ae);
NewInvoicePaneController controller = (NewInvoicePaneController) modalWindow.getDswFromController();
controller.getWindowStage().showAndWait();
}
private void openNewBarcodeInvoicePane(ActionEvent ae) {
PostoryModalWindow modalWindow = new PostoryModalWindow();
modalWindow.openNewModalPaneWithParent("New Invoice", "fxml/newbarcodeinvoicepane.fxml", ae);
//NewInvoicePaneController controller = (NewInvoicePaneController) modalWindow.getDswFromController();
//++controller.getWindowStage().showAndWait();
NewBarcodeInvoicePaneController controller = (NewBarcodeInvoicePaneController) modalWindow.getDswFromController();
//controller.setup();
controller.getWindowStage().showAndWait();
BluetoothController bc = controller.getBc();
if(bc != null){
System.err.println("CANCELLING");
bc.cancel(true);
bc.cancelandExit();
}
}
private void SetHoverEffect(IconicButton ib){
ib.setOnMouseEntered(e -> {
ib.setScaleX(1.1);
ib.setScaleY(1.1);
});
ib.setOnMouseExited(e -> {
ib.setScaleX(1.0);
ib.setScaleY(1.0);
});
}
}
| [
"[email protected]"
] | |
909d4e19c6547249cb2bc5cd8ca51645d0b95faa | c7359be3c38c940eb393ee8b734802e7c45ec499 | /common/src/com/hanceedu/common/interpolator/SineInterpolator.java | 589583d3758def8f201253b4fadbba6703ba979c | [] | no_license | jichuangsi/school-desk | 43b087b5331bba402b24b19044637327ce4fcf39 | fd5bd7c5e27e2e9bfa5d1a15952eab5ee99226de | refs/heads/master | 2020-04-16T12:27:33.699575 | 2019-01-29T09:37:10 | 2019-01-29T09:37:10 | 165,580,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,390 | java | package com.hanceedu.common.interpolator;
/*
*
* Open source under the BSD License.
*
* Copyright ยฉ 2001 Robert Penner
* 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 the author nor the names of 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.
*
*/
import android.view.animation.Interpolator;
import com.hanceedu.common.interpolator.EasingType.Type;
public class SineInterpolator implements Interpolator {
private com.hanceedu.common.interpolator.EasingType.Type type;
public SineInterpolator(Type type) {
this.type = type;
}
public float getInterpolation(float t) {
if (type == Type.IN) {
return in(t);
} else
if (type == Type.OUT) {
return out(t);
} else
if (type == Type.INOUT) {
return inout(t);
}
return 0;
}
private float in(float t) {
return (float) (-Math.cos(t * (Math.PI/2)) + 1);
}
private float out(float t) {
return (float) Math.sin(t * (Math.PI/2));
}
private float inout(float t) {
return (float) (-0.5f * (Math.cos(Math.PI*t) - 1));
}
}
| [
"school@jichuangsi"
] | school@jichuangsi |
74aaa61ad34382f1195d04916d9892c12e1e80ee | e32b563c1e581c94ff08f1259c25264f99b9567f | /source/jdbcDriverOOo/source/io/github/prrvchr/uno/sdbc/StatementBase.java | 9812c7e0b12145d3b8b329b8039748799c9e845e | [] | no_license | prrvchr/jdbcDriverOOo | 7f73efdd7c176964d5ad90a9d9dfa7d21ce750b8 | d49f1a66f7e70d4fed4fea9a05089f29c4db3334 | refs/heads/master | 2023-09-01T11:33:04.391315 | 2023-08-27T18:21:52 | 2023-08-27T18:21:52 | 230,941,890 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,625 | java | /*
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ Copyright (c) 2020 https://prrvchr.github.io โ
โ โ
โ 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 io.github.prrvchr.uno.sdbc;
import com.sun.star.beans.PropertyVetoException;
import com.sun.star.lang.WrappedTargetException;
import com.sun.star.logging.LogLevel;
import com.sun.star.sdbc.SQLException;
import com.sun.star.sdbc.XBatchExecution;
import com.sun.star.sdbc.XConnection;
import com.sun.star.sdbc.XResultSet;
import com.sun.star.sdbc.XStatement;
import com.sun.star.uno.Type;
import io.github.prrvchr.jdbcdriver.PropertyIds;
import io.github.prrvchr.jdbcdriver.Resources;
import io.github.prrvchr.uno.beans.PropertySetAdapter.PropertyGetter;
import io.github.prrvchr.uno.beans.PropertySetAdapter.PropertySetter;
import io.github.prrvchr.uno.helper.UnoHelper;
public abstract class StatementBase
extends StatementMain
implements XBatchExecution,
XStatement
{
private boolean m_EscapeProcessing = true;
// The constructor method:
public StatementBase(String service,
String[] services,
ConnectionBase connection)
{
super(service, services, connection);
registerProperties();
}
private void registerProperties() {
registerProperty(PropertyIds.ESCAPEPROCESSING.name, PropertyIds.ESCAPEPROCESSING.id, Type.BOOLEAN,
new PropertyGetter() {
@Override
public Object getValue() throws WrappedTargetException {
System.out.println("sdbc.StatementBase._getEscapeProcessing(): " + m_EscapeProcessing);
return _getEscapeProcessing();
}
},
new PropertySetter() {
@Override
public void setValue(Object value) throws PropertyVetoException, IllegalArgumentException, WrappedTargetException {
System.out.println("sdbc.StatementBase._setEscapeProcessing(): " + (boolean) value);
_setEscapeProcessing((boolean) value);
}
});
}
protected void _setEscapeProcessing(boolean value)
{
m_EscapeProcessing = value;
if (m_Statement != null)
{
try {
m_Statement.setEscapeProcessing(value);
} catch (java.sql.SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
protected boolean _getEscapeProcessing()
{
return m_EscapeProcessing;
}
@Override
protected void _createStatement()
throws SQLException {
checkDisposed();
if (m_Statement == null) {
try {
if (m_Connection.getProvider().isResultSetUpdatable(m_Connection) &&
(m_ResultSetType != java.sql.ResultSet.TYPE_FORWARD_ONLY || m_ResultSetConcurrency != java.sql.ResultSet.CONCUR_READ_ONLY)) {
m_Statement = m_Connection.getProvider().getConnection().createStatement(m_ResultSetType, m_ResultSetConcurrency);
}
else {
m_Statement = m_Connection.getProvider().getConnection().createStatement();
}
_setStatement();
}
catch (java.sql.SQLException e) {
System.out.println("sdbc.StatementBase._createStatement() ERROR: " + m_ResultSetType + " - " + m_ResultSetConcurrency + " - SQL: '" + m_Sql + "'");
throw UnoHelper.getSQLException(e, this);
}
}
}
protected void _setStatement()
throws java.sql.SQLException
{
super._setStatement();
m_Statement.setEscapeProcessing(m_EscapeProcessing);
}
// com.sun.star.sdbc.XBatchExecution
@Override
public void addBatch(String sql) throws SQLException {
try
{
_createStatement();
m_Statement.addBatch(sql);
} catch (java.sql.SQLException e)
{
throw UnoHelper.getSQLException(e, this);
}
}
@Override
public void clearBatch() throws SQLException {
try
{
_createStatement();
m_Statement.clearBatch();
} catch (java.sql.SQLException e)
{
throw UnoHelper.getSQLException(e, this);
}
}
@Override
public int[] executeBatch() throws SQLException {
try
{
_createStatement();
return m_Statement.executeBatch();
} catch (java.sql.SQLException e)
{
throw UnoHelper.getSQLException(e, this);
}
}
// com.sun.star.sdbc.XStatement:
@Override
public boolean execute(String sql) throws SQLException
{
try
{
m_logger.logp(LogLevel.FINE, Resources.STR_LOG_STATEMENT_EXECUTE, sql);
_createStatement();
m_Sql = sql;
return m_Statement.execute(sql, m_AutoGeneratedKeys);
} catch (java.sql.SQLException e)
{
e.printStackTrace();
throw UnoHelper.getSQLException(e, this);
}
}
@Override
public XResultSet executeQuery(String sql) throws SQLException
{
try
{
m_logger.logp(LogLevel.FINE, Resources.STR_LOG_STATEMENT_EXECUTE_QUERY, sql);
_createStatement();
m_Sql = sql;
java.sql.ResultSet resultset = m_Statement.executeQuery(sql);
return _getResultSet(resultset);
} catch (java.sql.SQLException e)
{
e.printStackTrace();
throw UnoHelper.getSQLException(e, this);
}
}
@Override
public int executeUpdate(String sql) throws SQLException
{
try
{
m_logger.logp(LogLevel.FINE, Resources.STR_LOG_STATEMENT_EXECUTE_UPDATE, sql);
_createStatement();
m_Sql = sql;
return m_Statement.executeUpdate(sql, m_AutoGeneratedKeys);
} catch (java.sql.SQLException e)
{
e.printStackTrace();
throw UnoHelper.getSQLException(e, this);
}
}
@Override
public XConnection getConnection() throws SQLException
{
return m_Connection;
}
}
| [
"[email protected]"
] | |
cabf127837ae582a497863c858f5c58dbb2c27b5 | ce723556a72693ee1062ff4c5fca898d5b9c739c | /AbstractionDemo1/Rectangle.java | 4db3908ea05bc532e653adaaaeba47a81b21c204 | [] | no_license | Alamgir-JUST/basic-object-oriented-programming-in-java | b4cf83f58625b40aa121ee6063f40c8c7d572dcd | 9bcbf1f04122c1f0789e39c42d7aaec5792eac05 | refs/heads/master | 2020-04-19T23:28:09.321521 | 2019-01-31T09:16:44 | 2019-01-31T09:16:44 | 168,496,612 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package AbstractionDemo1;
public class Rectangle extends Shape{
Rectangle(double a, double b) {
super(a, b);
}
void Area() {
double res = .5*a*b;
System.out.println("Rectange Area : "+res);
}
}
| [
"[email protected]"
] | |
aaa55934c3e104dda37022762882570f14153b6a | 3451e70f71472a90f1b510c0330bae7f06715bea | /app/src/main/java/com/pandehoz/viajary/NoTripFragment.java | 22f53cba912aa01740d7f11ebabc33c3053ac1f2 | [] | no_license | hybridpro/Viajary | 2c0d42da542905f47c9a9c4f5c8e153e088c38f1 | 80e02ea8c89a95e592f7d5b7f8a911662dff0523 | refs/heads/master | 2016-09-06T01:10:47.059732 | 2015-03-15T17:22:33 | 2015-03-15T17:22:33 | 32,109,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,689 | java | package com.pandehoz.viajary;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link NoTripFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link NoTripFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class NoTripFragment extends Fragment {
public NoTripFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_no_trip, container, false);
}
Button.OnClickListener mAddTripListener =
new Button.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().getSupportFragmentManager()
.beginTransaction()
.replace(R.id.sample_content_fragment,
new NewTripFragment()
).commit();
}
};
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
Button addTripBtn = (Button) view.findViewById(R.id.add_trip);
addTripBtn.setOnClickListener(mAddTripListener);
}
}
| [
"[email protected]"
] | |
3715a2d599d3eefdd81615ef1371ec81214b9f50 | b214f96566446763ce5679dd2121ea3d277a9406 | /modules/base/language-code-style-api/src/main/java/consulo/language/codeStyle/LegacyCodeStyleSettings.java | 966e6905acbc9773155dcba418819603c2f40442 | [
"Apache-2.0",
"LicenseRef-scancode-jgraph"
] | permissive | consulo/consulo | aa340d719d05ac6cbadd3f7d1226cdb678e6c84f | d784f1ef5824b944c1ee3a24a8714edfc5e2b400 | refs/heads/master | 2023-09-06T06:55:04.987216 | 2023-09-01T06:42:16 | 2023-09-01T06:42:16 | 10,116,915 | 680 | 54 | Apache-2.0 | 2023-06-05T18:28:51 | 2013-05-17T05:48:18 | Java | UTF-8 | Java | false | false | 23,931 | java | // Copyright 2000-2017 JetBrains s.r.o.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package consulo.language.codeStyle;
import consulo.language.Language;
import consulo.language.psi.PsiFile;
/**
* Contains fields which are left for compatibility with earlier versions. These fields shouldn't be used anymore. Every language must have
* its own settings which can be retrieved using {@link CodeStyleSettings#getCommonSettings(Language)} or
* {@link consulo.ide.impl.idea.application.options.CodeStyle#getLanguageSettings(PsiFile)}.
*
* @see LanguageCodeStyleSettingsProvider
*/
@SuppressWarnings("unused")
public class LegacyCodeStyleSettings extends CommonCodeStyleSettings {
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int RIGHT_MARGIN = -1;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean LINE_COMMENT_AT_FIRST_COLUMN = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean BLOCK_COMMENT_AT_FIRST_COLUMN = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean LINE_COMMENT_ADD_SPACE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean KEEP_LINE_BREAKS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean KEEP_FIRST_COLUMN_COMMENT = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean KEEP_CONTROL_STATEMENT_IN_ONE_LINE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int KEEP_BLANK_LINES_IN_DECLARATIONS = 2;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int KEEP_BLANK_LINES_IN_CODE = 2;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int KEEP_BLANK_LINES_BEFORE_RBRACE = 2;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_BEFORE_PACKAGE = 0;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AFTER_PACKAGE = 1;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_BEFORE_IMPORTS = 1;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AFTER_IMPORTS = 1;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AROUND_CLASS = 1;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AROUND_FIELD = 0;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AROUND_METHOD = 1;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_BEFORE_METHOD_BODY = 0;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AROUND_FIELD_IN_INTERFACE = 0;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AROUND_METHOD_IN_INTERFACE = 1;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AFTER_CLASS_HEADER = 0;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BLANK_LINES_AFTER_ANONYMOUS_CLASS_HEADER = 0;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean USE_FLYING_GEESE_BRACES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ELSE_ON_NEW_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean WHILE_ON_NEW_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean CATCH_ON_NEW_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean FINALLY_ON_NEW_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean INDENT_CASE_FROM_SWITCH = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean CASE_STATEMENT_ON_NEW_LINE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean INDENT_BREAK_FROM_CASE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPECIAL_ELSE_IF_TREATMENT = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_CHAINED_METHODS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_PARAMETERS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_PARAMETERS_IN_CALLS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_RESOURCES = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_FOR = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_BINARY_OPERATION = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_ASSIGNMENT = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_TERNARY_OPERATION = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_THROWS_LIST = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_THROWS_KEYWORD = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_EXTENDS_LIST = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_METHOD_BRACKETS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_PARENTHESIZED_EXPRESSION = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_GROUP_FIELD_DECLARATIONS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_CONSECUTIVE_VARIABLE_DECLARATIONS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ALIGN_SUBSEQUENT_SIMPLE_METHODS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_ASSIGNMENT_OPERATORS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_LOGICAL_OPERATORS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_EQUALITY_OPERATORS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_RELATIONAL_OPERATORS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_BITWISE_OPERATORS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_ADDITIVE_OPERATORS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_MULTIPLICATIVE_OPERATORS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_SHIFT_OPERATORS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_UNARY_OPERATOR = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_LAMBDA_ARROW = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AROUND_METHOD_REF_DBL_COLON = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AFTER_COMMA = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AFTER_COMMA_IN_TYPE_ARGUMENTS = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_COMMA = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AFTER_SEMICOLON = true; // in for-statement
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_SEMICOLON = false; // in for-statement
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_METHOD_CALL_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_EMPTY_METHOD_CALL_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_METHOD_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_EMPTY_METHOD_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_IF_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_WHILE_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_FOR_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_TRY_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_CATCH_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_SWITCH_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_SYNCHRONIZED_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_CAST_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_BRACKETS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_BRACES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_ARRAY_INITIALIZER_BRACES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_EMPTY_ARRAY_INITIALIZER_BRACES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AFTER_TYPE_CAST = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_METHOD_CALL_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_METHOD_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_IF_PARENTHESES = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_WHILE_PARENTHESES = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_FOR_PARENTHESES = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_TRY_PARENTHESES = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_CATCH_PARENTHESES = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_SWITCH_PARENTHESES = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_SYNCHRONIZED_PARENTHESES = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_CLASS_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_METHOD_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_IF_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_ELSE_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_WHILE_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_FOR_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_DO_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_SWITCH_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_TRY_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_CATCH_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_FINALLY_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_SYNCHRONIZED_LBRACE = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_ANNOTATION_ARRAY_INITIALIZER_LBRACE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_ELSE_KEYWORD = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_WHILE_KEYWORD = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_CATCH_KEYWORD = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_FINALLY_KEYWORD = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_QUEST = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AFTER_QUEST = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_COLON = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_AFTER_COLON = true;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_TYPE_PARAMETER_LIST = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int CALL_PARAMETERS_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean PREFER_PARAMETERS_WRAP = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean CALL_PARAMETERS_LPAREN_ON_NEXT_LINE = false; // misnamed, actually means: wrap AFTER lparen
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean CALL_PARAMETERS_RPAREN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int METHOD_PARAMETERS_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int RESOURCE_LIST_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean RESOURCE_LIST_LPAREN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean RESOURCE_LIST_RPAREN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int EXTENDS_LIST_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int THROWS_LIST_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int EXTENDS_KEYWORD_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int THROWS_KEYWORD_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int METHOD_CALL_CHAIN_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean WRAP_FIRST_METHOD_IN_CALL_CHAIN = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean PARENTHESES_EXPRESSION_LPAREN_WRAP = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean PARENTHESES_EXPRESSION_RPAREN_WRAP = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int BINARY_OPERATION_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean BINARY_OPERATION_SIGN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int TERNARY_OPERATION_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean TERNARY_OPERATION_SIGNS_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean MODIFIER_LIST_WRAP = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean KEEP_SIMPLE_METHODS_IN_ONE_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean KEEP_SIMPLE_CLASSES_IN_ONE_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int FOR_STATEMENT_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean FOR_STATEMENT_LPAREN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean FOR_STATEMENT_RPAREN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int ARRAY_INITIALIZER_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int ASSIGNMENT_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int LABELED_STATEMENT_WRAP = WRAP_ALWAYS;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean WRAP_COMMENTS = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int ASSERT_STATEMENT_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean ASSERT_STATEMENT_COLON_ON_NEXT_LINE = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int IF_BRACE_FORCE = DO_NOT_FORCE;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int DOWHILE_BRACE_FORCE = DO_NOT_FORCE;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int WHILE_BRACE_FORCE = DO_NOT_FORCE;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int FOR_BRACE_FORCE = DO_NOT_FORCE;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean WRAP_LONG_LINES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int METHOD_ANNOTATION_WRAP = WRAP_ALWAYS;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int CLASS_ANNOTATION_WRAP = WRAP_ALWAYS;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int FIELD_ANNOTATION_WRAP = WRAP_ALWAYS;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int PARAMETER_ANNOTATION_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int VARIABLE_ANNOTATION_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_BEFORE_ANOTATION_PARAMETER_LIST = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public boolean SPACE_WITHIN_ANNOTATION_PARENTHESES = false;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int ENUM_CONSTANTS_WRAP = DO_NOT_WRAP;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int FORCE_REARRANGE_MODE = REARRANGE_ACCORDIND_TO_DIALOG;
/**
* @deprecated See {@link LegacyCodeStyleSettings}
*/
@Deprecated
public int WRAP_ON_TYPING = CommonCodeStyleSettings.WrapOnTyping.DEFAULT.intValue;
public LegacyCodeStyleSettings() {
super(null);
}
}
| [
"[email protected]"
] | |
673aafb2181d208937943f2e35b01461098c4217 | 85d0389c49f660cdddf14cb7c00cfc3d3171f3c4 | /matsin-contrib/.svn/pristine/67/673aafb2181d208937943f2e35b01461098c4217.svn-base | d350970e38b1afdd23f7b928d67d92169f3c9faf | [] | no_license | anhpt204/tracnghiem_nham | 05cc10efd1cfaab54806d3408f33cfd223d8af13 | f159e63209b1aa73dc53ece36aa76e8deb086b70 | refs/heads/master | 2021-01-16T18:35:33.714347 | 2015-08-21T04:12:43 | 2015-08-21T04:12:43 | 38,027,945 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,436 | /* *********************************************************************** *
* project: org.matsim.*
* FacilitiesLoadCalculator.java.java
* *
* *********************************************************************** *
* *
* copyright : (C) 2008 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.locationchoice.facilityload;
import org.matsim.api.core.v01.Id;
import org.matsim.contrib.locationchoice.DestinationChoiceConfigGroup;
import org.matsim.core.controler.Controler;
import org.matsim.core.controler.events.AfterMobsimEvent;
import org.matsim.core.controler.events.BeforeMobsimEvent;
import org.matsim.core.controler.events.IterationEndsEvent;
import org.matsim.core.controler.events.StartupEvent;
import org.matsim.core.controler.listener.AfterMobsimListener;
import org.matsim.core.controler.listener.BeforeMobsimListener;
import org.matsim.core.controler.listener.IterationEndsListener;
import org.matsim.core.controler.listener.StartupListener;
import org.matsim.core.utils.io.IOUtils;
import org.matsim.facilities.ActivityFacilities;
import org.matsim.facilities.ActivityFacility;
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.TreeMap;
/**
* Prints statistics of facility load
*
* @author anhorni
*/
public class FacilitiesLoadCalculator implements StartupListener, BeforeMobsimListener, AfterMobsimListener, IterationEndsListener {
private EventsToFacilityLoad eventsToFacilityLoad = null;
private final TreeMap<Id, FacilityPenalty> facilityPenalties;
//--------------------------------------------------------------------------------------------------
public FacilitiesLoadCalculator(TreeMap<Id, FacilityPenalty> facilityPenalties) {
this.facilityPenalties = facilityPenalties;
}
@Override
public void notifyStartup(final StartupEvent event) {
Controler controler = event.getControler();
/*
* Scales the load of the facilities (for e.g. 10 % runs), assuming that only integers
* can be used to scale a x% scenario ((100 MOD x == 0) runs e.g. x=10%)
*/
double scaleNumberOfPersons = Double.parseDouble(controler.getConfig().findParam("locationchoice", "scaleFactor"));
this.eventsToFacilityLoad = new EventsToFacilityLoad(
controler.getScenario().getActivityFacilities(),
scaleNumberOfPersons,
this.facilityPenalties,
((DestinationChoiceConfigGroup)controler.getConfig().getModule("locationchoice"))
);
event.getControler().getEvents().addHandler(this.eventsToFacilityLoad);
}
@Override
public void notifyBeforeMobsim(BeforeMobsimEvent event) {
this.eventsToFacilityLoad.resetAll(event.getIteration());
}
@Override
public void notifyAfterMobsim(final AfterMobsimEvent event) {
this.eventsToFacilityLoad.finish();
}
/*
* At the end of an iteration the statistics of the facility load are printed and
* the load values are set to zero afterwards.
*/
@Override
public void notifyIterationEnds(IterationEndsEvent event) {
Controler controler = event.getControler();
ActivityFacilities facilities = controler.getScenario().getActivityFacilities();
if (event.getIteration() % 2 == 0) {
this.printStatistics(facilities, event.getControler().getControlerIO().getIterationPath(event.getIteration()), event.getIteration(),
this.eventsToFacilityLoad.getFacilityPenalties());
}
}
/*
* Print daily load of every facility and aggregated hourly load
*/
private void printStatistics(ActivityFacilities facilities, String iterationPath, int iteration,
TreeMap<Id, FacilityPenalty> facilityPenalties) {
try {
final String header="Facility_id\tx\ty\tNumberOfVisitorsPerDay\tAllVisitors\tCapacity\tsumPenaltyFactor\tis shopping facility";
final BufferedWriter out =
IOUtils.getBufferedWriter(iterationPath+"/"+iteration+".facFrequencies.txt");
final BufferedWriter out_summary =
IOUtils.getBufferedWriter(iterationPath+"/"+iteration+".facFrequencies_summary.txt");
out.write(header);
out.newLine();
double loadPerHourSum[] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
for (ActivityFacility facility : facilities.getFacilities().values()) {
FacilityPenalty facilityPenalty = facilityPenalties.get(facility.getId());
out.write(facility.getId().toString() + "\t"+
facility.getCoord().getX() + "\t"+
facility.getCoord().getY() + "\t"+
facilityPenalty.getFacilityLoad().getNumberOfVisitorsPerDay() + "\t" +
facilityPenalty.getFacilityLoad().getAllVisitors() + "\t" +
facilityPenalty.getCapacity() + "\t" +
facilityPenalty.getSumCapacityPenaltyFactor() + "\t");
if (facility.getActivityOptions().containsKey("shop")) {
out.write("shop");
}
else {
out.write("-");
}
out.newLine();
for (int i = 0; i < 24; i++) {
loadPerHourSum[i] += facilityPenalty.getFacilityLoad().getLoadPerHour(i);
}
}
out.flush();
out.close();
out_summary.write("Hour\tLoad");
out_summary.newLine();
for (int i = 0; i<24; i++) {
out_summary.write(i + "\t" + loadPerHourSum[i]);
out_summary.newLine();
out_summary.flush();
}
out_summary.close();
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
}
| [
"[email protected]"
] | ||
e16cc2d9cef00729ca5abfd0dc76668a57d4ba1b | 4ac54cc89928e52067b76cf839cf1cf77346e178 | /src/dejavu/Lesson13/ColorFrame.java | f682456e9699b00af5a0f629d4aac1cac6ebff80 | [] | no_license | i4igo/LearnJava-1 | 2497dfacb2e63d7139dfec3743a4ff3288889ec8 | e0cd81aa9ee4f51c373de5d9248b480c4edda1ee | refs/heads/master | 2021-01-24T15:23:53.301052 | 2016-07-19T14:55:27 | 2016-07-19T14:55:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,970 | java | package dejavu.Lesson13;
import javax.swing.*;
import javax.swing.event.ChangeListener;
import java.awt.*;
/**
* Created by dejavu on 10.07.2016.
*/
public class ColorFrame extends JFrame {
private JPanel panel;
private Slider r;
private Slider g;
private Slider b;
private Label labelR;
private Label labelG;
private Label labelB;
private Label labelHash;
private ChangeListener listenR;
private ChangeListener listenG;
private ChangeListener listenB;
private static int rColor = 128;
private static int gColor = 128;
private static int bColor = 128;
public ColorFrame(){
setTitle("Home Work Color selection");
setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE );
setSize(400, 300);
setLocation(500, 100);
panel = new JPanel();
r = new Slider();
g = new Slider();
b = new Slider();
labelR = new Label();
labelG = new Label();
labelB = new Label();
labelHash = new Label();
setLabel(labelR, "" + rColor);
setLabel(labelG, "" + gColor);
setLabel(labelB, "" + bColor);
setColors();
listenR = e -> {
Slider source = (Slider) e.getSource();
setLabel(labelR, "" + source.getValue());
rColor = source.getValue();
setColors();
};
listenG = e -> {
Slider source = (Slider) e.getSource();
setLabel(labelG, "" + source.getValue());
gColor = source.getValue();
setColors();
};
listenB = e -> {
Slider source = (Slider) e.getSource();
setLabel(labelB, "" + source.getValue());
bColor = source.getValue();
setColors();
};
r.addChangeListener(listenR);
g.addChangeListener(listenG);
b.addChangeListener(listenB);
panel.add(r);
panel.add(g);
panel.add(b);
panel.add(labelR);
panel.add(labelG);
panel.add(labelB);
panel.add(labelHash);
add(panel);
}
private void setColors() {
if(rColor > 255) rColor = 255;
if(gColor > 255) gColor = 255;
if(bColor > 255) bColor = 255;
if(rColor < 0) rColor = 0;
if(gColor < 0) gColor = 0;
if(bColor < 0) bColor = 0;
panel.setBackground( new Color( rColor, gColor, bColor) );
labelR.setBackground( Color.white );
labelG.setBackground( Color.white );
labelB.setBackground( Color.white );
labelHash.setBackground( Color.white );
setLabel(labelHash, "#"
+ Integer.toHexString(rColor)
+ Integer.toHexString(gColor)
+ Integer.toHexString(bColor) );
}
public void setLabel(JLabel label, String i) {
label.setText(i);
}
public void Show(){
setVisible(true);
}
}
| [
"[email protected]"
] | |
51a26f0a0a8d0f95fcff4865e1ec7005bbd22a3e | 3ec181de57f014603bb36b8d667a8223875f5ee8 | /jcommon/docean-plugin/docean-plugin-akka/src/main/java/com/xiaomi/mone/docean/plugin/akka/AkkaPlugin.java | dac7615601add149d59c62a3d54434f10db6c354 | [
"Apache-2.0"
] | permissive | XiaoMi/mone | 41af3b636ecabd7134b53a54c782ed59cec09b9e | 576cea4e6cb54e5bb7c37328f1cb452cda32f953 | refs/heads/master | 2023-08-31T08:47:40.632419 | 2023-08-31T08:09:35 | 2023-08-31T08:09:35 | 331,844,632 | 1,148 | 152 | Apache-2.0 | 2023-09-14T07:33:13 | 2021-01-22T05:20:18 | Java | UTF-8 | Java | false | false | 2,657 | java | /*
* Copyright 2020 Xiaomi
*
* 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.xiaomi.mone.docean.plugin.akka;
import akka.actor.*;
import akka.routing.RoundRobinPool;
import akka.util.Timeout;
import com.google.common.base.Joiner;
import com.xiaomi.youpin.docean.Ioc;
import com.xiaomi.youpin.docean.anno.DOceanPlugin;
import com.xiaomi.youpin.docean.plugin.IPlugin;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
/**
* @Author [email protected]
* @Date 2021/1/24 20:31
*/
@DOceanPlugin
@Slf4j
public class AkkaPlugin implements IPlugin {
@Getter
private ActorSystem system;
@Override
public void init(Set<? extends Class<?>> classSet, Ioc ioc) {
log.info("init akka plugin");
system = ActorSystem.create("akkaSystem");
ioc.putBean(system);
}
public void createActor(String name, int num, AbstractActor.Receive receive) {
log.info("create actor:{} {}", name, num);
IntStream.range(0, num).mapToObj(i -> {
ActorRef actor = system.actorOf(Props.create(DoceanActor.class, () -> new DoceanActor(receive)), Joiner.on("_").join(name, i));
return actor;
}).collect(Collectors.toList());
}
public void stopActor(String path, ActorContext context) {
context.stop(system.actorSelection(path)
.resolveOne(Timeout.apply(1, TimeUnit.SECONDS)).value().get().get());
}
public ActorRef createRoundRobinPool(ActorContext context, int num, String dispatcherName, String name, Class clazz, Object... parms) {
ActorRef actor = context.actorOf(new RoundRobinPool(num)
.props(Props.create(clazz, parms))
.withDispatcher(dispatcherName),
name);
log.info("createRoundRobinPool num:{} name:{} path:{}", num, name, actor.path());
return actor;
}
public static String getName(Object... params) {
return Joiner.on(":").join(params);
}
}
| [
"[email protected]"
] | |
bc8593885fb9ab1aaf8bead83fcb5e0ed6551f13 | ae6084dca9354ba40476de07e42e3dd967c20423 | /RequirementsDiscussionAnalyzer/src/main/java/org/computer/knauss/reqtDiscussion/model/Iteration.java | 4794938ac9bc1ec1079264242e8d01f9f0184820 | [] | no_license | oerich/ReqtDisc | 4830b64f3e4ba32ffa05901c0c0dbb7919eac91f | a26bc1bb7c654d9bbdd4f6264c466debc3c47409 | refs/heads/master | 2022-07-12T11:19:26.981649 | 2016-06-15T16:37:38 | 2016-06-15T16:37:38 | 4,485,352 | 0 | 4 | null | 2022-06-21T00:46:20 | 2012-05-29T17:44:12 | Java | UTF-8 | Java | false | false | 1,126 | java | package org.computer.knauss.reqtDiscussion.model;
import java.sql.Timestamp;
public class Iteration {
private String identifier;
private String title;
private String description;
private Timestamp startDate;
private Timestamp endDate;
private boolean hasDeliverables;
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Timestamp getStartDate() {
return startDate;
}
public void setStartDate(Timestamp startDate) {
this.startDate = startDate;
}
public Timestamp getEndDate() {
return endDate;
}
public void setEndDate(Timestamp endDate) {
this.endDate = endDate;
}
public boolean isHasDeliverables() {
return hasDeliverables;
}
public void setHasDeliverables(boolean hasDeliverables) {
this.hasDeliverables = hasDeliverables;
}
}
| [
"[email protected]"
] | |
b9085e0d1c0dc4945051beed9d003839fb6bcda2 | 66a1e0aeafe2fc745a86ad84233b2e4682c75e96 | /core/tests/src/org/kepler/objectmanager/ActorMetadataTest.java | e9d9145d04335017faa596562b6c6aca2610895b | [] | no_license | Elblonko/kepler | 1b1e13d1c5dfda0b7196c5c44f3aeca0ba07e688 | 48618dc2233781656e63c40f1f2b99123b8bd396 | refs/heads/master | 2021-01-10T18:25:40.356727 | 2014-08-19T03:17:59 | 2014-08-19T03:17:59 | 23,061,792 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,567 | java | package org.kepler.objectmanager;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Hashtable;
import java.util.List;
import java.util.Vector;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.kepler.build.modules.Module;
import org.kepler.build.modules.ModuleTree;
import org.kepler.util.FileUtil;
import ptolemy.kernel.util.NamedObj;
import ptolemy.kernel.util.Workspace;
import ptolemy.moml.MoMLParser;
/**
* The idea here is to run through a bunch of actors and deserialize them
* into ActorMetadata objects and see if they work.
* Also, this class tests just the MoMLParser on all momls.
*
* In order to run this test you must set your classpath to include everything
* that's in the classpath for all modules.
*
* @author Aaron Schultz
*/
public class ActorMetadataTest extends TestCase {
private final int maxLoops = 1000;
public ActorMetadataTest(String name) {
super(name);
}
/**
* Create a suite of tests to be run together
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new ActorMetadataTest("initialize"));
//suite.addTest(new ActorMetadataTest("testMomlParser"));
suite.addTest(new ActorMetadataTest("testActorMetadata"));
return suite;
}
/**
* Run an initial test that always passes to check that the test harness is
* working.
*/
public void initialize() {
assertTrue(1 == 1);
}
/**
* This test goes through all of the resources/kar directories
* and tries to parse using ActorMetadata found there through the MoMLParser.
* No errors should be found.
*/
public void testActorMetadata() {
System.out.println();
System.out.println("*************************************************");
System.out.println("testActorMetadata()");
//Vector<List<File>> momlLists = getAllMoMLs();
Vector<List<File>> momlLists = specifyMoMLs();
Hashtable<File,String> failedToParse = new Hashtable<File,String>();
int attempts = 0;
int loops = 0;
for (List<File> momlList : momlLists) {
for (File f : momlList) {
attempts++;
System.out.println();
System.out.println(f.toString());
try {
InputStream is = new FileInputStream(f);
ActorMetadata am = new ActorMetadata(is);
NamedObj obj = am.getActor();
if (obj == null) {
throw new Exception("Actor is null");
}
} catch (Exception e) {
failedToParse.put(f, e.getMessage());
}
if (loops++ >= maxLoops) break;
}
}
System.out.println("Attempted to parse " + attempts + " moml files");
handleErrors(failedToParse);
}
/**
* This test goes through all of the resources/kar directories
* and tries to run the momls found there through the MoMLParser.
* No errors should be found.
*/
public void testMomlParser() {
System.out.println();
System.out.println("*************************************************");
System.out.println("testMomlParser()");
Vector<List<File>> momlLists = getAllMoMLs();
Hashtable<File,String> failedToParse = new Hashtable<File,String>();
int attempts = 0;
int loops = 0;
for (List<File> momlList : momlLists) {
for (File f : momlList) {
attempts++;
//System.out.println(f.toString());
try {
InputStream is = new FileInputStream(f);
String momlStr = FileUtil.convertStreamToString(is);
MoMLParser parser = new MoMLParser(new Workspace());
parser.reset();
NamedObj obj = parser.parse(null, momlStr);
//System.out.println(obj.getName() + " " + obj.getClassName());
} catch (Exception e) {
failedToParse.put(f, e.getMessage());
}
if (loops++ >= maxLoops) break;
}
}
System.out.println("Attempted to parse " + attempts + " moml files");
handleErrors(failedToParse);
}
/**
* @throws java.lang.Exception
*/
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
public void tearDown() throws Exception {
}
private void handleErrors(Hashtable<File,String> failedToParse) {
if (failedToParse.size() > 0) {
System.out.println(failedToParse.size() + " momls failed to parse");
for (File f : failedToParse.keySet()) {
String err = failedToParse.get(f);
System.out.println();
System.out.println(f.toString());
System.out.println(err);
}
fail();
} else {
System.out.println("0 failures");
}
}
private Vector<List<File>> specifyMoMLs() {
Vector<List<File>> momlLists = new Vector<List<File>>();
List<File> momlList = new Vector<File>();
Vector<String> f = new Vector<String>();
//String p1 = "C:/kepler/suites/kepler/actors/resources/kar/CoreActors/";
//String p2 = "C:/Documents and Settings/Aaron/KeplerData/";
String test1 = "org/kepler/objectmanager/SomeExpression.xml";
File tf1 = FileUtil.getResourceAsFile(this, test1);
momlList.add(tf1);
// Add file paths here
//f.add( p1 + "CopyToNode.xml");
//f.add( p2 + "SomeExpression.xml");
for (String s : f) {
momlList.add(new File(s));
}
momlLists.add(momlList);
return momlLists;
}
private Vector<List<File>> getAllMoMLs() {
ModuleTree moduleTree = ModuleTree.instance();
Vector<List<File>> momlLists = new Vector<List<File>>();
for (Module m : moduleTree.getModuleList()) {
if (m != null) {
System.out.println(m.getName());
List<File> momls = getMoMLsForModule(m);
if (momls.size() > 0) {
System.out.println(momls.size() + " momls found");
momlLists.add(momls);
}
} else {
System.out.println("null");
}
}
return momlLists;
}
private List<File> getMoMLsForModule(Module mod) {
Vector<File> files = new Vector<File>();
File resDir = mod.getKarResourcesDir();
if (!resDir.exists()) return files;
String[] dirs = resDir.list();
for (int i = 0; i < dirs.length; i++) {
String dir = dirs[i];
File karDir = new File(resDir,dir);
if (!karDir.exists()) return files;
if (karDir.isDirectory()) {
String[] xmls = karDir.list();
for (int j = 0; j < xmls.length; j++) {
String xml = xmls[j];
File xmlFile = new File(karDir,xml);
if (!xmlFile.exists()) return files;
if (isMoml(xmlFile)) {
files.add(xmlFile);
}
}
}
}
return files;
}
private boolean isMoml(File f) {
boolean isMoml = false;
String fs = f.toString();
String fsLC = fs.toLowerCase();
if (fsLC.endsWith(".xml"))
isMoml = true;
if (fsLC.endsWith(".moml"))
isMoml = true;
return isMoml;
}
}
| [
"[email protected]"
] | |
d5665313ad28f8555f0dc52e75cf255473884239 | 8091ddb8ae8a2a6f295a50ba9e91eaefbf1d9741 | /app/src/main/java/com/example/dndeck_a6/game/PlayerRace.java | 8205d511820fcbf181e3447b7c432f2bbc3007c5 | [] | no_license | Malan-Tai/DnDeck | 2a9abed3b01a549f7df26462d5e84ea7e9daae24 | fb59264c4696e3ba66d1583f6ea8a14c4a87c370 | refs/heads/master | 2023-01-31T17:31:59.726764 | 2020-12-17T01:28:44 | 2020-12-17T01:28:44 | 320,607,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,812 | java | package com.example.dndeck_a6.game;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class PlayerRace {
public String name = "";
public int bonusStr = 0;
public int bonusDex = 0;
public int bonusCon = 0;
public int bonusInt = 0;
public int bonusWis = 0;
public int bonusCha = 0;
public JSONObject json;
public PlayerRace(String n) { name = n; }
public PlayerRace(JSONObject json){
try{
name = json.getString("name");
JSONArray bonuses = json.getJSONArray("ability_bonuses");
for (int i = 0; i < bonuses.length(); i++){
JSONObject jsonBonus = bonuses.getJSONObject(i);
String attr = jsonBonus.getJSONObject("ability_score").getString("name");
int bonus = jsonBonus.getInt("bonus");
switch (attr){
case "STR":
bonusStr = bonus;
break;
case "DEX":
bonusDex = bonus;
break;
case "CON":
bonusCon = bonus;
break;
case "INT":
bonusInt = bonus;
break;
case "WIS":
bonusWis = bonus;
break;
case "CHA":
bonusCha = bonus;
break;
default:
break;
}
}
this.json = json;
}
catch (JSONException e){
Log.i("Malan", "JSONException");
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
b062a0547c3f89f97dcac44eb41d83eeb492382f | 4cc907d7d927cdf3ab3cb984c5117a15e9ac6a99 | /micor-service-provider-dept-8003/src/main/java/lcxy/springcloud/micorserviceproviderdept8003/provider/DeptProvider.java | 319afe19c9ec9f1537cee181894ee62e9cfb5596 | [] | no_license | AthyLau/SpringCloud-Dept-ParentDemo | bf6f8b6259db9ca4a2105892edab7de4bcc624d6 | 2d7d7b7d522d4f2c485a0886e84951eb7979b25a | refs/heads/master | 2020-04-23T01:35:21.373937 | 2019-03-06T03:08:19 | 2019-03-06T03:08:19 | 170,817,488 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package lcxy.springcloud.micorserviceproviderdept8003.provider;
import lcxy.springcloud.micorserviceentity.domain.po.DeptPO;
/**
* Function:
*
* @author liubing
* Date: 2018/12/29 ไธๅ11:51
* @since JDK 1.8
*/
public class DeptProvider {
public static void main(String args[]){
DeptPO dept = new DeptPO();
}
}
| [
"[email protected]"
] | |
dae943a3d41fd244401a404559cd70f8981fb3fe | 42fcf1d879cb75f08225137de5095adfdd63fa21 | /src/main/java/org/jooq/packages/AppLnmMcaReports.java | a35807bd245dcbb2ae41441530febd8f94b2d598 | [] | no_license | mpsgit/JOOQTest | e10e9c8716f2688c8bf0160407b1244f9e70e8eb | 6af2922bddc55f591e94a5a9a6efd1627747d6ad | refs/heads/master | 2021-01-10T06:11:40.862153 | 2016-02-28T09:09:34 | 2016-02-28T09:09:34 | 52,711,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,038 | java | /**
* This class is generated by jOOQ
*/
package org.jooq.packages;
import javax.annotation.Generated;
import org.jooq.Configuration;
import org.jooq.Field;
import org.jooq.Wetrn;
import org.jooq.impl.PackageImpl;
import org.jooq.packages.app_lnm_mca_reports.GetBilngLineNrData;
import org.jooq.packages.app_lnm_mca_reports.GetBilngLineNrUsage;
import org.jooq.packages.app_lnm_mca_reports.GetBrchrLineNrData;
import org.jooq.packages.app_lnm_mca_reports.GetBrchrLineNrUsage;
/**
* Convenience access to all stored procedures and functions in APP_LNM_MCA_REPORTS
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.7.2"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class AppLnmMcaReports extends PackageImpl {
private static final long serialVersionUID = -2004324794;
/**
* The reference instance of <code>WETRN.APP_LNM_MCA_REPORTS</code>
*/
public static final AppLnmMcaReports APP_LNM_MCA_REPORTS = new AppLnmMcaReports();
/**
* Call <code>WETRN.APP_LNM_MCA_REPORTS.GET_BILNG_LINE_NR_DATA</code>
*/
public static Object getBilngLineNrData(Configuration configuration, Number pClstrId, Number pLeadMrktId, String pLineNr, Number pRefOffrPerdId) {
GetBilngLineNrData f = new GetBilngLineNrData();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPRefOffrPerdId(pRefOffrPerdId);
f.execute(configuration);
return f.getReturnValue();
}
/**
* Get <code>WETRN.APP_LNM_MCA_REPORTS.GET_BILNG_LINE_NR_DATA</code> as a field.
*/
public static Field<Object> getBilngLineNrData(Number pClstrId, Number pLeadMrktId, String pLineNr, Number pRefOffrPerdId) {
GetBilngLineNrData f = new GetBilngLineNrData();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPRefOffrPerdId(pRefOffrPerdId);
return f.asField();
}
/**
* Get <code>WETRN.APP_LNM_MCA_REPORTS.GET_BILNG_LINE_NR_DATA</code> as a field.
*/
public static Field<Object> getBilngLineNrData(Field<? extends Number> pClstrId, Field<? extends Number> pLeadMrktId, Field<String> pLineNr, Field<? extends Number> pRefOffrPerdId) {
GetBilngLineNrData f = new GetBilngLineNrData();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPRefOffrPerdId(pRefOffrPerdId);
return f.asField();
}
/**
* Call <code>WETRN.APP_LNM_MCA_REPORTS.GET_BILNG_LINE_NR_USAGE</code>
*/
public static Object getBilngLineNrUsage(Configuration configuration, Number pClstrId, Number pLeadMrktId, String pLineNr, Number pMinOffrPerdId, Number pMaxOffrPerdId) {
GetBilngLineNrUsage f = new GetBilngLineNrUsage();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPMinOffrPerdId(pMinOffrPerdId);
f.setPMaxOffrPerdId(pMaxOffrPerdId);
f.execute(configuration);
return f.getReturnValue();
}
/**
* Get <code>WETRN.APP_LNM_MCA_REPORTS.GET_BILNG_LINE_NR_USAGE</code> as a field.
*/
public static Field<Object> getBilngLineNrUsage(Number pClstrId, Number pLeadMrktId, String pLineNr, Number pMinOffrPerdId, Number pMaxOffrPerdId) {
GetBilngLineNrUsage f = new GetBilngLineNrUsage();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPMinOffrPerdId(pMinOffrPerdId);
f.setPMaxOffrPerdId(pMaxOffrPerdId);
return f.asField();
}
/**
* Get <code>WETRN.APP_LNM_MCA_REPORTS.GET_BILNG_LINE_NR_USAGE</code> as a field.
*/
public static Field<Object> getBilngLineNrUsage(Field<? extends Number> pClstrId, Field<? extends Number> pLeadMrktId, Field<String> pLineNr, Field<? extends Number> pMinOffrPerdId, Field<? extends Number> pMaxOffrPerdId) {
GetBilngLineNrUsage f = new GetBilngLineNrUsage();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPMinOffrPerdId(pMinOffrPerdId);
f.setPMaxOffrPerdId(pMaxOffrPerdId);
return f.asField();
}
/**
* Call <code>WETRN.APP_LNM_MCA_REPORTS.GET_BRCHR_LINE_NR_DATA</code>
*/
public static Object getBrchrLineNrData(Configuration configuration, Number pClstrId, Number pLeadMrktId, String pLineNr, Number pRefOffrPerdId) {
GetBrchrLineNrData f = new GetBrchrLineNrData();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPRefOffrPerdId(pRefOffrPerdId);
f.execute(configuration);
return f.getReturnValue();
}
/**
* Get <code>WETRN.APP_LNM_MCA_REPORTS.GET_BRCHR_LINE_NR_DATA</code> as a field.
*/
public static Field<Object> getBrchrLineNrData(Number pClstrId, Number pLeadMrktId, String pLineNr, Number pRefOffrPerdId) {
GetBrchrLineNrData f = new GetBrchrLineNrData();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPRefOffrPerdId(pRefOffrPerdId);
return f.asField();
}
/**
* Get <code>WETRN.APP_LNM_MCA_REPORTS.GET_BRCHR_LINE_NR_DATA</code> as a field.
*/
public static Field<Object> getBrchrLineNrData(Field<? extends Number> pClstrId, Field<? extends Number> pLeadMrktId, Field<String> pLineNr, Field<? extends Number> pRefOffrPerdId) {
GetBrchrLineNrData f = new GetBrchrLineNrData();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPRefOffrPerdId(pRefOffrPerdId);
return f.asField();
}
/**
* Call <code>WETRN.APP_LNM_MCA_REPORTS.GET_BRCHR_LINE_NR_USAGE</code>
*/
public static Object getBrchrLineNrUsage(Configuration configuration, Number pClstrId, Number pLeadMrktId, String pLineNr, Number pMinOffrPerdId, Number pMaxOffrPerdId) {
GetBrchrLineNrUsage f = new GetBrchrLineNrUsage();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPMinOffrPerdId(pMinOffrPerdId);
f.setPMaxOffrPerdId(pMaxOffrPerdId);
f.execute(configuration);
return f.getReturnValue();
}
/**
* Get <code>WETRN.APP_LNM_MCA_REPORTS.GET_BRCHR_LINE_NR_USAGE</code> as a field.
*/
public static Field<Object> getBrchrLineNrUsage(Number pClstrId, Number pLeadMrktId, String pLineNr, Number pMinOffrPerdId, Number pMaxOffrPerdId) {
GetBrchrLineNrUsage f = new GetBrchrLineNrUsage();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPMinOffrPerdId(pMinOffrPerdId);
f.setPMaxOffrPerdId(pMaxOffrPerdId);
return f.asField();
}
/**
* Get <code>WETRN.APP_LNM_MCA_REPORTS.GET_BRCHR_LINE_NR_USAGE</code> as a field.
*/
public static Field<Object> getBrchrLineNrUsage(Field<? extends Number> pClstrId, Field<? extends Number> pLeadMrktId, Field<String> pLineNr, Field<? extends Number> pMinOffrPerdId, Field<? extends Number> pMaxOffrPerdId) {
GetBrchrLineNrUsage f = new GetBrchrLineNrUsage();
f.setPClstrId(pClstrId);
f.setPLeadMrktId(pLeadMrktId);
f.setPLineNr(pLineNr);
f.setPMinOffrPerdId(pMinOffrPerdId);
f.setPMaxOffrPerdId(pMaxOffrPerdId);
return f.asField();
}
/**
* No further instances allowed
*/
private AppLnmMcaReports() {
super("APP_LNM_MCA_REPORTS", Wetrn.WETRN);
}
}
| [
"[email protected]"
] | |
ba683451571f74b840873d690254ca92dc6700c8 | e83ee6a09bb186c46a6401f1d65f268db332f3a0 | /tools/stress/src/org/apache/cassandra/stress/settings/CommandCategory.java | 4372f590c91b490086309d26f7944f4fd0e80323 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | rajath26/cassandra-trunk | d5659ac2382e469b6055ff1813a692fc5cd13021 | af69a6ad80fd62fcf5c64a976046d457a0a74559 | refs/heads/master | 2021-01-25T04:08:30.528650 | 2014-09-12T22:02:11 | 2014-09-12T22:02:11 | 23,941,596 | 1 | 1 | Apache-2.0 | 2023-03-20T11:52:14 | 2014-09-12T01:02:05 | Java | UTF-8 | Java | false | false | 930 | java | package org.apache.cassandra.stress.settings;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
public enum CommandCategory
{
BASIC,
MULTI,
MIXED
}
| [
"[email protected]"
] | |
a2d17cfde216737758cf8452e2814b422c82fb88 | 3cfce1ba1a23490093a592aa7c2ec71c9082ca12 | /app/src/androidTest/java/com/sky/lamp/TestAct.java | 0e443d412addad1a65a7b37397e98b18b7f3c1f6 | [] | no_license | julian-jian/ocean-app-android | 6abe88778f0f1e462a9bef2de88eb151eb9444af | 2a4ab8147b11212fd5a207a1d32c22fb23d767ec | refs/heads/main | 2023-06-10T03:07:39.448667 | 2021-06-29T06:27:50 | 2021-06-29T06:27:50 | 381,261,507 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.sky.lamp;
import android.test.ActivityInstrumentationTestCase2;
public class TestAct extends ActivityInstrumentationTestCase2 {
public TestAct(String pkg, Class activityClass) {
super(pkg, activityClass);
}
public TestAct(Class activityClass) {
super(activityClass);
}
public void testStart() {
getActivity();
}
}
| [
"[email protected]"
] | |
cdc2e2ef19b746f477e096fb332599160be83e81 | 6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386 | /google/cloud/dataproc/v1/google-cloud-dataproc-v1-java/proto-google-cloud-dataproc-v1-java/src/main/java/com/google/cloud/dataproc/v1/AutoscalingPolicy.java | 45428399e25c8a4754bf1b87ee9f9c707953388e | [
"Apache-2.0"
] | permissive | oltoco/googleapis-gen | bf40cfad61b4217aca07068bd4922a86e3bbd2d5 | 00ca50bdde80906d6f62314ef4f7630b8cdb6e15 | refs/heads/master | 2023-07-17T22:11:47.848185 | 2021-08-29T20:39:47 | 2021-08-29T20:39:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 59,629 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/dataproc/v1/autoscaling_policies.proto
package com.google.cloud.dataproc.v1;
/**
* <pre>
* Describes an autoscaling policy for Dataproc cluster autoscaler.
* </pre>
*
* Protobuf type {@code google.cloud.dataproc.v1.AutoscalingPolicy}
*/
public final class AutoscalingPolicy extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:google.cloud.dataproc.v1.AutoscalingPolicy)
AutoscalingPolicyOrBuilder {
private static final long serialVersionUID = 0L;
// Use AutoscalingPolicy.newBuilder() to construct.
private AutoscalingPolicy(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private AutoscalingPolicy() {
id_ = "";
name_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new AutoscalingPolicy();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private AutoscalingPolicy(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 10: {
java.lang.String s = input.readStringRequireUtf8();
id_ = s;
break;
}
case 18: {
java.lang.String s = input.readStringRequireUtf8();
name_ = s;
break;
}
case 26: {
com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.Builder subBuilder = null;
if (algorithmCase_ == 3) {
subBuilder = ((com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_).toBuilder();
}
algorithm_ =
input.readMessage(com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom((com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_);
algorithm_ = subBuilder.buildPartial();
}
algorithmCase_ = 3;
break;
}
case 34: {
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder subBuilder = null;
if (workerConfig_ != null) {
subBuilder = workerConfig_.toBuilder();
}
workerConfig_ = input.readMessage(com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(workerConfig_);
workerConfig_ = subBuilder.buildPartial();
}
break;
}
case 42: {
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder subBuilder = null;
if (secondaryWorkerConfig_ != null) {
subBuilder = secondaryWorkerConfig_.toBuilder();
}
secondaryWorkerConfig_ = input.readMessage(com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.parser(), extensionRegistry);
if (subBuilder != null) {
subBuilder.mergeFrom(secondaryWorkerConfig_);
secondaryWorkerConfig_ = subBuilder.buildPartial();
}
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.cloud.dataproc.v1.AutoscalingPoliciesProto.internal_static_google_cloud_dataproc_v1_AutoscalingPolicy_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.dataproc.v1.AutoscalingPoliciesProto.internal_static_google_cloud_dataproc_v1_AutoscalingPolicy_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.dataproc.v1.AutoscalingPolicy.class, com.google.cloud.dataproc.v1.AutoscalingPolicy.Builder.class);
}
private int algorithmCase_ = 0;
private java.lang.Object algorithm_;
public enum AlgorithmCase
implements com.google.protobuf.Internal.EnumLite,
com.google.protobuf.AbstractMessage.InternalOneOfEnum {
BASIC_ALGORITHM(3),
ALGORITHM_NOT_SET(0);
private final int value;
private AlgorithmCase(int value) {
this.value = value;
}
/**
* @param value The number of the enum to look for.
* @return The enum associated with the given number.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static AlgorithmCase valueOf(int value) {
return forNumber(value);
}
public static AlgorithmCase forNumber(int value) {
switch (value) {
case 3: return BASIC_ALGORITHM;
case 0: return ALGORITHM_NOT_SET;
default: return null;
}
}
public int getNumber() {
return this.value;
}
};
public AlgorithmCase
getAlgorithmCase() {
return AlgorithmCase.forNumber(
algorithmCase_);
}
public static final int ID_FIELD_NUMBER = 1;
private volatile java.lang.Object id_;
/**
* <pre>
* Required. The policy id.
* The id must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). Cannot begin or end with underscore
* or hyphen. Must consist of between 3 and 50 characters.
* </pre>
*
* <code>string id = 1;</code>
* @return The id.
*/
@java.lang.Override
public java.lang.String getId() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
}
}
/**
* <pre>
* Required. The policy id.
* The id must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). Cannot begin or end with underscore
* or hyphen. Must consist of between 3 and 50 characters.
* </pre>
*
* <code>string id = 1;</code>
* @return The bytes for id.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int NAME_FIELD_NUMBER = 2;
private volatile java.lang.Object name_;
/**
* <pre>
* Output only. The "resource name" of the autoscaling policy, as described
* in https://cloud.google.com/apis/design/resource_names.
* * For `projects.regions.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
* * For `projects.locations.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
* </pre>
*
* <code>string name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The name.
*/
@java.lang.Override
public java.lang.String getName() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
}
}
/**
* <pre>
* Output only. The "resource name" of the autoscaling policy, as described
* in https://cloud.google.com/apis/design/resource_names.
* * For `projects.regions.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
* * For `projects.locations.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
* </pre>
*
* <code>string name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The bytes for name.
*/
@java.lang.Override
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int BASIC_ALGORITHM_FIELD_NUMBER = 3;
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
* @return Whether the basicAlgorithm field is set.
*/
@java.lang.Override
public boolean hasBasicAlgorithm() {
return algorithmCase_ == 3;
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The basicAlgorithm.
*/
@java.lang.Override
public com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm getBasicAlgorithm() {
if (algorithmCase_ == 3) {
return (com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_;
}
return com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.getDefaultInstance();
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
*/
@java.lang.Override
public com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithmOrBuilder getBasicAlgorithmOrBuilder() {
if (algorithmCase_ == 3) {
return (com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_;
}
return com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.getDefaultInstance();
}
public static final int WORKER_CONFIG_FIELD_NUMBER = 4;
private com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig workerConfig_;
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
* @return Whether the workerConfig field is set.
*/
@java.lang.Override
public boolean hasWorkerConfig() {
return workerConfig_ != null;
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The workerConfig.
*/
@java.lang.Override
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig getWorkerConfig() {
return workerConfig_ == null ? com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.getDefaultInstance() : workerConfig_;
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
*/
@java.lang.Override
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder getWorkerConfigOrBuilder() {
return getWorkerConfig();
}
public static final int SECONDARY_WORKER_CONFIG_FIELD_NUMBER = 5;
private com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondaryWorkerConfig_;
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return Whether the secondaryWorkerConfig field is set.
*/
@java.lang.Override
public boolean hasSecondaryWorkerConfig() {
return secondaryWorkerConfig_ != null;
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return The secondaryWorkerConfig.
*/
@java.lang.Override
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig getSecondaryWorkerConfig() {
return secondaryWorkerConfig_ == null ? com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.getDefaultInstance() : secondaryWorkerConfig_;
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
@java.lang.Override
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder getSecondaryWorkerConfigOrBuilder() {
return getSecondaryWorkerConfig();
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (!getIdBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_);
}
if (!getNameBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_);
}
if (algorithmCase_ == 3) {
output.writeMessage(3, (com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_);
}
if (workerConfig_ != null) {
output.writeMessage(4, getWorkerConfig());
}
if (secondaryWorkerConfig_ != null) {
output.writeMessage(5, getSecondaryWorkerConfig());
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!getIdBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_);
}
if (!getNameBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_);
}
if (algorithmCase_ == 3) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(3, (com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_);
}
if (workerConfig_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, getWorkerConfig());
}
if (secondaryWorkerConfig_ != null) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(5, getSecondaryWorkerConfig());
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.cloud.dataproc.v1.AutoscalingPolicy)) {
return super.equals(obj);
}
com.google.cloud.dataproc.v1.AutoscalingPolicy other = (com.google.cloud.dataproc.v1.AutoscalingPolicy) obj;
if (!getId()
.equals(other.getId())) return false;
if (!getName()
.equals(other.getName())) return false;
if (hasWorkerConfig() != other.hasWorkerConfig()) return false;
if (hasWorkerConfig()) {
if (!getWorkerConfig()
.equals(other.getWorkerConfig())) return false;
}
if (hasSecondaryWorkerConfig() != other.hasSecondaryWorkerConfig()) return false;
if (hasSecondaryWorkerConfig()) {
if (!getSecondaryWorkerConfig()
.equals(other.getSecondaryWorkerConfig())) return false;
}
if (!getAlgorithmCase().equals(other.getAlgorithmCase())) return false;
switch (algorithmCase_) {
case 3:
if (!getBasicAlgorithm()
.equals(other.getBasicAlgorithm())) return false;
break;
case 0:
default:
}
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + getId().hashCode();
hash = (37 * hash) + NAME_FIELD_NUMBER;
hash = (53 * hash) + getName().hashCode();
if (hasWorkerConfig()) {
hash = (37 * hash) + WORKER_CONFIG_FIELD_NUMBER;
hash = (53 * hash) + getWorkerConfig().hashCode();
}
if (hasSecondaryWorkerConfig()) {
hash = (37 * hash) + SECONDARY_WORKER_CONFIG_FIELD_NUMBER;
hash = (53 * hash) + getSecondaryWorkerConfig().hashCode();
}
switch (algorithmCase_) {
case 3:
hash = (37 * hash) + BASIC_ALGORITHM_FIELD_NUMBER;
hash = (53 * hash) + getBasicAlgorithm().hashCode();
break;
case 0:
default:
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(com.google.cloud.dataproc.v1.AutoscalingPolicy prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* <pre>
* Describes an autoscaling policy for Dataproc cluster autoscaler.
* </pre>
*
* Protobuf type {@code google.cloud.dataproc.v1.AutoscalingPolicy}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:google.cloud.dataproc.v1.AutoscalingPolicy)
com.google.cloud.dataproc.v1.AutoscalingPolicyOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return com.google.cloud.dataproc.v1.AutoscalingPoliciesProto.internal_static_google_cloud_dataproc_v1_AutoscalingPolicy_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.dataproc.v1.AutoscalingPoliciesProto.internal_static_google_cloud_dataproc_v1_AutoscalingPolicy_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.dataproc.v1.AutoscalingPolicy.class, com.google.cloud.dataproc.v1.AutoscalingPolicy.Builder.class);
}
// Construct using com.google.cloud.dataproc.v1.AutoscalingPolicy.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
}
}
@java.lang.Override
public Builder clear() {
super.clear();
id_ = "";
name_ = "";
if (workerConfigBuilder_ == null) {
workerConfig_ = null;
} else {
workerConfig_ = null;
workerConfigBuilder_ = null;
}
if (secondaryWorkerConfigBuilder_ == null) {
secondaryWorkerConfig_ = null;
} else {
secondaryWorkerConfig_ = null;
secondaryWorkerConfigBuilder_ = null;
}
algorithmCase_ = 0;
algorithm_ = null;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return com.google.cloud.dataproc.v1.AutoscalingPoliciesProto.internal_static_google_cloud_dataproc_v1_AutoscalingPolicy_descriptor;
}
@java.lang.Override
public com.google.cloud.dataproc.v1.AutoscalingPolicy getDefaultInstanceForType() {
return com.google.cloud.dataproc.v1.AutoscalingPolicy.getDefaultInstance();
}
@java.lang.Override
public com.google.cloud.dataproc.v1.AutoscalingPolicy build() {
com.google.cloud.dataproc.v1.AutoscalingPolicy result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.cloud.dataproc.v1.AutoscalingPolicy buildPartial() {
com.google.cloud.dataproc.v1.AutoscalingPolicy result = new com.google.cloud.dataproc.v1.AutoscalingPolicy(this);
result.id_ = id_;
result.name_ = name_;
if (algorithmCase_ == 3) {
if (basicAlgorithmBuilder_ == null) {
result.algorithm_ = algorithm_;
} else {
result.algorithm_ = basicAlgorithmBuilder_.build();
}
}
if (workerConfigBuilder_ == null) {
result.workerConfig_ = workerConfig_;
} else {
result.workerConfig_ = workerConfigBuilder_.build();
}
if (secondaryWorkerConfigBuilder_ == null) {
result.secondaryWorkerConfig_ = secondaryWorkerConfig_;
} else {
result.secondaryWorkerConfig_ = secondaryWorkerConfigBuilder_.build();
}
result.algorithmCase_ = algorithmCase_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.cloud.dataproc.v1.AutoscalingPolicy) {
return mergeFrom((com.google.cloud.dataproc.v1.AutoscalingPolicy)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.dataproc.v1.AutoscalingPolicy other) {
if (other == com.google.cloud.dataproc.v1.AutoscalingPolicy.getDefaultInstance()) return this;
if (!other.getId().isEmpty()) {
id_ = other.id_;
onChanged();
}
if (!other.getName().isEmpty()) {
name_ = other.name_;
onChanged();
}
if (other.hasWorkerConfig()) {
mergeWorkerConfig(other.getWorkerConfig());
}
if (other.hasSecondaryWorkerConfig()) {
mergeSecondaryWorkerConfig(other.getSecondaryWorkerConfig());
}
switch (other.getAlgorithmCase()) {
case BASIC_ALGORITHM: {
mergeBasicAlgorithm(other.getBasicAlgorithm());
break;
}
case ALGORITHM_NOT_SET: {
break;
}
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.cloud.dataproc.v1.AutoscalingPolicy parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (com.google.cloud.dataproc.v1.AutoscalingPolicy) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int algorithmCase_ = 0;
private java.lang.Object algorithm_;
public AlgorithmCase
getAlgorithmCase() {
return AlgorithmCase.forNumber(
algorithmCase_);
}
public Builder clearAlgorithm() {
algorithmCase_ = 0;
algorithm_ = null;
onChanged();
return this;
}
private java.lang.Object id_ = "";
/**
* <pre>
* Required. The policy id.
* The id must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). Cannot begin or end with underscore
* or hyphen. Must consist of between 3 and 50 characters.
* </pre>
*
* <code>string id = 1;</code>
* @return The id.
*/
public java.lang.String getId() {
java.lang.Object ref = id_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
id_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* Required. The policy id.
* The id must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). Cannot begin or end with underscore
* or hyphen. Must consist of between 3 and 50 characters.
* </pre>
*
* <code>string id = 1;</code>
* @return The bytes for id.
*/
public com.google.protobuf.ByteString
getIdBytes() {
java.lang.Object ref = id_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
id_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* Required. The policy id.
* The id must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). Cannot begin or end with underscore
* or hyphen. Must consist of between 3 and 50 characters.
* </pre>
*
* <code>string id = 1;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
id_ = value;
onChanged();
return this;
}
/**
* <pre>
* Required. The policy id.
* The id must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). Cannot begin or end with underscore
* or hyphen. Must consist of between 3 and 50 characters.
* </pre>
*
* <code>string id = 1;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = getDefaultInstance().getId();
onChanged();
return this;
}
/**
* <pre>
* Required. The policy id.
* The id must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). Cannot begin or end with underscore
* or hyphen. Must consist of between 3 and 50 characters.
* </pre>
*
* <code>string id = 1;</code>
* @param value The bytes for id to set.
* @return This builder for chaining.
*/
public Builder setIdBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
id_ = value;
onChanged();
return this;
}
private java.lang.Object name_ = "";
/**
* <pre>
* Output only. The "resource name" of the autoscaling policy, as described
* in https://cloud.google.com/apis/design/resource_names.
* * For `projects.regions.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
* * For `projects.locations.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
* </pre>
*
* <code>string name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The name.
*/
public java.lang.String getName() {
java.lang.Object ref = name_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
name_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
* <pre>
* Output only. The "resource name" of the autoscaling policy, as described
* in https://cloud.google.com/apis/design/resource_names.
* * For `projects.regions.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
* * For `projects.locations.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
* </pre>
*
* <code>string name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return The bytes for name.
*/
public com.google.protobuf.ByteString
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
* <pre>
* Output only. The "resource name" of the autoscaling policy, as described
* in https://cloud.google.com/apis/design/resource_names.
* * For `projects.regions.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
* * For `projects.locations.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
* </pre>
*
* <code>string name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @param value The name to set.
* @return This builder for chaining.
*/
public Builder setName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
name_ = value;
onChanged();
return this;
}
/**
* <pre>
* Output only. The "resource name" of the autoscaling policy, as described
* in https://cloud.google.com/apis/design/resource_names.
* * For `projects.regions.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
* * For `projects.locations.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
* </pre>
*
* <code>string name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @return This builder for chaining.
*/
public Builder clearName() {
name_ = getDefaultInstance().getName();
onChanged();
return this;
}
/**
* <pre>
* Output only. The "resource name" of the autoscaling policy, as described
* in https://cloud.google.com/apis/design/resource_names.
* * For `projects.regions.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/regions/{region}/autoscalingPolicies/{policy_id}`
* * For `projects.locations.autoscalingPolicies`, the resource name of the
* policy has the following format:
* `projects/{project_id}/locations/{location}/autoscalingPolicies/{policy_id}`
* </pre>
*
* <code>string name = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code>
* @param value The bytes for name to set.
* @return This builder for chaining.
*/
public Builder setNameBytes(
com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
name_ = value;
onChanged();
return this;
}
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm, com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.Builder, com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithmOrBuilder> basicAlgorithmBuilder_;
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
* @return Whether the basicAlgorithm field is set.
*/
@java.lang.Override
public boolean hasBasicAlgorithm() {
return algorithmCase_ == 3;
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The basicAlgorithm.
*/
@java.lang.Override
public com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm getBasicAlgorithm() {
if (basicAlgorithmBuilder_ == null) {
if (algorithmCase_ == 3) {
return (com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_;
}
return com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.getDefaultInstance();
} else {
if (algorithmCase_ == 3) {
return basicAlgorithmBuilder_.getMessage();
}
return com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.getDefaultInstance();
}
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder setBasicAlgorithm(com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm value) {
if (basicAlgorithmBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
algorithm_ = value;
onChanged();
} else {
basicAlgorithmBuilder_.setMessage(value);
}
algorithmCase_ = 3;
return this;
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder setBasicAlgorithm(
com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.Builder builderForValue) {
if (basicAlgorithmBuilder_ == null) {
algorithm_ = builderForValue.build();
onChanged();
} else {
basicAlgorithmBuilder_.setMessage(builderForValue.build());
}
algorithmCase_ = 3;
return this;
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder mergeBasicAlgorithm(com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm value) {
if (basicAlgorithmBuilder_ == null) {
if (algorithmCase_ == 3 &&
algorithm_ != com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.getDefaultInstance()) {
algorithm_ = com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.newBuilder((com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_)
.mergeFrom(value).buildPartial();
} else {
algorithm_ = value;
}
onChanged();
} else {
if (algorithmCase_ == 3) {
basicAlgorithmBuilder_.mergeFrom(value);
}
basicAlgorithmBuilder_.setMessage(value);
}
algorithmCase_ = 3;
return this;
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder clearBasicAlgorithm() {
if (basicAlgorithmBuilder_ == null) {
if (algorithmCase_ == 3) {
algorithmCase_ = 0;
algorithm_ = null;
onChanged();
}
} else {
if (algorithmCase_ == 3) {
algorithmCase_ = 0;
algorithm_ = null;
}
basicAlgorithmBuilder_.clear();
}
return this;
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.Builder getBasicAlgorithmBuilder() {
return getBasicAlgorithmFieldBuilder().getBuilder();
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
*/
@java.lang.Override
public com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithmOrBuilder getBasicAlgorithmOrBuilder() {
if ((algorithmCase_ == 3) && (basicAlgorithmBuilder_ != null)) {
return basicAlgorithmBuilder_.getMessageOrBuilder();
} else {
if (algorithmCase_ == 3) {
return (com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_;
}
return com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.getDefaultInstance();
}
}
/**
* <code>.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm basic_algorithm = 3 [(.google.api.field_behavior) = REQUIRED];</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm, com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.Builder, com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithmOrBuilder>
getBasicAlgorithmFieldBuilder() {
if (basicAlgorithmBuilder_ == null) {
if (!(algorithmCase_ == 3)) {
algorithm_ = com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.getDefaultInstance();
}
basicAlgorithmBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm, com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm.Builder, com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithmOrBuilder>(
(com.google.cloud.dataproc.v1.BasicAutoscalingAlgorithm) algorithm_,
getParentForChildren(),
isClean());
algorithm_ = null;
}
algorithmCase_ = 3;
onChanged();;
return basicAlgorithmBuilder_;
}
private com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig workerConfig_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder> workerConfigBuilder_;
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
* @return Whether the workerConfig field is set.
*/
public boolean hasWorkerConfig() {
return workerConfigBuilder_ != null || workerConfig_ != null;
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
* @return The workerConfig.
*/
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig getWorkerConfig() {
if (workerConfigBuilder_ == null) {
return workerConfig_ == null ? com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.getDefaultInstance() : workerConfig_;
} else {
return workerConfigBuilder_.getMessage();
}
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder setWorkerConfig(com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig value) {
if (workerConfigBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
workerConfig_ = value;
onChanged();
} else {
workerConfigBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder setWorkerConfig(
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder builderForValue) {
if (workerConfigBuilder_ == null) {
workerConfig_ = builderForValue.build();
onChanged();
} else {
workerConfigBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder mergeWorkerConfig(com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig value) {
if (workerConfigBuilder_ == null) {
if (workerConfig_ != null) {
workerConfig_ =
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.newBuilder(workerConfig_).mergeFrom(value).buildPartial();
} else {
workerConfig_ = value;
}
onChanged();
} else {
workerConfigBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public Builder clearWorkerConfig() {
if (workerConfigBuilder_ == null) {
workerConfig_ = null;
onChanged();
} else {
workerConfig_ = null;
workerConfigBuilder_ = null;
}
return this;
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder getWorkerConfigBuilder() {
onChanged();
return getWorkerConfigFieldBuilder().getBuilder();
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
*/
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder getWorkerConfigOrBuilder() {
if (workerConfigBuilder_ != null) {
return workerConfigBuilder_.getMessageOrBuilder();
} else {
return workerConfig_ == null ?
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.getDefaultInstance() : workerConfig_;
}
}
/**
* <pre>
* Required. Describes how the autoscaler will operate for primary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig worker_config = 4 [(.google.api.field_behavior) = REQUIRED];</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder>
getWorkerConfigFieldBuilder() {
if (workerConfigBuilder_ == null) {
workerConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder>(
getWorkerConfig(),
getParentForChildren(),
isClean());
workerConfig_ = null;
}
return workerConfigBuilder_;
}
private com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondaryWorkerConfig_;
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder> secondaryWorkerConfigBuilder_;
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return Whether the secondaryWorkerConfig field is set.
*/
public boolean hasSecondaryWorkerConfig() {
return secondaryWorkerConfigBuilder_ != null || secondaryWorkerConfig_ != null;
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
* @return The secondaryWorkerConfig.
*/
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig getSecondaryWorkerConfig() {
if (secondaryWorkerConfigBuilder_ == null) {
return secondaryWorkerConfig_ == null ? com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.getDefaultInstance() : secondaryWorkerConfig_;
} else {
return secondaryWorkerConfigBuilder_.getMessage();
}
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
public Builder setSecondaryWorkerConfig(com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig value) {
if (secondaryWorkerConfigBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
secondaryWorkerConfig_ = value;
onChanged();
} else {
secondaryWorkerConfigBuilder_.setMessage(value);
}
return this;
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
public Builder setSecondaryWorkerConfig(
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder builderForValue) {
if (secondaryWorkerConfigBuilder_ == null) {
secondaryWorkerConfig_ = builderForValue.build();
onChanged();
} else {
secondaryWorkerConfigBuilder_.setMessage(builderForValue.build());
}
return this;
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
public Builder mergeSecondaryWorkerConfig(com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig value) {
if (secondaryWorkerConfigBuilder_ == null) {
if (secondaryWorkerConfig_ != null) {
secondaryWorkerConfig_ =
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.newBuilder(secondaryWorkerConfig_).mergeFrom(value).buildPartial();
} else {
secondaryWorkerConfig_ = value;
}
onChanged();
} else {
secondaryWorkerConfigBuilder_.mergeFrom(value);
}
return this;
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
public Builder clearSecondaryWorkerConfig() {
if (secondaryWorkerConfigBuilder_ == null) {
secondaryWorkerConfig_ = null;
onChanged();
} else {
secondaryWorkerConfig_ = null;
secondaryWorkerConfigBuilder_ = null;
}
return this;
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder getSecondaryWorkerConfigBuilder() {
onChanged();
return getSecondaryWorkerConfigFieldBuilder().getBuilder();
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
public com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder getSecondaryWorkerConfigOrBuilder() {
if (secondaryWorkerConfigBuilder_ != null) {
return secondaryWorkerConfigBuilder_.getMessageOrBuilder();
} else {
return secondaryWorkerConfig_ == null ?
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.getDefaultInstance() : secondaryWorkerConfig_;
}
}
/**
* <pre>
* Optional. Describes how the autoscaler will operate for secondary workers.
* </pre>
*
* <code>.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig secondary_worker_config = 5 [(.google.api.field_behavior) = OPTIONAL];</code>
*/
private com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder>
getSecondaryWorkerConfigFieldBuilder() {
if (secondaryWorkerConfigBuilder_ == null) {
secondaryWorkerConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3<
com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfig.Builder, com.google.cloud.dataproc.v1.InstanceGroupAutoscalingPolicyConfigOrBuilder>(
getSecondaryWorkerConfig(),
getParentForChildren(),
isClean());
secondaryWorkerConfig_ = null;
}
return secondaryWorkerConfigBuilder_;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.cloud.dataproc.v1.AutoscalingPolicy)
}
// @@protoc_insertion_point(class_scope:google.cloud.dataproc.v1.AutoscalingPolicy)
private static final com.google.cloud.dataproc.v1.AutoscalingPolicy DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.dataproc.v1.AutoscalingPolicy();
}
public static com.google.cloud.dataproc.v1.AutoscalingPolicy getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<AutoscalingPolicy>
PARSER = new com.google.protobuf.AbstractParser<AutoscalingPolicy>() {
@java.lang.Override
public AutoscalingPolicy parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new AutoscalingPolicy(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<AutoscalingPolicy> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<AutoscalingPolicy> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.cloud.dataproc.v1.AutoscalingPolicy getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| [
"bazel-bot-development[bot]@users.noreply.github.com"
] | bazel-bot-development[bot]@users.noreply.github.com |
3a766858217842a4c6410bde74b606d22eb4e187 | 4304cce8b141d41da26707d8194b8eec838df274 | /src/main/java/MysqlTest.java | a03dcc0396cb40975aeb88be414bc0f8ecd88818 | [] | no_license | villcore/learn-java | b89600e9e599483f8cde4290b81ce4415ba66080 | cf64e1aeebc75edd73850603ed761348b27177ab | refs/heads/master | 2021-01-11T20:22:03.571192 | 2017-12-17T02:33:04 | 2017-12-17T02:33:04 | 76,608,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 254 | java | /**
* Created by villcore on 2017/2/21.
*/
public class MysqlTest {
public static void main(String[] args) {
// Class.forName("");
// DriverManager.getConnection("");
// System.out.println(Reflection.getCallerClass());
}
}
| [
"[email protected]"
] | |
0a8c05adaf3b5741907205525fe5795a34293b06 | 233defe8ea08a3a6585caba671e8c3cc0fc286f8 | /src/ast/BoolIn.java | b33f59004c7b3d9a692aa9b1831c9ffd8e8b0fb5 | [] | no_license | rdspring1/potion | eb51827892a95ddb2637d8707131d57db5d609cb | 9d5966148e88ff27b205d6a8b3262c279da6c344 | refs/heads/master | 2021-01-18T14:38:24.128879 | 2013-05-02T17:02:44 | 2013-05-02T17:02:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | package ast;
import visitor.AstVisitor;
public class BoolIn extends Exp
{
public Identifier id;
public Exp exp;
public BoolIn(Identifier id,Exp exp)
{
this.id = id;
this.exp = exp;
}
public void visit(AstVisitor vis)
{
vis.accept(this);
}
}
| [
"[email protected]"
] | |
4f6aa7e1310e4d720120c35847e75f93245d0f2c | 5e3235edf3de262f4d10b9e9e1fcc3bd13d6b8b1 | /Code Snippet Repository/Spring/Spring4248.java | 30eccecb5e6705756b7b0e2a45e0510af0a7d080 | [] | no_license | saber13812002/DeepCRM | 3336a244d4852a364800af3181e03e868cf6f9f5 | be3e5e50e34a042d5ba7259ff5ff75c08ab32bb9 | refs/heads/master | 2023-03-16T00:08:06.473699 | 2018-04-18T05:29:50 | 2018-04-18T05:29:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,106 | java | public static TypePath fromString(final String typePath) {
if (typePath == null || typePath.length() == 0) {
return null;
}
int n = typePath.length();
ByteVector out = new ByteVector(n);
out.putByte(0);
for (int i = 0; i < n;) {
char c = typePath.charAt(i++);
if (c == '[') {
out.put11(ARRAY_ELEMENT, 0);
} else if (c == '.') {
out.put11(INNER_TYPE, 0);
} else if (c == '*') {
out.put11(WILDCARD_BOUND, 0);
} else if (c >= '0' && c <= '9') {
int typeArg = c - '0';
while (i < n && (c = typePath.charAt(i)) >= '0' && c <= '9') {
typeArg = typeArg * 10 + c - '0';
i += 1;
}
if (i < n && typePath.charAt(i) == ';') {
i += 1;
}
out.put11(TYPE_ARGUMENT, typeArg);
}
}
out.data[0] = (byte) (out.length / 2);
return new TypePath(out.data, 0);
}
| [
"[email protected]"
] | |
d6b2c7f16b9f54210b59b19b8d7f8420e20644a4 | aab429ca8e813766b0f589a699278741746b2bb1 | /src/umlgui/UMLGUI.java | 0c8518b528db016b82ed48152e96f350f14bbd6b | [] | no_license | oRANGE-CSCITeam/UML-Editor | 3d7f50279f95530e48a5c08ba10bf8848515a015 | 1c40a5d1593b460fb4a0295a5aeafbeedecc8a35 | refs/heads/master | 2020-05-23T15:37:04.188044 | 2014-02-27T03:38:15 | 2014-02-27T03:38:15 | 16,494,536 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 485 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package umlgui;
/**
*
* @author eddy30
*/
public class UMLGUI {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
// TODO add your handling code here:
}
}
| [
"[email protected]"
] | |
ea4ca7434af4c95b6712001d6087c98ed5194e81 | 97a76e59f512e04b84e38eaa6660ed29731ea61f | /Mk8/Enums/OpTypes/BinNumNumOp.java | af2993161925b498e09cda9d4a8ad7c34f8aafb6 | [] | no_license | MechaGent/GeneticProgrammer | dce55e43cfcfd55891c33edc6ae0af11c9a50bd0 | f32d5d33975010d160d275aae3ca1830fee58719 | refs/heads/master | 2021-01-11T13:56:55.082418 | 2017-06-20T15:33:55 | 2017-06-20T15:33:55 | 94,907,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,445 | java | package EnemyLevelScaling.GeneticProgrammer.Mk8.Enums.OpTypes;
import EnemyLevelScaling.GeneticProgrammer.Mk8.Nodes.AbstractClasses.BaseNode;
import EnemyLevelScaling.GeneticProgrammer.Mk8.Autobots.ConstantAutobot;
import EnemyLevelScaling.GeneticProgrammer.Mk8.Enums.OutputMode;
public enum BinNumNumOp
{
Add("+"), Sub("-"), Mult("*"), Div("/"), Pow("^"), Mod("%");
private String OperatorSymbol;
private static BinNumNumOp[] All = values();
private BinNumNumOp(String in)
{
this.OperatorSymbol = in;
}
public String getOperatorSymbol()
{
return OperatorSymbol;
}
public static BinNumNumOp getEnumAtIndex(int in)
{
return All[in];
}
public static int getNumOps()
{
return All.length;
}
public StringBuilder toStringBuilder(BaseNode var1, BaseNode var2, OutputMode in)
{
StringBuilder result = new StringBuilder();
switch (this)
{
case Add:
case Div:
case Mod:
case Mult:
case Sub:
{
result.append("(");
result.append(var1.toStringBuilder(in));
result.append(" " + this.toString() + " ");
result.append(var2.toStringBuilder(in));
result.append(")");
break;
}
case Pow:
default:
{
result.append(this.toString());
result.append("(");
result.append(var1.toStringBuilder(in));
result.append(ConstantAutobot.getArgDelimiter());
result.append(var1.toStringBuilder(in));
result.append(")");
break;
}
}
return result;
}
}
| [
"[email protected]"
] | |
dacf31ba6ac31a951a5ee7c9fdc3b341919d659f | f1d77651d686ebeb77b54f321619ee9869f3f70d | /Sub-task 2/implementation/mscf/src/parsers/Marshaller.java | 78372f02482337efa13229e8dbdc7455988d749b | [] | no_license | NemanjaSrdanovic/P2P-Microservices | b4e42e33239714ff531f06bcfbd87411712c2b25 | 41d22c0f6bf4f8c8205f7381649bf7e877380d6a | refs/heads/master | 2023-07-30T16:43:42.678518 | 2021-09-20T21:32:04 | 2021-09-20T21:32:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,380 | java | package parsers;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.DatagramPacket;
import java.net.InetAddress;
public class Marshaller {
private byte[] sendBuff;
private ByteArrayOutputStream bs;
private ByteArrayInputStream bis;
private ObjectInputStream ois;
private ObjectOutputStream oos;
private Object object;
private InetAddress ipHost;
public Marshaller() {}
public Marshaller(InetAddress address) {
this.ipHost = address;
}
public synchronized DatagramPacket makeDatagramPacket(Object obj, byte[] buffer, String ipPort) {
try {
bs = new ByteArrayOutputStream(buffer.length);
oos = new ObjectOutputStream(bs);
// oos.flush();
oos.writeObject(obj);
oos.flush();
byte[] sendBuf = bs.toByteArray();
oos.close();
bs.close();
return new DatagramPacket(sendBuf, sendBuf.length, InetAddress.getByName(ipPort.split(":")[0])
, Integer.parseUnsignedInt(ipPort.split(":")[1]));
} catch (IOException e) {
System.out.println("Error Marshaller Making DataPacket <---------------");
e.printStackTrace();
}finally {
}
return null;
}
public synchronized DatagramPacket makeDatagramPacketFrom(Object obj, byte[] buffer, int portHost) throws IOException {
try {
bs = new ByteArrayOutputStream(buffer.length);
oos = new ObjectOutputStream(bs);
// oos.flush();
oos.writeObject(obj);
oos.flush();
byte[] sendBuf = bs.toByteArray();
oos.close();
bs.close();
return new DatagramPacket(sendBuf, sendBuf.length, ipHost, portHost);
} catch (IOException e) {
System.out.println("Error Marshaller Making DataPacket <---------------");
e.printStackTrace();
}finally {
}
return null;
}
public synchronized Object makeObjectFrom(DatagramPacket packet) {
try {
bis = new ByteArrayInputStream(packet.getData());
ois = new ObjectInputStream(/*new BufferedInputStream(bis)*/ bis);
object = (Object) ois.readObject();
ois.close();
return object;
} catch (IOException e) {
System.out.println("Error Marsahller IO <----------------");
e.printStackTrace();
} catch (ClassNotFoundException e) {
System.out.println("Error Marshaller CLASS <-----------------");
e.printStackTrace();
}
return null;
}
/*Transforms object to byte to be stored into an database
* together with the rest of the message informations*/
public synchronized byte[] transformObjectToByte(Object obj) {
byte[] byteArrayObject = null;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
byteArrayObject = bos.toByteArray();
oos.close();
bos.close();
} catch (Exception e) {
System.out.println("Error Marshaller Making Byte <---------------");
e.printStackTrace();
return byteArrayObject;
}
return byteArrayObject;
}
public synchronized Object transformByteToObject(byte[] byteInput) {
Object obj = null;
ByteArrayInputStream bais;
ObjectInputStream ins;
try {
bais = new ByteArrayInputStream(byteInput);
ins = new ObjectInputStream(bais);
obj =(Object)ins.readObject();
ins.close();
}
catch (Exception e) {
System.out.println("Error Marshaller Making Object <---------------");
e.printStackTrace();
}
return obj;
}
} | [
"[email protected]"
] | |
50ead17e1e16e8a3db43a9948ec5be831400eb43 | 5c778e6b63efa7f07dc58d9c1047bd183d4e99d2 | /app/src/main/java/com/wiz/emobilisproject/onBoarding/views/FlowingGradientClass.java | ed63f4f85584e7ec5833cf0f24ee759379eaa419 | [] | no_license | Samsonjoe/EmobilisProject | 31ffd9b066a914ee35b897af99faa2f6e8ba65a9 | fdee3cfbff09d66c34b00f6aa725762bc568b219 | refs/heads/master | 2020-09-30T18:17:53.394237 | 2019-12-11T11:08:19 | 2019-12-11T11:08:19 | 227,345,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,898 | java | package com.wiz.emobilisproject.onBoarding.views;
import android.graphics.drawable.AnimationDrawable;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
public class FlowingGradientClass {
int Duration=4000;
RelativeLayout rl;
LinearLayout ll;
ImageView im;
int alphaint;
int d;
AnimationDrawable frameAnimation;
public FlowingGradientClass setTransitionDuration(int time) {
this.Duration = time;
return this;
}
public FlowingGradientClass onLinearLayout(LinearLayout ll) {
this.ll = ll;
return this;
}
public FlowingGradientClass onImageView(ImageView im) {
this.im = im;
return this;
}
public FlowingGradientClass onRelativeLayout(RelativeLayout rl) {
this.rl = rl;
return this;
}
public FlowingGradientClass start() {
if(ll!=null){
ll.setBackgroundResource(d);
}
else if(rl!=null){
rl.setBackgroundResource(d);
}
else if(im!=null){
im.setBackgroundResource(d);
}
if(ll!=null){
frameAnimation = (AnimationDrawable) ll.getBackground();
}
else if(rl!=null){
frameAnimation = (AnimationDrawable) rl.getBackground();
}
else if(im!=null){
frameAnimation = (AnimationDrawable) im.getBackground();
}
frameAnimation.setEnterFadeDuration(Duration);
frameAnimation.setExitFadeDuration(Duration);
frameAnimation.start();
return this;
}
public FlowingGradientClass setBackgroundResource(int d) {
this.d = d;
return this;
}
public FlowingGradientClass setAlpha(int alphaint) {
this.alphaint = alphaint;
frameAnimation.setAlpha(alphaint);
return this;
}
} | [
"[email protected]"
] | |
c367c59a4491030d6575039b7998fb18d574699b | 895cfe0ecc1649015aebb9323cebfee740d137d0 | /ejbs/refdata/src/main/java/org/sola/cs/services/ejb/refdata/entities/PresentationFormType.java | 6f67dbbfc1080ac295bafaf9c68c63cf47f0d1eb | [] | no_license | OpenTenure/services | 434812fe545c0f291d9c2b84fc4525bd130ae2cb | 68d69e2ddf25c4096e45ca6522e104b830770c08 | refs/heads/master | 2023-04-15T03:23:16.890471 | 2023-04-08T15:24:26 | 2023-04-08T15:24:26 | 34,508,654 | 0 | 3 | null | 2022-06-30T14:45:28 | 2015-04-24T09:01:12 | Java | UTF-8 | Java | false | false | 2,347 | java | /**
* ******************************************************************************************
* Copyright (C) 2014 - Food and Agriculture Organization of the United Nations (FAO).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,this list
* of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,this list
* of conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
* 3. Neither the name of FAO nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,STRICT LIABILITY,OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *********************************************************************************************
*/
package org.sola.cs.services.ejb.refdata.entities;
import javax.persistence.Table;
import org.sola.services.common.repository.DefaultSorter;
import org.sola.services.common.repository.entities.AbstractCodeEntity;
/**
* Entity representing the source.presentation_form_type code table.
* @author soladev
*/
@Table(name = "presentation_form_type", schema = "source")
@DefaultSorter(sortString="display_value")
public class PresentationFormType extends AbstractCodeEntity {
public PresentationFormType() {
super();
}
}
| [
"[email protected]"
] | |
3d9648314772a709ad5fac7198cd79ffd8e3ee54 | b2b311f3d8af93dad52f03e1c3ed27a4a7d5260d | /app/src/main/java/vn/huynh/whatsapp/services/NewMessageService.java | 9661206568ea661c15d93659bfdf15cef3c4b31e | [] | no_license | ShashankMudiraj/ChatApp | 51892148af39acad5877b0ab01dd83de3cbe602c | 3095adc30528d6853a6d0da9a412de9295fa3344 | refs/heads/master | 2020-08-04T11:10:27.671548 | 2019-08-06T13:27:47 | 2019-08-06T13:27:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,248 | java | package vn.huynh.whatsapp.services;
import android.annotation.SuppressLint;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Binder;
import android.os.IBinder;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.NotificationCompat;
import android.support.v4.content.ContextCompat;
import android.text.TextUtils;
import android.widget.RemoteViews;
import com.google.firebase.database.ChildEventListener;
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;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;
import vn.huynh.whatsapp.R;
import vn.huynh.whatsapp.chat.view.ChatActivity;
import vn.huynh.whatsapp.home.HomeActivity;
import vn.huynh.whatsapp.model.Chat;
import vn.huynh.whatsapp.model.Friend;
import vn.huynh.whatsapp.model.User;
import vn.huynh.whatsapp.utils.AppUtils;
import vn.huynh.whatsapp.utils.ChatUtils;
import vn.huynh.whatsapp.utils.Constant;
import vn.huynh.whatsapp.utils.ImageUtils;
import vn.huynh.whatsapp.utils.LogManagerUtils;
import vn.huynh.whatsapp.utils.MyApp;
import vn.huynh.whatsapp.utils.SharedPrefsUtil;
/**
* Created by duong on 4/26/2019.
*/
public class NewMessageService extends Service {
public static String TAG = NewMessageService.class.getSimpleName();
private NotificationCompat.Builder mNotification;
public static int ID_NOTIFICATION = 9;
private boolean mIsShowMessageNotification = true;
private boolean mIsShowFriendNotification = true;
private static final String NOTIFICATION_CHANNEL = "WHATSAPP_CHANNEL_ID";
private NotificationManager mNotificationManager;
private RemoteViews mSimpleContentView;
private final IBinder mBinder = new LocalBinder();
private DatabaseReference mDF = FirebaseDatabase.getInstance().getReference();
private DatabaseReference mDatabaseNewMessage;
private ValueEventListener mValueEventListenerNewMessage;
private DatabaseReference mDatabaseFriend;
private ChildEventListener mChildEventListenerFriend;
@Nullable
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
@Override
public int onStartCommand(Intent intent, final int flags, int startId) {
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (ChatUtils.getUser() == null) {
return START_STICKY;
}
String userId = ChatUtils.getUser().getId();
mDatabaseNewMessage = mDF.child(Constant.FB_KEY_USER).child(userId).child(Constant.FB_KEY_LAST_CHAT_ID);
mValueEventListenerNewMessage = new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
LogManagerUtils.d(TAG, "onStartCommand: " + dataSnapshot.getKey());
final String chatId = dataSnapshot.getValue().toString().split("=")[0];
DatabaseReference dbRef = mDF.child(Constant.FB_KEY_CHAT).child(chatId);
dbRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
final Chat chat = dataSnapshot.getValue(Chat.class);
if (chat.getLastMessageSent() != null && ChatUtils.getUser() != null) {
if (chat.getLastMessageSent().getCreator().equals(ChatUtils.getUser().getId())) {
return;
}
} else {
return;
}
if (!chat.getNotificationUserIds().get(ChatUtils.getUser().getId())) {
return;
}
loadUserData(chat);
updateMsgStatus(chatId, chat.getLastMessageSent().getId());
DatabaseReference dbRef = mDF.child(Constant.FB_KEY_USER).
child(chat.getLastMessageSent().getCreator());
dbRef.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
User sender = dataSnapshot.getValue(User.class);
if (chatId.equals(ChatUtils.getCurrentChatId()) && AppUtils.isAppVisible()) {
return;
} else {
if (mIsShowMessageNotification)
createNotification(sender, chat, null);
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
};
mDatabaseNewMessage.addValueEventListener(mValueEventListenerNewMessage);
//friend mNotification
mDatabaseFriend = mDF.child(Constant.FB_KEY_FRIEND).child(userId);
mChildEventListenerFriend = new ChildEventListener() {
@Override
public void onChildAdded(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
if (dataSnapshot.exists()) {
Friend friend = dataSnapshot.getValue(Friend.class);
if (mIsShowFriendNotification)
createNotification(null, null, friend);
}
}
@Override
public void onChildChanged(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
Friend friend = dataSnapshot.getValue(Friend.class);
if (mIsShowFriendNotification)
createNotification(null, null, friend);
}
@Override
public void onChildRemoved(@NonNull DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(@NonNull DataSnapshot dataSnapshot, @Nullable String s) {
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
};
mDatabaseFriend.addChildEventListener(mChildEventListenerFriend);
return START_STICKY;
}
@SuppressLint("NewApi")
public void createNotification(User sender, Chat chat, final Friend friend) {
if (chat != null) {
String lastMessageId = chat.getLastMessageSent().getId();
if (!lastMessageId.equals(SharedPrefsUtil.getInstance().
get(Constant.SP_LAST_NOTIFICATION_MESSAGE_ID, String.class))) {
SharedPrefsUtil.getInstance().put(Constant.SP_LAST_NOTIFICATION_MESSAGE_ID,
chat.getLastMessageSent().getId());
} else {
return;
}
Intent intent = new Intent(NewMessageService.this, ChatActivity.class);
intent.putExtra(Constant.EXTRA_CHAT_ID, chat.getId());
intent.putExtra(Constant.EXTRA_CHAT_NAME, chat.getChatName());
LogManagerUtils.d(TAG, "show mNotification: " + chat.getId());
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addNextIntentWithParentStack(intent);
// Get the PendingIntent containing the entire back stack
PendingIntent contentIntent =
stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
String title = "", message = "";
if (chat.isGroup()) {
title = chat.getChatName();
} else {
title = sender.getName();
}
mNotification = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL,
"Name", importance);
mNotificationManager.createNotificationChannel(notificationChannel);
mNotification = new NotificationCompat.Builder(getApplicationContext(),
notificationChannel.getId());
} else {
mNotification = new NotificationCompat.Builder(getApplicationContext());
}
message = chat.getLastMessageSent().getText();
if (TextUtils.isEmpty(message)) {
if (chat.getLastMessageSent().getMedia() != null && !chat.getLastMessageSent().
getMedia().isEmpty()) {
message = MyApp.resources.getString(R.string.message_sent_media);
}
}
mNotification = mNotification
.setSmallIcon(R.drawable.ic_notification_new)
.setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
.setLargeIcon(BitmapFactory.decodeResource(MyApp.resources,
R.mipmap.ic_launcher_round))
.setContentIntent(contentIntent)
.setContentTitle(title)
.setContentText(message)
.setDefaults(Notification.DEFAULT_ALL)
.setPriority(Notification.PRIORITY_HIGH)
.setAutoCancel(true);
mNotificationManager.notify(ID_NOTIFICATION, mNotification.build());
}
if (friend != null) {
String lastFriendId = friend.getUserId();
int lastFriendStatus = friend.getStatus();
if ((!lastFriendId.equals(SharedPrefsUtil.getInstance().
get(Constant.SP_LAST_NOTIFICATION_FRIEND_ID, String.class))
&& lastFriendStatus != SharedPrefsUtil.getInstance().
get(Constant.SP_LAST_NOTIFICATION_FRIEND_STATUS, Integer.class))
|| (lastFriendId.equals(SharedPrefsUtil.getInstance().
get(Constant.SP_LAST_NOTIFICATION_FRIEND_ID, String.class))
&& lastFriendStatus != SharedPrefsUtil.getInstance().
get(Constant.SP_LAST_NOTIFICATION_FRIEND_STATUS, Integer.class))) {
SharedPrefsUtil.getInstance().put(Constant.SP_LAST_NOTIFICATION_FRIEND_ID, lastFriendId);
SharedPrefsUtil.getInstance().put(Constant.SP_LAST_NOTIFICATION_FRIEND_STATUS, lastFriendStatus);
} else {
return;
}
final DatabaseReference databaseReference = mDF.child(Constant.FB_KEY_USER).
child(ChatUtils.getUser().getId()).
child(Constant.FB_KEY_FRIEND_NOTIFICATION);
databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
if (dataSnapshot.getValue(Integer.class) == 1) {
Intent intent = new Intent(NewMessageService.this, HomeActivity.class);
intent.putExtra(Constant.EXTRA_FRIEND_ID, friend.getUserId());
intent.putExtra(Constant.EXTRA_FRIEND_STATUS, friend.getStatus());
LogManagerUtils.d(TAG, "show mNotification friend: " + friend.getUserId());
TaskStackBuilder stackBuilder = TaskStackBuilder.create(NewMessageService.this);
stackBuilder.addNextIntentWithParentStack(intent);
// Get the PendingIntent containing the entire back stack
// PendingIntent contentIntent =
// stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(),
(int) System.currentTimeMillis(), intent, 0);
String title = "", message = "";
switch (friend.getStatus()) {
case Friend.STATUS_WAS_REQUESTED:
title = MyApp.resources.getString(R.string.notification_new_friend_request_from,
friend.getName());
break;
case Friend.STATUS_WAS_ACCEPTED:
title = MyApp.resources.getString(R.string.notification_accept_friend_request,
friend.getName());
message = MyApp.resources.getString(R.string.notification_you_two_are_friend,
friend.getName());
break;
case Friend.STATUS_WAS_REJECTED:
title = MyApp.resources.getString(R.string.notification_rejected_your_friend_request,
friend.getName());
break;
case Friend.STATUS_WAS_BLOCKED:
title = MyApp.resources.getString(R.string.notification_block, friend.getName());
break;
default:
return;
}
mNotification = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
int importance = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel notificationChannel = new NotificationChannel(NOTIFICATION_CHANNEL,
"Name", importance);
mNotificationManager.createNotificationChannel(notificationChannel);
mNotification = new NotificationCompat.Builder(getApplicationContext(),
notificationChannel.getId());
} else {
mNotification = new NotificationCompat.Builder(getApplicationContext());
}
mNotification = mNotification
.setSmallIcon(R.drawable.ic_notification_new)
.setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
.setLargeIcon(BitmapFactory.decodeResource(MyApp.resources,
R.mipmap.ic_launcher_round))
.setContentIntent(contentIntent)
.setContentTitle(title)
.setContentText(message)
.setDefaults(Notification.DEFAULT_ALL)
.setPriority(Notification.PRIORITY_HIGH)
.setAutoCancel(true);
mNotificationManager.notify(ID_NOTIFICATION, mNotification.build());
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
private void updateMsgStatus(final String chatId, final String messageId) {
DatabaseReference df = mDF.child(Constant.FB_KEY_MESSAGE).child(chatId).
child(messageId).child(Constant.FB_KEY_SEEN_USERS).child(ChatUtils.getUser().getId());
df.setValue(1);
}
public void removeListener() {
if (mDatabaseNewMessage != null) {
mDatabaseNewMessage.removeEventListener(mValueEventListenerNewMessage);
}
if (mDatabaseFriend != null) {
mDatabaseFriend.removeEventListener(mChildEventListenerFriend);
}
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onTaskRemoved(Intent rootIntent) {
super.onTaskRemoved(rootIntent);
LogManagerUtils.d(TAG, "onTaskRemove");
removeListener();
stopSelf();
Intent intent = new Intent(this, AppKilledBroadcast.class);
intent.setAction(Constant.BROADCAST_APP_KILL_ACTION);
sendBroadcast(intent);
}
public void setShowMessageNotification(boolean isShowNotify) {
LogManagerUtils.d(TAG, " mIsShowMessageNotification " +
this.mIsShowMessageNotification + "=> " + isShowNotify);
this.mIsShowMessageNotification = isShowNotify;
}
class GetBitmapFromUrl extends AsyncTask<String, Void, Bitmap> {
@Override
protected Bitmap doInBackground(String... params) {
InputStream in;
try {
URL url = new URL(params[0]);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
in = connection.getInputStream();
return BitmapFactory.decodeStream(in);
} catch (IOException e) {
return null;
}
}
@Override
protected void onPostExecute(Bitmap bitmap) {
if (bitmap != null) {
bitmap = ImageUtils.getRoundedCornerBitmap(bitmap, 9);
mSimpleContentView.setImageViewBitmap(R.id.img_avatar, bitmap);
mNotificationManager.notify(ID_NOTIFICATION, mNotification.build());
} else {
Bitmap icon = BitmapFactory.decodeResource(getResources(),
R.mipmap.ic_launcher);
mSimpleContentView.setImageViewBitmap(R.id.img_avatar, icon);
mNotificationManager.notify(ID_NOTIFICATION, mNotification.build());
}
}
}
/**
* Class used for the client Binder. Because we know this service always
* runs in the same process as its clients, we don't need to deal with IPC.
*/
public class LocalBinder extends Binder {
public NewMessageService getService() {
// Return this instance of LocalService so clients can call public methods
return NewMessageService.this;
}
}
private void loadUserData(final Chat chat) {
if (chat != null && chat.getUserIds() != null) {
for (Map.Entry<String, String> entry : chat.getUserIds().entrySet()) {
final DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference()
.child(Constant.FB_KEY_USER).child(entry.getValue());
databaseReference.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (dataSnapshot.exists()) {
User user = dataSnapshot.getValue(User.class);
chat.addUser(user);
}
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
}
}
}
| [
"[email protected]"
] | |
5e958219d6c68d30fce2e9b7683e406685e26c23 | 2124ee3863f38e43d99d5ec51c6ddbe3eb659900 | /src/HeatMap.java | 1f2d2d6b585523c4b397fa9fb95a14c0e0e94264 | [] | no_license | ReykCS/learn-sentence-genetic-algorithm | ef11637bd252323553dad15dac248de46fc4358b | 079218bb6a22a11d23b41f0c8946eadeaad8ee25 | refs/heads/master | 2020-09-04T13:12:40.836732 | 2019-11-05T12:35:02 | 2019-11-05T12:35:02 | 219,740,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,688 | java | import java.util.ArrayList;
import java.util.Arrays;
public class HeatMap {
int nano;
int runs;
int timeout;
int maximumLength;
int step;
public HeatMap() {
this.nano = 1000000000;
this.runs = 10;
this.timeout = 5000;
this.step = 5;
this.maximumLength = 40;
}
public int[] getHeatArrayForPopulation(int population) {
int[] heat = new int[this.maximumLength / this.step];
for ( int i = 5; i <= this.maximumLength; i += this.step) {
heat[i/5 - 1] = getHeatForPopulationAndLength(population, i);
}
return heat;
}
public int getHeatForPopulationAndLength(int population, int length) {
String testString = this.createRandomString(length);
int sum = 0;
for ( int i = 0; i < this.runs; i++) {
LearnSentence learn = new LearnSentence(testString, population);
int timeout = learn.learn(this.timeout);
sum += timeout == 0 ? this.timeout : timeout;
}
int average = (sum / this.runs);
System.out.println(average + " generations in average");
return average;
}
public String createRandomString(int length) {
char[] newString = new char[length];
RandomCharacter rand = new RandomCharacter();
for ( int i = 0; i < length; i++) {
newString[i] = rand.getRandomChar();
}
return new String(newString);
}
public static void main(String[] args) {
HeatMap map = new HeatMap();
int[] heat = map.getHeatArrayForPopulation(1000);
System.out.println(Arrays.toString(heat));
}
}
| [
"[email protected]"
] | |
a8f90da9fc1825ecee74ecea175ad6c1c27ca037 | 8e208f2fbe32b354d75dba596ca43e7177138e40 | /app/src/main/java/com/edutainer/in/Activity/TermsConditionsActivity.java | 746c5ad2ee72dd3558ad670b853f1c53c1aaa68a | [] | no_license | aartisoft/edutainer | bb5c9a944d1d2c7a96bc9782478538072a2cdc6c | a68631654d009c7b397b2ba3f0205b8f11c99b85 | refs/heads/master | 2020-04-25T17:11:21.398010 | 2019-02-25T13:24:13 | 2019-02-25T13:24:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package com.edutainer.in.Activity;
import android.os.Bundle;
import android.webkit.WebView;
import com.edutainer.in.R;
import com.edutainer.in.Utility.BaseActivity;
public class TermsConditionsActivity extends BaseActivity {
private WebView webView;
@Override
public void initialize(Bundle save) {
setTitle("Terms & Conditions");
webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("https://www.edutainer.in/edutainer_api/terms_conditions.php");
}
@Override
public int getActivityLayout() {
return R.layout.layout_webpage;
}
}
| [
"[email protected]"
] | |
cb60c0350f550efd95971218e04c809184aaca50 | 1ed10574f27245dd78160721e52d2a208202174b | /Week-04/Day-02/thegardenapplication/Garden.java | 81ddfe7e539ccb38540a14074af888b6cf77d8a5 | [] | no_license | green-fox-academy/KrisztianBatori | bf5e7b818aea6d45e7c690886c5be09d9f7e90b0 | ef5bb745f0cae5419ac8084c2e84c55d0cd17179 | refs/heads/master | 2020-04-13T16:47:17.818539 | 2019-03-16T15:29:36 | 2019-03-16T15:29:36 | 163,330,371 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,812 | java | import java.util.ArrayList;
public class Garden {
ArrayList<Plant> plants;
Garden(ArrayList<Plant> plants) {
this.plants = plants;
}
public void getNeedyPlants() {
for (int i = 0; i < plants.size(); i++) {
String plantType = plants.get(i).type;
if (plantType.equals("Flower") && plants.get(i).waterAmount < 5) {
System.out.println("The " + plants.get(i).color + " Flower needs water");
}
else if (plantType.equals("Flower")) {
System.out.println("The " + plants.get(i).color + " Flower doesn't need water");
}
}
for (int i = 0; i < plants.size(); i++) {
String plantType = plants.get(i).type;
if (plantType.equals("Tree") && plants.get(i).waterAmount < 10) {
System.out.println("The " + plants.get(i).color + " Tree needs water");
}
else if (plantType.equals("Tree")) {
System.out.println("The " + plants.get(i).color + " Tree doesn't need water");
}
}
}
public void waterPlants(int waterAmount) {
System.out.println("Watering with " + waterAmount);
int plantsNeededWaterCount = (int)plants.stream()
.filter(plant -> plant.type.equals("Tree") && plant.waterAmount < 10)
.count();
plantsNeededWaterCount += (int)plants.stream()
.filter(plant -> plant.type.equals("Flower") && plant.waterAmount < 5)
.count();
waterAmount /= plantsNeededWaterCount;
for (int i = 0; i < plants.size(); i++) {
plants.get(i).watering(waterAmount);
}
}
}
| [
"[email protected]"
] | |
fa58a1a84e91c0f82f67f76f17996f830400aadc | 07bf50b54050cad645f641255f336eef5210aac2 | /Sources/er/groupware/calendar/ERGWAttendee.java | ab0fdc5417cee13c9b6cd39f094ed0026c161199 | [] | no_license | pascalrobert/ERGroupware | f1341d27d9ad471f89d4177ac278dc14f83575f3 | d033f3591dedf32b92ae0c072fb9a169b43eb277 | refs/heads/master | 2016-09-05T16:58:34.669833 | 2013-06-29T11:25:55 | 2013-06-29T11:25:55 | 2,187,274 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,754 | java | package er.groupware.calendar;
import net.fortuna.ical4j.model.Parameter;
import net.fortuna.ical4j.model.parameter.Cn;
import net.fortuna.ical4j.model.parameter.CuType;
import net.fortuna.ical4j.model.parameter.Role;
import net.fortuna.ical4j.model.property.Attendee;
import er.extensions.eof.ERXKey;
import er.groupware.calendar.enums.ERGWAttendeeRole;
import er.groupware.calendar.enums.ERGWCUType;
import er.groupware.calendar.enums.ERGWParticipantStatus;
public class ERGWAttendee extends ERGWCalendarContact {
private ERGWParticipantStatus partStat;
private boolean rsvp;
private ERGWCUType cutype;
private String memberOf; // http://tools.ietf.org/html/rfc2445#section-4.2.11
private ERGWCalendarContact delegatedFrom;
private ERGWCalendarContact delegatedTo;
private boolean rsvpSent;
public static final ERXKey<ERGWParticipantStatus> PART_STAT = new ERXKey<ERGWParticipantStatus>("partStat");
public static final ERXKey<Boolean> RSVP = new ERXKey<Boolean>("rsvp");
public static final ERXKey<ERGWCUType> CUTYPE = new ERXKey<ERGWCUType>("cutype");
public static final ERXKey<String> MEMBER_OF = new ERXKey<String>("memberOf");
public static final ERXKey<ERGWCalendarContact> DELEGATED_FROM = new ERXKey<ERGWCalendarContact>("delegatedFrom");
public static final ERXKey<ERGWCalendarContact> DELEGATED_TO = new ERXKey<ERGWCalendarContact>("delegatedTo");
public ERGWAttendee() {
}
public ERGWParticipantStatus partStat() {
return partStat;
}
public void setPartStat(ERGWParticipantStatus _partStat) {
this.partStat = _partStat;
}
public boolean isRsvp() {
return rsvp;
}
public void setRsvp(boolean _rsvp) {
this.rsvp = _rsvp;
}
public ERGWCUType cutype() {
return cutype;
}
public void setCutype(ERGWCUType _cutype) {
this.cutype = _cutype;
}
public String memberOf() {
return memberOf;
}
public void setMemberOf(String _memberOf) {
this.memberOf = _memberOf;
}
public ERGWCalendarContact delegatedFrom() {
return delegatedFrom;
}
public void setDelegatedFrom(ERGWCalendarContact _delegatedFrom) {
this.delegatedFrom = _delegatedFrom;
}
public ERGWCalendarContact delegatedTo() {
return delegatedTo;
}
public void setDelegatedTo(ERGWCalendarContact _delegatedTo) {
this.delegatedTo = _delegatedTo;
}
public boolean isRsvpSent() {
return rsvpSent;
}
public void setRsvpSent(boolean _rsvpSent) {
this.rsvpSent = _rsvpSent;
}
public static ERGWAttendee transformFromICalObject(Attendee oldAttendee) {
ERGWAttendee attendee = new ERGWAttendee();
CuType type = (CuType)oldAttendee.getParameter(Parameter.CUTYPE);
if (type == CuType.GROUP) {
attendee.setCutype(ERGWCUType.GROUP);
} else if (type == CuType.INDIVIDUAL) {
attendee.setCutype(ERGWCUType.INDIVIDUAL);
} else if (type == CuType.RESOURCE) {
attendee.setCutype(ERGWCUType.RESOURCE);
} else if (type == CuType.ROOM) {
attendee.setCutype(ERGWCUType.ROOM);
} else if (type == CuType.UNKNOWN) {
attendee.setCutype(ERGWCUType.UNKNOWN);
}
Parameter role = oldAttendee.getParameter(Parameter.ROLE);
if (role != null) {
attendee.setRole(ERGWAttendeeRole.getByRFC2445ValueValue((Role)role));
} else {
attendee.setRole(ERGWAttendeeRole.REQ_PARTICIPANT);
}
Cn name = (Cn)oldAttendee.getParameter(Parameter.CN);
if (name != null)
attendee.setName(name.getValue());
attendee.setEmailAddress(null);
String emailAddress = oldAttendee.getCalAddress().getSchemeSpecificPart();
if (emailAddress != null)
attendee.setEmailAddress(emailAddress);
return attendee;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.