blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5d107d663c85ac03a2546f5dc35bfa6776ad49b9 | 343f8ba1b458e5f552a7f12768d68549f40f8ebc | /Langur-Chital Project/MASON code/MonkeysWithUI.java | 8083f49bcc15295441933d3865d87f49fadb4374 | [
"AFL-3.0"
] | permissive | SCKartoredjo/Langur-Chital-MASON | 2498c2c0faf5c786d9a52821a6ef0b493da8a413 | 60adfa97b2e17d6af0b7b1fe75315af15883f6e1 | refs/heads/master | 2020-03-21T20:36:00.596321 | 2018-06-28T13:14:13 | 2018-06-28T13:14:13 | 139,017,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,184 | java | package TestMason;
import sim.engine.*;
import sim.display.*;
import sim.portrayal.continuous.*;
import sim.portrayal.simple.*;
import javax.swing.*;
import java.awt.Color;
import sim.portrayal.*;
import java.awt.*;
public class MonkeysWithUI extends GUIState {
public Display2D display;
public JFrame displayFrame;
ContinuousPortrayal2D fieldPortrayal = new ContinuousPortrayal2D();
public static void main(String[] args) {
MonkeysWithUI vid = new MonkeysWithUI();
Console c = new Console(vid);
c.setVisible(true);
}
// Monkeys takes a seed,
// Berries also takes a seed.
// Manipulatable:
// Monkeys:
// nr of monkeys
// starting hunger
// decision parameters
// Berries:
// nr of berries (this is only the starting number, see Tree)
// berry weight (but 0.5 is the "realistic" weight")
// Trees:
// Speed and range of spawning
public MonkeysWithUI() {
super(new Monkeys(System.currentTimeMillis()));
// give deers and predators the field to set them in and the deer the berries
// also
}
public MonkeysWithUI(SimState state) {
super(state);
}
public static String getName() {
return "Savanna";
}
public void start() {
super.start();
setupPortrayals();
}
public void load(SimState state) {
super.load(state);
setupPortrayals();
}
public void setupPortrayals() {
Monkeys monkeys = (Monkeys) state;
// tell the portrayals what to portray and how to portray them
fieldPortrayal.setField(monkeys.field);
// fieldPortrayal.setPortrayalForAll(new RectanglePortrayal2D());
fieldPortrayal.setPortrayalForClass(Deer.class, new OvalPortrayal2D() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void draw(Object object, Graphics2D graphics, DrawInfo2D info) {
Deer deer = (Deer) object;
if (deer.interested)
paint = new Color(250, 0, 50, 200);
else
paint = new Color(125, 125, 250, 200);
super.draw(object, graphics, info);
}
});
fieldPortrayal.setPortrayalForClass(Berry.class, new OvalPortrayal2D() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void draw(Object object, Graphics2D graphics, DrawInfo2D info) {
Berry berry = (Berry) object;
if (berry.isEaten)
paint = new Color(255, 255, 255, 0);
else if (berry.onGround)
paint = new Color(0, 255, 255, 100);
else
paint = new Color(255, 0, 255, 100);
super.draw(object, graphics, info);
}
});
fieldPortrayal.setPortrayalForClass(Monkey.class, new RectanglePortrayal2D() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void draw(Object object, Graphics2D graphics, DrawInfo2D info) {
Monkey monkey = (Monkey) object;
if (monkey.isAlive) {
int hungryShade = (int) (monkey.hungriness * 255);
if (hungryShade > 255)
hungryShade = 255;
paint = new Color(hungryShade, 255 - hungryShade, 0, 200);
} else
paint = new Color(125, 125, 125, 0);
super.draw(object, graphics, info);
}
});
fieldPortrayal.setPortrayalForClass(Predator.class, new RectanglePortrayal2D() {
/**
*
*/
private static final long serialVersionUID = 1L;
public void draw(Object object, Graphics2D graphics, DrawInfo2D info) {
Predator predator = (Predator) object;
if (!predator.disinterest)
paint = new Color(125, 125, 125);
else
paint = new Color(255, 100, 100);
super.draw(object, graphics, info);
}
});
// reschedule the displayer
display.reset();
display.setBackdrop(Color.white);
// redraw the display
display.repaint();
}
public void init(Controller c) {
super.init(c);
display = new Display2D(600, 600, this);
display.setClipping(false);
displayFrame = display.createFrame();
displayFrame.setTitle("Field Display");
c.registerFrame(displayFrame); // so the frame appears in the "Display" list
displayFrame.setVisible(true);
display.attach(fieldPortrayal, "Savanna");
}
public void quit() {
super.quit();
if (displayFrame != null)
displayFrame.dispose();
displayFrame = null;
display = null;
}
private boolean done() {
return state.schedule.getSteps() >= 5000;
}
}
| [
"31567196+BaantjerKok@users.noreply.github.com"
] | 31567196+BaantjerKok@users.noreply.github.com |
e8ffa2de6a73331f87ff30c7a029bb366baaefb9 | 159d1dd0d346c92da6b3033ebaa004f27c7382f5 | /traducao_intermediario/Tree/Expr.java | 28346ebe9a6157a4d43c0e16e1961d2ce43de60e | [] | no_license | AndyFernandes/compiladores | cdf47826f10cadf3d79efcf44d8e54a64250b8c3 | 32e907fd2bf744b7fae803538e55cabaab3bb8ab | refs/heads/master | 2020-05-16T00:59:36.588318 | 2019-05-24T20:28:26 | 2019-05-24T20:28:26 | 182,591,966 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 147 | java | package traducao_intermediario.Tree;
abstract public class Expr {
abstract public ExpList kids();
abstract public Expr build(ExpList kids);
}
| [
"andfernandes24@gmail.com"
] | andfernandes24@gmail.com |
9668dd4e3156f3c620000a17830555430e01114a | 388d52b66433213fb321f82c6ad11749c1be8d57 | /app/src/test/java/com/khadejaclarke/registerlogin/ExampleUnitTest.java | a55f9829d2be99b81b56019e267c492b2fa1a0d3 | [] | no_license | KhadejaClarke/RegisterLogin | ed1758ca6619b80a6d5523df7e582465f5def344 | ddcf509a0d017bf9f9fe47eff106027e6d98ad32 | refs/heads/master | 2020-06-07T00:08:52.239128 | 2019-06-20T08:35:07 | 2019-06-20T08:35:07 | 192,881,803 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 392 | java | package com.khadejaclarke.registerlogin;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"clarke.khadeja@gmail.com"
] | clarke.khadeja@gmail.com |
a335be798d1316010161403a6b8fe568e1ef70fb | 7c37b9ad99dfaa08b8435b2e585a609c6581748a | /BasicCoreJava/src/Oops/Abstraction/Lastname.java | 24952065dc99a1f27e091cdfb5ff4fbc548b29d5 | [] | no_license | AyashaShaikh/AutomationRepo123 | c05118b4ccfcb10c5a4a9bb0b6dff2ba629ef156 | f7390c0b8826cbd7f53b53b9fff5a97b7a744d8f | refs/heads/master | 2020-08-03T02:45:33.539276 | 2019-11-16T17:27:10 | 2019-11-16T17:27:10 | 211,601,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 188 | java | package Oops.Abstraction;
public class Lastname extends Middlename {
public void lastname() {
System.out.println("Irfan");
// TODO Auto-generated method stub
}
}
| [
"ayashasayyed@gmail.com"
] | ayashasayyed@gmail.com |
bbc611b9eeb5b235487e627e268fefae18dc6657 | 1def91314742ab60c5553302ef2083909489eee7 | /src/tictactics/SmallBoard.java | a65342bf66f431bf9f5e46914965b6b927b478a6 | [] | no_license | sashankg/TicTacTics | 3c2c48d86b43d59c97ab065057784af3328171b5 | de686dbbb80579ed7761fea50269100696876c7c | refs/heads/master | 2021-01-17T18:34:43.331257 | 2016-10-30T15:23:06 | 2016-10-30T15:23:06 | 71,512,349 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,386 | 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 tictactics;
/**
*
* @author Sashank
*/
public class SmallBoard extends Board implements SpotInterface{
private Player winner;
public SmallBoard() {
super(new Spot[3][3]);
winner = Player.getBlankPlayer();
}
@Override
public Player getOwner() {
return winner;
}
@Override
public void setOwner(Player p) {
winner = p;
}
@Override
public boolean isDisabled() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setDisabled(boolean b) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public boolean canDisable()
{
SpotInterface[][] s = getSpots();
int emptySpots = 0;
for(SpotInterface[] a : s)
{
for(SpotInterface p : a)
{
if(p.getOwner() == Player.getBlankPlayer())
{
emptySpots++;
}
}
}
return emptySpots > 1;
}
}
| [
"sashankg@gmail.com"
] | sashankg@gmail.com |
def1c6fc7b4b1d9023ef9792f413598e58dfd7c4 | 87e29d47c275b9575e1298adf9558d00e3302716 | /kturner/src/main/java/playground/kturner/utils/MoveDirVisitor.java | c9aaa1de0109fd64376561942397e29158398c55 | [] | no_license | nanddesai99/vsp-playgrounds | d2255352ea485c5044bce432c6ed2ff0a2f59381 | 0052c80f612737ab3e477e74b0cf95dcb32fb76e | refs/heads/master | 2020-05-26T11:26:28.078351 | 2019-05-21T15:24:14 | 2019-05-21T15:24:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,938 | java | package playground.kturner.utils;
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Objects;
import org.apache.log4j.Logger;
import org.jfree.util.Log;
/**
* @author kturner
*
* Move a directory with its files and directories
*
* This class bases on code found here:
* https://www.java-forum.org/thema/ordner-samt-dateien-kopieren.157759/page-2
*
*
***/
public class MoveDirVisitor extends SimpleFileVisitor<Path> {
private static final Logger log = Logger.getLogger(MoveDirVisitor.class) ;
private Path fromPath;
private Path toPath;
private StandardCopyOption copyOption;
/**
* For moving directory use following command
* Files.walkFileTree(startingDir, new MoveDirVisitor(startingDir, destDir, copyOption));
*
* Remaining empty directories in fromPath after moving files and directories will be deleted.
*
* @param fromPath
* Source path from were files and directories should be copied from.
* @param toPath
* Destination path to were files and directories should be copied to.
* @param copyOption
* Defines the copyOption.
* @throws IOException
*
*/
public MoveDirVisitor(Path fromPath, Path toPath, StandardCopyOption copyOption) throws IOException {
this.fromPath = fromPath;
this.toPath = toPath;
this.copyOption = copyOption;
if (!Files.exists(toPath)){
Files.createDirectory(toPath);
log.info("Created directory: " + toPath.toString());
}
}
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
Path targetPath = toPath.resolve(fromPath.relativize(dir));
if (!Files.exists(targetPath)) {
Files.createDirectory(targetPath);
}
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
// System.out.println(file);
Files.copy(file, toPath.resolve(fromPath.relativize(file)), copyOption);
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException
{
if (Files.exists(dir) && Files.isDirectory(dir)){
if (dir.toFile().list().length == 0) { //directory is empty
Files.delete(dir);
} else {
Log.warn("Something goes wrong with moving files from: " + dir.getFileName());
}
}
Objects.requireNonNull(dir);
if (exc != null)
throw exc;
return FileVisitResult.CONTINUE;
}
}
| [
"martins-turner@vsp.tu-berlin.de"
] | martins-turner@vsp.tu-berlin.de |
52c8f782d1155b17aa6507099a5ac07c90dd4086 | 93e39d2abb49a1df0739d9ed182c75ed80f0a7b3 | /src/baekjoon/Main10815_1.java | 4840ae0b42b8e54cb100e82f6d5c7bac1f371899 | [] | no_license | expitly/algorithm | a7a423a263b6417877e4a357ebb7e50e8a780b93 | 08cf5d1ee8210ea263c51d32b4a38318b09d6a3a | refs/heads/master | 2021-07-11T07:38:29.841536 | 2020-06-27T09:29:42 | 2020-06-27T09:29:42 | 154,927,615 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package baekjoon;
import java.util.HashSet;
import java.util.Scanner;
public class Main10815_1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
HashSet<Integer> set = new HashSet<Integer>();
int[] arr = new int[N];
for(int i =0; i<N; i++) {
set.add(sc.nextInt());
}
int M = sc.nextInt();
StringBuilder sb = new StringBuilder();
for(int i =0; i<M; i++) {
int target = sc.nextInt();
if(set.contains(target)) sb.append("1");
else sb.append("0");
sb.append(" ");
}
System.out.println(sb.toString().trim());
}
}
| [
"jjy@jangjin-yeong-ui-MacBookPro.local"
] | jjy@jangjin-yeong-ui-MacBookPro.local |
735ee8020275f4d26b3ec835b0f629bd1b103531 | a38847ee7e65a579af00ab60c657e54cb573b15d | /core/com/limegroup/gnutella/dime/DIMEParser.java | 423bd2791d44d5f876f0a8c625e0eaef8ff28b2b | [] | no_license | zootella/learning-bittorrent | 0b7c1afc7888dccd0c0a9bce59a9bb00cf753b71 | 5fa74c6d4d6960fa60856d6f3e251db5bd20a67a | refs/heads/master | 2021-01-19T11:22:16.240341 | 2008-08-27T20:48:44 | 2008-08-27T20:48:44 | 46,785 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,906 | java | package com.limegroup.gnutella.dime;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
/**
* Parser for creating DIMERecords from input.
*
* See: http://www.gotdotnet.com/team/xml_wsspecs/dime/dime.htm
* (or http://www.perfectxml.com/DIME.asp )
* for information about DIME.
*/
public class DIMEParser implements Iterator {
/**
* The input stream this parser is working off of.
*/
private final InputStream IN;
/**
* Whether or not we've read the last record.
*/
private boolean _lastRead = false;
/**
* Whether or not we've read the first record.
*/
private boolean _firstRead = false;
/**
* Constructs a new DIMEParser.
*/
public DIMEParser(InputStream in) {
IN = in;
}
/**
* Returns the next element.
*/
public Object next() {
try {
return nextRecord();
} catch(IOException ioe) {
throw new NoSuchElementException(ioe.getMessage());
}
}
/**
* Returns the next record we can parse.
*/
public DIMERecord nextRecord() throws IOException {
return getNext();
}
/**
* Return a list of all possible records we can still read from the stream.
*
* If all records are already read, returns an empty list.
*/
public List getRecords() throws IOException {
if(_lastRead)
return Collections.EMPTY_LIST;
List records = new LinkedList();
while(!_lastRead)
records.add(getNext());
return records;
}
/**
* Determines if this has more records to read.
*/
public boolean hasNext() {
return !_lastRead;
}
/**
* Unsupported operation.
*/
public void remove() {
throw new UnsupportedOperationException();
}
/**
* Reads the next record from the stream, updating the internal variables.
* If the read record is the first and doesn't have the ME flag set,
* throws IOException.
* If this is called when _lastRead is already set, throws IOException.
*/
private DIMERecord getNext() throws IOException {
if(_lastRead)
throw new IOException("already read last message.");
DIMERecord next = DIMERecord.createFromStream(IN);
if(next.isLastRecord())
_lastRead = true;
if(!_firstRead && !next.isFirstRecord())
throw new IOException("middle of stream.");
else if(_firstRead && next.isFirstRecord())
throw new IOException("two first records.");
_firstRead = true;
return next;
}
} | [
"zootella@zootella.com"
] | zootella@zootella.com |
a6f750211408986e87c99945cb8a777bbd43e02b | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /src/irvine/oeis/a024/A024282.java | f704c42f800595d2f4de6305d3ac48b6b1f6a06e | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package irvine.oeis.a024;
import irvine.math.z.Z;
import irvine.oeis.a009.A009833;
/**
* A024282 Expansion of e.g.f. <code>tanh(x)*sin(sin(x))/2</code>, even powers only.
* @author Sean A. Irvine
*/
public class A024282 extends A009833 {
@Override
public Z next() {
return super.next().divide2();
}
}
| [
"sean.irvine@realtimegenomics.com"
] | sean.irvine@realtimegenomics.com |
e95f8af6a96439ff5c3f9bfb45ede907a6bc61da | 98d313cf373073d65f14b4870032e16e7d5466f0 | /gradle-open-labs/example/src/main/java/se/molybden/Class21712.java | 83ef37120b433869e491b0f7258d832ee50dd807 | [] | no_license | Molybden/gradle-in-practice | 30ac1477cc248a90c50949791028bc1cb7104b28 | d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3 | refs/heads/master | 2021-06-26T16:45:54.018388 | 2016-03-06T20:19:43 | 2016-03-06T20:19:43 | 24,554,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java |
public class Class21712{
public void callMe(){
System.out.println("called");
}
}
| [
"jocce.nilsson@gmail.com"
] | jocce.nilsson@gmail.com |
0e8837f4f78ec00689dfaaf03070e18fcf8f7f97 | 76e42d768f95c798b920d288f61e6d7962818cf5 | /src/com/lnl/finance/dialog/FinanceModifyDialog.java | e5797bff19bed70c53f7f8ec944c72ded7c921a2 | [] | no_license | EternalHunters/Finance | bbe0c677cfbf1517be1344f40ba1bf65ffc36259 | 66c4e005b2a8f031681e9ec8c1149ca6e1086dab | refs/heads/master | 2021-01-01T18:16:09.807544 | 2016-07-11T03:21:20 | 2016-07-11T03:21:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,831 | java | package com.lnl.finance.dialog;
import java.text.DecimalFormat;
import java.util.Map;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.lnl.finance.R;
import com.lnl.finance.util.AppUtil;
import com.lnl.finance.util.DBOperation;
public class FinanceModifyDialog extends DialogFragment {
private static FinanceModifyDialog financeModifyDialog;
private static Map<String, Object> financeItem;
private EditText modifyEditText;
private static OnFinanceModifyListener onFinanceModifyListener;
public void setOnFinanceModifyListener(OnFinanceModifyListener onFinanceModifyListener){
this.onFinanceModifyListener = onFinanceModifyListener;
}
public interface OnFinanceModifyListener{
public void financeModify();
}
public FinanceModifyDialog() {
}
public static void setDatePickerDialog(FinanceModifyDialog financeModifyDialog) {
FinanceModifyDialog.financeModifyDialog = financeModifyDialog;
}
public static FinanceModifyDialog newInstance(Map<String, Object> item, OnFinanceModifyListener onFinanceModifyListener1) {
financeModifyDialog = new FinanceModifyDialog();
financeItem = item;
onFinanceModifyListener = onFinanceModifyListener1;
return financeModifyDialog;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
private int maxLength = 0;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final int dialogWidth = AppUtil.dip2px(getActivity(), 270);
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
View view = inflater.inflate(R.layout.dialog_finance_modify, null);
final TextView unitTextView = (TextView)view.findViewById(R.id.tv_unit);
modifyEditText = (EditText)view.findViewById(R.id.et_modify_finance);
Button delButton = (Button)view.findViewById(R.id.btn_delete);
Button modifyButton = (Button)view.findViewById(R.id.btn_modify);
delButton.setOnClickListener(delClickListener);
modifyButton.setOnClickListener(modifyClickListener);
String moneyString = "";
try {
DecimalFormat a = new DecimalFormat("0.##");
moneyString = a.format(Double.valueOf(financeItem.get("f_money").toString()));
} catch (Exception e) {
}
modifyEditText.setText(moneyString);
modifyEditText.addTextChangedListener(new TextWatcher(){
@Override
public void afterTextChanged(Editable s) {
String temp = s.toString();
if((maxLength!=0&&maxLength<=temp.length()+1)||(maxLength==0&&modifyEditText.getWidth()+unitTextView.getWidth()>dialogWidth-AppUtil.dip2px(getActivity(), 20)-15)){
if(maxLength==0)maxLength = temp.length();
s.delete(temp.length()-1, temp.length());
}else{
int posDot = temp.indexOf(".");
if (posDot <= 0) return;
if (temp.length() - posDot - 1 > 2)
{
s.delete(posDot + 3, posDot + 4);
}
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
});
String type = financeItem.get("f_type").toString();
if("2".equals(type)){
unitTextView.setTextColor(Color.rgb(223, 92, 92));
modifyEditText.setTextColor(Color.rgb(223, 92, 92));
}else{
unitTextView.setTextColor(Color.rgb(37, 175, 63));
modifyEditText.setTextColor(Color.rgb(37, 175, 63));
}
return view;
}
@Override
public void onResume() {
super.onResume();
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
//显示软键盘
imm.showSoftInputFromInputMethod(modifyEditText.getWindowToken(), 0);
}
public void keyboardAction(View view){
int screenWidth = AppUtil.getSreenWidth(getActivity());
String numberStr = modifyEditText.getText().toString();
String addStr = view.getTag().toString();
//删除
if("del".equals(addStr)){
if(!"0".equals(numberStr)&&numberStr.length()>1){
numberStr = numberStr.substring(0, numberStr.length()-1);
}else{
numberStr = "0";
}
}else if(screenWidth-50>modifyEditText.getWidth()+modifyEditText.getWidth()){
if(".".equals(addStr)){
if(numberStr.indexOf(".")!=-1){
return;
}
numberStr = numberStr+addStr;
}else{
//判断是否已经到小数点两位
if(numberStr.indexOf(".")!=-1){
String[] numberStrs = numberStr.split("\\.");
if(numberStrs.length>1&&numberStrs[1].length()>1){
return;
}
}
if("0".equals(numberStr)){
numberStr = "";
}
numberStr = numberStr+addStr;
}
}
modifyEditText.setText(numberStr);
}
private OnClickListener delClickListener = new OnClickListener(){
@Override
public void onClick(View v) {
new AlertDialog.Builder(getActivity()).setTitle("提示").setMessage("确定删除这项账单").setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
DBOperation.delFinance(getActivity(), financeItem);
if(onFinanceModifyListener!=null){
onFinanceModifyListener.financeModify();
}
dismiss();
}
}).setNegativeButton("取消",null).create().show();
}
};
private OnClickListener modifyClickListener = new OnClickListener() {
@Override
public void onClick(View v) {
try {
String numberStr = modifyEditText.getText().toString();
if("".equals(numberStr)||"0".equals(numberStr)){
Toast.makeText(getActivity(), "请输入有效的内容", Toast.LENGTH_SHORT).show();
return;
}
DBOperation.modifyFinance(getActivity(), financeItem, Double.valueOf(numberStr)+"");
if(onFinanceModifyListener!=null){
onFinanceModifyListener.financeModify();
}
dismiss();
} catch (Exception e) {
Toast.makeText(getActivity(), "请输入有效的内容", Toast.LENGTH_SHORT).show();
}
}
};
}
| [
"yanglx0505@163.com"
] | yanglx0505@163.com |
5a2695f96ea5cca3812300bcad90c927d5c18831 | 5d0dbe4a8bb3c9e67e6925e5f9080f6288413cfd | /src/CustomLinkedList/Main.java | 6b693e11c37aa1a52cf4d5398777c118c90e1555 | [] | no_license | hommm5/Project_Learning_To_Code | c4e483a53ff35fcf04c9841cf75e06a99b419d93 | af46d6d439a9ba147f66f5c1d35dfa527340be68 | refs/heads/master | 2023-01-20T01:16:55.125647 | 2020-11-27T15:53:09 | 2020-11-27T15:53:09 | 307,722,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | java | package CustomLinkedList;
public class Main {
public static void main(String[] args) {
DoubleLinkedList list = new DoubleLinkedList();
list.addLast(1);
list.addLast(2);
list.addLast(3);
list.addLast(4);
list.addLast(5);
System.out.println(list.removeAt(4));
System.out.println();
}
}
| [
"hommm5@gmail.com"
] | hommm5@gmail.com |
27fe211cd6293e18c89efc1efc5c6a1c954f57b4 | 3e4600d6e131f6f4b1a1c1307fadcc1fcafedb66 | /app/src/main/java/y2019/aoc/malak/malakaoc2019/ui/slideshow/SlideshowViewModel.java | 1647130984aa5691c313e96803da5540c2e3489f | [] | no_license | malak73/MalakAoc | 5ecf7848620f318067280902baff347f95c885bb | 9d38b070733c14e8cdba64e5156001acceec8290 | refs/heads/master | 2020-07-28T20:27:04.528246 | 2020-03-23T06:46:16 | 2020-03-23T06:46:16 | 209,526,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package y2019.aoc.malak.malakaoc2019.ui.slideshow;
import android.arch.lifecycle.LiveData;
import android.arch.lifecycle.MutableLiveData;
import android.arch.lifecycle.ViewModel;
public class SlideshowViewModel extends ViewModel {
private MutableLiveData<String> mText;
public SlideshowViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is slideshow fragment");
}
public LiveData<String> getText() {
return mText;
}
} | [
"malak73a@gmail.com"
] | malak73a@gmail.com |
f6a8ebf2d709d5608f6583dee803c42d9fc44b69 | 7d461cc71566e3b7dc18eaffa2c09bd686277f97 | /Vehicle Parking/src/java/Java1.java | a02d2b347344185dbec92b94d3ee31817be0d82e | [] | no_license | rajan2244/online-parking-reservation-system | 4f41606de01a08a3167e4ad92486e9800920f930 | 577c05a2a18bf1f004159f8edf4a0788a18c9c51 | refs/heads/master | 2020-09-07T05:00:18.863932 | 2019-11-26T16:08:35 | 2019-11-26T16:08:35 | 220,663,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,244 | 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.
*/
/**
*
* @author user
*/
/*public class java1 {
public static void main(String ar[])
{
int times[]={8,9,10,11,12,13,14,15,16,17,18,19,20,21,22};
String pattern = "hh:mm";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
String time = simpleDateFormat.format(new Date());
System.out.println(time);
}
}*/
import java.util.HashMap;
public class Java1 {
public static void main(String ars[])
{
// TODO Auto-generated method stu
String str = "This this is is done by Saket Saket";
String[] a = str.split(" ");
HashMap<String,Integer> map = new HashMap<>();
for (int i=0; i<=a.length-1; i++) {
if (map.containsKey(a[i])) {
int count = map.get(a[i]);
map.put(a[i], count+1);
}
else {
map.put(a[i], 1);
}
}
System.out.println(map);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
6c805a85856f405f8338317fa7006ee02f428c8f | da45a90a8dc406e368844c6fe773d58bbeb3c56c | /src/main/java/org/petdians/common/dto/PageDTO.java | 16382d88f8caf62cca6fcf4bf640ed52c350bd6c | [] | no_license | SaveAnimals2021/Petdians | 684216d9b3817d3997481eb7db30e8947a226602 | 5fe1874b04a2131fcd0dc94003c647806373bf3e | refs/heads/master | 2023-05-06T01:55:18.641993 | 2021-05-18T06:25:14 | 2021-05-18T06:25:14 | 352,938,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package org.petdians.common.dto;
import lombok.Data;
import lombok.ToString;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Data
public class PageDTO {
private Integer page;
private Integer perSheet;
private String type, keyword;
private String day;
//default 설정
public PageDTO() {
this.page = 1;
this.perSheet = 10;
}
public Integer getSkip() {
return (page - 1) * perSheet;
}
public String[] getArr() {
if(type == null) {
return null;
}
if(keyword == null || keyword.trim().length() == 0) {
return null;
}
return type.split("");
}
}
| [
"jmw900@naver.com"
] | jmw900@naver.com |
8026afb9ab204757fe1412e3db3ea1be358dafac | bdaf4d6ed645a7cb1a2056348ab635bea985f2a6 | /Droid/obj/Debug/android/src/md599aad7114f4ec0a7abcaf7512de775e4/MainActivity.java | da1f65b2050a477d4ea3e57d401c90952fb93f7e | [] | no_license | vadabala/svvvap | ec577d90fef212b183f2332fcdb0f4503c544c83 | acaafc45b9cf348a1bffe3ed551c35dbf82a0807 | refs/heads/master | 2021-01-20T13:16:18.977158 | 2017-04-08T17:04:29 | 2017-04-08T17:04:29 | 82,678,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,222 | java | package md599aad7114f4ec0a7abcaf7512de775e4;
public class MainActivity
extends md5b60ffeb829f638581ab2bb9b1a7f4f3f.FormsAppCompatActivity
implements
mono.android.IGCUserPeer
{
/** @hide */
public static final String __md_methods;
static {
__md_methods =
"n_onCreate:(Landroid/os/Bundle;)V:GetOnCreate_Landroid_os_Bundle_Handler\n" +
"";
mono.android.Runtime.register ("SVVVAP.Droid.MainActivity, SVVVAP.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", MainActivity.class, __md_methods);
}
public MainActivity () throws java.lang.Throwable
{
super ();
if (getClass () == MainActivity.class)
mono.android.TypeManager.Activate ("SVVVAP.Droid.MainActivity, SVVVAP.Droid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { });
}
public void onCreate (android.os.Bundle p0)
{
n_onCreate (p0);
}
private native void n_onCreate (android.os.Bundle p0);
private java.util.ArrayList refList;
public void monodroidAddReference (java.lang.Object obj)
{
if (refList == null)
refList = new java.util.ArrayList ();
refList.add (obj);
}
public void monodroidClearReferences ()
{
if (refList != null)
refList.clear ();
}
}
| [
"vadabala@gmail.com"
] | vadabala@gmail.com |
3a3c973ed9c42321163fef05e0fb3eba176494ea | a1b7b419778ea045c22e230dbbb4d93843f7ccd9 | /src/lesson20/task1/exception/UserNotFoundException.java | b1f961fb2526315290978bc4fc641c7b5b4bc3ea | [] | no_license | Evgen0124/java-core-grom | a7848755333812c37209c26ee4e59a669e83eb19 | 01003d08c6991e738cd1d4f832447b7774f402f5 | refs/heads/master | 2021-01-01T18:01:43.371895 | 2018-04-02T22:18:42 | 2018-04-02T22:18:42 | 98,230,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package lesson20.task1.exception;
/**
* Created by user on 01.12.2017.
*/
public class UserNotFoundException extends Exception {
public UserNotFoundException(String message) {
super(message);
}
}
| [
"Dyndar1@mail.ru"
] | Dyndar1@mail.ru |
df220c0864bc194903f02550fcf11ecd55e663bd | f6662da73393910ab8a6892e0934e11ef4955d91 | /src/main/java/de/maxhenkel/sleepingbags/Main.java | 5db7fd937417dca3d8ba35f0b33d44e7bdb1aa2b | [] | no_license | SF-s-Translation-repository/sleeping-bags | 36aefa0800fd18f6824f5f26cbd1318877f57eff | 92cf3f5b86855c26173c4e6c8a2aac41cef15408 | refs/heads/master | 2022-11-30T03:29:42.754577 | 2020-08-13T12:30:49 | 2020-08-13T12:30:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,256 | java | package de.maxhenkel.sleepingbags;
import de.maxhenkel.corelib.CommonRegistry;
import de.maxhenkel.sleepingbags.items.ModItems;
import net.minecraft.item.Item;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@Mod(Main.MODID)
public class Main {
public static final String MODID = "sleeping_bags";
public static final Logger LOGGER = LogManager.getLogger(MODID);
public static ServerConfig SERVER_CONFIG;
public Main() {
FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class, ModItems::registerItems);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::commonSetup);
SERVER_CONFIG = CommonRegistry.registerConfig(ModConfig.Type.SERVER, ServerConfig.class);
}
@SubscribeEvent
public void commonSetup(FMLCommonSetupEvent event) {
MinecraftForge.EVENT_BUS.register(new Events());
}
}
| [
"max@maxhenkel.de"
] | max@maxhenkel.de |
f86bcfaaf40fb00d9538a32ee36e47f3d11f3b1e | 3fbbf6d8b86010165d074fefa1f91bab1caec6bc | /test/taskManager/taskList/Tasks/DeadlineTest.java | b90bbd7bde2af0c507744d05e3b4fe1e43422fae | [] | no_license | yaololo/Java-TaskManager | 4e7faa2f4f67c6a7494bd52b0bfe39d9ef0aaa3c | 80332cec3cf14f886245dfb233b3588573ac9e24 | refs/heads/master | 2020-03-30T12:54:10.446985 | 2018-11-14T17:13:35 | 2018-11-14T17:13:35 | 151,247,058 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,771 | java | package taskManager.taskList.Tasks;
import org.junit.Assert;
import org.junit.Test;
import java.text.SimpleDateFormat;
import java.util.Date;
import static org.junit.Assert.*;
public class DeadlineTest {
@Test
public void getDeadline() {
String description1 = "this is a test";
String deadline1 = "1901-02-02 12:00:00";
Deadline deadlineTest1 = new Deadline(description1, deadline1);
Assert.assertEquals(deadline1, deadlineTest1.getDeadline());
}
@Test
public void getTimeToRemindInMin() {
String description2 = "this is a test";
String deadline2 = "1901-02-02 12:00:00";
Deadline deadlineTest2 = new Deadline(description2, deadline2);
// 30 is the default reminder time
Assert.assertEquals(30, deadlineTest2.getTimeToRemindInMin());
}
@Test
public void getDetailsWhenTaskIsOverdue() {
String description3 = "this is a test";
String deadline3 = "1901-02-02 12:00:00";
Deadline deadlineTest3 = new Deadline(description3, deadline3);
String expectDescription = "this is a test\n\tIs done? No" + "\n\t1901-02-02 12:00:00" +
"\n\tCurrent setting for reminder is " +
"30 minutes before deadline";
Assert.assertEquals(expectDescription, deadlineTest3.getDetails());
}
@Test
public void getDetailsWhenTaskIsNotOverdue() {
String description4 = "this is a test";
Date expectDeadline = new Date(System.currentTimeMillis() + 3600 * 1000);
String deadline4 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(expectDeadline);
Deadline deadlineTest4 = new Deadline(description4, deadline4);
String expectDescription = "this is a test\n\tIs done? No" + "\n\t" + deadline4 +
"\n\t59 minutes until deadline"+
"\n\tCurrent setting for reminder is " +
"30 minutes before deadline";
Assert.assertEquals(expectDescription, deadlineTest4.getDetails());
}
@Test
// when duration from now until deadline is bigger than timeToRemindInMin
public void getReminderStatusReturnFalse() {
String description5 = "this is a test";
Date expectDeadline = new Date(System.currentTimeMillis() + 3600 * 1000);
String deadline5 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(expectDeadline);
Deadline deadlineTest5 = new Deadline(description5, deadline5);
Assert.assertEquals(false, deadlineTest5.getReminderStatus());
}
@Test
// when duration from now until deadline is lesser than timeToRemindInMin
public void getReminderStatusReturnTrue() {
String description6 = "this is a test";
Date expectDeadline = new Date(System.currentTimeMillis() + 1000 * 1000);
String deadline6 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(expectDeadline);
Deadline deadlineTest6 = new Deadline(description6, deadline6);
Assert.assertEquals(true, deadlineTest6.getReminderStatus());
}
String description = "this is a test";
String deadline = "1900-02-02 12:00:00";
Deadline deadlineTest = new Deadline(description, deadline);
@Test
public void getTaskType() {
Assert.assertEquals("deadline", deadlineTest.getTaskType());
}
@Test
public void setDeadline() {
String newDeadline = "1900-01-01 12:00:00";
deadlineTest.setDeadline(newDeadline);
Assert.assertEquals(newDeadline, deadlineTest.getDeadline());
}
@Test
public void setTimeToRemindInMin() {
int reminderTime = 50;
deadlineTest.setTimeToRemindInMin(50);
Assert.assertEquals(reminderTime, deadlineTest.getTimeToRemindInMin());
}
} | [
"yongming.zhuang@moneysmart.com"
] | yongming.zhuang@moneysmart.com |
a371c19620957e7e6c1d3d657607fb17e8e9505e | 1d6d358499673debf55390b51c5eb54169b699c4 | /app/src/main/java/idle/land/app/logic/api/ApiConnection.java | 797d9db6e3863a90a77953f8f72dc9c1efd0bbda | [
"MIT"
] | permissive | IdleLands/AndroidFE | 6557d83e77c46da59a9462740bcc4e4d53fd0d49 | 0c42b830d66b29de20287de4f7b4c8fef9d4b05d | refs/heads/master | 2020-05-20T15:55:30.771153 | 2015-03-24T17:38:26 | 2015-03-24T17:38:26 | 29,818,231 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,444 | java | package idle.land.app.logic.api;
import com.google.gson.JsonObject;
import idle.land.app.BuildConfig;
import retrofit.Callback;
import retrofit.RestAdapter;
import retrofit.RetrofitError;
import retrofit.client.Response;
import retrofit.http.Field;
import retrofit.http.FormUrlEncoded;
import retrofit.http.POST;
import retrofit.http.PUT;
/**
* Connection to the REST Api
* Methods with Callback are performed asynchronous
*/
public class ApiConnection {
private static final String BASE_URL = "http://api.idle.land";
ApiService service;
public ApiConnection()
{
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(BASE_URL)
.build();
if(BuildConfig.DEBUG)
adapter.setLogLevel(RestAdapter.LogLevel.FULL);
service = adapter.create(ApiService.class);
}
public void login(String identifier, String password, HeartbeatCallback cb)
{
service.login(identifier, password, cb);
}
public void turn(String identifier, String token, HeartbeatCallback cb)
{
service.turn(identifier, token, cb);
}
public void register(String identifier, String name, String password, Callback<JsonObject> cb)
{
service.register(identifier, name, password, cb);
}
/**
* Asynchronous logout without callback
*/
public void logout(String identifier, String token) { service.logout(identifier, token, new Callback<JsonObject>() {
@Override
public void success(JsonObject jsonObject, Response response) {
}
@Override
public void failure(RetrofitError error) {
}
}); }
interface ApiService {
@POST("/player/auth/login")
@FormUrlEncoded
void login(@Field("identifier") String identifier, @Field("password") String password, HeartbeatCallback callback);
@POST("/player/action/turn")
@FormUrlEncoded
void turn(@Field("identifier") String identifier, @Field("token") String token, HeartbeatCallback callback);
@POST("/player/auth/logout")
@FormUrlEncoded
void logout(@Field("identifier") String identifier, @Field("token") String token, Callback<JsonObject> cb);
@PUT("/player/auth/register")
void register(@Field("identifier") String identifier, @Field("name") String name, @Field("password") String password, Callback<JsonObject> cb);
}
}
| [
"danijob88@googlemail.com"
] | danijob88@googlemail.com |
86f95c8612194fbbd33f752a5907a7d11698891b | 396685dcd567914f51eaeb0ddc6bbe57029ea9fd | /PizzaStory/src/pizzaStoryPackage/Dough.java | 2b0a6b501afcb703006f6ae74064ce47f90f94e0 | [] | no_license | vglu/PatternDiscoveryVglu | dd2971338f1acd67a8ad5befbfd627d0deae8107 | 785545c330ebd3cd2a2f39f1e349581478fd00ea | refs/heads/master | 2016-09-10T13:53:48.017286 | 2013-06-21T14:54:30 | 2013-06-21T14:54:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 204 | java | package pizzaStoryPackage;
/**
* Created with IntelliJ IDEA.
* User: vgl
* Date: 07.06.13
* Time: 9:57
* To change this template use File | Settings | File Templates.
*/
public interface Dough {
}
| [
"vglu@inbox.ru"
] | vglu@inbox.ru |
254685aad3d318eee39884bb423ad1f3e33b8aed | e19705921a21d6401351fe20aa64fa87f858494c | /Week8/Teht 4/app/src/test/java/com/example/week84/ExampleUnitTest.java | 55a56c5fbc9ce0abd659d845953ae8bbe81b22a2 | [] | no_license | AkseliA/Olio2020 | 62579bb62710872e0cd4424fa98bab7bbed9089a | 38fd69867ce2123ecf9a2543f3f47c1cad1b2928 | refs/heads/master | 2022-06-29T23:41:26.435144 | 2020-05-07T15:20:31 | 2020-05-07T15:20:31 | 252,707,293 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package com.example.week84;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"61878488+AkseliA@users.noreply.github.com"
] | 61878488+AkseliA@users.noreply.github.com |
199494a2e6667c09270d11deb99b2f95ee4055d4 | 6b14fc33b87e740bd076be5b8a76f79fd7eff702 | /api/src/main/java/com/evolvestage/api/config/RestTemplateConfig.java | 40798ab0e65fe9886a110c6c1828070b9eeed6a7 | [] | no_license | michaelfmnk/Evolve | 699d7098b79fc5204a78cbe2f3fa19cc577e8202 | b1c0b7867ec97b2ee842d919146974e63b162d66 | refs/heads/master | 2022-12-13T03:28:31.468504 | 2019-07-13T17:59:00 | 2019-07-13T17:59:00 | 195,454,443 | 0 | 0 | null | 2022-12-10T04:34:39 | 2019-07-05T18:50:18 | Java | UTF-8 | Java | false | false | 770 | java | package com.evolvestage.api.config;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestTemplate;
@Configuration
public class RestTemplateConfig {
@Bean
public RestTemplate restTemplate(ObjectMapper objectMapper) {
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
converter.setObjectMapper(objectMapper);
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(0, converter);
return restTemplate;
}
}
| [
"michael.fmnk@gmail.com"
] | michael.fmnk@gmail.com |
8f39b5855e90d1b797ec267e184a95b2b48dab67 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project239/src/main/java/org/gradle/test/performance/largejavamultiproject/project239/p1197/Production23958.java | c3b1065a1e4c7220fd26bee4a3c9b6b5552a4e54 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,890 | java | package org.gradle.test.performance.largejavamultiproject.project239.p1197;
public class Production23958 {
private String property0;
public String getProperty0() {
return property0;
}
public void setProperty0(String value) {
property0 = value;
}
private String property1;
public String getProperty1() {
return property1;
}
public void setProperty1(String value) {
property1 = value;
}
private String property2;
public String getProperty2() {
return property2;
}
public void setProperty2(String value) {
property2 = value;
}
private String property3;
public String getProperty3() {
return property3;
}
public void setProperty3(String value) {
property3 = value;
}
private String property4;
public String getProperty4() {
return property4;
}
public void setProperty4(String value) {
property4 = value;
}
private String property5;
public String getProperty5() {
return property5;
}
public void setProperty5(String value) {
property5 = value;
}
private String property6;
public String getProperty6() {
return property6;
}
public void setProperty6(String value) {
property6 = value;
}
private String property7;
public String getProperty7() {
return property7;
}
public void setProperty7(String value) {
property7 = value;
}
private String property8;
public String getProperty8() {
return property8;
}
public void setProperty8(String value) {
property8 = value;
}
private String property9;
public String getProperty9() {
return property9;
}
public void setProperty9(String value) {
property9 = value;
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
c4d57a38e5514c8ec687597ef725dd44f47ed90b | 18fee73004b5818ded0e3ec67decdfd7f6db552a | /src/main/java/com/zuehlke/jasschallenge/client/game/strategy/utils/rules/ChooseCardRules.java | 13f11c39e2057852f46e63185141b7d3f047d636 | [] | no_license | Jass-Challenge-2020/challenge-client-java | c771bcfededee565a7ae7080169e5548fe027eb2 | fc9782d7fc4958e17f98eb6d9adcb054e5533cf1 | refs/heads/master | 2021-05-20T00:29:58.724195 | 2020-04-08T05:18:42 | 2020-04-08T05:18:42 | 252,107,328 | 0 | 0 | null | 2020-04-08T05:19:31 | 2020-04-01T07:47:23 | Java | UTF-8 | Java | false | false | 4,745 | java | package com.zuehlke.jasschallenge.client.game.strategy.utils.rules;
import com.zuehlke.jasschallenge.client.game.GameSessions;
import com.zuehlke.jasschallenge.client.game.strategy.utils.options.CardOption;
import com.zuehlke.jasschallenge.client.game.strategy.utils.options.CardOptions;
import com.zuehlke.jasschallenge.game.Trumpf;
import com.zuehlke.jasschallenge.game.cards.Card;
import com.zuehlke.jasschallenge.game.cards.Color;
import com.zuehlke.jasschallenge.game.mode.Mode;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
public class ChooseCardRules {
/**
* This rule returns the strongest card that can win the current round. If it
*/
public static ChooseCardRule CHOOSE_STRONGEST_CARD_IF_ROUND_CAN_BE_WON = (inputOptions, gameSession, allMoves) -> {
if (inputOptions.size() <= 1) {
return inputOptions;
}
Mode mode = gameSession.getCurrentRound().getMode();
List<Card> playedCards = GameSessions.getCardsPlayedInCurrentRound(gameSession);
List<CardOption> canWinRound = CardOptions.canWinRound(inputOptions, mode, playedCards);
if (canWinRound.size() <= 1) {
return inputOptions;
}
boolean trumpfPlayed = playedCards.stream().anyMatch(card -> card.getColor().equals(mode.getTrumpfColor()));
List<CardOption> trumpfOptions = canWinRound.stream()
.filter(option -> option.getCard().getColor().equals(mode.getTrumpfColor()))
.collect(Collectors.toList());
if (trumpfPlayed) {
return Collections.singletonList(
CardOptions.getMaxOption(inputOptions, Comparator.comparing(CardOption::getTrumpfRank))
);
} else if (trumpfOptions.size() > 0) {
return Collections.singletonList(
CardOptions.getMaxOption(trumpfOptions, Comparator.comparing(CardOption::getTrumpfRank))
);
} else {
return Collections.singletonList(
CardOptions.getMaxOption(inputOptions, Comparator.comparing(CardOption::getRank))
);
}
};
public static ChooseCardRule CHOOSE_WEAKEST_CARD_THAT_CAN_BE_APPLIED_TO_ROUND = (inputOptions, gameSession, allMoves) -> {
if (inputOptions.size() <= 1) {
return inputOptions;
}
Mode mode = gameSession.getCurrentRound().getMode();
List<Card> playedCards = GameSessions.getCardsPlayedInCurrentRound(gameSession);
List<CardOption> canBeApplied = CardOptions.canBeAppliedTo(inputOptions, mode, playedCards);
if (canBeApplied.size() <= 1) {
return inputOptions;
}
boolean trumpfPlayed = playedCards.stream()
.anyMatch(card -> card.getColor().equals(mode.getTrumpfColor()));
if (trumpfPlayed) {
return Collections.singletonList(
CardOptions.getMinOption(canBeApplied, Comparator.comparing(CardOption::getTrumpfRank))
);
} else {
return Collections.singletonList(
CardOptions.getMinOption(canBeApplied, Comparator.comparing(CardOption::getRank))
);
}
};
public static ChooseCardRule CHOOSE_WEAKEST_CARD = (inputOptions, gameSession, allMoves) -> {
if (inputOptions.size() <= 1) {
return inputOptions;
}
Mode mode = gameSession.getCurrentRound().getMode();
Color trumpfColor = mode.getTrumpfColor();
if (mode.getTrumpfName().equals(Trumpf.TRUMPF) || mode.getTrumpfName().equals(Trumpf.SCHIEBE)) {
final Optional<CardOption> worstOptionWithoutTrumpfCards = inputOptions.stream()
.filter(option -> !option.getCard().getColor().equals(trumpfColor))
.min(Comparator.comparing(CardOption::getRank));
if (worstOptionWithoutTrumpfCards.isPresent()) {
CardOption worstOption = worstOptionWithoutTrumpfCards.get();
return Collections.singletonList(worstOption);
} else {
CardOption worstOptionOfAllAvailableOptions = inputOptions.stream()
.min(Comparator.comparing(CardOption::getRank))
.get();
return Collections.singletonList(worstOptionOfAllAvailableOptions);
}
} else {
CardOption worstOptionOfAllAvailableOptions = inputOptions.stream()
.min(Comparator.comparing(CardOption::getRank))
.get();
return Collections.singletonList(worstOptionOfAllAvailableOptions);
}
};
}
| [
"remo@mountain-yard.ch"
] | remo@mountain-yard.ch |
29e6da3b2f9df90ae629f109355fb4e4ef25e42d | aa80dca85594c303f60dd65367935063447d76af | /src/com/coolweather/app/receiver/AutoUpdateReceiver.java | a8e9910a623f7a420222b7e00ce2017b9f0f19c6 | [
"Apache-2.0"
] | permissive | GalanXu/coolweather | 4470afdc7e7a0f0a494c8df365f48e65c8426021 | 2b4d49281a6bd296e34dfc603b56b53080a4770f | refs/heads/master | 2021-01-20T17:21:34.005816 | 2016-06-12T02:22:51 | 2016-06-12T02:22:51 | 60,076,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.coolweather.app.receiver;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.coolweather.app.service.AutoUpdateService;
public class AutoUpdateReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent i = new Intent(context, AutoUpdateService.class);
context.startService(i);
}
}
| [
"ccxgn1@163.com"
] | ccxgn1@163.com |
2bc8894a70584573443be98245e81dbd41da6cba | e5578a2af4b51036bbabda03f6c0d6b523a96b9f | /ecopass-travel/src/test/java/info/ecopass/locationhistory/ideas/TestLocationHistoryNearestProvider.java | eadcf7d1cc1e7bd81bc929115f075163e246b4a9 | [] | no_license | eco-pass/ecopass | aff88e751aae3062504df2316876351c6f47bad2 | fab846e7c6acc43edfbb0244871174b7969ecf7e | refs/heads/dev | 2022-06-09T10:54:35.289101 | 2019-09-24T15:31:52 | 2019-09-24T15:31:52 | 144,574,130 | 1 | 0 | null | 2022-05-20T20:54:12 | 2018-08-13T12:03:19 | Java | UTF-8 | Java | false | false | 917 | java | package info.ecopass.locationhistory.ideas;
import static org.junit.Assert.assertEquals;
import java.util.Date;
import java.util.List;
import org.junit.Test;
import info.ecopass.locationhistory.model.Location;
public class TestLocationHistoryNearestProvider {
private static final long ACTIVITY_BEFORE = 1539623266024L;
private static final long ACTIVITY_AFTER = 1539623245989L;
@Test
public void whenNoAmountSpecifiedAndDateIsAfterFirstEntry_thenReturnsPreviousAndNext() {
LocationHistoryNearestProvider locationHistoryFunStuff = new LocationHistoryNearestProvider();
long timestampBetweenActivities = (ACTIVITY_BEFORE + ACTIVITY_AFTER) / 2;
Date dateBetween = new Date(timestampBetweenActivities);
List<Location> result = locationHistoryFunStuff.getNearestActivities(dateBetween);
assertEquals(2, result.size());
}
@Test
public void whenFutureDateSpecified_thenReturnsLastEntry() {
}
}
| [
"gabonyibalazs@gmail.com"
] | gabonyibalazs@gmail.com |
29838ac929f2f7a9d68508ab489dec20ccffa36c | 37abbb3bc912370c88a6aec26b433421437a6e65 | /fucai/japp_common/src/main/java/com/cqfc/protocol/useraccount/UserInfo.java | c9fb55036579322997c91a15eedbc2b6882e6602 | [] | no_license | ca814495571/javawork | cb931d2c4ff5a38cdc3e3023159a276b347b7291 | bdfd0243b7957263ab7ef95a2a8f33fa040df721 | refs/heads/master | 2021-01-22T08:29:17.760092 | 2017-06-08T16:52:42 | 2017-06-08T16:52:42 | 92,620,274 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | true | 75,575 | java | /**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.cqfc.protocol.useraccount;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UserInfo implements org.apache.thrift.TBase<UserInfo, UserInfo._Fields>, java.io.Serializable, Cloneable, Comparable<UserInfo> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserInfo");
private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userId", org.apache.thrift.protocol.TType.I64, (short)1);
private static final org.apache.thrift.protocol.TField NICK_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("nickName", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField CARD_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("cardType", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField CARD_NO_FIELD_DESC = new org.apache.thrift.protocol.TField("cardNo", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final org.apache.thrift.protocol.TField MOBILE_FIELD_DESC = new org.apache.thrift.protocol.TField("mobile", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final org.apache.thrift.protocol.TField EMAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("email", org.apache.thrift.protocol.TType.STRING, (short)6);
private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)7);
private static final org.apache.thrift.protocol.TField SEX_FIELD_DESC = new org.apache.thrift.protocol.TField("sex", org.apache.thrift.protocol.TType.I32, (short)8);
private static final org.apache.thrift.protocol.TField BIRTHDAY_FIELD_DESC = new org.apache.thrift.protocol.TField("birthday", org.apache.thrift.protocol.TType.STRING, (short)9);
private static final org.apache.thrift.protocol.TField AGE_FIELD_DESC = new org.apache.thrift.protocol.TField("age", org.apache.thrift.protocol.TType.I32, (short)10);
private static final org.apache.thrift.protocol.TField USER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("userType", org.apache.thrift.protocol.TType.I32, (short)11);
private static final org.apache.thrift.protocol.TField REGISTER_TERMINAL_FIELD_DESC = new org.apache.thrift.protocol.TField("registerTerminal", org.apache.thrift.protocol.TType.I32, (short)12);
private static final org.apache.thrift.protocol.TField ACCOUNT_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("accountType", org.apache.thrift.protocol.TType.I32, (short)13);
private static final org.apache.thrift.protocol.TField PARTNER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("partnerId", org.apache.thrift.protocol.TType.STRING, (short)14);
private static final org.apache.thrift.protocol.TField PARTNER_USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("partnerUserId", org.apache.thrift.protocol.TType.STRING, (short)15);
private static final org.apache.thrift.protocol.TField PRIZE_PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("prizePassword", org.apache.thrift.protocol.TType.STRING, (short)16);
private static final org.apache.thrift.protocol.TField CREATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("createTime", org.apache.thrift.protocol.TType.STRING, (short)17);
private static final org.apache.thrift.protocol.TField LAST_UPDATE_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastUpdateTime", org.apache.thrift.protocol.TType.STRING, (short)18);
private static final org.apache.thrift.protocol.TField USER_ACCOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("userAccount", org.apache.thrift.protocol.TType.STRUCT, (short)19);
private static final org.apache.thrift.protocol.TField USER_HANDSEL_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("userHandselList", org.apache.thrift.protocol.TType.LIST, (short)20);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new UserInfoStandardSchemeFactory());
schemes.put(TupleScheme.class, new UserInfoTupleSchemeFactory());
}
public long userId; // required
public String nickName; // required
public int cardType; // required
public String cardNo; // required
public String mobile; // required
public String email; // required
public String userName; // required
public int sex; // required
public String birthday; // required
public int age; // required
public int userType; // required
public int registerTerminal; // required
public int accountType; // required
public String partnerId; // required
public String partnerUserId; // required
public String prizePassword; // required
public String createTime; // required
public String lastUpdateTime; // required
public UserAccount userAccount; // required
public List<UserHandsel> userHandselList; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
USER_ID((short)1, "userId"),
NICK_NAME((short)2, "nickName"),
CARD_TYPE((short)3, "cardType"),
CARD_NO((short)4, "cardNo"),
MOBILE((short)5, "mobile"),
EMAIL((short)6, "email"),
USER_NAME((short)7, "userName"),
SEX((short)8, "sex"),
BIRTHDAY((short)9, "birthday"),
AGE((short)10, "age"),
USER_TYPE((short)11, "userType"),
REGISTER_TERMINAL((short)12, "registerTerminal"),
ACCOUNT_TYPE((short)13, "accountType"),
PARTNER_ID((short)14, "partnerId"),
PARTNER_USER_ID((short)15, "partnerUserId"),
PRIZE_PASSWORD((short)16, "prizePassword"),
CREATE_TIME((short)17, "createTime"),
LAST_UPDATE_TIME((short)18, "lastUpdateTime"),
USER_ACCOUNT((short)19, "userAccount"),
USER_HANDSEL_LIST((short)20, "userHandselList");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // USER_ID
return USER_ID;
case 2: // NICK_NAME
return NICK_NAME;
case 3: // CARD_TYPE
return CARD_TYPE;
case 4: // CARD_NO
return CARD_NO;
case 5: // MOBILE
return MOBILE;
case 6: // EMAIL
return EMAIL;
case 7: // USER_NAME
return USER_NAME;
case 8: // SEX
return SEX;
case 9: // BIRTHDAY
return BIRTHDAY;
case 10: // AGE
return AGE;
case 11: // USER_TYPE
return USER_TYPE;
case 12: // REGISTER_TERMINAL
return REGISTER_TERMINAL;
case 13: // ACCOUNT_TYPE
return ACCOUNT_TYPE;
case 14: // PARTNER_ID
return PARTNER_ID;
case 15: // PARTNER_USER_ID
return PARTNER_USER_ID;
case 16: // PRIZE_PASSWORD
return PRIZE_PASSWORD;
case 17: // CREATE_TIME
return CREATE_TIME;
case 18: // LAST_UPDATE_TIME
return LAST_UPDATE_TIME;
case 19: // USER_ACCOUNT
return USER_ACCOUNT;
case 20: // USER_HANDSEL_LIST
return USER_HANDSEL_LIST;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __USERID_ISSET_ID = 0;
private static final int __CARDTYPE_ISSET_ID = 1;
private static final int __SEX_ISSET_ID = 2;
private static final int __AGE_ISSET_ID = 3;
private static final int __USERTYPE_ISSET_ID = 4;
private static final int __REGISTERTERMINAL_ISSET_ID = 5;
private static final int __ACCOUNTTYPE_ISSET_ID = 6;
private byte __isset_bitfield = 0;
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.NICK_NAME, new org.apache.thrift.meta_data.FieldMetaData("nickName", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.CARD_TYPE, new org.apache.thrift.meta_data.FieldMetaData("cardType", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.CARD_NO, new org.apache.thrift.meta_data.FieldMetaData("cardNo", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.MOBILE, new org.apache.thrift.meta_data.FieldMetaData("mobile", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.EMAIL, new org.apache.thrift.meta_data.FieldMetaData("email", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.USER_NAME, new org.apache.thrift.meta_data.FieldMetaData("userName", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.SEX, new org.apache.thrift.meta_data.FieldMetaData("sex", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.BIRTHDAY, new org.apache.thrift.meta_data.FieldMetaData("birthday", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.AGE, new org.apache.thrift.meta_data.FieldMetaData("age", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.USER_TYPE, new org.apache.thrift.meta_data.FieldMetaData("userType", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.REGISTER_TERMINAL, new org.apache.thrift.meta_data.FieldMetaData("registerTerminal", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.ACCOUNT_TYPE, new org.apache.thrift.meta_data.FieldMetaData("accountType", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.PARTNER_ID, new org.apache.thrift.meta_data.FieldMetaData("partnerId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PARTNER_USER_ID, new org.apache.thrift.meta_data.FieldMetaData("partnerUserId", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.PRIZE_PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("prizePassword", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.CREATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("createTime", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.LAST_UPDATE_TIME, new org.apache.thrift.meta_data.FieldMetaData("lastUpdateTime", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.USER_ACCOUNT, new org.apache.thrift.meta_data.FieldMetaData("userAccount", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserAccount.class)));
tmpMap.put(_Fields.USER_HANDSEL_LIST, new org.apache.thrift.meta_data.FieldMetaData("userHandselList", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, UserHandsel.class))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserInfo.class, metaDataMap);
}
public UserInfo() {
}
public UserInfo(
long userId,
String nickName,
int cardType,
String cardNo,
String mobile,
String email,
String userName,
int sex,
String birthday,
int age,
int userType,
int registerTerminal,
int accountType,
String partnerId,
String partnerUserId,
String prizePassword,
String createTime,
String lastUpdateTime,
UserAccount userAccount,
List<UserHandsel> userHandselList)
{
this();
this.userId = userId;
setUserIdIsSet(true);
this.nickName = nickName;
this.cardType = cardType;
setCardTypeIsSet(true);
this.cardNo = cardNo;
this.mobile = mobile;
this.email = email;
this.userName = userName;
this.sex = sex;
setSexIsSet(true);
this.birthday = birthday;
this.age = age;
setAgeIsSet(true);
this.userType = userType;
setUserTypeIsSet(true);
this.registerTerminal = registerTerminal;
setRegisterTerminalIsSet(true);
this.accountType = accountType;
setAccountTypeIsSet(true);
this.partnerId = partnerId;
this.partnerUserId = partnerUserId;
this.prizePassword = prizePassword;
this.createTime = createTime;
this.lastUpdateTime = lastUpdateTime;
this.userAccount = userAccount;
this.userHandselList = userHandselList;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public UserInfo(UserInfo other) {
__isset_bitfield = other.__isset_bitfield;
this.userId = other.userId;
if (other.isSetNickName()) {
this.nickName = other.nickName;
}
this.cardType = other.cardType;
if (other.isSetCardNo()) {
this.cardNo = other.cardNo;
}
if (other.isSetMobile()) {
this.mobile = other.mobile;
}
if (other.isSetEmail()) {
this.email = other.email;
}
if (other.isSetUserName()) {
this.userName = other.userName;
}
this.sex = other.sex;
if (other.isSetBirthday()) {
this.birthday = other.birthday;
}
this.age = other.age;
this.userType = other.userType;
this.registerTerminal = other.registerTerminal;
this.accountType = other.accountType;
if (other.isSetPartnerId()) {
this.partnerId = other.partnerId;
}
if (other.isSetPartnerUserId()) {
this.partnerUserId = other.partnerUserId;
}
if (other.isSetPrizePassword()) {
this.prizePassword = other.prizePassword;
}
if (other.isSetCreateTime()) {
this.createTime = other.createTime;
}
if (other.isSetLastUpdateTime()) {
this.lastUpdateTime = other.lastUpdateTime;
}
if (other.isSetUserAccount()) {
this.userAccount = new UserAccount(other.userAccount);
}
if (other.isSetUserHandselList()) {
List<UserHandsel> __this__userHandselList = new ArrayList<UserHandsel>(other.userHandselList.size());
for (UserHandsel other_element : other.userHandselList) {
__this__userHandselList.add(new UserHandsel(other_element));
}
this.userHandselList = __this__userHandselList;
}
}
public UserInfo deepCopy() {
return new UserInfo(this);
}
@Override
public void clear() {
setUserIdIsSet(false);
this.userId = 0;
this.nickName = null;
setCardTypeIsSet(false);
this.cardType = 0;
this.cardNo = null;
this.mobile = null;
this.email = null;
this.userName = null;
setSexIsSet(false);
this.sex = 0;
this.birthday = null;
setAgeIsSet(false);
this.age = 0;
setUserTypeIsSet(false);
this.userType = 0;
setRegisterTerminalIsSet(false);
this.registerTerminal = 0;
setAccountTypeIsSet(false);
this.accountType = 0;
this.partnerId = null;
this.partnerUserId = null;
this.prizePassword = null;
this.createTime = null;
this.lastUpdateTime = null;
this.userAccount = null;
this.userHandselList = null;
}
public long getUserId() {
return this.userId;
}
public UserInfo setUserId(long userId) {
this.userId = userId;
setUserIdIsSet(true);
return this;
}
public void unsetUserId() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __USERID_ISSET_ID);
}
/** Returns true if field userId is set (has been assigned a value) and false otherwise */
public boolean isSetUserId() {
return EncodingUtils.testBit(__isset_bitfield, __USERID_ISSET_ID);
}
public void setUserIdIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __USERID_ISSET_ID, value);
}
public String getNickName() {
return this.nickName;
}
public UserInfo setNickName(String nickName) {
this.nickName = nickName;
return this;
}
public void unsetNickName() {
this.nickName = null;
}
/** Returns true if field nickName is set (has been assigned a value) and false otherwise */
public boolean isSetNickName() {
return this.nickName != null;
}
public void setNickNameIsSet(boolean value) {
if (!value) {
this.nickName = null;
}
}
public int getCardType() {
return this.cardType;
}
public UserInfo setCardType(int cardType) {
this.cardType = cardType;
setCardTypeIsSet(true);
return this;
}
public void unsetCardType() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CARDTYPE_ISSET_ID);
}
/** Returns true if field cardType is set (has been assigned a value) and false otherwise */
public boolean isSetCardType() {
return EncodingUtils.testBit(__isset_bitfield, __CARDTYPE_ISSET_ID);
}
public void setCardTypeIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CARDTYPE_ISSET_ID, value);
}
public String getCardNo() {
return this.cardNo;
}
public UserInfo setCardNo(String cardNo) {
this.cardNo = cardNo;
return this;
}
public void unsetCardNo() {
this.cardNo = null;
}
/** Returns true if field cardNo is set (has been assigned a value) and false otherwise */
public boolean isSetCardNo() {
return this.cardNo != null;
}
public void setCardNoIsSet(boolean value) {
if (!value) {
this.cardNo = null;
}
}
public String getMobile() {
return this.mobile;
}
public UserInfo setMobile(String mobile) {
this.mobile = mobile;
return this;
}
public void unsetMobile() {
this.mobile = null;
}
/** Returns true if field mobile is set (has been assigned a value) and false otherwise */
public boolean isSetMobile() {
return this.mobile != null;
}
public void setMobileIsSet(boolean value) {
if (!value) {
this.mobile = null;
}
}
public String getEmail() {
return this.email;
}
public UserInfo setEmail(String email) {
this.email = email;
return this;
}
public void unsetEmail() {
this.email = null;
}
/** Returns true if field email is set (has been assigned a value) and false otherwise */
public boolean isSetEmail() {
return this.email != null;
}
public void setEmailIsSet(boolean value) {
if (!value) {
this.email = null;
}
}
public String getUserName() {
return this.userName;
}
public UserInfo setUserName(String userName) {
this.userName = userName;
return this;
}
public void unsetUserName() {
this.userName = null;
}
/** Returns true if field userName is set (has been assigned a value) and false otherwise */
public boolean isSetUserName() {
return this.userName != null;
}
public void setUserNameIsSet(boolean value) {
if (!value) {
this.userName = null;
}
}
public int getSex() {
return this.sex;
}
public UserInfo setSex(int sex) {
this.sex = sex;
setSexIsSet(true);
return this;
}
public void unsetSex() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SEX_ISSET_ID);
}
/** Returns true if field sex is set (has been assigned a value) and false otherwise */
public boolean isSetSex() {
return EncodingUtils.testBit(__isset_bitfield, __SEX_ISSET_ID);
}
public void setSexIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SEX_ISSET_ID, value);
}
public String getBirthday() {
return this.birthday;
}
public UserInfo setBirthday(String birthday) {
this.birthday = birthday;
return this;
}
public void unsetBirthday() {
this.birthday = null;
}
/** Returns true if field birthday is set (has been assigned a value) and false otherwise */
public boolean isSetBirthday() {
return this.birthday != null;
}
public void setBirthdayIsSet(boolean value) {
if (!value) {
this.birthday = null;
}
}
public int getAge() {
return this.age;
}
public UserInfo setAge(int age) {
this.age = age;
setAgeIsSet(true);
return this;
}
public void unsetAge() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __AGE_ISSET_ID);
}
/** Returns true if field age is set (has been assigned a value) and false otherwise */
public boolean isSetAge() {
return EncodingUtils.testBit(__isset_bitfield, __AGE_ISSET_ID);
}
public void setAgeIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __AGE_ISSET_ID, value);
}
public int getUserType() {
return this.userType;
}
public UserInfo setUserType(int userType) {
this.userType = userType;
setUserTypeIsSet(true);
return this;
}
public void unsetUserType() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __USERTYPE_ISSET_ID);
}
/** Returns true if field userType is set (has been assigned a value) and false otherwise */
public boolean isSetUserType() {
return EncodingUtils.testBit(__isset_bitfield, __USERTYPE_ISSET_ID);
}
public void setUserTypeIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __USERTYPE_ISSET_ID, value);
}
public int getRegisterTerminal() {
return this.registerTerminal;
}
public UserInfo setRegisterTerminal(int registerTerminal) {
this.registerTerminal = registerTerminal;
setRegisterTerminalIsSet(true);
return this;
}
public void unsetRegisterTerminal() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __REGISTERTERMINAL_ISSET_ID);
}
/** Returns true if field registerTerminal is set (has been assigned a value) and false otherwise */
public boolean isSetRegisterTerminal() {
return EncodingUtils.testBit(__isset_bitfield, __REGISTERTERMINAL_ISSET_ID);
}
public void setRegisterTerminalIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __REGISTERTERMINAL_ISSET_ID, value);
}
public int getAccountType() {
return this.accountType;
}
public UserInfo setAccountType(int accountType) {
this.accountType = accountType;
setAccountTypeIsSet(true);
return this;
}
public void unsetAccountType() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ACCOUNTTYPE_ISSET_ID);
}
/** Returns true if field accountType is set (has been assigned a value) and false otherwise */
public boolean isSetAccountType() {
return EncodingUtils.testBit(__isset_bitfield, __ACCOUNTTYPE_ISSET_ID);
}
public void setAccountTypeIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ACCOUNTTYPE_ISSET_ID, value);
}
public String getPartnerId() {
return this.partnerId;
}
public UserInfo setPartnerId(String partnerId) {
this.partnerId = partnerId;
return this;
}
public void unsetPartnerId() {
this.partnerId = null;
}
/** Returns true if field partnerId is set (has been assigned a value) and false otherwise */
public boolean isSetPartnerId() {
return this.partnerId != null;
}
public void setPartnerIdIsSet(boolean value) {
if (!value) {
this.partnerId = null;
}
}
public String getPartnerUserId() {
return this.partnerUserId;
}
public UserInfo setPartnerUserId(String partnerUserId) {
this.partnerUserId = partnerUserId;
return this;
}
public void unsetPartnerUserId() {
this.partnerUserId = null;
}
/** Returns true if field partnerUserId is set (has been assigned a value) and false otherwise */
public boolean isSetPartnerUserId() {
return this.partnerUserId != null;
}
public void setPartnerUserIdIsSet(boolean value) {
if (!value) {
this.partnerUserId = null;
}
}
public String getPrizePassword() {
return this.prizePassword;
}
public UserInfo setPrizePassword(String prizePassword) {
this.prizePassword = prizePassword;
return this;
}
public void unsetPrizePassword() {
this.prizePassword = null;
}
/** Returns true if field prizePassword is set (has been assigned a value) and false otherwise */
public boolean isSetPrizePassword() {
return this.prizePassword != null;
}
public void setPrizePasswordIsSet(boolean value) {
if (!value) {
this.prizePassword = null;
}
}
public String getCreateTime() {
return this.createTime;
}
public UserInfo setCreateTime(String createTime) {
this.createTime = createTime;
return this;
}
public void unsetCreateTime() {
this.createTime = null;
}
/** Returns true if field createTime is set (has been assigned a value) and false otherwise */
public boolean isSetCreateTime() {
return this.createTime != null;
}
public void setCreateTimeIsSet(boolean value) {
if (!value) {
this.createTime = null;
}
}
public String getLastUpdateTime() {
return this.lastUpdateTime;
}
public UserInfo setLastUpdateTime(String lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
return this;
}
public void unsetLastUpdateTime() {
this.lastUpdateTime = null;
}
/** Returns true if field lastUpdateTime is set (has been assigned a value) and false otherwise */
public boolean isSetLastUpdateTime() {
return this.lastUpdateTime != null;
}
public void setLastUpdateTimeIsSet(boolean value) {
if (!value) {
this.lastUpdateTime = null;
}
}
public UserAccount getUserAccount() {
return this.userAccount;
}
public UserInfo setUserAccount(UserAccount userAccount) {
this.userAccount = userAccount;
return this;
}
public void unsetUserAccount() {
this.userAccount = null;
}
/** Returns true if field userAccount is set (has been assigned a value) and false otherwise */
public boolean isSetUserAccount() {
return this.userAccount != null;
}
public void setUserAccountIsSet(boolean value) {
if (!value) {
this.userAccount = null;
}
}
public int getUserHandselListSize() {
return (this.userHandselList == null) ? 0 : this.userHandselList.size();
}
public java.util.Iterator<UserHandsel> getUserHandselListIterator() {
return (this.userHandselList == null) ? null : this.userHandselList.iterator();
}
public void addToUserHandselList(UserHandsel elem) {
if (this.userHandselList == null) {
this.userHandselList = new ArrayList<UserHandsel>();
}
this.userHandselList.add(elem);
}
public List<UserHandsel> getUserHandselList() {
return this.userHandselList;
}
public UserInfo setUserHandselList(List<UserHandsel> userHandselList) {
this.userHandselList = userHandselList;
return this;
}
public void unsetUserHandselList() {
this.userHandselList = null;
}
/** Returns true if field userHandselList is set (has been assigned a value) and false otherwise */
public boolean isSetUserHandselList() {
return this.userHandselList != null;
}
public void setUserHandselListIsSet(boolean value) {
if (!value) {
this.userHandselList = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case USER_ID:
if (value == null) {
unsetUserId();
} else {
setUserId((Long)value);
}
break;
case NICK_NAME:
if (value == null) {
unsetNickName();
} else {
setNickName((String)value);
}
break;
case CARD_TYPE:
if (value == null) {
unsetCardType();
} else {
setCardType((Integer)value);
}
break;
case CARD_NO:
if (value == null) {
unsetCardNo();
} else {
setCardNo((String)value);
}
break;
case MOBILE:
if (value == null) {
unsetMobile();
} else {
setMobile((String)value);
}
break;
case EMAIL:
if (value == null) {
unsetEmail();
} else {
setEmail((String)value);
}
break;
case USER_NAME:
if (value == null) {
unsetUserName();
} else {
setUserName((String)value);
}
break;
case SEX:
if (value == null) {
unsetSex();
} else {
setSex((Integer)value);
}
break;
case BIRTHDAY:
if (value == null) {
unsetBirthday();
} else {
setBirthday((String)value);
}
break;
case AGE:
if (value == null) {
unsetAge();
} else {
setAge((Integer)value);
}
break;
case USER_TYPE:
if (value == null) {
unsetUserType();
} else {
setUserType((Integer)value);
}
break;
case REGISTER_TERMINAL:
if (value == null) {
unsetRegisterTerminal();
} else {
setRegisterTerminal((Integer)value);
}
break;
case ACCOUNT_TYPE:
if (value == null) {
unsetAccountType();
} else {
setAccountType((Integer)value);
}
break;
case PARTNER_ID:
if (value == null) {
unsetPartnerId();
} else {
setPartnerId((String)value);
}
break;
case PARTNER_USER_ID:
if (value == null) {
unsetPartnerUserId();
} else {
setPartnerUserId((String)value);
}
break;
case PRIZE_PASSWORD:
if (value == null) {
unsetPrizePassword();
} else {
setPrizePassword((String)value);
}
break;
case CREATE_TIME:
if (value == null) {
unsetCreateTime();
} else {
setCreateTime((String)value);
}
break;
case LAST_UPDATE_TIME:
if (value == null) {
unsetLastUpdateTime();
} else {
setLastUpdateTime((String)value);
}
break;
case USER_ACCOUNT:
if (value == null) {
unsetUserAccount();
} else {
setUserAccount((UserAccount)value);
}
break;
case USER_HANDSEL_LIST:
if (value == null) {
unsetUserHandselList();
} else {
setUserHandselList((List<UserHandsel>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case USER_ID:
return Long.valueOf(getUserId());
case NICK_NAME:
return getNickName();
case CARD_TYPE:
return Integer.valueOf(getCardType());
case CARD_NO:
return getCardNo();
case MOBILE:
return getMobile();
case EMAIL:
return getEmail();
case USER_NAME:
return getUserName();
case SEX:
return Integer.valueOf(getSex());
case BIRTHDAY:
return getBirthday();
case AGE:
return Integer.valueOf(getAge());
case USER_TYPE:
return Integer.valueOf(getUserType());
case REGISTER_TERMINAL:
return Integer.valueOf(getRegisterTerminal());
case ACCOUNT_TYPE:
return Integer.valueOf(getAccountType());
case PARTNER_ID:
return getPartnerId();
case PARTNER_USER_ID:
return getPartnerUserId();
case PRIZE_PASSWORD:
return getPrizePassword();
case CREATE_TIME:
return getCreateTime();
case LAST_UPDATE_TIME:
return getLastUpdateTime();
case USER_ACCOUNT:
return getUserAccount();
case USER_HANDSEL_LIST:
return getUserHandselList();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case USER_ID:
return isSetUserId();
case NICK_NAME:
return isSetNickName();
case CARD_TYPE:
return isSetCardType();
case CARD_NO:
return isSetCardNo();
case MOBILE:
return isSetMobile();
case EMAIL:
return isSetEmail();
case USER_NAME:
return isSetUserName();
case SEX:
return isSetSex();
case BIRTHDAY:
return isSetBirthday();
case AGE:
return isSetAge();
case USER_TYPE:
return isSetUserType();
case REGISTER_TERMINAL:
return isSetRegisterTerminal();
case ACCOUNT_TYPE:
return isSetAccountType();
case PARTNER_ID:
return isSetPartnerId();
case PARTNER_USER_ID:
return isSetPartnerUserId();
case PRIZE_PASSWORD:
return isSetPrizePassword();
case CREATE_TIME:
return isSetCreateTime();
case LAST_UPDATE_TIME:
return isSetLastUpdateTime();
case USER_ACCOUNT:
return isSetUserAccount();
case USER_HANDSEL_LIST:
return isSetUserHandselList();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof UserInfo)
return this.equals((UserInfo)that);
return false;
}
public boolean equals(UserInfo that) {
if (that == null)
return false;
boolean this_present_userId = true;
boolean that_present_userId = true;
if (this_present_userId || that_present_userId) {
if (!(this_present_userId && that_present_userId))
return false;
if (this.userId != that.userId)
return false;
}
boolean this_present_nickName = true && this.isSetNickName();
boolean that_present_nickName = true && that.isSetNickName();
if (this_present_nickName || that_present_nickName) {
if (!(this_present_nickName && that_present_nickName))
return false;
if (!this.nickName.equals(that.nickName))
return false;
}
boolean this_present_cardType = true;
boolean that_present_cardType = true;
if (this_present_cardType || that_present_cardType) {
if (!(this_present_cardType && that_present_cardType))
return false;
if (this.cardType != that.cardType)
return false;
}
boolean this_present_cardNo = true && this.isSetCardNo();
boolean that_present_cardNo = true && that.isSetCardNo();
if (this_present_cardNo || that_present_cardNo) {
if (!(this_present_cardNo && that_present_cardNo))
return false;
if (!this.cardNo.equals(that.cardNo))
return false;
}
boolean this_present_mobile = true && this.isSetMobile();
boolean that_present_mobile = true && that.isSetMobile();
if (this_present_mobile || that_present_mobile) {
if (!(this_present_mobile && that_present_mobile))
return false;
if (!this.mobile.equals(that.mobile))
return false;
}
boolean this_present_email = true && this.isSetEmail();
boolean that_present_email = true && that.isSetEmail();
if (this_present_email || that_present_email) {
if (!(this_present_email && that_present_email))
return false;
if (!this.email.equals(that.email))
return false;
}
boolean this_present_userName = true && this.isSetUserName();
boolean that_present_userName = true && that.isSetUserName();
if (this_present_userName || that_present_userName) {
if (!(this_present_userName && that_present_userName))
return false;
if (!this.userName.equals(that.userName))
return false;
}
boolean this_present_sex = true;
boolean that_present_sex = true;
if (this_present_sex || that_present_sex) {
if (!(this_present_sex && that_present_sex))
return false;
if (this.sex != that.sex)
return false;
}
boolean this_present_birthday = true && this.isSetBirthday();
boolean that_present_birthday = true && that.isSetBirthday();
if (this_present_birthday || that_present_birthday) {
if (!(this_present_birthday && that_present_birthday))
return false;
if (!this.birthday.equals(that.birthday))
return false;
}
boolean this_present_age = true;
boolean that_present_age = true;
if (this_present_age || that_present_age) {
if (!(this_present_age && that_present_age))
return false;
if (this.age != that.age)
return false;
}
boolean this_present_userType = true;
boolean that_present_userType = true;
if (this_present_userType || that_present_userType) {
if (!(this_present_userType && that_present_userType))
return false;
if (this.userType != that.userType)
return false;
}
boolean this_present_registerTerminal = true;
boolean that_present_registerTerminal = true;
if (this_present_registerTerminal || that_present_registerTerminal) {
if (!(this_present_registerTerminal && that_present_registerTerminal))
return false;
if (this.registerTerminal != that.registerTerminal)
return false;
}
boolean this_present_accountType = true;
boolean that_present_accountType = true;
if (this_present_accountType || that_present_accountType) {
if (!(this_present_accountType && that_present_accountType))
return false;
if (this.accountType != that.accountType)
return false;
}
boolean this_present_partnerId = true && this.isSetPartnerId();
boolean that_present_partnerId = true && that.isSetPartnerId();
if (this_present_partnerId || that_present_partnerId) {
if (!(this_present_partnerId && that_present_partnerId))
return false;
if (!this.partnerId.equals(that.partnerId))
return false;
}
boolean this_present_partnerUserId = true && this.isSetPartnerUserId();
boolean that_present_partnerUserId = true && that.isSetPartnerUserId();
if (this_present_partnerUserId || that_present_partnerUserId) {
if (!(this_present_partnerUserId && that_present_partnerUserId))
return false;
if (!this.partnerUserId.equals(that.partnerUserId))
return false;
}
boolean this_present_prizePassword = true && this.isSetPrizePassword();
boolean that_present_prizePassword = true && that.isSetPrizePassword();
if (this_present_prizePassword || that_present_prizePassword) {
if (!(this_present_prizePassword && that_present_prizePassword))
return false;
if (!this.prizePassword.equals(that.prizePassword))
return false;
}
boolean this_present_createTime = true && this.isSetCreateTime();
boolean that_present_createTime = true && that.isSetCreateTime();
if (this_present_createTime || that_present_createTime) {
if (!(this_present_createTime && that_present_createTime))
return false;
if (!this.createTime.equals(that.createTime))
return false;
}
boolean this_present_lastUpdateTime = true && this.isSetLastUpdateTime();
boolean that_present_lastUpdateTime = true && that.isSetLastUpdateTime();
if (this_present_lastUpdateTime || that_present_lastUpdateTime) {
if (!(this_present_lastUpdateTime && that_present_lastUpdateTime))
return false;
if (!this.lastUpdateTime.equals(that.lastUpdateTime))
return false;
}
boolean this_present_userAccount = true && this.isSetUserAccount();
boolean that_present_userAccount = true && that.isSetUserAccount();
if (this_present_userAccount || that_present_userAccount) {
if (!(this_present_userAccount && that_present_userAccount))
return false;
if (!this.userAccount.equals(that.userAccount))
return false;
}
boolean this_present_userHandselList = true && this.isSetUserHandselList();
boolean that_present_userHandselList = true && that.isSetUserHandselList();
if (this_present_userHandselList || that_present_userHandselList) {
if (!(this_present_userHandselList && that_present_userHandselList))
return false;
if (!this.userHandselList.equals(that.userHandselList))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public int compareTo(UserInfo other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetUserId()).compareTo(other.isSetUserId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUserId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userId, other.userId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNickName()).compareTo(other.isSetNickName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNickName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nickName, other.nickName);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCardType()).compareTo(other.isSetCardType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCardType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardType, other.cardType);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCardNo()).compareTo(other.isSetCardNo());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCardNo()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cardNo, other.cardNo);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMobile()).compareTo(other.isSetMobile());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMobile()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mobile, other.mobile);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetEmail()).compareTo(other.isSetEmail());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetEmail()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.email, other.email);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUserName()).compareTo(other.isSetUserName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUserName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userName, other.userName);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSex()).compareTo(other.isSetSex());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSex()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.sex, other.sex);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetBirthday()).compareTo(other.isSetBirthday());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetBirthday()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.birthday, other.birthday);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAge()).compareTo(other.isSetAge());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAge()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.age, other.age);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUserType()).compareTo(other.isSetUserType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUserType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userType, other.userType);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRegisterTerminal()).compareTo(other.isSetRegisterTerminal());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRegisterTerminal()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.registerTerminal, other.registerTerminal);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetAccountType()).compareTo(other.isSetAccountType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAccountType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.accountType, other.accountType);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPartnerId()).compareTo(other.isSetPartnerId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPartnerId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partnerId, other.partnerId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPartnerUserId()).compareTo(other.isSetPartnerUserId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPartnerUserId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.partnerUserId, other.partnerUserId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetPrizePassword()).compareTo(other.isSetPrizePassword());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetPrizePassword()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.prizePassword, other.prizePassword);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetCreateTime()).compareTo(other.isSetCreateTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCreateTime()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.createTime, other.createTime);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetLastUpdateTime()).compareTo(other.isSetLastUpdateTime());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLastUpdateTime()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastUpdateTime, other.lastUpdateTime);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUserAccount()).compareTo(other.isSetUserAccount());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUserAccount()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userAccount, other.userAccount);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetUserHandselList()).compareTo(other.isSetUserHandselList());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetUserHandselList()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userHandselList, other.userHandselList);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("UserInfo(");
boolean first = true;
sb.append("userId:");
sb.append(this.userId);
first = false;
if (!first) sb.append(", ");
sb.append("nickName:");
if (this.nickName == null) {
sb.append("null");
} else {
sb.append(this.nickName);
}
first = false;
if (!first) sb.append(", ");
sb.append("cardType:");
sb.append(this.cardType);
first = false;
if (!first) sb.append(", ");
sb.append("cardNo:");
if (this.cardNo == null) {
sb.append("null");
} else {
sb.append(this.cardNo);
}
first = false;
if (!first) sb.append(", ");
sb.append("mobile:");
if (this.mobile == null) {
sb.append("null");
} else {
sb.append(this.mobile);
}
first = false;
if (!first) sb.append(", ");
sb.append("email:");
if (this.email == null) {
sb.append("null");
} else {
sb.append(this.email);
}
first = false;
if (!first) sb.append(", ");
sb.append("userName:");
if (this.userName == null) {
sb.append("null");
} else {
sb.append(this.userName);
}
first = false;
if (!first) sb.append(", ");
sb.append("sex:");
sb.append(this.sex);
first = false;
if (!first) sb.append(", ");
sb.append("birthday:");
if (this.birthday == null) {
sb.append("null");
} else {
sb.append(this.birthday);
}
first = false;
if (!first) sb.append(", ");
sb.append("age:");
sb.append(this.age);
first = false;
if (!first) sb.append(", ");
sb.append("userType:");
sb.append(this.userType);
first = false;
if (!first) sb.append(", ");
sb.append("registerTerminal:");
sb.append(this.registerTerminal);
first = false;
if (!first) sb.append(", ");
sb.append("accountType:");
sb.append(this.accountType);
first = false;
if (!first) sb.append(", ");
sb.append("partnerId:");
if (this.partnerId == null) {
sb.append("null");
} else {
sb.append(this.partnerId);
}
first = false;
if (!first) sb.append(", ");
sb.append("partnerUserId:");
if (this.partnerUserId == null) {
sb.append("null");
} else {
sb.append(this.partnerUserId);
}
first = false;
if (!first) sb.append(", ");
sb.append("prizePassword:");
if (this.prizePassword == null) {
sb.append("null");
} else {
sb.append(this.prizePassword);
}
first = false;
if (!first) sb.append(", ");
sb.append("createTime:");
if (this.createTime == null) {
sb.append("null");
} else {
sb.append(this.createTime);
}
first = false;
if (!first) sb.append(", ");
sb.append("lastUpdateTime:");
if (this.lastUpdateTime == null) {
sb.append("null");
} else {
sb.append(this.lastUpdateTime);
}
first = false;
if (!first) sb.append(", ");
sb.append("userAccount:");
if (this.userAccount == null) {
sb.append("null");
} else {
sb.append(this.userAccount);
}
first = false;
if (!first) sb.append(", ");
sb.append("userHandselList:");
if (this.userHandselList == null) {
sb.append("null");
} else {
sb.append(this.userHandselList);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
if (userAccount != null) {
userAccount.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
// it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
__isset_bitfield = 0;
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class UserInfoStandardSchemeFactory implements SchemeFactory {
public UserInfoStandardScheme getScheme() {
return new UserInfoStandardScheme();
}
}
private static class UserInfoStandardScheme extends StandardScheme<UserInfo> {
public void read(org.apache.thrift.protocol.TProtocol iprot, UserInfo struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // USER_ID
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.userId = iprot.readI64();
struct.setUserIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // NICK_NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.nickName = iprot.readString();
struct.setNickNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // CARD_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.cardType = iprot.readI32();
struct.setCardTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // CARD_NO
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.cardNo = iprot.readString();
struct.setCardNoIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 5: // MOBILE
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.mobile = iprot.readString();
struct.setMobileIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 6: // EMAIL
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.email = iprot.readString();
struct.setEmailIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 7: // USER_NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.userName = iprot.readString();
struct.setUserNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 8: // SEX
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.sex = iprot.readI32();
struct.setSexIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 9: // BIRTHDAY
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.birthday = iprot.readString();
struct.setBirthdayIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 10: // AGE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.age = iprot.readI32();
struct.setAgeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 11: // USER_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.userType = iprot.readI32();
struct.setUserTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 12: // REGISTER_TERMINAL
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.registerTerminal = iprot.readI32();
struct.setRegisterTerminalIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 13: // ACCOUNT_TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.accountType = iprot.readI32();
struct.setAccountTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 14: // PARTNER_ID
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.partnerId = iprot.readString();
struct.setPartnerIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 15: // PARTNER_USER_ID
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.partnerUserId = iprot.readString();
struct.setPartnerUserIdIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 16: // PRIZE_PASSWORD
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.prizePassword = iprot.readString();
struct.setPrizePasswordIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 17: // CREATE_TIME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.createTime = iprot.readString();
struct.setCreateTimeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 18: // LAST_UPDATE_TIME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.lastUpdateTime = iprot.readString();
struct.setLastUpdateTimeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 19: // USER_ACCOUNT
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.userAccount = new UserAccount();
struct.userAccount.read(iprot);
struct.setUserAccountIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 20: // USER_HANDSEL_LIST
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list8 = iprot.readListBegin();
struct.userHandselList = new ArrayList<UserHandsel>(_list8.size);
for (int _i9 = 0; _i9 < _list8.size; ++_i9)
{
UserHandsel _elem10;
_elem10 = new UserHandsel();
_elem10.read(iprot);
struct.userHandselList.add(_elem10);
}
iprot.readListEnd();
}
struct.setUserHandselListIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, UserInfo struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(USER_ID_FIELD_DESC);
oprot.writeI64(struct.userId);
oprot.writeFieldEnd();
if (struct.nickName != null) {
oprot.writeFieldBegin(NICK_NAME_FIELD_DESC);
oprot.writeString(struct.nickName);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(CARD_TYPE_FIELD_DESC);
oprot.writeI32(struct.cardType);
oprot.writeFieldEnd();
if (struct.cardNo != null) {
oprot.writeFieldBegin(CARD_NO_FIELD_DESC);
oprot.writeString(struct.cardNo);
oprot.writeFieldEnd();
}
if (struct.mobile != null) {
oprot.writeFieldBegin(MOBILE_FIELD_DESC);
oprot.writeString(struct.mobile);
oprot.writeFieldEnd();
}
if (struct.email != null) {
oprot.writeFieldBegin(EMAIL_FIELD_DESC);
oprot.writeString(struct.email);
oprot.writeFieldEnd();
}
if (struct.userName != null) {
oprot.writeFieldBegin(USER_NAME_FIELD_DESC);
oprot.writeString(struct.userName);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(SEX_FIELD_DESC);
oprot.writeI32(struct.sex);
oprot.writeFieldEnd();
if (struct.birthday != null) {
oprot.writeFieldBegin(BIRTHDAY_FIELD_DESC);
oprot.writeString(struct.birthday);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(AGE_FIELD_DESC);
oprot.writeI32(struct.age);
oprot.writeFieldEnd();
oprot.writeFieldBegin(USER_TYPE_FIELD_DESC);
oprot.writeI32(struct.userType);
oprot.writeFieldEnd();
oprot.writeFieldBegin(REGISTER_TERMINAL_FIELD_DESC);
oprot.writeI32(struct.registerTerminal);
oprot.writeFieldEnd();
oprot.writeFieldBegin(ACCOUNT_TYPE_FIELD_DESC);
oprot.writeI32(struct.accountType);
oprot.writeFieldEnd();
if (struct.partnerId != null) {
oprot.writeFieldBegin(PARTNER_ID_FIELD_DESC);
oprot.writeString(struct.partnerId);
oprot.writeFieldEnd();
}
if (struct.partnerUserId != null) {
oprot.writeFieldBegin(PARTNER_USER_ID_FIELD_DESC);
oprot.writeString(struct.partnerUserId);
oprot.writeFieldEnd();
}
if (struct.prizePassword != null) {
oprot.writeFieldBegin(PRIZE_PASSWORD_FIELD_DESC);
oprot.writeString(struct.prizePassword);
oprot.writeFieldEnd();
}
if (struct.createTime != null) {
oprot.writeFieldBegin(CREATE_TIME_FIELD_DESC);
oprot.writeString(struct.createTime);
oprot.writeFieldEnd();
}
if (struct.lastUpdateTime != null) {
oprot.writeFieldBegin(LAST_UPDATE_TIME_FIELD_DESC);
oprot.writeString(struct.lastUpdateTime);
oprot.writeFieldEnd();
}
if (struct.userAccount != null) {
oprot.writeFieldBegin(USER_ACCOUNT_FIELD_DESC);
struct.userAccount.write(oprot);
oprot.writeFieldEnd();
}
if (struct.userHandselList != null) {
oprot.writeFieldBegin(USER_HANDSEL_LIST_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.userHandselList.size()));
for (UserHandsel _iter11 : struct.userHandselList)
{
_iter11.write(oprot);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class UserInfoTupleSchemeFactory implements SchemeFactory {
public UserInfoTupleScheme getScheme() {
return new UserInfoTupleScheme();
}
}
private static class UserInfoTupleScheme extends TupleScheme<UserInfo> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetUserId()) {
optionals.set(0);
}
if (struct.isSetNickName()) {
optionals.set(1);
}
if (struct.isSetCardType()) {
optionals.set(2);
}
if (struct.isSetCardNo()) {
optionals.set(3);
}
if (struct.isSetMobile()) {
optionals.set(4);
}
if (struct.isSetEmail()) {
optionals.set(5);
}
if (struct.isSetUserName()) {
optionals.set(6);
}
if (struct.isSetSex()) {
optionals.set(7);
}
if (struct.isSetBirthday()) {
optionals.set(8);
}
if (struct.isSetAge()) {
optionals.set(9);
}
if (struct.isSetUserType()) {
optionals.set(10);
}
if (struct.isSetRegisterTerminal()) {
optionals.set(11);
}
if (struct.isSetAccountType()) {
optionals.set(12);
}
if (struct.isSetPartnerId()) {
optionals.set(13);
}
if (struct.isSetPartnerUserId()) {
optionals.set(14);
}
if (struct.isSetPrizePassword()) {
optionals.set(15);
}
if (struct.isSetCreateTime()) {
optionals.set(16);
}
if (struct.isSetLastUpdateTime()) {
optionals.set(17);
}
if (struct.isSetUserAccount()) {
optionals.set(18);
}
if (struct.isSetUserHandselList()) {
optionals.set(19);
}
oprot.writeBitSet(optionals, 20);
if (struct.isSetUserId()) {
oprot.writeI64(struct.userId);
}
if (struct.isSetNickName()) {
oprot.writeString(struct.nickName);
}
if (struct.isSetCardType()) {
oprot.writeI32(struct.cardType);
}
if (struct.isSetCardNo()) {
oprot.writeString(struct.cardNo);
}
if (struct.isSetMobile()) {
oprot.writeString(struct.mobile);
}
if (struct.isSetEmail()) {
oprot.writeString(struct.email);
}
if (struct.isSetUserName()) {
oprot.writeString(struct.userName);
}
if (struct.isSetSex()) {
oprot.writeI32(struct.sex);
}
if (struct.isSetBirthday()) {
oprot.writeString(struct.birthday);
}
if (struct.isSetAge()) {
oprot.writeI32(struct.age);
}
if (struct.isSetUserType()) {
oprot.writeI32(struct.userType);
}
if (struct.isSetRegisterTerminal()) {
oprot.writeI32(struct.registerTerminal);
}
if (struct.isSetAccountType()) {
oprot.writeI32(struct.accountType);
}
if (struct.isSetPartnerId()) {
oprot.writeString(struct.partnerId);
}
if (struct.isSetPartnerUserId()) {
oprot.writeString(struct.partnerUserId);
}
if (struct.isSetPrizePassword()) {
oprot.writeString(struct.prizePassword);
}
if (struct.isSetCreateTime()) {
oprot.writeString(struct.createTime);
}
if (struct.isSetLastUpdateTime()) {
oprot.writeString(struct.lastUpdateTime);
}
if (struct.isSetUserAccount()) {
struct.userAccount.write(oprot);
}
if (struct.isSetUserHandselList()) {
{
oprot.writeI32(struct.userHandselList.size());
for (UserHandsel _iter12 : struct.userHandselList)
{
_iter12.write(oprot);
}
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, UserInfo struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(20);
if (incoming.get(0)) {
struct.userId = iprot.readI64();
struct.setUserIdIsSet(true);
}
if (incoming.get(1)) {
struct.nickName = iprot.readString();
struct.setNickNameIsSet(true);
}
if (incoming.get(2)) {
struct.cardType = iprot.readI32();
struct.setCardTypeIsSet(true);
}
if (incoming.get(3)) {
struct.cardNo = iprot.readString();
struct.setCardNoIsSet(true);
}
if (incoming.get(4)) {
struct.mobile = iprot.readString();
struct.setMobileIsSet(true);
}
if (incoming.get(5)) {
struct.email = iprot.readString();
struct.setEmailIsSet(true);
}
if (incoming.get(6)) {
struct.userName = iprot.readString();
struct.setUserNameIsSet(true);
}
if (incoming.get(7)) {
struct.sex = iprot.readI32();
struct.setSexIsSet(true);
}
if (incoming.get(8)) {
struct.birthday = iprot.readString();
struct.setBirthdayIsSet(true);
}
if (incoming.get(9)) {
struct.age = iprot.readI32();
struct.setAgeIsSet(true);
}
if (incoming.get(10)) {
struct.userType = iprot.readI32();
struct.setUserTypeIsSet(true);
}
if (incoming.get(11)) {
struct.registerTerminal = iprot.readI32();
struct.setRegisterTerminalIsSet(true);
}
if (incoming.get(12)) {
struct.accountType = iprot.readI32();
struct.setAccountTypeIsSet(true);
}
if (incoming.get(13)) {
struct.partnerId = iprot.readString();
struct.setPartnerIdIsSet(true);
}
if (incoming.get(14)) {
struct.partnerUserId = iprot.readString();
struct.setPartnerUserIdIsSet(true);
}
if (incoming.get(15)) {
struct.prizePassword = iprot.readString();
struct.setPrizePasswordIsSet(true);
}
if (incoming.get(16)) {
struct.createTime = iprot.readString();
struct.setCreateTimeIsSet(true);
}
if (incoming.get(17)) {
struct.lastUpdateTime = iprot.readString();
struct.setLastUpdateTimeIsSet(true);
}
if (incoming.get(18)) {
struct.userAccount = new UserAccount();
struct.userAccount.read(iprot);
struct.setUserAccountIsSet(true);
}
if (incoming.get(19)) {
{
org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
struct.userHandselList = new ArrayList<UserHandsel>(_list13.size);
for (int _i14 = 0; _i14 < _list13.size; ++_i14)
{
UserHandsel _elem15;
_elem15 = new UserHandsel();
_elem15.read(iprot);
struct.userHandselList.add(_elem15);
}
}
struct.setUserHandselListIsSet(true);
}
}
}
}
| [
"an__chen@163.com"
] | an__chen@163.com |
9c7536ce624bd3fad4bd0648e9b6884e9368ffea | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_48637.java | 816ba71583305fd80fa0c23c09fa1dd8728e4b5e | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | public SliceQuery getQuery(final InternalRelationType type,Direction dir){
CacheEntry ce;
try {
ce=cache.get(type.longId(),() -> new CacheEntry(edgeSerializer,type));
}
catch ( ExecutionException e) {
throw new AssertionError("Should not happen: " + e.getMessage());
}
assert ce != null;
return ce.get(dir);
}
| [
"sonnguyen@utdallas.edu"
] | sonnguyen@utdallas.edu |
0308d544ccb873ea52fadb3ef572b72a5587729a | 6a7b2066455d580c6c07e65bb6652408e23b7b3c | /src/main/java/ru/sbrf/atm/client/Card.java | f35f77cf541cc22749637d222faf70679c189b46 | [] | no_license | Qvasov/atm | c407db5a9cefdba5530712e3ffbc010d3fd49824 | 901585dccb8b3745ced2c565317264ada791d364 | refs/heads/master | 2022-12-17T18:32:07.306974 | 2020-09-13T19:12:24 | 2020-09-13T19:12:24 | 283,583,489 | 0 | 0 | null | 2020-09-23T19:56:15 | 2020-07-29T19:19:33 | Java | UTF-8 | Java | false | false | 1,213 | java | package ru.sbrf.atm.client;
import lombok.Getter;
import ru.sbrf.atm.client.method.Pin;
import ru.sbrf.atm.server.Account;
import ru.sbrf.atm.server.Bank;
import ru.sbrf.atm.server.Currency;
import ru.sbrf.atm.server.SavingAccount;
/**
* Создаёт карту, которая содержит номер счета и номер клинта которому принаджлежит.
*
* Если не указывать номер клиента в банке, то создатся новый номер клиента.
*/
public class Card {
private String number;
@Getter
private String accountNumber;
@Getter
private long clientNumber;
public Card(Bank bank, Long clientNumber) {
this.number = String.format("%016d", bank.getNewCardNumber());
this.clientNumber = bank.getClient(clientNumber).getNumber();
SavingAccount account = new SavingAccount(Currency.RUR, bank.getClient(clientNumber).getNumber());
this.accountNumber = account.getNumber();
bank.getClient(clientNumber).putAccount(account);
bank.getClient(clientNumber).putSecret(new Pin("1234"));
}
public Card(Bank bank) {
this(bank, null);
}
}
| [
"Qvasov@gmail.com"
] | Qvasov@gmail.com |
6d1754e08694f4ea3397154024afec14c0aaf3ec | a9891ed8029cd948e44bd4229b684f82d8ee0c8c | /src/main/java/vote/controllers/VoteController.java | 35a15ed6b2d855f678ded50f7656956f4e8f5927 | [] | no_license | jordanbethea/everybody-vote-spring | 840d5c34c2503ae57436973589c4feaeffa2e2fd | 7a3434de295c2364a11975037bc3e6393292e32e | refs/heads/master | 2021-04-27T00:04:56.661565 | 2018-08-08T20:19:53 | 2018-08-08T20:19:53 | 123,747,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,003 | java | package vote.controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.view.RedirectView;
import vote.repositories.SelectionRepository;
import vote.repositories.SlateRepository;
import vote.repositories.BallotRepository;
import vote.repositories.RankedChoiceRepository;
import vote.model.RankedChoice;
import org.springframework.validation.BindingResult;
import javax.servlet.http.HttpServletRequest;
import org.springframework.ui.Model;
import vote.model.Ballot;
import vote.model.Slate;
@Controller
@RequestMapping("/vote")
public class VoteController {
private final SelectionRepository selRepository;
private final SlateRepository slateRepository;
private final BallotRepository ballotRepository;
private final RankedChoiceRepository rankRepository;
@Autowired
public VoteController(SelectionRepository selRepository, SlateRepository slateRepository,
BallotRepository ballotRepository, RankedChoiceRepository rankRepository) {
this.selRepository = selRepository;
this.slateRepository = slateRepository;
this.ballotRepository = ballotRepository;
this.rankRepository = rankRepository;
}
@RequestMapping(value="/{slateIDs}", method= RequestMethod.GET)
public String newVote(@PathVariable String slateIDs, Model model) {
Long slateID = new Long(slateIDs);
Slate chosenSlate = slateRepository.findOne(slateID);
model.addAttribute("slate", chosenSlate);
Ballot newBallot = new Ballot();
newBallot.setVotedSlate(chosenSlate);
model.addAttribute("ballot", newBallot);
return "votingForm";
}
@RequestMapping(value="/{slateIDs}/create", params={"rankDown"})
public String rankDown(@PathVariable String slateIDs, @ModelAttribute Ballot newBallot, final BindingResult bindingResult,
final HttpServletRequest req, Model model) {
Long slateID = new Long(slateIDs);
Slate chosenSlate = slateRepository.findOne(slateID);
model.addAttribute("slate", chosenSlate);
int ranking = new Integer(req.getParameter("rankDown"));
newBallot.rankVoteDown(ranking);
model.addAttribute("ballot", newBallot);
return "votingForm";
}
@RequestMapping(value="/{slateIDs}/create", params={"rankUp"})
public String rankUp(@PathVariable String slateIDs, @ModelAttribute Ballot newBallot, final BindingResult bindingResult,
final HttpServletRequest req, Model model) {
Long slateID = new Long(slateIDs);
Slate chosenSlate = slateRepository.findOne(slateID);
model.addAttribute("slate", chosenSlate);
int ranking = new Integer(req.getParameter("rankUp"));
newBallot.rankVoteUp(ranking);
model.addAttribute("ballot", newBallot);
return "votingForm";
}
@RequestMapping(value="/{slateIDs}/create", method=RequestMethod.POST)
public RedirectView castVote(@PathVariable String slateIDs, @ModelAttribute Ballot newBallot, Model model) {
Long slateID = new Long(slateIDs);
Slate chosenSlate = slateRepository.findOne(slateID);
newBallot.setVotedSlate(chosenSlate);
ballotRepository.save(newBallot);
for(RankedChoice choice : newBallot.getRankedChoices()) {
choice.setBallot(newBallot);
rankRepository.save(choice);
}
return new RedirectView("/slate/show/"+chosenSlate.getId());
}
/*@RequestMapping("/")
public String index() {
return "Get ready to vote on stuff";
}*/
}
| [
"jordan.bethea@gmail.com"
] | jordan.bethea@gmail.com |
f954bb574b4fc79ad6a39f2b0687797bcae52988 | f49ea161e8150243e2e81ca37e0e35b7a77e47ed | /src/main/java/net/atos/demo/config/Constants.java | 4f701d5c9f75527948e0c70b02e638ccfdc7d70e | [] | no_license | mac8088/dtm_easytrans_wallet_ms | a6e5b62f6d19a0df00eef64cad8fd57b9766dd5c | baf05f711f92c3506223e5b13a228f641792b9ee | refs/heads/master | 2022-12-22T10:10:54.817346 | 2019-12-19T09:08:25 | 2019-12-19T09:08:25 | 229,012,755 | 0 | 0 | null | 2022-12-16T04:41:07 | 2019-12-19T08:47:47 | Java | UTF-8 | Java | false | false | 190 | java | package net.atos.demo.config;
/**
* Application constants.
*/
public final class Constants {
public static final String SYSTEM_ACCOUNT = "system";
private Constants() {
}
}
| [
"chun.ma@qq.com"
] | chun.ma@qq.com |
400ae114de4a131a050a1ac0421c6bc0eefca809 | 844688472680f60f9dfb357d8ebf36025059a457 | /app/src/main/java/com/example/imageapp/di/ActivityScoped.java | a8a2a1599d3be4c9c9d655d46900ef2fd19fbab8 | [] | no_license | rkandoroidrepo/ImageApp | effe09dfbc60ce0f758a13346cef9242d60a1627 | 27590eed0f1de56bd84e52248386fedbcf6f2ddd | refs/heads/master | 2020-08-27T22:58:42.936954 | 2019-10-25T10:48:42 | 2019-10-25T10:48:42 | 217,513,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 278 | java | package com.example.imageapp.di;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Scope;
@Documented
@Scope
@Retention(RetentionPolicy.RUNTIME)
public @interface ActivityScoped {
} | [
"Ramkrishna.Kushwaha@jdplc.com"
] | Ramkrishna.Kushwaha@jdplc.com |
33b7a206cb47c0eb895adbe56137e21445af0e59 | 6e0ac98e17317b0ddd32bf6da7af00cc817b2d89 | /guru99test/src/guru99test/LoginOfId.java | 28cff6997853cf32a1bc5fb09ece31e96dc22831 | [] | no_license | AravindArmstrong/guru99-projects | b7815ea74050da5ea8a4498833653c7bcc52703d | fd0fc7c9c5b33e177c12d5cc508e385b93548a8f | refs/heads/master | 2020-03-23T16:00:08.793103 | 2018-07-22T06:42:56 | 2018-07-22T06:42:56 | 141,788,894 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package guru99test;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class LoginOfId {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","D://DEVIBALA//chromedriver_win32//chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://www.demo.guru99.com/V4/");
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().window().maximize();
WebElement username=driver.findElement(By.name("uid"));
username.sendKeys("mngr142992");
WebElement password=driver.findElement(By.name("password"));
password.sendKeys("gUqevem");
WebElement loginbutton=driver.findElement(By.name("btnLogin"));
loginbutton.click();
}
}
| [
"Admin@DesignExperts07"
] | Admin@DesignExperts07 |
ea79649d60add4f1bac9486bc7f502c15fb035e3 | 3590e22970736e4dea27af842318c1a46db1f10e | /azure-functions-gradle-plugin/src/main/java/com/microsoft/azure/plugin/functions/gradle/task/DeployTask.java | c78ff0d63e39f8a6490ca84b75710e2af63a7d5c | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | Global-localhost/azure-gradle-plugins | 8e9829fefefbb8049b1f8fe7086ffe1f4068f7c2 | dbec098dd6f011e496e3d1f2f83d30aef88d110c | refs/heads/master | 2023-02-25T10:56:26.506244 | 2021-02-04T00:46:04 | 2021-02-04T00:46:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,063 | java | /*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
package com.microsoft.azure.plugin.functions.gradle.task;
import com.microsoft.azure.common.exceptions.AzureExecutionException;
import com.microsoft.azure.common.logging.Log;
import com.microsoft.azure.plugin.functions.gradle.AzureFunctionsExtension;
import com.microsoft.azure.plugin.functions.gradle.GradleFunctionContext;
import com.microsoft.azure.plugin.functions.gradle.handler.DeployHandler;
import com.microsoft.azure.plugin.functions.gradle.telemetry.TelemetryAgent;
import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
import org.gradle.api.tasks.Nested;
import org.gradle.api.tasks.TaskAction;
import javax.annotation.Nullable;
public class DeployTask extends DefaultTask implements IFunctionTask {
private static final String DEPLOY_FAILURE = "Cannot deploy functions due to error: ";
@Nullable
private AzureFunctionsExtension functionsExtension;
public IFunctionTask setFunctionsExtension(final AzureFunctionsExtension functionsExtension) {
this.functionsExtension = functionsExtension;
return this;
}
@Nested
@Nullable
public AzureFunctionsExtension getFunctionsExtension() {
return functionsExtension;
}
@TaskAction
public void deploy() throws GradleException {
try {
TelemetryAgent.instance.trackTaskStart(this.getClass());
final GradleFunctionContext ctx = new GradleFunctionContext(getProject(), this.getFunctionsExtension());
final DeployHandler deployHandler = new DeployHandler(ctx);
deployHandler.execute();
TelemetryAgent.instance.trackTaskSuccess(this.getClass());
} catch (final AzureExecutionException e) {
Log.error(e);
TelemetryAgent.instance.traceException(this.getClass(), e);
throw new GradleException(DEPLOY_FAILURE + e.getMessage(), e);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
115571a8febddea1d975216742f56bd1e763c999 | 8882c2dc3bbf303ae72e90b110b66d31d2ac9374 | /iqiyiplayer-library-core/src/main/java/tv/ismar/iqiyiplayer/BlankActivity.java | c47db38a325bf0840022b48f53639ceec88981e5 | [] | no_license | JasonFengHot/StrelitziaWithExoPlayer | 69c5041e670648afe1bb0eb83395aac083abb4c6 | a99f37a042eace90337889ded51f51944a51ba7c | refs/heads/master | 2021-08-26T07:26:17.465093 | 2017-11-22T06:54:54 | 2017-11-22T06:54:54 | 109,950,854 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 798 | java | package tv.ismar.iqiyiplayer;
import android.app.Activity;
import android.content.Intent;
import android.view.KeyEvent;
/**
* DEBUG CODE, blank activity for test memory leak.
*/
public class BlankActivity extends Activity {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
finish();
return super.onKeyDown(keyCode, event);
} else if (keyCode == KeyEvent.KEYCODE_MENU) {
Intent it = new Intent();
it.setClass(BlankActivity.this, SdkTestActivity.class);
startActivity(it);
BlankActivity.this.finish();
return super.onKeyDown(keyCode, event);
} else {
return super.onKeyDown(keyCode, event);
}
}
}
| [
"fenghuibin@ismartv.cn"
] | fenghuibin@ismartv.cn |
91668dd845fcdea7e671d63b3a12019cac8c27fb | a648a04f5c134aabbb6c96d92fb279a2411e2066 | /src/com/multithreading/hashmap/nullcheck/Employee.java | 8212065a5b9e8d1f7d62a115427d1e5749cc73ec | [] | no_license | ayush1291/JavaBasics | 648c183cfd8b244b453a7f2d2815494b3badd9c0 | b5cece8ec006dd5fe6cc91f19e427a56fd8b9e93 | refs/heads/master | 2020-03-28T11:21:34.024965 | 2020-03-26T10:03:25 | 2020-03-26T10:03:25 | 148,204,985 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package com.multithreading.hashmap.nullcheck;
public class Employee{
String name;
public String getName(){
return name;
}
public void setName(String name){
this.name = name;
}
} | [
"ayush.kumar1291@gmail.com"
] | ayush.kumar1291@gmail.com |
d2f208df8ba644fbdf5358c22f22929ba952c4e1 | e8961003a724cf08cdf0ead9d45b53a14038fc2c | /app/src/main/java/classact/com/xprize/fragment/drill/movie/MovieDao.java | 622836ee79ed3fcd4d4aab2048549b981c4420aa | [] | no_license | classact/XPrize | 5b7f60e3cfd5e7c610949ed391ab5121d4e3ece0 | f7b8e3928dba59d581f78c40c290f2a6c05dbb67 | refs/heads/master | 2021-01-24T12:12:11.233937 | 2018-02-22T18:08:01 | 2018-02-22T18:08:01 | 58,711,608 | 1 | 0 | null | 2018-02-22T18:08:02 | 2016-05-13T07:18:11 | Java | UTF-8 | Java | false | false | 1,906 | java | package classact.com.xprize.fragment.drill.movie;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import classact.com.xprize.database.model.Movie;
import classact.com.xprize.database.model.Story;
/**
* Created by hcdjeong on 2017/12/27.
*/
public class MovieDao {
public static Movie getMovie(SQLiteDatabase db,
int movieId) {
Movie movie = null;
Cursor cursor = db.rawQuery(
"SELECT m.* " +
"FROM tbl_Movie m " +
"WHERE m.id = " + movieId + " " +
"ORDER BY m.id ASC", null);
if (cursor.getCount() > 0) {
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
movie = new Movie(
cursor.getInt(cursor.getColumnIndex("id")),
cursor.getString(cursor.getColumnIndex("name")),
cursor.getString(cursor.getColumnIndex("video_file")),
cursor.getString(cursor.getColumnIndex("subtitle_file")));
}
cursor.close();
}
return movie;
}
public static int getMovieId(SQLiteDatabase db,
int unitSectionDrillId) {
int movieId = -1;
Cursor cursor = db.rawQuery(
"SELECT movie_id " +
"FROM tbl_UnitSectionDrillMovie usdm " +
"WHERE usdm.unit_section_drill_id = " + unitSectionDrillId + " " +
"ORDER BY usdm.id ASC", null);
if (cursor.getCount() > 0) {
for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
movieId = cursor.getInt(cursor.getColumnIndex("movie_id"));
}
cursor.close();
}
return movieId;
}
}
| [
"dave@mediaetc.co.za"
] | dave@mediaetc.co.za |
c09504ea72a469e988ddec082208fd3f7e34aaff | c33cdaa74f06351fe92a93f266fd471e9de353bf | /src/main/java/com/jiedangou/i17dl/api/sdk/bean/param/biz/receivemanagement/Index.java | ffd66d3d88ada28596ae879521fcc522b9221975 | [
"Apache-2.0"
] | permissive | howe/17dlApi-sdk | 4b5675bd188d63fff07739a638829ad4030c75b8 | 26bcd8b728a300972c391a5fc7cc12846bd3e9cf | refs/heads/master | 2021-05-09T07:33:20.514109 | 2018-03-06T14:45:37 | 2018-03-06T14:45:37 | 119,365,430 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,114 | java | package com.jiedangou.i17dl.api.sdk.bean.param.biz.receivemanagement;
import com.jiedangou.i17dl.api.sdk.bean.param.biz.Brieforder;
import java.util.List;
/**
* Created on 2018/1/28
*
* @author Jianghao(howechiang @ gmail.com)
*/
public class Index {
private Integer count;
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
private List<Brieforder> list;
public List<Brieforder> getList() {
return list;
}
public void setList(List<Brieforder> list) {
this.list = list;
}
private Integer page;
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
private Integer pageSize;
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
private String game;
public String getGame() {
return game;
}
public void setGame(String game) {
this.game = game;
}
}
| [
"howechiang@gmail.com"
] | howechiang@gmail.com |
39dc316bd10ed4a7311bc5880f321cfa7923d8fe | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a203/A203244Test.java | 8d0ba42081341791b67654a536ef80e16246b8be | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a203;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A203244Test extends AbstractSequenceTest {
}
| [
"sairvin@gmail.com"
] | sairvin@gmail.com |
78379beefcfffca5cd20a2e58a241d2a76a94fb9 | 9debe1cd59abe82d280e2729d24246fa66fd56bd | /src/main/java/com/example/demo/model/Pedido.java | 4050115214d91f4c5a656ca7d2d4418c3e0b50c5 | [] | no_license | Matheus-jacobb/AC1-POO-Labotarorio | a079abde33ab0c21c6ec165da75300dff221d509 | 438082dca7d077a0421bf7bf10dc020cde1e76ff | refs/heads/master | 2022-12-22T15:31:46.756677 | 2020-10-02T12:35:57 | 2020-10-02T12:35:57 | 299,906,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | package com.example.demo.model;
public class Pedido {
private int codigo;
private double valor;
private String descricao;
private String cliente;
private String data;
//Get e Setters
public int getCodigo() {
return codigo;
}
public void setCodigo(int codigo) {
this.codigo = codigo;
}
public double getValor() {
return valor;
}
public void setValor(double valor) {
this.valor = valor;
}
public String getDescricao() {
return descricao;
}
public void setDescricao(String descricao) {
this.descricao = descricao;
}
public String getCliente() {
return cliente;
}
public void setCliente(String cliente) {
this.cliente = cliente;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
| [
"matheusbendel@hotmail.com"
] | matheusbendel@hotmail.com |
80a0cd4f0d93f498394bc7f9ee62a5edcad33acf | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/71/org/apache/commons/math/util/MathUtils_addAndCheck_131.java | 03ffb5765ab247df2eea9202f641a489fa187b57 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 2,314 | java |
org apach common math util
addit built function link math
version revis date
math util mathutil
add integ check overflow
param addend
param addend
param msg messag thrown except
sum code code
arithmet except arithmeticexcept result repres
add check addandcheck string msg
ret
symmetri reduc boundari case
ret add check addandcheck msg
check neg overflow
long min
ret
arithmet except arithmeticexcept msg
opposit sign addit safe
ret
check posit overflow
long max
ret
arithmet except arithmeticexcept msg
ret
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
da3fbcf7302cea2f4ddaf28e54321e563a8de644 | 3d71e80c8f2b0c8c8c6c93257e1f1c7e78d3fe18 | /src/main/java/org/xenei/bloomgraph/bloom/filters/TripleBloomFilter.java | bd4452c6fbf14c40c5e2e3500f830e1041b05a2b | [] | no_license | Claudenw/BloomGraph | 9cad6a00675c8b5506998b2a148f3b7362c87be8 | a381c05c420a2a9a15de8289ce237715fa6ac428 | refs/heads/master | 2022-11-14T22:40:23.811829 | 2022-10-21T17:00:06 | 2022-10-21T17:00:06 | 31,927,968 | 0 | 1 | null | 2022-10-21T17:00:07 | 2015-03-09T23:22:09 | Java | UTF-8 | Java | false | false | 2,617 | 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.xenei.bloomgraph.bloom.filters;
import java.nio.ByteBuffer;
import java.util.BitSet;
/**
* A bloom filter for a triple
*/
public class TripleBloomFilter extends AbstractBloomFilter {
// 3 nodes in the filter, 1 in 100000 collisions
public static final FilterConfig CONFIG = new FilterConfig(3, 100000);
/**
* Verify that a byte buffer has enough bytes.
*
* @param data
* @return the byte buffer.
* @throws IllegalArgumentException
* if the wrong size.
*/
private static ByteBuffer verifyDataLength(final ByteBuffer data) {
if (data.limit() < CONFIG.getNumberOfBytes()) {
throw new IllegalArgumentException("Data buffer must be at least "
+ CONFIG.getNumberOfBytes() + " bytes long");
}
if (data.limit() > CONFIG.getNumberOfBytes()) {
return (ByteBuffer) data.slice().limit(CONFIG.getNumberOfBytes());
}
return data;
}
/**
* A public builder for a TripleBloomFilter.
*/
public static AbstractBuilder<TripleBloomFilter> BUILDER = new Builder();
/**
* Construct a filter using the bitset.
*
* @param bitSet
* The bitset for the filter.
*/
private TripleBloomFilter(BitSet bitSet) {
super(bitSet);
}
/**
* Create a triple bloom filter from a byte buffer.
*
* @param buff
* the buffer to read.
*/
public TripleBloomFilter(ByteBuffer buff) {
super(verifyDataLength(buff));
}
@Override
public int getSize() {
return CONFIG.getNumberOfBytes();
}
/**
* The builder for the TripleBloomFilter.
*
*/
private static class Builder extends AbstractBuilder<TripleBloomFilter> {
/**
* Constructor.
*/
private Builder() {
super(CONFIG);
}
@Override
protected TripleBloomFilter construct(final BitSet bitSet) {
return new TripleBloomFilter(bitSet);
}
}
}
| [
"claude@xenei.com"
] | claude@xenei.com |
410545cd3f1a3abfd7558d195e76b2c80f08a8ba | 22032f2f11b335dd9c948d7f81b4a29a42d1f0f6 | /se.xdin.electricgaugesurveillance/gen/se/xdin/electricgaugesurveillance/BuildConfig.java | 7d08f3ca6c4190f48f5b7ed9d6a2af05da69ba10 | [] | no_license | ostling/ElectricGaugeSurveillance | 5b16ad4480fc06bec24df9c1ed932d1cc00ab044 | 43d7948d8c2012b67d33c0c5606eb319192266a5 | refs/heads/master | 2018-12-29T16:47:58.224810 | 2012-10-24T08:03:29 | 2012-10-24T08:03:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | /** Automatically generated file. DO NOT MODIFY */
package se.xdin.electricgaugesurveillance;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"mo2248@SEGOAO-L1011003.redbull.xdin.com"
] | mo2248@SEGOAO-L1011003.redbull.xdin.com |
4fd5e873dc66bb3e2c931ff43c20476e2703c0b3 | ac23b9e4ea5217f591b0fa6fa7d59409a6280a48 | /archive/xweb/src/java/net/osm/agent/LinkAgent.java | 6c9a2b3c550327cada273ce5f5362fd0563a793e | [] | no_license | BackupTheBerlios/osm-svn | f8acbce0f132342f6568bbd34ffce50d312a1086 | b7b47ee0ea8645d5c5b2241bda32119ca8020ff4 | refs/heads/master | 2021-01-01T06:50:16.703738 | 2009-10-18T23:07:30 | 2009-10-18T23:07:30 | 40,776,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,682 | java |
package net.osm.agent;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.omg.Session.Link;
public class LinkAgent extends ValueAgent implements Agent
{
/**
* The object reference to the Link that this agents
* represents.
*/
protected Link link;
/**
* Cache reference to the target object reference.
*/
protected AbstractResourceAgent target;
//=========================================================================
// Constructor
//=========================================================================
public LinkAgent( )
{
}
public LinkAgent( Object object )
{
super( object );
try
{
this.link = (Link) object;
}
catch( Throwable t )
{
throw new RuntimeException(
"LinkAgent/setReference - bad type.");
}
}
//=========================================================================
// Atrribute setters
//=========================================================================
/**
* Set the resource that is to be presented.
*/
public void setReference( Object value )
{
super.setReference( value );
try
{
this.link = (Link) value;
}
catch( Throwable t )
{
throw new RuntimeException(
"LinkAgent/setReference - bad type.");
}
}
//=========================================================================
// Getter methods
//=========================================================================
/**
* Returns the target of the link.
*/
public AbstractResourceAgent getTarget( )
{
if( target != null ) return target;
try
{
target = (AbstractResourceAgent) AgentServer.getAgentService().resolve( link.resource() );
return target;
}
catch( Throwable e )
{
throw new CascadingRuntimeException( "LinkAgent:getTarget", e );
}
}
/**
* Returns the name of the resource.
*/
public String getName()
{
try
{
return getTarget().getName();
}
catch( Throwable e )
{
throw new CascadingRuntimeException( "LinkAgent:getName", e );
}
}
/**
* Return the IOR of the link's target object reference.
*/
public String getIor( )
{
try
{
return getTarget().getIor();
}
catch( Throwable e )
{
throw new CascadingRuntimeException( "LinkAgent:getIor", e );
}
}
}
| [
"mcconnell@aaecaf6e-66fb-0310-8020-e30436e8796d"
] | mcconnell@aaecaf6e-66fb-0310-8020-e30436e8796d |
3becc28f69881365e34fecc26b08a4a650300be8 | ff62e39ecd55d14d6d11d7d044d17c3377ef48cc | /Principles of Software Design/week2/EfficientSortStarterProgram/TitleLastAndMagnitudeComparator.java | 5d7df9d1c7a37e55fa590417a8655d6f87a86ea8 | [] | no_license | aChrisChen/Duke_Java_Intro_Specialization | 484f06bf86a770554555433a6500871700f4b6b2 | d760958b3ce9452b442da53a6066221cf9ee5f5e | refs/heads/master | 2020-03-22T14:44:30.138542 | 2018-07-31T14:27:48 | 2018-07-31T14:27:48 | 140,202,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java |
/**
* Write a description of TitleLastAndMagnitudeComparator here.
*
* @author (your name)
* @version (a version number or a date)
*/
import java.util.*;
public class TitleLastAndMagnitudeComparator implements Comparator<QuakeEntry> {
public int compare(QuakeEntry q1, QuakeEntry q2) {
int compareResult = q1.getInfo().substring(q1.getInfo().lastIndexOf(" ")+1).
compareTo(q2.getInfo().substring(q2.getInfo().lastIndexOf(" ")+1));
if (compareResult == 0) {
return Double.compare(q1.getMagnitude(), q2.getMagnitude());
}
return compareResult;
}
}
| [
"chenjipeng@promote.cache-dns.local"
] | chenjipeng@promote.cache-dns.local |
6ec058c2881a5069ee8747d1b84ee2682f10ea18 | f516e2bf144d141aaace46952a9e33a77312c179 | /app/src/main/java/com/sae/raz/ui/view/MyWebView.java | 21b2234132ffcb305a250d7791c15f767c0b1767 | [] | no_license | RazSB/MHCI | 68641571754deb891cd34af5640adabb7987ae8f | c92c22610997d92594c57aa241083f17fe4c282b | refs/heads/master | 2021-01-17T22:12:41.979682 | 2017-03-07T11:19:27 | 2017-03-07T11:19:27 | 84,189,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,592 | java | package com.sae.raz.ui.view;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebSettings.LayoutAlgorithm;
import android.webkit.WebSettings.PluginState;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import java.util.ArrayList;
@SuppressLint("SetJavaScriptEnabled")
@SuppressWarnings("deprecation")
public class MyWebView extends WebView {
private static int mCurrentHistoryIndex = 0;
private static ArrayList<String> mUrlHistory = new ArrayList<>();
public static void AddHistory(String url) {
if (!TextUtils.isEmpty(url)) {
if (mUrlHistory.size() > 0) {
String curUrl = mUrlHistory.get(mCurrentHistoryIndex);
if (curUrl.equals(url))
return; // final url is same with new url, so don't need to add it again
}
for (int i = mCurrentHistoryIndex; i < mUrlHistory.size()-1; i++) {
mUrlHistory.remove(mUrlHistory.size()-1);
}
mUrlHistory.add(url);
mCurrentHistoryIndex = mUrlHistory.size()-1;
}
}
public static String GetPrevHistory() {
if (mCurrentHistoryIndex > 0) {
mCurrentHistoryIndex--;
return mUrlHistory.get(mCurrentHistoryIndex);
}
return "";
}
public static String GetNextHistory() {
if (mCurrentHistoryIndex < mUrlHistory.size()-1) {
mCurrentHistoryIndex++;
return mUrlHistory.get(mCurrentHistoryIndex);
}
return "";
}
public static String GetLastHistory() {
if (mCurrentHistoryIndex < mUrlHistory.size()) {
return mUrlHistory.get(mCurrentHistoryIndex);
}
return "";
}
/*
*/
public MyWebView(Context context) {
super(context);
// TODO Auto-generated constructor stub
init(context);
}
public MyWebView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
init(context);
}
public MyWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
// TODO Auto-generated constructor stub
init(context);
}
public MyWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) {
super(context, attrs, defStyleAttr, privateBrowsing);
// TODO Auto-generated constructor stub
init(context);
}
private void init(Context context) {
WebSettings ws = getSettings();
ws.getPluginState();
ws.setPluginState(PluginState.ON);
ws.setJavaScriptEnabled(true);
ws.setJavaScriptCanOpenWindowsAutomatically(true);
ws.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
setBackgroundColor(Color.TRANSPARENT);
setWebViewClient(new WebViewClient() {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
super.onPageStarted(view, url, favicon);
if (mOnWebViewListner != null)
mOnWebViewListner.onPageLoadStarted(url);
}
// @Override
// public boolean shouldOverrideUrlLoading(WebView view, String url) {
// // TODO Auto-generated method stub
// final String MAILTO = "mailto:";
// if (url.contains(MAILTO)) {
// int start_index = url.indexOf(MAILTO) + MAILTO.length();
// String mail_address = url.substring(start_index).replace("%40", "@");
// if (!TextUtils.isEmpty(mail_address))
// CommonUtil.SendEmail(view.getContext(), mail_address, "", "", "");
//
// } else {
// CommonUtil.showURL(view.getContext(), url);
// }
// return true;
// }
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
// TODO Auto-generated method stub
super.onReceivedError(view, errorCode, description, failingUrl);
final String mimeType = "text/html";
final String encoding = "UTF-8";
String html = "<html></html>";
view.loadDataWithBaseURL("", html, mimeType, encoding, "");
}
});
setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
// TODO Auto-generated method stub
super.onProgressChanged(view, newProgress);
if (mOnWebViewListner != null)
mOnWebViewListner.onPageLoadProgressChanged(newProgress);
if (newProgress == 100) {
if (mOnWebViewListner != null) {
mOnWebViewListner.onPageLoadFinished();
}
}
}
});
setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
// TODO Auto-generated method stub
if (mOnWebViewListner != null) {
int contentHeight = (int) Math.floor(getContentHeight() * getScale());
if (contentHeight - getScrollY() <= getHeight()) { // if diff is zero, then the bottom has been reached
mOnWebViewListner.onScrollChanged(true);
} else {
mOnWebViewListner.onScrollChanged(false);
}
}
super.onScrollChanged(l, t, oldl, oldt);
}
private OnWebViewListner mOnWebViewListner;
public void setOnWebViewListner(OnWebViewListner listener) {
mOnWebViewListner = listener;
}
public interface OnWebViewListner {
public void onPageLoadStarted(String url);
public void onPageLoadFinished();
public void onPageLoadProgressChanged(int progress);
public void onScrollChanged(boolean isHitBottom);
}
}
| [
"Razan.Bamoallem@gmail.com"
] | Razan.Bamoallem@gmail.com |
0462328780fe4201ccea8bb8baf4b620a1aae345 | 3b4aba1edc430e416527f4e8555a523c6beb7359 | /HashSetTest.java | bb7e52368756f9376ce4302c6194bf3d9f0a9811 | [] | no_license | turbobin/JavaTest | 7595b1efff3423e1f39081fa8c0e0d399b62210a | 3bd5330fc65e1a2bffaf5dfdce5be4248307fc2d | refs/heads/master | 2020-03-12T23:00:37.837652 | 2018-05-04T03:37:33 | 2018-05-04T03:37:33 | 130,857,477 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,353 | java | import java.util.*;
/*
* |--Set:元素是无序的(存入和取出的顺序不一定一致),元素不可以重复。
* |--HashSet:底层数据结构是哈希表。
* HashSet是如何保证程序唯一性的呢?
* 是通过元素的两个方法hashCode和equals来完成。如果元素的HashCode值相同,才会判断equals是否为true
* 如果元素的hashCode值不同,不会调用equals.
* 注意:对于判断元素是否存在(contains),以及删除(remove)等操作,依赖的是元素的hashCode和equals方法。
* |--TreeSet:
* Set集合的功能和collection是一致的。
*/
class HashSetDemo
{
private String name;
private int age;
HashSetDemo(String name,int age)
{
this.name = name;
this.age = age;
}
public int hashCode()
{
System.out.println(this.name+"....");
// return 60;
return name.hashCode()+age*39;
}
public boolean equals(Object obj) //当返回相同的hashCode时,底层会自动调用
{
if(!(obj instanceof HashSetDemo))
return false;
HashSetDemo p = (HashSetDemo)obj;
System.out.println(this.name+"..pk.."+p.name);
return this.name.equals(p.getName()) && this.age == p.age;
}
public String getName()
{
return name;
}
public int getAge()
{
return age;
}
}
public class HashSetTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
// hashsetDemo hs1 = new hashsetDemo();
// hashsetDemo hs2 = new hashsetDemo();
// say(hs1);
// say(hs2);
HashSet hs = new HashSet();
hs.add(new HashSetDemo("a1",11));//返回true
hs.add(new HashSetDemo("a1",11));//返回false
hs.add(new HashSetDemo("a2",13));
hs.add(new HashSetDemo("a1",11));
// hs.add(new HashSetDemo("a3",12));
// hs.add(new HashSetDemo("a4",11));
// say(hs);
// hs = removeDup(hs);
Iterator it = hs.iterator();
while(it.hasNext())
{
HashSetDemo hsd = (HashSetDemo)it.next();
say(hsd.getName()+","+hsd.getAge());
}
}
/*
public static HashSet removeDup(HashSet hs)
{
//定义一个临时容器。
HashSet newhs = new HashSet();
Iterator it = hs.iterator();
while(it.hasNext())
{
Object obj = it.next();
if(!newhs.contains(obj)) //remove,contains底层都会调用equals方法
newhs.add(obj);
}
return newhs;
}
*/
public static void say(Object obj)
{
System.out.println(obj);
}
}
| [
"1571616014@qq.com"
] | 1571616014@qq.com |
5bd5ed002347d696cee9de90f6b1d5070c535863 | c3fd5e06226d5fe3d15548313cec5dc783d1d306 | /tags/1.6.0/jbidibc-rxtx-2.2/src/main/java/gnu/io/RS485Port.java | 6a8af1ae5081f27e84447af907b36aec6e15c00a | [] | no_license | svn2github/jbidibc | 37917bead3721f0781bedf267afa0c71f7ab7975 | 12184930eaa7af18c38dc83dccad2f8d330bcf06 | refs/heads/master | 2021-01-13T02:03:00.163181 | 2015-01-18T14:45:10 | 2015-01-18T14:45:10 | 20,271,028 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,074 | java | /* Non functional contact tjarvi@qbang.org for details */
/*-------------------------------------------------------------------------
| RXTX License v 2.1 - LGPL v 2.1 + Linking Over Controlled Interface.
| RXTX is a native interface to serial ports in java.
| Copyright 1997-2007 by Trent Jarvi tjarvi@qbang.org and others who
| actually wrote it. See individual source files for more information.
|
| A copy of the LGPL v 2.1 may be found at
| http://www.gnu.org/licenses/lgpl.txt on March 4th 2007. A copy is
| here for your convenience.
|
| This library is free software; you can redistribute it and/or
| modify it under the terms of the GNU Lesser General Public
| License as published by the Free Software Foundation; either
| version 2.1 of the License, or (at your option) any later version.
|
| This library 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
| Lesser General Public License for more details.
|
| An executable that contains no derivative of any portion of RXTX, but
| is designed to work with RXTX by being dynamically linked with it,
| is considered a "work that uses the Library" subject to the terms and
| conditions of the GNU Lesser General Public License.
|
| The following has been added to the RXTX License to remove
| any confusion about linking to RXTX. We want to allow in part what
| section 5, paragraph 2 of the LGPL does not permit in the special
| case of linking over a controlled interface. The intent is to add a
| Java Specification Request or standards body defined interface in the
| future as another exception but one is not currently available.
|
| http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
|
| As a special exception, the copyright holders of RXTX give you
| permission to link RXTX with independent modules that communicate with
| RXTX solely through the Sun Microsytems CommAPI interface version 2,
| regardless of the license terms of these independent modules, and to copy
| and distribute the resulting combined work under terms of your choice,
| provided that every copy of the combined work is accompanied by a complete
| copy of the source code of RXTX (the version of RXTX used to produce the
| combined work), being distributed under the terms of the GNU Lesser General
| Public License plus this exception. An independent module is a
| module which is not derived from or based on RXTX.
|
| Note that people who make modified versions of RXTX are not obligated
| to grant this special exception for their modified versions; it is
| their choice whether to do so. The GNU Lesser General Public License
| gives permission to release a modified version without this exception; this
| exception also makes it possible to release a modified version which
| carries forward this exception.
|
| You should have received a copy of the GNU Lesser General Public
| License along with this library; if not, write to the Free
| Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
| All trademarks belong to their respective owners.
--------------------------------------------------------------------------*/
package gnu.io;
import java.io.*;
import java.util.*;
/**
* @author Trent Jarvi
* @version %I%, %G%
* @since JDK1.0
*/
abstract class RS485Port extends CommPort {
public static final int DATABITS_5 = 5;
public static final int DATABITS_6 = 6;
public static final int DATABITS_7 = 7;
public static final int DATABITS_8 = 8;
public static final int PARITY_NONE = 0;
public static final int PARITY_ODD = 1;
public static final int PARITY_EVEN = 2;
public static final int PARITY_MARK = 3;
public static final int PARITY_SPACE = 4;
public static final int STOPBITS_1 = 1;
public static final int STOPBITS_1_5 = 0; // wrong
public static final int STOPBITS_2 = 2;
public static final int FLOWCONTROL_NONE = 0;
public static final int FLOWCONTROL_RTSCTS_IN = 1;
public static final int FLOWCONTROL_RTSCTS_OUT = 2;
public static final int FLOWCONTROL_XONXOFF_IN = 4;
public static final int FLOWCONTROL_XONXOFF_OUT = 8;
public abstract void setRS485PortParams(int b, int d, int s, int p) throws UnsupportedCommOperationException;
public abstract int getBaudRate();
public abstract int getDataBits();
public abstract int getStopBits();
public abstract int getParity();
public abstract void setFlowControlMode(int flowcontrol) throws UnsupportedCommOperationException;
public abstract int getFlowControlMode();
public abstract boolean isDTR();
public abstract void setDTR(boolean state);
public abstract void setRTS(boolean state);
public abstract boolean isCTS();
public abstract boolean isDSR();
public abstract boolean isCD();
public abstract boolean isRI();
public abstract boolean isRTS();
public abstract void sendBreak(int duration);
public abstract void addEventListener(RS485PortEventListener lsnr) throws TooManyListenersException;
public abstract void removeEventListener();
public abstract void notifyOnDataAvailable(boolean enable);
public abstract void notifyOnOutputEmpty(boolean enable);
public abstract void notifyOnCTS(boolean enable);
public abstract void notifyOnDSR(boolean enable);
public abstract void notifyOnRingIndicator(boolean enable);
public abstract void notifyOnCarrierDetect(boolean enable);
public abstract void notifyOnOverrunError(boolean enable);
public abstract void notifyOnParityError(boolean enable);
public abstract void notifyOnFramingError(boolean enable);
public abstract void notifyOnBreakInterrupt(boolean enable);
/*
* public abstract void setRcvFifoTrigger(int trigger); deprecated
*/
}
| [
"akuhtz@87107999-b52a-42af-a34b-1e85ba8a0939"
] | akuhtz@87107999-b52a-42af-a34b-1e85ba8a0939 |
4917757856a1f5944e478112ad13972dc2047c24 | 850055cf42a634f76985e9a8f2e509eb4d04f980 | /app/src/main/java/com/quellevo/quellevo/utils/adapters/ListViewAdapter.java | d928ed52b308435515eecbc7077198a390050380 | [] | no_license | nicodubi/quellevo-android | 19d1a4ae52776ffc7359880aae51eb4e8f6f5875 | dc6f41c05901724a0bccf3dc8a46bdf6eb57ba08 | refs/heads/master | 2020-12-25T18:42:30.295244 | 2017-07-02T07:40:28 | 2017-07-02T07:40:28 | 93,974,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,418 | java | package com.quellevo.quellevo.utils.adapters;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.quellevo.quellevo.R;
import java.util.List;
/**
* Created by Nicolas on 29/6/2017.
*/
public class ListViewAdapter<T> extends ArrayAdapter<T> {
private List<T> objects;
private boolean itemsRemovables;
private ClickTickItem<T> clickTickItem;
private ClickDeleteItem<T> clickDeleteItem;
public ListViewAdapter(Context context, int resource, List<T> objects) {
super(context, resource, objects);
this.objects = objects;
this.itemsRemovables = true;
}
public void configElements(boolean removables, ClickDeleteItem<T> deleteItemListener, ClickTickItem<T> clickTickItem) {
this.itemsRemovables = removables;
this.clickTickItem = clickTickItem;
this.clickDeleteItem = deleteItemListener;
}
public void clear() {
objects.clear();
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.view_item_list_autocomplete, parent, false);
}
TextView t = (TextView) convertView.findViewById(R.id.textAdapterItem);
t.setText(getItem(position).toString());
ImageView delete = (ImageView) convertView.findViewById(R.id.deleteItemList);
ImageView tick = (ImageView) convertView.findViewById(R.id.tickIconId);
if (itemsRemovables) {
delete.setTag(position);
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (view.getTag() != null) {
if (clickDeleteItem != null) {
clickDeleteItem.onItemClickDeleted(objects.get((int) view.getTag()));
}
objects.remove((int) view.getTag());
notifyDataSetChanged();
}
}
});
} else {
delete.setVisibility(View.GONE);
}
if (this.clickTickItem != null) {
tick.setTag(position);
tick.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v.getTag() != null) {
clickTickItem.onItemClickTick(objects.get((int) v.getTag()));
}
}
});
} else {
tick.setVisibility(View.GONE);
}
return convertView;
}
@Override
public void remove(T dto) {
objects.remove(dto);
notifyDataSetChanged();
}
@Override
public void add(T dto) {
objects.add(dto);
notifyDataSetChanged();
}
public interface ClickTickItem<T> {
public void onItemClickTick(T item);
}
public interface ClickDeleteItem<T> {
/**
* @param item
* @return return if do you want to be removed item from list
*/
public void onItemClickDeleted(T item);
}
}
| [
"nicodubi111@gmail.com"
] | nicodubi111@gmail.com |
e9a6882331e6ce38bba9434a96c80354d904bcdd | 4d9ec46a109f084efa32b085e2b036162ef37254 | /GUI/MainMenuGUI.java | 09f3e13bb197dd8b6f5f8bbdcd89463a21c90d2b | [] | no_license | nchollan/Odius | 8c42c35a8114eaaed66578c2c9233c04ac7ec5b0 | 3d9ea6ffcb774f7ae49446283415022d2c820c63 | refs/heads/master | 2021-01-19T22:10:42.186382 | 2016-04-04T21:33:51 | 2016-04-04T21:33:51 | 55,385,186 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,767 | java | package GUI;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.SwingConstants;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.UIManager;
import javax.swing.border.MatteBorder;
import java.awt.Button;
public class MainMenuGUI extends JFrame {
private JPanel contentPane;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
MainMenuGUI frame = new MainMenuGUI();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the frame.
*/
public MainMenuGUI() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 900, 900);
contentPane = new JPanel();
contentPane.setBackground(UIManager.getColor("ToolBar.floatingForeground"));
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(0, 0, 884, 166);
panel.setBorder(new MatteBorder(2, 2, 2, 2, (Color) new Color(0, 0, 0)));
panel.setBackground(new Color(255, 165, 0));
panel.setForeground(Color.WHITE);
contentPane.add(panel);
JLabel lblKabasuji = new JLabel("Kabasuji");
panel.add(lblKabasuji);
lblKabasuji.setHorizontalAlignment(SwingConstants.CENTER);
lblKabasuji.setForeground(new Color(255, 255, 51));
lblKabasuji.setFont(new Font("Elephant", Font.PLAIN, 71));
Button button_3 = new Button("View Levels");
button_3.setBounds(309, 399, 265, 90);
button_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
button_3.setFont(new Font("Dialog", Font.PLAIN, 34));
button_3.setForeground(Color.YELLOW);
button_3.setBackground(new Color(255, 153, 0));
contentPane.add(button_3);
Button button_4 = new Button("Play");
button_4.setForeground(Color.YELLOW);
button_4.setFont(new Font("Dialog", Font.PLAIN, 34));
button_4.setBackground(new Color(255, 153, 0));
button_4.setBounds(309, 303, 265, 90);
contentPane.add(button_4);
Button button_6 = new Button("Reset Score");
button_6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
}
});
button_6.setForeground(Color.YELLOW);
button_6.setFont(new Font("Dialog", Font.PLAIN, 34));
button_6.setBackground(new Color(255, 153, 0));
button_6.setBounds(309, 495, 265, 90);
contentPane.add(button_6);
}
}
| [
"qholam@wpi.edu"
] | qholam@wpi.edu |
99828e84301871654d07293d3cb51d715c246ace | a541a93ffd24056c2150dff34c22aa23c4e4c89a | /src/java/sacome/dao/ConsultaDAO.java | f025a6821fca7110687d9c322b08eab41f725d7d | [] | no_license | tuliorcc/sacome2 | 67db550e5e0d11165ff4651d1a85d5f44deb0746 | 6fddddfc695b6cba2a7a877d052b7e77bd8b6d18 | refs/heads/master | 2020-03-17T18:09:24.948267 | 2018-06-21T17:29:39 | 2018-06-21T17:29:39 | 133,816,358 | 0 | 0 | null | 2018-06-21T17:29:40 | 2018-05-17T13:19:51 | Java | UTF-8 | Java | false | false | 6,942 | 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 sacome.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.enterprise.context.RequestScoped;
import javax.naming.NamingException;
import javax.sql.DataSource;
import sacome.beans.Consulta;
import sacome.beans.Medico;
import sacome.beans.Paciente;
/**
*
* @author tulio
*/
@RequestScoped
public class ConsultaDAO {
private final static String CRIAR_CONSULTA_SQL = "insert into Consulta"
+ " (cpf, crm, dataconsulta)"
+ " values (?,?,?)";
private final static String BUSCAR_CONSULTA_MEDICO_SQL = "select"
+ " c.id as consultaId, c.cpf, c.crm, c.dataconsulta, m.nome"
+ " from Consulta c inner join Medico m on c.crm = m.crm"
+ " where c.crm = ? and dataconsulta=?";
private final static String LISTAR_CONSULTA_POR_PACIENTE_SQL = "select"
+ " c.id as consultaId, c.cpf, c.crm, c.dataconsulta, m.nome"
+ " from Consulta c inner join Medico m on c.crm = m.crm"
+ " where cpf = ?";
private final static String BUSCAR_CONSULTA_PACIENTE_SQL = "select"
+ " c.id as consultaId, c.cpf, c.crm, c.dataconsulta, p.nome"
+ " from Consulta c inner join Paciente p on c.cpf = p.cpf"
+ " where c.cpf = ? and dataconsulta=?";
private final static String LISTAR_CONSULTA_POR_MEDICO_SQL = "select"
+ " c.id as consultaId, c.cpf, c.crm, c.dataconsulta, p.nome"
+ " from Consulta c inner join Paciente p on c.cpf = p.cpf"
+ " where crm = ?";
@Resource(name = "jdbc/sacomeDBlocal")
DataSource dataSource;
public Consulta gravarConsulta(Consulta p) throws SQLException, NamingException {
try (Connection con = dataSource.getConnection();
PreparedStatement ps = con.prepareStatement(CRIAR_CONSULTA_SQL, Statement.RETURN_GENERATED_KEYS);) {
ps.setString(1, p.getCpf());
ps.setString(2, p.getCrm());
ps.setDate(3, new java.sql.Date(p.getDataConsulta().getTime()));
ps.execute();
try (ResultSet rs = ps.getGeneratedKeys()) {
rs.next();
p.setId(rs.getInt(1));
}
}
return p;
}
public List<Consulta> listarConsultasPorPaciente(String cpf) throws SQLException {
List<Consulta> ret = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
try (Connection con = dataSource.getConnection();
PreparedStatement ps = con.prepareStatement(LISTAR_CONSULTA_POR_PACIENTE_SQL)) {
ps.setString(1, cpf);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
Consulta c = new Consulta();
Medico m = new Medico();
c.setId(rs.getInt("consultaId"));
c.setCpf(rs.getString("cpf"));
c.setCrm(rs.getString("crm"));
c.setDataConsulta(rs.getDate("dataConsulta"));
c.setDataString(sdf.format(rs.getDate("dataConsulta")));
m.setNome(rs.getString("nome"));
c.setMedico(m);
ret.add(c); }
}
}
return ret;
}
public List<Consulta> listarConsultasPorMedico(String crm) throws SQLException {
List<Consulta> ret = new ArrayList<>();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
try (Connection con = dataSource.getConnection();
PreparedStatement ps = con.prepareStatement(LISTAR_CONSULTA_POR_MEDICO_SQL)) {
ps.setString(1, crm);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
Consulta c = new Consulta();
Paciente p = new Paciente();
c.setId(rs.getInt("consultaId"));
c.setCpf(rs.getString("cpf"));
c.setCrm(rs.getString("crm"));
c.setDataConsulta(new Date(rs.getDate("dataConsulta").getTime()));
c.setDataString(sdf.format(rs.getDate("dataConsulta")));
p.setNome(rs.getString("nome"));
c.setPaciente(p);
ret.add(c); }
}
}
return ret;
}
public List<Consulta> buscarConsultaMedico(String crm, Date dataconsulta) throws SQLException {
List<Consulta> ret = new ArrayList<>();
try (Connection con = dataSource.getConnection();
PreparedStatement ps = con.prepareStatement(BUSCAR_CONSULTA_MEDICO_SQL )) {
ps.setString(1, crm);
ps.setDate(2, new java.sql.Date(dataconsulta.getTime()));
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
Consulta u = new Consulta();
Medico m = new Medico();
u.setId(rs.getInt("consultaId"));
u.setCpf(rs.getString("cpf"));
u.setCrm(rs.getString("crm"));
u.setDataConsulta(new Date(rs.getDate("dataConsulta").getTime()));
m.setNome(rs.getString("nome"));
u.setMedico(m);
ret.add(u); }
}
}
return (ret.isEmpty() ? null : ret);
}
public List<Consulta> buscarConsultaPaciente(String cpf, Date dataconsulta) throws SQLException {
List<Consulta> ret = new ArrayList<>();
try (Connection con = dataSource.getConnection();
PreparedStatement ps = con.prepareStatement(BUSCAR_CONSULTA_PACIENTE_SQL )) {
ps.setString(1, cpf);
ps.setDate(2, new java.sql.Date(dataconsulta.getTime()));
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
Consulta c = new Consulta();
Paciente p = new Paciente();
c.setId(rs.getInt("consultaId"));
c.setCpf(rs.getString("cpf"));
c.setCrm(rs.getString("crm"));
c.setDataConsulta(new Date(rs.getDate("dataConsulta").getTime()));
p.setNome(rs.getString("nome"));
c.setPaciente(p);
ret.add(c); }
}
}
return (ret.isEmpty() ? null : ret);
}
}
| [
""
] | |
19a83bcd1a885fc79293d671d02262baebdae203 | 4d538d0c696e46cf7c9be63033508bfd718a8a61 | /main/java/br/com/laminarsoft/jazzforms/ui/communicator/IGuvnorResponseHandler.java | e9cee14c30856afa52107ebc1ac0f5b6eb925f2f | [] | no_license | alisonsilva/jazzforms-ui | 80da9841bf03451d3befbb83612605c97840b4a2 | a1dc88d11e0e437df35ce5a92d5ea4e9fe991f0e | refs/heads/master | 2021-01-10T14:26:54.158652 | 2018-04-01T18:55:26 | 2018-04-01T18:55:26 | 55,779,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package br.com.laminarsoft.jazzforms.ui.communicator;
import org.apache.abdera.model.Document;
import org.apache.abdera.model.Feed;
import br.com.laminarsoft.jazzforms.persistencia.model.util.InfoRetornoProcessModel;
public interface IGuvnorResponseHandler {
public void receivePackages(InfoRetornoProcessModel packages);
public void receivePackageAssets(Document<Feed> assets);
public void onServerError(Exception e);
}
| [
"alison@laminarsoft.com.br"
] | alison@laminarsoft.com.br |
b49a9d17da07c0793ec8a65cf1fa0d19972a48e6 | b43af7037473620f50d90bed7200c049286370f5 | /src/com/opatomic/OpaClientConfig.java | bf3d2a3b52c0ddb69498f1978175bfa0fefeaff1 | [
"ISC"
] | permissive | opatomic/opac-java | 0bd22fa7dd1c1c668c56079644a48cf590ec0ad4 | f60e5fd8892950e358e92b4e48b9314d35effa75 | refs/heads/master | 2022-07-17T09:53:15.317658 | 2022-07-12T20:36:10 | 2022-07-12T20:36:10 | 146,318,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,585 | java | package com.opatomic;
public class OpaClientConfig {
public interface RawResponseHandler {
void handle(Object id, Object result, Object err);
}
public interface ExceptionHandler {
void handle(Throwable e, Object context);
}
public static final OpaClientConfig DEFAULT_CFG;
static {
DEFAULT_CFG = new OpaClientConfig();
DEFAULT_CFG.unknownIdHandler = new RawResponseHandler() {
@Override
public void handle(Object id, Object result, Object err) {
System.err.println("Unknown callback id " + OpaUtils.stringify(id));
}
};
DEFAULT_CFG.uncaughtExceptionHandler = new ExceptionHandler() {
@Override
public void handle(Throwable e, Object context) {
e.printStackTrace();
}
};
}
/**
* Size of the recv/parse buffer in bytes.
*/
public int recvBuffLen = 1024 * 4;
/**
* Size of the serializer buffer in bytes.
*/
public int sendBuffLen = 1024 * 4;
/**
* Max length of the send queue. When the length is reached, callers will block until a request
* has been removed from the send queue to be serialized. This is a form of back-pressure.
*/
public int sendQueueLen = 1024;
/**
* Callback to invoke when a response is received without a registered callback.
*/
public RawResponseHandler unknownIdHandler;
/**
* Callback to invoke when an uncaught exception occurs.
*/
public ExceptionHandler uncaughtExceptionHandler;
/**
* Callback to invoke when an internal error occurs in the client. Examples could include parse
* errors or serialization errors.
*/
public ExceptionHandler clientErrorHandler;
}
| [
"j@opatomic.com"
] | j@opatomic.com |
ae1ded9095067a1272246a13ca70e617052cc96e | b3ccabefe054c9e0b095263f5cc3a8a64593b530 | /app/src/main/java/com/example/weather/getWeatherAPI.java | ac41d4abc4b36ff9d46955c569253b1f623fa992 | [] | no_license | Kajal-Mongia/Weather-app | bc5dbc4b5719843748fa0eb5c66fd7b01a6137d5 | 8b729019daaabb51232cff120235c9756fba195d | refs/heads/master | 2022-12-21T10:31:29.537025 | 2020-09-13T21:41:49 | 2020-09-13T21:41:49 | 293,374,789 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,509 | java | package com.example.weather;
import android.os.AsyncTask;
import android.util.Log;
import com.squareup.picasso.Picasso;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
public class getWeatherAPI extends AsyncTask<Void,Void,Void> {
String data="";
String singleParsed="";
String date;
String weatherTag;
String temp;
String iconUrl2;
double lat,longt;
getWeatherAPI(double latitude,double longitude){
lat=latitude;
longt=longitude;
}
@Override
protected Void doInBackground(Void... voids) {
try {
String urlString ="https://www.metaweather.com/api/location/search/?lattlong="+lat+","+longt;
URL urlLatLong = new URL( urlString );
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) urlLatLong.openConnection();
InputStream inputStream = httpsURLConnection.getInputStream();
BufferedReader br = new BufferedReader( new InputStreamReader( inputStream ) );
String line = " ";
while (line != null) {
line = br.readLine();
data += line;
}
JSONArray jsonArray=new JSONArray( data );
JSONObject jsonObject = (JSONObject) jsonArray.get(0);
singleParsed = "\nTitle : "+jsonObject.get( "title" )+"\nLocation Type:"+jsonObject.get( "location_type" )
+"\nWhere on earth id:"+jsonObject.get("woeid")+"\nlatt_long:"+jsonObject.get( "latt_long" );
String urlStr2 = "https://www.metaweather.com/api/location/"+jsonObject.get("woeid")+"/";
URL urlWoeid = new URL( urlStr2 );
httpsURLConnection=(HttpsURLConnection)urlWoeid.openConnection();
inputStream=httpsURLConnection.getInputStream();
br = new BufferedReader( new InputStreamReader( inputStream ) );
line = " ";
data="";
while (line != null) {
line = br.readLine();
data += line;
}
Log.d( "Weather DATA : ", "" + data);
JSONObject jsonObject1 = new JSONObject( data );
JSONArray jsonArray1 = new JSONArray( ""+jsonObject1.get("consolidated_weather") );
JSONObject weatherTodayObject = (JSONObject)jsonArray1.get(0);
date=String.valueOf( weatherTodayObject.get("applicable_date"));
weatherTag=String.valueOf( weatherTodayObject.get( "weather_state_name" ));
temp= String.valueOf( weatherTodayObject.get( "the_temp" ) );
String icon_abbr =weatherTodayObject.getString( "weather_state_abbr" );
iconUrl2 = "https://www.metaweather.com/api/static/img/weather/png/64/"+icon_abbr+".png";
} catch (IOException | JSONException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
MainActivity.weatherSpaceTextView.setText( singleParsed );
MainActivity.weatherTagTextView.setText( weatherTag );
MainActivity.dateTextView.setText( date );
MainActivity.tempTextView.setText( temp );
MainActivity.iconUrl=iconUrl2;
// Log.d( "DEBUG", "HELLO JI "+iconUrl2 );
super.onPostExecute( aVoid );
}
}
| [
"mongiakajal@gmail.com"
] | mongiakajal@gmail.com |
9174686ebda11303e73a56386caacad2c0ec74cf | b25b32a3a026be953c338ac7d488dfb98792030d | /Proxy/ProtectionProxy/PersonBean.java | f8ced474bdd09a13473d9670b970cf66a613e370 | [] | no_license | magoncalves/DesignPatterns | 9876b665f0c19f1b39635d7348cac7dfb2f59d98 | ede937b6d0ddbe00586120f90ffd9fb1371a164c | refs/heads/master | 2020-05-29T19:40:58.837023 | 2020-04-28T01:50:42 | 2020-04-28T01:50:42 | 189,335,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | public interface PersonBean {
String getName();
String getGender();
String getInterests();
int getHotOrNotRating();
void setName(String name);
void setGender(String gender);
void setInterests(String interests);
void setHotOrNotRating(int rating);
} | [
"murilloagoncalves@gmail.com"
] | murilloagoncalves@gmail.com |
48605799fba122ef8a5a2bb843228acc1402fb2f | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/35/35_2cbb7b0eb10832d238c39021400477963052789a/BundleInstallerDialog/35_2cbb7b0eb10832d238c39021400477963052789a_BundleInstallerDialog_s.java | e68fcd52dc74cacc624274f50da83a7e3983eaf8 | [] | 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 | 8,772 | java | package kkckkc.jsourcepad.installer.bundle;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import kkckkc.jsourcepad.Dialog;
import kkckkc.jsourcepad.model.Application;
import kkckkc.jsourcepad.model.bundle.BundleManager;
import kkckkc.jsourcepad.util.Config;
import kkckkc.jsourcepad.util.io.ScriptExecutor;
import kkckkc.utils.DomUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.InputSource;
import javax.annotation.PostConstruct;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.StringReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Set;
public class BundleInstallerDialog implements Dialog<BundleInstallerDialogView> {
private BundleInstallerDialogView view;
private List<BundleTableModel.Entry> bundles;
@PostConstruct
public void init() {
view.getInstallButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
install();
}
});
view.getCancelButton().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
close();
}
});
view.getLabel().setText("Getting list of bundles...");
}
public void show() {
final BundleManager bundleManager = Application.get().getBundleManager();
bundles = Lists.newArrayList();
if (! verifyGit()) {
JOptionPane.showMessageDialog(null,
"Git is not found. Please make sure git is installed (in cygwin if running on windows).",
"Git is not found",
JOptionPane.ERROR_MESSAGE);
return;
}
try {
new SwingWorker<Void, Object>() {
@Override
protected Void doInBackground() throws Exception {
Set<String> preSelectedBundles = Sets.newHashSet();
if (bundleManager.getBundles() == null || bundleManager.getBundles().isEmpty()) {
preSelectedBundles.addAll(Arrays.asList(
"bundle-development", "c", "css", "html", "java", "javascript", "markdown",
"php", "perl", "python", "ruby", "sql", "shellscript", "source", "text",
"textmate", "xml"));
}
URL url = new URL("http://github.com/api/v2/xml/repos/show/textmate");
final URLConnection conn = url.openConnection();
conn.connect();
Document document = DomUtil.parse(new InputSource(conn.getInputStream()));
for (Element e : DomUtil.getChildren(document.getDocumentElement())) {
Element nameE = DomUtil.getChild(e, "name");
String name = DomUtil.getText(nameE);
if (! name.endsWith(".tmbundle")) continue;
bundles.add(new BundleTableModel.Entry(
bundleManager.getBundleByDirName(name) != null ||
preSelectedBundles.contains(name.substring(0, name.lastIndexOf("."))),
bundleManager.getBundleByDirName(name) != null, name, DomUtil.getChildText(e, "url")));
}
return null;
}
@Override
protected void done() {
view.setModel(new BundleTableModel(bundles));
view.getLabel().setText("Available bundles:");
if (bundleManager.getBundles() == null || bundleManager.getBundles().isEmpty()) {
JOptionPane.showMessageDialog(view.getJDialog(),
"As this is the first time you are installing bundles, a selection \n" +
"of common bundles have been pre-selected for you");
}
}
}.execute();
} catch (Exception ioe) {
throw new RuntimeException(ioe);
}
view.getJDialog().show();
}
private boolean verifyGit() {
try {
StatusCallback statusCallback = new StatusCallback();
ScriptExecutor se = new ScriptExecutor("git --version", Application.get().getThreadPool());
ScriptExecutor.Execution execution = se.execute(statusCallback, new StringReader(""), System.getenv());
execution.waitForCompletion();
if (! statusCallback.isSuccessful()) {
return false;
}
} catch (Exception ioe) {
throw new RuntimeException(ioe);
}
return true;
}
@Override
public void close() {
view.getJDialog().dispose();
}
@Override
@Autowired
public void setView(BundleInstallerDialogView view) {
this.view = view;
}
private void install() {
final Collection<BundleTableModel.Entry> entriesToInstall = Collections2.filter(bundles, new Predicate<BundleTableModel.Entry>() {
@Override
public boolean apply(BundleTableModel.Entry entry) {
return ! entry.isDisabled() && entry.isSelected();
}
});
final ProgressMonitor progressMonitor = new ProgressMonitor(view.getJDialog(),
"Installing bundles",
"", 0, entriesToInstall.size());
progressMonitor.setMillisToPopup(100);
new SwingWorker<Void, BundleTableModel.Entry>() {
@Override
protected Void doInBackground() throws Exception {
int i = 0;
for (BundleTableModel.Entry entry : entriesToInstall) {
setProgress(i++);
publish(entry);
installBundle(entry);
if (progressMonitor.isCanceled()) {
return null;
}
}
return null;
}
@Override
protected void process(List<BundleTableModel.Entry> chunks) {
for (BundleTableModel.Entry s : chunks) {
progressMonitor.setProgress(getProgress());
progressMonitor.setNote(s.getName());
}
}
@Override
protected void done() {
Application.get().getBundleManager().reload();
progressMonitor.close();
close();
}
private void installBundle(BundleTableModel.Entry entry) {
try {
// TODO: Show progress
StatusCallback statusCallback = new StatusCallback();
ScriptExecutor se = new ScriptExecutor("git clone " + entry.getUrl() + ".git", Application.get().getThreadPool());
se.setDirectory(Config.getBundlesFolder());
ScriptExecutor.Execution execution = se.execute(statusCallback, new StringReader(""), System.getenv());
execution.waitForCompletion();
if (! statusCallback.isSuccessful()) {
JOptionPane.showMessageDialog(view.getJDialog(), "Cannot install bundle " + entry.getName(),
"Error installing bundle", JOptionPane.ERROR_MESSAGE);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
}.execute();
}
static class StatusCallback extends ScriptExecutor.CallbackAdapter {
boolean successful = false;
@Override
public void onFailure(ScriptExecutor.Execution execution) {
successful = false;
}
@Override
public void onSuccess(ScriptExecutor.Execution execution) {
successful = true;
}
public boolean isSuccessful() {
return successful;
}
};
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
9b76974a65e8ccb43796d6428ff231663f4aa1bf | ea55259853490933f411809940ee026200f2213d | /lesson13/lecture/demo/src/test/java/jp/co/aivick/demo/domain/CaloryTest.java | 0b4ad7be0acb24d7dc9ed2579b83460ae3902527 | [] | no_license | yamassx/java_lecture-1 | fc242febc3a343bb7790b7ef9d86ba50583a8a4d | 0a4eff9b1d1641dbc93020d144ae4a5c1ea9bab3 | refs/heads/master | 2022-10-06T20:34:37.361451 | 2020-06-12T02:56:30 | 2020-06-12T02:56:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 668 | java | package jp.co.aivick.demo.domain;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class CaloryTest
{
@Test
void カロリーが生成できる() {
var sut = new Calory(100);
assertEquals(100, sut.value());
}
@Test
void マイナスのカロリーは生成できない() {
assertThrows(IllegalArgumentException.class, () -> {
new Calory(-10);
});
}
@Test
void 小数点桁数を指定して文字列整形できる() {
var sut = new Calory(100.235);
var acutal = sut.format(2);
assertEquals("100.24 Kcal", acutal);
}
}
| [
"h.tomoyuki@me.com"
] | h.tomoyuki@me.com |
5e47980af06143cddc3320f4fd8a2baab9b61361 | 24b6f2416c2225d14ec4baee7432b67d6dd3309c | /Jshop/Jshop-utils/src/main/java/com/jshop/tools/service/dto/LocalStorageDto.java | f7d4c4d94def8cd2724e8440e527daa81035baf1 | [
"Apache-2.0"
] | permissive | 906522290/tetHttps | 61722939dbad672178c33b5a794e2f793e4e70aa | 6a223fd0f163005f79344ed631b1480d1cb1a411 | refs/heads/main | 2023-06-17T20:14:52.524042 | 2021-07-15T02:41:52 | 2021-07-15T02:41:52 | 386,139,606 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | /**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.kaikeba.co
*/
package com.jshop.tools.service.dto;
import lombok.Data;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* @author jack胡
*/
@Data
public class LocalStorageDto implements Serializable {
private Long id;
private String realName;
private String name;
private String suffix;
private String path;
private String type;
private String size;
private String operate;
private Timestamp createTime;
}
| [
"906522290@qq.com"
] | 906522290@qq.com |
08587c75010d74480990dc08ba22428c4357b66d | 88901adee6bf5621b46368055440a712b592a63f | /src/main/java/wc/wc.java | dd15b31c34c99a1cd4bc71ca425d3344ef1a1bd9 | [] | no_license | caiboqiang/Spark | a1f5097d0469aa383f3e27e0062f61413d2a47d6 | a1f9dd9d6ed476cde1565eb7f10d8b13ac3bb32a | refs/heads/master | 2020-04-05T11:38:33.022343 | 2018-11-09T10:01:16 | 2018-11-09T10:01:17 | 156,842,570 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,220 | java | package wc;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.api.java.function.Function2;
import org.apache.spark.api.java.function.PairFunction;
import org.apache.spark.api.java.function.VoidFunction;
import scala.Tuple2;
import java.util.Arrays;
/**
* 本地测试单词统计程序
*/
public class wc {
public static void main( String[] args){
//编写Spark应用程序
//1.创建SparkConf对象 设置配置
//setMaster:可以设置Spark应用程序要连接的Spark需要的集群Master节点的URL ,如果设置为local[1]则表示在本地运行
SparkConf con = new SparkConf().setAppName("RDD").setMaster("local[2]");
//2.创建JavaSparkContext对象。在Spark中SparkContext是所有功能的入口,无论是java、scala 等 主要作用初始化Spark应用的核心组件。是Spark中最重要的对象。
// 第二步:创建JavaSparkContext对象
// 在Spark中,SparkContext是Spark所有功能的一个入口,你无论是用java、scala,甚至是python编写
// 都必须要有一个SparkContext,它的主要作用,包括初始化Spark应用程序所需的一些核心组件,包括
// 调度器(DAGSchedule、TaskScheduler),还会去到Spark Master节点上进行注册,等等
// 一句话,SparkContext,是Spark应用中,可以说是最最重要的一个对象
// 但是呢,在Spark中,编写不同类型的Spark应用程序,使用的SparkContext是不同的,如果使用scala,
// 使用的就是原生的SparkContext对象
// 但是如果使用Java,那么就是JavaSparkContext对象
// 如果是开发Spark SQL程序,那么就是SQLContext、HiveContext
// 如果是开发Spark Streaming程序,那么就是它独有的SparkContext
// 以此类推
JavaSparkContext sc = new JavaSparkContext(con);
//3.连接数据源 hdfs 等
// 第三步:要针对输入源(hdfs文件、本地文件,等等),创建一个初始的RDD
// 输入源中的数据会打散,分配到RDD的每个partition中,从而形成一个初始的分布式的数据集
// 我们这里呢,因为是本地测试,所以呢,就是针对本地文件
// SparkContext中,用于根据文件类型的输入源创建RDD的方法,叫做textFile()方法
// 在Java中,创建的普通RDD,都叫做JavaRDD
// 在这里呢,RDD中,有元素这种概念,如果是hdfs或者本地文件呢,创建的RDD,每一个元素就相当于
// 是文件里的一行
JavaRDD<String> lines = sc.textFile("C://Users//Administrator//Desktop//spark.txt");
// 第四步:对初始RDD进行transformation操作,也就是一些计算操作
// 通常操作会通过创建function,并配合RDD的map、flatMap等算子来执行
// function,通常,如果比较简单,则创建指定Function的匿名内部类
// 但是如果function比较复杂,则会单独创建一个类,作为实现这个function接口的类
// 先将每一行拆分成单个的单词
// FlatMapFunction,有两个泛型参数,分别代表了输入和输出类型
// 我们这里呢,输入肯定是String,因为是一行一行的文本,输出,其实也是String,因为是每一行的文本
// 这里先简要介绍flatMap算子的作用,其实就是,将RDD的一个元素,给拆分成一个或多个元素
JavaRDD<String> words = lines.flatMap(new FlatMapFunction<String, String>() {
private static final long serialVersionUID = 1L;
@Override
public Iterable<String> call(String line) throws Exception {
return Arrays.asList(line.split(" "));
}
});
// 接着,需要将每一个单词,映射为(单词, 1)的这种格式
// 因为只有这样,后面才能根据单词作为key,来进行每个单词的出现次数的累加
// mapToPair,其实就是将每个元素,映射为一个(v1,v2)这样的Tuple2类型的元素
// 如果大家还记得scala里面讲的tuple,那么没错,这里的tuple2就是scala类型,包含了两个值
// mapToPair这个算子,要求的是与PairFunction配合使用,第一个泛型参数代表了输入类型
// 第二个和第三个泛型参数,代表的输出的Tuple2的第一个值和第二个值的类型
// JavaPairRDD的两个泛型参数,分别代表了tuple元素的第一个值和第二个值的类型
JavaPairRDD<String, Integer> pairs = words.mapToPair(
new PairFunction<String, String, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public Tuple2<String, Integer> call(String word) throws Exception {
return new Tuple2<String, Integer>(word, 1);
}
});
// 接着,需要以单词作为key,统计每个单词出现的次数
// 这里要使用reduceByKey这个算子,对每个key对应的value,都进行reduce操作
// 比如JavaPairRDD中有几个元素,分别为(hello, 1) (hello, 1) (hello, 1) (world, 1)
// reduce操作,相当于是把第一个值和第二个值进行计算,然后再将结果与第三个值进行计算
// 比如这里的hello,那么就相当于是,首先是1 + 1 = 2,然后再将2 + 1 = 3
// 最后返回的JavaPairRDD中的元素,也是tuple,但是第一个值就是每个key,第二个值就是key的value
// reduce之后的结果,相当于就是每个单词出现的次数
JavaPairRDD<String, Integer> wordCounts = pairs.reduceByKey(
new Function2<Integer, Integer, Integer>() {
private static final long serialVersionUID = 1L;
@Override
public Integer call(Integer v1, Integer v2) throws Exception {
return v1 + v2;
}
});
// 到这里为止,我们通过几个Spark算子操作,已经统计出了单词的次数
// 但是,之前我们使用的flatMap、mapToPair、reduceByKey这种操作,都叫做transformation操作
// 一个Spark应用中,光是有transformation操作,是不行的,是不会执行的,必须要有一种叫做action
// 接着,最后,可以使用一种叫做action操作的,比如说,foreach,来触发程序的执行
wordCounts.foreach(new VoidFunction<Tuple2<String,Integer>>() {
private static final long serialVersionUID = 1L;
@Override
public void call(Tuple2<String, Integer> wordCount) throws Exception {
System.out.println(wordCount._1 + " appeared " + wordCount._2 + " times.");
}
});
sc.close();
}
}
| [
"908507670@qq.com"
] | 908507670@qq.com |
2b1117ed11cff3cce18de0bc115cdbea7f060e0e | fc953c483aacd205255a0c47419e442ee1aa1fe9 | /src/pachet/tema3/Robots/Robot.java | 6c50a6fe382e580facf0f1e1702d73fe435726dd | [] | no_license | slv92/IPRepo_LAB | 213c78d6be249b5a711b93e35846dc7a26964a26 | 1c6fa050d09fae49776a12012ab609d450839669 | refs/heads/master | 2020-04-06T04:34:05.555819 | 2014-11-09T10:46:39 | 2014-11-09T10:46:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package pachet.tema3.Robots;
/**
* Created by slv on 11/2/2014.
*/
public abstract class Robot {
/**
* The Name of the robot
*/
String mName;
/**
* The default constructor
*
* @param mName
*/
public Robot(String mName) {
this.mName = mName;
}
/**
* This method sets what type of weapon the robot has
* It has to be overwritten by subclasses
*
* @param WeaponName
*/
public abstract void weapon(String WeaponName);
public String getmName() {
return mName;
}
public void setmName(String mName) {
this.mName = mName;
}
}
| [
"silviu.gabriel92@gmail.com"
] | silviu.gabriel92@gmail.com |
7b32ab9f5793f6233f0d1f525c13b8d5a0c7d393 | ad315316c3b3ef8fa698b66864fd2164386e499d | /devel/projects/spa/src/hr/restart/util/reports/raRacRnalSumSection_Footer2.java | e70fb4bd31309ed4382afd377f2eb0eabd710b14 | [] | no_license | apemant/spa | 73c2c5b3f32375990d5410052675b3987f31f4cd | 58f2343aa3415a61b8a3215d09de5dd8e23fab83 | refs/heads/master | 2020-04-18T03:08:47.909138 | 2019-01-24T13:28:09 | 2019-01-24T13:28:09 | 167,188,261 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,957 | java | /****license*****************************************************************
** file: raRacRnalSumSection_Footer2.java
** Copyright 2006 Rest Art
**
** 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 hr.restart.util.reports;
public class raRacRnalSumSection_Footer2 extends raReportSection {
private String[] thisProps = new String[] {"MatUslGrouping", "", "", "", "Yes", "", "Yes", /*"500"*/"400"};
public raReportElement Line1;
private String[] Line1Props = new String[] {"/", "", "", "20", "10800", "0", "", "", ""};
public raReportElement Label1;
private String[] Label1Props = new String[] {"", "", "", "60", "10820", "280", "Normal", "Gray",
"Solid", "Gray", "", "", "Lucida Bright", "8", "Bold", "", "", "Center"};
public raReportElement LabelUKUPNO;
private String[] LabelUKUPNOProps = new String[] {"UKUPNO", "", "200", "100", "920", "220",
"Normal", "Gray", "Solid", "Gray", "", "", "Lucida Bright", "8", "Bold", "", "", ""};
public raReportElement TextRADOVIMATERIJAL;
private String[] TextRADOVIMATERIJALProps = new String[] {"RADOVIMATERIJAL", "", "", "", "", "",
"", "", "1120", "100", "3160", "220", "", "-1973791", "", "", "", "", "Lucida Bright", "8",
"Bold", "", "", "", ""};
public raReportElement Text1;
private String[] Text1Props = new String[] {"=(dsum \"INETO\")", "", "",
"Number|false|1|309|2|2|true|3|false", "", "", "", "", "9420", /*"100"*/"60", "1400", "220", "", "",
"", "", "", "", "Lucida Bright", "8",/* "Bold"*/"", "", "", "Right", ""};
public raReportElement Line2;
private String[] Line2Props = new String[] {"/", "", "", "280", "10800", "0", "", "", ""};
public raRacRnalSumSection_Footer2(raReportTemplate owner) {
super(owner.template.getModel(raElixirProperties.SECTION_FOOTER + 2));
this.setDefaults(thisProps);
addElements();
addReportModifier(new ReportModifier() {
public void modify() {
modifyThis();
}
});
}
private void addElements() {
Line1 = addModel(ep.LINE, Line1Props);
// Label1 = addModel(ep.LABEL, Label1Props);
// LabelUKUPNO = addModel(ep.LABEL, LabelUKUPNOProps);
// TextRADOVIMATERIJAL = addModel(ep.TEXT, TextRADOVIMATERIJALProps);
Text1 = addModel(ep.TEXT, Text1Props);
Line2 = addModel(ep.LINE, Line2Props);
}
private void modifyThis() {
}
}
| [
""
] | |
9ca9e6411f7f09b3fe0b86f96cf4d9b391d60531 | b61a99d71dc59cbc3e20b399594b21ee475f685d | /src/projecto/EventS.java | 49f876c3bc2f6a30a715636197d2b932576e41b7 | [] | no_license | BCasaleiro/Projecto2-SCC | 6e8ebcee317c594fc2f355965df7af2dd17730f7 | da1a1d1494842266fcc80746acf4f3aa847b2659 | refs/heads/master | 2020-05-31T04:32:36.236007 | 2015-03-21T20:19:15 | 2015-03-21T20:19:15 | 32,527,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,569 | java | /*
Author: Fernando J. Barros
University of Coimbra
Department of Informatics Enginnering
3030 Coimbra, Portugal
Date: 20/2/2015
*/
package projecto;
import java.util.*;
interface RandomStream {
abstract public double next();
}
class Discrete extends Uniform01 {
private final double[] prob;
private final double[] values;
public Discrete(int stream, double[] values, double[] prob) {
super(stream);
double sum = 0.0;
for (int i = 0; i < prob.length; ++i) sum += prob[i];
assert(sum <= 1.0);
this.prob = prob;
this.values = values;
}
@Override
public double next() {
double rnd = super.next();
int i = 0;
double sum = prob[i];
while (sum < rnd) sum += prob[++i];
return values[i];
}
}
class Constant implements RandomStream {
final private double value;
public Constant(int value) {this.value = value;}
@Override
public double next() {return value;}
}
class Uniform01 implements RandomStream {
final private Random rnd;
public Uniform01(int stream) {rnd = new Random(stream);}
@Override
public double next() {return rnd.nextDouble();}
}
class Uniform extends Uniform01 {
final private double a, b;
public Uniform(int stream, double a, double b) {
super(stream);
assert (a < b);
this.a = a;
this.b = b;
}
@Override
public double next() {return a + super.next() * (b - a);}
}
class Sequence implements RandomStream {
final private double[] values;
private int curr;
public Sequence(double[] values) {
this.values = values;
curr = 0;
}
@Override
public double next() {
return values[curr++];
}
}
class Exponential extends Uniform01 {
final private double mean;
public Exponential(int stream, double mean) {
super(stream);
this.mean = mean;
}
@Override
public double next() {return -mean * Math.log(super.next());}
}
class Accumulate {
private int max = 0;
private int value = 0;
private double accum = 0.0;
private double last = 0.0;
public Accumulate(int value) {this.value = value;}
public void inc(int d, double time) {
set(value + d, time);
if(value > max){
max = value;
}
}
public void set(int v, double time) {
double delta = time - last;
accum += value * delta;
this.value = v;
last = time;
}
public double mean(double time) {return integral(time) / time;}
public double integral(double time) {
double delta = time - last;
accum += value * delta;
last = time;
return accum;
}
public int value() {return value;}
public int getMax() {
return max;
}
public void setMax(int max) {
this.max = max;
}
@Override
public String toString() {return "" + value + " " + accum + " " + last;}
}
class Average {
private double max = 0;
private double sum;
private int count;
public Average() {clear();}
public double mean() {return sum / count;}
public void add(double value) {
if(max < value){
max = value;
}
sum += value;
++count;
}
public int count() {return count;}
public final void clear() {
sum = 0.0;
count = 0;
}
public double getMax(){
return max;
}
@Override
public String toString() {return String.format("%.3f\t%d", mean(), count);}
}
class Tally {
final private List<Double> values;
public Tally() {values = new ArrayList<>();}
public double mean() {
double sum = 0.0;
for (Double value: values) sum += value;
return sum / values.size();
}
public double stdDev() {
double sum = 0.0;
double mean = mean();
for (Double value: values) sum += Math.pow(mean - value, 2);
return Math.sqrt(sum / (values.size() - 1));
}
public void add(double value) {values.add(value);}
public void clear() {values.clear();}
@Override
public String toString() {return "" + values;}
}
abstract class Event implements Comparable<Event> {
protected double time = 0;
public Event() {}
public void time(double time) {
assert (time >= 0): "Event.time: Time error.";
this. time = time;
}
public double time() {return time;}
public abstract void execute();
@Override
public int compareTo(Event e) {
if (time > e.time) return 1;
return -1;
}
@Override
public String toString() {return this.getClass().getSimpleName() + " " + String.format("%.2f", time);}
}
abstract class Model {
private Simulator simulator;
protected void simulator(Simulator simulator) {this.simulator = simulator;}
public Model() {}
abstract protected void init();
protected final void cancel(Event e) {simulator.cancel(e);}
protected final Event schedule(Event ev, double delta) {
assert (delta >= 0): "Model.schedule, time error! " + delta;
simulator.schedule(ev, delta);
return ev;
}
protected final boolean reschedule(Event e, double delta) {
assert (delta >= 0): "Model.reschedule, time error! " + delta;
return simulator.reschedule(e, delta);
}
protected final void clear() {simulator.clear();}
}
final class EventList {
protected final PriorityQueue<Event> eventList;
public EventList() {
this.eventList = new PriorityQueue<>(10);
}
public boolean empty() {return eventList.isEmpty();}
public void clear() {eventList.clear();}
public void schedule(Event e, double time) {
e.time(time);
eventList.add(e);
}
public boolean reschedule(Event e, double time) {
boolean bool = eventList.remove(e);
e.time(time);
eventList.add(e);
return bool;
}
public void cancel(Event e) {eventList.remove(e);}
@Override
public String toString() {return eventList.toString();}
public double timeNext() {return eventList.peek().time();}
public Event pop() {return eventList.poll();}
}
final class Simulator {
private final Model model;
double clock;
private final EventList events;
public Simulator(Model model) {
this.model = model;
clock = 0.0;
events = new EventList();
}
protected void cancel(Event e) {events.cancel(e);}
public Event schedule(Event e, double delta) {
assert (delta >= 0): "Simulator.schedule, time error! " + delta;
events.schedule(e, clock + delta);
return e;
}
public boolean reschedule(Event e, double delta) {
assert (delta >= 0): "Simulation.reschedule, time error! " + delta;
return events.reschedule(e, clock + delta);
}
public void clear() {events.clear();}
public final void run() {
model.init();
while (! events.empty()) {
Event event = events.pop();
double curr = event.time();
assert (curr >= clock): "Simulation.run, time error. " + curr + " > " + clock;
clock = curr;
event.execute();
}
}
} | [
"bernardocasaleiro@gmail.com"
] | bernardocasaleiro@gmail.com |
2cc0a999fbfbda79d47f9bb57e6c18934698a6c7 | 1f7a8a0a76e05d096d3bd62735bc14562f4f071a | /NeverPuk/net/y6/l.java | 1514c0e5f34001bbd874f0f9f36452a942d6287f | [] | no_license | yunusborazan/NeverPuk | b6b8910175634523ebd4d21d07a4eb4605477f46 | a0e58597858de2fcad3524daaea656362c20044d | refs/heads/main | 2023-05-10T09:08:02.183430 | 2021-06-13T17:17:50 | 2021-06-13T17:17:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,898 | java | package net.y6;
import net.y6.jb;
public class l extends net.y6.z {
public jb L;
public jb S;
public jb J;
public jb R;
public jb M;
public jb m;
public jb E;
public l() {
this(0.0F);
}
public l(float var1) {
boolean var10000 = true;
this.L = new jb(this, 0, 0);
this.L.d(-4.0F, -8.0F, -4.0F, 8, 8, 8, var1);
this.L.n(0.0F, 6.0F, 0.0F);
this.S = new jb(this, 32, 0);
this.S.d(-4.0F, -8.0F, -4.0F, 8, 8, 8, var1 + 0.5F);
this.S.n(0.0F, 6.0F, 0.0F);
this.J = new jb(this, 16, 16);
this.J.d(-4.0F, 0.0F, -2.0F, 8, 12, 4, var1);
this.J.n(0.0F, 6.0F, 0.0F);
this.R = new jb(this, 0, 16);
this.R.d(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1);
this.R.n(-2.0F, 18.0F, 4.0F);
this.M = new jb(this, 0, 16);
this.M.d(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1);
this.M.n(2.0F, 18.0F, 4.0F);
this.m = new jb(this, 0, 16);
this.m.d(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1);
this.m.n(-2.0F, 18.0F, -4.0F);
this.E = new jb(this, 0, 16);
this.E.d(-2.0F, 0.0F, -2.0F, 4, 6, 4, var1);
this.E.n(2.0F, 18.0F, -4.0F);
}
public void V(net.ne.l var1, float var2, float var3, float var4, float var5, float var6, float var7) {
this.p(var2, var3, var4, var5, var6, var7, var1);
this.L.B(var7);
this.J.B(var7);
this.R.B(var7);
this.M.B(var7);
this.m.B(var7);
this.E.B(var7);
}
public void p(float var1, float var2, float var3, float var4, float var5, float var6, net.ne.l var7) {
this.L.N = var4 * 0.017453292F;
this.L.b = var5 * 0.017453292F;
this.R.b = net.u.t.m(var1 * 0.6662F) * 1.4F * var2;
this.M.b = net.u.t.m(var1 * 0.6662F + 3.1415927F) * 1.4F * var2;
this.m.b = net.u.t.m(var1 * 0.6662F + 3.1415927F) * 1.4F * var2;
this.E.b = net.u.t.m(var1 * 0.6662F) * 1.4F * var2;
}
}
| [
"68544940+Lazy-Hero@users.noreply.github.com"
] | 68544940+Lazy-Hero@users.noreply.github.com |
4eed1e1cb40e91791d65c51127e3d21fff9f05ba | 65c19e3f3194c94b0c35688ea5e39efb1c9fdab2 | /src/main/java/org/adactin/helper/PropertyReaderManager.java | 7cb367ed7bfb749def71e0bea25e2bf4430625af | [] | no_license | kevivek2003/sabarlatest | adeb03822d60b340ccafd5dccf0d1f548957ebda | ae4d73e30c72955c68ea04f6759e806321dba8fa | refs/heads/master | 2021-06-15T15:33:20.493730 | 2019-06-22T07:41:48 | 2019-06-22T07:41:48 | 193,202,370 | 0 | 0 | null | 2021-04-26T19:16:14 | 2019-06-22T06:57:44 | HTML | UTF-8 | Java | false | false | 434 | java | package org.adactin.helper;
import org.openqa.selenium.WebDriver;
public class PropertyReaderManager {
static PropertyReaderManager prm = new PropertyReaderManager();
private PropertyReaderManager() {
}
public PropertyReader pr;
public static PropertyReaderManager getInstance() {
return prm;
}
public PropertyReader getPr() throws Throwable {
if (pr == null) {
pr = new PropertyReader();
}
return pr;
}
}
| [
"kevivek20@gmail.com"
] | kevivek20@gmail.com |
10717e2fafa2cc6b51003b6dbb27978da9bf5d93 | 6472e2c37e41a0368adb8e067de53bfdddf535af | /engineering/src/main/java/controller/employees/EmployeeController.java | 4b14a9ae177bd171491e1b71dcfdd3cf756f3644 | [] | no_license | SoongMoo/engineering | e67a5594f88eaf104bcb473fbae9a81a0f0d0fe4 | 6739af732fb1c94ad9f2ece2682094051d834032 | refs/heads/main | 2023-07-14T03:31:13.495572 | 2021-08-26T23:36:07 | 2021-08-26T23:36:07 | 375,644,313 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,445 | java | package controller.employees;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import command.EmployeeCommand;
import service.employees.EmployeeDeleteService;
import service.employees.EmployeeInfoService;
import service.employees.EmployeeListService;
import service.employees.EmployeeModifyService;
import service.employees.EmployeeNoService;
import service.employees.EmployeeService;
@Controller
@RequestMapping("emp")
public class EmployeeController {
@Autowired
EmployeeService employeeService;
@Autowired
EmployeeNoService employeeNoService;
@Autowired
EmployeeListService employeeListService;
@Autowired
EmployeeInfoService employeeInfoService;
@Autowired
EmployeeModifyService employeeModifyService;
@Autowired
EmployeeDeleteService employeeDeleteService;
@RequestMapping("empList")
public String empList(Model model) {
employeeListService.empList(model);
return "employee/empList";
}
@RequestMapping("empReget")
public String empReget(Model model) {
employeeNoService.getEmpNo(model);
return "employee/employeeForm";
}
@RequestMapping(value="empJoin", method=RequestMethod.POST)
public String empJoin(EmployeeCommand employeeCommand) {
employeeService.insertEmp(employeeCommand);
return "redirect:empList";
}
@RequestMapping("empInfo")
public String empInfo(
@RequestParam(value="empNo") String empNo,
Model model) {
employeeInfoService.empInfo(empNo,model);
System.out.println(empNo);
return "employee/employeeInfo";
}
@RequestMapping("empModify")
public String empModify(
@RequestParam(value="empNo") String empNo,
Model model
) {
employeeInfoService.empInfo(empNo,model);
return "employee/employeeModify";
}
@RequestMapping("empModifyOk")
public String empModifyOk(EmployeeCommand employeeCommand) {
employeeModifyService.empModify(employeeCommand);
return "redirect:empInfo?empNo="+employeeCommand.getEmpNo();
}
@RequestMapping("empDelete")
public String empDelete(
@RequestParam(value="empNo") String empNo
) {
employeeDeleteService.empDelete(empNo);
return "redirect:empList";
}
}
| [
"leekh4232@gmail.com"
] | leekh4232@gmail.com |
2f42d5b38d69e8a29102aa1a6a497ae3b25b007e | 449549f47bdfbbdfff778de2ccce5b57181cbc05 | /src/WebUI/ImageServlet.java | 7902f90abcc7f3df771f9b38609c9170922ccd0c | [] | no_license | opensourcecode/TagRecommender | 4e2b9e39e7476dad48704dc015053e21b6ae32a5 | 59d579a2fd2aded2711810c0485d00083281da99 | refs/heads/master | 2021-01-10T20:43:46.471203 | 2014-04-18T21:03:59 | 2014-04-18T21:03:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,775 | java | package WebUI;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/ImageServlet")
public class ImageServlet extends HttpServlet
{
private static final long serialVersionUID = -8084138612164586175L;
public ImageServlet()
{
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String relativePath = trimToEmpty(request.getPathInfo());
if(isXSSAttack(relativePath) == false)
{
String pathToFile = this.getServletContext().getRealPath(request.getPathInfo());
File file = new File(pathToFile);
System.out.println("Looking for file " + file.getAbsolutePath());
if(!file.exists() || !file.isFile()) {
httpError(404, response);
} else {
try {
streamImageFile(file, response);
} catch(Exception e) {
// Tell the user there was some internal server error.\
// 500 - Internal server error.
httpError(500, response);
e.printStackTrace();
}
}
} else {
// what to do if i think it is a XSS attack ?!?
}
}
private void streamImageFile(File file, HttpServletResponse response) {
// find the right MIME type and set it as content type
response.setContentType(getContentType(file));
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
response.setContentLength((int) file.length());
// Use Buffered Stream for reading/writing.
bis = new BufferedInputStream(new FileInputStream(file));
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buff = new byte[(int) file.length()];
int bytesRead;
// Simple read/write loop.
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if (bis != null) {
try {
bis.close();
} catch (IOException e) {
e.printStackTrace();
// To late to do anything about it now, we may have already sent some data to user.
}
}
if (bos != null) {
try {
bos.close();
} catch (IOException e) {
e.printStackTrace();
// To late to do anything about it now, we may have already sent some data to user.
}
}
}
}
private String getContentType(File file) {
if(file.getName().length() > 0) {
String[] parts = file.getName().split("\\.");
if(parts.length > 0) {
// only last part interests me
String extention = parts[parts.length - 1];
if(extention.equalsIgnoreCase("jpg")) {
return "image/jpg";
} else if(extention.equalsIgnoreCase("gif")) {
return "image/gif";
} else if(extention.equalsIgnoreCase("png")) {
return "image/png";
}
}
}
throw new RuntimeException("Can not find content type for the file " + file.getAbsolutePath());
}
private String trimToEmpty(String pathInfo) {
if(pathInfo == null) {
return "";
} else {
return pathInfo.trim();
}
}
private void httpError(int statusCode, HttpServletResponse response) {
try {
response.setStatus(statusCode);
response.setContentType("text/html");
PrintWriter writer = response.getWriter();
writer.append("<html><body><h1>Error Code: " + statusCode + "</h1><body></html>");
writer.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
private boolean isXSSAttack(String path) {
boolean xss = false;
// Split on the bases of know file separator
String[] parts = path.split("/|\\\\");
// Now verify that no part contains anything harmful
for(String part : parts) {
// No double dots ..
// No colons :
// No semicolons ;
if(part.trim().contains("..") || part.trim().contains(":") || part.trim().contains(";")) {
// Fire in the hole!
xss = true;
break;
}
}
return xss;
}
/**
* @see HttpServlet#doPost(Ht/promotions/some.jpgtpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| [
"ashutosh.iiit@gmail.com"
] | ashutosh.iiit@gmail.com |
9b33068d1cd7b83eba7def0dd58a35d7e55eb2e6 | 8a5216fc4c6b3f69db85d6e7050bf72ae267efcd | /app/src/main/java/com/example/achowdhury/architecture/di/BindersModule.java | 339f50d27304ccb848a2cc09465a971d1feb728b | [] | no_license | achowdhury3762/Architecture | 1b9285e9426b7ca686f139b7bf1490b65b4abc02 | 24c73f14ab161a14f9481cd6ed609fabef455196 | refs/heads/master | 2021-09-14T03:48:24.981027 | 2018-05-07T20:45:29 | 2018-05-07T20:45:29 | 117,057,306 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,407 | java | package com.example.achowdhury.architecture.di;
import com.example.achowdhury.architecture.presentation.authentication.SpotifyAuthenticationActivity;
import com.example.achowdhury.architecture.presentation.authentication.SpotifyAuthenticationModule;
import com.example.achowdhury.architecture.presentation.fullscreenplaylist.PlayMusicActivity;
import com.example.achowdhury.architecture.presentation.lobby.LobbyActivity;
import com.example.achowdhury.architecture.presentation.lobby.LobbyModule;
import com.example.achowdhury.architecture.presentation.login.LoginActivity;
import com.example.achowdhury.architecture.presentation.login.LoginModule;
import com.example.achowdhury.architecture.presentation.fullscreenplaylist.PlayMusicModule;
import dagger.Module;
import dagger.android.ContributesAndroidInjector;
@Module
abstract class BindersModule {
@PerActivity
@ContributesAndroidInjector(modules = SpotifyAuthenticationModule.class)
abstract SpotifyAuthenticationActivity spotifyAuthenticationActivity();
@PerActivity
@ContributesAndroidInjector(modules = LoginModule.class)
abstract LoginActivity loginActivity();
@PerActivity
@ContributesAndroidInjector(modules = LobbyModule.class)
abstract LobbyActivity lobbyActivity();
@PerActivity
@ContributesAndroidInjector(modules = PlayMusicModule.class)
abstract PlayMusicActivity playMusicActivity();
}
| [
"achowdhury@Ashiques-MacBook-Pro.local"
] | achowdhury@Ashiques-MacBook-Pro.local |
ef3549fbfba437dce05594cb7acb7b73c80547ca | 515034ff0a001d081efbe78167262c7e2c9041c2 | /src/Exam_Preparation_November_2020/P05_FitnessCenter.java | 946ae85e477ac82e159f6fe16d3bc8ce5a0e4711 | [] | no_license | rbekyarov/SoftUni_Java_Programming_Basics | 2b798571868fd1e22b7eb9f14caec3dba4efc2aa | 30d4a449a6c8d4c202b4f07e105eb355cd1e66be | refs/heads/main | 2023-08-10T17:39:20.569560 | 2021-10-02T13:26:49 | 2021-10-02T13:26:49 | 408,304,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,835 | java | package Exam_Preparation_November_2020;
import java.util.Scanner;
public class P05_FitnessCenter {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int visitors = Integer.parseInt(scan.nextLine());
int back = 0;
int chest = 0;
int legs = 0;
int abs = 0;
int proteinShake = 0;
int proteinBar = 0;
int training = 0;
int shopping = 0;
for (int i = 0; i < visitors; i++) {
String activity = scan.nextLine();
if ("Back".equals(activity)) {
back++;
training++;
} else if ("Chest".equals(activity)) {
chest++;
training++;
} else if ("Legs".equals(activity)) {
legs++;
training++;
} else if ("Abs".equals(activity)) {
abs++;
training++;
} else if ("Protein shake".equals(activity)) {
proteinShake++;
shopping++;
} else if ("Protein bar".equals(activity)) {
proteinBar++;
shopping++;
}
}
System.out.println(String.format("%d - back", back));
System.out.println(String.format("%d - chest", chest));
System.out.println(String.format("%d - legs", legs));
System.out.println(String.format("%d - abs", abs));
System.out.println(String.format("%d - protein shake", proteinShake));
System.out.println(String.format("%d - protein bar", proteinBar));
System.out.println(String.format("%.2f%% - work out", (training * 1.0 / (training + shopping)) * 100));
System.out.println(String.format("%.2f%% - protein", (shopping * 1.0 / (training + shopping)) * 100));
}
}
| [
"rbekyarov82@gmail.com"
] | rbekyarov82@gmail.com |
6e501db3b73357e3c7a628f77677c3cc9b79c6c9 | ca39975eb7d604e77e1deb8c0d49087bcd264c2b | /Organizze/app/src/main/java/com/example/organizze/adapter/AdapterMovimentacao.java | a2edf1521ebd910d1227cb3aaf3f7428793a8227 | [] | no_license | dcaahub/Android | 7d87ef49963d025faa8e9a91f7c3ad42f3eb09af | 3d7dd97c916fd4b39c3bad20b82937e8c3fe891f | refs/heads/master | 2021-08-28T10:21:11.951170 | 2021-08-20T19:31:20 | 2021-08-20T19:31:20 | 236,014,548 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,190 | java | package com.example.organizze.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.example.organizze.R;
import com.example.organizze.model.Movimentacao;
import java.util.List;
/**
* Created by Jamilton Damasceno
*/
public class AdapterMovimentacao extends RecyclerView.Adapter<AdapterMovimentacao.MyViewHolder> {
List<Movimentacao> movimentacoes;
Context context;
public AdapterMovimentacao(List<Movimentacao> movimentacoes, Context context) {
this.movimentacoes = movimentacoes;
this.context = context;
}
@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemLista = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_movimentacao, parent, false);
return new MyViewHolder(itemLista);
}
@Override
public void onBindViewHolder(MyViewHolder holder, int position) {
Movimentacao movimentacao = movimentacoes.get(position);
holder.titulo.setText(movimentacao.getDescricao());
holder.valor.setText(String.valueOf(movimentacao.getValor()));
holder.categoria.setText(movimentacao.getCategoria());
holder.valor.setTextColor(context.getResources().getColor(R.color.colorAccentReceita));
if (movimentacao.getTipo() == "d" || movimentacao.getTipo().equals("d")) {
holder.valor.setTextColor(context.getResources().getColor(R.color.colorAccent));
holder.valor.setText("-" + movimentacao.getValor());
}
}
@Override
public int getItemCount() {
return movimentacoes.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder {
TextView titulo, valor, categoria;
public MyViewHolder(View itemView) {
super(itemView);
titulo = itemView.findViewById(R.id.textAdapterTitulo);
valor = itemView.findViewById(R.id.textAdapterValor);
categoria = itemView.findViewById(R.id.textAdapterCategoria);
}
}
}
| [
"dcaahub@gmail.com"
] | dcaahub@gmail.com |
5862c215d08f8716b6bad72391421a10dd91d44e | 81c0123f1f336921d32873f7e3930c00103d8eea | /chapter_008/src/main/java/ru/chedmitriy/persistent/Store.java | 0414a0fe01f99a7afb99c6ebfefa9608b73c2f2e | [
"Apache-2.0"
] | permissive | CheRut/chedmitry | 9c659f073d478ee87545c85f949214bf2418cbec | 00d780fe0307aeb7e0cf2d1411128114678ae137 | refs/heads/master | 2021-01-12T04:48:25.916780 | 2019-01-06T13:50:43 | 2019-01-06T13:50:43 | 77,799,730 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,694 | java | package ru.chedmitriy.persistent;
import java.util.Collection;
/**
* Интерфейс хранилища пользователей
* Здесь собраны все опреции
* для работы с хранилищем
* пользователей: добавление,
* удаление, редактирование,
* поиск.
*
*/
public interface Store<User> {
/** Поиск по id
* Также используется при удалении и
* редактированиии
* @param id -искомый пользователь
* пользователь с таким ключом-id
*/
User getById(int id);
/**
* Добавляем пользователя
* @param user новый пользователь
*/
void add(final User user);
/**
* пользователь ищется в
* хранилище по id.
* Удаляем пользователь
* по его id
* @param id - id удаляемого
* пользователя
*/
void delete(final int id);
/** Get the store's values
* without a keys
* @return - values
*/
Collection<User> values();
/**
* Пользователь ищется в
* хранилище по id,
* затем редактируется
* @param user - id редактируемого
* пользователя
*/
void edit(final User user);
/**
* Получаем значения
* хранилища
* @return - значения из хранилища
*/
Collection<User> viewAll();
}
| [
"diemason@list.ru"
] | diemason@list.ru |
8e6b04442b0713ded76e7b2c265f688e5c2ad28b | b4516f23d85112e87b8fe1c39eb7a8a07de54c61 | /javacore04/src/com/hk/app/Select4.java | 0d6efe43107b290b2ecc3887922bcd65830263ae | [] | no_license | kyeongmin92/Java_min | 6d2d7034d3e362a31fcef89dfd2f514f1208fb74 | c034c2e5b81ad559af3dc23c41e3a04d5ac5a5c6 | refs/heads/master | 2022-11-21T13:07:16.035409 | 2020-07-18T08:19:19 | 2020-07-18T08:19:19 | 266,068,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 739 | java | package com.hk.app;
public class Select4 {
public static void main(String[] args) {
int age = 0; // 나이
char mil = ' '; // 군대 공군 a 해군 m 육군 g
String mi = "";
// 입력
age = 50; //김건우
mil = 'a';
// 나이가 18세 미만 m = ' ' 청소년이고 미필입니다
// 나이가 18세 이상 m = 'a' 또는 'm' 또는 'g' 성인이고 군필입니다
// 나이가 18세 이상 m = ' ' 성인이고 미필입니다
if (age>=18 && mil!=' ') {
System.out.println("성인이고 군필");
}else if(age>=18 && mil==' ') {
System.out.println("성인이고 미필");
} else { System.out.println("청소년이고 미필");
}
}
}
| [
"admin@DESKTOP-K0AIJQF"
] | admin@DESKTOP-K0AIJQF |
a239d8dd5a35639d6b6f95d66403361ca43a0e9a | 8bf192c5be2007239fc1625fcfdbe31abe41f499 | /PE_DepconConverterBatch/src/main/java/it/gov/mef/noipa/postemissione/pe_depconconverterbatch/bean/cu/multilingua/DepconCudMultiLinguaWrapper.java | 5cc1aab2e73725cb35014fbca842b0bc165af597 | [] | no_license | AndreaMassimilianoOrfeo/AMO | bf2ea815cd5083b1b61c3829db552cb85f77522d | b0bf6a493b4a8dc9aaee74a2e4b43806d4c87b6c | refs/heads/master | 2021-05-12T15:37:45.797969 | 2018-02-27T15:43:07 | 2018-02-27T15:43:07 | 116,990,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 894 | java | package it.gov.mef.noipa.postemissione.pe_depconconverterbatch.bean.cu.multilingua;
import java.util.HashMap;
import it.gov.mef.noipa.postemissione.pe_depconconverterbatch.bean.cu.CudFooter;
/**
*
* @author a.orfeo
*
*/
public class DepconCudMultiLinguaWrapper {
public static final String ITALIANO = "i";
public static final String TEDESCO = "t";
/**
* Contiene una mappa di DepconCudMultilingua
* la chiave può assumere i valorei ITALIANO o TEDESCO
*/
private HashMap<String, DepconCudMultilingua> mappaCu ;
private CudFooter cudFooter;
public HashMap<String, DepconCudMultilingua> getMappaCu() {
return mappaCu;
}
public void setMappaCu(HashMap<String, DepconCudMultilingua> mappaCu) {
this.mappaCu = mappaCu;
}
public CudFooter getCudFooter() {
return cudFooter;
}
public void setCudFooter(CudFooter cudFooter) {
this.cudFooter = cudFooter;
}
}
| [
"giovanni.colazzo@dxc.com"
] | giovanni.colazzo@dxc.com |
658e1897f51c76cf68d08f04fa6bc82c78401286 | d2af19d45aceab67a2a27d8db198f13f1215b5ca | /sivajenkin/src/main/java/sivajenkin/sivajenkin/App.java | d06de55f0cbdd83a84667618eca97ecc7e65d267 | [] | no_license | Siva2224/cucumber | cfd0361060ac54b661ae69958bd980c393f8b67a | d1a87bc04f7148a69efe41c345a5547635591bee | refs/heads/master | 2022-12-29T14:20:21.342043 | 2019-07-22T10:13:04 | 2019-07-22T10:13:04 | 198,198,108 | 0 | 0 | null | 2020-10-13T14:46:48 | 2019-07-22T10:09:59 | Java | UTF-8 | Java | false | false | 197 | java | package sivajenkin.sivajenkin;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}
| [
"noreply@github.com"
] | noreply@github.com |
8722dbaccb3e31b940c07532eda2ffb7e6c5f8d4 | af771f62880731d97f5f16ecae7454176d8fade3 | /app代码/MyApplication12/MyApplication12/app/src/main/java/com/example/administrator/hearinghelp/SineWave.java | f809303da62062977e2151b10c40d834914fd522 | [] | no_license | nomattercai/hearing-help | 7518b199708be9bc7a39bf33a333e8030fc643e1 | 71975823637c04373f256e40acc02e9665c007de | refs/heads/master | 2022-12-12T20:25:14.701342 | 2020-08-30T02:52:33 | 2020-08-30T02:52:33 | 291,380,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 824 | java | package com.example.administrator.hearinghelp;
/**
* Created by John.Doe on 2020/3/3.
*/
public class SineWave {
protected static final int SAMPLERATE = 44100;
private final double TWOPI = 3.1416 * 2;
private short HEIGHT = 32767; // 这次采用16bit的数据
protected short[] wave;
protected int wavelen;
protected int length;
protected void setSineWave(int frequency, int decible) {
HEIGHT = (short) Math.pow(10.0, (double) decible / 20.0); // 声音强度范围为0 - 90dB
wavelen = SAMPLERATE / frequency;
length = wavelen * frequency * 2;
wave = new short[length];
for (int i = 0; i < length; i++) {
wave[i] = (short) (HEIGHT * (1 - Math.sin(TWOPI * (double) (i % wavelen) / (double) wavelen)) / 2);
}
}
} | [
"nocountingstar@foxmail.com"
] | nocountingstar@foxmail.com |
d3317f184d3b04a16661751ac8c823acf2582aeb | 4e84882cbfa22bb7149e9f5517d82a23123ce006 | /gulimall-ware/src/main/java/com/atguigu/gulimall/ware/vo/WareSkuLockVo.java | e6b28c55e6a21fec07901533cb1bf867f70593ac | [] | no_license | linfeng1916/mall | e4aa00705a7be75da475a40a2facdc54c5c62f71 | 52e133ccbe4449dafc8c39172f84d3482b25775d | refs/heads/main | 2023-06-06T06:50:26.820384 | 2021-06-28T08:38:53 | 2021-06-28T08:38:53 | 373,815,629 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package com.atguigu.gulimall.ware.vo;
import lombok.Data;
import java.util.List;
@Data
public class WareSkuLockVo {
/**
* 订单号
*/
private String orderSn;
/**
* 需要锁住的所有库存信息
*/
private List<OrderItemVo> locks;
}
| [
"951243590@qq.com"
] | 951243590@qq.com |
d27d0fc081489184a66ec04c13d7836cacc5c43f | dc7c93443c9b118b74a95dbfefd719f3379cd383 | /src/main/java/com/ziggle/authclient/SecurityJwtRedisConnection.java | 239ec7135b53b031671beba6184198878a174ffb | [] | no_license | youngerier/security-jwt-redis | bd400a9e9617f6c2dd0f1353113e57f613a1e19b | 8050dd2a09a5e9e684f5e0c6ae54fac27e1426c6 | refs/heads/master | 2020-07-07T22:30:24.959667 | 2019-08-22T03:21:13 | 2019-08-22T03:21:13 | 203,494,092 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,271 | java | package com.ziggle.authclient;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Strings;
import io.lettuce.core.RedisClient;
import io.lettuce.core.RedisURI;
import io.lettuce.core.api.sync.RedisCommands;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
/**
* @author: wp
* @date: 2019-08-19 13:59
*/
public class SecurityJwtRedisConnection {
private RedisCommands<String, String> cmd;
private ObjectMapper om = new ObjectMapper();
private final Logger log = LoggerFactory.getLogger(SecurityJwtRedisConnection.class);
public SecurityJwtRedisConnection(SecurityJwtProperties properties) {
RedisClient redisClient = RedisClient.create(RedisURI.create(properties.getRedisUrl()));
this.cmd = redisClient.connect().sync();
}
public String getUserInfo(String key) {
String s = cmd.get(key);
try {
if (!Strings.isNullOrEmpty(s)) {
SecurityJwtToken securityJwtToken = om.readValue(s, SecurityJwtToken.class);
return securityJwtToken.getToken();
}
} catch (IOException e) {
// decode error
log.error(e.getMessage(), e);
}
return "";
}
}
| [
"muyue1125@gmail.com"
] | muyue1125@gmail.com |
3a49e85e5e28305498105b31846126b496aed966 | 480fabd0d22d98f2ac31ed50c4bb7328e07c815f | /msi.gama.core/src/msi/gama/common/util/GeometryUtils.java | 47ad48da5103010b6685d2778ed6439aa38fd637 | [] | no_license | jcrinfo/gama | 54d8cbbdf0e114dc0fea996fd2aacb5f68db9402 | 7978a0d10934cb4e3fd1f7c76c12066cfc053c36 | refs/heads/master | 2020-12-24T18:23:24.453585 | 2015-08-05T18:53:30 | 2015-08-05T18:53:30 | 40,296,229 | 1 | 0 | null | 2015-08-06T09:22:15 | 2015-08-06T09:22:15 | null | UTF-8 | Java | false | false | 37,097 | java | /*********************************************************************************************
*
*
* 'GeometryUtils.java', in plugin 'msi.gama.core', is part of the source code of the
* GAMA modeling and simulation platform.
* (c) 2007-2014 UMI 209 UMMISCO IRD/UPMC & Partners
*
* Visit https://code.google.com/p/gama-platform/ for license information and developers contact.
*
*
**********************************************************************************************/
package msi.gama.common.util;
import static msi.gama.metamodel.shape.IShape.Type.LINESTRING;
import static msi.gama.metamodel.shape.IShape.Type.MULTILINESTRING;
import static msi.gama.metamodel.shape.IShape.Type.MULTIPOINT;
import static msi.gama.metamodel.shape.IShape.Type.NULL;
import static msi.gama.metamodel.shape.IShape.Type.POINT;
import static msi.gama.metamodel.shape.IShape.Type.POLYGON;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import msi.gama.database.sql.SqlConnection;
import msi.gama.database.sql.SqlUtils;
import msi.gama.metamodel.shape.Envelope3D;
import msi.gama.metamodel.shape.GamaPoint;
import msi.gama.metamodel.shape.GamaShape;
import msi.gama.metamodel.shape.ILocation;
import msi.gama.metamodel.shape.IShape;
import msi.gama.metamodel.shape.IShape.Type;
import msi.gama.metamodel.topology.projection.IProjection;
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gama.util.GamaListFactory;
import msi.gama.util.IList;
import msi.gama.util.file.IGamaFile;
import msi.gama.util.graph.IGraph;
import msi.gaml.operators.Files;
import msi.gaml.operators.Graphs;
import msi.gaml.operators.Spatial.Operators;
import msi.gaml.operators.Spatial.ThreeD;
import msi.gaml.species.ISpecies;
import msi.gaml.types.GamaGeometryType;
import msi.gaml.types.Types;
import org.geotools.geometry.jts.JTS;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.CoordinateSequence;
import com.vividsolutions.jts.geom.CoordinateSequenceFactory;
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.LinearRing;
import com.vividsolutions.jts.geom.MultiLineString;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.PrecisionModel;
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
import com.vividsolutions.jts.io.WKTWriter;
import com.vividsolutions.jts.precision.GeometryPrecisionReducer;
import com.vividsolutions.jts.simplify.DouglasPeuckerSimplifier;
import com.vividsolutions.jts.triangulate.ConformingDelaunayTriangulationBuilder;
import com.vividsolutions.jts.triangulate.ConstraintEnforcementException;
import com.vividsolutions.jts.triangulate.DelaunayTriangulationBuilder;
import com.vividsolutions.jts.triangulate.VoronoiDiagramBuilder;
import com.vividsolutions.jts.triangulate.quadedge.LocateFailureException;
/**
* The class GamaGeometryUtils.
*
* @author drogoul
* @since 14 d�c. 2011
*
*/
public class GeometryUtils {
public static class GamaCoordinateSequenceFactory implements CoordinateSequenceFactory {
/**
* Method create()
* @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(com.vividsolutions.jts.geom.Coordinate[])
*/
@Override
public GamaCoordinateSequence create(final Coordinate[] coordinates) {
return new GamaCoordinateSequence(coordinates);
}
/**
* Method create()
* @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(com.vividsolutions.jts.geom.CoordinateSequence)
*/
@Override
public GamaCoordinateSequence create(final CoordinateSequence coordSeq) {
return new GamaCoordinateSequence(coordSeq);
}
/**
* Method create()
* @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(int, int)
*/
@Override
public GamaCoordinateSequence create(final int size, final int dimension) {
return new GamaCoordinateSequence(size);
}
}
public static class GamaCoordinateSequence implements CoordinateSequence {
GamaPoint[] points;
/**
* @param points2
*/
public GamaCoordinateSequence(final Coordinate[] points2) {
if ( points2 == null ) {
points = new GamaPoint[0];
} else {
points = new GamaPoint[points2.length];
for ( int i = 0; i < points2.length; i++ ) {
points[i] = new GamaPoint(points2[i]);
}
}
}
/**
* @param size
*/
public GamaCoordinateSequence(final int size) {
points = new GamaPoint[size];
for ( int i = 0; i < size; i++ ) {
points[i] = new GamaPoint(0d, 0d, 0d);
}
}
/**
* @param coordSeq
*/
public GamaCoordinateSequence(final CoordinateSequence coordSeq) {
this(coordSeq.toCoordinateArray());
}
/**
* Method getDimension()
* @see com.vividsolutions.jts.geom.CoordinateSequence#getDimension()
*/
@Override
public int getDimension() {
return 3;
}
@Override
public GamaCoordinateSequence clone() {
return new GamaCoordinateSequence(points);
}
/**
* Method getCoordinate()
* @see com.vividsolutions.jts.geom.CoordinateSequence#getCoordinate(int)
*/
@Override
public Coordinate getCoordinate(final int i) {
return points[i];
}
/**
* Method getCoordinateCopy()
* @see com.vividsolutions.jts.geom.CoordinateSequence#getCoordinateCopy(int)
*/
@Override
public Coordinate getCoordinateCopy(final int i) {
return new GamaPoint((Coordinate) points[i]);
}
/**
* Method getCoordinate()
* @see com.vividsolutions.jts.geom.CoordinateSequence#getCoordinate(int, com.vividsolutions.jts.geom.Coordinate)
*/
@Override
public void getCoordinate(final int index, final Coordinate coord) {
coord.setCoordinate(points[index]);
}
/**
* Method getX()
* @see com.vividsolutions.jts.geom.CoordinateSequence#getX(int)
*/
@Override
public double getX(final int index) {
return points[index].x;
}
/**
* Method getY()
* @see com.vividsolutions.jts.geom.CoordinateSequence#getY(int)
*/
@Override
public double getY(final int index) {
return points[index].y;
}
/**
* Method getOrdinate()
* @see com.vividsolutions.jts.geom.CoordinateSequence#getOrdinate(int, int)
*/
@Override
public double getOrdinate(final int index, final int ordinateIndex) {
return points[index].getOrdinate(ordinateIndex);
}
/**
* Method size()
* @see com.vividsolutions.jts.geom.CoordinateSequence#size()
*/
@Override
public int size() {
return points.length;
}
/**
* Method setOrdinate()
* @see com.vividsolutions.jts.geom.CoordinateSequence#setOrdinate(int, int, double)
*/
@Override
public void setOrdinate(final int index, final int ordinateIndex, final double value) {
points[index].setOrdinate(ordinateIndex, value);
}
/**
* Method toCoordinateArray()
* @see com.vividsolutions.jts.geom.CoordinateSequence#toCoordinateArray()
*/
@Override
public Coordinate[] toCoordinateArray() {
return points;
}
/**
* Method expandEnvelope()
* @see com.vividsolutions.jts.geom.CoordinateSequence#expandEnvelope(com.vividsolutions.jts.geom.Envelope)
*/
@Override
public Envelope expandEnvelope(final Envelope env) {
// TODO Create an Envelope3D ??
for ( GamaPoint p : points ) {
env.expandToInclude(p);
}
return env;
}
}
public static GeometryFactory FACTORY = new GeometryFactory(new GamaCoordinateSequenceFactory());
public static PreparedGeometryFactory pgfactory = new PreparedGeometryFactory();
public static CoordinateSequenceFactory coordFactory = FACTORY.getCoordinateSequenceFactory();
public static GamaPoint pointInGeom(final Geometry geom, final RandomUtils rand) {
// WARNING Only in 2D !
if ( geom instanceof Point ) { return new GamaPoint(geom.getCoordinate()); }
if ( geom instanceof LineString ) {
final int i = rand.between(0, geom.getCoordinates().length - 2);
final Coordinate source = geom.getCoordinates()[i];
final Coordinate target = geom.getCoordinates()[i + 1];
if ( source.x != target.x ) {
final double a = (source.y - target.y) / (source.x - target.x);
final double b = source.y - a * source.x;
final double x = rand.between(source.x, target.x);
final double y = a * x + b;
return new GamaPoint(x, y, 0);
}
final double x = source.x;
final double y = rand.between(source.y, target.y);
return new GamaPoint(x, y, 0);
}
if ( geom instanceof Polygon ) {
final Envelope env = geom.getEnvelopeInternal();
final double xMin = env.getMinX();
final double xMax = env.getMaxX();
final double yMin = env.getMinY();
final double yMax = env.getMaxY();
final double x = rand.between(xMin, xMax);
final Coordinate coord1 = new Coordinate(x, yMin);
final Coordinate coord2 = new Coordinate(x, yMax);
final Coordinate[] coords = { coord1, coord2 };
Geometry line = FACTORY.createLineString(coords);
try {
line = line.intersection(geom);
} catch (final Exception e) {
final PrecisionModel pm = new PrecisionModel(PrecisionModel.FLOATING_SINGLE);
line =
GeometryPrecisionReducer.reducePointwise(line, pm).intersection(
GeometryPrecisionReducer.reducePointwise(geom, pm));
}
return pointInGeom(line, rand);
}
if ( geom instanceof GeometryCollection ) { return pointInGeom(
geom.getGeometryN(rand.between(0, geom.getNumGeometries() - 1)), rand); }
return null;
}
private static Coordinate[] minimiseLength(final Coordinate[] coords) {
final double dist1 = FACTORY.createLineString(coords).getLength();
final Coordinate[] coordstest1 = new Coordinate[3];
coordstest1[0] = coords[0];
coordstest1[1] = coords[2];
coordstest1[2] = coords[1];
final double dist2 = FACTORY.createLineString(coordstest1).getLength();
final Coordinate[] coordstest2 = new Coordinate[3];
coordstest2[0] = coords[1];
coordstest2[1] = coords[0];
coordstest2[2] = coords[2];
final double dist3 = FACTORY.createLineString(coordstest2).getLength();
if ( dist1 <= dist2 && dist1 <= dist3 ) { return coords; }
if ( dist2 <= dist1 && dist2 <= dist3 ) { return coordstest1; }
if ( dist3 <= dist1 && dist3 <= dist2 ) { return coordstest2; }
return coords;
}
public static int nbCommonPoints (final Geometry p1, final Geometry p2) {
Set<Coordinate> cp = new HashSet<Coordinate>() ;
List<Coordinate> coords = Arrays.asList(p1.getCoordinates());
for (Coordinate pt : p2.getCoordinates()) {
if (coords.contains(pt)) {
cp.add(pt);
}
}
return cp.size();
}
public static Coordinate[] extractPoints(final IShape triangle, final Set<IShape> connectedNodes) {
final Coordinate[] coords = triangle.getInnerGeometry().getCoordinates();
int degree = connectedNodes.size();
final Coordinate[] c1 = { coords[0], coords[1] };
final Coordinate[] c2 = { coords[1], coords[2] };
final Coordinate[] c3 = { coords[2], coords[3] };
final LineString l1 = FACTORY.createLineString(c1);
final LineString l2 = FACTORY.createLineString(c2);
final LineString l3 = FACTORY.createLineString(c3);
final Coordinate[] pts = new Coordinate[degree];
if ( degree == 3 ) {
pts[0] = l1.getCentroid().getCoordinate();
pts[1] = l2.getCentroid().getCoordinate();
pts[2] = l3.getCentroid().getCoordinate();
return minimiseLength(pts);
} else if ( degree == 2 ) {
int cpt = 0;
for (IShape n : connectedNodes) {
if (nbCommonPoints(l1,n.getInnerGeometry()) == 2) {
pts[cpt] = l1.getCentroid().getCoordinate();
cpt++;
} else if (nbCommonPoints(l2,n.getInnerGeometry()) == 2) {
pts[cpt] = l2.getCentroid().getCoordinate();
cpt++;
} else if (nbCommonPoints(l3,n.getInnerGeometry()) == 2) {
pts[cpt] = l3.getCentroid().getCoordinate();
cpt++;
}
}
} else {
return null;
}
return pts;
}
public static IList<IShape> hexagonalGridFromGeom(final IShape geom, final int nbRows, final int nbColumns) {
final double widthEnv = geom.getEnvelope().getWidth();
final double heightEnv = geom.getEnvelope().getHeight();
double xmin = geom.getEnvelope().getMinX();
double ymin = geom.getEnvelope().getMinY();
final double widthHex = widthEnv / (nbColumns * 0.75 + 0.25);
final double heightHex = heightEnv / nbRows;
final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
xmin += widthHex / 2.0;
ymin += heightHex / 2.0;
for ( int l = 0; l < nbRows; l++ ) {
for ( int c = 0; c < nbColumns; c = c + 2 ) {
final GamaShape poly =
(GamaShape) GamaGeometryType.buildHexagon(widthHex, heightHex, new GamaPoint(xmin + c * widthHex *
0.75, ymin + l * heightHex, 0));
// GamaShape poly = (GamaShape) GamaGeometryType.buildHexagon(size, xmin + (c * 1.5)
// * size, ymin + 2* size*val * l);
if ( geom.covers(poly) ) {
geoms.add(poly);
}
}
}
for ( int l = 0; l < nbRows; l++ ) {
for ( int c = 1; c < nbColumns; c = c + 2 ) {
final GamaShape poly =
(GamaShape) GamaGeometryType.buildHexagon(widthHex, heightHex, new GamaPoint(xmin + c * widthHex *
0.75, ymin + (l + 0.5) * heightHex, 0));
// GamaShape poly = (GamaShape) GamaGeometryType.buildHexagon(size, xmin + (c * 1.5)
// * size, ymin + 2* size*val * l);
if ( geom.covers(poly) ) {
geoms.add(poly);
}
}
}
/*
* for(int l=0;l<nbColumns;l++){
* for(int c=0;c<nbRows;c = c+2){
* GamaShape poly = (GamaShape) GamaGeometryType.buildHexagon(size, xmin + ((c +1) * 1.5) *
* size, ymin + 2* size*val * (l+0.5));
* if (geom.covers(poly))
* geoms.add(poly);
* }
* }
*/
return geoms;
}
public static IList<IShape> discretisation(final Geometry geom, int nb_squares,final boolean overlaps, double coeff_precision) {
double size = Math.sqrt(geom.getArea() /nb_squares);
List<IShape> rectToRemove = new ArrayList<IShape>();
IList<IShape> squares = discretisation(geom, size, size, overlaps,rectToRemove);
if (squares.size() < nb_squares) {
while (squares.size() < nb_squares) {
size *= coeff_precision;
rectToRemove = new ArrayList<IShape>();
squares = discretisation(geom, size, size, overlaps,rectToRemove);
}
} else if (squares.size() > nb_squares) {
while (squares.size() > nb_squares) {
size /= coeff_precision;
List<IShape> rectToRemove2 = new ArrayList<IShape>();
IList<IShape> squares2 = discretisation(geom, size, size, overlaps,rectToRemove2);
if (squares2.size() < nb_squares) {
break;
}
squares = squares2;
rectToRemove = rectToRemove2;
}
}
int nb = squares.size();
if(nb > nb_squares) {
if (nb- nb_squares > rectToRemove.size()) {
squares.removeAll(rectToRemove);
} else {
for (int i = 0; i < (nb - nb_squares); i++) {
squares.remove(rectToRemove.get(i));
}
}
}
return squares;
}
public static IList<IShape> discretisation(final Geometry geom, final double size_x, final double size_y,
final boolean overlaps ) {
return discretisation(geom, size_x, size_y,overlaps, null );
}
public static IList<IShape> discretisation(final Geometry geom, final double size_x, final double size_y,
final boolean overlaps, List<IShape> borders ) {
final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
if ( geom instanceof GeometryCollection ) {
final GeometryCollection gc = (GeometryCollection) geom;
for ( int i = 0; i < gc.getNumGeometries(); i++ ) {
geoms.addAll(discretisation(gc.getGeometryN(i), size_x, size_y, overlaps, borders));
}
} else {
final Envelope env = geom.getEnvelopeInternal();
final double xMax = env.getMaxX();
final double yMax = env.getMaxY();
double x = env.getMinX();
double y = env.getMinY();
boolean firstX = true;
while (x < xMax) {
y = env.getMinY();
firstX = true;
while (y < yMax) {
final Coordinate c1 = new Coordinate(x, y);
final Coordinate c2 = new Coordinate(x + size_x, y);
final Coordinate c3 = new Coordinate(x + size_x, y + size_y);
final Coordinate c4 = new Coordinate(x, y + size_y);
final Coordinate[] cc = { c1, c2, c3, c4, c1 };
final Geometry square = FACTORY.createPolygon(FACTORY.createLinearRing(cc), null);
y += size_y;
if ( !overlaps ) {
if ( square.coveredBy(geom) ) {
IShape sq = new GamaShape(square);
geoms.add(sq);
if (firstX && borders != null) borders.add(sq);
firstX = false;
}
} else {
if ( square.intersects(geom) ) {
IShape sq = new GamaShape(square);
geoms.add(sq);
if (firstX && borders != null) borders.add(sq);
firstX = false;
}
}
}
x += size_x;
}
}
return geoms;
}
public static IList<IShape> geometryDecomposition(final IShape geom, final double x_size, final double y_size) {
final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
double zVal = geom.getLocation().getZ();
IList<IShape> rects = discretisation(geom.getInnerGeometry(), x_size, y_size, true);
for ( IShape shape : rects ) {
IShape gg = Operators.inter(null, shape, geom);
if ( gg != null && !gg.getInnerGeometry().isEmpty() ) {
GamaShape sp = new GamaShape(gg);
IList<ILocation> pts = (IList<ILocation>) sp.getPoints();
for ( int i = 0; i < pts.size(); i++ ) {
ILocation gp = pts.get(i);
if ( zVal != gp.getZ() ) {
ThreeD.set_z(null, sp, i, zVal);
}
}
geoms.add(sp);
}
}
return geoms;
}
public static IList<IShape> geometryDecomposition(final IShape geom, final int nbCols, final int nbRows) {
double x_size = geom.getEnvelope().getWidth() / nbCols;
double y_size = geom.getEnvelope().getHeight() / nbRows;
return geometryDecomposition(geom, x_size, y_size);
}
public static IList<IShape> triangulation(final IScope scope, final IList<IShape> lines) {
final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
final ConformingDelaunayTriangulationBuilder dtb = new ConformingDelaunayTriangulationBuilder();
final Geometry points = GamaGeometryType.geometriesToGeometry(scope, lines).getInnerGeometry();
final double sizeTol = Math.sqrt(points.getEnvelope().getArea()) / 100.0;
dtb.setSites(points);
dtb.setConstraints(points);
dtb.setTolerance(sizeTol);
final GeometryCollection tri = (GeometryCollection) dtb.getTriangles(FACTORY);
final int nb = tri.getNumGeometries();
for ( int i = 0; i < nb; i++ ) {
final Geometry gg = tri.getGeometryN(i);
geoms.add(new GamaShape(gg));
}
return geoms;
}
public static IList<IShape> voronoi(final IScope scope, final IList<GamaPoint> points) {
final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
final VoronoiDiagramBuilder dtb = new VoronoiDiagramBuilder();
dtb.setClipEnvelope(scope.getSimulationScope().getEnvelope());
dtb.setSites(points);
final GeometryCollection g = (GeometryCollection) dtb.getDiagram(FACTORY);
final int nb = g.getNumGeometries();
for ( int i = 0; i < nb; i++ ) {
final Geometry gg = g.getGeometryN(i);
geoms.add(new GamaShape(gg));
}
return geoms;
}
public static IList<IShape> voronoi(final IScope scope, final IList<GamaPoint> points, final IShape clip) {
final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
final VoronoiDiagramBuilder dtb = new VoronoiDiagramBuilder();
dtb.setClipEnvelope(clip.getEnvelope());
dtb.setSites(points);
final GeometryCollection g = (GeometryCollection) dtb.getDiagram(FACTORY);
final int nb = g.getNumGeometries();
for ( int i = 0; i < nb; i++ ) {
final Geometry gg = g.getGeometryN(i);
geoms.add(new GamaShape(gg));
}
return geoms;
}
public static IList<IShape> triangulationSimple(final IScope scope, final Geometry geom) {
final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
if ( geom instanceof GeometryCollection ) {
final GeometryCollection gc = (GeometryCollection) geom;
for ( int i = 0; i < gc.getNumGeometries(); i++ ) {
geoms.addAll(triangulationSimple(scope, gc.getGeometryN(i)));
}
} else if ( geom instanceof Polygon ) {
final Polygon polygon = (Polygon) geom;
final double sizeTol = Math.sqrt(polygon.getArea()) / 100.0;
final DelaunayTriangulationBuilder dtb = new DelaunayTriangulationBuilder();
GeometryCollection tri = null;
try {
dtb.setSites(polygon);
// dtb.setConstraints(polygon);
dtb.setTolerance(sizeTol);
tri = (GeometryCollection) dtb.getTriangles(FACTORY);
} catch (final LocateFailureException e) {
GamaRuntimeException.warning("Impossible to triangulate Geometry: " + new WKTWriter().write(geom),
scope);
return triangulationSimple(scope, DouglasPeuckerSimplifier.simplify(geom, 0.1));
} catch (final ConstraintEnforcementException e) {
/* GAMA.reportError(scope, */GamaRuntimeException.warning("Impossible to triangulate Geometry: " +
new WKTWriter().write(geom), scope)/* , false) */;
return triangulationSimple(scope, DouglasPeuckerSimplifier.simplify(geom, 0.1));
}
final PreparedGeometry pg = pgfactory.create(polygon.buffer(sizeTol, 5, 0));
final PreparedGeometry env = pgfactory.create(pg.getGeometry().getEnvelope());
final int nb = tri.getNumGeometries();
for ( int i = 0; i < nb; i++ ) {
final Geometry gg = tri.getGeometryN(i);
if ( env.covers(gg) && pg.covers(gg) ) {
geoms.add(new GamaShape(gg));
}
}
}
return geoms;
}
public static IList<IShape> triangulation(final IScope scope, final Geometry geom) {
final IList<IShape> geoms = GamaListFactory.create(Types.GEOMETRY);
if ( geom instanceof GeometryCollection ) {
final GeometryCollection gc = (GeometryCollection) geom;
for ( int i = 0; i < gc.getNumGeometries(); i++ ) {
geoms.addAll(triangulation(scope, gc.getGeometryN(i)));
}
} else if ( geom instanceof Polygon ) {
final Polygon polygon = (Polygon) geom;
final double sizeTol = Math.sqrt(polygon.getArea()) / 100.0;
final ConformingDelaunayTriangulationBuilder dtb = new ConformingDelaunayTriangulationBuilder();
GeometryCollection tri = null;
try {
dtb.setSites(polygon);
dtb.setConstraints(polygon);
dtb.setTolerance(sizeTol);
tri = (GeometryCollection) dtb.getTriangles(FACTORY);
} catch (final LocateFailureException e) {
GamaRuntimeException.warning("Impossible to triangulate Geometry: " + new WKTWriter().write(geom),
scope);
return triangulation(scope, DouglasPeuckerSimplifier.simplify(geom, 0.1));
} catch (final ConstraintEnforcementException e) {
/* GAMA.reportError(scope, */GamaRuntimeException.warning("Impossible to triangulate Geometry: " +
new WKTWriter().write(geom), scope)/* , false) */;
return triangulation(scope, DouglasPeuckerSimplifier.simplify(geom, 0.1));
}
final PreparedGeometry pg = pgfactory.create(polygon.buffer(sizeTol, 5, 0));
final PreparedGeometry env = pgfactory.create(pg.getGeometry().getEnvelope());
final int nb = tri.getNumGeometries();
for ( int i = 0; i < nb; i++ ) {
final Geometry gg = tri.getGeometryN(i);
if ( env.covers(gg) && pg.covers(gg) ) {
geoms.add(new GamaShape(gg));
}
}
}
return geoms;
}
public static List<LineString> squeletisation(final IScope scope, final Geometry geom) {
final List<LineString> network = new ArrayList<LineString>();
final IList polys = GeometryUtils.triangulation(scope, geom);
final IGraph graph = Graphs.spatialLineIntersection(scope, polys);
final Collection<GamaShape> nodes = graph.vertexSet();
for ( final GamaShape node : nodes ) {
final Coordinate[] coordsArr = GeometryUtils.extractPoints(node,new HashSet(Graphs.neighboursOf(scope, graph, node)));
if ( coordsArr != null ) {
network.add(FACTORY.createLineString(coordsArr));
}
}
return network;
}
public static Geometry buildGeometryJTS(final List<List<List<ILocation>>> listPoints) {
final IShape.Type geometryType = geometryType(listPoints);
switch (geometryType) {
case NULL:
return null;
case POINT:
return buildPoint(listPoints.get(0));
case LINESTRING:
return buildLine(listPoints.get(0));
case POLYGON:
return buildPolygon(listPoints.get(0));
case MULTIPOINT:
final int nb = listPoints.size();
final Point[] geoms = new Point[nb];
for ( int i = 0; i < nb; i++ ) {
geoms[i] = (Point) buildPoint(listPoints.get(i));
}
return FACTORY.createMultiPoint(geoms);
case MULTILINESTRING:
final int n = listPoints.size();
final LineString[] lines = new LineString[n];
for ( int i = 0; i < n; i++ ) {
lines[i] = (LineString) buildLine(listPoints.get(i));
}
return FACTORY.createMultiLineString(lines);
case MULTIPOLYGON:
final int n3 = listPoints.size();
final Polygon[] polys = new Polygon[n3];
for ( int i = 0; i < n3; i++ ) {
polys[i] = (Polygon) buildPolygon(listPoints.get(i));
}
return FACTORY.createMultiPolygon(polys);
default:
return null;
}
}
private static Geometry buildPoint(final List<List<ILocation>> listPoints) {
return FACTORY.createPoint((Coordinate) listPoints.get(0).get(0));
}
public static Geometry buildGeometryCollection(final List<IShape> geoms) {
int nb = geoms.size();
Geometry[] geometries = new Geometry[nb];
for ( int i = 0; i < nb; i++ ) {
geometries[i] = geoms.get(i).getInnerGeometry();
}
Geometry geom = FACTORY.createGeometryCollection(geometries);
return geom;
}
private static Geometry buildLine(final List<List<ILocation>> listPoints) {
final List<ILocation> coords = listPoints.get(0);
final int nb = coords.size();
final Coordinate[] coordinates = new Coordinate[nb];
for ( int i = 0; i < nb; i++ ) {
coordinates[i] = (Coordinate) coords.get(i);
}
return FACTORY.createLineString(coordinates);
}
private static Geometry buildPolygon(final List<List<ILocation>> listPoints) {
final List<ILocation> coords = listPoints.get(0);
final int nb = coords.size();
final Coordinate[] coordinates = new Coordinate[nb];
for ( int i = 0; i < nb; i++ ) {
coordinates[i] = (Coordinate) coords.get(i);
}
final int nbHoles = listPoints.size() - 1;
LinearRing[] holes = null;
if ( nbHoles > 0 ) {
holes = new LinearRing[nbHoles];
for ( int i = 0; i < nbHoles; i++ ) {
final List<ILocation> coordsH = listPoints.get(i + 1);
final int nbp = coordsH.size();
final Coordinate[] coordinatesH = new Coordinate[nbp];
for ( int j = 0; j < nbp; j++ ) {
coordinatesH[j] = (Coordinate) coordsH.get(j);
}
holes[i] = FACTORY.createLinearRing(coordinatesH);
}
}
final Polygon poly = FACTORY.createPolygon(FACTORY.createLinearRing(coordinates), holes);
return poly;
}
private static IShape.Type geometryType(final List<List<List<ILocation>>> listPoints) {
final int size = listPoints.size();
if ( size == 0 ) { return NULL; }
if ( size == 1 ) { return geometryTypeSimp(listPoints.get(0)); }
final IShape.Type type = geometryTypeSimp(listPoints.get(0));
switch (type) {
case POINT:
return MULTIPOINT;
case LINESTRING:
return MULTILINESTRING;
case POLYGON:
return POLYGON;
default:
return NULL;
}
}
private static IShape.Type geometryTypeSimp(final List<List<ILocation>> listPoints) {
if ( listPoints.isEmpty() || listPoints.get(0).isEmpty() ) { return NULL; }
final List<ILocation> list0 = listPoints.get(0);
final int size0 = list0.size();
if ( size0 == 1 || size0 == 2 && list0.get(0).equals(list0.get(listPoints.size() - 1)) ) { return POINT; }
if ( !list0.get(0).equals(list0.get(listPoints.size() - 1)) || size0 < 3 ) { return LINESTRING; }
return POLYGON;
}
public static IList<GamaPoint> locsOnGeometry(final Geometry geom, final Double distance) {
final IList<GamaPoint> locs = GamaListFactory.create(Types.POINT);
if ( geom instanceof Point ) {
locs.add(new GamaPoint(geom.getCoordinate()));
} else if ( geom instanceof LineString ) {
double distCur = 0;
final Coordinate[] coordsSimp = geom.getCoordinates();
if ( coordsSimp.length > 0 ) {
locs.add(new GamaPoint(coordsSimp[0]));
}
final int nbSp = coordsSimp.length;
for ( int i = 0; i < nbSp - 1; i++ ) {
Coordinate s = coordsSimp[i];
final Coordinate t = coordsSimp[i + 1];
while (true) {
final double dist = s.distance(t);
if ( distance - distCur < dist ) {
double distTravel = distance - distCur;
final double ratio = distTravel / dist;
double x_s = s.x + ratio * (t.x - s.x);
double y_s = s.y + ratio * (t.y - s.y);
s = new Coordinate(x_s, y_s);
locs.add(new GamaPoint(s));
distCur = 0;
} else if ( distance - distCur > dist ) {
distCur += dist;
break;
} else {
distCur = 0;
locs.add(new GamaPoint(t));
break;
}
}
}
if ( locs.size() > 1 ) {
if ( locs.get(0).distance(locs.get(locs.size() - 1)) < 0.1 * distance ) {
locs.remove(locs.size() - 1);
}
}
} else if ( geom instanceof Polygon ) {
final Polygon poly = (Polygon) geom;
locs.addAll(locsOnGeometry(poly.getExteriorRing(), distance));
for ( int i = 0; i < poly.getNumInteriorRing(); i++ ) {
locs.addAll(locsOnGeometry(poly.getInteriorRingN(i), distance));
}
}
return locs;
}
// ---------------------------------------------------------------------------------------------
// Thai.truongminh@gmail.com
// Created date:24-Feb-2013: Process for SQL - MAP type
// Modified: 03-Jan-2014
public static Envelope computeEnvelopeFromSQLData(final IScope scope, final Map<String, Object> params) {
final String crs = (String) params.get("crs");
final String srid = (String) params.get("srid");
final Boolean longitudeFirst =
params.containsKey("longitudeFirst") ? (Boolean) params.get("longitudeFirst") : true;
SqlConnection sqlConn;
Envelope env = null;
// create connection
sqlConn = SqlUtils.createConnectionObject(scope, params);
// get data
final IList gamaList = sqlConn.selectDB(scope, (String) params.get("select"));
env = SqlConnection.getBounds(gamaList);
GuiUtils.debug("GeometryUtils.computeEnvelopeFromSQLData.Before Projection:" + env);
IProjection gis;
gis = scope.getSimulationScope().getProjectionFactory().fromParams(params, env);
env = gis.getProjectedEnvelope();
GuiUtils.debug("GeometryUtils.computeEnvelopeFromSQLData.After Projection:" + env);
return env;
// ----------------------------------------------------------------------------------------------------
}
public static Envelope computeEnvelopeFrom(final IScope scope, final Object obj) {
Envelope result = new Envelope3D();
if ( obj instanceof ISpecies ) {
return computeEnvelopeFrom(scope, ((ISpecies) obj).getPopulation(scope));
} else if ( obj instanceof Number ) {
final double size = ((Number) obj).doubleValue();
result = new Envelope3D(0, size, 0, size, 0, size);
} else if ( obj instanceof ILocation ) {
final ILocation size = (ILocation) obj;
result = new Envelope3D(0, size.getX(), 0, size.getY(), 0, size.getZ());
} else if ( obj instanceof IShape ) {
result = ((IShape) obj).getEnvelope();
} else if ( obj instanceof Envelope ) {
result = new Envelope3D((Envelope) obj);
} else if ( obj instanceof String ) {
result = computeEnvelopeFrom(scope, Files.from(scope, (String) obj));
} else if ( obj instanceof Map ) {
result = computeEnvelopeFromSQLData(scope, (Map) obj);
} else if ( obj instanceof IGamaFile ) {
result = ((IGamaFile) obj).computeEnvelope(scope);
} else if ( obj instanceof IList ) {
Envelope boundsEnv = null;
for ( final Object bounds : (IList) obj ) {
final Envelope env = computeEnvelopeFrom(scope, bounds);
if ( boundsEnv == null ) {
boundsEnv = env;
} else {
boundsEnv.expandToInclude(env);
}
}
result = boundsEnv;
}
return result;
}
public static IList<IShape> split_at(final IShape geom, final ILocation pt) {
final IList<IShape> lines = GamaListFactory.create(Types.GEOMETRY);
List<Geometry> geoms = null;
if ( geom.getInnerGeometry() instanceof LineString ) {
final Coordinate[] coords = ((LineString) geom.getInnerGeometry()).getCoordinates();
final Point pt1 = FACTORY.createPoint(new GamaPoint(pt.getLocation()));
final int nb = coords.length;
int indexTarget = -1;
double distanceT = Double.MAX_VALUE;
for ( int i = 0; i < nb - 1; i++ ) {
final Coordinate s = coords[i];
final Coordinate t = coords[i + 1];
final Coordinate[] seg = { s, t };
final Geometry segment = FACTORY.createLineString(seg);
final double distT = segment.distance(pt1);
if ( distT < distanceT ) {
distanceT = distT;
indexTarget = i;
}
}
int nbSp = indexTarget + 2;
final Coordinate[] coords1 = new Coordinate[nbSp];
for ( int i = 0; i <= indexTarget; i++ ) {
coords1[i] = coords[i];
}
coords1[indexTarget + 1] = new GamaPoint(pt.getLocation());
nbSp = coords.length - indexTarget;
final Coordinate[] coords2 = new Coordinate[nbSp];
coords2[0] = new GamaPoint(pt.getLocation());
int k = 1;
for ( int i = indexTarget + 1; i < coords.length; i++ ) {
coords2[k] = coords[i];
k++;
}
final List<Geometry> geoms1 = new ArrayList<Geometry>();
geoms1.add(FACTORY.createLineString(coords1));
geoms1.add(FACTORY.createLineString(coords2));
geoms = geoms1;
} else if ( geom.getInnerGeometry() instanceof MultiLineString ) {
final Point point = FACTORY.createPoint((Coordinate) pt);
Geometry geom2 = null;
double distMin = Double.MAX_VALUE;
final MultiLineString ml = (MultiLineString) geom.getInnerGeometry();
for ( int i = 0; i < ml.getNumGeometries(); i++ ) {
final double dist = ml.getGeometryN(i).distance(point);
if ( dist <= distMin ) {
geom2 = ml.getGeometryN(i);
distMin = dist;
}
}
final Coordinate[] coords = ((LineString) geom2).getCoordinates();
final Point pt1 = FACTORY.createPoint(new GamaPoint(pt.getLocation()));
final int nb = coords.length;
int indexTarget = -1;
double distanceT = Double.MAX_VALUE;
for ( int i = 0; i < nb - 1; i++ ) {
final Coordinate s = coords[i];
final Coordinate t = coords[i + 1];
final Coordinate[] seg = { s, t };
final Geometry segment = FACTORY.createLineString(seg);
final double distT = segment.distance(pt1);
if ( distT < distanceT ) {
distanceT = distT;
indexTarget = i;
}
}
int nbSp = indexTarget + 2;
final Coordinate[] coords1 = new Coordinate[nbSp];
for ( int i = 0; i <= indexTarget; i++ ) {
coords1[i] = coords[i];
}
coords1[indexTarget + 1] = new GamaPoint(pt.getLocation());
nbSp = coords.length - indexTarget;
final Coordinate[] coords2 = new Coordinate[nbSp];
coords2[0] = new GamaPoint(pt.getLocation());
int k = 1;
for ( int i = indexTarget + 1; i < coords.length; i++ ) {
coords2[k] = coords[i];
k++;
}
final List<Geometry> geoms1 = new ArrayList<Geometry>();
geoms1.add(FACTORY.createLineString(coords1));
geoms1.add(FACTORY.createLineString(coords2));
geoms = geoms1;
}
if ( geoms != null ) {
for ( final Geometry g : geoms ) {
lines.add(new GamaShape(g));
}
}
return lines;
}
/**
* @param intersect
* @return
*/
public static Type getTypeOf(final Geometry g) {
if ( g == null ) { return Type.NULL; }
return IShape.JTS_TYPES.get(g.getGeometryType());
}
/**
* @param scope
* @param innerGeometry
* @param param
* @return
*/
public static IShape smooth(final Geometry geom, final double fit) {
return new GamaShape(JTS.smooth(geom, fit, FACTORY));
}
}
| [
"pcaillou@gmail.com"
] | pcaillou@gmail.com |
ddff9214079a14527e43231f3609d99e28dc3c08 | 0d018d044080cb8527866146c668dc966ff41654 | /app/src/main/java/com/wei/news/SplashActivity.java | 93ed155f1a38eaed1f181d2e896d60527d9f95cc | [] | no_license | Sekei/WeMedia-master | 8a749cdf29e297740c786a85707e4a35791e71f6 | 05529d560fdd808459444b7372d55ec285e15dc0 | refs/heads/master | 2020-04-25T09:22:54.204605 | 2019-02-26T10:32:15 | 2019-02-26T10:32:15 | 172,673,918 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,910 | java | package com.wei.news;
import android.Manifest;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.Window;
import com.daimajia.androidanimations.library.Techniques;
import com.viksaa.sssplash.lib.activity.AwesomeSplash;
import com.viksaa.sssplash.lib.cnst.Flags;
import com.viksaa.sssplash.lib.model.ConfigSplash;
import com.wei.news.sdk.permission.KbPermission;
import com.wei.news.sdk.permission.KbPermissionListener;
import com.wei.news.sdk.permission.KbPermissionUtils;
import com.wei.news.utils.Constant;
public class SplashActivity extends AwesomeSplash {
@Override
public void initSplash(final ConfigSplash configSplash) {
/* you don't have to override every property */
KbPermission.with(this)
.requestCode(100)
.permission(Manifest.permission.WRITE_EXTERNAL_STORAGE) //需要申请的权限(支持不定长参数)
.callBack(new KbPermissionListener() {
@Override
public void onPermit(int requestCode, String... permission) { //允许权限的回调
}
@Override
public void onCancel(int requestCode, String... permission) { //拒绝权限的回调
KbPermissionUtils.goSetting(SplashActivity.this); //跳转至当前app的权限设置界面
}
})
.send();
initSplashData(configSplash);
}
private void initSplashData(ConfigSplash configSplash) {
//Customize Circular Reveal
configSplash.setBackgroundColor(R.color.gray_light); //any color you want form colors.xml
configSplash.setAnimCircularRevealDuration(600); //int ms
configSplash.setRevealFlagX(Flags.REVEAL_RIGHT); //or Flags.REVEAL_LEFT
configSplash.setRevealFlagY(Flags.REVEAL_BOTTOM); //or Flags.REVEAL_TOP
//Choose LOGO OR PATH; if you don't provide String value for path it's logo by default
// //Customize Logo
// configSplash.setLogoSplash(R.drawable.ic_launcher); //or any other drawable
// configSplash.setAnimLogoSplashDuration(2000); //int ms
// configSplash.setAnimLogoSplashTechnique(Techniques.Bounce); //choose one form Techniques (ref: https://github.com/daimajia/AndroidViewAnimations)
//Customize Path
configSplash.setPathSplash(Constant.DROID_LOGO); //set path String
configSplash.setOriginalHeight(400); //in relation to your svg (path) resource
configSplash.setOriginalWidth(400); //in relation to your svg (path) resource
configSplash.setAnimPathStrokeDrawingDuration(250);
configSplash.setPathSplashStrokeSize(3); //I advise value be <5
configSplash.setPathSplashStrokeColor(R.color.black_gray); //any color you want form colors.xml
configSplash.setAnimPathFillingDuration(250);
configSplash.setPathSplashFillColor(R.color.black_gray); //path object filling color
//Customize Title
configSplash.setTitleSplash("微娱乐");
configSplash.setTitleTextColor(R.color.colorAccent);
configSplash.setTitleTextSize(35f); //float value
configSplash.setAnimTitleDuration(2000);
configSplash.setAnimTitleTechnique(Techniques.FlipInX);
}
@Override
public void animationsFinished() {
startActivity(new Intent(this, MainActivity.class));
finish();
}
//必须添加,否则第一次请求成功权限不会走回调
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
KbPermission.onRequestPermissionResult(requestCode, permissions, grantResults);
}
} | [
"juanjuan19941019"
] | juanjuan19941019 |
fb3367cdb021d3e20f51f023a604154e46a45607 | 5a76a6a938784ba69ca29f2273f229ae96071064 | /PAFProject/src/com/Review.java | 610d993fa1d93f16d754612a26207a0c56255692 | [] | no_license | adeeshaMendis/PAF-IT18219630 | 8702684ce9c24582a84fab203630dbbbd2cef3a5 | 562dff2ee595af1c957bdffeb882d62e591fcb48 | refs/heads/master | 2023-04-30T06:44:27.998761 | 2021-05-14T18:16:57 | 2021-05-14T18:16:57 | 367,048,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,377 | java | package com;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
public class Review {
private Connection connect()
{
Connection con = null;
try
{
Class.forName("com.mysql.cj.jdbc.Driver");
//Provide the correct details: DBServer/DBName, username, password
con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/review", "root", "");
}
catch (Exception e)
{e.printStackTrace();}
return con;
}
public String readReviews()
{
String output = "";
try
{
Connection con = connect();
if (con == null)
{
return "Error while connecting to the database for reading.";
}
// Prepare the html table to be displayed
output = "<table border='1'>"
+ "<tr><th>Review ID</th> "
+ "<th>Review Type</th> "
+ "<th>Review Description</th> "
+ "<th>Rating Value</th> "
+ "<th>Update</th>"
+ "<th>Remove</th></tr>";
String query = "select * from reviews";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
// iterate through the rows in the result set
while (rs.next())
{
String reviewID = Integer.toString(rs.getInt("reviewID"));
String reviewType = rs.getString("reviewType");
String reviewDesc = rs.getString("reviewDesc");
String reviewValue = Integer.toString(rs.getInt("reviewValue"));
// Add into the html table
output += "<td>" + reviewID + "</td>";
output += "<td>" + reviewType + "</td>";
output += "<td>" + reviewDesc + "</td>";
output += "<td>" + reviewValue + "</td>";
// buttons
output += "<td><input name='btnUpdate' type='button' value='Update' class='btnUpdate btn btn-outline-warning'></td>"
+ "<td><input name='btnRemove' type='button' value='Remove' class='btnRemove btn btn-outline-danger' data-itemid='" + reviewID + "'></td></tr>";
}
con.close();
// Complete the html table
output += "</table>";
}
catch (Exception e)
{
output = "Error while reading the items.";
System.err.println(e.getMessage());
}
return output;
}
public String insertReview(String reviewType,String reviewDesc, String reviewValue) {
{
String output = "";
try
{
Connection con = connect();
if (con == null)
{
return "Error while connecting to the database for inserting.";
}
// create a prepared statement
String query = " insert into reviews(reviewID,reviewType,reviewDesc,reviewValue) values (?, ?, ?, ?)";
PreparedStatement preparedStmt = con.prepareStatement(query);
// binding values
preparedStmt.setInt(1, 0);
preparedStmt.setString(2, reviewType);
preparedStmt.setString(3, reviewDesc);
preparedStmt.setInt(4, Integer.parseInt(reviewValue));
// execute the statement
preparedStmt.execute();
con.close();
String newItems = readReviews();
output = "{\"status\":\"success\", \"data\": \"" + newItems + "\"}";
}
catch (Exception e)
{
output = "{\"status\":\"error\", \"data\":\"Error while inserting the item.\"}";
System.err.println(e.getMessage());
}
return output;
}
}
public String updateReview(String reviewID, String reviewType,String reviewDesc, String reviewValue)
{
String output = "";
try
{
Connection con = connect();
if (con == null)
{return "Error while connecting to the database for updating."; }
// create a prepared statement
String query = "UPDATE reviews SET reviewType=?,reviewDesc=?,reviewValue=? WHERE reviewID=?";
PreparedStatement preparedStmt = con.prepareStatement(query);
// binding values
preparedStmt.setString(1, reviewType);
preparedStmt.setString(2, reviewDesc);
preparedStmt.setInt(3, Integer.parseInt(reviewValue));
preparedStmt.setInt(4, Integer.parseInt(reviewID));
// execute the statement
preparedStmt.execute();
con.close();
String newItems = readReviews();
output = "{\"status\":\"success\", \"data\": \"" + newItems + "\"}";
}
catch (Exception e)
{
output = "{\"status\":\"error\", \"data\":\"Error while updating the item.\"}";
System.err.println(e.getMessage());
}
return output;
}
public String deleteReview(String reviewID)
{
String output = "";
try
{
Connection con = connect();
if (con == null)
{return "Error while connecting to the database for deleting."; }
// create a prepared statement
String query = "delete from reviews where reviewID=?";
PreparedStatement preparedStmt = con.prepareStatement(query);
// binding values
preparedStmt.setInt(1, Integer.parseInt(reviewID));
// execute the statement
preparedStmt.execute();
con.close();
String newItems = readReviews();
output = "{\"status\":\"success\", \"data\": \"" + newItems + "\"}";
}
catch (Exception e)
{
output = "{\"status\":\"error\", \"data\":\"Error while deleting the item.\"}";
System.err.println(e.getMessage());
}
return output;
}
} | [
"noreply@github.com"
] | noreply@github.com |
2f84095c39625b4a8a7501a10a2241c321c7a70d | ee49c7a6c7b0dc2bd2e19063c036a3d7e420aef9 | /src/main/java/cn/bdqn/entity/Order.java | dc501d8aaf7d5bc934874db32244037b08214013 | [] | no_license | fwhfwh9527/pmlm | 125183fcdd1ef9d64850e698834d738b4fadcd79 | 401ec6b8531872e1a78d7b84de3b827a2a287467 | refs/heads/master | 2020-07-06T01:42:48.932069 | 2019-08-17T07:15:06 | 2019-08-17T07:15:06 | 202,849,598 | 0 | 0 | null | 2019-08-17T07:23:20 | 2019-08-17T07:23:20 | null | UTF-8 | Java | false | false | 791 | java | package cn.bdqn.entity;
public class Order {
private long oId; //主键
private String oBh; //订单编号
private long uId; //用户id
private long aId; //地址表id
private double oPrice; //总价格
public long getOId() {
return oId;
}
public void setOId(long oId) {
this.oId = oId;
}
public String getOBh() {
return oBh;
}
public void setOBh(String oBh) {
this.oBh = oBh;
}
public long getUId() {
return uId;
}
public void setUId(long uId) {
this.uId = uId;
}
public long getAId() {
return aId;
}
public void setAId(long aId) {
this.aId = aId;
}
public double getOPrice() {
return oPrice;
}
public void setOPrice(double oPrice) {
this.oPrice = oPrice;
}
}
| [
"liukekez@yeah.net"
] | liukekez@yeah.net |
112f6f333c7a706f868f72c120378d86319fff4d | 1566b291cb8f79e6efa115e81684e8c74fd2445f | /src/main/java/me/limeglass/ticker/utils/LangEnumParser.java | b725a21a9ba0203662f31cdc44354a2d5b7d0894 | [
"Apache-2.0"
] | permissive | TheLimeGlass/Ticker | 2d87c67ce4395fc8f62230179e2599f3fe24f38c | 4fb7fe45253a91fd2515716556efa70ff3bed599 | refs/heads/master | 2021-05-13T14:31:26.698558 | 2018-01-10T05:43:54 | 2018-01-10T05:43:54 | 116,742,799 | 0 | 0 | null | 2018-01-09T07:45:32 | 2018-01-09T00:05:06 | Java | UTF-8 | Java | false | false | 2,220 | java | package me.limeglass.ticker.utils;
import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.jdt.annotation.Nullable;
import ch.njol.skript.lang.ParseContext;
import ch.njol.skript.localization.Language;
import ch.njol.skript.util.EnumUtils;
import me.limeglass.ticker.Ticker;
import me.limeglass.ticker.Syntax;
import me.limeglass.ticker.lang.TickerParser;
public class LangEnumParser<T extends Enum<T>> extends TickerParser<T> {
private EnumUtils<T> enumUtil;
private final Class<T> clazz;
private final String codeName;
public LangEnumParser(String variableNamePattern, Class<T> clazz) {
super(variableNamePattern);
this.clazz = clazz;
this.codeName = variableNamePattern;
try {
this.enumUtil = new EnumUtils<T>(clazz, variableNamePattern + "s");
ArrayList<String> enumNames = new ArrayList<String>();
for (final T e : clazz.getEnumConstants()) {
enumNames.addAll(Arrays.asList(Language.get_(variableNamePattern + "s" + "." + e.name())));
}
Ticker.getSyntaxData().set("Syntax.Enums." + clazz.getSimpleName() + ".names", enumNames);
} catch (NullPointerException error) {
Ticker.consoleMessage("&cThe class: " + clazz.getName() + " for classinfo name: " + variableNamePattern + " isn't an Enum!");
}
Syntax.save();
}
@Nullable
public T parse(String string, ParseContext parseContent) {
if (string.startsWith(codeName + ":")) {
string = string.substring(codeName.length() + 1, string.length());
}
string = string.replaceAll("_", " ");
T result = enumUtil != null ? enumUtil.parse(string) : null; //Checks if the english.lang file contains the enum
if (result != null) return result;
string = string.replaceAll(" ", "_");
try {
return Enum.valueOf(clazz, string.toUpperCase()); //If it failed finding that enum in the english.lang or there wasn't one setup, do this fallback.
} catch (IllegalArgumentException error) {
return null;
}
}
@Override
public String toString(T t, int i) {
return t.name().toLowerCase().replaceAll("_", " ");
}
@Override
public String toVariableNameString(T t) {
return codeName + ':' + t.toString();
}
@Override
public String getVariableNamePattern() {
return codeName + ":.+";
}
} | [
"seantgrover@gmail.com"
] | seantgrover@gmail.com |
94ab615dc092b1a5e23e4f5cfc81d189f78de16e | 6f5c694a876c3728c809d7c47baf53cc58c2d75b | /app/src/main/java/com/cse110team24/walkwalkrevolution/firebase/firestore/adapters/FirebaseFirestoreAdapterUsers.java | 4032cd8b30346fd3603bb250e16b28d2c54a4dc1 | [] | no_license | CheeryW/team-project-team24 | 05cc2323c61093cb5a551392e0f8252ed470247b | eb6ed30c13c145c7c571aacaeea2978aadb19db5 | refs/heads/master | 2021-05-20T17:03:20.751677 | 2020-03-12T08:49:26 | 2020-03-12T08:49:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,383 | java | package com.cse110team24.walkwalkrevolution.firebase.firestore.adapters;
import android.util.Log;
import com.cse110team24.walkwalkrevolution.firebase.firestore.observers.users.UsersDatabaseServiceObserver;
import com.cse110team24.walkwalkrevolution.firebase.firestore.observers.users.UsersUserDataObserver;
import com.cse110team24.walkwalkrevolution.firebase.firestore.observers.users.UsersUserExistsObserver;
import com.cse110team24.walkwalkrevolution.firebase.firestore.services.UsersDatabaseService;
import com.cse110team24.walkwalkrevolution.models.user.FirebaseUserAdapter;
import com.cse110team24.walkwalkrevolution.models.user.IUser;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.cse110team24.walkwalkrevolution.models.user.FirebaseUserAdapter.TEAM_UID_KEY;
/**
* {@inheritDoc}
* This type's database provider is Cloud Firestore. The document path for a user is
* users/\{user\}.
*/
public class FirebaseFirestoreAdapterUsers implements UsersDatabaseService {
private static final String TAG = "WWR_FirebaseFirestoreAdapterUsers";
public static final String USERS_COLLECTION_KEY = "users";
public static final String USER_REGISTRATION_TOKENS_COLLECTION_KEY = "tokens";
public static final String TOKEN_SET_KEY = "token";
private CollectionReference usersCollection;
private FirebaseFirestore firebaseFirestore;
List<UsersDatabaseServiceObserver> observers = new ArrayList<>();
public FirebaseFirestoreAdapterUsers() {
firebaseFirestore = FirebaseFirestore.getInstance();
usersCollection = firebaseFirestore.collection(USERS_COLLECTION_KEY);
}
@Override
public void createUserInDatabase(IUser user) {
Map<String, Object> userData = user.userData();
DocumentReference userDocument= usersCollection.document(user.documentKey());
userDocument.set(userData).addOnCompleteListener(task -> {
if (task.isSuccessful()) {
Log.i(TAG, "createUserInDatabase: successfully created document in \"users\" collection for user " + user.getDisplayName());
} else {
Log.e(TAG, "createUserInDatabase: failed to create document", task.getException());
}
});
}
@Override
public void updateUserTeamUidInDatabase(IUser user, String teamUid) {
DocumentReference documentReference = usersCollection.document(user.documentKey());
documentReference.update(TEAM_UID_KEY, teamUid).addOnCompleteListener(task -> {
if (task.isSuccessful()) {
Log.i(TAG, "updateUserTeam: successfully updated user's team uid");
} else {
Log.e(TAG, "updateUserTeam: error updating team uid", task.getException());
}
});
}
@Override
public void getUserData(IUser user) {
DocumentReference documentReference = usersCollection.document(user.documentKey());
documentReference.get().addOnCompleteListener(task -> {
if (task.isSuccessful() && task.getResult() != null) {
notifyObserversUserData(task.getResult().getData());
}
});
}
@Override
public void notifyObserversUserData(Map<String, Object> userDataMap) {
observers.forEach(observer -> {
if(observer instanceof UsersUserDataObserver) {
((UsersUserDataObserver) observer).onUserData(userDataMap);
}
});
}
@Override
public void checkIfOtherUserExists(String userDocumentKey) {
DocumentReference otherUserDoc = usersCollection.document(userDocumentKey);
otherUserDoc.get().addOnCompleteListener(task -> {
if (task.isSuccessful() && task.getResult() != null) {
notifyObserversIfUserExists(task.getResult().exists(), buildUser(task.getResult()));
}
});
}
// build user, only gives display name and teamUid
private IUser buildUser(DocumentSnapshot data) {
if (data.exists()) {
return FirebaseUserAdapter.builder()
.addDisplayName(data.getString("displayName"))
.addTeamUid(data.getString("teamUid"))
.build();
} else {
return null;
}
}
@Override
public void notifyObserversIfUserExists(boolean exists, IUser otherUser) {
observers.forEach(observer -> {
if (observer instanceof UsersUserExistsObserver) {
UsersUserExistsObserver userExistsObserver = (UsersUserExistsObserver) observer;
if (exists) {
userExistsObserver.onUserExists(otherUser);
} else {
userExistsObserver.onUserDoesNotExist();
}
}
});
}
@Override
public void register(UsersDatabaseServiceObserver usersDatabaseServiceObserver) {
observers.add(usersDatabaseServiceObserver);
}
@Override
public void deregister(UsersDatabaseServiceObserver usersDatabaseServiceObserver) {
observers.remove(usersDatabaseServiceObserver);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
c2e6103ec70d9f811c109013f468674a25bef915 | a4c148dba043ec22c60f8895cd5ac920807a18aa | /Mid Exam Grads - Siri Chandana Komatireddy/question3/CinnamanRoll.java | d6dd63bf23894192375d63afd4b7bf275c61f5c4 | [] | no_license | SiriSk1197/COMP-830 | bd4c09fbd84722ce5b7834d13ad2e5aad07e915f | 811fa7b5ccc94599e3396bba5543534de11150de | refs/heads/master | 2022-12-24T01:27:01.117277 | 2020-02-29T22:55:59 | 2020-02-29T22:55:59 | 162,473,204 | 0 | 0 | null | 2022-12-10T01:31:57 | 2018-12-19T18:03:39 | Java | UTF-8 | Java | false | false | 555 | java | package question3;
public class CinnamanRoll implements BakedGoods {
private int price = 5;
private String description = "CinnamanRoll";
private String sellByDate = "04/19/2019";
public CinnamanRoll(int price, String Description, String SellByDate) {
this.price = price;
this.description = description;
this.sellByDate = sellByDate;
}
public CinnamanRoll() {
}
public int getPrice() {
return price;
}
public String getDescription() {
return description;
}
public String getSellByDate() {
return sellByDate;
}
}
| [
"42788713+SiriSk1197@users.noreply.github.com"
] | 42788713+SiriSk1197@users.noreply.github.com |
38232281090dac86c477e2cf9e75087507e1347a | a3748b3a0cdd2544c728ec769b29ab49cf861bb6 | /src/main/java/ru/impl/TechnologyServiceImpl.java | 8c9e66bb641feb0cdead7617eaf377227677d526 | [] | no_license | gagarin545/arghi | 387aa55fc404af8a64c57fd5fa1c922fa16e97c0 | c96d7b67569c05bb72bc107145a71900c280bcc7 | refs/heads/master | 2022-12-25T00:59:11.340938 | 2020-02-20T14:32:33 | 2020-02-20T14:32:33 | 192,922,493 | 0 | 1 | null | 2022-12-15T23:41:28 | 2019-06-20T13:12:24 | Java | UTF-8 | Java | false | false | 826 | java | package ru.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ru.entity.TechnogyEntity;
import ru.repository.TechnologyEntityRepository;
import java.util.List;
@Service("jpaTechnology")
public class TechnologyServiceImpl implements ru.service.TechnologyService {
@Autowired
private TechnologyEntityRepository technologyEntityRepository;
@Override
public TechnogyEntity addTechnology(TechnogyEntity technogyEntity) { return technologyEntityRepository.saveAndFlush(technogyEntity); }
@Override
public List<TechnogyEntity> getAll() { return technologyEntityRepository.findAll(); }
@Override
public TechnogyEntity getById(String name) { return technologyEntityRepository.getById( name); }
}
| [
"ura545@mail.ru"
] | ura545@mail.ru |
18078ec5f107ea15ef0a73e996511d089384ef5b | bfa31541d1ec674a63ac08bf049a993958430d7b | /Lab8MySQLQueryInsert_603021234-4/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/asynclayoutinflater/R.java | 3ed5b76b9b3e16d3a58af7efb3b492b845250e75 | [] | no_license | Supawitkongkum/LAB8_SEC2_603021234-4 | f392495034202bc75ac423aadc6300ad5f6dbd97 | 293c7d30746a68b40905c6f0411b107585629331 | refs/heads/master | 2020-08-06T08:11:26.108989 | 2019-10-05T15:19:19 | 2019-10-05T15:19:19 | 212,902,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,459 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.asynclayoutinflater;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f020088;
public static final int fontProviderAuthority = 0x7f02008a;
public static final int fontProviderCerts = 0x7f02008b;
public static final int fontProviderFetchStrategy = 0x7f02008c;
public static final int fontProviderFetchTimeout = 0x7f02008d;
public static final int fontProviderPackage = 0x7f02008e;
public static final int fontProviderQuery = 0x7f02008f;
public static final int fontStyle = 0x7f020090;
public static final int fontVariationSettings = 0x7f020091;
public static final int fontWeight = 0x7f020092;
public static final int ttcIndex = 0x7f020154;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04003f;
public static final int notification_icon_bg_color = 0x7f040040;
public static final int ripple_material_light = 0x7f04004a;
public static final int secondary_text_default_material_light = 0x7f04004c;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004e;
public static final int compat_button_inset_vertical_material = 0x7f05004f;
public static final int compat_button_padding_horizontal_material = 0x7f050050;
public static final int compat_button_padding_vertical_material = 0x7f050051;
public static final int compat_control_corner_material = 0x7f050052;
public static final int compat_notification_large_icon_max_height = 0x7f050053;
public static final int compat_notification_large_icon_max_width = 0x7f050054;
public static final int notification_action_icon_size = 0x7f050064;
public static final int notification_action_text_size = 0x7f050065;
public static final int notification_big_circle_margin = 0x7f050066;
public static final int notification_content_margin_start = 0x7f050067;
public static final int notification_large_icon_height = 0x7f050068;
public static final int notification_large_icon_width = 0x7f050069;
public static final int notification_main_column_padding_top = 0x7f05006a;
public static final int notification_media_narrow_margin = 0x7f05006b;
public static final int notification_right_icon_size = 0x7f05006c;
public static final int notification_right_side_padding_top = 0x7f05006d;
public static final int notification_small_icon_background_padding = 0x7f05006e;
public static final int notification_small_icon_size_as_large = 0x7f05006f;
public static final int notification_subtext_size = 0x7f050070;
public static final int notification_top_pad = 0x7f050071;
public static final int notification_top_pad_large_text = 0x7f050072;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060061;
public static final int notification_bg = 0x7f060062;
public static final int notification_bg_low = 0x7f060063;
public static final int notification_bg_low_normal = 0x7f060064;
public static final int notification_bg_low_pressed = 0x7f060065;
public static final int notification_bg_normal = 0x7f060066;
public static final int notification_bg_normal_pressed = 0x7f060067;
public static final int notification_icon_background = 0x7f060068;
public static final int notification_template_icon_bg = 0x7f060069;
public static final int notification_template_icon_low_bg = 0x7f06006a;
public static final int notification_tile_bg = 0x7f06006b;
public static final int notify_panel_notification_icon_bg = 0x7f06006c;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f07002e;
public static final int action_divider = 0x7f070030;
public static final int action_image = 0x7f070031;
public static final int action_text = 0x7f070037;
public static final int actions = 0x7f070038;
public static final int async = 0x7f07003e;
public static final int blocking = 0x7f070041;
public static final int chronometer = 0x7f07004a;
public static final int forever = 0x7f070062;
public static final int icon = 0x7f070068;
public static final int icon_group = 0x7f070069;
public static final int info = 0x7f07006c;
public static final int italic = 0x7f07006e;
public static final int line1 = 0x7f070072;
public static final int line3 = 0x7f070073;
public static final int normal = 0x7f07007b;
public static final int notification_background = 0x7f07007c;
public static final int notification_main_column = 0x7f07007d;
public static final int notification_main_column_container = 0x7f07007e;
public static final int right_icon = 0x7f07008a;
public static final int right_side = 0x7f07008b;
public static final int tag_transition_group = 0x7f0700b0;
public static final int tag_unhandled_key_event_manager = 0x7f0700b1;
public static final int tag_unhandled_key_listeners = 0x7f0700b2;
public static final int text = 0x7f0700b3;
public static final int text2 = 0x7f0700b5;
public static final int time = 0x7f0700b8;
public static final int title = 0x7f0700b9;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0a001f;
public static final int notification_action_tombstone = 0x7f0a0020;
public static final int notification_template_custom_big = 0x7f0a0021;
public static final int notification_template_icon_group = 0x7f0a0022;
public static final int notification_template_part_chronometer = 0x7f0a0023;
public static final int notification_template_part_time = 0x7f0a0024;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0d001d;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0e00ed;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0e00ee;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0e00ef;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0e00f0;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0e00f1;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0e015c;
public static final int Widget_Compat_NotificationActionText = 0x7f0e015d;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f02008a, 0x7f02008b, 0x7f02008c, 0x7f02008d, 0x7f02008e, 0x7f02008f };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020088, 0x7f020090, 0x7f020091, 0x7f020092, 0x7f020154 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"53934250+Supawitkongkum@users.noreply.github.com"
] | 53934250+Supawitkongkum@users.noreply.github.com |
6f597cecee36deac2ae28698a6d5ade6a62f2494 | 71cc2415a3c65b8b24f80eb0bd11e23547792496 | /DTSLDecode/src/hk/polyu/trace/decode/ITraceException.java | fdfdd127aecccb1b23caafc76ab3b4c58f9e900f | [
"Apache-2.0"
] | permissive | apkunpacker/happer | a568fffdf35abfaa5be61ca9952d47cba439c986 | 3b48894e2d91f150f1aee0ce75291b9ca2a29bbe | refs/heads/main | 2023-05-01T03:55:43.221557 | 2021-05-25T15:29:34 | 2021-05-25T15:29:34 | 379,007,139 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 118 | java | package hk.polyu.trace.decode;
public interface ITraceException {
String getTitle();
int getNumber();
}
| [
"cshaoz@comp.polyu.edu.hk"
] | cshaoz@comp.polyu.edu.hk |
5279a5f376350f73957679fa24e4059764bc0eb7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/15/15_dfb96dd3163bf73c9debdf3176dd2e5ec8869135/MeshActor/15_dfb96dd3163bf73c9debdf3176dd2e5ec8869135_MeshActor_s.java | ac64e244876cd6fe3f92386af59deda8e6ff44f4 | [] | 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,320 | java | package com.razh.tiling;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Mesh;
import com.badlogic.gdx.graphics.g3d.materials.Material;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.math.Matrix3;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Touchable;
public class MeshActor extends Actor3D {
private Mesh mMesh;
private Material mMaterial;
private Matrix4 mModelMatrix;
private Matrix3 mNormalMatrix;
private ShaderProgram mShaderProgram;
private Vector3 mRotationAxis;
private float mOrientation;
private Entity mEntity;
public MeshActor() {
super();
mModelMatrix = new Matrix4();
mNormalMatrix = new Matrix3();
setRotationAxis(new Vector3(0.0f, 1.0f, 0.0f));
setOrientation(0.0f);
}
@Override
public void act(float delta) {
super.act(delta);
if (mEntity != null) {
mEntity.act(delta);
}
}
public void draw(ShaderProgram shaderProgram, float parentAlpha) {
setShaderProgram(shaderProgram);
draw(parentAlpha);
}
public void draw(float parentAlpha) {
mModelMatrix.idt()
.translate(getPosition())
.scale(getWidth(), getHeight(), getDepth())
.rotate(getRotationAxis(), getRotation())
.rotate(Vector3.Z, getOrientation());
mShaderProgram.setUniformMatrix("modelMatrix", mModelMatrix);
mNormalMatrix.set(mModelMatrix.cpy().inv()).transpose();
mShaderProgram.setUniformMatrix("normalMatrix", mNormalMatrix);
mShaderProgram.setUniformf("diffuse", getColor().r, getColor().g, getColor().b);
if (hasMaterial()) {
mMaterial.bind(mShaderProgram);
}
if (hasMesh()) {
getMesh().render(mShaderProgram, GL20.GL_TRIANGLES);
}
}
@Override
public Actor hit(float x, float y, boolean touchable) {
if (touchable && getTouchable() != Touchable.enabled) {
return null;
}
if (Math.abs(x - getX()) <= getWidth() && Math.abs(y - getY()) <= getHeight()) {
return this;
}
return null;
}
@Override
public Vector2 parentToLocalCoordinates(Vector2 parentCoords) {
return parentCoords;
}
public Vector3 getRotationAxis() {
return mRotationAxis;
}
public void setRotationAxis(Vector3 rotationAxis) {
mRotationAxis = rotationAxis;
}
public float getOrientation() {
return mOrientation;
}
public void setOrientation(float orientation) {
mOrientation = orientation;
}
public Mesh getMesh() {
return mMesh;
}
public void setMesh(Mesh mesh) {
mMesh = mesh;
}
public boolean hasMesh() {
return getMesh() != null;
}
public Material getMaterial() {
return mMaterial;
}
public void setMaterial(Material material) {
mMaterial = material;
}
public boolean hasMaterial() {
return getMaterial() != null;
}
public Entity getEntity() {
return mEntity;
}
public void setEntity(Entity entity) {
mEntity = entity;
}
public ShaderProgram getShaderProgram() {
return mShaderProgram;
}
public void setShaderProgram(ShaderProgram shaderProgram) {
mShaderProgram = shaderProgram;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
01038226c6212dc9841520331c6199f4d7ef6587 | d7504ce3d1c10bc829687a3573a7d9a70b065618 | /pyg_manage_web/src/main/java/com/pyg/manage/controller/SellerController.java | 952f300adbf77248d64aa8cb61e93def40cb59af | [] | no_license | zoufrank/pyg_parent | 34813d4a9534a26eeb9e20f23a6fe22106a8a7f0 | 6e4f45fe978f73d05af72aa8cd2ff7679c440325 | refs/heads/master | 2020-04-11T21:03:38.960843 | 2018-12-17T08:10:02 | 2018-12-17T08:10:02 | 162,093,366 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,581 | java | package com.pyg.manage.controller;
import com.alibaba.dubbo.config.annotation.Reference;
import com.pyg.pojo.TbSeller;
import com.pyg.sellergoods.service.SellerService;
import entity.PageResult;
import entity.Result;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* controller
* @author Administrator
*
*/
@RestController
@RequestMapping("/seller")
public class SellerController {
@Reference
private SellerService sellerService;
/**
* 返回全部列表
* @return
*/
@RequestMapping("/findAll")
public List<TbSeller> findAll(){
return sellerService.findAll();
}
/**
* 返回全部列表
* @return
*/
@RequestMapping("/findPage")
public PageResult findPage(int page,int rows){
return sellerService.findPage(page, rows);
}
/**
* 增加
* @param seller
* @return
*/
@RequestMapping("/add")
public Result add(@RequestBody TbSeller seller){
try {
sellerService.add(seller);
return new Result(true, "增加成功");
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "增加失败");
}
}
/**
* 修改
* @param seller
* @return
*/
@RequestMapping("/update")
public Result update(@RequestBody TbSeller seller){
try {
sellerService.update(seller);
return new Result(true, "修改成功");
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "修改失败");
}
}
/**
* 获取实体
* @param id
* @return
*/
@RequestMapping("/findOne")
public TbSeller findOne(String id){
return sellerService.findOne(id);
}
/**
* 批量删除
* @param ids
* @return
*/
@RequestMapping("/delete")
public Result delete(Long [] ids){
try {
sellerService.delete(ids);
return new Result(true, "删除成功");
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "删除失败");
}
}
/**
* 查询+分页
* @param seller
* @param page
* @param rows
* @return
*/
@RequestMapping("/search")
public PageResult search(@RequestBody TbSeller seller, int page, int rows ){
return sellerService.findPage(seller, page, rows);
}
@RequestMapping("/updateStatus")
public Result updateStatus(String sellerId, String status){
try {
sellerService.updateStatus(sellerId, status);
return new Result(true, "成功");
} catch (Exception e) {
e.printStackTrace();
return new Result(false, "失败");
}
}
}
| [
"745340171@qq.com"
] | 745340171@qq.com |
f1b5fe584a81de929960d0708b9d646fcf23d264 | 7b088f7504d5f39b2a17026b0e7cc15f8d183b9c | /src/jogoDaVelha/Main.java | c43c52373b41fe6df40a9b801817db90e10cd2eb | [] | no_license | caiquecmls/jogo-da-velha | de8a57508bb93b5b840ba34bf9228c2dd175d096 | fe42f86b18b9064fd497143e4b8a6885f9f4c2e8 | refs/heads/main | 2023-03-12T18:38:15.294600 | 2021-03-05T14:58:16 | 2021-03-05T14:58:16 | 344,815,152 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,774 | 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 jogoDaVelha;
import java.util.Scanner;
/**
*
* @author caiqu
*/
public class Main {
public static void main(String[] args) {
char matriz[][] = new char[3][3];
initialize(matriz);
imprimirMatriz(matriz);
int linha = 0, coluna = 0;
inserirNoTabuleiro(matriz, linha, coluna);
imprimirMatriz(matriz);
}
public static Scanner sc = new Scanner(System.in);
public static char[][] initialize(char matrizA[][]) {
char matriz[][] = new char[3][3];
String auxiliar = " ";
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[0].length; j++) {
matriz[i][j] = auxiliar.charAt(0);
}
}
return matriz;
}
public static void imprimirMatriz(char matriz[][]) {
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[0].length; j++) {
System.out.printf("| %c |", matriz[i][j]);
}
System.out.println("");
}
}
public static void inserirNoTabuleiro(char matriz[][], int linha, int coluna) {;
System.out.println("Digite o Indice da posição que desaja");
linha = sc.nextInt();
coluna = sc.nextInt();
System.out.println("Digite X ou O");
matriz[linha][coluna] = sc.next().charAt(0);
}
public static void verificarPosicaoPreenchida(char matriz[][]) {
for (int i = 0; i < matriz.length; i++) {
for (int j = 0; j < matriz[0].length; j++) {
}
}
}
}
| [
"caique_moreira7@hotmail.com"
] | caique_moreira7@hotmail.com |
b867481e7a279cbf7b53d66db5d4e536782b1ce5 | 99d2f8f1065b013a211639f659c81aa8a3ca6cf4 | /src/main/java/com/example/model/VendorListPK.java | e509da4f18c1f22e3be8dd6127ace7d7bc67bc37 | [] | no_license | vishakhamodasia/US3WithPaginationDemo | 01e05a5f2c8bec6c533afff6960198a6c09b44a2 | 06d610a191ca024f3de21d0a685b18a15721f075 | refs/heads/master | 2022-11-08T05:19:12.481719 | 2020-06-15T06:56:25 | 2020-06-15T06:56:25 | 272,364,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,274 | java | package com.example.model;
import java.io.Serializable;
public class VendorListPK implements Serializable{
private static final long serialVersionUID = -7842144899625014597L;
private long vendorId;
private long batteryId;
public VendorListPK() {
super();
// TODO Auto-generated constructor stub
}
public VendorListPK(Long vendorId, Long batteryId) {
super();
this.vendorId = vendorId;
this.batteryId = batteryId;
}
public Long getVendorId() {
return vendorId;
}
public void setVendorId(Long vendorId) {
this.vendorId = vendorId;
}
public Long getBatteryId() {
return batteryId;
}
public void setBatteryId(Long batteryId) {
this.batteryId = batteryId;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (batteryId ^ (batteryId >>> 32));
result = prime * result + (int) (vendorId ^ (vendorId >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VendorListPK other = (VendorListPK) obj;
if (batteryId != other.batteryId)
return false;
if (vendorId != other.vendorId)
return false;
return true;
}
}
| [
"vmodasia@altimetrik.com"
] | vmodasia@altimetrik.com |
7506bf85351916ac35670a9b39a887fba81dce82 | b206a38b6fb7272ad8c551db2d3ebbd2337f0732 | /jwt-helloworld/src/main/java/com/example/jwthelloworld/controller/HelloWorldController.java | f43ffbc1b05454ea356cfab28815cfceb5cbb0d7 | [] | no_license | zomayn/Spring-Security | 9d8d09c8a4366a9cb6398d7d29555d3cbbe06e38 | 851f87c7831915413a27e8b91766c6001add5dce | refs/heads/master | 2021-01-03T21:12:52.188121 | 2020-02-12T14:25:34 | 2020-02-12T14:25:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package com.example.jwthelloworld.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@GetMapping({ "/hello" })
public String firstPage() {
return "Hello World";
}
}
| [
"34671@ITCINFOTECH.COM"
] | 34671@ITCINFOTECH.COM |
553480d3b3a42ec9846cffe524c505b0612f388b | da6b6f0de0745ea9798401d92947233b3b58172e | /apiautosclasicos/src/edu/cibertec/dao/MySQLMarcaAutoDAO.java | 63cc1324fb0ba9a6f9eb4083125a95d4406eb939 | [] | no_license | Renzott/docker-proyecto-autos | 831f168543d6dce91a342d547b22e38aa531adbb | f15342ab5f6cdc0a07160b18b62ba1ab22a2e597 | refs/heads/main | 2023-01-23T11:41:00.464795 | 2020-12-09T01:31:14 | 2020-12-09T01:31:14 | 318,947,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,183 | java | package edu.cibertec.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import edu.cibertec.beans.MarcaAutoDTO;
import edu.cibertec.interfaces.MarcaAutoDAO;
import edu.cibertec.utils.MySQLConexion;
public class MySQLMarcaAutoDAO implements MarcaAutoDAO {
@Override
public ArrayList<MarcaAutoDTO> ListadoMarcaAuto() {
ArrayList<MarcaAutoDTO> lista = new ArrayList<MarcaAutoDTO>();
ResultSet rs = null;
Connection con = null;
PreparedStatement pst = null;
try{
con = MySQLConexion.getConexion();
String sql= "CALL SPAL_Listar_MarcaAuto";
pst = con.prepareStatement(sql);
rs = pst.executeQuery();
while(rs.next()){
MarcaAutoDTO ma = new MarcaAutoDTO();
ma.setCodigoMarcaAuto(rs.getString(1));
ma.setNombreMarcaAuto(rs.getString(2));
lista.add(ma);
}
}catch(Exception e){
System.out.println("ERROR EN LA SENTENCIA - LISTADO " + e.getMessage());
}finally{
try{
con.close();
pst.close();
}catch(Exception e){
System.out.println("ERROR AL CERRAR - LISTADO");
}
}
return lista;
}
/*----------------------Alvaro------------------------*/
@Override
public MarcaAutoDTO ListadoMarcaAutoxCodigo(String codigo) {
MarcaAutoDTO marcaAuto = null;
ResultSet rs = null;
Connection con = null;
PreparedStatement pst = null;
try{
con = MySQLConexion.getConexion();
String sql= "CALL SPAL_Listar_MarcaAutoxCodigo(?)";
pst = con.prepareStatement(sql);
pst.setString(1, codigo);
rs = pst.executeQuery();
while(rs.next()){
MarcaAutoDTO ma = new MarcaAutoDTO();
ma.setCodigoMarcaAuto(rs.getString(1));
ma.setNombreMarcaAuto(rs.getString(2));
marcaAuto = ma;
}
}catch(Exception e){
System.out.println("ERROR EN LA SENTENCIA - LISTADO " + e.getMessage());
}finally{
try{
con.close();
pst.close();
}catch(Exception e){
System.out.println("ERROR AL CERRAR - LISTADO");
}
}
return marcaAuto;
}
}
| [
"renzottaffairs@gmail.com"
] | renzottaffairs@gmail.com |
d4f85133626842245b1e60f9a50bf3a24f0803b3 | ed93f23e31d2e7d4ca920298ecbcbb27e803543d | /hrvoreski_projekt/hrvoreski_projekt/hrvoreski_aplikacija_3/hrvoreski_aplikacija_3_2/src/java/org/foi/nwtis/hrvoreski/mb/AdreseMessageBean.java | c9f4d2f589f70b9785abe5a958350a9b8e1594c4 | [] | no_license | horeski/Nwtis-projekt | 3b4e5ff315f381028cb462f4a1d7654de49ca7b4 | 7cf2e6cdc7b1828a70ded00bea8daffd263570f6 | refs/heads/master | 2021-01-02T08:39:41.986475 | 2015-09-08T11:31:05 | 2015-09-08T11:31:05 | 42,104,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,117 | 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 org.foi.nwtis.hrvoreski.mb;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.ConnectException;
import java.net.Socket;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Resource;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.EJB;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import org.foi.nwtis.hrvoreski.sb.MessagesStorage;
import org.foi.nwtis.hrvoreski.web.kontrole.JMSAdresaStruktura;
/**
* Message bean koji prima poruke JMS adrese objekta
*
* @author Hrvoje
*/
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "jms/NWTiS_hrvoreski_1")
})
public class AdreseMessageBean implements MessageListener {
@EJB
private MessagesStorage messagesStorage;
@Resource(name = "korisnickoIme")
private String korisnik;
@Resource(name = "lozinka")
private String lozinka;
@Resource(name = "adresaPosluzitelja")
private String adresaPosluzitelja;
@Resource(name = "port")
private Integer port;
/**
* Konstruktor
*/
public AdreseMessageBean() {
}
@Override
public void onMessage(Message message) {
try {
System.out.println("Pristigla nova JMS poruka za adresu !");
ObjectMessage o = (ObjectMessage) message;
JMSAdresaStruktura poruka = (JMSAdresaStruktura) o.getObject();
poruka.setBrisi(messagesStorage.getCounter());
messagesStorage.dodajAdresu(poruka);
String adresa = poruka.getAdresa();
System.out.println("APP 3 - JMS ZA ADRESU " + adresa);
if (adresa != null) {
String zahtjevTest = "USER " + korisnik + "; PASSWD " + lozinka + "; TEST " + adresa + ";";
String odgovor = saljiKomandu(zahtjevTest);
System.out.println("APP 3 - odgovor za TEST : " + odgovor);
if (odgovor.equals("ERR 51")) {
String zahtjevAdd = "USER " + korisnik + "; PASSWD " + lozinka + "; ADD " + adresa + ";";
odgovor = saljiKomandu(zahtjevAdd);
System.out.println("APP 3 - odgovor za ADD : " + odgovor);
}
}
} catch (JMSException ex) {
Logger.getLogger(AdreseMessageBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
private String saljiKomandu(String zahtjev) {
Socket server;
try {
server = new Socket(adresaPosluzitelja, port);
InputStream is = server.getInputStream();
OutputStream os = server.getOutputStream();
InputStreamReader isr = new InputStreamReader(is, "ISO-8859-2");
OutputStreamWriter osw = new OutputStreamWriter(os, "ISO-8859-2");
osw.write(zahtjev);
osw.flush();
server.shutdownOutput();
//dohvati odgovor
StringBuilder odgovor = new StringBuilder();
while (true) {
int znak = isr.read();
if (znak == -1) {
break;
}
odgovor.append((char) znak);
}
isr.close();
osw.close();
is.close();
os.close();
server.close();
return odgovor.toString();
} catch (ConnectException ex) {
return "veza odbijena";
} catch (IOException ex) {
Logger.getLogger(AdreseMessageBean.class.getName()).log(Level.SEVERE, null, ex);
return "";
}
}
}
| [
"oreskihrvoje@gmail.com"
] | oreskihrvoje@gmail.com |
fa22c1fbe65db89834297431ab70b4bae6c3280d | 83fdbaa29995f676d00232adb4fc2d53bc5cbad1 | /app/src/main/java/cn/moon/fulicenter/model/dao/DBManager.java | eef8e578d343bc3747d71b6df9d66b2b035286d7 | [] | no_license | NightMoonCat/fulicenter-201612 | da0b960cca527c159038d5b183aa20eadcb6f7dd | 74dd93d178f282eac069559224b99b1e2c7a1a98 | refs/heads/master | 2021-03-13T04:09:43.119875 | 2017-04-26T13:00:00 | 2017-04-26T13:00:00 | 84,799,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,751 | java | package cn.moon.fulicenter.model.dao;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import cn.moon.fulicenter.model.bean.User;
/**
* Created by Moon on 2017/3/21.
*/
public class DBManager {
private static DBOpenHelper mHelper;
static DBManager dbmgr = new DBManager();
public static DBManager getInstance() {
return dbmgr;
}
public synchronized void initDB(Context context) {
mHelper = DBOpenHelper.getInstance(context);
}
public boolean saveUserInfo(User user) {
SQLiteDatabase database = mHelper.getWritableDatabase();
if (database.isOpen()) {
ContentValues values = new ContentValues();
values.put(UserDao.USER_COLUMN_NAME, user.getMuserName());
values.put(UserDao.USER_COLUMN_NICK, user.getMuserNick());
values.put(UserDao.USER_COLUMN_AVATAR, user.getMavatarId());
values.put(UserDao.USER_COLUMN_AVATAR_PATH, user.getMavatarPath());
values.put(UserDao.USER_COLUMN_AVATAR_TYPE, user.getMavatarType());
values.put(UserDao.USER_COLUMN_AVATAR_SUFFIX, user.getMavatarSuffix());
values.put(UserDao.USER_COLUMN_AVATAR_LASTUPDATE_TIME, user.getMavatarLastUpdateTime());
return database.replace(UserDao.USER_TABLE_NAME, null, values) != -1;
}
return false;
}
public User getUserInfo(String userName) {
SQLiteDatabase database = mHelper.getReadableDatabase();
if (database.isOpen()) {
String sql = "select * from " + UserDao.USER_TABLE_NAME +
" where " + UserDao.USER_COLUMN_NAME + "='" + userName + "'";
Cursor cursor = database.rawQuery(sql, null);
while (cursor.moveToNext()) {
User user = new User();
user.setMuserName(userName);
user.setMuserNick(cursor.getString(cursor.getColumnIndex(UserDao.USER_COLUMN_NICK)));
user.setMavatarId(cursor.getInt(cursor.getColumnIndex(UserDao.USER_COLUMN_AVATAR)));
user.setMavatarPath(cursor.getString(cursor.getColumnIndex(UserDao.USER_COLUMN_AVATAR_PATH)));
user.setMavatarType(cursor.getInt(cursor.getColumnIndex(UserDao.USER_COLUMN_AVATAR_TYPE)));
user.setMavatarSuffix(cursor.getString(cursor.getColumnIndex(UserDao.USER_COLUMN_AVATAR_SUFFIX)));
user.setMavatarLastUpdateTime(cursor.getString(cursor.getColumnIndex(UserDao.USER_COLUMN_AVATAR_LASTUPDATE_TIME)));
return user;
}
}
return null;
}
public void closeDB() {
mHelper.closeDB();
}
}
| [
"495982617@qq.com"
] | 495982617@qq.com |
5f43eecd2ab3ead5ed8167a3b54977803b6e91c9 | f54b3b135da2567e74e94f5cbfb2d1ac016b5907 | /src/testng/remo.java | b0d10fd783f77b00041bb6c7e5cf280729cffd61 | [] | no_license | raji-1234/DemoRepo | 1525011082b21a9d527e7fed2e1ac6cfceefe8ac | 42d87616c888f3697f63d930566deb29bb6fe1d2 | refs/heads/master | 2021-01-06T16:35:54.385750 | 2020-02-18T16:37:30 | 2020-02-18T16:37:30 | 241,399,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 206 | java | package testng;
import org.testng.Reporter;
import org.testng.annotations.Test;
public class remo {
@Test
public void run()
{
Reporter.log("i am run() of Remo class", true);
}
}
| [
"sachi@DESKTOP-F10TQDQ"
] | sachi@DESKTOP-F10TQDQ |
9a919ebca5e1919d8d6d6e56b532e1761a3a5a62 | d7eaa91e7bf961186f7c2377e70e6bf1b1e79f04 | /pattern/src/main/java/com/hongfei/focus/pattern/creational/factory/factorymethod/CarFactory.java | 2b3998daac8805e6ef950e4a39fd08d5e36636fa | [] | no_license | tzrough/java-pattern | c325c7478f69f807c23b0b42ed7baf81a9e146b3 | 9362f46433409cbceafb157e715f738dd1f34856 | refs/heads/master | 2020-03-29T18:50:05.534987 | 2018-10-23T08:57:55 | 2018-10-23T08:57:55 | 150,233,891 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package com.hongfei.focus.pattern.creational.factory.factorymethod;
public interface CarFactory
{
Car createCar();
}
| [
"732898328@qq.com"
] | 732898328@qq.com |
12de61464fd7c8ad3da5a5d23c161a925b2b173f | 89e8ce3d574dfe697471c7bd44fb7fa94b767926 | /atomiclearn/src/androidTest/java/com/example/atomiclearn/ExampleInstrumentedTest.java | 3445669bfb46bef1325f20e44e15cbbea0c89ee1 | [] | no_license | keeponZhang/RxJavaAnalyse | e72d14c0cf9376b263806c75c0057e12a727c715 | 60c8d745b17ed38e5f005b930c8e143bf0b5188a | refs/heads/master | 2021-06-14T08:29:08.804775 | 2021-04-17T10:30:54 | 2021-04-17T10:30:54 | 184,300,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package com.example.atomiclearn;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.atomiclearn", appContext.getPackageName());
}
}
| [
"zhangwengao@yy.com"
] | zhangwengao@yy.com |
bd9314511b4eacd7d0e534841852c31203f451a2 | f05760a9472004679c07ed31948ebcf034e94f71 | /src/test/java/SeleniumOperations/SeleniumOperations/tableDemo.java | 8564e58ca5bee34319bef65b5be9feaa97443286 | [] | no_license | SagarWanjari/SeleniumOperations | 5e9347512a9146bc85012bf9b486c9106f2b4f8c | e03402ec92c6d3dfe2dcc2cff892468ff98cda00 | refs/heads/master | 2023-08-10T18:24:33.775536 | 2021-09-20T18:50:21 | 2021-09-20T18:50:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package SeleniumOperations.SeleniumOperations;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
public class tableDemo extends BaseClass {
@Test
public void tableTravserse()
{
driver.findElement(locators.tableLink).click();
List<WebElement> trow = driver.findElements(By.tagName("tr"));
System.out.println("trow size"+trow);
for(int i=0;i<trow.size();i++)
{
List<WebElement> tdata = trow.get(i).findElements(By.tagName("td"));
for(int k=0;k<tdata.size();k++)
{
System.out.print(tdata.get(k).getText()+" ");
}
System.out.println();
}
}
}
| [
"swanjari94@gmail.com"
] | swanjari94@gmail.com |
24e98e6b19f41ecd79d95e0988fca07d22a755ee | 32cf23ff0d117a4e7100274c79b8d08da3e500a7 | /AsyncTaskExample/app/src/main/java/com/github/liangyunfeng/asynctask/MainActivity.java | d081f162db4e4a15ca27e4a66b8eee72be5cfeff | [] | no_license | liangyunfeng/AndroidExamples | a7619664ae314a7dfa81e30ae91e0c3cc54c0960 | b9949a1355dd6e3d4d6bed2ab809a0e2e9fbc307 | refs/heads/master | 2020-03-19T01:53:59.795883 | 2018-08-08T12:50:24 | 2018-08-08T12:50:24 | 135,580,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,232 | java | package com.github.liangyunfeng.asynctask;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
/**
* 1.HttpClient已经过时并且从Android上移除
*
* 2.ProgressDialog已经过时,可以使用ProgressBar替代,
* 但是弹出进度条对话框还是ProgressDialog好用
*/
public class MainActivity extends AppCompatActivity {
private Button btn1, btn2, btn3, btn4;
private ImageView imageView;
private ProgressDialog progressDialog1;
private ProgressDialog progressDialog2;
private final String IMAGE_PATH = "http://i.imgur.com/DvpvklR.png";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageView.setImageBitmap(null);
/**
* <String, Integer, byte[]>
* No scale progress
*
* 在UI Thread当中实例化AsyncTask对象,并调用execute方法
*/
new MyAsyncTask1().execute(IMAGE_PATH);
}
});
btn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageView.setImageBitmap(null);
/**
* <String, Integer, byte[]>
* With scale progress
*
* 在UI Thread当中实例化AsyncTask对象,并调用execute方法
*/
new MyAsyncTask2().execute(IMAGE_PATH);
}
});
btn3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageView.setImageBitmap(null);
/**
* <String, Void, Bitmap>
* No scale progress
*
* 在UI Thread当中实例化AsyncTask对象,并调用execute方法
*/
new MyAsyncTask3().execute(IMAGE_PATH);
}
});
btn4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
imageView.setImageBitmap(null);
/**
* <String, Integer, Bitmap>
* With scale progress
*
* 在UI Thread当中实例化AsyncTask对象,并调用execute方法
*/
new MyAsyncTask4().execute(IMAGE_PATH);
}
});
}
/**
* <String, Integer, byte[]>
* No scale progress
*/
class MyAsyncTask1 extends AsyncTask<String, Integer, byte[]> {
@Override
protected void onPreExecute() {
super.onPreExecute();
// 在onPreExecute()中我们让ProgressDialog显示出来
progressDialog1.show();
}
@Override
protected byte[] doInBackground(String... params) {
byte[] image = new byte[]{};
if (params != null) {
HttpURLConnection connection = null;
try {
// 1. 得到访问地址的URL
URL url = new URL(params[0]);
// 2. 得到网络访问对象java.net.HttpURLConnection
connection = (HttpURLConnection) url.openConnection();
/* 3. 设置请求参数(过期时间,输入、输出流、访问方式),以流的形式进行连接 */
// 设置是否向HttpURLConnection输出
connection.setDoOutput(false);
// 设置是否从httpUrlConnection读入
connection.setDoInput(true);
// 设置请求方式
connection.setRequestMethod("GET");
// 设置是否使用缓存
connection.setUseCaches(true);
// 设置此 HttpURLConnection 实例是否应该自动执行 HTTP 重定向
//connection.setInstanceFollowRedirects(true);
// 设置连接超时时间
connection.setConnectTimeout(3000);
// 设置读取超时时间
//connection.setReadTimeout(3000);
// 连接
connection.connect();
// 4. 得到响应状态码的返回值 responseCode
int code = connection.getResponseCode();
// 5. 如果返回值正常,数据在网络中是以流的形式得到服务端返回的数据
if (code == 200) { // 正常响应
// 得到文件的总长度
long file_length = connection.getContentLength();
// 每次读取后累加的长度
long total_length = 0;
// 从流中读取响应信息
InputStream is = connection.getInputStream();
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
try {
// 每次最多读取1024个字节
byte[] buff = new byte[1024];
int len;
while ((len = is.read(buff)) != -1) {
arrayOutputStream.write(buff, 0, len);
}
image = arrayOutputStream.toByteArray();
} finally {
is.close();
arrayOutputStream.close();
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (connection != null) {
// 6. 断开连接,释放资源
connection.disconnect();
}
}
}
return image;
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(byte[] result) {
super.onPostExecute(result);
// 将doInBackground方法返回的byte[]解码成要给Bitmap
Bitmap bitmap = BitmapFactory.decodeByteArray(result, 0, result.length);
// 更新我们的ImageView控件
imageView.setImageBitmap(bitmap);
// 使ProgressDialog框消失
progressDialog1.dismiss();
}
}
/**
* <String, Integer, byte[]>
* With scale progress
*/
class MyAsyncTask2 extends AsyncTask<String, Integer, byte[]> {
@Override
protected void onPreExecute() {
super.onPreExecute();
// 在onPreExecute()中我们让ProgressDialog显示出来
progressDialog2.show();
progressDialog2.setProgress(0);
}
@Override
protected byte[] doInBackground(String... params) {
byte[] image = new byte[]{};
if (params != null) {
HttpURLConnection connection = null;
try {
// 1. 得到访问地址的URL
URL url = new URL(params[0]);
// 2. 得到网络访问对象java.net.HttpURLConnection
connection = (HttpURLConnection) url.openConnection();
/* 3. 设置请求参数(过期时间,输入、输出流、访问方式),以流的形式进行连接 */
// 设置是否向HttpURLConnection输出
connection.setDoOutput(false);
// 设置是否从httpUrlConnection读入
connection.setDoInput(true);
// 设置请求方式
connection.setRequestMethod("GET");
// 设置是否使用缓存
connection.setUseCaches(true);
// 设置此 HttpURLConnection 实例是否应该自动执行 HTTP 重定向
//connection.setInstanceFollowRedirects(true);
// 设置连接超时时间
connection.setConnectTimeout(3000);
// 设置读取超时时间
//connection.setReadTimeout(3000);
// 连接
connection.connect();
// 4. 得到响应状态码的返回值 responseCode
int code = connection.getResponseCode();
// 5. 如果返回值正常,数据在网络中是以流的形式得到服务端返回的数据
if (code == 200) { // 正常响应
// 得到文件的总长度
long file_length = connection.getContentLength();
// 每次读取后累加的长度
long total_length = 0;
// 从流中读取响应信息
InputStream is = connection.getInputStream();
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
try {
// 每次最多读取1024个字节
byte[] buff = new byte[1024];
int len;
while ((len = is.read(buff)) != -1) {
arrayOutputStream.write(buff, 0, len);
total_length += len;
// 得到当前图片下载的进度
int progress = ((int) ((total_length / (float) file_length) * 100));
// 时刻将当前进度更新给onProgressUpdate方法
publishProgress(progress);
}
image = arrayOutputStream.toByteArray();
} finally {
is.close();
arrayOutputStream.close();
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (connection != null) {
// 6. 断开连接,释放资源
connection.disconnect();
}
}
}
return image;
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
// 更新ProgressDialog的进度条
progressDialog2.setProgress(values[0]);
}
@Override
protected void onPostExecute(byte[] result) {
super.onPostExecute(result);
// 将doInBackground方法返回的byte[]解码成要给Bitmap
Bitmap bitmap = BitmapFactory.decodeByteArray(result, 0, result.length);
// 更新我们的ImageView控件
imageView.setImageBitmap(bitmap);
// 使ProgressDialog框消失
progressDialog2.dismiss();
}
}
/**
* <String, Void, Bitmap>
* No scale progress
*/
class MyAsyncTask3 extends AsyncTask<String, Void, Bitmap> {
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog1.show();
}
@Override
protected Bitmap doInBackground(String... params) {
Bitmap bitmap = null;
HttpURLConnection connection = null;
InputStream is = null;
if (params != null) {
try {
URL url = new URL(params[0]);
connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(false);
connection.setRequestMethod("GET");
connection.setUseCaches(true);
connection.setConnectTimeout(3000);
connection.connect();
int code = connection.getResponseCode();
if (code == 200) {
is = connection.getInputStream();
bitmap = BitmapFactory.decodeStream(connection.getInputStream());
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if (connection != null)
connection.disconnect();
}
}
return bitmap;
}
@Override
protected void onProgressUpdate(Void... values) {
super.onProgressUpdate(values);
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
imageView.setImageBitmap(bitmap);
progressDialog1.dismiss();
}
}
/**
* <String, Integer, Bitmap>
* With scale progress
*/
class MyAsyncTask4 extends AsyncTask<String, Integer, Bitmap> {
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog2.show();
progressDialog2.setProgress(0);
}
@Override
protected Bitmap doInBackground(String... params) {
Bitmap bitmap = null;
HttpURLConnection connection = null;
InputStream is = null;
ByteArrayOutputStream byteArrayOutputStream = null;
if (params != null) {
try {
URL url = new URL(params[0]);
connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(false);
connection.setRequestMethod("GET");
connection.setUseCaches(true);
connection.setConnectTimeout(3000);
connection.connect();
int code = connection.getResponseCode();
if (code == 200) {
int total = connection.getContentLength();
int curLen = 0;
int len;
is = connection.getInputStream();
byte[] buff = new byte[1024];
byteArrayOutputStream = new ByteArrayOutputStream();
while ((len = is.read(buff)) != -1) {
curLen += len;
byteArrayOutputStream.write(buff, 0, len);
int progress = (int)((curLen / (float)total) * 100);
publishProgress(progress);
}
byte[] image = byteArrayOutputStream.toByteArray();
bitmap = BitmapFactory.decodeByteArray(image, 0, image.length);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if (connection != null)
connection.disconnect();
}
}
return bitmap;
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
progressDialog2.setProgress(values[0]);
}
@Override
protected void onPostExecute(Bitmap bitmap) {
super.onPostExecute(bitmap);
progressDialog2.dismiss();
imageView.setImageBitmap(bitmap);
}
}
public byte[] getBytesInputStream(InputStream is) throws IOException {
ByteArrayOutputStream arrayOutputStream = new ByteArrayOutputStream();
try {
byte[] buff = new byte[512];
int len;
while ((len = is.read(buff)) != -1) {
arrayOutputStream.write(buff, 0, len);
}
} finally {
is.close();
arrayOutputStream.close();
}
return arrayOutputStream.toByteArray();
}
public void initView() {
btn1 = (Button) findViewById(R.id.btn1);
btn2 = (Button) findViewById(R.id.btn2);
btn3 = (Button) findViewById(R.id.btn3);
btn4 = (Button) findViewById(R.id.btn4);
imageView = (ImageView) findViewById(R.id.imageView);
// 弹出要给ProgressDialog
progressDialog1 = new ProgressDialog(MainActivity.this);
progressDialog1.setTitle("提示信息");
progressDialog1.setMessage("正在下载中,请稍后......");
// 设置setCancelable(false); 表示我们不能取消这个弹出框,等下载完成之后再让弹出框消失
progressDialog1.setCancelable(false);
// 设置ProgressDialog样式为圆圈的形式
progressDialog1.setProgressStyle(ProgressDialog.STYLE_SPINNER);
// 弹出要给ProgressDialog
progressDialog2 = new ProgressDialog(MainActivity.this);
progressDialog2.setTitle("提示信息");
progressDialog2.setMessage("正在下载中,请稍后......");
// 设置setCancelable(false); 表示我们不能取消这个弹出框,等下载完成之后再让弹出框消失
progressDialog2.setCancelable(false);
// 设置ProgressDialog样式为水平的样式
progressDialog2.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
}
}
| [
"liangyunfeng001@163.com"
] | liangyunfeng001@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.