blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
316c09c8e60989c1fe1190548cdc868e4d4d3b86 | 23c788c260fd4b2ea7557e52c5a6e9e2013400fa | /clickhouse-client/src/main/java/com/clickhouse/client/data/ClickHouseTabSeparatedProcessor.java | 6c70cc408deb9ff5895dcfd8645dfed00cd07cb5 | [
"Apache-2.0"
] | permissive | Blackmorse/clickhouse-jdbc | 8609733344df93de35a890a22ed9ec443cb35459 | f285b73d45597e29cf36dff4daf4cb4f9f53453a | refs/heads/master | 2022-10-24T08:56:37.493779 | 2022-07-29T03:00:29 | 2022-07-29T03:00:29 | 186,688,087 | 0 | 1 | null | 2019-05-14T19:37:11 | 2019-05-14T19:37:10 | null | UTF-8 | Java | false | false | 12,080 | java | package com.clickhouse.client.data;
import java.io.EOFException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import com.clickhouse.client.ClickHouseByteBuffer;
import com.clickhouse.client.ClickHouseColumn;
import com.clickhouse.client.ClickHouseConfig;
import com.clickhouse.client.ClickHouseDataProcessor;
import com.clickhouse.client.ClickHouseDeserializer;
import com.clickhouse.client.ClickHouseFormat;
import com.clickhouse.client.ClickHouseInputStream;
import com.clickhouse.client.ClickHouseOutputStream;
import com.clickhouse.client.ClickHouseRecord;
import com.clickhouse.client.ClickHouseSerializer;
import com.clickhouse.client.ClickHouseValue;
import com.clickhouse.client.config.ClickHouseClientOption;
import com.clickhouse.client.config.ClickHouseRenameMethod;
import com.clickhouse.client.data.tsv.ByteFragment;
public class ClickHouseTabSeparatedProcessor extends ClickHouseDataProcessor {
private static final Map<ClickHouseFormat, MappedFunctions> cachedFuncs = new EnumMap<>(ClickHouseFormat.class);
static final class TextHandler {
static final byte[] NULL = "\\N".getBytes(StandardCharsets.US_ASCII);
private final byte colDelimiter;
private final byte rowDelimiter;
private final byte escapeByte;
private byte prev;
TextHandler(char rowDelimiter) {
this.colDelimiter = 0x0;
this.rowDelimiter = (byte) rowDelimiter;
this.escapeByte = 0x0;
this.prev = 0x0;
}
TextHandler(char colDelimiter, char rowDelimiter, char escapeByte) {
this.colDelimiter = (byte) colDelimiter;
this.rowDelimiter = (byte) rowDelimiter;
this.escapeByte = (byte) escapeByte;
this.prev = 0x0;
}
private int read(byte[] bytes, int position, int limit) {
int offset = 0;
for (int i = position; i < limit; i++) {
byte b = bytes[i];
offset++;
if (b == rowDelimiter) {
return offset;
}
}
return -1;
}
int readLine(byte[] bytes, int position, int limit) {
if (escapeByte == 0x0) {
return read(bytes, position, limit);
}
int offset = 0;
for (int i = position; i < limit; i++) {
byte b = bytes[i];
offset++;
if (prev == escapeByte) {
prev = b == escapeByte ? 0x0 : b;
} else {
prev = b;
if (b == rowDelimiter) {
return offset;
}
}
}
return -1;
}
int readColumn(byte[] bytes, int position, int limit) {
if (colDelimiter == 0x0) {
return readLine(bytes, position, limit);
}
int offset = 0;
for (int i = position; i < limit; i++) {
byte b = bytes[i];
offset++;
if (prev == escapeByte) {
prev = b == escapeByte ? 0x0 : b;
} else {
prev = b;
if (b == colDelimiter || b == rowDelimiter) {
return offset;
}
}
}
return -1;
}
int writeColumn(byte[] bytes, int position, int limit) {
if (colDelimiter == 0x0) {
return writeLine(bytes, position, limit);
} else {
bytes[position] = colDelimiter;
return 1;
}
}
int writeLine(byte[] bytes, int position, int limit) {
if (rowDelimiter == 0x0) {
return 0;
} else {
bytes[position] = rowDelimiter;
return 1;
}
}
}
public static final class MappedFunctions
implements ClickHouseDeserializer<ClickHouseValue>, ClickHouseSerializer<ClickHouseValue> {
private final TextHandler textHandler;
private MappedFunctions(ClickHouseFormat format) {
this.textHandler = getTextHandler(format);
}
/**
* Deserializes data read from input stream.
*
* @param ref wrapper object can be reused, could be null(always return new
* wrapper object)
* @param config non-null configuration
* @param column non-null type information
* @param input non-null input stream
* @return deserialized value which might be the same instance as {@code ref}
* @throws IOException when failed to read data from input stream
*/
public ClickHouseValue deserialize(ClickHouseValue ref, ClickHouseConfig config, ClickHouseColumn column,
ClickHouseInputStream input) throws IOException {
if (ref == null) {
ref = ClickHouseStringValue.ofNull();
}
return ref.update(
input.readCustom(column.isLastColumn() && column.isFirstColumn() ? textHandler::readLine
: textHandler::readColumn).asUnicodeString());
}
/**
* Writes serialized value to output stream.
*
* @param value non-null value to be serialized
* @param config non-null configuration
* @param column non-null type information
* @param output non-null output stream
* @throws IOException when failed to write data to output stream
*/
public void serialize(ClickHouseValue value, ClickHouseConfig config, ClickHouseColumn column,
ClickHouseOutputStream output) throws IOException {
output.writeBytes(value.isNullOrEmpty() ? TextHandler.NULL : value.asBinary());
output.writeCustom(column.isLastColumn() ? textHandler::writeLine : textHandler::writeColumn);
}
}
private static TextHandler getTextHandler(ClickHouseFormat format) {
final TextHandler textHandler;
switch (format) {
case CSV:
case CSVWithNames:
textHandler = new TextHandler(',', '\t', '\\');
break;
case TSV:
case TSVRaw:
case TSVWithNames:
case TSVWithNamesAndTypes:
case TabSeparated:
case TabSeparatedRaw:
case TabSeparatedWithNames:
case TabSeparatedWithNamesAndTypes:
textHandler = new TextHandler('\t', '\n', '\\');
break;
default:
textHandler = new TextHandler('\n');
break;
}
return textHandler;
}
private static String[] toStringArray(ByteFragment headerFragment, byte delimitter) {
if (delimitter == (byte) 0) {
return new String[] { headerFragment.asString(true) };
}
ByteFragment[] split = headerFragment.split(delimitter);
String[] array = new String[split.length];
for (int i = 0; i < split.length; i++) {
array[i] = split[i].asString(true);
}
return array;
}
public static MappedFunctions getMappedFunctions(ClickHouseFormat format) {
return cachedFuncs.computeIfAbsent(format, MappedFunctions::new);
}
// initialize in readColumns()
private TextHandler textHandler;
private ByteFragment currentRow;
protected TextHandler getTextHandler() {
if (textHandler == null) {
textHandler = getTextHandler(config.getFormat());
}
return textHandler;
}
@Override
protected ClickHouseRecord createRecord() {
return new ClickHouseSimpleRecord(getColumns(), templates);
}
@Override
protected void readAndFill(ClickHouseRecord r) throws IOException {
ClickHouseByteBuffer buf = input.readCustom(getTextHandler()::readLine);
if (buf.isEmpty() && input.available() < 1) {
throw new EOFException();
}
currentRow = new ByteFragment(buf.array(), buf.position(),
buf.lastByte() == getTextHandler().rowDelimiter ? buf.length() - 1 : buf.length());
int index = readPosition;
byte delimiter = getTextHandler().colDelimiter;
ByteFragment[] currentCols;
if (columns.length > 1 && delimiter != (byte) 0) {
currentCols = currentRow.split(delimiter);
} else {
currentCols = new ByteFragment[] { currentRow };
}
for (; readPosition < columns.length; readPosition++) {
r.getValue(readPosition).update(currentCols[readPosition - index].asString(true));
}
}
@Override
protected void readAndFill(ClickHouseValue value, ClickHouseColumn column) throws IOException {
throw new UnsupportedOperationException();
}
@Override
protected List<ClickHouseColumn> readColumns() throws IOException {
if (input == null) {
return Collections.emptyList();
}
ClickHouseFormat format = config.getFormat();
if (!format.hasHeader()) {
return DEFAULT_COLUMNS;
}
ClickHouseByteBuffer buf = input.readCustom(getTextHandler()::readLine);
if (buf.isEmpty()) {
input.close();
// no result returned
return Collections.emptyList();
}
ByteFragment headerFragment = new ByteFragment(buf.array(), buf.position(),
buf.lastByte() == getTextHandler().rowDelimiter ? buf.length() - 1 : buf.length());
String header = headerFragment.asString(true);
if (header.startsWith("Code: ") && !header.contains("\t")) {
input.close();
throw new IllegalArgumentException("ClickHouse error: " + header);
}
String[] cols = toStringArray(headerFragment, getTextHandler().colDelimiter);
String[] types = null;
if (ClickHouseFormat.TSVWithNamesAndTypes == format
|| ClickHouseFormat.TabSeparatedWithNamesAndTypes == format) {
buf = input.readCustom(getTextHandler()::readLine);
if (buf.isEmpty()) {
input.close();
throw new IllegalArgumentException("ClickHouse response without column types");
}
ByteFragment typesFragment = new ByteFragment(buf.array(), buf.position(),
buf.lastByte() == getTextHandler().rowDelimiter ? buf.length() - 1 : buf.length());
types = toStringArray(typesFragment, getTextHandler().colDelimiter);
}
ClickHouseRenameMethod m = (ClickHouseRenameMethod) config
.getOption(ClickHouseClientOption.RENAME_RESPONSE_COLUMN);
List<ClickHouseColumn> list = new ArrayList<>(cols.length);
for (int i = 0; i < cols.length; i++) {
list.add(ClickHouseColumn.of(m.rename(cols[i]), types == null ? "Nullable(String)" : types[i]));
}
return list;
}
public ClickHouseTabSeparatedProcessor(ClickHouseConfig config, ClickHouseInputStream input,
ClickHouseOutputStream output, List<ClickHouseColumn> columns, Map<String, Object> settings)
throws IOException {
super(config, input, output, columns, settings);
}
@Override
public void write(ClickHouseValue value, ClickHouseColumn column) throws IOException {
if (output == null || column == null) {
throw new IllegalArgumentException("Cannot write any value when output stream or column is null");
}
output.writeBytes(value.isNullOrEmpty() ? TextHandler.NULL : value.asBinary());
output.writeCustom(column.isLastColumn() ? getTextHandler()::writeLine : getTextHandler()::writeColumn);
}
}
| [
"[email protected]"
] | |
f0b740e2371aac9fc768c72570bc10a2a6fbae0a | 55b3651d0cb62c91816dbfb9c14324c01bd64b65 | /20171010/杨楠-151220142/huluwa/battle.java | e56ca669f558129decc20e84c3d9b0a00ce97566 | [] | no_license | irishaha/java-2017f-homework | e942688ccc49213ae53c6cee01552cf15c7345f5 | af9b2071de4896eebbb27da43d23e4d8a84c8b5d | refs/heads/master | 2021-09-04T07:54:46.721020 | 2018-01-17T06:51:12 | 2018-01-17T06:51:12 | 103,260,952 | 2 | 0 | null | 2017-10-18T14:50:25 | 2017-09-12T11:17:27 | Java | WINDOWS-1252 | Java | false | false | 617 | java | package huluwa;
public class battle {
public static void main(String[] args) {
stage stg = new stage(10);
huluwa.setkids();
shejing Shejing = new shejing();
xiezi Xiezi = new xiezi();
yeye Yeye = new yeye();
huluwa Huluwa = new huluwa(7);
louluo Louluo = new louluo(6);
Huluwa.setposition(0, 0, 0);
Yeye.setposition(0, 9);
Xiezi.setposition(6, 0);
Louluo.setposition(6, 0, 2);
Shejing.setposition(9, 9);
stg.show();
System.out.println("±ä»»Õó·¨!!!");
Xiezi.leaveposition();
Louluo.leaveposition();
Xiezi.setposition(9, 0);
Louluo.setposition(8, 1, 1);
stg.show();
}
}
| [
"[email protected]"
] | |
ae042d9ce3239837cd0def6b259b29312ac06034 | a737b6d65f238fb31be7dc179035edc74c284c49 | /springboot-facade/src/main/java/com/liuhao/springboot/demo/facade/UserFacade.java | 3feb96d9004664fb561d9d52ade36d7e43972a87 | [] | no_license | harryLiu92/springboot-study | b6d146306c9eab8a95f7d5e0c79b547bea7b27d4 | c093b4b67744ac4f1be9b9d7c41512961975a71e | refs/heads/master | 2020-04-03T19:14:16.306449 | 2018-10-31T08:08:10 | 2018-10-31T08:08:10 | 155,516,000 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 144 | java | package com.liuhao.springboot.demo.facade;
/**
* @Author: liuhao
* @Date: 2018/10/25 17:34
* @Description:
**/
public class UserFacade {
}
| [
"[email protected]"
] | |
a1f141e21fdc8dd6ade20032895f68c9c8ef79e8 | 59e0765827b9089240759530e1396cfb9be87aa3 | /client/src/main/java/com/alibaba/otter/canal/client/impl/running/ServerInfo.java | e435eab06081b577c20b2de9cd81e3d493a11a35 | [
"Apache-2.0"
] | permissive | shiranjia/canal | d7101471a1226a782a544d4df0ec9d65db21d85a | a6b287e114fba5d5bc41bce3018f295b3cc8caef | refs/heads/master | 2020-05-25T14:57:19.104279 | 2016-10-27T08:43:19 | 2016-10-27T08:43:19 | 48,232,917 | 1 | 0 | null | 2015-12-18T11:58:46 | 2015-12-18T11:58:45 | null | UTF-8 | Java | false | false | 741 | java | package com.alibaba.otter.canal.client.impl.running;
import com.alibaba.otter.canal.common.zookeeper.running.ServerRunningData;
import java.util.List;
/**
* Created by jiashiran on 2016/10/24.
*/
public class ServerInfo {
private ServerRunningData serverRunningData;
private List<String> activeServer;
public List<String> getActiveServer() {
return activeServer;
}
public void setActiveServer(List<String> activeServer) {
this.activeServer = activeServer;
}
public ServerRunningData getServerRunningData() {
return serverRunningData;
}
public void setServerRunningData(ServerRunningData serverRunningData) {
this.serverRunningData = serverRunningData;
}
}
| [
"[email protected]"
] | |
f89e599b4a2117facaa8eafa6207d6cee5855ca5 | 451d8862d644ef63e959ef9b6029f5ae808eda80 | /app/src/main/java/ru/courierhelper/ofkbanktask/RestaurantList.java | 9da978e58158c1575acc323d59486d63532b913d | [] | no_license | ivan8m8/OFKBankTask | 1bd52d8fd220e4c58796ecb877d8fdc78120deb5 | 2b483fbbca401d24c243a28d01c35960cccf8a65 | refs/heads/master | 2021-06-17T16:19:56.650951 | 2017-05-25T17:55:57 | 2017-05-25T17:55:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package ru.courierhelper.ofkbanktask;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
/**
* Created by Ivan on 24.05.17.
*/
public class RestaurantList {
@SerializedName("data")
@Expose
private ArrayList<Restaurant> restaurants = new ArrayList<>();
public ArrayList<Restaurant> getRestaurants() {
return restaurants;
}
public void setRestaurants(ArrayList<Restaurant> restaurants) {
this.restaurants = restaurants;
}
}
| [
"[email protected]"
] | |
a62f09e9e964b7477cc7743d43dc326660b0e917 | a51c94230c52fefd8c9cbf77a0ab2074ac344974 | /app/src/main/java/pl/szon/stopwatch/CircleAnimation.java | c518aeb34eeb63950f7c5329a165cb18a437bf2c | [] | no_license | Litery/StopWatch | 986c76f07073a9dcc2603a3996985bc1fa46701e | cc64ca3cc45d3369809230ebd0cb571eb5f0bc81 | refs/heads/master | 2021-01-20T21:06:55.979453 | 2016-07-05T20:00:17 | 2016-07-05T20:00:17 | 62,640,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package pl.szon.stopwatch;
import android.view.animation.Animation;
import android.view.animation.Transformation;
/**
* Created by Szymon on 05.07.2016.
*/
public class CircleAnimation extends Animation {
private Circle circle;
private float oldAngle;
private float newAngle;
public CircleAnimation(Circle circle, int newAngle) {
this.oldAngle = circle.getAngle();
this.newAngle = newAngle;
this.circle = circle;
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation transformation) {
float angle = oldAngle + ((newAngle - oldAngle) * interpolatedTime);
circle.setAngle(angle);
circle.requestLayout();
}
}
| [
"[email protected]"
] | |
05201f217b7796d988fc7aa2d050eb34c4dc3a3c | bb8a41c2292b0504b4d1b1be3b7fcb6eddf57e7d | /src/com/asan/frontPages/serverForms/ServerInfoDialog.java | b43621aac7879b7eff4d6d72f091b3a3c6328c76 | [] | no_license | aliamiri/ConcentratorJMX | 6f11a1ed58690695558479571ae44aef176fcc3d | dc698ad09678048e385aa2d239d022587e9068c2 | refs/heads/master | 2016-09-06T02:19:49.088311 | 2015-03-15T13:53:24 | 2015-03-15T13:53:24 | 32,258,863 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,851 | java | package com.asan.frontPages.serverForms;
import com.asan.JMXClasses.ServerConnectorMXBean;
import com.asan.NamesPkg.Server;
import com.asan.MainClass;
import javax.management.Attribute;
import javax.management.ObjectName;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ServerInfoDialog extends JDialog {
private JPanel contentPane;
private JButton disConnect;
private JButton reset;
private boolean status;
private JButton connect;
private JButton save;
private JCheckBox autoReconnectEnable;
private JTextField writeBufferHighWaterMark;
private JTextField connectionTryWaitTimeMillis;
private JTextField writeBufferLowWaterMark;
private JLabel nameLabel;
private String name;
private ObjectName objName;
public ServerInfoDialog(ServerConnectorMXBean server, ObjectName objectName) {
setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
setContentPane(contentPane);
setModal(true);
getRootPane().setDefaultButton(disConnect);
objName = objectName;
name = server.Name;
nameLabel.setText(name);
autoReconnectEnable.setSelected(server.AutoReconnectEnable);
connectionTryWaitTimeMillis.setText(server.ConnectionTryWaitTimeMillis+"");
writeBufferHighWaterMark.setText(server.WriteBufferHighWaterMark+"");
writeBufferLowWaterMark.setText(server.WriteBufferLowWaterMark+"");
disConnect.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
status = true;
MainClass.callJmxFunction(objName, Server.func_disconnect, null, null);
}
});
reset.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
status = true;
MainClass.callJmxFunction(objName, Server.func_resetConnection, null, null);
}
});
connect.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
status = true;
MainClass.callJmxFunction(objName, Server.func_connect, null, null);
}
});
save.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
status = true;
Attribute attribute = new Attribute(Server.attr_AutoReconnectEnable,Boolean.valueOf(autoReconnectEnable.isSelected()));
MainClass.setJMXAttribute(objName,attribute);
attribute = new Attribute(Server.attr_ConnectionTryWaitTimeMillis,Integer.valueOf(connectionTryWaitTimeMillis.getText()));
MainClass.setJMXAttribute(objName,attribute);
attribute = new Attribute(Server.attr_WriteBufferHighWaterMark,Integer.valueOf(writeBufferHighWaterMark.getText()));
MainClass.setJMXAttribute(objName,attribute);
attribute = new Attribute(Server.attr_WriteBufferLowWaterMark,Integer.valueOf(writeBufferLowWaterMark.getText()));
MainClass.setJMXAttribute(objName,attribute);
dispose();
}
});
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
}
});
contentPane.registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
dispose();
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}
public boolean showDialog(){
setVisible(true);
return status;
}
}
| [
"[email protected]"
] | |
5771dc2d35a062af875058fa792529ddef56e215 | 85c261151a6967df62ecf85c0165061d175a6e5e | /DeckOfCards/src/com/blbz/deckofcards/seviceimp/DeckofcardImp.java | b2c9fd6758f550408101ba1f8174ff07a317708b | [] | no_license | Kutty39/Program | e370b3d1d00700a134b148643e816a2a94a1bd1c | dd73672baf7ea3c63f14b168f4670e62aa075d3e | refs/heads/master | 2020-09-04T06:25:36.484508 | 2020-05-08T07:52:33 | 2020-05-08T07:52:33 | 219,675,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,300 | java | package com.blbz.deckofcards.seviceimp;
import com.blbz.deckofcards.model.DeckofcardModel;
import com.blbz.deckofcards.service.Deckofcard;
import com.blbz.deckofcards.utility.MyQueue;
import java.util.Arrays;
import java.util.Random;
public class DeckofcardImp implements Deckofcard {
DeckofcardModel dm;
//Constructor will create the object of the model class
public DeckofcardImp() {
dm = new DeckofcardModel();
}
/*
This methode will create the full deck with order
*/
@Override
public void fullDeckCreater() {
int pos = 0;
for (String s : dm.getSuit()) {
for (String s1 : dm.getRank()) {
dm.getFulldeck()[pos][0] = s1;
dm.getFulldeck()[pos][1] = s;
++pos;
}
}
}
/*
this will shuffle the full deck and create new shuffled deck
*/
@Override
public void shuffleCards() {
dm.setShuffleddeck(dm.getFulldeck().clone());
Random rd = new Random();
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 13; j++) {
int r = rd.nextInt(52);
int r1 = rd.nextInt(52);
String[] temp = dm.getShuffleddeck()[r];
dm.getShuffleddeck()[r] = dm.getShuffleddeck()[r1];
dm.getShuffleddeck()[r1] = temp;
}
}
}
/*
Distributing cards to all the players one by one.
and printing the 2d array
*/
@Override
public void putCardtoPlayers() {
int pos = 0;
for (int i = 0; i < 9; i++) {
for (int j = 0; j < 4; j++) {
switch (j + 1) {
case 1:
dm.getP1()[i] = dm.getShuffleddeck()[pos];
break;
case 2:
dm.getP2()[i] = dm.getShuffleddeck()[pos];
break;
case 3:
dm.getP3()[i] = dm.getShuffleddeck()[pos];
break;
case 4:
dm.getP4()[i] = dm.getShuffleddeck()[pos];
break;
}
++pos;
}
}
System.out.println("2d Array");
System.out.println("Player 1 \tPlayer 2 \tPlayer 3 \tPlayer 4");
for (int i = 0; i < dm.getP1().length; i++) {
String p1 = dm.getP1()[i][0] + " " + dm.getP1()[i][1];
String p2 = dm.getP2()[i][0] + " " + dm.getP2()[i][1];
String p3 = dm.getP3()[i][0] + " " + dm.getP3()[i][1];
String p4 = dm.getP4()[i][0] + " " + dm.getP4()[i][1];
System.out.print(p1 + " ".repeat(14 - p1.length()) + "\t" +
p2 + " ".repeat(14 - p2.length()) + "\t" +
p3 + " ".repeat(14 - p3.length()) + "\t" +
p4);
System.out.println();
}
}
/*
creating the q for all the players
*/
@Override
public void creatingPlayerQ() {
for (String[] strings : dm.getP1()) {
dm.getP1q().enQueue(strings[0]+" "+strings[1],findRank(strings));
//System.out.println(strings[0]+" "+strings[1]+" "+findRank(strings));
}
for (String[] strings : dm.getP2()) {
dm.getP2q().enQueue(strings[0]+" "+strings[1],findRank(strings));
//System.out.println(strings[0]+" "+strings[1]+" "+findRank(strings));
}
for (String[] strings : dm.getP3()) {
dm.getP3q().enQueue(strings[0]+" "+strings[1],findRank(strings));
//System.out.println(strings[0]+" "+strings[1]+" "+findRank(strings));
}
for (String[] strings : dm.getP4()) {
dm.getP4q().enQueue(strings[0]+" "+strings[1],findRank(strings));
//System.out.println(strings[0]+" "+strings[1]+" "+findRank(strings));
}
dm.getPlayerq().enQueue( dm.getP1q(),1);
dm.getPlayerq().enQueue( dm.getP2q(),2);
dm.getPlayerq().enQueue( dm.getP3q(),3);
dm.getPlayerq().enQueue( dm.getP4q(),4);
}
/*
displaying the q for all the players
*/
public void displayQ(){
System.out.println("*****************");
System.out.println("using Q");
System.out.println("*****************");
int py=1;
while (dm.getPlayerq().size()!=0){
MyQueue<String> tmpw= dm.getPlayerq().deQueus();
if (py==1){
System.out.println("Player 1");
}else if(py==2){
System.out.println("Player 2");
}else if(py==3){
System.out.println("Player 3");
}else{
System.out.println("Player 4");
}
while (tmpw.size()!=0){
System.out.println(tmpw.deQueus());
}
System.out.println("************************");
++py;
}
}
/*
to find the index of the card from full deck
*/
private int findRank(String[] str) {
for (int i = 0; i < dm.getFulldeck().length; i++) {
if (Arrays.equals(dm.getFulldeck()[i], str)) {
return i;
}
}
return -1;
}
}
| [
"[email protected]"
] | |
91aa0118f28a25af1de877793fc5571dc2e6aa7d | 0025b08a9182894f827f302a59f26878eb946c9a | /web_manage_soft_back/ble/src/com/mzl0101/dao/UsersDao.java | b3eb7904e82f49e5249541b4254f6e4eb1be3c10 | [] | no_license | ml-lan/openwrt | c23142ed9daf3a309924a679c265e6edf3f49dd6 | d1b47a95539f05f4e1a5ca57a85ea1b44e4e4f44 | refs/heads/master | 2023-08-31T15:41:59.518510 | 2019-12-22T11:25:56 | 2019-12-22T11:25:56 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,454 | java | package com.mzl0101.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import com.mzl0101.entity.Users;
import com.mzl0101.utils.DBManager;
import com.mzl0101.utils.DataSourceUtils;
public class UsersDao {
private DBManager db = new DBManager();
/**
* 保存用户数据
*
* @param user
* @return void
*/
public void saveUser(Users user) {
String sql = "insert into users (username,passwd,user_email)"
+" values('"
+user.getUsername()
+"','"
+user.getPassword()
+"','"
+user.getEmail()
+"')";
db.update(sql);
}
/**
* 通过用户名查找是否存在该用户
* 返回true则存在
* @param username
* @return boolean
*/
public boolean queryByUserName(String username) {
try {
String sql = "select * from users where username= '"+username+"'";
//System.out.println(">>>>>>>>>>>>>"+sql);
ResultSet rs = db.query(sql);
return rs.next();
} catch (SQLException e) {
e.printStackTrace();
} finally {
db.closeConn();
}
return false;
}
/**
*根据已存在的用户名查找该用户的密码。
*@param username
*@return password
*/
public Users queryUserByUserName(String username){
Users u = null;
try {
String sql = "select * from users where username= '" + username +"'";
ResultSet rs = db.query(sql);
while (rs.next()) {
u = new Users();
u.setUsername(rs.getString("username"));
u.setPassword(rs.getString("passwd"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
db.closeConn();
}
return u;
}
/**
* 修改用户密码
* @param email password
*/
public void updateUserPass(String email, String password)
{
String sql = "update users set passwd ='"+password+"' where user_email='"+email+"'";
db.update(sql);
}
/**
*根据已存在的邮箱查找该用户。
*@param emial
*@return boolean
*/
public boolean queryByUserEmail(String user_email) {
// 1.创建QueryRunner
QueryRunner runner = new QueryRunner(DataSourceUtils.getDataSource());
String sql = "select * from users where user_email=?";
try {
if(runner.query(sql,new BeanHandler<Users>(Users.class), user_email) != null){
return true;
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}
}
| [
"[email protected]"
] | |
3258ece31f8754244f95dbe196a0057a56cb99e5 | ce37c4df55ca695d9fa5147fbad3775aa59a7f02 | /src/vista/PanelInicial.java | 1071f1be91e831ae77dd1219ce297340c5f001d7 | [] | no_license | jsc0197/Buscaminas | a674ea1788bdf163fb0b27ac13f8a2a6a1dd45f1 | 043dbf4938eb0667f9b31891f7fff5a17e60ee5c | refs/heads/master | 2021-04-06T00:24:04.608617 | 2018-03-12T08:18:28 | 2018-03-12T08:18:28 | 124,517,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | package vista;
import javax.swing.JPanel;
import javax.swing.JButton;
import javax.swing.JTextPane;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;
import control.Densidad;
import control.NumeroMinas;
public class PanelInicial extends JPanel {
private JButton btnJugar;
private JComboBox comboBox;
private JComboBox comboBoxMinas;
public JButton getBtnJugar() {
return btnJugar;
}
public void setBtnJugar(JButton btnJugar) {
this.btnJugar = btnJugar;
}
/**
* Create the panel.
*/
public PanelInicial() {
setLayout(null);
JLabel lblNumeroDeMinas = new JLabel("N\u00BA Minas");
lblNumeroDeMinas.setBounds(44, 52, 56, 16);
add(lblNumeroDeMinas);
comboBox = new JComboBox();
comboBox.setModel(new DefaultComboBoxModel(Densidad.values()));
comboBox.setBounds(170, 82, 84, 22);
add(comboBox);
JLabel lblDificultad = new JLabel("Dificultad");
lblDificultad.setBounds(44, 85, 56, 16);
add(lblDificultad);
btnJugar = new JButton("Jugar");
btnJugar.setFocusPainted(false);
btnJugar.setBounds(170, 169, 84, 25);
add(btnJugar);
comboBoxMinas = new JComboBox();
comboBoxMinas.setModel(new DefaultComboBoxModel(NumeroMinas.values()));
comboBoxMinas.setBounds(169, 49, 85, 22);
add(comboBoxMinas);
}
public JComboBox getComboBox() {
return comboBox;
}
public void setComboBox(JComboBox comboBox) {
this.comboBox = comboBox;
}
public JComboBox getComboBoxMinas() {
return comboBoxMinas;
}
public void setComboBox_1(JComboBox comboBox_1) {
this.comboBoxMinas = comboBox_1;
}
}
| [
"[email protected]"
] | |
c390b0667baad9d23fadbe939308c9a0ad8822ab | 2d7c86ca0edfe4aad8c86ba28621b2021ba93611 | /Kaprekar number/Main.java | 44a5bebf4183b14897aa6a054e81e62359d5345a | [] | no_license | GirishSai/Playground | eff7ef4a772cc4d2c9526012b34a83d8bb07ffc6 | bd0ada1696984a78985f74c7bf5f78f1bfea743a | refs/heads/master | 2022-10-01T02:22:50.217803 | 2020-05-30T14:10:32 | 2020-05-30T14:10:32 | 256,555,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | #include<bits/stdc++.h>
using namespace std;
bool iskaprekar(int n)
{
if (n == 1)
return true;
int sq_n = n * n;
int count_digits = 0;
while (sq_n)
{
count_digits++;
sq_n /= 10;
}
sq_n = n*n;
for (int r_digits=1; r_digits<count_digits; r_digits++)
{
int eq_parts = pow(10, r_digits);
if (eq_parts == n)
continue;
int sum = sq_n/eq_parts + sq_n % eq_parts;
if (sum == n)
return true;
}
return false;
}
int main()
{
int n;
cin>>n;
if (iskaprekar(n)) {
cout <<"Kaprekar Number";
}
else{
cout<<"Not a Kaprekar Number";
}
} | [
"[email protected]"
] | |
1209452e45567c7cc3c2b9c6e32c4b271507905a | d935990a261711be280e783a0761440ba3041be0 | /design/factory/src/main/java/spring/design/factory/service/impl/StrategyTwo.java | 3ac10fce049f458417bec7a94ac74e012db90d10 | [] | no_license | zhuleiming03/spring | ceffd507305c7ef83b36089596a68ee1c3a73442 | 4c05bfba5a710d203fc6bd5e4313907ab45ca43e | refs/heads/master | 2023-08-31T04:09:26.845091 | 2023-08-29T06:37:40 | 2023-08-29T06:37:40 | 252,900,200 | 0 | 0 | null | 2022-12-16T00:42:17 | 2020-04-04T03:35:38 | Java | UTF-8 | Java | false | false | 295 | java | package spring.design.factory.service.impl;
import org.springframework.stereotype.Component;
import spring.design.factory.service.Strategy;
@Component("two")
public class StrategyTwo implements Strategy {
@Override
public String doOperation() {
return "Strategy Two";
}
}
| [
"[email protected]"
] | |
627d82f89bd4035a884d3e5a764e24fe1d02ff7f | 7650bf06a2ec58761b0394df765bc21c0809a755 | /shsj/src/com/lssrc/cms/dao/ActivitMapper.java | 615fb65b8a2b81b4ba1d6ea4c62fcae09d63aebe | [] | no_license | lsw1991abc/shsj | b87a61ce03603299b6a6e0832dfbed151ee60be5 | 9f3410a7950cfdff6a101effb02f97e5fb2725ea | refs/heads/master | 2020-05-30T22:58:50.351906 | 2015-05-28T12:26:09 | 2015-05-28T12:26:09 | 28,892,216 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package com.lssrc.cms.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.lssrc.cms.dto.ActivitDto;
import com.lssrc.cms.entity.Activit;
public interface ActivitMapper {
int deleteByPrimaryKey(String aId);
int insert(Activit record);
ActivitDto selectByPrimaryKey(String aId);
int updateByPrimaryKey(Activit record);
List<Activit> selectByPage(@Param("start") int start, @Param("pageSize") int pageSize);
int selectCount();
List<Map<String, Object>> selectStatus();
} | [
"[email protected]"
] | |
0ffafdabcb40070125dc1103e1e841f1607cddbf | 9991948d970188ddf15df011df00b88bbd78b324 | /src/main/java/com/mao/mysqlhive/demomh/controller/UserController.java | 66f3764623ce58ffd4bca19787826edb30b1076f | [] | no_license | suixinlu2017/springboot-mysql-hive | 5ca39c8bbdd36a28dd1785e1164af7fa5475ecf6 | 3e9125b67e1eb94ff50c4ca26a5416a304583f17 | refs/heads/master | 2020-07-24T18:16:35.879615 | 2019-08-12T06:09:21 | 2019-08-12T06:09:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 753 | java | package com.mao.mysqlhive.demomh.controller;
import com.mao.mysqlhive.demomh.entity.User;
import com.mao.mysqlhive.demomh.service.primary.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* test2数据库 Controller
*/
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@ResponseBody
@RequestMapping("/userList")
public List<User> getUserList() {
List<User> accounts = userService.getUserList();
return accounts;
}
}
| [
"[email protected]"
] | |
02d3fa4614bf7afb94f8e016404ab5b4152f4a4a | 4c9e56d7f36bc92b3c81f1e3f5edd33ae7d6a239 | /src/edu/ucsb/cs56/drawings/blim/advanced/AllMyDrawings.java | 1b789eeaad694487fecbee19bffe9ad9a22c5199 | [
"MIT"
] | permissive | BLimmie/F17-lab04 | 73f45e2c44456ff36425676246ce85d2f6e133b7 | fd3d918dc0f80a44d0fd2d87ec31ec968661cda2 | refs/heads/master | 2021-07-19T16:03:48.075309 | 2017-10-29T08:28:24 | 2017-10-29T08:28:24 | 108,339,218 | 0 | 0 | null | 2017-10-25T23:56:45 | 2017-10-25T23:56:45 | null | UTF-8 | Java | false | false | 4,017 | java | package edu.ucsb.cs56.drawings.blim.advanced;
import java.awt.Graphics2D;
import java.awt.Shape; // general class for shapes
import java.awt.Color; // class for Colors
import java.awt.Stroke;
import java.awt.BasicStroke;
import edu.ucsb.cs56.drawings.utilities.ShapeTransforms;
import edu.ucsb.cs56.drawings.utilities.GeneralPathWrapper;
/**
* A class with static methods for drawing various pictures
*
* @author Brian Lim
* @version for UCSB CS56, F17
*/
public class AllMyDrawings
{
/** Draw a picture with a few Shields
*/
public static void drawPicture1(Graphics2D g2) {
Shield h1 = new Shield(100,250,50,75);
g2.setColor(Color.CYAN); g2.draw(h1);
Shape h2 = ShapeTransforms.scaledCopyOfLL(h1,0.5,0.5);
h2 = ShapeTransforms.translatedCopyOf(h2,150,0);
g2.setColor(Color.BLACK); g2.draw(h2);
h2 = ShapeTransforms.scaledCopyOfLL(h2,4,4);
h2 = ShapeTransforms.translatedCopyOf(h2,150,0);
Stroke thick = new BasicStroke (4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
// for hex colors, see (e.g.) http://en.wikipedia.org/wiki/List_of_colors
// #002FA7 is "International Klein Blue" according to Wikipedia
// In HTML we use #, but in Java (and C/C++) its 0x
Stroke orig=g2.getStroke();
g2.setStroke(thick);
g2.setColor(new Color(0x002FA7));
g2.draw(h2);
Shield hw1 = new Shield(50,350,40,75);
Shield hw2 = new Shield(200,350,200,100);
g2.draw(hw1);
g2.setColor(new Color(0x8F00FF)); g2.draw(hw2);
// @@@ FINALLY, SIGN AND LABEL YOUR DRAWING
g2.setStroke(orig);
g2.setColor(Color.BLACK);
g2.drawString("A few shields by Brian Lim", 20,20);
}
/** Draw a picture with a few shields and designed shields
*/
public static void drawPicture2(Graphics2D g2) {
DesignedShield large = new DesignedShield(100,50,225,150);
DesignedShield smallCC = new DesignedShield(20,50,40,30);
DesignedShield tallSkinny = new DesignedShield(20,150,20,40);
DesignedShield shortFat = new DesignedShield(20,250,40,20);
g2.setColor(Color.RED); g2.draw(large);
g2.setColor(Color.GREEN); g2.draw(smallCC);
g2.setColor(Color.BLUE); g2.draw(tallSkinny);
g2.setColor(Color.MAGENTA); g2.draw(shortFat);
Shield h1 = new Shield(100,250,50,75);
g2.setColor(Color.CYAN); g2.draw(h1);
Shape h2 = ShapeTransforms.scaledCopyOfLL(h1,0.5,0.5);
h2 = ShapeTransforms.translatedCopyOf(h2,150,0);
g2.setColor(Color.BLACK); g2.draw(h2);
h2 = ShapeTransforms.scaledCopyOfLL(h2,4,4);
h2 = ShapeTransforms.translatedCopyOf(h2,150,0);
// We'll draw this with a thicker stroke
Stroke thick = new BasicStroke (4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL);
// for hex colors, see (e.g.) http://en.wikipedia.org/wiki/List_of_colors
// #002FA7 is "International Klein Blue" according to Wikipedia
// In HTML we use #, but in Java (and C/C++) its 0x
Stroke orig=g2.getStroke();
g2.setStroke(thick);
g2.setColor(new Color(0x002FA7));
g2.draw(h2);
DesignedShield hw1 = new DesignedShield(50,350,40,75);
DesignedShield hw2 = new DesignedShield(200,350,200,100);
g2.draw(hw1);
g2.setColor(new Color(0x8F00FF));
Shape hw3 = ShapeTransforms.rotatedCopyOf(hw2, Math.PI/4.0);
g2.draw(hw3);
// @@@ FINALLY, SIGN AND LABEL YOUR DRAWING
g2.setStroke(orig);
g2.setColor(Color.BLACK);
g2.drawString("A bunch of Shields by Brian Lim", 20,20);
}
/** Draw a different picture with only designed shields
*/
public static void drawPicture3(Graphics2D g2) {
// label the drawing
g2.drawString("A bunch of Shields with Designs by Brian Lim", 20,20);
// Draw some coffee cups.
DesignedShield large = new DesignedShield(100,50,225,150);
DesignedShield smallCC = new DesignedShield(20,50,40,30);
g2.setColor(Color.RED); g2.draw(large);
g2.setColor(Color.GREEN); g2.draw(smallCC);
}
}
| [
"[email protected]"
] | |
643708a523281116ad257dbb21a3e3a5a912e22f | cab1f24088fe067111345ff2780952a99d09b48f | /app/src/main/java/com/example/petsapp/data/PetDbHelper.java | 9aed94e8aa1393d35a4868e8d1552c478e2d38a1 | [] | no_license | Anant-1/PetApp | bac3f5c635d67c16e9f729fb9cfd474859cfbc9a | 45b372ceaaf56a2a7ca45114c163eeec094515d5 | refs/heads/master | 2023-06-22T14:31:35.237992 | 2021-07-22T14:47:42 | 2021-07-22T14:47:42 | 387,521,864 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,224 | java | package com.example.petsapp.data;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.view.View;
import android.widget.TextView;
import com.example.petsapp.data.PetContract.PetEntry;
import androidx.annotation.Nullable;
public class PetDbHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "shelter.db";
private static final int DATABASE_VERSION = 1;
public PetDbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String SQL_CREATE_PETS_TABLE = "create table " + PetEntry.TABLE_NAME + "("
+ PetEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
+ PetEntry.COLUMN_PET_NAME + " TEXT NOT NULL, "
+ PetEntry.COLUMN_PET_BREED + " TEXT, "
+ PetEntry.COLUMN_PET_GENDER + " INTEGER NOT NULL, "
+ PetEntry.COLUMN_PET_WEIGHT + " INTEGER NOT NULL DEFAULT 0);";
db.execSQL(SQL_CREATE_PETS_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
}
}
| [
"[email protected]"
] | |
83a209d44f2b0b809b719c9313ee91d631d76e46 | 9f0d7b0b870bc4b3d6e4151947a31fcbffd19753 | /src/com/jni/consbench/simpleCall/BenchmarkSetLongFieldStatic.java | 3b2cd47212106223cfb40c998bedc32bc2bb8afb | [] | no_license | NigelYiboYu/jni-construction-benchmark | 357355fc2603f6b396c670c877edc55c77460bdd | 65aaabe27c788ff685ceead5ecf740947c7785ab | refs/heads/master | 2021-05-14T08:05:09.750862 | 2018-03-07T20:32:32 | 2018-03-07T20:32:32 | 116,284,382 | 0 | 0 | null | 2018-01-04T16:48:27 | 2018-01-04T16:48:27 | null | UTF-8 | Java | false | false | 1,659 | java | package com.jni.consbench.simpleCall;
import java.text.NumberFormat;
import java.util.Locale;
public class BenchmarkSetLongFieldStatic {
// default to 1 million
private static long ITERATIONS = 1000000;
private static boolean warmup = true;
private static boolean isXPLink = true;
private static String testName = "testSetLongFieldStatic";
public final static void main(final String args[]) {
System.loadLibrary("xplinkjnibench");
if (args.length >= 1)
ITERATIONS = Long.parseLong(args[0]);
if (args.length >= 2)
warmup = (Integer.parseInt(args[1]) != 0);
if (args.length >= 3)
isXPLink = (Integer.parseInt(args[2]) != 0);
if (isXPLink)
System.loadLibrary("xplinkjnibench");
else
System.loadLibrary("stdlinkjnibench");
System.out.println("Using iteration count " + ITERATIONS + "\n\n");
System.out.println(testName + " out of main " + (warmup ? "with warmup" : "no warmup"));
if (warmup) {
System.out.println("warming up");
doTest(false);
}
doTest(true);
}
private static void doTest(boolean doPrint) {
NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
if (doPrint)
System.out.println("Starting test " + testName + " " + numberFormat.format(ITERATIONS) + " iterations");
final long start1 = System.currentTimeMillis();
for (long j = 0; j < ITERATIONS; j++) {
SimpleCalls.testSetLongFieldStatic(j);
}
final long end1 = System.currentTimeMillis();
if (doPrint)
System.out.println(testName + " out of main " + (warmup ? "warmup " : "no warmup ")
+ (isXPLink ? "xplink " : "non-xplink ") + numberFormat.format(end1 - start1) + "ms\n\n");
}
}
| [
"[email protected]"
] | |
84700744352a943ac1137f83c5e898bff910df3f | 38435754efb18ce7200755a72135bd496a497f42 | /app/src/main/java/com/howlzzz/shoptime/ui/sharing/FriendAdapter.java | c722d552ebeda503b0beb0ccab3208152f943692 | [] | no_license | premhowli/ShopTime | 96cd0399f8b1e1c8061bf612f542c6c61d54f35e | 4623da633f11a44431d79552a5b80c58b6b9b7fc | refs/heads/master | 2021-01-13T12:17:52.891808 | 2017-02-17T20:03:58 | 2017-02-17T20:03:58 | 69,111,666 | 0 | 0 | null | 2017-02-17T20:03:59 | 2016-09-24T15:48:33 | Java | UTF-8 | Java | false | false | 10,035 | java | package com.howlzzz.shoptime.ui.sharing;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;
import com.firebase.client.DataSnapshot;
import com.firebase.client.Firebase;
import com.firebase.client.FirebaseError;
import com.firebase.client.Query;
import com.firebase.client.ValueEventListener;
import com.firebase.ui.FirebaseListAdapter;
import com.howlzzz.shoptime.R;
import com.howlzzz.shoptime.model.ShopTime;
import com.howlzzz.shoptime.model.User;
import com.howlzzz.shoptime.utils.Constants;
import com.howlzzz.shoptime.utils.Utils;
import com.shaded.fasterxml.jackson.databind.ObjectMapper;
import java.util.HashMap;
import java.util.Map;
/**
* Populates the list_view_friends_share inside ShareListActivity
*/
public class FriendAdapter extends FirebaseListAdapter<User> {
private static final String LOG_TAG = FriendAdapter.class.getSimpleName();
private final Firebase mFirebaseRef;
private String mListId;
private HashMap <Firebase, ValueEventListener> mLocationListenerMap;
private ShopTime mShoppingList;
private HashMap<String, User> mSharedUsersList;
private String s;
/**
* Public constructor that initializes private instance variables when adapter is created
*/
public FriendAdapter(Activity activity, Class<User> modelClass, int modelLayout,
Query ref, String listId) {
super(activity, modelClass, modelLayout, ref);
this.mActivity = activity;
this.mListId = listId;
mFirebaseRef = new Firebase(Constants.FIREBASE_URL);
mLocationListenerMap = new HashMap<Firebase, ValueEventListener>();
}
/**
* Protected method that populates the view attached to the adapter (list_view_friends_autocomplete)
* with items inflated from single_user_item.xml
* populateView also handles data changes and updates the listView accordingly
*/
@Override
protected void populateView(View view, final User friend, int i) {
((TextView) view.findViewById(R.id.user_name)).setText(friend.getName());
final ImageButton buttonToggleShare = (ImageButton) view.findViewById(R.id.button_toggle_share);
final Firebase sharedFriendInShoppingListRef = new Firebase(Constants.FIREBASE_URL_LISTS_SHARED_WITH)
.child(mListId).child(Utils.encodeEmail(friend.getEmail()));
/**
+ * Gets the value of the friend from the ShoppingList's sharedWith list of users
+ * and then allows the friend to be toggled as shared with or not.
+ *
+ * The friend in the snapshot (sharedFriendInShoppingList) will either be a User object
+ * (if they are in the the sharedWith list) or null (if they are not in the sharedWith
+ * list)
+ */
ValueEventListener listener = sharedFriendInShoppingListRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
final User sharedFriendInShoppingList = snapshot.getValue(User.class);
/**
+ * If list is already being shared with this friend, set the buttonToggleShare
+ * to remove selected friend from sharedWith onClick and change the
+ * buttonToggleShare image to green
+ */
if (sharedFriendInShoppingList != null) {
buttonToggleShare.setImageResource(R.drawable.ic_shared_check);
buttonToggleShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/**
+ * Create map and fill it in with deep path multi write operations list.
+ * Use false to mark that you are removing this friend
+ */
HashMap<String, Object> updatedUserData = updateFriendInSharedWith(false, friend);
/* Do a deep-path update */
mFirebaseRef.updateChildren(updatedUserData);
}
});
} else {
/**
+ * Set the buttonToggleShare onClickListener to add selected friend to sharedWith
+ * and change the buttonToggleShare image to grey otherwise
+ */
buttonToggleShare.setImageResource(R.drawable.icon_add_friend);
buttonToggleShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/**
+ * Create map and fill it in with deep path multi write operations list
+ */
HashMap<String, Object> updatedUserData = updateFriendInSharedWith(true, friend);
/* Do a deep-path update */
mFirebaseRef.updateChildren(updatedUserData);
}
});
}
}
@Override
public void onCancelled(FirebaseError firebaseError) {
Log.e(LOG_TAG,
mActivity.getString(R.string.log_error_the_read_failed) +
firebaseError.getMessage());
}
});
/* Add the listener to the HashMap so that it can be removed on cleanup */
mLocationListenerMap.put(sharedFriendInShoppingListRef, listener);
}
/**
* Public method that is used to pass ShoppingList object when it is loaded in ValueEventListener
*/
public void setShoppingList(ShopTime shoppingList) {
this.mShoppingList = shoppingList;
this.notifyDataSetChanged();
}
/**
* Public method that is used to pass SharedUsers when they are loaded in ValueEventListener
*/
public void setSharedWithUsers(HashMap<String, User> sharedUsersList) {
this.mSharedUsersList = sharedUsersList;
this.notifyDataSetChanged();
}
/**
* This method does the tricky job of adding or removing a friend from the sharedWith list.
* @param addFriend This is true if the friend is being added, false is the friend is being removed.
* @param friendToAddOrRemove This is the friend to either add or remove
* @return
*/
private HashMap<String, Object> updateFriendInSharedWith(Boolean addFriend, User friendToAddOrRemove) {
HashMap<String, Object> updatedUserData = new HashMap<String, Object>();
/* Update the sharedWith List for this Shopping List */
HashMap<String, User> newSharedWith = new HashMap<String, User>(mSharedUsersList);
if (addFriend) {
/**
+ * Changes the timestamp changed to now; Because of ancestry issues, we cannot
+ * have one updateChildren call that both creates data and then updates that same data
+ * because updateChildren has no way of knowing what was the intended update
+ */
mShoppingList.setTimestampLastChangedToNow();
/* Make it a HashMap of the shopping list and user */
final HashMap<String, Object> shoppingListForFirebase = (HashMap<String, Object>)
new ObjectMapper().convertValue(mShoppingList, Map.class);
final HashMap<String, Object> friendForFirebase = (HashMap<String, Object>)
new ObjectMapper().convertValue(friendToAddOrRemove, Map.class);
//updatedUserData.put(Constants.FIREBASE_LOCATION_LISTS_SHARED_WITH + "/" + mListId + "/" + friendToAddOrRemove.getEmail(), friendForFirebase);
/* Add the friend to the shared list */
updatedUserData.put("/" + Constants.FIREBASE_LOCATION_LISTS_SHARED_WITH + "/" + mListId +
"/" + friendToAddOrRemove.getEmail(), friendForFirebase);
/* Add that shopping list hashmap to the new user's active lists */
updatedUserData.put("/" + Constants.FIREBASE_LOCATION_USER_LISTS + "/" + friendToAddOrRemove.getEmail()
+ "/" + mListId, shoppingListForFirebase);
} else {
/* Remove the friend from the shared list */
updatedUserData.put("/" + Constants.FIREBASE_LOCATION_LISTS_SHARED_WITH + "/" + mListId +
"/" + friendToAddOrRemove.getEmail(), null);
/* Remove the list from the shared friend */
updatedUserData.put("/" + Constants.FIREBASE_LOCATION_USER_LISTS + "/" + friendToAddOrRemove.getEmail()
+ "/" + mListId, null);
newSharedWith.remove(friendToAddOrRemove.getEmail());
//updatedUserData.put(Constants.FIREBASE_LOCATION_LISTS_SHARED_WITH + "/" + mListId + "/" + friendToAddOrRemove.getEmail(), null);
}
Utils.updateMapWithTimestampLastChanged(newSharedWith, mListId, mShoppingList.getOwner(), updatedUserData);
return updatedUserData;
}
@Override
public void cleanup() {
super.cleanup();
/* Clean up the event listeners */
for (HashMap.Entry<Firebase, ValueEventListener> listenerToClean : mLocationListenerMap.entrySet()) {
listenerToClean.getKey().removeEventListener(listenerToClean.getValue());
}
}
} | [
"[email protected]"
] | |
fa22b072ac4e71eb10b2521ddbfc6904e3d1e12d | 013389ae8002e0ac4a9ef38012ef1ae05dffe35d | /src/main/java/com/marcura/cargotracker/web/rest/ProfileInfoResource.java | 7b5632aa5cca30278fe9a6b3e70686a0dbcbd88a | [] | no_license | BulkSecurityGeneratorProject/CargoTracker | 5e4cacbea5ad8a86f59f4e15f1ce28e872cf34b2 | 66d1db8695bc7e82bd9cae76ce19800ae15dd798 | refs/heads/master | 2022-12-12T16:20:40.291992 | 2018-01-26T00:53:32 | 2018-01-26T00:53:32 | 296,637,796 | 0 | 0 | null | 2020-09-18T14:03:35 | 2020-09-18T14:03:35 | null | UTF-8 | Java | false | false | 2,049 | java | package com.marcura.cargotracker.web.rest;
import com.marcura.cargotracker.config.DefaultProfileUtil;
import io.github.jhipster.config.JHipsterProperties;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Resource to return information about the currently running Spring profiles.
*/
@RestController
@RequestMapping("/api")
public class ProfileInfoResource {
private final Environment env;
private final JHipsterProperties jHipsterProperties;
public ProfileInfoResource(Environment env, JHipsterProperties jHipsterProperties) {
this.env = env;
this.jHipsterProperties = jHipsterProperties;
}
@GetMapping("/profile-info")
public ProfileInfoVM getActiveProfiles() {
String[] activeProfiles = DefaultProfileUtil.getActiveProfiles(env);
return new ProfileInfoVM(activeProfiles, getRibbonEnv(activeProfiles));
}
private String getRibbonEnv(String[] activeProfiles) {
String[] displayOnActiveProfiles = jHipsterProperties.getRibbon().getDisplayOnActiveProfiles();
if (displayOnActiveProfiles == null) {
return null;
}
List<String> ribbonProfiles = new ArrayList<>(Arrays.asList(displayOnActiveProfiles));
List<String> springBootProfiles = Arrays.asList(activeProfiles);
ribbonProfiles.retainAll(springBootProfiles);
if (!ribbonProfiles.isEmpty()) {
return ribbonProfiles.get(0);
}
return null;
}
class ProfileInfoVM {
private String[] activeProfiles;
private String ribbonEnv;
ProfileInfoVM(String[] activeProfiles, String ribbonEnv) {
this.activeProfiles = activeProfiles;
this.ribbonEnv = ribbonEnv;
}
public String[] getActiveProfiles() {
return activeProfiles;
}
public String getRibbonEnv() {
return ribbonEnv;
}
}
}
| [
"[email protected]"
] | |
4b20b4da954aba1cde9207d894b5946822518554 | 89e4d31702513680716e7030a21c290b1f4171ae | /src/pojo/Kdysm.java | 69c7ff41e410def6ff4f5f21fc2903c822ff4055 | [] | no_license | zengege/convey | 40418a9ddd8773a22a16b8f71ec5ce8bcd46866a | 7737b6b79727016713f03ed556bcf827cbb51593 | refs/heads/master | 2020-05-20T09:34:11.736490 | 2019-05-08T01:53:27 | 2019-05-08T01:53:27 | 185,503,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,446 | java | package pojo;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.math.BigInteger;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import xiaojiemian.Dizhiqueding;
import xiaojiemian.Scott;
import xiaojiemian.Scottcha;
import xiaojiemian.Tijiaokdsm;
public class Kdysm extends JInternalFrame {
final JPanel panel1 = new JPanel() {
private ImageIcon images;
public void paintComponent(Graphics g) {
images = new ImageIcon(
"images//u=794619075,3505052030&fm=27&gp=0.gif");
Dimension dimension = getSize();
g.drawImage(images.getImage(), 0, 0, dimension.width,
dimension.height, null);
}
};
public static String luxianString;
public static String time1;
public static String pricesumString;
private JLabel wherecom = new JLabel("包裹从哪里来");
private JComboBox<Address> depBoxcom = new JComboBox<Address>();
private JLabel jjrname = new JLabel("寄件人姓名");
private JTextField jjrnameField = new JTextField();
private JLabel jjrtelJLabel = new JLabel("寄件人电话");
private JTextField jjrtelField = new JTextField();
private JLabel chickjlabel1 = new JLabel("");
private JLabel wherego = new JLabel("你想寄到哪里去");
private JComboBox<Address> depBoxgo = new JComboBox<Address>();
private JLabel sjrname = new JLabel("收件人姓名");
private JTextField sjrnameField = new JTextField();
private JLabel sjrtelJLabel = new JLabel("收件人电话");
private JTextField sjrtelField = new JTextField();
static JLabel priceJLabel1 = new JLabel("");
private JLabel chickjlabel2 = new JLabel("");
private JLabel time = new JLabel("期望上门时间");
private JComboBox<Timesm> timeBox = new JComboBox<Timesm>();
private JLabel priceJLabel2 = new JLabel("");
private JLabel weight = new JLabel("类型和重量");
private JComboBox<Sortweight> sortBox = new JComboBox<Sortweight>();
private JComboBox<Weight> weightBox = new JComboBox<Weight>();
private JLabel priceJLabel3 = new JLabel("");
private JLabel protect = new JLabel("保价");
private JComboBox<Baojia> bJComboBox = new JComboBox<Baojia>();
private JLabel priceJLabel4 = new JLabel("");
private JLabel bJLabel1 = new JLabel(
"(温馨提示:1.请按照物品实际情况来填写物品实际价值,快递员上门将会核实。");
private JLabel bJLabel2 = new JLabel("2.运送过程中出现丢失或者破损,会按照物品的实际价值的90%进行赔偿)");
private JLabel inform = new JLabel("留言给快递员");
// private JComboBox<Liuyan> liuyanBox = new JComboBox<Liuyan>();
// private JCheckBox j1=new JCheckBox("缺包装袋");
private JTextField j2 = new JTextField();
private JButton jibaButton = new JButton("确定");
private JButton restButton = new JButton("重置");
StringBuffer ssBuffer = new StringBuffer("");
public Kdysm(final String username, final String password) throws SQLException {
Scottcha dao = new Scottcha();
Scott scott = dao.ahaha(username, password);
String dateString = scott.getZfbdate();
String mima = scott.getZfbdlmima();
int agendar = scott.getZfbgendar();
String identity = scott.getZfbid();
int addressid = scott.getZfbaddressid();
String nameString = scott.getZfbname();
final int num = scott.getZfbnum();
String telString = scott.getZfbtel();
setTitle("快递员上门");
setSize(900, 930);
setLayout(null);
setResizable(false);
setClosable(true);
setIconifiable(true);
wherecom.setBounds(0, 0, 100, 70);
jjrname.setBounds(150, 0, 80, 70);
jjrnameField.setBounds(250, 20, 100, 50);
jjrtelJLabel.setBounds(400, 0, 80, 70);
jjrtelField.setBounds(500, 20, 100, 50);
chickjlabel1.setBounds(630, 20, 50, 50);
depBoxcom.setBounds(700, 30, 80, 30);
wherego.setBounds(0, 100, 100, 70);
sjrname.setBounds(150, 100, 80, 70);
sjrnameField.setBounds(250, 120, 100, 50);
sjrtelJLabel.setBounds(400, 100, 80, 70);
sjrtelField.setBounds(500, 120, 80, 50);
chickjlabel2.setBounds(630, 120, 50, 50);
depBoxgo.setBounds(700, 130, 80, 30);
priceJLabel1.setBounds(800, 100, 30, 70);//
time.setBounds(0, 200, 100, 70);
timeBox.setBounds(150, 220, 150, 30);
priceJLabel1.setBounds(270, 200, 50, 70);//
weight.setBounds(0, 300, 100, 70);
sortBox.setBounds(150, 320, 100, 30);
weightBox.setBounds(300, 320, 100, 30);
priceJLabel1.setBounds(420, 300, 50, 70);//
protect.setBounds(0, 400, 100, 70);
bJComboBox.setBounds(150, 420, 100, 30);
bJLabel1.setBounds(100, 500, 500, 30);
bJLabel2.setBounds(130, 530, 500, 30);
priceJLabel1.setBounds(370, 400, 50, 70);//
inform.setBounds(200, 550, 100, 80);
// liuyanBox.setBounds(100,700,200,50);
j2.setBounds(200, 640, 200, 50);
jibaButton.setBounds(100, 750, 100, 50);
restButton.setBounds(300, 750, 100, 50);
panel1.setBounds(0, 0, 900, 930);
wherecom.setFont(new Font("楷体", 1, 13));
depBoxcom.setFont(new Font("楷体", 1, 13));
jjrname.setFont(new Font("楷体", 1, 13));
jjrnameField.setFont(new Font("楷体", 1, 13));
jjrtelField.setFont(new Font("楷体", 1, 13));
jjrtelJLabel.setFont(new Font("楷体", 1, 13));
wherego.setFont(new Font("楷体", 1, 13));
sjrname.setFont(new Font("楷体", 1, 13));
sjrnameField.setFont(new Font("楷体", 1, 13));
sjrtelField.setFont(new Font("楷体", 1, 13));
sjrtelJLabel.setFont(new Font("楷体", 1, 13));
time.setFont(new Font("楷体", 1, 13));
timeBox.setFont(new Font("楷体", 1, 13));
weight.setFont(new Font("楷体", 1, 13));
weightBox.setFont(new Font("楷体", 1, 13));
sortBox.setFont(new Font("楷体", 1, 13));
protect.setFont(new Font("楷体", 1, 13));
bJComboBox.setFont(new Font("楷体", 1, 13));
bJLabel1.setFont(new Font("楷体", 1, 13));
bJLabel2.setFont(new Font("楷体", 1, 13));
inform.setFont(new Font("楷体", 1, 13));
j2.setFont(new Font("楷体", 1, 13));
jibaButton.setFont(new Font("楷体", 1, 13));
restButton.setFont(new Font("楷体", 1, 13));
depBoxgo.setFont(new Font("楷体", 1, 13));
add(priceJLabel1);
add(priceJLabel2);
add(priceJLabel3);
add(priceJLabel4);
add(jjrname);
add(jjrnameField);
add(jjrtelField);
add(jjrtelJLabel);
add(sjrname);
add(sjrnameField);
add(sjrtelField);
add(sjrtelJLabel);
add(depBoxcom);
add(wherecom);
add(depBoxgo);
add(inform);
add(jibaButton);
add(restButton);
add(bJComboBox);
add(bJLabel1);
add(bJLabel2);
add(protect);
add(sortBox);
add(time);
add(timeBox);
add(weight);
add(weightBox);
add(wherego);
// add(liuyanBox);
add(j2);
// 初始化寄出去的地址下拉列表
{
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1/kuaidi", "root", "admin");
String sql = "select addressid , address from Address";
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Address address = new Address();
address.setAddressid(rs.getInt(1));
address.setAddress(rs.getString(2));
depBoxcom.addItem(address);
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
// 初始化目的地地址下拉列表
{
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1/kuaidi", "root", "admin");
String sql = "select addressid , address from Address";
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Address address = new Address();
address.setAddressid(rs.getInt(1));
address.setAddress(rs.getString(2));
depBoxgo.addItem(address);
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
// 初始化期望时间预定下拉列表
{
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1/kuaidi", "root", "admin");
String sql = "select tmid , howlong from timesm";
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Timesm timesm = new Timesm();
timesm.setTmid(rs.getInt(1));
timesm.setHowlong(rs.getString(2));
timeBox.addItem(timesm);
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
// 初始化寄件类型
{
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1/kuaidi", "root", "admin");
String sql = "select sortid , sort from Sortweight";
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Sortweight sortweight = new Sortweight();
sortweight.setSortid(rs.getInt(1));
sortweight.setSort(rs.getString(2));
sortBox.addItem(sortweight);
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
// 初始化重量下拉列表
{
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1/kuaidi", "root", "admin");
String sql = "select wtid , wtnum from Weight";
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Weight weight = new Weight();
weight.setWtid(rs.getInt(1));
weight.setWtnum(rs.getString(2));
weightBox.addItem(weight);
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
// 初始化保价下拉列表
{
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1/kuaidi", "root", "admin");
String sql = "select bjid , jiazhi from baojia";
PreparedStatement ps = connection.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
Baojia baojia = new Baojia();
baojia.setBjid(rs.getInt(1));
baojia.setJiazhi(rs.getString(2));
bJComboBox.addItem(baojia);
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
// 确定按钮的监听事件
jibaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String jjrnameString = jjrnameField.getText();
String jjrtelString = jjrtelField.getText();
String sjrnameString = sjrnameField.getText();
String sjrtelString = sjrtelField.getText();
String ssString = j2.getText();
Connection connection = null;
Connection connection1 = null;
Connection connection2 = null;
String price2 = null;
String price3 = null;
try {
Class.forName("com.mysql.jdbc.Driver");
connection = DriverManager.getConnection(
"jdbc:mysql://127.0.0.1/kuaidi", "root", "admin");
String mysql = "insert into kdysm(jjrname,jjrtel,sortid,wtid,tmid,bjid,liuyan,sjrname,sjrtel,zfbnum,qishiaddressid,mudiaddressid,newtime,statusid) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?) ";
PreparedStatement ps = connection.prepareStatement(mysql);
ps.setObject(1, jjrnameString);
ps.setObject(5,
((Timesm) timeBox.getSelectedItem()).getTmid());
ps.setObject(2, jjrtelString);
ps.setObject(3, ((Sortweight) sortBox.getSelectedItem())
.getSortid());
ps.setObject(4,
((Weight) weightBox.getSelectedItem()).getWtid());
ps.setObject(6,
((Baojia) bJComboBox.getSelectedItem()).getBjid());
ps.setObject(7, ssString);
ps.setObject(8, sjrnameString);
ps.setObject(9, sjrtelString);
ps.setObject(10, num);
ps.setObject(11, ((Address) depBoxcom.getSelectedItem())
.getAddressid());
ps.setObject(12, ((Address) depBoxgo.getSelectedItem())
.getAddressid());
Date date = new Date();// 得到系统的当前时间
System.out.println(date);
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss");// 参数指的是按照什么样的格式进行格式化
// 格式化
String dateString = sdf.format(date);
ps.setObject(13, dateString);
ps.setObject(14, 0);
System.out.println(ps);
int rs = ps.executeUpdate();
if (rs > 0) {
JOptionPane.showMessageDialog(null, "提交成功!快递员即将上门....");
} else {
JOptionPane.showMessageDialog(null, "提交失败,请重新提交");
}
} catch (Exception e1) {
e1.printStackTrace();
} finally {
try {
connection.close();
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
});
restButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
jjrnameField.setText("");
jjrtelField.setText("");
chickjlabel1.setText("");
sjrnameField.setText("");
sjrtelField.setText("");
chickjlabel2.setText("");
priceJLabel1.setText("");
priceJLabel2.setText("");
priceJLabel3.setText("");
priceJLabel4.setText("");
}
});
// 电话号码的检查
jjrtelField.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
String id = jjrtelField.getText();// 得到用户输入的身份证号码
String regex = "^1[34578]\\d{9}$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(id);
if (matcher.find()) {
chickjlabel1.setText("√");
} else {
chickjlabel1.setText("×");
}
}
});
sjrtelField.addKeyListener(new KeyAdapter() {
public void keyReleased(KeyEvent e) {
String id = sjrtelField.getText();// 得到用户输入的身份证号码
String regex = "^1[34578]\\d{9}$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(id);
if (matcher.find()) {
chickjlabel2.setText("√");
} else {
chickjlabel2.setText("×");
}
}
});
add(panel1);
setVisible(true);
}
}
| [
"[email protected]"
] | |
711b8a58a374599e94b139d8452402522739d914 | 71400933efdf9a74c4a9e526b9b7308c642997ba | /src/View/Form_consultar_prestador.java | b652932fe6c5c3e393dd37d34396e86f174f7b8f | [] | no_license | andrezitojava2017/Sistema-Controle-de-Prestador | 2b31b1b142df13e826541134483ecfbf5b8fae72 | 82b29fec8ec787275384bd94501a9cc625c55a78 | refs/heads/master | 2022-10-20T03:08:11.216221 | 2022-10-05T00:43:51 | 2022-10-05T00:43:51 | 159,515,200 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,709 | 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 View;
import Controller.Pessoas_Controller;
import Model.Pessoas_Model;
import Model.TableBuscarPrestadorAbstract;
import java.util.List;
/**
*
* @author andre
*/
public class Form_consultar_prestador extends javax.swing.JDialog {
TableBuscarPrestadorAbstract tableBuscaPrestador = new TableBuscarPrestadorAbstract();
/**
* Creates new form Form_consultar_prestador
*/
public Form_consultar_prestador(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
tableBusca.setModel(tableBuscaPrestador);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
campoBuscarPrestador = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
btnBuscar = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tableBusca = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Buscar");
campoBuscarPrestador.addInputMethodListener(new java.awt.event.InputMethodListener() {
public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
}
public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
Buscar(evt);
}
});
campoBuscarPrestador.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
BuscarMethod(evt);
}
});
jLabel1.setText("Buscar por:");
btnBuscar.setText("Buscar");
btnBuscar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBuscarActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(campoBuscarPrestador, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31)
.addComponent(btnBuscar)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(campoBuscarPrestador, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)
.addComponent(btnBuscar))
.addContainerGap(22, Short.MAX_VALUE))
);
tableBusca.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null},
{null, null},
{null, null},
{null, null}
},
new String [] {
"PIS/PASEP", "NOME"
}
) {
boolean[] canEdit = new boolean [] {
false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(tableBusca);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 461, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE)
.addContainerGap())
);
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
// TODO add your handling code here:
Pessoas_Controller consultar = new Pessoas_Controller();
List<Pessoas_Model> result = consultar.ConsultarPrestador(campoBuscarPrestador.getText());
consultar.PreencherTabelaConsulta(result, tableBuscaPrestador);
}//GEN-LAST:event_btnBuscarActionPerformed
private void Buscar(java.awt.event.InputMethodEvent evt) {//GEN-FIRST:event_Buscar
// TODO add your handling code here:
Pessoas_Controller consultar = new Pessoas_Controller();
List<Pessoas_Model> result = consultar.ConsultarPrestador(campoBuscarPrestador.getText());
consultar.PreencherTabelaConsulta(result, tableBuscaPrestador);
}//GEN-LAST:event_Buscar
private void BuscarMethod(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_BuscarMethod
// TODO add your handling code here:
Pessoas_Controller consultar = new Pessoas_Controller();
List<Pessoas_Model> result = consultar.ConsultarPrestador(campoBuscarPrestador.getText());
consultar.PreencherTabelaConsulta(result, tableBuscaPrestador);
}//GEN-LAST:event_BuscarMethod
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Form_consultar_prestador.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Form_consultar_prestador.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Form_consultar_prestador.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Form_consultar_prestador.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
Form_consultar_prestador dialog = new Form_consultar_prestador(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnBuscar;
private javax.swing.JTextField campoBuscarPrestador;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tableBusca;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
08733ecc91567af1805e63df81784f06c5a94aa7 | 9a68117c57f813c959bac2cebfd4f2b03e686aa6 | /src/main/java/nl/webservices/www/soap/BusinessGetBIKDescriptionRequestType.java | 920f159c6818d849c26bd96c10222653dd924aca | [] | no_license | mytestrepofolder/cached-soap-webservices | dc394ba2cbabe58aca4516c623f46cf75021e46c | ce29a5e914b2f8e6963ef876d3558c74f0c47103 | refs/heads/master | 2020-12-02T16:22:55.920937 | 2017-07-07T13:55:41 | 2017-07-07T13:55:41 | 96,543,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,748 | java | /**
* BusinessGetBIKDescriptionRequestType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package nl.webservices.www.soap;
public class BusinessGetBIKDescriptionRequestType implements java.io.Serializable {
private java.lang.String bikcode;
public BusinessGetBIKDescriptionRequestType() {
}
public BusinessGetBIKDescriptionRequestType(
java.lang.String bikcode) {
this.bikcode = bikcode;
}
/**
* Gets the bikcode value for this BusinessGetBIKDescriptionRequestType.
*
* @return bikcode
*/
public java.lang.String getBikcode() {
return bikcode;
}
/**
* Sets the bikcode value for this BusinessGetBIKDescriptionRequestType.
*
* @param bikcode
*/
public void setBikcode(java.lang.String bikcode) {
this.bikcode = bikcode;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof BusinessGetBIKDescriptionRequestType)) return false;
BusinessGetBIKDescriptionRequestType other = (BusinessGetBIKDescriptionRequestType) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.bikcode==null && other.getBikcode()==null) ||
(this.bikcode!=null &&
this.bikcode.equals(other.getBikcode())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getBikcode() != null) {
_hashCode += getBikcode().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(BusinessGetBIKDescriptionRequestType.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://www.webservices.nl/soap/", "businessGetBIKDescriptionRequestType"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("bikcode");
elemField.setXmlName(new javax.xml.namespace.QName("http://www.webservices.nl/soap/", "bikcode"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"[email protected]"
] | |
70dfc9bb08a670aa849f8859eeaad2310809d682 | 73f6f24312c3102671b34fa8bb121adc5519c493 | /trainplatform-service/src/main/java/com/bossien/train/service/ICreatePublicProjectService.java | 22d508bbaecd4d7c6ca66f9b52a39c348d34f062 | [] | no_license | RenMingNeng/trainplatform-parent | 95941b66ff38ab7fe5a90e4013f4567051e2492e | 63baaef728b4e7f1e5b9afa2a01b699c2f5ed760 | refs/heads/master | 2021-05-12T17:55:08.457201 | 2018-01-11T05:35:58 | 2018-01-11T05:35:58 | 117,054,915 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 779 | java | package com.bossien.train.service;
import com.bossien.train.domain.User;
import java.util.Map;
/**
* Created by Administrator on 2017-08-03.
*/
public interface ICreatePublicProjectService {
/**
* 公开型项目保存
* @param params
* @param user
*/
void savePublicProject(Map<String, Object> params, User user) throws Exception;
/**
* 公开型项目修改保存
* @param params
* @param user
*/
void updatePublicProject(Map<String, Object> params, User user) throws Exception;
/**
* 修改组卷策略
* @param params
*/
void updateExamStrategy(Map<String, Object> params);
/**
* 公开型项目删除
* @param params
*/
void delete(Map<String, Object> params);
}
| [
"[email protected]"
] | |
f48d0246fc85513eda98656dfa9586ab639ac624 | 40df4983d86a3f691fc3f5ec6a8a54e813f7fe72 | /app/src/main/java/android/support/p015v4/media/session/MediaSessionCompatApi8.java | 32df583ddacc09f2b112a985832437cd5282df2a | [] | no_license | hlwhsunshine/RootGeniusTrunAK | 5c63599a939b24a94c6f083a0ee69694fac5a0da | 1f94603a9165e8b02e4bc9651c3528b66c19be68 | refs/heads/master | 2020-04-11T12:25:21.389753 | 2018-12-24T10:09:15 | 2018-12-24T10:09:15 | 161,779,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package android.support.p015v4.media.session;
import android.content.ComponentName;
import android.content.Context;
import android.media.AudioManager;
/* renamed from: android.support.v4.media.session.MediaSessionCompatApi8 */
class MediaSessionCompatApi8 {
MediaSessionCompatApi8() {
}
public static void registerMediaButtonEventReceiver(Context context, ComponentName componentName) {
((AudioManager) context.getSystemService("audio")).registerMediaButtonEventReceiver(componentName);
}
public static void unregisterMediaButtonEventReceiver(Context context, ComponentName componentName) {
((AudioManager) context.getSystemService("audio")).unregisterMediaButtonEventReceiver(componentName);
}
}
| [
"[email protected]"
] | |
8f9475660eb370579ae9f794c888d02d8f2654aa | 5431ac1e110e25eec0ccb6f68079ac37f425a229 | /sample/src/com/davemorrissey/labs/subscaleview/sample/extension/views/PinView.java | 274e164ba935731f4ac8c09cf6833e2a75a65d70 | [
"Apache-2.0"
] | permissive | netzme/subsampling-scale-image-view | 2144342a619c8e254827fe238d856936aca8e970 | e22c8912d33ca44bf3a18be687023d0157cf3588 | refs/heads/master | 2021-01-15T16:56:49.666917 | 2018-02-27T06:34:02 | 2018-02-27T06:34:02 | 33,581,120 | 0 | 1 | Apache-2.0 | 2018-02-27T06:29:59 | 2015-04-08T02:53:27 | Java | UTF-8 | Java | false | false | 2,263 | java | /*
Copyright 2014 David Morrissey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.davemorrissey.labs.subscaleview.sample.extension.views;
import android.content.Context;
import android.graphics.*;
import android.util.AttributeSet;
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import com.davemorrissey.labs.subscaleview.sample.R.drawable;
public class PinView extends SubsamplingScaleImageView {
private PointF sPin;
private Bitmap pin;
public PinView(Context context) {
this(context, null);
}
public PinView(Context context, AttributeSet attr) {
super(context, attr);
initialise();
}
public void setPin(PointF sPin) {
this.sPin = sPin;
initialise();
invalidate();
}
public PointF getPin() {
return sPin;
}
private void initialise() {
float density = getResources().getDisplayMetrics().densityDpi;
pin = BitmapFactory.decodeResource(this.getResources(), drawable.pushpin_blue);
float w = (density/420f) * pin.getWidth();
float h = (density/420f) * pin.getHeight();
pin = Bitmap.createScaledBitmap(pin, (int)w, (int)h, true);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// Don't draw pin before image is ready so it doesn't move around during setup.
if (!isReady()) {
return;
}
Paint paint = new Paint();
paint.setAntiAlias(true);
if (sPin != null && pin != null) {
PointF vPin = sourceToViewCoord(sPin);
float vX = vPin.x - (pin.getWidth()/2);
float vY = vPin.y - pin.getHeight();
canvas.drawBitmap(pin, vX, vY, paint);
}
}
}
| [
"[email protected]"
] | |
f839ba37c203e8027ce4ad05d2ff8d4f7af74897 | ad75ebb9dfa155c0c021f0700d982a6a9ee167e2 | /src/main/java/com/logonovo/stock/parse/AbstractParseClass.java | 9c05186d22b39f55d3caa2bac6c8a36f66b8da72 | [
"MIT"
] | permissive | dongtianqi1125/stock-2 | 9eb7933546d257e9a582c7894c52035468ac3700 | 01205a3b9b3fb7a5bfd300a27ff34bb204f3bc38 | refs/heads/master | 2020-04-26T22:12:28.322018 | 2017-10-28T14:49:27 | 2017-10-28T14:49:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,084 | java | package com.logonovo.stock.parse;
import com.logonovo.stock.model.AssertRatio;
import com.logonovo.stock.model.Base;
import com.logonovo.stock.model.Rate;
import com.logonovo.stock.utils.DateUtil;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.time.LocalDate;
import java.time.Month;
import java.util.ArrayList;
import java.util.List;
/**
* @Author 小凡
* Email: [email protected]
* @Date 2017/10/20 19:56
*/
public abstract class AbstractParseClass<T extends Base> {
protected Document doc;
protected String code;
public List<T> parse(Document doc,Class<T> clazz, String code){
this.doc = doc;
this.code = code;
Elements elements = getElements(doc);
List<T> target = getTargets(clazz, elements);
return target;
}
private List<T> getTargets(Class<T> clazz, Elements elements) {
List<T> target = new ArrayList<>();
for (int i = 0; i < elements.size(); i++) {
Element tr = elements.get(i);
Elements tds = tr.select("td");
for (int j = 1; j < tds.size(); j++) {
T obj = null;
if (target.size() <= j - 1) {
obj = newTclass(clazz);
target.add(obj);
} else {
obj = target.get(j - 1);
}
obj.setCode(code);
if(j == 1){
obj.setYear(DateUtil.LocalDateToUdate(LocalDate.of(2012, Month.JANUARY, 01)));
}else if(j == 2){
obj.setYear(DateUtil.LocalDateToUdate(LocalDate.of(2013, Month.JANUARY, 01)));
}else if(j == 3){
obj.setYear(DateUtil.LocalDateToUdate(LocalDate.of(2014, Month.JANUARY, 01)));
}else if(j == 4){
obj.setYear(DateUtil.LocalDateToUdate(LocalDate.of(2015, Month.JANUARY, 01)));
}else if(j == 5){
obj.setYear(DateUtil.LocalDateToUdate(LocalDate.of(2016, Month.JANUARY, 01)));
}
String text = tds.get(j).text();
Double value = null;
if (text != null) {
if("--".equals(text)){
value = 0.0;
}else {
if(text.contains("(")){
text = "-"+text.replaceAll("\\(","").replaceAll("\\)","");
}
text = text.replaceAll(",","");
value = Double.parseDouble(text);
}
}
setObjectValue(i, obj, value);
}
}
return target;
}
protected abstract Elements getElements(Document doc);
private static <T> T newTclass(Class<T> clazz){
try {
T a=clazz.newInstance();
return a;
} catch (Exception e) {
}
return null;
}
protected abstract void setObjectValue(int i, T obj, Double value);
}
| [
"[email protected]"
] | |
e6338f3a814fa4b13740a815350cd8d64feed1d2 | 3185ed07569e3687a24bc515d390e7f0cc748cec | /hu.bme.mit.inf.gs.workflow.model/src/main/java/hu/bme/mit/inf/gs/workflow/buyapp/BuyAppProcess.java | d6c2db780da3dcd04e275d32694dc51c02fdd0aa | [
"MIT"
] | permissive | darvasd/gsoaarchitect | 6080e3890c66c59963f8aa571d023d2e530770f9 | ff98b09fac9391395be6a75c22aced542630bd8f | refs/heads/master | 2021-01-01T16:50:48.826332 | 2015-03-14T18:50:33 | 2015-03-14T18:50:33 | 32,224,585 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,425 | java | package hu.bme.mit.inf.gs.workflow.buyapp;
import hu.bme.mit.inf.gs.workflow.buyapp.helpers.AddApplicationToUserWorkItemHandler;
import hu.bme.mit.inf.gs.workflow.buyapp.helpers.CheckApplicationPriceWorkItemHandler;
import hu.bme.mit.inf.gs.workflow.buyapp.helpers.CreditTransactionWorkItemHandler;
import hu.bme.mit.inf.gs.workflow.buyapp.helpers.CreditTransactionsWorkItemHandler;
import hu.bme.mit.inf.gs.workflow.buyapp.helpers.GetOperatorUsernameWorkItemHandler;
import java.util.HashMap;
import java.util.Map;
import org.drools.KnowledgeBase;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;
public class BuyAppProcess {
public static void startProcess(String buyerName, Integer appID, String appRepoURI, String CreditManager, String UserManager) throws Exception {
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.getWorkItemManager().registerWorkItemHandler("CheckApplicationPrice", new CheckApplicationPriceWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("AddApplicationToUser", new AddApplicationToUserWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("CreditTransactionCollection", new CreditTransactionsWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("CreditTransaction", new CreditTransactionWorkItemHandler());
ksession.getWorkItemManager().registerWorkItemHandler("GetOperator", new GetOperatorUsernameWorkItemHandler());
System.out.println("Starting buyapp...");
Map<String, Object> params = new HashMap<String, Object>();
params.put("buyerName", buyerName);
params.put("applicationID", appID);
params.put("appRepositoryURI", appRepoURI + "/");
params.put("creditManagerURI", CreditManager + "/");
params.put("userManagerURI", UserManager + "/");
ksession.startProcess("hu.bme.mit.inf.gs.workflow.buyapp", params);
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("buyapp.bpmn"), ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
} | [
"[email protected]@6045f8f4-8255-5c3e-d7ec-fc5b50a9ea1d"
] | [email protected]@6045f8f4-8255-5c3e-d7ec-fc5b50a9ea1d |
7e2d949f69f3180bcf5ed1614b3655f3a4a0971e | 2d8a25db09f853b6f09fe54d4294d7179ebc0dad | /WoodWorker.java | 85a3a723ddf00b359fdb9a889e5a29096659722d | [] | no_license | zahmed333/Object-Orientated-Practice | 16ea71853e0a5cbb3ee907294eaca3176d90e937 | 61a76622cf7e1842b61a215067719248f492d1db | refs/heads/main | 2023-06-15T08:18:18.523398 | 2021-07-20T00:41:02 | 2021-07-20T00:41:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 785 | java | import java.util.*;
import java.lang.Math;
public class WoodWorker extends Worker {
private int avgWood;
public WoodWorker(String name, int avgWood) {
super(name);
if (avgWood < 40) {
this.avgWood = 40;
}
else {
this.avgWood = avgWood;
}
}
public WoodWorker(String name) {
super(name);
this.avgWood = 40;
}
public String toString() {
String result = super.toString();
return "[Wood Worker] " + result + "! (avg logs/day: " + avgWood + ")";
}
public int work() {
int mood = getCurrentMood();
int tired = (int) (avgWood * .75);
int pumped = (int) (avgWood * 1.25);
if (mood == 0) {
return tired;
}
else if (mood == 1) {
return avgWood;
}
else {
return pumped;
}
}
} | [
"[email protected]"
] | |
a47e52dc417d67567a02c023b989552375880272 | eb9cf71429c902dc7e363608fd1b64b9d5aeed5c | /src/main/java/helpers/DriverFactory.java | 92e393ceeb7e9559a5b2b96922179f1b16d06565 | [] | no_license | chitturi/KneatCoding | 64a3e5b9c5e9f805bca9fb0ff6b4fa508b29eadf | 54a619004579ef47b3c3a78ff583e07426b41b11 | refs/heads/master | 2022-12-20T03:47:21.671677 | 2020-10-03T10:39:53 | 2020-10-03T10:39:53 | 300,853,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,722 | java | package helpers;
import org.apache.commons.lang.SystemUtils;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.util.concurrent.TimeUnit;
public class DriverFactory {
private static DriverFactory instance = null;
static ThreadLocal<WebDriver> webDriver = new ThreadLocal<WebDriver>();
private DriverFactory() {
}
public static DriverFactory getInstance() {
if (instance == null) {
instance = new DriverFactory();
}
return instance;
}
public static WebDriver createDriverInstance(String browser) throws Exception {
WebDriver driver = null;
DesiredCapabilities caps = null;
switch (browser) {
case "chrome":
caps = DesiredCapabilities.chrome();
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_LINUX)
{
System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir") + "//chromedriver//chromedriver");
}else
{
System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir") + "\\chromedriver\\chromedriver.exe");
}
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().deleteAllCookies();
break;
case "firefox":
caps = DesiredCapabilities.firefox();
if (SystemUtils.IS_OS_MAC || SystemUtils.IS_OS_LINUX)
{
System.setProperty("webdriver.gecko.driver",System.getProperty("user.dir") + "//firefoxdriver//geckodriver");
}else
{
System.setProperty("webdriver.gecko.driver",System.getProperty("user.dir") + "\\firefoxdriver\\geckodriver.exe");
}
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().deleteAllCookies();
break;
case "IE11":
caps = DesiredCapabilities.edge();
System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir") + "//IEDriver//IEDriverdriverServer");
driver = new InternetExplorerDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().deleteAllCookies();
break;
default:
throw new Exception("Cant instantiate Webdriver");
}
return driver;
}
public static void setDriver(WebDriver driverParam)
{
webDriver.set(driverParam);
}
public WebDriver getDriver() {
return webDriver.get();
}
public void removeDriver() {
try {
webDriver.get().quit();
webDriver.remove();
} catch(Exception e)
{
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
d416c5c52321adaf97795585d5d633c56d41d3b5 | b9dc695efaef18f1d0ef985464eeb56a564dd8d3 | /src/network/model/Set.java | c113a8724b9d747349de85ed08e7f4a69e659462 | [] | no_license | Hackness/simplenneuralnetwork4j | ea89a89571d7016dd136de72f1d8535fb576fe58 | fd2e3d6d7a87ecf1aa3c41239a7b42026f00ea07 | refs/heads/master | 2021-01-22T18:33:45.383484 | 2017-08-19T04:03:16 | 2017-08-19T04:03:16 | 100,767,694 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package network.model;
import com.sun.istack.internal.NotNull;
import com.sun.istack.internal.Nullable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Created by Hack
* Date: 16.08.2017 7:37
*/
public class Set {
private final List<Double> inputValues;
private final List<Double> resultValues;
public Set(@NotNull Double[] input, @Nullable Double[] result) {
inputValues = new ArrayList<>(Arrays.asList(input));
resultValues = result != null ? new ArrayList<>(Arrays.asList(result)) : null;
}
public List<Double> getInputValues() {
return inputValues;
}
public List<Double> getResultValues() {
return resultValues;
}
}
| [
"[email protected]"
] | |
f18f2c30fbd71eacd654c647b120ce4d01776e2e | 101759fa957bb5911b714a0d73b0b90712bf7f9d | /src/main/java/monero/wallet/model/MoneroTransfer.java | 98b147c7adf7a76d730f2d709e2f6cde4cb86d4d | [
"MIT",
"Apache-2.0"
] | permissive | coinext/monero-java-rpc | 2f50c26eed535fcf11cfc291087d8d6ffc2fff52 | 2b6d887ec3770e7987617ae8165e31d0c6a6247f | refs/heads/master | 2022-01-20T09:50:21.780992 | 2019-07-21T18:50:17 | 2019-07-21T18:50:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,824 | java | package monero.wallet.model;
import java.math.BigInteger;
import com.fasterxml.jackson.annotation.JsonBackReference;
import monero.utils.MoneroUtils;
/**
* Models a base transfer of funds to or from the wallet.
*/
public class MoneroTransfer {
private MoneroTxWallet tx;
private BigInteger amount;
private Integer accountIndex;
private Integer numSuggestedConfirmations;
public MoneroTransfer() {
// nothing to initialize
}
public MoneroTransfer(MoneroTransfer transfer) {
this.amount = transfer.amount;
this.accountIndex = transfer.accountIndex;
this.numSuggestedConfirmations = transfer.numSuggestedConfirmations;
}
@JsonBackReference
public MoneroTxWallet getTx() {
return tx;
}
public MoneroTransfer setTx(MoneroTxWallet tx) {
this.tx = tx;
return this;
}
public Boolean getIsOutgoing() {
return !getIsIncoming();
}
public Boolean getIsIncoming() {
throw new RuntimeException("Subclass must implement");
}
public BigInteger getAmount() {
return amount;
}
public MoneroTransfer setAmount(BigInteger amount) {
this.amount = amount;
return this;
}
public Integer getAccountIndex() {
return accountIndex;
}
public MoneroTransfer setAccountIndex(Integer accountIndex) {
this.accountIndex = accountIndex;
return this;
}
/**
* Return how many confirmations till it's not economically worth re-writing the chain.
* That is, the number of confirmations before the transaction is highly unlikely to be
* double spent or overwritten and may be considered settled, e.g. for a merchant to trust
* as finalized.
*
* @return Integer is the number of confirmations before it's not worth rewriting the chain
*/
public Integer getNumSuggestedConfirmations() {
return numSuggestedConfirmations;
}
public MoneroTransfer setNumSuggestedConfirmations(Integer numSuggestedConfirmations) {
this.numSuggestedConfirmations = numSuggestedConfirmations;
return this;
}
public MoneroTransfer copy() {
return new MoneroTransfer(this);
}
/**
* Updates this transaction by merging the latest information from the given
* transaction.
*
* Merging can modify or build references to the transfer given so it
* should not be re-used or it should be copied before calling this method.
*
* @param transfer is the transfer to merge into this one
*/
public MoneroTransfer merge(MoneroTransfer transfer) {
assert(transfer instanceof MoneroTransfer);
if (this == transfer) return this;
// merge txs if they're different which comes back to merging transfers
if (this.getTx() != transfer.getTx()) {
this.getTx().merge(transfer.getTx());
return this;
}
// otherwise merge transfer fields
this.setAccountIndex(MoneroUtils.reconcile(this.getAccountIndex(), transfer.getAccountIndex()));
// TODO monero core: failed tx in pool (after testUpdateLockedDifferentAccounts()) causes non-originating saved wallets to return duplicate incoming transfers but one has amount/numSuggestedConfirmations of 0
if (this.getAmount() != null && transfer.getAmount() != null && !this.getAmount().equals(transfer.getAmount()) && (BigInteger.valueOf(0).equals(this.getAmount()) || BigInteger.valueOf(0).equals(transfer.getAmount()))) {
this.setAmount(MoneroUtils.reconcile(this.getAmount(), transfer.getAmount(), null, null, true));
this.setNumSuggestedConfirmations(MoneroUtils.reconcile(this.getNumSuggestedConfirmations(), transfer.getNumSuggestedConfirmations(), null, null, true));
System.out.println("WARNING: failed tx in pool causes non-originating wallets to return duplicate incoming transfers but with one amount/numSuggestedConfirmations of 0");
} else {
this.setAmount(MoneroUtils.reconcile(this.getAmount(), transfer.getAmount()));
this.setNumSuggestedConfirmations(MoneroUtils.reconcile(this.getNumSuggestedConfirmations(), transfer.getNumSuggestedConfirmations(), null, null, false)); // TODO monero-wallet-rpc: outgoing txs become 0 when confirmed
}
return this;
}
public String toString() {
return toString(0);
}
public String toString(int indent) {
StringBuilder sb = new StringBuilder();
sb.append(MoneroUtils.kvLine("Amount", this.getAmount() != null ? this.getAmount().toString() : null, indent));
sb.append(MoneroUtils.kvLine("Account index", this.getAccountIndex(), indent));
sb.append(MoneroUtils.kvLine("Num suggested confirmations", getNumSuggestedConfirmations(), indent));
String str = sb.toString();
return str.substring(0, str.length() - 1);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((accountIndex == null) ? 0 : accountIndex.hashCode());
result = prime * result + ((amount == null) ? 0 : amount.hashCode());
result = prime * result + ((numSuggestedConfirmations == null) ? 0 : numSuggestedConfirmations.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
MoneroTransfer other = (MoneroTransfer) obj;
if (accountIndex == null) {
if (other.accountIndex != null) return false;
} else if (!accountIndex.equals(other.accountIndex)) return false;
if (amount == null) {
if (other.amount != null) return false;
} else if (!amount.equals(other.amount)) return false;
if (numSuggestedConfirmations == null) {
if (other.numSuggestedConfirmations != null) return false;
} else if (!numSuggestedConfirmations.equals(other.numSuggestedConfirmations)) return false;
return true;
}
}
| [
"[email protected]"
] | |
d3f0641ccb6ad8457f65f03be44d53c88f101f70 | 9099901f3edfc44aab82b9eb87a030f6088ab352 | /app/src/main/java/com/remon/books/Set_nickname.java | 51b68dd918961a9a930defa5b71696a698a04ef1 | [] | no_license | superphs333/Books_ | 65c09f027350724ab942b27d32e62cadea8470f8 | c2ebcd123316d53bd05717d680606cf91fd881b3 | refs/heads/master | 2023-05-05T06:06:40.431746 | 2021-05-17T15:38:17 | 2021-05-17T15:38:17 | 324,981,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,366 | java | package com.remon.books;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.remon.books.Function.Function_Set;
import com.remon.books.Function.Function_SharedPreference;
import java.util.HashMap;
import java.util.Map;
public class Set_nickname extends AppCompatActivity {
Context context;
Activity activity;
EditText edit_nick;
TextView txt_nick_info;
Button btn_nick_chk;
Function_Set function_set;
Function_SharedPreference fs;
// 닉네임 중복체크
boolean nick_no_double = false;
// login 정보
String login_value,profile_url;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_set_nickname);
/*
뷰연결
*/
context = getApplicationContext();
activity = this;
edit_nick = findViewById(R.id.edit_nick);
txt_nick_info = findViewById(R.id.txt_nick_info);
btn_nick_chk = findViewById(R.id.btn_nick_chk);
// 함수 모음 객체
function_set = new Function_Set(context);
fs = new Function_SharedPreference(context);
fs.context = context;
/*
Intent로 부터 값 받아오기(login_value, profile_url)
*/
login_value = getIntent().getStringExtra("login_value");
profile_url = getIntent().getStringExtra("profile_url");
/*
중복확인 후에,
닉네임 입력칸(edit_nick)에 입력값이 있을 경우
중복확인을 다시 해줘야 한다
*/
edit_nick.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if(nick_no_double==true){
txt_nick_info.setText("중복확인 문구");
nick_no_double = false;
} // end if
} // end afterTextChanged
}); // end edit_nick.addTextChangedListener
}
public void Check_Nick_Double(View view) {
// 입력값
String Nick = edit_nick.getText().toString();
// 닉네임 적합성 판단
if(!function_set.validate_Nick(Nick)){
Toast.makeText(getApplicationContext()
, "닉네임이 적절하지 않습니다",Toast.LENGTH_LONG).show();
return;
}
// 중복체크
function_set.input = Nick;
function_set.chk_double(new Function_Set.VolleyCallback() {
@Override
public void onSuccess(String result) {
// 결과값이 unable인 경우 -> 함수 빠져나오기
if(result.equals("unable")){
txt_nick_info.setText("사용 불가능한 닉네임입니다");
nick_no_double = false;
return;
}
// 중복확인 문구 변경해주기
txt_nick_info.setText("사용 가능한 닉네임입니다");
nick_no_double = true;
}
}, "nickname");
} // end Check_Nick_Double
// 회원가입
public void sign_up(View view) {
// 만약, nick_no_double = false인 경우 toast하고 함수 빠져나오기)
if(nick_no_double==false){
Toast.makeText(getApplicationContext()
, "닉네임을 확인해 주세요",Toast.LENGTH_LONG).show();
return;
}
// 닉네임
final String nickname = edit_nick.getText().toString();
// 웹페이지 실행하기
String url = getString(R.string.server_url)+"signup_google_chk.php";
StringRequest request = new StringRequest(
Request.Method.POST,
url,
new com.android.volley.Response.Listener<String>() { // 정상 응답
@Override
public void onResponse(String response) {
Log.d("실행","response=>"+response);
// 성공인경우
if(response.equals("success")){
Toast.makeText(getApplicationContext()
, "회원가입이 완료되었습니다",Toast.LENGTH_LONG).show();
// Shared에 회원 Unique_Value 저장
fs.setPreference("member","login_value",login_value);
// shared에 google로 로그인 했다는 것 저장
fs.setPreference("member","platform_type","google");
// 페이지 이동
Intent intent = new Intent(context,Main.class);
finish();
startActivity(intent);
}else{
Toast.makeText(getApplicationContext()
, "죄송합니다. 오류가 발생하였습니다. 다시 시도해 주세요",Toast.LENGTH_LONG).show();
}
}
},
new com.android.volley.Response.ErrorListener() { // 에러 발생
@Override
public void onErrorResponse(VolleyError error) {
Log.d("실행","error=>"+error.getMessage());
}
}
){ // Post 방식으로 body에 요청 파라미터를 넣어 전달하고 싶을 경우
// 만약 헤더를 한 줄 추가하고 싶다면 getHeaders() override
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("login_value", login_value);
params.put("profile_url", profile_url);
params.put("nickname", nickname);
return params;
}
};
// 요청 객체를 만들었으니 이제 requestQueue 객체에 추가하면 됨.
// Volley는 이전 결과를 캐싱하므로, 같은 결과가 있으면 그대로 보여줌
// 하지만 아래 메소드를 false로 set하면 이전 결과가 있더라도 새로 요청해서 응답을 보여줌.
request.setShouldCache(false);
AppHelper.requestQueue = Volley.newRequestQueue(context);
AppHelper.requestQueue.add(request);
} // end sign_up
}
| [
"[email protected]"
] | |
cfefc95f84eb28adac079fcd4cbbfc19f0210090 | 6ad53f3975e736658716ffa3c567097fbac83bc7 | /src/main/java/com/demo/imooc/example/aqs/SemaphoreExample3.java | 24dca252ca0af4ddb06b3aab85ce183d103c534f | [
"MIT"
] | permissive | ZhangJin1988/juc | c07c38e2a4beb3d3df1c3af246ea52d327ae1197 | b2998a239ec77922d2daaad580cd0be49b4b8014 | refs/heads/master | 2021-01-21T21:00:48.525437 | 2018-05-02T10:09:03 | 2018-05-02T10:09:03 | 92,299,227 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,151 | java | package com.demo.imooc.example.aqs;
import lombok.extern.slf4j.Slf4j;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
@Slf4j
public class SemaphoreExample3 {
private final static int threadCount = 20;
public static void main(String[] args) throws Exception {
ExecutorService exec = Executors.newCachedThreadPool();
final Semaphore semaphore = new Semaphore(3);
for (int i = 0; i < threadCount; i++) {
final int threadNum = i;
exec.execute(() -> {
try {
if (semaphore.tryAcquire()) { // 尝试获取一个许可
test(threadNum);
semaphore.release(); // 释放一个许可
}
} catch (Exception e) {
log.error("exception", e);
}
});
}
exec.shutdown();
}
private static void test(int threadNum) throws Exception {
log.info("{}", threadNum);
Thread.sleep(1000);
}
}
| [
"[email protected]"
] | |
e923430b652b83601574afa5b62a1fe1bd11e076 | e0e09e59670dd5067c94cd1d393e9d737725d49f | /src/main/java/fist_week/Datetime.java | d543ebbc9c6523911e0883558fdecff62a0e57c0 | [] | no_license | qq252223804/javaProject | 0eae2a1e1f3a1ef7bbdee5e2cf6ebdaf381426b9 | 56e83a307e4e594c0dba0292532a228aa4079eb8 | refs/heads/master | 2020-07-01T15:50:44.249862 | 2020-04-29T11:46:55 | 2020-04-29T11:46:55 | 201,216,529 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 929 | java | package fist_week;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class Datetime {
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static String format(Date time) {
return sdf.format(time);
}
public static void main(String[] args) {
Calendar c = Calendar.getInstance();
Date now = c.getTime();
// 当前日期
System.out.println("当前日期:\t" + format(c.getTime()));
// 下个月的今天
c.setTime(now);
c.add(Calendar.MONTH, 1);
System.out.println("下个月的今天:\t" +format(c.getTime()));
// 去年的今天
c.setTime(now);
c.add(Calendar.YEAR, -1);
System.out.println("去年的今天:\t" +format(c.getTime()));
// 上个月的第三天
c.setTime(now);
c.add(Calendar.MONTH, -1);
c.set(Calendar.DATE, 3);
System.out.println("上个月的第三天:\t" +format(c.getTime()));
}
}
| [
"[email protected]"
] | |
2f5d81a6c3b3e8c67ce926c143a528b12b30d5d3 | 296daac12ef35cbb9d11319d5a4dbbda43b30d08 | /src/main/java/com/nahalit/nahalapimanager/repository/RlItemSizeRepository.java | 707221f5dbde5dc1c77024f03ffe1d56661c431d | [] | no_license | badrulme/accounts-management-system | fb6ac41388e96043026168f911b36b5ebc4f6679 | 62fcd451c5ff8c3c7a8cfac040caedb9b103c950 | refs/heads/master | 2022-06-23T19:51:07.610707 | 2020-03-14T17:55:22 | 2020-03-14T17:55:22 | 261,062,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 599 | java | package com.nahalit.nahalapimanager.repository;
import com.nahalit.nahalapimanager.model.RlItemSize;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Repository
public interface RlItemSizeRepository extends JpaRepository<RlItemSize, Long> {
@Query("SELECT S FROM RlItemSize S WHERE PROJECT_NO=:PROJECT_NO")
List<RlItemSize> getAllByProjectNo(@RequestParam("PROJECT_NO") Long PROJECT_NO);
}
| [
"[email protected]"
] | |
4e71597a4ce79045f4efefccff8d4ca56b0d1e54 | cf69cd662bbf03b3a809d75790c3feb6c8ba2ac0 | /Photos38/src/model/Session.java | 08223819ec7d6a3686e9ea665cf74545fac533f5 | [] | no_license | dparth12/photoLibrary | 8cfdd89a42a6484a68b708726f9e6f7585949a0b | 7e2b15c1525c62a273e832b800fe3f87b23be4e3 | refs/heads/master | 2020-06-20T01:07:53.996390 | 2019-07-15T06:41:43 | 2019-07-15T06:41:43 | 196,938,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,684 | java | package model;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.ArrayList;
import application.Main;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import view.LoginController;
import view.SearchPageController;
public class Session implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
User currUser;
ArrayList<User> allUsers;
static boolean isAdmin = false;
// used for serialization
public final static String storeName = "data/storage.dat";
public Session() {
allUsers = new ArrayList<>();
}
// serializes list of all users to the file
public void writeApp() throws IOException {
ObjectOutputStream outStream = new ObjectOutputStream(new FileOutputStream(storeName));
outStream.writeObject(this);
}
public static Session readApp() throws FileNotFoundException, IOException, ClassNotFoundException {
ObjectInputStream inStream = new ObjectInputStream(new FileInputStream(storeName));
Session newSession = (Session)inStream.readObject();
return newSession;
}
public ArrayList<User> getUsers() {
return allUsers;
}
public User getUser(String username) {
for (User item:allUsers) {
if (item.getUsername().equals(username)) {
return item;
}
}
return null;
}
public User getCurrUser() {
return currUser;
}
public void setUser(User user) {
currUser = user;
}
public void addUser(User user) {
allUsers.add(user);
}
public void delete(User user) {
allUsers.remove(user);
}
public void login() {
}
public void logout(Stage stage) throws Exception {
writeApp();
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("/view/LoginPage.fxml"));
AnchorPane root;
root = (AnchorPane) loader.load();
LoginController controller = loader.getController();
controller.start(stage);
Scene searchPageScene = new Scene(root,800,800);
stage.setScene(searchPageScene);
}
public void quit() throws Exception {
writeApp();
Platform.exit();
}
public boolean usernameExists(String username) {
for (User item:allUsers) {
if (item.getUsername().equals(username)) {
return true;
}
}
return false;
}
public void setAdmin(boolean value) {
isAdmin = value;
}
}
| [
"[email protected]"
] | |
2947016833baaf6413162c70fce3606fad8f5ffe | 55333580fafb50e292a4f9f166ef54d1de36b06f | /mantis-tests/src/test/java/training/pft/mantis/appmaneger/ApplicationManager.java | ef96e37b024fc89c8244515c5e4ba62605479f79 | [
"Apache-2.0"
] | permissive | drums013/jft_46 | f11624d21786cde906e7c544ff18df091cd5fd31 | 8322562e5900b26cf57f0ee0582d70196449f50e | refs/heads/master | 2021-09-15T01:36:36.191755 | 2018-05-23T13:50:32 | 2018-05-23T13:50:32 | 107,447,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,817 | java | package training.pft.mantis.appmaneger;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.BrowserType;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
public class ApplicationManager {
private final Properties properties;
private WebDriver wd;
private String browser;
private RegistrationHelper registrationHelper;
private FtpHelper ftp;
private MailHelper mailHelper;
private JamesHelper jamesHelper;
private UserHelper userHelper;
private DbHelper dbHelper;
private SoapHelper soapHelper;
public ApplicationManager(String browser){
this.browser = browser;
properties = new Properties();
}
public void init() throws IOException {
String target = System.getProperty("target", "local");
properties.load(new FileReader(new File(String.format("src/test/resources/%s.properties", target))));
dbHelper = new DbHelper();
}
public void stop() {
if (wd != null) {
wd.quit();
}
}
public HttpSession newSession() {
return new HttpSession(this);
}
public String getProperty(String key) {
return properties.getProperty(key);
}
public RegistrationHelper registration() {
if (registrationHelper == null) {
registrationHelper = new RegistrationHelper(this);
}
return registrationHelper;
}
public FtpHelper ftp() {
if (ftp == null) {
ftp = new FtpHelper(this);
}
return ftp;
}
public WebDriver getDriver() {
if (wd == null){
if (browser.equals(BrowserType.FIREFOX)) {
wd = new FirefoxDriver(new FirefoxOptions().setLegacy(true));
} else if (browser.equals(BrowserType.CHROME)) {
wd = new ChromeDriver();
} else if (browser.equals(BrowserType.IE)) {
wd = new InternetExplorerDriver();
}
wd.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS);
wd.get(properties.getProperty("web.baseUrl"));
}
return wd;
}
public MailHelper mail(){
if (mailHelper == null) {
mailHelper = new MailHelper(this);
}
return mailHelper;
}
public JamesHelper james(){
if(jamesHelper == null){
jamesHelper = new JamesHelper(this);
}
return jamesHelper;
}
public UserHelper user(){
if (userHelper == null) {
userHelper = new UserHelper(this);
}
return userHelper;
}
public DbHelper db() {
return dbHelper;
}
public SoapHelper soap(){
if (soapHelper == null){
soapHelper = new SoapHelper(this);
}
return soapHelper;
}
}
| [
"[email protected]"
] | |
78b4d260e9a95a94d03c93343189912f93adea62 | 307cd62505fb6936fd694edabdfd25b3026ef2a7 | /Instantiable/Data/Immutable/ImmutableArray.java | bb2542821cd7d5ccfdce96d6bb4f3d0ed7c51073 | [] | no_license | yet-another-account/DragonAPI | abc240ba53184748743d546ee5cb762b708e7918 | f6197d115b95955c507ef0023c16613e9a3140ad | refs/heads/master | 2021-05-28T21:52:23.776189 | 2015-02-18T02:16:43 | 2015-02-18T02:16:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | /*******************************************************************************
* @author Reika Kalseki
*
* Copyright 2015
*
* All rights reserved.
* Distribution of the software in any form is only allowed with
* explicit, prior permission from the owner.
******************************************************************************/
package Reika.DragonAPI.Instantiable.Data.Immutable;
public class ImmutableArray<V> {
private final V[] data;
public final int length;
public ImmutableArray(V[] arr) {
data = arr;
this.length = arr.length;
}
public V get(int i) {
return data[i];
}
}
| [
"[email protected]"
] | |
bd0861d2840ad15a901efb3b9b4aa3379d9f45a8 | 48acbf8ce2064fe0de2bcdd0615a06283393055d | /src/main/java/com/spring/templates/domain/Ingredient.java | 74c097f2ab49b5f0b8ec0720663b7d3f68a099f9 | [] | no_license | kgromov/spring-with-jmh | 9285aa4f1f6d3e46e15ecc89c7f2092d5f87c2b8 | 7d32440139db0c8f98792c2b75a5562fa2c3d74e | refs/heads/master | 2023-03-26T00:00:29.550525 | 2021-03-27T19:50:41 | 2021-03-27T19:50:41 | 352,163,063 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,012 | java | package com.spring.templates.domain;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import java.math.BigDecimal;
/**
* Created by jt on 6/13/17.
*/
@Getter
@Setter
@EqualsAndHashCode(exclude = {"recipe"})
@Entity
public class Ingredient {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String description;
private BigDecimal amount;
@OneToOne(fetch = FetchType.EAGER)
private UnitOfMeasure uom;
@ManyToOne
private Recipe recipe;
public Ingredient() {
}
public Ingredient(String description, BigDecimal amount, UnitOfMeasure uom) {
this.description = description;
this.amount = amount;
this.uom = uom;
}
public Ingredient(String description, BigDecimal amount, UnitOfMeasure uom, Recipe recipe) {
this.description = description;
this.amount = amount;
this.uom = uom;
this.recipe = recipe;
}
}
| [
"[email protected]"
] | |
de5b86ea5e32b860e62049d8c770a244413b1146 | 6d1eb5cdf4e1f001d9133f516e545cde73e4832e | /environmenturl/src/main/java/com/validator/DatabaseCredentialValidator.java | 819d81ddeffa08052fc91b5073af0807b8c26b11 | [] | no_license | ragnar-lothbrok/Spring_hibernate_demo | efc311565e056b2af7197abacd37f310525953ae | e7a24b7bc97f982e1cc1f8d296a3db9548d4ebec | refs/heads/master | 2016-09-05T11:17:50.745053 | 2015-02-16T16:09:08 | 2015-02-16T16:09:08 | 30,830,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,278 | java | package com.validator;
import org.apache.log4j.Logger;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;
import com.model.DatabaseCredential;
public class DatabaseCredentialValidator implements Validator{
private static final Logger logger = Logger.getLogger(DatabaseCredentialValidator.class);
@Override
public boolean supports(Class<?> clazz) {
return DatabaseCredential.class.isAssignableFrom(clazz);
}
@Override
public void validate(Object target, Errors errors) {
logger.debug("Inside databaseCredentialValidator....");
if(target instanceof DatabaseCredential){
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "database_name", "database_name.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "database_ip", "database_ip.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "database_username", "database_username.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "database_password", "database_password.required");
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "application_name", "application_name.required");
}
logger.debug("ValidationUtils : >>"+errors);
}
}
| [
"[email protected]"
] | |
07654682c78091ec6f32d8f87bb2fc5a2422a2a7 | 01ffc7f1e5f97d9db5959e32596c6c0af595a9ec | /src/com/alexsandro/cursojava/aula39_Heranca_ModificadoresDeAcesso/teste/Aluno.java | 64d4d543b9f16f4feeb96f789c4fde3ecbe4c172 | [] | no_license | alexsfo/cursojava | 67022fdf028b7f56f845e50ca938cd3eb4d2caa8 | 8712b74f1a684610dc4cd5850b086bc5c63c2e35 | refs/heads/master | 2021-07-12T10:56:13.555845 | 2021-07-10T18:07:03 | 2021-07-10T18:07:03 | 202,550,503 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.alexsandro.cursojava.aula39_Heranca_ModificadoresDeAcesso.teste;
import com.alexsandro.cursojava.aula39_Heranca_ModificadoresDeAcesso.Pessoa;
public class Aluno extends Pessoa {
public Aluno() {
super(); // chama o construtor da superclasse
}
public void verificarAcesso() {
this.nomeVisibilidade = "dsd";
super.nomeVisibilidade = "skdmskd";
}
public Aluno(String nome, String endereco, String telefone, String curso) {
super(nome, endereco, telefone);
this.curso = curso;
}
private String curso;
private double[] notas;
public String getCurso() {
return curso;
}
public void setCurso(String curso) {
this.curso = curso;
}
public double[] getNotas() {
return notas;
}
public void setNotas(double[] notas) {
this.notas = notas;
}
public double calcularMedia() {
return 0;
}
public boolean verificarAprovado() {
return true;
}
public void metodoQualquer() {
super.setCpf("23232323");
System.out.println(this.getCpf());
}
}
| [
"[email protected]"
] | |
3a8e779509e1aadeeafc7b8565feee404af28452 | a8ab42e1db1c7fce608dc614af19c70c32f7e105 | /src/main/java/Main.java | 55fd8aaa047196b18bcdf75e78b4c867ae43f799 | [
"MIT"
] | permissive | jin519/ExcelManager | 48ec45d79acc899d8d13b6a322c85d1f5ca8b6ac | 7eebb82d3eb58ed084079d8825aa8b47f7aa883b | refs/heads/master | 2022-07-06T07:14:42.039741 | 2019-09-29T03:10:11 | 2019-09-29T03:11:34 | 210,157,868 | 6 | 0 | null | 2019-09-28T14:22:05 | 2019-09-22T14:09:01 | Java | UTF-8 | Java | false | false | 1,377 | java | import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import record_data_structure.Company;
import record_data_structure.Movie;
import record_data_structure.Person;
import record_data_structure.Profile;
import java.io.IOException;
public class Main
{
public static void main(String[] args) throws IOException, InvalidFormatException, IllegalAccessException, InstantiationException
{
ExcelReader excelReader = new ExcelReader("read_test.xlsx");
final Table movieTable = excelReader.read(0, Movie.class, true);
final Table personTable = excelReader.read(1, Person.class, true);
final Table companyTable = excelReader.read(2, Company.class, true);
excelReader.close();
excelReader.open("read_test2.xlsx");
final Table profileTable = excelReader.read(0, Profile.class, false);
excelReader.close();
System.out.println("파일을 모두 읽었습니다.");
ExcelWriter excelWriter = new ExcelWriter();
excelWriter.set("영화", movieTable);
excelWriter.set("영화인", personTable);
excelWriter.set("영화사", companyTable);
excelWriter.write("write_test.xlsx");
excelWriter.set("프로필", profileTable);
excelWriter.write("write_test2.xlsx");
System.out.println("파일 쓰기가 완료되었습니다.");
}
}
| [
"[email protected]"
] | |
38556eed67706a906828280eaa0ffd3a66a4a819 | cab1b20f2cc9995ecf6504620872c3a884b9b872 | /vendaingressosclient/src/vendaingressosclient/model/Status.java | 0d3f8e76394d27fed92badd720df94c313bbba8b | [] | no_license | israeltduarte/vendaingressos | c475ae21e4cd45c7269ff9858c7ef29712b9b6c2 | facd3ad68d2ca0abc62d3206711d9777a3f83f56 | refs/heads/master | 2020-11-26T18:13:38.198549 | 2019-12-20T01:53:51 | 2019-12-20T01:53:51 | 221,342,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 115 | java | package vendaingressosclient.model;
public enum Status {
DISPONIVEL, RESERVADO, VENDIDO, INDISPONIVEL
}
| [
"[email protected]"
] | |
a8557dbe58867f84a2ae8162b1729819a609e4c2 | b91f38a2e357bc3f44117c35750bb7f47fc96d9b | /app/src/main/java/com/wifidev/activities/Main.java | 61bb7e91f6f0eed010aa8e0526b8f581bf497e3d | [] | no_license | sidleciel/Wifidev-android | f842e97da25633e10403fc22046c179d7f31f104 | 964975054c8330276b3024d384a5b897fe17799e | refs/heads/master | 2020-06-13T05:42:00.753630 | 2016-12-03T16:14:30 | 2016-12-03T16:14:30 | 75,484,685 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,019 | java | package com.wifidev.activities;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import com.wifidev.R;
import com.wifidev.config.ADB;
import com.wifidev.logic.adb.TCPIP;
import com.wifidev.logic.wifi.WifiConnection;
public class Main extends Activity
{
TextView connectCommand;
@Override
protected void onCreate(Bundle savedInstanceState)
{
//--------------------------------
// Call super
//--------------------------------
super.onCreate(savedInstanceState);
//--------------------------------
// Set up UI
//--------------------------------
initializeUI();
//--------------------------------
// Ask for root and set tcp port
//--------------------------------
TCPIP.set();
}
void initializeUI()
{
//--------------------------------
// Load layout
//--------------------------------
setContentView(R.layout.main);
//--------------------------------
// Load layout
//--------------------------------
connectCommand = (TextView)findViewById(R.id.connectCommand);
}
@Override
protected void onResume()
{
//--------------------------------
// Call super
//--------------------------------
super.onResume();
//--------------------------------
// Reload connect command
//--------------------------------
showConnectCommand();
}
void showConnectCommand()
{
//--------------------------------
// Get internal Wifi connection IP
//--------------------------------
String ip = WifiConnection.getInternalIP(this);
//--------------------------------
// No IP? Not on Wifi...
//--------------------------------
if ( ip == null )
{
//--------------------------------
// Show error
//--------------------------------
connectCommand.setText(getString(R.string.noWifiConnection));
}
else
{
//--------------------------------
// Get adbd port
//--------------------------------
int port = ADB.TCPIP_PORT;
//--------------------------------
// Prepare command
//--------------------------------
String cmd = getString(R.string.connectCommand) + " " + ip;
//--------------------------------
// 5555 is the default port
// for adb connect command
// so don't display it
//--------------------------------
if (port != 5555)
{
cmd += ":" + port;
}
//--------------------------------
// Display connect command
//--------------------------------
connectCommand.setText(cmd);
}
}
}
| [
"[email protected]"
] | |
a0bc44dc32f768425175cff797fecd5e471c39fa | 1e6faf722fad48d080b22d395dacc078c049acbb | /app/src/main/java/com/bn/util/constant/isCutUtil.java | cae50ed8bad4b0cd160c2dc07ec5cdbd2d771847 | [] | no_license | jihaifeng/cut | 74ed4a20588420e290410485907c2b42023cbe9a | 7eca55676ce03789b7ff5b30453d7bb59244076a | refs/heads/master | 2021-01-22T07:48:00.327528 | 2017-05-27T06:40:48 | 2017-05-27T06:40:48 | 92,577,084 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 8,489 | java | package com.bn.util.constant;
import java.util.ArrayList;
import com.bn.fastcut.MySurfaceView;
import com.bn.object.BNObject;
import uk.co.geolib.geolib.CGrid;
import uk.co.geolib.geopolygons.C2DHoledPolygon;
import uk.co.geolib.geopolygons.C2DPolygon;
public class isCutUtil{
//判断手划过的线段与图形中的线段是否相交
public static boolean isIntersect(float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4)
{
if(x1==x2||x3==x4)//x1=x2 或者x3=x4直接返回false
{
return false;
}
float k1 = (float)(y1-y2)/(float)(x1-x2);//求第一条直线的斜率
float b1 = (float)(x1*y2 - x2*y1)/(float)(x1-x2);
float k2 = (float)(y3-y4)/(float)(x3-x4);//求第二条直线的斜率
float b2 = (float)(x3*y4 - x4*y3)/(float)(x3-x4);
if(k1==k2)//如果斜率相同
{
return false;//直接返回false
}else
{
float x = (float)(b2-b1) / (float)(k1-k2);
//差0.1即认为相等 相当于模糊计算
if((((x+0.1)>=x1)&&((x-0.1)<=x2))||(((x+0.1)>=x2)&&(x-0.1)<=x1))
{
if((((x+0.1)>=x3)&&((x-0.1)<=x4))||(((x+0.1)>=x4)&&(x-0.1)<=x3))
{
return true;
}
}
return false;
}
}
//获得两条线段的交点
public static float[] getIntersectPoint(float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4)
{
float[] result=new float[2];
result[0] = (((x1 - x2) * (x3 * y4 - x4 * y3) - (x3 - x4) * (x1 * y2 - x2 * y1))
/ ((x3 - x4) * (y1 - y2) - (x1 - x2) * (y3 - y4)));
result[1] = ((y1 - y2) * (x3 * y4 - x4 * y3) - (x1 * y2 - x2 * y1) * (y3 - y4))
/ ((y1 - y2) * (x3 - x4) - (x1 - x2) * (y3 - y4));
return result;
}
//判断是否划到了多边形
public static boolean isCutPolygon(MySurfaceView mv,C2DPolygon cp,float x1,float y1,float x2,float y2)
{
int indexTemp=MySurfaceView.CheckpointIndex;
float[] polygonData=GeoLibUtil.fromC2DPolygonToVData(cp);//获取现在多边形性状的点坐标
boolean[] isIntersect=new boolean[polygonData.length/2];//存取线段是否相交的数组
int boolCount=0;//数组变量自加值
int falseCount=0;//不相交线段的数量
int index[]=new int[2];
int findCount=0;
for(int j=0;j<polygonData.length/2;j++)
{
float[] data=MyFCData.getData(polygonData,j);//获取一条边的x、y坐标
isIntersect[boolCount]=isIntersect(x1, y1, x2, y2,
data[0], data[1], data[2], data[3]);//判断两条线段是否相交
//判断是否划到了 不可切割的边=========================start==========================
if(isIntersect[boolCount])//如果线段与线段相交
{
for(int k=0;k<MyFCData.data[indexTemp].length/2;k++)//循环最初数据的数组
{
if(((int)data[0]==MyFCData.data[indexTemp][k*2])&&((int)data[1]==MyFCData.data[indexTemp][k*2+1]))//如果获得的边的第一个x坐标在最初数据里能够找到
{
index[0]=k;//记录此点在最初数据中的位置
findCount++;//计数器加1
}
if(((int)data[2]==MyFCData.data[indexTemp][k*2])&&((int)data[3]==MyFCData.data[indexTemp][k*2+1]))//如果获得的边的第二个x坐标在最初数据里能够找到
{
index[1]=k;//记录此点在最初数据中的位置
findCount++;//计数器加1
}
}
if(findCount>0&&findCount%2==0)//如果是偶数个
{
if(index[0]>index[1])
{
if(index[1]==0)//如果是最大值-0 则判断最大值的边的boolean值
{
if(!MyFCData.dataBool[indexTemp][index[0]])//判断该条边是否可以切割
{
mv.isCutRigid=true;
mv.intersectPoint=getIntersectPoint(x1, y1, x2, y2,
data[0], data[1], data[2], data[3]);
return false;//如果不能切割 则直接返回false
}
}else
{
if(!MyFCData.dataBool[indexTemp][index[1]])//判断该条边是否可以切割
{
mv.isCutRigid=true;
mv.intersectPoint=getIntersectPoint(x1, y1, x2, y2,
data[0], data[1], data[2], data[3]);
return false;//如果不能切割 则直接返回false
}
}
}else
{
if(!MyFCData.dataBool[indexTemp][index[0]])//判断该条边是否可以切割
{
mv.isCutRigid=true;
mv.intersectPoint=getIntersectPoint(x1, y1, x2, y2,
data[0], data[1], data[2], data[3]);
return false;//如果不能切割 则直接返回false
}
}
findCount=0;
}else
{
findCount=0;
}
}
//判断是否划到了 不可切割的边=========================end==========================
if(isIntersect[boolCount]==false)//如果线段不相交
{
falseCount++;//数量加1
}
boolCount++;//数组变量自加1
}
if((falseCount==isIntersect.length)||(falseCount==isIntersect.length-1))
{
return false;
}else
{
return true;
}
}
//获得切分区域已经进行分类的多边形列表
public static ArrayList<C2DPolygon> getCutPolysArrayList(MySurfaceView mv,ArrayList<BNObject> alBNPO,float lxs,float lys,float lxe,float lye)
{
ArrayList<C2DPolygon> onePolygon=new ArrayList<C2DPolygon>();//切割后每个区域只有一个多边形的列表
ArrayList<C2DPolygon> tempPolygon=new ArrayList<C2DPolygon>();//切割后每个区域内有多个多边形的列表
ArrayList<ArrayList<float[]>> tal=GeoLibUtil.calParts(lxs, lys, lxe,lye);//分成两个多边形区域
C2DPolygon[] cpA=GeoLibUtil.createPolys(tal);//创建两个多边形
for(C2DPolygon cpTemp:cpA)
{
ArrayList<C2DHoledPolygon> polys = new ArrayList<C2DHoledPolygon>();
//获得被切分成的两个多边形与基本图形的重叠部分,并放入polys列表中
cpTemp.GetOverlaps(alBNPO.get(0).cp, polys, new CGrid());
if(polys.size()==1)//如果该区域内只有一个多边形
{
onePolygon.add(polys.get(0).getRim());//直接加进列表中
}else//如果该区域内有多个多边形
{
for(C2DHoledPolygon chp:polys)//将多个多边形加进列表中
{
tempPolygon.add(chp.getRim());
}
}
}
ArrayList<C2DPolygon> result=getLastPolysArrayList(mv,onePolygon,tempPolygon,lxs, lys, lxe,lye);
return result;
}
//判断切分的具体是哪个多边形 经过合并等操作 返回多边形列表
public static ArrayList<C2DPolygon> getLastPolysArrayList(MySurfaceView mv,ArrayList<C2DPolygon> onePolygon,ArrayList<C2DPolygon> tempPolygon,float lxs,float lys,float lxe,float lye)
{
ArrayList<C2DPolygon> lastPolygons=new ArrayList<C2DPolygon>();//最后根据球来判断切分多边形的列表
ArrayList<C2DPolygon> canCombineP=new ArrayList<C2DPolygon>();//手没有划到 可以进行合并多边形的列表
//判断切分的具体是哪个多边形==================start======================
if(tempPolygon.size()>0)//如果一个区域内有多个多边形
{
for(C2DPolygon cp:tempPolygon)//遍历C2DPolygon对象
{
if(isCutPolygon(mv,cp, lxs, lys, lxe, lye))//判断手是否划到了该多边形对象
{
lastPolygons.add(cp);
}else
{
canCombineP.add(cp);//没划到的多边形放进canCombine列表中
}
}
if(canCombineP.size()>0)//如果存在能够合并的多边形
{
C2DPolygon cc=new C2DPolygon();
for(int i=0;i<canCombineP.size();i++)//遍历能够合并的多边形列表
{
if(i==0)//如果是第一次循环
{
cc=onePolygon.get(0);//赋初值
}
cc=MyPatchUtil.getCombinePolygon//合并多边形
(
MyPatchUtil.getPolygonData(canCombineP.get(i), canCombineP.get(i).IsClockwise()),
MyPatchUtil.getPolygonData(cc, cc.IsClockwise()),
MyPatchUtil.getPolygonData(canCombineP.get(i), canCombineP.get(i).IsClockwise()).length,
MyPatchUtil.getPolygonData(cc, cc.IsClockwise()).length
);
}
lastPolygons.add(cc);//将合并后的多边形添加进列表里面
}else//如果不存在能够合并的多边形
{
lastPolygons.add(onePolygon.get(0));//即直接添加进最后的列表中
}
}else//如果一个区域内只有一个多边形
{
for(int i=0;i<onePolygon.size();i++)
{
lastPolygons.add(onePolygon.get(i));//直接添加进列表中
}
}
//判断切分的具体是哪个多边形==================end======================
return lastPolygons;
}
}
| [
"[email protected]"
] | |
2f947c2dab7c84d938972ae360108f45d3853689 | dbfcbcd3350305f29b14cb018faf9ddfca49d0b8 | /compiler/factual_parser/src/com/facetedworlds/factual/parsetree/PrimitiveType.java | 0f8250e778d753fbd0023d378a0d0b83ea5032cd | [
"MIT"
] | permissive | michaellperry/CorrespondenceAndroid | ba380c1d00378c1d5a11a01457858654e6792652 | 43160093f1c15b85cbddb210f9a75658be1783a2 | refs/heads/master | 2016-09-03T02:22:57.841583 | 2012-08-20T14:13:41 | 2012-08-20T14:13:41 | 4,803,828 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,649 | java | package com.facetedworlds.factual.parsetree;
public enum PrimitiveType {
BYTE( "byte" , "byte" , "Byte" ),
STRING( "string" , "String" , "String" ),
INT( "int" , "int" , "Integer" ),
LONG( "long" , "long" , "Long" ),
FLOAT( "float", "float" , "Float" ),
DOUBLE( "double" , "double" , "Double" ),
DECIMAL( "decimal" , "double" , "Double" ), // TODO Correct Type? Fixed point data type - BigDecimal
CHAR( "char" , "char" , "Character" ),
DATE( "date" , "java.util.Date" , "java.util.Date" ), // date, no time
TIME( "time" , "java.util.Date", "java.util.Date" ), // timestamp
BOOL( "bool" , "bool" , "Boolean" );
private String correspondenceType;
private String javaDataType;
private String javaObjectDataType;
PrimitiveType( String correspondenceType , String javaPrimitiveDataType , String javaObjectDataType ) {
this.correspondenceType = correspondenceType;
this.javaDataType = javaPrimitiveDataType;
this.javaObjectDataType = javaObjectDataType;
}
public String getCorrespondenceType() {
return correspondenceType;
}
public String getJavaDataType( FactCardinality f ) {
switch( f ) {
case ONE:
return javaDataType;
case OPTIONAL:
return javaObjectDataType;
case MANY:
return "java.util.List<" + javaObjectDataType + ">";
}
throw new IllegalStateException();
}
public String getJavaObjectDataType( FactCardinality f ) {
switch( f ) {
case ONE:
return javaObjectDataType;
case OPTIONAL:
return javaObjectDataType;
case MANY:
return "java.util.List<" + javaObjectDataType + ">";
}
throw new IllegalStateException();
}
}
| [
"[email protected]"
] | |
cbe2ee61332208d3ab33edc15968d7af1e0f4851 | 342e571310f8019a4fa8117b08897b9fb5736030 | /src/main/java/com/firedata/qtacker/domain/User.java | 6f421243fd4e0b0346da252ab25b6c7a1609182e | [] | no_license | Marko-Mijovic/qtacker-application | 383ae9e2bd6c6d92d2555c8b79bdfca9d801851b | 3f97152f208cb3347142b2bbc207c498469b6c6c | refs/heads/master | 2022-04-14T04:03:28.834874 | 2020-04-15T00:32:04 | 2020-04-15T00:32:04 | 255,757,303 | 0 | 0 | null | 2020-04-15T00:32:42 | 2020-04-15T00:04:04 | Java | UTF-8 | Java | false | false | 4,697 | java | package com.firedata.qtacker.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.firedata.qtacker.config.Constants;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.FieldType;
/**
* A user.
*/
@Entity
@Table(name = "jhi_user")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@org.springframework.data.elasticsearch.annotations.Document(indexName = "user")
public class User extends AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@org.springframework.data.elasticsearch.annotations.Field(type = FieldType.Keyword)
private String id;
@NotNull
@Pattern(regexp = Constants.LOGIN_REGEX)
@Size(min = 1, max = 50)
@Column(length = 50, unique = true, nullable = false)
private String login;
@Size(max = 50)
@Column(name = "first_name", length = 50)
private String firstName;
@Size(max = 50)
@Column(name = "last_name", length = 50)
private String lastName;
@Email
@Size(min = 5, max = 254)
@Column(length = 254, unique = true)
private String email;
@NotNull
@Column(nullable = false)
private boolean activated = false;
@Size(min = 2, max = 10)
@Column(name = "lang_key", length = 10)
private String langKey;
@Size(max = 256)
@Column(name = "image_url", length = 256)
private String imageUrl;
@JsonIgnore
@ManyToMany
@JoinTable(
name = "jhi_user_authority",
joinColumns = { @JoinColumn(name = "user_id", referencedColumnName = "id") },
inverseJoinColumns = { @JoinColumn(name = "authority_name", referencedColumnName = "name") }
)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@BatchSize(size = 20)
private Set<Authority> authorities = new HashSet<>();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getLogin() {
return login;
}
// Lowercase the login before saving it in database
public void setLogin(String login) {
this.login = StringUtils.lowerCase(login, Locale.ENGLISH);
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public boolean getActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public String getLangKey() {
return langKey;
}
public void setLangKey(String langKey) {
this.langKey = langKey;
}
public Set<Authority> getAuthorities() {
return authorities;
}
public void setAuthorities(Set<Authority> authorities) {
this.authorities = authorities;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof User)) {
return false;
}
return id != null && id.equals(((User) o).id);
}
@Override
public int hashCode() {
return 31;
}
@Override
public String toString() {
return (
"User{" +
"login='" +
login +
'\'' +
", firstName='" +
firstName +
'\'' +
", lastName='" +
lastName +
'\'' +
", email='" +
email +
'\'' +
", imageUrl='" +
imageUrl +
'\'' +
", activated='" +
activated +
'\'' +
", langKey='" +
langKey +
'\'' +
"}"
);
}
}
| [
"[email protected]"
] | |
c7580ac8e4302638496cdace7cd5f9aa69de20ff | bf51711a1f69313369b834983d0950637dbd1a4d | /spring-boot-mybatis-xml/src/main/java/com/demo/entity/UserEntity.java | 514e97fb8b11213089d5cb9c2e29733e841747ea | [] | no_license | eff666/spring-boot | 2a9d20e7c4d71ce05a28528444a94fb0a0751623 | 4cb96e6e0ae7ecc3f38ef24cc1d85c20089ad0b7 | refs/heads/master | 2021-01-19T13:55:51.688776 | 2017-04-28T07:10:28 | 2017-04-28T07:10:28 | 88,114,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,321 | java | package com.demo.entity;
import java.io.Serializable;
import com.demo.enums.UserSexEnum;
public class UserEntity implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private String userName;
private String passWord;
private UserSexEnum userSex;
private String nickName;
public UserEntity() {
super();
}
public UserEntity(String userName, String passWord, UserSexEnum userSex) {
super();
this.passWord = passWord;
this.userName = userName;
this.userSex = userSex;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassWord() {
return passWord;
}
public void setPassWord(String passWord) {
this.passWord = passWord;
}
public UserSexEnum getUserSex() {
return userSex;
}
public void setUserSex(UserSexEnum userSex) {
this.userSex = userSex;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return "userName " + this.userName + ", pasword " + this.passWord + "sex " + userSex.name();
}
} | [
"[email protected]"
] | |
1d8008da939a15c6088a658f4d2f550608782ce7 | c92f01ba2fedeb32bd9d86b79e3edab4f3156ca4 | /Practica Videojuego/src/Espada.java | 64eb20444a46369cee3acdb5675e58870a4dd49d | [] | no_license | DanielNieto2404/WorkSpaceJava | ea559242a220551b3bee89597c014ed3b88e5681 | 590386ee90c70d0f0c07f25d370fcc582d45135a | refs/heads/main | 2023-08-21T13:41:04.686483 | 2021-10-15T10:10:45 | 2021-10-15T10:10:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | public class Espada extends Arma{
public Espada(String nombre, int dañoMax, int dañoMin) {
super(nombre, dañoMax, dañoMin, "Guerrero", 1.8);
}
public void usar(){
System.out.println("Swwangggg!!!");
}
}
| [
"[email protected]"
] | |
41e556fc6dff1fe3260b3fdbed2911c380848c6c | 59894941e63077287a4e11460c1c8b9f19a9a1e8 | /src/com/cucc/vertx/demo/object/User.java | 192334ddcaa0ca087f10c74979ab2dde29f95e05 | [] | no_license | zhangchengqi/Vertx3Demo | fd2679aa471fb418d710da934a518220975a94a0 | 4285d5c114f01c2d60353d0fc3d03466dd7e2ec8 | refs/heads/master | 2020-06-02T12:42:58.614766 | 2015-06-27T14:12:24 | 2015-06-27T14:12:24 | 38,089,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.cucc.vertx.demo.object;
public class User {
public String user_id;
public String msisdn;
public String getMsisdn() {
return msisdn;
}
public void setMsisdn(String msisdn) {
this.msisdn = msisdn;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
}
| [
"spark@hadoop"
] | spark@hadoop |
679f2c4f1264ffd9bb4c41844dc7894387d13b8a | c8ca1e65f7b9953748c68adce16486e926fcac7b | /src/main/java/repositories/TareaRepository.java | ef5613f2bd86d59f8306dea23d397d7d277544f6 | [] | no_license | martos93/SevillaMultiservicios | 3ca27c38504f301f90bf0af0b4f7fdc1c7dfc679 | 249467d446d6f845a41db9c9edca4367f33212a5 | refs/heads/master | 2020-03-15T16:33:55.378813 | 2018-06-10T10:23:39 | 2018-06-10T10:23:39 | 132,237,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 259 | java |
package repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import domain.Tarea;
@Repository
public interface TareaRepository extends JpaRepository<Tarea, Integer> {
}
| [
"[email protected]"
] | |
a897343227ffaf5472de83b51ac89668bb2d28e1 | 0c51368673fa61d7674c58c31d9296872b0be5a2 | /platform/platform-impl/src/com/intellij/application/options/editor/fonts/FontWeightCombo.java | 48f42f1178a13083907eb75be30baf938f050891 | [
"Apache-2.0"
] | permissive | aprilwang172/intellij-community | 6ed25d2eddfa05110ea7555e71fbefab1514f10d | 573a1eebd5cb39a01a18ceadd4e4e2a7f36046bb | refs/heads/master | 2023-02-01T16:34:46.140308 | 2020-12-16T17:13:57 | 2020-12-16T17:41:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,769 | java | // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.application.options.editor.fonts;
import com.intellij.openapi.application.ApplicationBundle;
import com.intellij.openapi.editor.colors.FontPreferences;
import com.intellij.openapi.editor.impl.FontFamilyService;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.ui.ColoredListCellRenderer;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
abstract class FontWeightCombo extends ComboBox<FontWeightCombo.MyWeightItem> {
private final MyModel myModel;
private final boolean myMarkRecommended;
FontWeightCombo(boolean markRecommended) {
myMarkRecommended = markRecommended;
myModel = new MyModel();
setModel(myModel);
setRenderer(new MyListCellRenderer());
}
void update(@NotNull FontPreferences fontPreferences) {
myModel.update(fontPreferences);
}
@Nullable
String getSelectedSubFamily() {
Object selected = myModel.getSelectedItem();
return selected instanceof MyWeightItem ? ((MyWeightItem)selected).subFamily : null;
}
private class MyModel extends AbstractListModel<MyWeightItem> implements ComboBoxModel<MyWeightItem> {
private final @NotNull List<MyWeightItem> myItems = new ArrayList<>();
private @Nullable MyWeightItem mySelectedItem;
@Override
public void setSelectedItem(Object anItem) {
if (anItem instanceof MyWeightItem) {
mySelectedItem = (MyWeightItem)anItem;
}
else if (anItem instanceof String) {
mySelectedItem = ContainerUtil.find(myItems, item -> item.subFamily.equals(anItem));
}
}
@Override
public Object getSelectedItem() {
return mySelectedItem;
}
@Override
public int getSize() {
return myItems.size();
}
@Override
public MyWeightItem getElementAt(int index) {
return myItems.get(index);
}
private void update(@NotNull FontPreferences currPreferences) {
myItems.clear();
String currFamily = currPreferences.getFontFamily();
String recommended = getRecommendedSubFamily(currFamily);
FontFamilyService.getSubFamilies(currFamily).forEach(
subFamily -> myItems.add(new MyWeightItem(subFamily, subFamily.equals(recommended)))
);
String subFamily = getSubFamily(currPreferences);
setSelectedItem(subFamily != null ? subFamily : recommended);
fireContentsChanged(this, -1, -1);
}
}
private class MyListCellRenderer extends ColoredListCellRenderer<MyWeightItem> {
@Override
protected void customizeCellRenderer(@NotNull JList<? extends MyWeightItem> list,
MyWeightItem value, int index, boolean selected, boolean hasFocus) {
if (value != null) {
append(value.subFamily);
if (value.isRecommended && myMarkRecommended) {
append(" ");
append(ApplicationBundle.message("settings.editor.font.recommended"), SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
}
}
static class MyWeightItem {
private final @NlsSafe String subFamily;
private final boolean isRecommended;
MyWeightItem(String subFamily, boolean isRecommended) {
this.subFamily = subFamily;
this.isRecommended = isRecommended;
}
}
@Nullable
abstract String getSubFamily(@NotNull FontPreferences preferences);
@NotNull
abstract String getRecommendedSubFamily(@NotNull String family);
}
| [
"[email protected]"
] | |
518233909fbf4284e01b65ebc98c7255d9eb01c7 | 47798511441d7b091a394986afd1f72e8f9ff7ab | /src/main/java/com/alipay/api/domain/AlipayOpenMiniVersionUploadModel.java | 4e2cdc5b5f9f2ce7599bdee6ab22904354a835ad | [
"Apache-2.0"
] | permissive | yihukurama/alipay-sdk-java-all | c53d898371032ed5f296b679fd62335511e4a310 | 0bf19c486251505b559863998b41636d53c13d41 | refs/heads/master | 2022-07-01T09:33:14.557065 | 2020-05-07T11:20:51 | 2020-05-07T11:20:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,953 | java | package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 小程序基于模板上传版本
*
* @author auto create
* @since 1.0, 2020-01-09 14:37:03
*/
public class AlipayOpenMiniVersionUploadModel extends AlipayObject {
private static final long serialVersionUID = 5145374939315639856L;
/**
* 小程序版本号,版本号必须满足 x.y.z, 且均为数字。要求版本号比商户之前最新的版本号高。
*/
@ApiField("app_version")
private String appVersion;
/**
* 小程序投放的端参数,例如投放到支付宝钱包是支付宝端。该参数可选,默认支付宝端 ,目前仅支持支付宝端,枚举列举:com.alipay.alipaywallet:支付宝端
*/
@ApiField("bundle_id")
private String bundleId;
/**
* 模板的配置参数
*/
@ApiField("ext")
private String ext;
/**
* 模板id
*/
@ApiField("template_id")
private String templateId;
/**
* 模板版本号,版本号必须满足 x.y.z, 且均为数字。不传默认使用最新在架模板版本。
*/
@ApiField("template_version")
private String templateVersion;
public String getAppVersion() {
return this.appVersion;
}
public void setAppVersion(String appVersion) {
this.appVersion = appVersion;
}
public String getBundleId() {
return this.bundleId;
}
public void setBundleId(String bundleId) {
this.bundleId = bundleId;
}
public String getExt() {
return this.ext;
}
public void setExt(String ext) {
this.ext = ext;
}
public String getTemplateId() {
return this.templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getTemplateVersion() {
return this.templateVersion;
}
public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion;
}
}
| [
"[email protected]"
] | |
e5fd79af9a2dfee10df36b5608924b98af4c066d | e5b84002cb0224e689e97632a656130248d25047 | /XML/XMLParsersExercise/src/DepartmentEntity.java | 6f7eb6473a738ba3e6c39be8a2a49651d80288e6 | [] | no_license | aadvikm/JAVA_J2EE_REPO | 4a254fda12c6a30b098ac0e04a54f4ee18cfd464 | 689fcfbcea739440795b43ef578b6312a2c144d3 | refs/heads/master | 2020-03-25T07:50:20.677504 | 2018-09-14T04:35:32 | 2018-09-14T04:35:32 | 143,584,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class DepartmentEntity {
private Integer deptId;
private String deptName;
private Integer locationId;
private Integer managerId;
public DepartmentEntity() {
super();
// TODO Auto-generated constructor stub
}
@XmlElement
public Integer getDeptId() {
return deptId;
}
public void setDeptId(Integer deptId) {
this.deptId = deptId;
}
@XmlElement
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
@XmlElement
public Integer getLocationId() {
return locationId;
}
public void setLocationId(Integer locationId) {
this.locationId = locationId;
}
@XmlElement
public Integer getManagerId() {
return managerId;
}
public void setManagerId(Integer managerId) {
this.managerId = managerId;
}
@Override
public String toString() {
return "DepartmentEntity [deptId=" + deptId + ", deptName=" + deptName + ", locationId=" + locationId
+ ", managerId=" + managerId + "]";
}
}
| [
"[email protected]"
] | |
a64f8f5b7909e701d3e403b2d6bbb38e34784011 | eadd329f1bd8f454b2bc0f18d7308d9ea31f569d | /src/com/jlkj/msj/entity/Praise.java | bcd1fff98afa703d57d679216edc73b7d27f2ac0 | [] | no_license | ben12138/msj | 4d2032fd14e1bda5978f05eb9f7ab5cbded32c3e | 59ad8c12ecae13878900a3c587ea583a08acf8d1 | refs/heads/master | 2020-03-09T01:50:00.020355 | 2018-04-07T12:17:08 | 2018-04-07T12:17:08 | 128,525,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,712 | java | package com.jlkj.msj.entity;
/**
* Praise实体类
* 用于保存具体的点赞信息
* 与数据库praise表对应
*/
public class Praise {
private int id;//id自增长,为物理主键
private String praiseId;//praiseId为逻辑主键,根据UUID+时间生成,确保唯一性
private String userId;//点赞人id信息
private String contentId;//点赞的条目的id
private int type;//点赞的属性:1代表给回答点赞,2代表给菜谱点赞,3代表给作品点赞,4代表给评论点赞
public Praise() {
}
public Praise(String praiseId, String userId, String contentId, int type) {
this.praiseId = praiseId;
this.userId = userId;
this.contentId = contentId;
this.type = type;
}
public Praise(int id, String praiseId, String userId, String contentId, int type) {
this.id = id;
this.praiseId = praiseId;
this.userId = userId;
this.contentId = contentId;
this.type = type;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getPraiseId() {
return praiseId;
}
public void setPraiseId(String praiseId) {
this.praiseId = praiseId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getContentId() {
return contentId;
}
public void setContentId(String contentId) {
this.contentId = contentId;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
| [
"[email protected]"
] | |
93a1dc8b802aecacf36424f36c95e3635effec83 | 5aee8e4c586732d5e198c85523d3e19a27d5a745 | /18_typy_generyczne/src/test/java/pl/sdacademy/PudelkoNaKsztaltyTest.java | f46310c3100e60f3a71fd813f1619a61a87f8254 | [] | no_license | PiotrDobrodziej/sdacademy-examples | 49e5eecbe80a9de1de78a44dd49375ffcf0d518f | c70647a2417716f62533e89434c0e1a08e315cd7 | refs/heads/master | 2020-04-10T09:38:53.295147 | 2019-02-12T19:08:37 | 2019-02-12T19:08:37 | 160,943,181 | 1 | 0 | null | 2018-12-08T13:43:25 | 2018-12-08T13:43:25 | null | UTF-8 | Java | false | false | 1,192 | java | package pl.sdacademy;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import pl.sdacademy.shapes.Ksztalt;
import pl.sdacademy.shapes.Kwadrat;
import pl.sdacademy.shapes.Trojkat;
import static org.assertj.core.api.Assertions.*;
public class PudelkoNaKsztaltyTest {
@DisplayName("mozna do pudelka na ksztalty wlozyc zarowno kwadraty oraz trojkaty oraz obliczyc ich pole")
@Test
void test() {
// given
PudelkoNaKsztalty<Ksztalt> ksztalty = new PudelkoNaKsztalty<>(shegemege());
// when
double powierzchnie = ksztalty.sumujPowierzchnie();
// then
assertThat(powierzchnie).isEqualTo(2550);
}
@DisplayName("mozna zbudowac pudelko wylacznie na trojkaty i policzyc ich powierzchnie")
@Test
void trojkaty() {
// given
PudelkoNaKsztalty<Trojkat> pudelkoNaTrojkaty = new PudelkoNaKsztalty<>(tylkoTrojkaty());
// when
double powierzchnia = pudelkoNaTrojkaty.sumujPowierzchnie();
// then
assertThat(powierzchnia).isEqualTo(68);
}
private Trojkat[] tylkoTrojkaty() {
return new Trojkat[]{new Trojkat(10, 10), new Trojkat(6, 6)};
}
private Ksztalt[] shegemege() {
return new Ksztalt[]{new Trojkat(10, 10), new Kwadrat(50)};
}
}
| [
"[email protected]"
] | |
5ddfd36b05ebf505a3698c8fb0f2057c2c80224d | a8fef3a72c0cf4d0c8863353e60bf8a96c036159 | /OOP/Abstraction/Playlist/Playlist.java | 068d3c877a985e6150bd84b57f611a76dd6e2b73 | [] | no_license | turab45/Java | 1fbf2791f6f2eb2390facf2848037d8c92264fdd | cb295a195c111286d405f2f35ae92eb2a02592a2 | refs/heads/master | 2021-01-01T01:41:55.100637 | 2020-07-29T08:43:34 | 2020-07-29T08:43:34 | 239,126,401 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 166 | java | abstract class Playlist{
public String songName;
public double duration;
abstract void addSong(String songName, double duration);
abstract void playSong();
}
| [
"[email protected]"
] | |
0783663b7044a821bb2646df43f9fdaf6d24731b | af2e9f68773b5bbe39821797e7e636d83d32fb8e | /src/com/headfirst/observer/util/HeatIndexDisplay.java | 420a73861f94de397852505bbcd11fb01dc00402 | [] | no_license | EikeOgkler/Observer | 86555aa5d36b7099ce4b6d83662130b87b6a8d63 | fe474d192f151655cc4554e150bcd76508b56970 | refs/heads/master | 2021-01-21T02:41:59.295403 | 2014-08-13T00:43:18 | 2014-08-13T00:43:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,290 | java | package com.headfirst.observer.util;
import java.util.Observable;
import java.util.Observer;
public class HeatIndexDisplay implements Observer, DisplayElement {
float heatIndex = 0.0f;
Observable observable;
public HeatIndexDisplay(Observable observable) {
this.observable = observable;
this.observable.addObserver(this);
}
@Override
public void update(Observable o, Object arg) {
if (o instanceof WeatherData) {
WeatherData weatherData = (WeatherData) o;
this.heatIndex = this.computeHeatIndex(weatherData.getTemperature(), weatherData.getHumidity());
this.display();
}
}
private float computeHeatIndex(float t, float rh) {
float index = (float)(16.923 + 0.185212 * t + 5.37941 * rh - 0.100254 * t * rh
+ 0.00941695 * (t * t) + 0.00728898 * (rh * rh)
+ 0.000345372 * (t * t * rh) - 0.000814971 * (t * rh * rh) +
0.0000102102 * (t * t * rh * rh) - 0.000038646 * (t * t * t) + 0.0000291583 *
(rh * rh * rh) + 0.00000142721 * (t * t * t * rh) +
0.000000197483 * (t * rh * rh * rh) - 0.0000000218429 * (t * t * t * rh * rh) +
0.000000000843296 * (t * t * rh * rh * rh) -
0.0000000000481975 * (t * t * t * rh * rh * rh));
return index;
}
@Override
public void display() {
System.out.println("Heat index is " + this.heatIndex);
}
}
| [
"[email protected]"
] | |
223090d0124fd4b953c3351161859c3794ce2cb7 | ae3df1775c5c4344180943334eae07b09003b80b | /.svn/pristine/22/223090d0124fd4b953c3351161859c3794ce2cb7.svn-base | b84364d89802ea141640032ca546852597552851 | [] | no_license | cgq355716727/HotelWeb | 467b4e9c335ed7a5512a109c41fe4fe7fdeec9d4 | 3f84326f9e0622f295dffc7e10ba2f695d3236ee | refs/heads/master | 2016-09-06T20:09:00.070840 | 2014-04-26T04:32:32 | 2014-04-26T04:32:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | package com.service.impl;
import com.dao.IAdminDao;
import com.dao.impl.AdminDao;
import com.service.IAdminService;
import com.vo.AdminVo;
public class AdminService implements IAdminService {
private IAdminDao adminDao;
public AdminService(){
adminDao=new AdminDao();
}
public AdminVo validateAdmin(AdminVo vo) {
// TODO Auto-generated method stub
return adminDao.validateAdmin(vo);
}
public int addAdmin(AdminVo vo) {
// TODO Auto-generated method stub
return adminDao.addAdmin(vo);
}
public int updPassword(AdminVo vo) {
// TODO Auto-generated method stub
return adminDao.updPassword(vo);
}
public int delAdmin(int adminId) {
// TODO Auto-generated method stub
return adminDao.delAdmin(adminId);
}
}
| [
"[email protected]"
] | ||
3f0a83008c3b49ec3bf01d21440b0827697e99fc | 6df035de3b4251df9692876ec691ecb9cab6c5c7 | /mall-common-service/src/main/java/com/mall/mallcommonservice/product/model/ProductInfo.java | 1d0635bdbaebebb89c21d5a7ea3b7c1204539332 | [] | no_license | gggcgba/mall | 779ea7b7b14c48b45ecaf711298f64173a0223ea | 882a3f64ab831343064c581de9cbcd92b2ff2739 | refs/heads/master | 2023-01-13T11:50:39.798342 | 2020-11-19T13:50:26 | 2020-11-19T13:50:26 | 313,916,378 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 682 | java | package com.mall.mallcommonservice.product.model;
import java.io.Serializable;
/**
* @author gggcgba 【wechat:13031016567】
* 2020/11/18 0018
**/
public class ProductInfo implements Serializable {
private static final long serialVersionUID = 3779275407733692771L;
/**
*
* 产品名称
*/
private String name;
/**
*
* 产品价格
*/
private Double price;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
}
| [
"[email protected]"
] | |
e6768a38bdece7feaadf8aa7ad51a3183d123435 | b078809ff0c0597c8273154586a9796e225045be | /medical/src/main/java/com/huios/medical/entities/Service.java | b44e2839e152b2a409df688d1456d0502f86c017 | [] | no_license | serviceshuios/huiosMedicinal | 611099ed49a7b9af725795e190b643327a8de0ae | 0c830912bf8f7abe049412b135456229778e9073 | refs/heads/master | 2020-03-24T21:46:05.643571 | 2018-09-03T15:08:24 | 2018-09-03T15:08:24 | 143,049,148 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,784 | java | package com.huios.medical.entities;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "services")
public class Service extends AbstractActivity {
private String typeService;
private String presentationService;
private int tarifMin;
private int tarifMax;
private String priseRdvConseille;
public String getTypeService() {
return typeService;
}
public void setTypeService(String typeService) {
this.typeService = typeService;
}
public String getPresentationService() {
return presentationService;
}
public void setPresentationService(String presentationService) {
this.presentationService = presentationService;
}
public int getTarifMin() {
return tarifMin;
}
public void setTarifMin(int tarifMin) {
this.tarifMin = tarifMin;
}
public int getTarifMax() {
return tarifMax;
}
public void setTarifMax(int tarifMax) {
this.tarifMax = tarifMax;
}
public String getPriseRdvConseille() {
return priseRdvConseille;
}
public void setPriseRdvConseille(String priseRdvConseille) {
this.priseRdvConseille = priseRdvConseille;
}
public Service() {
super();
// TODO Auto-generated constructor stub
}
public Service(Long id, Long version, String typeService, String presentationService, int tarifMin, int tarifMax,
String priseRdvConseille) {
super(id, version);
this.typeService = typeService;
this.presentationService = presentationService;
this.tarifMin = tarifMin;
this.tarifMax = tarifMax;
this.priseRdvConseille = priseRdvConseille;
}
@Override
public String toString() {
return "Service [typeService=" + typeService + ", presentationService=" + presentationService + ", tarifMin="
+ tarifMin + ", tarifMax=" + tarifMax + ", priseRdvConseille=" + priseRdvConseille + "]";
}
}
| [
"[email protected]"
] | |
3eaf3d271508c3ed7a30db1977aa25ce6b319b9c | 1703cac186d7dc9328c931fd109533bda8ea7d91 | /OmazanEJB/ejbModule/com/omazan/EJBs/Interfaces/OrderEJBRemote.java | 86b14176ecff797432c37092cb5b55d48c6a1ac3 | [] | no_license | faisalpk29/Middleware-Project | a9b7fda748e295ebbf714991fbf187f5e9725398 | e7ee051edb735fa43ae3b58e77ebdbeecfee9919 | refs/heads/master | 2021-01-01T16:19:09.433262 | 2015-09-15T13:24:23 | 2015-09-15T13:24:23 | 42,472,106 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package com.omazan.EJBs.Interfaces;
import java.util.List;
import javax.ejb.Remote;
import com.omazan.Entities.Order;
import com.omazan.Entities.Truck;
@Remote
public interface OrderEJBRemote {
public String ProcessOrder(Order order);
public Order GetOrder(int OrderID);
public List<Order> ListOrdersByCustomer(int CustomerId) ;
public List<Order> ListInProcessOrders();
public List<Order> ListDeleiveredOrders();
public void MarkProductAsDeleivered(int OrderID);
public List<Order> ListOrders();
}
| [
"[email protected]"
] | |
c1679dc6d6e65e0a9af311e7cbd68bef930d03e1 | 0f90963e901568c40acde88af0e8f0778d25acb1 | /app/src/main/java/com/example/varun/myassignment/Main2Activity.java | 8b044d3014a73f722a6c8b67518c321b66d366a2 | [] | no_license | laxmannakka/Assignment | 9af64c469baac0767bcaa689b013c28eef50d6dd | 81bfcb5baf2d189906949f87553a761d893a44e8 | refs/heads/master | 2020-12-02T22:16:02.195926 | 2017-07-03T11:37:33 | 2017-07-03T11:37:33 | 96,104,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,752 | java | package com.example.varun.myassignment;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.widget.Toast;
public class Main2Activity extends AppCompatActivity {
boolean doubleBackToExitPressedOnce = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
BottomNavigationView bottomNavigationView = (BottomNavigationView)
findViewById(R.id.navigation);
bottomNavigationView.setOnNavigationItemSelectedListener
(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Fragment selectedFragment = null;
switch (item.getItemId()) {
case R.id.action_item1:
selectedFragment = ItemOneFragment.newInstance();
break;
case R.id.action_item2:
selectedFragment = ItemTwoFragment.newInstance();
break;
case R.id.action_item3:
selectedFragment = ItemThreeFragment.newInstance();
break;
}
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.frame_layout, selectedFragment);
transaction.commit();
return true;
}
});
//Manually displaying the first fragment - one time only
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.frame_layout, ItemOneFragment.newInstance());
transaction.commit();
}
@Override
public void onBackPressed() {
if (doubleBackToExitPressedOnce) {
super.onBackPressed();
return;
}
this.doubleBackToExitPressedOnce = true;
Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
doubleBackToExitPressedOnce=false;
}
}, 2000);
}
}
| [
"[email protected]"
] | |
bec3b03a004d71bbd56cac6b505f7048d0227a9e | ad2c936c98423278444c1a92ceecb1d604d95957 | /app/src/main/java/prawas/exa/com/prawas_journy/Common/GPSTracker.java | 00b2355d78bf289122a865ad815df5dadd234fb4 | [] | no_license | Indradhanushya/Prawas | 45ba9501291dfac603f8ca39fd16ae005633c751 | 7855eab62a63831a2ca9a9d90f3e480414496892 | refs/heads/master | 2021-01-21T20:34:46.160230 | 2017-06-19T05:41:24 | 2017-06-19T05:41:24 | 92,254,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,304 | java | package prawas.exa.com.prawas_journy.Common;
import android.Manifest;
import android.app.AlertDialog;
import android.app.Service;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.util.Log;
/**
* Created by Swapnil Jadhav on 19/6/17.
*/
public class GPSTracker extends Service implements LocationListener {
private final Context mContext;
// flag for GPS status
boolean isGPSEnabled = false;
// flag for network status
boolean isNetworkEnabled = false;
// flag for GPS status
boolean canGetLocation = false;
Location location; // location
double latitude; // latitude
double longitude; // longitude
// The minimum distance to change Updates in meters
private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 10; // 10 meters
// The minimum time between updates in milliseconds
private static final long MIN_TIME_BW_UPDATES = 1000 * 60 * 1; // 1 minute
// Declaring a Location Manager
protected LocationManager locationManager;
public GPSTracker(Context context) {
this.mContext = context;
getLocation();
}
public Location getLocation() {
try {
locationManager = (LocationManager) mContext
.getSystemService(LOCATION_SERVICE);
// getting GPS status
isGPSEnabled = locationManager
.isProviderEnabled(LocationManager.GPS_PROVIDER);
// getting network status
isNetworkEnabled = locationManager
.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
if (!isGPSEnabled && !isNetworkEnabled) {
// no network provider is enabled
} else {
this.canGetLocation = true;
// First get location from Network Provider
if (isNetworkEnabled) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
}
locationManager.requestLocationUpdates(
LocationManager.NETWORK_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("Network", "Network");
if (locationManager != null) {
location = locationManager
.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
}
}
}
// if GPS Enabled get lat/long using GPS Services
if (isGPSEnabled) {
if (location == null) {
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
MIN_TIME_BW_UPDATES,
MIN_DISTANCE_CHANGE_FOR_UPDATES, this);
Log.d("GPS Enabled", "GPS Enabled");
if (locationManager != null) {
location = locationManager
.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (location != null) {
latitude = location.getLatitude();
longitude = location.getLongitude();
}
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return location;
}
/**
* Stop using GPS listener
* Calling this function will stop using GPS in your app
* */
public void stopUsingGPS(){
if(locationManager != null){
locationManager.removeUpdates(GPSTracker.this);
}
}
/**
* Function to get latitude
* */
public double getLatitude(){
if(location != null){
latitude = location.getLatitude();
}
// return latitude
return latitude;
}
/**
* Function to get longitude
* */
public double getLongitude(){
if(location != null){
longitude = location.getLongitude();
}
// return longitude
return longitude;
}
/**
* Function to check GPS/wifi enabled
* @return boolean
* */
public boolean canGetLocation() {
return this.canGetLocation;
}
/**
* Function to show settings alert dialog
* On pressing Settings button will lauch Settings Options
* */
public void showSettingsAlert(){
AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
// Setting Dialog Title
alertDialog.setTitle("GPS is settings");
// Setting Dialog Message
alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
// On pressing Settings button
alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
mContext.startActivity(intent);
}
});
// on pressing cancel button
alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
// Showing Alert Message
alertDialog.show();
}
@Override
public void onLocationChanged(Location location) {
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void onProviderEnabled(String provider) {
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}
@Override
public IBinder onBind(Intent arg0) {
return null;
}
} | [
"[email protected]"
] | |
011b5e70729aceb26cea0d1c6e64d9a0b437156a | 6ba5c82b02b7b3874f54dffc83468a1727fee417 | /app/src/main/java/model/Filmes.java | b063c29aa0ae5bcd59ea796963135ac1cd96ed13 | [] | no_license | HiagoW/OscarApp | 2a037bd89c76e42cb7d058cf356fb24f1c56afb6 | dabf914ee59e842bc402dde328e58e3067d482a0 | refs/heads/main | 2023-03-19T04:10:30.726288 | 2021-03-06T19:23:46 | 2021-03-06T19:23:46 | 338,399,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 605 | java | package model;
public class Filmes {
private int id;
String nome, foto, genero;
public int getId() {
return id;
}
public String getGenero() {
return genero;
}
public void setGenero(String genero) {
this.genero = genero;
}
public void setId(int id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getFoto() {
return foto;
}
public void setFoto(String foto) {
this.foto = foto;
}
}
| [
"[email protected]"
] | |
5080a884cca5110070017a0be2b398ceaf2eebe5 | dd49804615396eb3815afba75f7e2fbad8b261fc | /src/controller/IGeneralManage.java | bf60f36d840948c964f5e85873221d2b5c754202 | [] | no_license | dominthao91/MD2-QlyHoaDonTinDien | 867e83fddf1c20568419e44dec8a5243d10cf098 | bc257651d36153ee4ddfe67fb9f2de8f3e6f1160 | refs/heads/master | 2023-09-04T03:00:07.055003 | 2021-10-11T01:43:41 | 2021-10-11T01:43:41 | 415,745,040 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 207 | java | package controller;
public interface IGeneralManage <T>{
void showAll();
void addNew(T t);
void removeByCodeElectric(String codeElectric);
int searchByCodeElectric(String codeElectric);
}
| [
"[email protected]"
] | |
37f1d8ede05078cd73371aa8eea81fd0aa79d756 | 22b1fe6a0af8ab3c662551185967bf2a6034a5d2 | /experimenting-rounds/massive-count-of-annotated-classes/src/main/java/fr/javatronic/blog/massive/annotation1/sub1/Class_3607.java | cd8b19641ba6b0fe13dc07bef28a67de37deabaf | [
"Apache-2.0"
] | permissive | lesaint/experimenting-annotation-processing | b64ed2182570007cb65e9b62bb2b1b3f69d168d6 | 1e9692ceb0d3d2cda709e06ccc13290262f51b39 | refs/heads/master | 2021-01-23T11:20:19.836331 | 2014-11-13T10:37:14 | 2014-11-13T10:37:14 | 26,336,984 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 151 | java | package fr.javatronic.blog.massive.annotation1.sub1;
import fr.javatronic.blog.processor.Annotation_001;
@Annotation_001
public class Class_3607 {
}
| [
"[email protected]"
] | |
0f541847d5bc7a478a544d0cba4be9a760a87505 | 7aa9e44a7a2791976915f0e83a3ca0258a4d4054 | /src/domain/PageBean.java | 07c964249e7d42096056700c15aa27dce1f05a96 | [] | no_license | sbcxk/PPL | e3c18938b63cd9e27824ab84eb5b37857a548f19 | f12e97bf070e44535f37b9edcd75dffc67a1aec3 | refs/heads/master | 2023-02-11T06:28:49.524785 | 2021-01-09T04:31:27 | 2021-01-09T04:31:27 | 328,067,199 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | package domain;
import java.util.List;
public class PageBean<T> {
private List<T> data;//当前页的数据 查询 limit (pageNumber-1)*pageSize,pageSize
private int pageNumber;//当前页 页面传递过来
private int totalRecord;//总条数 查询 count(*)
private int pageSize;//每页显示的数量 固定值
private int totalPage;//总页数 计算出来 (int)Math.ceil(totalRecord*1.0/pageSize);
public List<T> getData() {
return data;
}
public void setData(List<T> data) {
this.data = data;
}
public int getPageNumber() {
return pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
public int getTotalRecord() {
return totalRecord;
}
public void setTotalRecord(int totalRecord) {
this.totalRecord = totalRecord;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
/**
* 获取总页数
* @return
*/
public int getTotalPage() {
return (int)Math.ceil(totalRecord*1.0/pageSize);
}
/**
* 获取开始索引
* @return
*/
public int getStartIndex(){
return (pageNumber-1)*pageSize;
}
public PageBean(int pageNumber, int pageSize) {
super();
this.pageNumber = pageNumber;
this.pageSize = pageSize;
}
}
| [
"[email protected]"
] | |
a1449cf8c8c5f5fe863dd1b686728eab7e3e941f | a5d1bd5feb381e1962d5e79b24738e81bf7bea79 | /versioned/persist/nontx/src/main/java/org/projectnessie/versioned/persist/nontx/AdjustableNonTransactionalDatabaseAdapterConfig.java | adf7904be197ca5ccac95c49cef6c3c0f3b355f2 | [
"Apache-2.0"
] | permissive | supriya-kharsan/nessie | aac13380f29ce75a3d378853ea6ab64a26933cb8 | b14d0f895ff1e2592107db3351f4009f9698833a | refs/heads/main | 2023-08-15T23:04:50.711971 | 2021-10-20T09:00:23 | 2021-10-20T09:00:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | /*
* Copyright (C) 2020 Dremio
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.projectnessie.versioned.persist.nontx;
import org.immutables.value.Value;
import org.projectnessie.versioned.persist.adapter.AdjustableDatabaseAdapterConfig;
@Value.Immutable
public interface AdjustableNonTransactionalDatabaseAdapterConfig
extends NonTransactionalDatabaseAdapterConfig, AdjustableDatabaseAdapterConfig {
AdjustableNonTransactionalDatabaseAdapterConfig withParentsPerGlobalCommit(
int parentsPerGlobalCommit);
}
| [
"[email protected]"
] | |
53d474e96af4effb50772eaa480f0f0ba0997089 | e0788e768a3c0b5ad16171d59a0baf355602738e | /jstacs/src/de/jstacs/sequenceScores/statisticalModels/trainable/mixture/MixtureTrainSM.java | 2f766ae471a3e66e718f3da7c60a04d6c4fc8d6d | [] | no_license | wsgan001/jstacs | bdf3fd597eb6c366a9599721b08cec9a8f123910 | f5e80d98f6d26c47ab53fe33a8ca34ab7a073b73 | refs/heads/master | 2021-06-01T17:16:59.376304 | 2016-08-23T18:12:21 | 2016-08-23T18:12:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,290 | java | /*
* This file is part of Jstacs.
*
* Jstacs is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* Jstacs is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* Jstacs. If not, see <http://www.gnu.org/licenses/>.
*
* For more information on Jstacs, visit http://www.jstacs.de
*/
package de.jstacs.sequenceScores.statisticalModels.trainable.mixture;
import java.text.NumberFormat;
import java.util.Arrays;
import javax.naming.OperationNotSupportedException;
import de.jstacs.algorithms.optimization.termination.TerminationCondition;
import de.jstacs.data.DataSet;
import de.jstacs.data.WrongAlphabetException;
import de.jstacs.data.sequences.Sequence;
import de.jstacs.io.NonParsableException;
import de.jstacs.sampling.BurnInTest;
import de.jstacs.sequenceScores.statisticalModels.trainable.TrainableStatisticalModel;
import de.jstacs.utils.random.MRGParams;
import de.jstacs.utils.random.MultivariateRandomGenerator;
/**
* The class for a mixture model of any {@link TrainableStatisticalModel}s.
*
* <br>
* <br>
*
* If you use Gibbs sampling temporary files will be created in the Java temp
* folder. These files will be deleted if no reference to the current instance
* exists and the Garbage Collector is called. Therefore it is recommended to
* call the Garbage Collector explicitly at the end of any application.
*
* @author Jens Keilwagen, Berit Haldemann
*/
public class MixtureTrainSM extends AbstractMixtureTrainSM {
/**
* Creates a new {@link MixtureTrainSM}. This constructor can be used for any
* algorithm since it takes all necessary values as parameters.
*
* @param length
* the length used in this model
* @param models
* the single models building the {@link MixtureTrainSM}, if the
* model is trained using
* {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING} the
* models that will be adjusted have to implement
* {@link de.jstacs.sampling.SamplingComponent}
* @param starts
* the number of times the algorithm will be started in the
* <code>train</code>-method, at least 1
* @param estimateComponentProbs
* the switch for estimating the component probabilities in the
* algorithm or to hold them fixed; if the component parameters
* are fixed, the values of <code>weights</code> will be used,
* otherwise the <code>componentHyperParams</code> will be
* incorporated in the adjustment
* @param componentHyperParams
* the hyperparameters for the component assignment prior
* <ul>
* <li>will only be used if
* <code>estimateComponentProbs == true</code>
* <li>the array has to be <code>null</code> or has to have
* length <code>models.length</code>
* <li><code>null</code> or an array with all values zero (0)
* then ML
* <li>otherwise (all values positive) a prior is used (MAP, MP,
* ...)
* <li>depends on the <code>parameterization</code>
* </ul>
* @param weights
* <code>null</code> or the weights for the components (then
* <code>weights.length == models.length</code>)
* @param algorithm
* either {@link AbstractMixtureTrainSM.Algorithm#EM} or
* {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}
* @param alpha
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the positive parameter for the Dirichlet distribution which is
* used when you invoke <code>train</code> to initialize the
* gammas. It is recommended to use <code>alpha = 1</code>
* (uniform distribution on a simplex).
* @param tc
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the {@link TerminationCondition} for stopping the EM-algorithm,
* <code>tc</code> has to return <code>true</code> from {@link TerminationCondition#isSimple()}
* @param parametrization
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the type of the component probability parameterization;
* <ul>
* <li>{@link AbstractMixtureTrainSM.Parameterization#THETA} or
* {@link AbstractMixtureTrainSM.Parameterization#LAMBDA}
* <li>the parameterization of a component is determined by the
* component model
* <li>it is recommended to use the same parameterization for the
* components and the component assignment probabilities
* <li>it is recommended to use
* {@link AbstractMixtureTrainSM.Parameterization#LAMBDA}
* </ul>
* @param initialIteration
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the positive length of the initial sampling phase (at least 1,
* at most <code>stationaryIteration/starts</code>)
* @param stationaryIteration
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the positive length of the stationary phase (at least 1)
* (summed over all starts), i.e. the number of parameter sets
* that is used for approximation
* @param burnInTest
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the test that will be used to determine the length of the
* burn-in phase
*
* @throws IllegalArgumentException
* if
* <ul>
* <li>the models are not able to score the sequence of length
* <code>length</code> <li><code>dimension < 1</code> <li>
* <code>weights != null && weights.length != dimension</code>
* <li><code>weights != null</code> and it exists an <code>i
* </code> where <code>weights[i] < 0</code> <li><code>starts
* < 1</code> <li><code>componentHyperParams</code> are not
* correct <li>the algorithm specific parameters are not correct
* </ul>
* @throws WrongAlphabetException
* if not all <code>models</code> work on the same alphabet
* @throws CloneNotSupportedException
* if the <code>models</code> can not be cloned
*/
protected MixtureTrainSM( int length, TrainableStatisticalModel[] models, int starts, boolean estimateComponentProbs, double[] componentHyperParams,
double[] weights, Algorithm algorithm, double alpha, TerminationCondition tc, Parameterization parametrization, //EM
int initialIteration, int stationaryIteration, BurnInTest burnInTest ) //GIBBS_SAMPLING
throws IllegalArgumentException,
WrongAlphabetException,
CloneNotSupportedException {
super( length,
models,
null,
models.length,
starts,
estimateComponentProbs,
componentHyperParams,
weights,
algorithm,
alpha,
tc,
parametrization,
initialIteration,
stationaryIteration,
burnInTest );
}
/**
* Creates an instance using EM and estimating the component probabilities.
*
* @param length
* the length used in this model
* @param models
* the single models building the {@link MixtureTrainSM}, if the
* model is trained using
* {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING} the
* models that will be adjusted have to implement
* {@link de.jstacs.sampling.SamplingComponent}
* @param starts
* the number of times the algorithm will be started in the
* <code>train</code>-method, at least 1
* @param componentHyperParams
* the hyperparameters for the component assignment prior
* <ul>
* <li>will only be used if
* <code>estimateComponentProbs == true</code>
* <li>the array has to be <code>null</code> or has to have
* length <code>models.length</code>
* <li><code>null</code> or an array with all values zero (0)
* then ML
* <li>otherwise (all values positive) a prior is used (MAP, MP,
* ...)
* <li>depends on the <code>parameterization</code>
* </ul>
* @param alpha
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the positive parameter for the Dirichlet distribution which is
* used when you invoke <code>train</code> to initialize the
* gammas. It is recommended to use <code>alpha = 1</code>
* (uniform distribution on a simplex).
* @param tc
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the {@link TerminationCondition} for stopping the EM-algorithm,
* <code>tc</code> has to return <code>true</code> from {@link TerminationCondition#isSimple()}
* @param parametrization
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the type of the component probability parameterization
* <ul>
* <li>{@link AbstractMixtureTrainSM.Parameterization#THETA} or
* {@link AbstractMixtureTrainSM.Parameterization#LAMBDA}
* <li>the parameterization of a component is determined by the
* component model
* <li>it is recommended to use the same parameterization for the
* components and the component assignment probabilities
* <li>it is recommended to use
* {@link AbstractMixtureTrainSM.Parameterization#LAMBDA}
* </ul>
*
* @throws IllegalArgumentException
* if
* <ul>
* <li>the models are not able to score the sequence of length
* <code>length</code>
* <li><code>dimension < 1</code>
* <li>
* <code>weights != null && weights.length != dimension</code>
* <li><code>weights != null</code> and it exists an
* <code>i</code> where <code>weights[i] < 0</code>
* <li><code>starts < 1</code>
* <li><code>componentHyperParams</code> are not correct
* <li>the algorithm specific parameters are not correct
* </ul>
* @throws WrongAlphabetException
* if not all <code>models</code> work on the same alphabet
* @throws CloneNotSupportedException
* if the <code>models</code> can not be cloned
*
* @see MixtureTrainSM#MixtureTrainSM(int, de.jstacs.sequenceScores.statisticalModels.trainable.TrainableStatisticalModel[], int,
* boolean, double[], double[],
* de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM.Algorithm, double,
* TerminationCondition,
* de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM.Parameterization, int,
* int, de.jstacs.sampling.BurnInTest)
* @see AbstractMixtureTrainSM.Algorithm#EM
*/
public MixtureTrainSM( int length, TrainableStatisticalModel[] models, int starts, double[] componentHyperParams, double alpha, TerminationCondition tc,
Parameterization parametrization ) throws IllegalArgumentException, WrongAlphabetException,
CloneNotSupportedException {
this( length, models, starts, true, componentHyperParams, null, Algorithm.EM, alpha, tc, parametrization, 0, 0, null );
}
/**
* Creates an instance using EM and fixed component probabilities.
*
* @param length
* the length used in this model
* @param models
* the single models building the {@link MixtureTrainSM}, if the
* model is trained using
* {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING} the
* models that will be adjusted have to implement
* {@link de.jstacs.sampling.SamplingComponent}
* @param starts
* the number of times the algorithm will be started in the
* <code>train</code>-method, at least 1
* @param weights
* <code>null</code> or the weights for the components (then
* <code>weights.length == models.length</code>)
* @param alpha
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the positive parameter for the Dirichlet distribution which is
* used when you invoke <code>train</code> to initialize the
* gammas. It is recommended to use <code>alpha = 1</code>
* (uniform distribution on a simplex).
* @param tc
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the {@link TerminationCondition} for stopping the EM-algorithm,
* <code>tc</code> has to return <code>true</code> from {@link TerminationCondition#isSimple()}
* @param parametrization
* only for {@link AbstractMixtureTrainSM.Algorithm#EM}<br>
* the type of the component probability parameterization;
* <ul>
* <li>{@link AbstractMixtureTrainSM.Parameterization#THETA} or
* {@link AbstractMixtureTrainSM.Parameterization#LAMBDA}
* <li>the parameterization of a component is determined by the
* component model
* <li>it is recommended to use the same parameterization for the
* components and the component assignment probabilities
* <li>it is recommended to use
* {@link AbstractMixtureTrainSM.Parameterization#LAMBDA}
* </ul>
*
* @throws IllegalArgumentException
* if
* <ul>
* <li>the models are not able to score the sequence of length
* <code>length</code>
* <li><code>dimension < 1</code>
* <li>
* <code>weights != null && weights.length != dimension</code>
* <li><code>weights != null</code> and it exists an
* <code>i</code> where <code>weights[i] < 0</code>
* <li><code>starts < 1</code>
* <li><code>componentHyperParams</code> are not correct
* <li>the algorithm specific parameters are not correct
* </ul>
* @throws WrongAlphabetException
* if not all <code>models</code> work on the same alphabet
* @throws CloneNotSupportedException
* if the <code>models</code> can not be cloned
*
* @see MixtureTrainSM#MixtureTrainSM(int, de.jstacs.sequenceScores.statisticalModels.trainable.TrainableStatisticalModel[], int,
* boolean, double[], double[],
* de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM.Algorithm, double,
* TerminationCondition,
* de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM.Parameterization, int,
* int, de.jstacs.sampling.BurnInTest)
* @see AbstractMixtureTrainSM.Algorithm#EM
*/
public MixtureTrainSM( int length, TrainableStatisticalModel[] models, double[] weights, int starts, double alpha, TerminationCondition tc,
Parameterization parametrization ) throws IllegalArgumentException, WrongAlphabetException,
CloneNotSupportedException {
this( length, models, starts, false, null, weights, Algorithm.EM, alpha, tc, parametrization, 0, 0, null );
}
/**
* Creates an instance using Gibbs Sampling and sampling the component
* probabilities.
*
* @param length
* the length used in this model
* @param models
* the single models building the {@link MixtureTrainSM}, if the
* model is trained using
* {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING} the
* models that will be adjusted have to implement
* {@link de.jstacs.sampling.SamplingComponent}
* @param starts
* the number of times the algorithm will be started in the
* <code>train</code>-method, at least 1
* @param componentHyperParams
* the hyperparameters for the component assignment prior
* <ul>
* <li>will only be used if
* <code>estimateComponentProbs == true</code>
* <li>the array has to be <code>null</code> or has to have
* length <code>models.length</code>
* <li><code>null</code> or an array with all values zero (0)
* then ML
* <li>otherwise (all values positive) a prior is used (MAP, MP,
* ...)
* <li>depends on the <code>parameterization</code>
* </ul>
* @param initialIteration
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the positive length of the initial sampling phase (at least 1,
* at most <code>stationaryIteration/starts</code>)
* @param stationaryIteration
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the positive length of the stationary phase (at least 1)
* (summed over all starts), i.e. the number of parameter sets
* that is used for approximation
* @param burnInTest
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the test that will be used to determine the length of the
* burn-in phase
*
* @throws IllegalArgumentException
* if
* <ul>
* <li>the models are not able to score the sequence of length
* <code>length</code>
* <li><code>dimension < 1</code>
* <li>
* <code>weights != null && weights.length != dimension</code>
* <li><code>weights != null</code> and it exists an
* <code>i</code> where <code>weights[i] < 0</code>
* <li><code>starts < 1</code>
* <li><code>componentHyperParams</code> are not correct
* <li>the algorithm specific parameters are not correct
* </ul>
* @throws WrongAlphabetException
* if not all <code>models</code> work on the same alphabet
* @throws CloneNotSupportedException
* if the <code>models</code> can not be cloned
*
* @see MixtureTrainSM#MixtureTrainSM(int, de.jstacs.sequenceScores.statisticalModels.trainable.TrainableStatisticalModel[], int,
* boolean, double[], double[],
* de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM.Algorithm, double,
* TerminationCondition,
* de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM.Parameterization, int,
* int, de.jstacs.sampling.BurnInTest)
* @see AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING
*/
public MixtureTrainSM( int length, TrainableStatisticalModel[] models, int starts, double[] componentHyperParams, int initialIteration,
int stationaryIteration, BurnInTest burnInTest ) throws IllegalArgumentException, WrongAlphabetException,
CloneNotSupportedException {
this( length,
models,
starts,
true,
componentHyperParams,
null,
Algorithm.GIBBS_SAMPLING,
0,
null,
Parameterization.LAMBDA,
initialIteration,
stationaryIteration,
burnInTest );
}
/**
* Creates an instance using Gibbs Sampling and fixed component
* probabilities.
*
* @param length
* the length used in this model
* @param models
* the single models building the {@link MixtureTrainSM}, if the
* model is trained using
* {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING} the
* models that will be adjusted have to implement
* {@link de.jstacs.sampling.SamplingComponent}
* @param starts
* the number of times the algorithm will be started in the
* <code>train</code>-method, at least 1
* @param weights
* <code>null</code> or the weights for the components (than
* <code>weights.length == models.length</code>)
* @param initialIteration
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the positive length of the initial sampling phase (at least 1,
* at most <code>stationaryIteration/starts</code>)
* @param stationaryIteration
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the positive length of the stationary phase (at least 1)
* (summed over all starts), i.e. the number of parameter sets
* that is used for approximation
* @param burnInTest
* only for {@link AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING}<br>
* the test that will be used to determine the length of the
* burn-in phase
*
* @throws IllegalArgumentException
* if
* <ul>
* <li>the models are not able to score the sequence of length
* <code>length</code>
* <li><code>dimension < 1</code>
* <li>
* <code>weights != null && weights.length != dimension</code>
* <li><code>weights != null</code> and it exists an
* <code>i</code> where <code>weights[i] < 0</code>
* <li><code>starts < 1</code>
* <li><code>componentHyperParams</code> are not correct
* <li>the algorithm specific parameters are not correct
* </ul>
* @throws WrongAlphabetException
* if not all <code>models</code> work on the same alphabet
* @throws CloneNotSupportedException
* if the <code>models</code> can not be cloned
*
* @see MixtureTrainSM#MixtureTrainSM(int, de.jstacs.sequenceScores.statisticalModels.trainable.TrainableStatisticalModel[], int,
* boolean, double[], double[],
* de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM.Algorithm, double,
* TerminationCondition,
* de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM.Parameterization, int,
* int, de.jstacs.sampling.BurnInTest)
* @see AbstractMixtureTrainSM.Algorithm#GIBBS_SAMPLING
*/
public MixtureTrainSM( int length, TrainableStatisticalModel[] models, double[] weights, int starts, int initialIteration, int stationaryIteration,
BurnInTest burnInTest ) throws IllegalArgumentException, WrongAlphabetException, CloneNotSupportedException {
this( length,
models,
starts,
false,
null,
weights,
Algorithm.GIBBS_SAMPLING,
0,
null,
Parameterization.LAMBDA,
initialIteration,
stationaryIteration,
burnInTest );
}
/**
* The constructor for the interface {@link de.jstacs.Storable}. Creates a
* new {@link MixtureTrainSM} out of its XML representation.
*
* @param xml
* the XML representation of the model as {@link StringBuffer}
*
* @throws NonParsableException
* if the {@link StringBuffer} is not parsable
*/
public MixtureTrainSM( StringBuffer xml ) throws NonParsableException {
super( xml );
}
/* (non-Javadoc)
* @see de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM#emitDataSetUsingCurrentParameterSet(int, int[])
*/
@Override
protected Sequence[] emitDataSetUsingCurrentParameterSet( int n, int... lengths ) throws Exception {
int[] numbers = new int[dimension];
Arrays.fill( numbers, 0 );
int counter = 0, no = 0, k = 0;
// sample how many sequences each model should generate
for( ; no < n; no++ ) {
numbers[AbstractMixtureTrainSM.draw( weights, 0 )]++;
}
no = 0;
DataSet help;
Sequence[] seqs = new Sequence[n];
if( length == 0 ) {
// homogenous case
for( ; counter < dimension; counter++ ) {
if( numbers[counter] > 0 ) {
if( lengths.length == 1 ) {
help = model[counter].emitDataSet( n, lengths );
} else {
int[] array = new int[numbers[counter]];
System.arraycopy( lengths, k, array, 0, numbers[counter] );
help = model[counter].emitDataSet( n, array );
}
for( k = 0; k < help.getNumberOfElements(); k++ ) {
seqs[no] = help.getElementAt( k );
}
}
}
} else {
// inhomogenous case
if( lengths == null || lengths.length == 0 ) {
// System.out.println( Arrays.toString( weights ) );
// System.out.println( Arrays.toString( numbers ) );
// generate sequences
for( ; counter < dimension; counter++ ) {
if( numbers[counter] > 0 ) {
if( model[counter].getLength() == 0 ) {
help = model[counter].emitDataSet( numbers[counter], length );
} else {
help = model[counter].emitDataSet( numbers[counter], lengths );
}
for( no = 0; no < numbers[counter]; no++, k++ ) {
seqs[k] = help.getElementAt( no );
}
}
}
} else {
throw new Exception( "This is an inhomogeneous model. Please check parameter lengths." );
}
}
return seqs;
}
/* (non-Javadoc)
* @see de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM#doFirstIteration(double[], de.jstacs.utils.random.MultivariateRandomGenerator, de.jstacs.utils.random.MRGParams[])
*/
@Override
protected double[][] doFirstIteration( double[] dataWeights, MultivariateRandomGenerator m, MRGParams[] params ) throws Exception {
int counter1, counter2, d = sample[0].getNumberOfElements();
double[][] seqweights = createSeqWeightsArray();
double[] w = new double[dimension];
initWithPrior( w );
double[] help = new double[dimension];
if( dataWeights == null ) {
for( counter1 = 0; counter1 < d; counter1++ ) {
help = m.generate( dimension, params[counter1] );
for( counter2 = 0; counter2 < dimension; counter2++ ) {
seqweights[counter2][counter1] = help[counter2];
w[counter2] += help[counter2];
}
}
} else {
for( counter1 = 0; counter1 < d; counter1++ ) {
help = m.generate( dimension, params[counter1] );
for( counter2 = 0; counter2 < dimension; counter2++ ) {
seqweights[counter2][counter1] = dataWeights[counter1] * help[counter2];
w[counter2] += seqweights[counter2][counter1];
}
}
}
getNewParameters( 0, seqweights, w );
return seqweights;
}
/**
* This method enables you to train a mixture model with a fixed start
* partitioning. This is useful to compare implementations or if one has a
* hypothesis how the components should look like.
*
* @param data
* the data set of sequences
* @param dataWeights
* <code>null</code> or the weights of each element of the data set
* @param partitioning
* a kind of partitioning
* <ol>
* <li> <code>partitioning.length</code> has to be
* <code>data.getNumberofElements()</code>
* <li>for all i: <code>partitioning[i].length</code> has to be
* <code>getNumberOfModels()</code>
* <li>{@latex.inline $\\forall i:\\;\\sum_j partitioning[i][j] \\stackrel{!}{=}1$}
* </ol>
*
* @return the weighting array used to initialize, this array can be reused
* in the following iterations
*
* @throws Exception
* if something went wrong or if the number of components is 1
*/
public double[][] doFirstIteration( DataSet data, double[] dataWeights, double[][] partitioning ) throws Exception {
setTrainData( data );
if( dimension > 1 ) {
int counter1, counter2, d = data.getNumberOfElements();
double[][] seqweights = createSeqWeightsArray();
double[] w = new double[dimension];
initWithPrior( w );
double sum;
for( counter1 = 0; counter1 < d; counter1++ ) {
if( partitioning[counter1].length != dimension ) {
throw new IllegalArgumentException( "The partitioning for sequence " + counter1 + " was wrong. (number of parts)" );
}
sum = 0;
for( counter2 = 0; counter2 < dimension; counter2++ ) {
if( partitioning[counter1][counter2] < 0 || partitioning[counter1][counter2] > 1 ) {
throw new IllegalArgumentException( "The partitioning for sequence " + counter1
+ " was wrong. (part "
+ counter2
+ "was incorrect)" );
}
seqweights[counter2][counter1] = ( ( dataWeights == null ) ? 1d : dataWeights[counter1] ) * partitioning[counter1][counter2];
sum += partitioning[counter1][counter2];
w[counter2] += seqweights[counter2][counter1];
}
if( sum != 1 ) {
throw new IllegalArgumentException( "The partitioning for sequence " + counter1 + " was wrong. (sum of parts not 1)" );
}
}
getNewParameters( 0, seqweights, w );
return seqweights;
} else {
throw new OperationNotSupportedException();
}
}
/* (non-Javadoc)
* @see de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM#getLogProbUsingCurrentParameterSetFor(int, de.jstacs.data.Sequence, int, int)
*/
@Override
protected double getLogProbUsingCurrentParameterSetFor( int component, Sequence s, int start, int end ) throws Exception {
return logWeights[component] + model[component].getLogProbFor( s, start, end );
}
/*
* (non-Javadoc)
* @see de.jstacs.sequenceScores.SequenceScore#toString(java.text.NumberFormat)
*/
@Override
public String toString(NumberFormat nf) {
StringBuffer sb = new StringBuffer( model.length * 100000 );
sb.append( "Mixture model with parameter estimation by " + getNameOfAlgorithm() + ": \n" );
sb.append( "number of starts:\t" + starts + "\n" );
switch( algorithm ) {
case EM:
for( int i = 0; i < dimension; i++ ) {
sb.append( nf.format( weights[i] ) + "\t" + model[i].getInstanceName() + "\n" + model[i].toString(nf) + "\n" );
}
break;
case GIBBS_SAMPLING:
sb.append( "burn in test :\t" + burnInTest.getInstanceName() + "\n" );
sb.append( "length of stationary phase:\t" + stationaryIteration + "\n" );
sb.append( "Mixture model components:\n" );
for( int i = 0; i < dimension; i++ ) {
sb.append( ( i + 1 ) + ". component: " + model[i].getInstanceName() + "\n" );
}
break;
default:
throw new IllegalArgumentException( "The type of algorithm is unknown." );
}
return sb.toString();
}
/**
* Computes sequence weights and returns the score.
*/
@Override
protected double getNewWeights( double[] dataWeights, double[] w, double[][] seqweights ) throws Exception {
double L = 0, currentWeight = 1;
int counter1, counter2 = 0;
Sequence seq;
initWithPrior( w );
double[] help = new double[dimension];
for( counter1 = 0; counter1 < seqweights[0].length; counter1++ ) {
seq = sample[0].getElementAt( counter1 );
if( dataWeights != null ) {
currentWeight = dataWeights[counter1];
}
for( counter2 = 0; counter2 < dimension; counter2++ ) {
help[counter2] = model[counter2].getLogProbFor( seq ) + logWeights[counter2];
}
L += modifyWeights( help ) * currentWeight;
for( counter2 = 0; counter2 < dimension; counter2++ ) {
seqweights[counter2][counter1] = help[counter2] * currentWeight;
w[counter2] += seqweights[counter2][counter1];
}
}
return L;
}
/* (non-Javadoc)
* @see de.jstacs.sequenceScores.statisticalModels.trainable.mixture.AbstractMixtureTrainSM#setTrainData(de.jstacs.data.DataSet)
*/
@Override
protected void setTrainData( DataSet data ) {
sample = new DataSet[]{ data };
}
}
| [
"[email protected]"
] | |
a83ad0a09a0ab00653afa69a48ad3e40dc02eb0a | cbd1798fa1a31a26a7fabd0f4044368ef9af8248 | /app/src/main/java/sv/edu/ues/fia/eisi/pdm115/docente/AdmRepetidoActivity.java | 675138f2c3889c3c375939426e5c9e7661f02e00 | [] | no_license | mikezxcv/PDM115 | 023ccf0c37d78f7a3fc46a83133ab70141ae0dcf | 8063d9580300d0124f307146d8d745c83f67aa91 | refs/heads/master | 2022-11-13T08:45:57.524505 | 2020-07-07T06:17:59 | 2020-07-07T06:17:59 | 269,791,692 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,155 | java | package sv.edu.ues.fia.eisi.pdm115.docente;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import java.util.List;
import sv.edu.ues.fia.eisi.pdm115.ControlBdGrupo12;
public class AdmRepetidoActivity extends ListActivity {
String[] activities={"AdmDetallesolicitudRepetido"};
//campos a mostrar
String [] idRepetido;
String [] carnet;
String [] nombre;
String [] materias;
String [] tipoEvaluacion;
String [] fechaSolicitudRepetido;
String[] notaAntesRepetido;
String [] opciones;
String cantidad;
ControlBdGrupo12 helper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
helper= new ControlBdGrupo12(this);
llenar();
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, opciones));
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Intent intent = new Intent(this,AdmDetallesolicitudRepetido.class);
intent.putExtra("idRepetido",idRepetido[position]);
intent.putExtra("carnet",carnet[position]);
intent.putExtra("nombre",nombre[position]);
intent.putExtra("materia",materias[position]);
intent.putExtra("evaluacion",tipoEvaluacion[position]);
intent.putExtra("fechaSolicitud",fechaSolicitudRepetido[position]);
intent.putExtra("notaAntesRepetido",notaAntesRepetido[position]);
this.startActivity(intent);
}
protected void llenar(){
int contador=0;
helper.abrir();
cantidad= helper.consultarCantidadSolicitudesRepetidos();
idRepetido = new String[Integer.parseInt(cantidad)];
carnet= new String[Integer.parseInt(cantidad)];
nombre = new String[Integer.parseInt(cantidad)];
materias = new String[Integer.parseInt(cantidad)];
tipoEvaluacion = new String[Integer.parseInt(cantidad)];
fechaSolicitudRepetido = new String[Integer.parseInt(cantidad)];
notaAntesRepetido = new String[Integer.parseInt(cantidad)];
idRepetido = helper.idSolicitudRepetido();
carnet = helper.carnetSolicitudRepetido();
nombre = helper.nombreSolicitudRepetido();
materias = helper.idAsignaturaSolicitudRepetido();
tipoEvaluacion = helper.tipoEvaluacionSolicitudRepetido();
fechaSolicitudRepetido = helper.fechaSolicitudRepetido();
notaAntesRepetido = helper.notaAntesSolicitudRepetido();
opciones= new String[Integer.parseInt(cantidad)];
helper.cerrar();
for (int i=0; i<Integer.valueOf(cantidad);i++){
contador= contador+1;
String alumno= carnet[i];
String materia= materias[i];
opciones[i]= "Solicitud Repetido "+contador+" ["+ alumno+" - "+materia+" ]";
}
}
}
| [
"[email protected]"
] | |
00e1737b12a6bf80c0a7fa0f8c1fc59af18e3f09 | cd38aa60a8f53ecc42e9dbea664747fba5f919e3 | /Backend/luvbox-dao/src/main/java/dao/TbRequestTemplate.java | e2e0a780d91f3ce00c294e63b8eae8473f2a78c1 | [] | no_license | mysincreative/luvbox-demo-server | 0068243dacd9fe2a70e7ef6c1f707f8abc221609 | e7608dce3868b1d8a3dd6a7b499ceffe4f0d684b | refs/heads/master | 2016-09-06T20:16:51.249849 | 2015-11-05T11:09:16 | 2015-11-05T11:09:16 | 42,809,385 | 0 | 0 | null | 2015-10-08T08:31:41 | 2015-09-20T10:46:45 | Java | UTF-8 | Java | false | false | 1,572 | java | package dao;
import javax.persistence.*;
import static javax.persistence.GenerationType.IDENTITY;
/**
* TbRequestTemplate entity. @author MyEclipse Persistence Tools
*/
@Entity
@Table(name = "tb_request_template" )
public class TbRequestTemplate implements java.io.Serializable {
// Fields
private Integer id;
private TbTemplate tbTemplate;
private TbRequest tbRequest;
private Boolean isChooise;
private Double price;
// Constructors
/** default constructor */
public TbRequestTemplate() {
}
// Property accessors
@Id
@Column(name = "id", unique = true, nullable = false)
@GeneratedValue(strategy = IDENTITY)
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "templateId", nullable = false)
public TbTemplate getTbTemplate() {
return this.tbTemplate;
}
public void setTbTemplate(TbTemplate tbTemplate) {
this.tbTemplate = tbTemplate;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "requestId", nullable = false)
public TbRequest getTbRequest() {
return tbRequest;
}
public void setTbRequest(TbRequest tbRequest) {
this.tbRequest = tbRequest;
}
@Column(name ="isChooise")
public Boolean getIsChooise() {
return isChooise;
}
public void setIsChooise(Boolean isChooise) {
this.isChooise = isChooise;
}
@Column(name="price")
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
} | [
"[email protected]"
] | |
85c18ac9e79e587f3df7fba4ccc3fa31b8f1c2f5 | a888c2362d56f7894b94dfe0890667bda718de5a | /src/main/java/calculator/AddOperation.java | 7e320483b16cae800b7a0d1512534ecc430c968e | [] | no_license | junhee-ko/tdd-practice | 0737e6c000b17e6c96fc57fdc728997b1f9e3817 | 13cc53d2cd9091163707e713a765a66f4dd41c89 | refs/heads/master | 2022-04-12T12:48:54.338125 | 2020-02-05T13:15:30 | 2020-02-05T13:15:30 | 237,213,879 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 240 | java | package calculator;
import java.math.BigDecimal;
public class AddOperation extends BinaryOperation {
@Override
protected BigDecimal calculate(BigDecimal value01, BigDecimal value02) {
return value01.add(value02);
}
}
| [
"[email protected]"
] | |
9a9f8530a93a84b9b9cb69580abbcf2d39c42a37 | b641e97d985535e4f1d52c7891aa907f3eb0a254 | /src/Components/animatefx/animation/ZoomInDown.java | 68df54c64856bd6da294ef13ab20f51f6fd23eee | [] | no_license | mmaciag1991/HarnessDesignSystemInterfaceDiagram | 7e6f5dc078205475700dc2f63abc3f1e88e62728 | 4569676541a80dff1ffb5df6080799367e835065 | refs/heads/main | 2023-05-19T00:43:10.113472 | 2021-06-11T21:54:03 | 2021-06-11T21:54:03 | 375,101,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,635 | java | package Components.animatefx.animation;
import javafx.animation.Interpolator;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.scene.Node;
import javafx.util.Duration;
/**
* @author Loïc Sculier aka typhon0
*/
public class ZoomInDown extends AnimationFX {
/**
* Create new ZoomInDown
*
* @param node The node to affect
*/
public ZoomInDown(Node node) {
super(node);
}
public ZoomInDown() {
}
@Override
AnimationFX resetNode() {
return this;
}
@Override
void initTimeline() {
setTimeline(new Timeline(
new KeyFrame(Duration.millis(0),
new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
new KeyValue(getNode().translateYProperty(), -600, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)),
new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19))
),
new KeyFrame(Duration.millis(600),
new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
new KeyValue(getNode().translateYProperty(), 60, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1))
),
new KeyFrame(Duration.millis(1000),
new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)),
new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1))
)
));
}
}
| [
"[email protected]"
] | |
60a87e7afec6addc297a6f42e9a1899571945078 | bdb5d205d56ef9e0f523be1c3fd683400f7057a5 | /app/src/main/java/com/tgf/kcwc/mvp/presenter/CarDataPresenter.java | 95e82ec5300cd90c58013d0a64b646985f28ab2e | [] | no_license | yangyusong1121/Android-car | f8fbd83b8efeb2f0e171048103f2298d96798f9e | d6215e7a59f61bd7f15720c8e46423045f41c083 | refs/heads/master | 2020-03-11T17:25:07.154083 | 2018-04-19T02:18:15 | 2018-04-19T02:20:19 | 130,146,301 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 15,100 | java | package com.tgf.kcwc.mvp.presenter;
import com.tgf.kcwc.common.Constants;
import com.tgf.kcwc.mvp.ServiceFactory;
import com.tgf.kcwc.mvp.model.CarBean;
import com.tgf.kcwc.mvp.model.CarColor;
import com.tgf.kcwc.mvp.model.FactorySeriesModel;
import com.tgf.kcwc.mvp.model.GalleryDetailModel;
import com.tgf.kcwc.mvp.model.ModelGalleryModel;
import com.tgf.kcwc.mvp.model.ResponseMessage;
import com.tgf.kcwc.mvp.model.SeriesDetailModel;
import com.tgf.kcwc.mvp.model.SeriesModel;
import com.tgf.kcwc.mvp.model.TopicTagDataModel;
import com.tgf.kcwc.mvp.model.VehicleService;
import com.tgf.kcwc.mvp.view.CarDataView;
import com.tgf.kcwc.util.CommonUtils;
import com.tgf.kcwc.util.RXUtil;
import java.util.List;
import java.util.Map;
import rx.Observer;
import rx.Subscription;
import rx.functions.Action0;
/**
* Author:Jenny
* Date:2016/12/8 20:55
* E-mail:[email protected]
* 整车-车型列表Presenter
*/
public class CarDataPresenter extends WrapPresenter<CarDataView> {
private CarDataView mView;
private Subscription mSubscription;
private VehicleService mService = null;
@Override
public void attachView(CarDataView view) {
this.mView = view;
mService = ServiceFactory.getVehicleService();
}
/**
* 获取车列表
*
* @param brandId
* @param page
* @param priceKey
* @param priceMin
* @param priceMax
* @param seatKey
*/
public void loadDatas(String brandId, String page, String priceKey, String priceMin,
String priceMax, String seatKey, String isFirst, String token) {
mSubscription = RXUtil.execute(mService.getSeriesList(brandId, page, priceKey, priceMin,
priceMax, seatKey, isFirst, token), new Observer<ResponseMessage<SeriesModel>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<SeriesModel> motoListDataResponseMessage) {
mView.showData(motoListDataResponseMessage.data);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 获取车列表
*
* @param params
*/
public void loadDatas(Map<String, String> params) {
mSubscription = RXUtil.execute(mService.getSeriesList(params), new Observer<ResponseMessage<SeriesModel>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<SeriesModel> motoListDataResponseMessage) {
mView.showData(motoListDataResponseMessage.data);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 根据品牌id获取车型列表
*
* @param brandId
*/
public void loadDatas(String brandId, String token) {
mSubscription = RXUtil.execute(mService.getCarsByBrandId(brandId, token),
new Observer<ResponseMessage<List<CarBean>>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<List<CarBean>> motoListDataResponseMessage) {
// mView.showModelDatas(motoListDataResponseMessage.data);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 获取车型详情
*
* @param seriesId
*/
public void getSeriesDetail(String seriesId, String token) {
mSubscription = RXUtil.execute(mService.getSeriesDetail(seriesId, token),
new Observer<ResponseMessage<SeriesDetailModel>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<SeriesDetailModel> responseMessage) {
if (Constants.NetworkStatusCode.SUCCESS == responseMessage.statusCode) {
mView.showData(responseMessage.data);
} else {
CommonUtils.showToast(mView.getContext(), responseMessage.statusMessage);
}
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 获取车系、车型图库
*
* @param seriesId
* @param type car or series
* @param outId
* @param inId
* @param carId
*/
public void getCarGallery(String seriesId, String type, String outId, String inId,
String carId) {
mSubscription = RXUtil.execute(mService.getCarGallery(seriesId, type, outId, inId, carId),
new Observer<ResponseMessage<ModelGalleryModel>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<ModelGalleryModel> responseMessage) {
if (Constants.NetworkStatusCode.SUCCESS == responseMessage.statusCode) {
mView.showData(responseMessage.data);
} else {
CommonUtils.showToast(mView.getContext(), responseMessage.statusMessage);
}
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
public void getCarCategoryColors(String id, String type, String colorType) {
mSubscription = RXUtil.execute(mService.getCarCategoryColors(id, type, colorType),
new Observer<ResponseMessage<List<CarColor>>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<List<CarColor>> responseMessage) {
if (Constants.NetworkStatusCode.SUCCESS == responseMessage.statusCode) {
mView.showData(responseMessage.data);
} else {
CommonUtils.showToast(mView.getContext(), responseMessage.statusMessage);
}
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 根据品牌id获取车系列表
*
* @param brandId
*/
public void getSeriesByBrand(String brandId, String token) {
mSubscription = RXUtil.execute(mService.getSeriesByBrand(brandId, token),
new Observer<ResponseMessage<List<CarBean>>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<List<CarBean>> responseMessage) {
mView.showData(responseMessage.data);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 根据车系id获取车型列表
*
* @param seriesId
*/
public void getCarBySeries(String seriesId, String token) {
mSubscription = RXUtil.execute(mService.getCarBySeries(seriesId, token),
new Observer<ResponseMessage<List<CarBean>>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<List<CarBean>> responseMessage) {
mView.showData(responseMessage.data);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 车系、车型图库详情
*
* @param
*/
public void getGalleryDetails(String id, String imgType, String type) {
mSubscription = RXUtil.execute(mService.getGalleryDetails(id, imgType, type),
new Observer<ResponseMessage<GalleryDetailModel>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<GalleryDetailModel> responseMessage) {
mView.showData(responseMessage.data.images);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 当前车系下的车型列表
*
* @param id
*/
public void getCarList(String id) {
mSubscription = RXUtil.execute(mService.getCarList(id),
new Observer<ResponseMessage<List<CarBean>>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<List<CarBean>> responseMessage) {
mView.showData(responseMessage.data);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 厂商车系(二级品牌车系)
*
* @param params
*/
public void getFactorySeries(Map<String, String> params) {
mSubscription = RXUtil.execute(mService.getFactorySeries(params),
new Observer<ResponseMessage<FactorySeriesModel>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<FactorySeriesModel> responseMessage) {
mView.showData(responseMessage.data);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
/**
* 获取帖子带参标签数据
*
* @param params
*/
public void getTopicTagDatas(Map<String, String> params) {
mSubscription = RXUtil.execute(mService.getTopicTagDatas(params),
new Observer<ResponseMessage<List<TopicTagDataModel>>>() {
@Override
public void onCompleted() {
mView.setLoadingIndicator(false);
}
@Override
public void onError(Throwable e) {
mView.showLoadingTasksError();
}
@Override
public void onNext(ResponseMessage<List<TopicTagDataModel>> responseMessage) {
mView.showData(responseMessage.data);
}
}, new Action0() {
@Override
public void call() {
mView.setLoadingIndicator(true);
}
});
mSubscriptions.add(mSubscription);
}
}
| [
"[email protected]"
] | |
01eb4626c48c519c2f3356a35d74690ddb74b6ef | 279f30adbc967c844d73b32562fa7b5b0b818f05 | /CN Lab/9/MULTIUSER/Server.java | 6cc4e47971ce132df902c97e8d6c1dc54c90ff28 | [] | no_license | sayali-s/TE-Ass | 91a714b45aa64634ac0f949516478e16b5b6a583 | b1f20c980bd6cc3c1e43a600ee87bfb5ed4fc3a7 | refs/heads/master | 2023-02-08T16:45:28.303348 | 2021-01-02T10:55:56 | 2021-01-02T10:55:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,334 | java | import java.io.*;
import java.net.*;
class ClientThread implements Runnable{
DataInputStream in;
DataOutputStream out;
Socket s;
Thread t;
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
public ClientThread(Socket s) {
this.s=s;
try {
in=new DataInputStream(s.getInputStream());
out=new DataOutputStream(s.getOutputStream());
t=new Thread(this);
t.setName(in.readUTF());
System.out.println("\n"+t.getName()+" joined Chat....");
t.start();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void run() {
String str="",str2="sd";
try {
while(!str2.equalsIgnoreCase("end"))
{
str=in.readUTF();
System.out.println(t.getName()+" says: "+str);
System.out.print("Enter Your Message to "+t.getName()+" : ");
str2=read.readLine();
out.writeUTF(str2);
out.flush();
}
in.close();
out.close();
s.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public class Server {
public static void main(String[] args) throws IOException {
ServerSocket ss = new ServerSocket(8033);
System.out.println("Server is created");
while(true)
new ClientThread(ss.accept());
}
}
| [
"[email protected]"
] | |
263af6c091b10cf02abb4afb08f3729e6810828c | a0d9ec7776e20f36ef73749d243f3460cc209ffd | /src/coinpurse/MoneyFactoryDemo.java | 61eac2858fa361ab0b7e34c7f2991508becbdd73 | [] | no_license | OOP2018/coinpurse-jampttws | 25b28b802c0e74bcd7a2e6a6c9c1c327f65a0f46 | 585f4ba2689d31b1de00b101addd48ec32f0fca3 | refs/heads/master | 2021-05-11T09:49:01.939946 | 2018-04-21T14:43:56 | 2018-04-21T14:43:56 | 118,087,538 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,013 | java | package coinpurse;
/**
* Test the method of any MoneyFactory.
* @author Tanasorn Tritawisup
*
*/
public class MoneyFactoryDemo {
public static void main(String[] args){
//test create Thai's money
MoneyFactory tm = new ThaiMoneyFactory();
System.out.println(tm.createMoney(1));
System.out.println(tm.createMoney(20));
System.out.println(tm.createMoney(50));
//test create Malaysia's money
MoneyFactory mm = new MalayMoneyFactory();
System.out.println(mm.createMoney(0.05));
System.out.println(mm.createMoney(2));
System.out.println(mm.createMoney(100));
//test setFactory
MoneyFactory mf1 = MoneyFactory.getInstance();
System.out.println(mf1.createMoney(2));
MoneyFactory.setFactory(new MalayMoneyFactory());
MoneyFactory mf2 = MoneyFactory.getInstance();
System.out.println(mf2.createMoney(0.10));
MoneyFactory mf3 = MoneyFactory.getInstance();
if(mf2 == mf3) {
System.out.println("singleton");
}else {
System.out.println("not singleton");
}
}
}
| [
"[email protected]"
] | |
fb2bcb45c4d8696a66bb51f428fbc15492087bba | c24d47a9b1b69fbb7d32a7d6a80cedd10a937c83 | /Day3Programs/Sorting.java | cbd1d99e3c406d1a95875b882127efe4219298b2 | [] | no_license | Naveenreddybhavanam/HCL-Assignments- | 4a6b9fa74916f977c99bb4027a730502311769b0 | 2768bebbdaed240e01c6a8c4098db789666e0dc8 | refs/heads/master | 2022-12-31T00:00:56.684433 | 2020-10-21T12:05:51 | 2020-10-21T12:05:51 | 294,048,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 446 | java | package day3;
import java.util.Arrays;
public class Sorting {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr = {34,56,12,6,3,57,244,74,123,67};
int temp;
for(int i=0; i<arr.length; i++) {
for(int j=i+1; j<arr.length; j++) {
if(arr[i]>arr[j] ){
temp=arr[j];
arr[j]=arr[i];
arr[i]=temp;
}
}
}
System.out.println(Arrays.toString(arr));
}
}
| [
"[email protected]"
] | |
48e9d3d4f4852523825db022e9e461f14b17fcb2 | 046a5d5799d885b989369a2fe12137cf5ede240d | /deployer/src/it/polito/dp2/NFV/lab3/AllocationException.java | 76ccdf6d9c2a1a4a05b0a4c1fb585a97b0a6501b | [] | no_license | marcomicera/nfv-manager | 24a9615787958b03d5566555d90b333ed2837c02 | df6bd9c47548726852325e82988cf0bd452fb961 | refs/heads/master | 2021-07-23T21:00:47.199762 | 2020-04-11T13:30:05 | 2020-04-11T13:30:05 | 134,253,211 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 656 | java | package it.polito.dp2.NFV.lab3;
public class AllocationException extends Exception {
/**
* Thrown when an error related to allocation occurs
*/
private static final long serialVersionUID = 1L;
public AllocationException() {
}
public AllocationException(String message) {
super(message);
}
public AllocationException(Throwable cause) {
super(cause);
}
public AllocationException(String message, Throwable cause) {
super(message, cause);
}
public AllocationException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"[email protected]"
] | |
e02b4ab389bbc29d0dfeb7c2591c17428b440f92 | 41ad42c26add9b56ac22d570e85b98f76e18e8d0 | /src/main/java/com/katameszaros/poller/websocket/PollerSessionHandler.java | ba37e8e2b10a05bf6ea1e43155b92a8ee7a1dfef | [] | no_license | katameszaros/poller | 9919df904ed9ee2563ee41320fad464ae3655396 | e110dbcb06b7c93c79e2f3dd55abd589b73398ce | refs/heads/master | 2021-01-21T14:52:48.578954 | 2017-08-21T22:17:46 | 2017-08-21T22:17:46 | 95,349,508 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,315 | java | package com.katameszaros.poller.websocket;
/**
* Created by kata on 2017.06.25..
*/
import com.katameszaros.poller.model.Choice;
import com.katameszaros.poller.model.Poll;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.ApplicationScope;
import javax.json.Json;
import javax.json.JsonArray;
import javax.json.JsonArrayBuilder;
import javax.json.JsonObject;
import javax.json.spi.JsonProvider;
import javax.websocket.Session;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@ApplicationScope
@Component
public class PollerSessionHandler {
private int pollId = 0;
private final Set<Session> sessions = new HashSet<>();
private final Set<Poll> polls = new HashSet<>();
public void addSession(Session session) {
sessions.add(session);
for (Poll poll : polls) {
JsonObject addMessage = createAddMessage(poll);
sendToSession(session, addMessage);
}
}
public void removeSession(Session session) {
sessions.remove(session);
}
public List<Poll> getPolls() {
return new ArrayList<>(polls);
}
public void addPoll(Poll poll) {
poll.setId(pollId);
polls.add(poll);
pollId++;
JsonObject addMessage = createAddMessage(poll);
sendToAllConnectedSessions(addMessage);
}
public void removePoll(int id) {
Poll poll = getPollById(id);
if (poll != null) {
polls.remove(poll);
JsonProvider provider = JsonProvider.provider();
JsonObject removeMessage = provider.createObjectBuilder()
.add("action", "remove")
.add("id", id)
.build();
sendToAllConnectedSessions(removeMessage);
}
}
public void addChoiceToPoll(Poll poll, Choice choice) {
if (poll != null) {
JsonProvider provider = JsonProvider.provider();
JsonObject showChoicesMessage = provider.createObjectBuilder()
.add("action", "addChoice")
.add("id", poll.getId())
.add("choice", choice.getDescription())
.build();
sendToAllConnectedSessions(showChoicesMessage);
}
}
public void getPollDetails(int pollId) {
Poll poll = getPollById(pollId);
if (poll != null) {
List<Choice> choices = poll.getChoices();
JsonArray choicesArray = createJsonArrayFromChoices(choices);
JsonProvider provider = JsonProvider.provider();
JsonObject showChoicesMessage = provider.createObjectBuilder()
.add("action", "getPollDetails")
.add("id", poll.getId())
.add("choices", choicesArray)
.build();
sendToAllConnectedSessions(showChoicesMessage);
}
}
public void addVoteToPoll(int pollId, int choiceIndex) {
Poll poll = getPollById(pollId);
if (poll != null) {
List<Choice> choices = poll.getChoices();
Choice choice = choices.get(choiceIndex);
choice.setQuantity(1);
JsonArray choicesArray = createJsonArrayFromChoices(choices);
JsonProvider provider = JsonProvider.provider();
JsonObject showChoicesMessage = provider.createObjectBuilder()
.add("action", "addVoteToPoll")
.add("id", poll.getId())
.add("choices", choicesArray)
.build();
sendToAllConnectedSessions(showChoicesMessage);
}
}
private JsonArray createJsonArrayFromChoices(List<Choice> choices) {
JsonArrayBuilder jsonArray = Json.createArrayBuilder();
for(Choice choice : choices) {
jsonArray.add(Json.createObjectBuilder()
.add("description", choice.getDescription())
.add("quantity", choice.getQuantity()));
}
JsonArray result = jsonArray.build();
return result;
}
private Poll getPollById(int id) {
for (Poll poll : polls) {
if (poll.getId() == id) {
return poll;
}
}
return null;
}
private JsonObject createAddMessage(Poll poll) {
JsonProvider provider = JsonProvider.provider();
JsonObject addMessage = provider.createObjectBuilder()
.add("action", "add")
.add("id", poll.getId())
.add("name", poll.getQuestion())
.build();
return addMessage;
}
private void sendToAllConnectedSessions(JsonObject message) {
for (Session session : sessions) {
sendToSession(session, message);
}
}
private void sendToSession(Session session, JsonObject message) {
try {
session.getBasicRemote().sendText(message.toString());
} catch (IOException ex) {
sessions.remove(session);
Logger.getLogger(PollerSessionHandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
| [
"[email protected]"
] | |
88df4489f1b0104409d6919cb774ce02de33e74e | 3b21a3ffef4f979bee641b26bf7f9c2c4bc8c7d1 | /demo-spring-boot-08-spring-task/src/main/java/com/dongxiang/demospringboot08springtask/timer/TimerDemo.java | 94afd51a7fbffc98a18461f3a06ec86bca5f52d5 | [] | no_license | ManLikeTheWind/demo-spring-boot-temp | c1bef554fd88dbb98d57ef5021272683da38319a | f7cd98ef2edd953f12e9ca28fa9e8c8fcde109a3 | refs/heads/master | 2020-03-22T07:26:01.767061 | 2018-07-26T08:04:03 | 2018-07-26T08:04:03 | 139,688,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 766 | java | package com.dongxiang.demospringboot08springtask.timer;
import java.time.LocalDateTime;
import java.util.Timer;
import java.util.TimerTask;
/**
* author:dongxiang
* data:2018/7/5 9:33
* email:[email protected]
* description:
* function:
* using:
* note: <li>基于Timer 实现的定时调度,基本就是手撸代码,目前应用较少,不是很推荐</li>
*/
public class TimerDemo {
public static void main(String[]args){
TimerTask timerTask=new TimerTask() {
@Override
public void run() {
System.out.println(TimerDemo.class.getSimpleName()+" 执行任务 - "+LocalDateTime.now());
}
};
Timer timer=new Timer();
timer.schedule(timerTask, 500,3000);
}
}
| [
"[email protected]"
] | |
8fa9072096a04b12cf00f01afb7b9649ff788b75 | d5955133a7e0567852d678a559f35de4175dd9d0 | /app/src/main/java/com/stcodesapp/noteit/factory/TasksFactory.java | 80a8359fc5ac82b364c5c174f5bdc8b992425b15 | [] | no_license | Shadat-tonmoy/NoteMe | df7cce98b657ef2e99b599063d95f79929027b72 | a433afd582220bbf1ae2ebebd2f7192873785154 | refs/heads/master | 2022-07-30T01:38:11.893575 | 2020-05-23T20:14:40 | 2020-05-23T20:14:40 | 177,613,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,231 | java | package com.stcodesapp.noteit.factory;
import android.support.v4.app.FragmentActivity;
import com.stcodesapp.noteit.common.FragmentFrameHelper;
import com.stcodesapp.noteit.models.NoteComponents;
import com.stcodesapp.noteit.tasks.databaseTasks.DatabaseTasks;
import com.stcodesapp.noteit.tasks.databaseTasks.selectionTasks.AllAudioSelectionTasks;
import com.stcodesapp.noteit.tasks.databaseTasks.selectionTasks.AllImageSelectionTasks;
import com.stcodesapp.noteit.tasks.functionalTasks.dataBackupTasks.BackupConvertionTask;
import com.stcodesapp.noteit.tasks.functionalTasks.dataBackupTasks.BackupRestoringTask;
import com.stcodesapp.noteit.tasks.functionalTasks.dataBackupTasks.BackupSavingTask;
import com.stcodesapp.noteit.tasks.functionalTasks.DialogManagementTask;
import com.stcodesapp.noteit.tasks.functionalTasks.IAPBillingTasks;
import com.stcodesapp.noteit.tasks.functionalTasks.behaviorTrackingTasks.AdStrategyTrackingTask;
import com.stcodesapp.noteit.tasks.functionalTasks.behaviorTrackingTasks.IAPTrackingTasks;
import com.stcodesapp.noteit.tasks.functionalTasks.fileRelatedTasks.FileDeletingTask;
import com.stcodesapp.noteit.tasks.functionalTasks.fileRelatedTasks.FileIOTasks;
import com.stcodesapp.noteit.tasks.functionalTasks.fileRelatedTasks.FileMovingTask;
import com.stcodesapp.noteit.tasks.functionalTasks.phoneFunctionAccessTasks.ImageCapturingTask;
import com.stcodesapp.noteit.tasks.functionalTasks.NoteFieldValidationTask;
import com.stcodesapp.noteit.tasks.functionalTasks.PDFCreationTasks;
import com.stcodesapp.noteit.tasks.functionalTasks.phoneFunctionAccessTasks.VoiceInputTasks;
import com.stcodesapp.noteit.tasks.functionalTasks.phoneFunctionAccessTasks.VoiceRecordTask;
import com.stcodesapp.noteit.tasks.navigationTasks.ActivityNavigationTasks;
import com.stcodesapp.noteit.tasks.navigationTasks.FragmentNavigationTasks;
import com.stcodesapp.noteit.tasks.functionalTasks.behaviorTrackingTasks.RateUSPopupTrackingTasks;
import com.stcodesapp.noteit.tasks.networkingTasks.GoogleDriveAPITask;
import com.stcodesapp.noteit.tasks.networkingTasks.GoogleSignInHandlingTask;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.activityScreenManipulationTasks.CheckListActivityScreenManipulationTask;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.activityScreenManipulationTasks.IAPScreenManipulationTasks;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.fragmentScreenManipulationTass.BackupFragmentScreenManipulationTask;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.fragmentScreenManipulationTass.CheckListScreenManipulationTask;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.fragmentScreenManipulationTass.ContactScreenManipulationTask;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.fragmentScreenManipulationTass.EmailScreenManipulationTask;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.fragmentScreenManipulationTass.FileSaveScreenManipulationTasks;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.fragmentScreenManipulationTass.HomeScreenManipulationTasks;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.activityScreenManipulationTasks.ManualContactScreenManipulationTasks;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.activityScreenManipulationTasks.ManualEmailScreenManipulationTasks;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.activityScreenManipulationTasks.NoteFieldScreenManipulationTasks;
import com.stcodesapp.noteit.tasks.screenManipulationTasks.fragmentScreenManipulationTass.SortingDialogManipulationTask;
import com.stcodesapp.noteit.tasks.utilityTasks.AppPermissionTrackingTasks;
import com.stcodesapp.noteit.tasks.utilityTasks.ClipboardTasks;
import com.stcodesapp.noteit.tasks.utilityTasks.InfoThroughWebViewDialogShowingTask;
import com.stcodesapp.noteit.tasks.utilityTasks.SharingTasks;
public class TasksFactory {
private FragmentActivity activity;
private FragmentFrameHelper fragmentFrameHelper;
public TasksFactory(FragmentActivity activity, FragmentFrameHelper fragmentFrameHelper) {
this.activity = activity;
this.fragmentFrameHelper= fragmentFrameHelper;
}
public TasksFactory(FragmentActivity activity) {
this.activity = activity;
}
public ActivityNavigationTasks getActivityNavigationTasks()
{
return new ActivityNavigationTasks(activity);
}
public FragmentNavigationTasks getFragmentNavigationTasks()
{
return new FragmentNavigationTasks(fragmentFrameHelper);
}
public NoteFieldScreenManipulationTasks getNoteFieldScreenManipulationTasks()
{
return new NoteFieldScreenManipulationTasks(activity,getListeningTasks(), getUiComponentFactory(),this);
}
public ManualContactScreenManipulationTasks getManualContactScreenManipulationTasks()
{
return new ManualContactScreenManipulationTasks(activity);
}
public ManualEmailScreenManipulationTasks getManualEmailScreenManipulationTasks()
{
return new ManualEmailScreenManipulationTasks(activity);
}
public HomeScreenManipulationTasks getHomeScreenManipulationTasks()
{
return new HomeScreenManipulationTasks(activity);
}
public AppPermissionTrackingTasks getAppPermissionTrackingTasks()
{
return new AppPermissionTrackingTasks(activity);
}
public FileIOTasks getFileIOTasks()
{
return new FileIOTasks(activity);
}
public ListeningTasks getListeningTasks()
{
return new ListeningTasks(activity,getDatabaseTasks(),this);
}
private UIComponentFatory getUiComponentFactory()
{
return new UIComponentFatory();
}
public ClipboardTasks getClipboardTasks()
{
return new ClipboardTasks(activity);
}
public VoiceInputTasks getVoiceInputTasks()
{
return new VoiceInputTasks(activity);
}
public SharingTasks getSharingTasks()
{
return new SharingTasks(activity);
}
public DatabaseTasks getDatabaseTasks()
{
return new DatabaseTasks(activity);
}
public NoteFieldValidationTask getNoteFieldValidationTask(NoteComponents noteComponents)
{
return new NoteFieldValidationTask(activity,noteComponents);
}
public SortingDialogManipulationTask getSortingDialogManipulationTask()
{
return new SortingDialogManipulationTask(activity);
}
public EmailScreenManipulationTask getEmailScreenManipulationTask()
{
return new EmailScreenManipulationTask(activity);
}
public ContactScreenManipulationTask getContactScreenManipulationTask()
{
return new ContactScreenManipulationTask(activity);
}
public CheckListActivityScreenManipulationTask getCheckListActivityScreenManipulationTask()
{
return new CheckListActivityScreenManipulationTask(activity,getClipboardTasks());
}
public CheckListScreenManipulationTask getCheckListScreenManipulationTask()
{
return new CheckListScreenManipulationTask(activity);
}
public PDFCreationTasks getPDFCreationTasks()
{
return new PDFCreationTasks(activity,this);
}
public VoiceRecordTask getVoiceRecordTask()
{
return new VoiceRecordTask(activity);
}
public FileSaveScreenManipulationTasks getFileSaveScreenManipulationTasks() {
return new FileSaveScreenManipulationTasks(activity);
}
public FileMovingTask getFileMovingTask(FileMovingTask.Listener listener) {
FileMovingTask fileMovingTask = new FileMovingTask();
fileMovingTask.setListener(listener);
return fileMovingTask;
}
public FileDeletingTask getFileDeletingTask(FileDeletingTask.Listener listener) {
FileDeletingTask fileDeletingTask = new FileDeletingTask();
fileDeletingTask.setListener(listener);
return fileDeletingTask;
}
public ImageCapturingTask getImageCapturingTask()
{
return new ImageCapturingTask(activity,this);
}
public RateUSPopupTrackingTasks getRateUSPopupTrackingTasks()
{
return new RateUSPopupTrackingTasks(activity);
}
public DialogManagementTask getDialogManagementTask()
{
return new DialogManagementTask(activity,this);
}
public AllImageSelectionTasks getAllImageSelectionTasks(AllImageSelectionTasks.Listener listener,int purpose)
{
return new AllImageSelectionTasks(activity,listener, purpose);
}
public AllAudioSelectionTasks getAllAudioSelectionTasks(AllAudioSelectionTasks.Listener listener, int purpose)
{
return new AllAudioSelectionTasks(activity,listener, purpose);
}
public AdStrategyTrackingTask getAdStrategyTrackingTask()
{
return new AdStrategyTrackingTask(activity);
}
public IAPTrackingTasks getIAPTrackingTasks()
{
return new IAPTrackingTasks(activity);
}
public IAPBillingTasks getIAPBillingTasks()
{
return new IAPBillingTasks(activity, getIAPTrackingTasks());
}
public IAPScreenManipulationTasks getIAPScreenManipulationTasks()
{
return new IAPScreenManipulationTasks(activity);
}
public BackupSavingTask getBackupSavingTask()
{
return new BackupSavingTask(activity,getFileIOTasks());
}
public BackupRestoringTask getBackupRestoringTask()
{
return new BackupRestoringTask(activity,getFileIOTasks());
}
public BackupFragmentScreenManipulationTask getBackupFragmentScreenManipulationTask()
{
return new BackupFragmentScreenManipulationTask(activity,this);
}
public GoogleDriveAPITask getGoogleDriveAPITask()
{
return new GoogleDriveAPITask(activity,getBackupConvertionTask());
}
public BackupConvertionTask getBackupConvertionTask()
{
return new BackupConvertionTask(activity);
}
public GoogleSignInHandlingTask getGoogleSignInHandlingTask()
{
return new GoogleSignInHandlingTask(activity);
}
public InfoThroughWebViewDialogShowingTask getInfoThroughWebViewDialogShowingTask()
{
return new InfoThroughWebViewDialogShowingTask(activity);
}
}
| [
"[email protected]"
] | |
2265490a515b3c6aa5293644a8140a4fb1c9698d | 195a49ea5bbfc2706fd4440bd061bbae17af714f | /src/main/java/aqs/SelfSemaphoreTest.java | 288d471d4ea4484d4aea65c1beb2116c4c3bec4d | [] | no_license | xiaoxixi0314/use-java-thread | 1d282353cf66b5f503d909178db8679db161e35f | c3f373d927e8056e81985873b787c6948d387a5c | refs/heads/master | 2022-07-14T12:18:54.138748 | 2020-06-15T03:21:29 | 2020-06-15T03:21:29 | 225,623,694 | 0 | 0 | null | 2022-06-17T02:41:46 | 2019-12-03T13:14:11 | Java | UTF-8 | Java | false | false | 910 | java | package aqs;
import base.util.SleepTool;
public class SelfSemaphoreTest {
private static final SelfSemaphore lock = new SelfSemaphore();
public void test() {
try {
lock.lock();
SleepTool.sleepMills(1000);
System.out.println(Thread.currentThread().getName());
} finally {
lock.unlock();
}
}
static class TestThread extends Thread {
private SelfSemaphoreTest test = new SelfSemaphoreTest();
public TestThread(SelfSemaphoreTest test) {
this.test = test;
}
@Override
public void run() {
test.test();
}
}
public static void main(String[] args) {
SelfSemaphoreTest test = new SelfSemaphoreTest();
for (int i = 0; i < 12; i ++) {
new TestThread(test).start();
}
SleepTool.sleepMills(3000);
}
} | [
"[email protected]"
] | |
dffa10ec106c7755956e91ced57ff06654fae826 | 140327aa87b35d992b68416a2925f34458ca3c34 | /app/src/main/java/com/lzx/demo/ui/DragMenuListActivity.java | 55f97ffd1b76274e79e26c25397446c468c9fdcb | [
"Apache-2.0"
] | permissive | LuffyCarl/LRecyclerView | 602d5d17d08e89165b5a3e2a42194bcf761e38e1 | 61ffe737115f75a75778770ca90a518ffc4a93c4 | refs/heads/master | 2021-01-17T21:01:32.362694 | 2016-08-06T03:53:30 | 2016-08-06T03:53:30 | 65,066,800 | 1 | 0 | null | 2016-08-06T05:32:50 | 2016-08-06T05:32:48 | null | UTF-8 | Java | false | false | 7,310 | java | package com.lzx.demo.ui;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import com.github.jdsjlzx.interfaces.Closeable;
import com.github.jdsjlzx.interfaces.OnItemClickLitener;
import com.github.jdsjlzx.interfaces.OnSwipeMenuItemClickListener;
import com.github.jdsjlzx.interfaces.SwipeMenuCreator;
import com.github.jdsjlzx.recyclerview.LRecyclerView;
import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter;
import com.github.jdsjlzx.swipe.SwipeMenu;
import com.github.jdsjlzx.swipe.SwipeMenuItem;
import com.github.jdsjlzx.swipe.touch.OnItemMoveListener;
import com.lzx.demo.ItemDecoration.ListViewDecoration;
import com.lzx.demo.R;
import com.lzx.demo.adapter.MenuAdapter;
import com.lzx.demo.bean.ItemModel;
import com.lzx.demo.util.AppToast;
import java.util.ArrayList;
import java.util.Collections;
public class DragMenuListActivity extends AppCompatActivity {
private Activity mContext;
private LRecyclerView mRecyclerView = null;
private MenuAdapter mDataAdapter = null;
private LRecyclerViewAdapter mLRecyclerViewAdapter = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sample_ll_activity);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mContext = this;
mRecyclerView = (LRecyclerView) findViewById(R.id.list);
//init data
ArrayList<ItemModel> dataList = new ArrayList<>();
for (int i = 0; i < 16; i++) {
ItemModel itemModel = new ItemModel();
itemModel.title = "item" + i;
dataList.add(itemModel);
}
mDataAdapter = new MenuAdapter();
mDataAdapter.setDataList(dataList);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));// 布局管理器。
mRecyclerView.setHasFixedSize(true);// 如果Item够简单,高度是确定的,打开FixSize将提高性能。
mRecyclerView.setItemAnimator(new DefaultItemAnimator());// 设置Item默认动画,加也行,不加也行。
mRecyclerView.addItemDecoration(new ListViewDecoration());// 添加分割线。
// 为SwipeRecyclerView的Item创建菜单就两句话,不错就是这么简单:
// 设置菜单创建器。
mRecyclerView.setSwipeMenuCreator(swipeMenuCreator);
// 设置菜单Item点击监听。
mRecyclerView.setSwipeMenuItemClickListener(menuItemClickListener);
mLRecyclerViewAdapter = new LRecyclerViewAdapter(this, mDataAdapter);
mRecyclerView.setAdapter(mLRecyclerViewAdapter);
mRecyclerView.setPullRefreshEnabled(false);
mRecyclerView.setLongPressDragEnabled(true);// 开启拖拽,就这么简单一句话。
mRecyclerView.setOnItemMoveListener(onItemMoveListener);// 监听拖拽,更新UI。
mLRecyclerViewAdapter.setOnItemClickLitener(new OnItemClickLitener() {
@Override
public void onItemClick(View view, int position) {
String text = "Click position = " + position;
AppToast.showShortText(DragMenuListActivity.this, text);
}
@Override
public void onItemLongClick(View view, int position) {
}
});
}
/**
* 当Item移动的时候。
*/
private OnItemMoveListener onItemMoveListener = new OnItemMoveListener() {
@Override
public boolean onItemMove(int fromPosition, int toPosition) {
final int adjFromPosition = fromPosition - (mLRecyclerViewAdapter.getHeaderViewsCount() + 1);
final int adjToPosition = toPosition - (mLRecyclerViewAdapter.getHeaderViewsCount() + 1);
// 当Item被拖拽的时候。
Collections.swap(mDataAdapter.getDataList(), adjFromPosition, adjToPosition);
//Be carefull in here!
mLRecyclerViewAdapter.notifyItemMoved(fromPosition, toPosition);
return true;// 返回true表示处理了,返回false表示你没有处理。
}
@Override
public void onItemDismiss(int position) {
// 当Item被滑动删除掉的时候,在这里是无效的,因为这里没有启用这个功能。
// 使用Menu时就不用使用这个侧滑删除啦,两个是冲突的。
}
};
/**
* 菜单创建器
*/
private SwipeMenuCreator swipeMenuCreator = new SwipeMenuCreator() {
@Override
public void onCreateMenu(SwipeMenu swipeLeftMenu, SwipeMenu swipeRightMenu, int viewType) {
int size = getResources().getDimensionPixelSize(R.dimen.item_height);
SwipeMenuItem deleteItem = new SwipeMenuItem(mContext)
.setBackgroundDrawable(R.drawable.selector_red)
.setImage(R.mipmap.ic_action_delete)
.setWidth(size)
.setHeight(size);
swipeRightMenu.addMenuItem(deleteItem);// 添加一个按钮到右侧菜单。
SwipeMenuItem wechatItem = new SwipeMenuItem(mContext)
.setBackgroundDrawable(R.drawable.selector_green)
.setImage(R.mipmap.ic_action_wechat)
.setWidth(size)
.setHeight(size);
swipeRightMenu.addMenuItem(wechatItem);// 添加一个按钮到右侧菜单。
}
};
/**
* 菜单点击监听。
*/
private OnSwipeMenuItemClickListener menuItemClickListener = new OnSwipeMenuItemClickListener() {
/**
* Item的菜单被点击的时候调用。
* @param closeable closeable. 用来关闭菜单。
* @param adapterPosition adapterPosition. 这个菜单所在的item在Adapter中position。
* @param menuPosition menuPosition. 这个菜单的position。比如你为某个Item创建了2个MenuItem,那么这个position可能是是 0、1,
* @param direction 如果是左侧菜单,值是:SwipeMenuRecyclerView#LEFT_DIRECTION,如果是右侧菜单,值是:SwipeMenuRecyclerView#RIGHT_DIRECTION.
*/
@Override
public void onItemClick(Closeable closeable, int adapterPosition, int menuPosition, int direction) {
closeable.smoothCloseMenu();// 关闭被点击的菜单。
if (direction == LRecyclerView.RIGHT_DIRECTION) {
AppToast.showShortText(DragMenuListActivity.this, "list第" + adapterPosition + "; 右侧菜单第" + menuPosition);
} else if (direction == LRecyclerView.LEFT_DIRECTION) {
AppToast.showShortText(DragMenuListActivity.this, "list第" + adapterPosition + "; 左侧菜单第" + menuPosition);
}
}
};
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
}
return true;
}
} | [
"[email protected]"
] | |
5a1dfaa765ba008522285726a6a38b9613ee323a | 0ad8a59c647845e484d762515cc229a9039e106f | /src/main/java/com/elcentr/controller/mapper/EnclosureMapper.java | 68678d24cc93808b87cf7d1c4d3f77c0fcd555e9 | [] | no_license | zenzeliuk/web-app-elcentr | b66e21ac02896f46e01d862ec5f90c05b970b483 | f82b797f79b469d5fbb7a37739ea475c5a2cc6dc | refs/heads/master | 2023-03-21T00:40:49.872813 | 2021-03-11T13:14:53 | 2021-03-11T13:14:53 | 338,906,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package com.elcentr.controller.mapper;
import com.elcentr.controller.dto.EnclosureDTO;
import com.elcentr.model.Enclosure;
public class EnclosureMapper {
public static EnclosureDTO toEnclosureDTO(Enclosure enclosure) {
return EnclosureDTO.builder()
.id(enclosure.getId().toString())
.manufacturer(enclosure.getManufacturer())
.code(enclosure.getCode())
.name(enclosure.getName())
// .typeOfInstallation(enclosure.getTypeOfInstallation())
// .category(enclosure.getCategory())
// .color(enclosure.getColor())
// .indexProtection(enclosure.getIndexProtection().toString())
// .material(enclosure.getMaterial())
// .depth(enclosure.getDepth().toString())
// .height(enclosure.getHeight().toString())
// .width(enclosure.getWidth().toString())
.build();
}
}
| [
"[email protected]"
] | |
3b088ff5572bdc4e91944ecb451dc6bf4ce16e6e | 7fefc0fd2acb06e00bb12bf24867ce6ab9bb4d23 | /app/src/main/java/com/example/wx/inba/model/User.java | 5eaa6126a68bccb69e729bd8a3d014bc85dd7204 | [] | no_license | ChocomintX/Inba | 1deb89ee55b956e5136b517ac44c19f037a76efa | df091d8e921ca15bcfaeb0fa7b9b8e8b5e75177a | refs/heads/master | 2023-04-09T22:21:14.252791 | 2019-12-13T16:44:07 | 2019-12-13T16:44:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 634 | java | package com.example.wx.inba.model;
public class User {
int id;
String username;
public User(int id, String username) {
this.id = id;
this.username = username;
}
public User() {}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public String toString() {
// TODO Auto-generated method stub
return "User[id="+id+",username="+username+"]";
}
}
| [
"[email protected]"
] | |
b699102d9c222f76d830d8d0707aa8ad4d61f352 | e2a142bad9dec181fe6928637bc5e5e78c850c7c | /src/main/java/fr/esgi/pa/server/user/infrastructure/dataprovider/JpaUser.java | b915ba65042fac626a853d84118a4d77108844d1 | [] | no_license | 4AL2-B-Lego-R-Baris-M-ISHII/code-fit-api | 2bed101d15b30a7f47f0cecc9785fbdcdf93c5a1 | fb6fdbcf7eaa90b432655f1cc4e318b01aa80749 | refs/heads/main | 2023-06-27T16:36:22.295019 | 2021-07-28T20:54:13 | 2021-07-28T20:54:13 | 366,519,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,008 | java | package fr.esgi.pa.server.user.infrastructure.dataprovider;
import fr.esgi.pa.server.role.infrastructure.dataprovider.JpaRole;
import lombok.Data;
import lombok.experimental.Accessors;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.HashSet;
import java.util.Set;
@Entity(name = "user")
@Data
@Accessors(chain = true)
public class JpaUser {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotBlank
@Size(max = 20)
private String username;
@NotBlank
@Size(max = 50)
@Email
private String email;
@NotBlank
@Size(max = 120)
private String password;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "user_role",
joinColumns = @JoinColumn(name = "user_id"),
inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<JpaRole> roles = new HashSet<>();
}
| [
"[email protected]"
] | |
e3cde9e1910746d86a2474dc785e4cd58c435ca6 | e4237736ac1acd1c465b0eb7235f6471d1661a15 | /src/main/java/br/com/leonardo/commons/service/ProductService.java | 25a9e2ef103b43c5d21136a78dba0d53b3093a34 | [] | no_license | leonardodosanjossantos/spreadsheet-commons | ef9d81d05fcc4142542ff53116ad2fd5663b4d09 | e20c0643dd5787a84bf8c43c87fd9fab1ec05974 | refs/heads/master | 2022-07-23T15:14:26.840277 | 2019-07-15T05:15:55 | 2019-07-15T05:15:55 | 196,879,039 | 0 | 0 | null | 2022-06-29T17:30:23 | 2019-07-14T20:12:49 | Java | UTF-8 | Java | false | false | 823 | java | package br.com.leonardo.commons.service;
import java.util.ArrayList;
import java.util.List;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.leonardo.commons.model.Product;
import br.com.leonardo.commons.model.ProductDTO;
import br.com.leonardo.commons.repository.ProductRepository;
@Service
public class ProductService {
@Autowired
private ProductRepository productRepository;
public void saveList(List<ProductDTO> listProductDTO) {
final ModelMapper modelMapper = new ModelMapper();
List<Product> listProduct = new ArrayList<>();
listProductDTO.stream().forEach(itemDTO -> {
listProduct.add(modelMapper.map(itemDTO, Product.class));
});
productRepository.saveAll(listProduct);
}
}
| [
"[email protected]"
] | |
47075e39c72adb9709d5e9f89882cc66fc2593ba | 9b294c3bf262770e9bac252b018f4b6e9412e3ee | /camerazadas/source/apk/com.sonyericsson.android.camera/src-cfr-nocode/android/support/v4/accessibilityservice/AccessibilityServiceInfoCompatJellyBeanMr2.java | 85e1a6f8886614e5c2c7b152c8305834f2429b31 | [] | no_license | h265/camera | 2c00f767002fd7dbb64ef4dc15ff667e493cd937 | 77b986a60f99c3909638a746c0ef62cca38e4235 | refs/heads/master | 2020-12-30T22:09:17.331958 | 2015-08-25T01:22:25 | 2015-08-25T01:22:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 325 | java | /*
* Decompiled with CFR 0_100.
*/
package android.support.v4.accessibilityservice;
import android.accessibilityservice.AccessibilityServiceInfo;
class AccessibilityServiceInfoCompatJellyBeanMr2 {
AccessibilityServiceInfoCompatJellyBeanMr2();
public static int getCapabilities(AccessibilityServiceInfo var0);
}
| [
"[email protected]"
] | |
7557cb9edfad6b84ce96c5b25b28862df131bc64 | 733c87e27339a9fba5e7a9cc7a8907f9046cf95d | /exercise2.java | 74fc745a235bf91eff353a61d4c9560058518ee5 | [] | no_license | spalmerg/MapReduce-HW1 | 9c06146d9fb102ca12ee4feb10a5a073c87cf4d1 | 28bb2f7dbacfb8909d970acca718a5a8e697da47 | refs/heads/master | 2020-03-19T09:07:29.874513 | 2018-06-12T20:35:19 | 2018-06-12T20:35:19 | 136,261,513 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,996 | java | import java.io.*;
import java.util.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;
import org.apache.hadoop.util.*;
public class exercise2 extends Configured implements Tool {
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, FloatWritable> {
private FloatWritable col4 = new FloatWritable();
private Text combo = new Text();
public void configure(JobConf job) {
}
protected void setup(OutputCollector<Text, FloatWritable> output) throws IOException, InterruptedException {
}
public void map(LongWritable key, Text value, OutputCollector<Text, FloatWritable> output, Reporter reporter) throws IOException {
String[] line = value.toString().split(",");
if(line[line.length - 1].equals("false")) {
String[] subset = Arrays.copyOfRange(line, 29, 33);
String stringSubset = Arrays.toString(subset);
Float target = Float.parseFloat(line[3]); //col4 value and count
combo.set(stringSubset);
col4.set(target);
output.collect(combo, col4);
}
}
protected void cleanup(OutputCollector<Text, FloatWritable> output) throws IOException, InterruptedException {
}
}
public static class Reduce extends MapReduceBase implements Reducer<Text, FloatWritable, Text, FloatWritable> {
public void configure(JobConf job) {
}
protected void setup(OutputCollector<Text, FloatWritable> output) throws IOException, InterruptedException {
}
public void reduce(Text key, Iterator<FloatWritable> values, OutputCollector<Text, FloatWritable> output, Reporter reporter) throws IOException {
float sum = 0;
int count = 0;
while (values.hasNext()) {
sum += values.next().get();
count++;
}
output.collect(key, new FloatWritable(sum/count));
}
protected void cleanup(OutputCollector<Text, FloatWritable> output) throws IOException, InterruptedException {
}
}
public int run(String[] args) throws Exception {
JobConf conf = new JobConf(getConf(), exercise2.class);
conf.setJobName("exercise2");
// conf.setNumReduceTasks(0);
// conf.setBoolean("mapred.output.compress", true);
// conf.setBoolean("mapred.compress.map.output", true);
conf.setOutputKeyClass(Text.class);
conf.setOutputValueClass(FloatWritable.class);
conf.setMapperClass(Map.class);
// conf.setCombinerClass(Reduce.class);
conf.setReducerClass(Reduce.class);
conf.setInputFormat(TextInputFormat.class);
conf.setOutputFormat(TextOutputFormat.class);
FileInputFormat.setInputPaths(conf, new Path(args[0]));
FileOutputFormat.setOutputPath(conf, new Path(args[1]));
JobClient.runJob(conf);
return 0;
}
public static void main(String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new exercise2(), args);
System.exit(res);
}
} | [
"[email protected]"
] | |
e71bc10e8ce2bb059750c1c19dea300e94f4eeda | 372f0c33815ec5189b58bb0400545719949da2d9 | /src/main/java/com/vanda/security/AuthoritiesConstants.java | 17bf0137c21390cadc2e0b849a037dbd837457cc | [] | no_license | itachiunited/vanda-app | 1ae7adc05a24aeb4bcf7aa60f8f08d21009c3f98 | 75193e8db6e26853bb4495bbbd0dd98cb66c250f | refs/heads/master | 2020-05-27T07:49:36.473229 | 2019-05-25T07:40:28 | 2019-05-25T07:40:28 | 188,535,994 | 0 | 0 | null | 2019-10-30T20:22:34 | 2019-05-25T07:40:17 | Java | UTF-8 | Java | false | false | 339 | java | package com.vanda.security;
/**
* Constants for Spring Security authorities.
*/
public final class AuthoritiesConstants {
public static final String ADMIN = "ROLE_ADMIN";
public static final String USER = "ROLE_USER";
public static final String ANONYMOUS = "ROLE_ANONYMOUS";
private AuthoritiesConstants() {
}
}
| [
"[email protected]"
] | |
aeceb247f1b5084640cfb9283ac01db2321ef2bd | 447520f40e82a060368a0802a391697bc00be96f | /apks/malware/app81/source/com/tencent/android/tpush/horse/data/OptStrategyList.java | 1b9b9076d3ffa200debf186619246b2fa55f6b88 | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 4,641 | java | package com.tencent.android.tpush.horse.data;
import android.text.format.Time;
import com.tencent.android.tpush.service.channel.exception.NullReturnException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class OptStrategyList
implements Serializable
{
private static final long serialVersionUID = 4532907276158395575L;
private StrategyItem httpItem;
private StrategyItem httpRedirectItem;
private StrategyItem tcpItem;
private StrategyItem tcpRedirectItem;
private long timestamp;
public OptStrategyList() {}
public StrategyItem a()
{
return this.tcpRedirectItem;
}
public List a(short paramShort)
{
ArrayList localArrayList = new ArrayList();
if (paramShort == 1)
{
if (this.httpRedirectItem != null) {
localArrayList.add(this.httpRedirectItem);
}
if (this.httpItem != null) {
localArrayList.add(this.httpItem);
}
}
do
{
return localArrayList;
if (this.tcpRedirectItem != null) {
localArrayList.add(this.tcpRedirectItem);
}
} while (this.tcpItem == null);
localArrayList.add(this.tcpItem);
return localArrayList;
}
public void a(long paramLong)
{
this.timestamp = paramLong;
}
public void a(StrategyItem paramStrategyItem)
{
this.tcpRedirectItem = paramStrategyItem;
}
public StrategyItem b()
{
return this.tcpItem;
}
public void b(StrategyItem paramStrategyItem)
{
this.tcpItem = paramStrategyItem;
}
public StrategyItem c()
{
return this.httpRedirectItem;
}
public void c(StrategyItem paramStrategyItem)
{
this.httpRedirectItem = paramStrategyItem;
}
public StrategyItem d()
{
return this.httpItem;
}
public void d(StrategyItem paramStrategyItem)
{
this.httpItem = paramStrategyItem;
}
public StrategyItem e()
{
if (this.tcpRedirectItem != null) {
return this.tcpRedirectItem;
}
if (this.tcpItem != null) {
return this.tcpItem;
}
if (this.httpRedirectItem != null) {
return this.httpRedirectItem;
}
if (this.httpItem != null) {
return this.httpItem;
}
throw new NullReturnException("getOptStrategyItem return null,because the optstragegylist is empty");
}
public List f()
{
ArrayList localArrayList = new ArrayList();
if (this.tcpRedirectItem != null) {
localArrayList.add(this.tcpRedirectItem);
}
if (this.tcpItem != null) {
localArrayList.add(this.tcpItem);
}
if (this.httpRedirectItem != null) {
localArrayList.add(this.httpRedirectItem);
}
if (this.httpItem != null) {
localArrayList.add(this.httpItem);
}
return localArrayList;
}
public long g()
{
return this.timestamp;
}
public String toString()
{
StringBuilder localStringBuilder1 = new StringBuilder();
localStringBuilder1.append("\n------list start-----\n");
StringBuilder localStringBuilder2 = new StringBuilder().append("[TcpRedirectStrategyItem]:");
if (this.tcpRedirectItem == null)
{
localObject = " tcpRedirect item is null";
localStringBuilder1.append((String)localObject + "\n");
localStringBuilder2 = new StringBuilder().append("[TCPStrategyItem]:");
if (this.tcpItem != null) {
break label250;
}
localObject = " tcp item is null";
label79:
localStringBuilder1.append((String)localObject + "\n");
localStringBuilder2 = new StringBuilder().append("[HttpRedirectStrategyItem]:");
if (this.httpRedirectItem != null) {
break label261;
}
localObject = " httpRedirect item is null";
label120:
localStringBuilder1.append((String)localObject + "\n");
localStringBuilder2 = new StringBuilder().append("[HttpStrategyItem]:");
if (this.httpItem != null) {
break label272;
}
}
label250:
label261:
label272:
for (Object localObject = " http item is null";; localObject = this.httpItem.toString())
{
localStringBuilder1.append((String)localObject + "\n");
localObject = new Time();
((Time)localObject).set(this.timestamp);
localStringBuilder1.append(">>>saveTime=" + ((Time)localObject).format2445() + ">>>\n");
localStringBuilder1.append("------list end-----\n");
return localStringBuilder1.toString();
localObject = this.tcpRedirectItem.toString();
break;
localObject = this.tcpItem.toString();
break label79;
localObject = this.httpRedirectItem.toString();
break label120;
}
}
}
| [
"[email protected]"
] | |
5f07772c93b28438bc29de18681a610c71918231 | 8430cd0a92af431fa85e92a7c5ea20b8efda949f | /Java Advanced/ObjectsClassesAndCollections-Lab/src/Pr2HotPotato.java | 7099aff19238420bb59b75bcd411cb904fcadc06 | [] | no_license | Joret0/Exercises-with-Java | 9a93e39236b88bb55335e6cff62d2e774f78b054 | a1b2f64aafdf8ce8b28fb20f31aa5e37b9643652 | refs/heads/master | 2021-09-16T04:28:49.605116 | 2018-06-16T14:32:52 | 2018-06-16T14:32:52 | 71,498,826 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;
public class Pr2HotPotato {
public static void main(String[] args) throws IOException {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String[] line = bufferedReader.readLine().split("\\s+");
int n = Integer.parseInt(bufferedReader.readLine());
Deque<String> queue = new ArrayDeque<>();
for (int i = 0; i < line.length; i++) {
queue.add(line[i]);
}
while (queue.size() > 1) {
for (int i = 1; i <= n; i++) {
if (i % n == 0) {
System.out.println("Removed " + queue.remove());
} else {
queue.add(queue.poll());
}
}
}
System.out.println("Last is " + queue.remove());
}
}
| [
"[email protected]"
] | |
a267679f6c27aaf95035c51593ad684d7c8bcccb | 7b993d143c8f96a062dc2385c146e44350b5e253 | /NDKstudy/app/src/main/java/com/example/administrator/ndkstudy/MainActivity.java | 8cd845ef3a5cc18ec78724296b1c4f05b173d5cf | [] | no_license | wineoffree/NDKstudy | 67fb7d482d7a1c58465b97cb0301b3af7f9f75fb | b7c6ab9216198c082cdd21837516a47cc1f0dcda | refs/heads/master | 2021-01-19T11:21:36.252263 | 2016-07-16T13:51:14 | 2016-07-16T13:51:14 | 63,484,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,127 | java | package com.example.administrator.ndkstudy;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
static {
System.loadLibrary("JniTest");
}
TextView txtView;
EditText editText;
String str;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtView = (TextView)findViewById(R.id.txt);
editText=(EditText)findViewById(R.id.input);
str=null;
Button button=( Button)findViewById(R.id.sure);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
str=editText.getText().toString();
if(str!=null)
txtView.setText(getStringFromNative(str));
}
});
}
public native String getStringFromNative(String str);
}
| [
"[email protected]"
] | |
90b52b5d122eea37890ce8a18b8d4ae32cbf6961 | edbb9ab1c18714fb6b55e00b5e77f05f3b7bdb58 | /FundamentalClasses/ComA3.java | 833e88dabfa8dd66c6b9a136de49ab7be661e06e | [] | no_license | VinayManyam/java_programs | 18237592464115c71351ea5a2647abc8e9c12cfd | fae6b19d03e224379ed4551494a745fdbb509838 | refs/heads/master | 2021-01-22T18:24:44.740014 | 2019-03-11T04:26:33 | 2019-03-11T04:26:33 | 100,758,059 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 199 | java | package FundamentalClasses;
public class ComA3 {
int x;
ComA3(int x){
this.x=x;
}
public int hashCode() {
return x;
}
public int JVMHC() {
return super.hashCode();
}
}
| [
"[email protected]"
] | |
13bcac4c646fc4bd9954e5c093eb03b16c39833a | e42afd54dcc0add3d2b8823ee98a18c50023a396 | /java-compute/proto-google-cloud-compute-v1/src/main/java/com/google/cloud/compute/v1/DeleteGlobalOperationRequest.java | a14491a7702df30ce22a5a0a0511995d608ed242 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-proprietary-license"
] | permissive | degloba/google-cloud-java | eea41ebb64f4128583533bc1547e264e730750e2 | b1850f15cd562c659c6e8aaee1d1e65d4cd4147e | refs/heads/master | 2022-07-07T17:29:12.510736 | 2022-07-04T09:19:33 | 2022-07-04T09:19:33 | 180,201,746 | 0 | 0 | Apache-2.0 | 2022-07-04T09:17:23 | 2019-04-08T17:42:24 | Java | UTF-8 | Java | false | false | 26,271 | java | /*
* Copyright 2020 Google LLC
*
* 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
*
* https://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.
*/
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/compute/v1/compute.proto
package com.google.cloud.compute.v1;
/**
*
*
* <pre>
* A request message for GlobalOperations.Delete. See the method description for details.
* </pre>
*
* Protobuf type {@code google.cloud.compute.v1.DeleteGlobalOperationRequest}
*/
public final class DeleteGlobalOperationRequest extends com.google.protobuf.GeneratedMessageV3
implements
// @@protoc_insertion_point(message_implements:google.cloud.compute.v1.DeleteGlobalOperationRequest)
DeleteGlobalOperationRequestOrBuilder {
private static final long serialVersionUID = 0L;
// Use DeleteGlobalOperationRequest.newBuilder() to construct.
private DeleteGlobalOperationRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private DeleteGlobalOperationRequest() {
operation_ = "";
project_ = "";
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(UnusedPrivateParameter unused) {
return new DeleteGlobalOperationRequest();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
return this.unknownFields;
}
private DeleteGlobalOperationRequest(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 416721722:
{
java.lang.String s = input.readStringRequireUtf8();
operation_ = s;
break;
}
case 1820481738:
{
java.lang.String s = input.readStringRequireUtf8();
project_ = s;
break;
}
default:
{
if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.compute.v1.Compute
.internal_static_google_cloud_compute_v1_DeleteGlobalOperationRequest_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.compute.v1.Compute
.internal_static_google_cloud_compute_v1_DeleteGlobalOperationRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.compute.v1.DeleteGlobalOperationRequest.class,
com.google.cloud.compute.v1.DeleteGlobalOperationRequest.Builder.class);
}
public static final int OPERATION_FIELD_NUMBER = 52090215;
private volatile java.lang.Object operation_;
/**
*
*
* <pre>
* Name of the Operations resource to delete.
* </pre>
*
* <code>string operation = 52090215 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The operation.
*/
@java.lang.Override
public java.lang.String getOperation() {
java.lang.Object ref = operation_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
operation_ = s;
return s;
}
}
/**
*
*
* <pre>
* Name of the Operations resource to delete.
* </pre>
*
* <code>string operation = 52090215 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The bytes for operation.
*/
@java.lang.Override
public com.google.protobuf.ByteString getOperationBytes() {
java.lang.Object ref = operation_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
operation_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
public static final int PROJECT_FIELD_NUMBER = 227560217;
private volatile java.lang.Object project_;
/**
*
*
* <pre>
* Project ID for this request.
* </pre>
*
* <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The project.
*/
@java.lang.Override
public java.lang.String getProject() {
java.lang.Object ref = project_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
project_ = s;
return s;
}
}
/**
*
*
* <pre>
* Project ID for this request.
* </pre>
*
* <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The bytes for project.
*/
@java.lang.Override
public com.google.protobuf.ByteString getProjectBytes() {
java.lang.Object ref = project_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
project_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(operation_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 52090215, operation_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(project_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 227560217, project_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(operation_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(52090215, operation_);
}
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(project_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(227560217, project_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof com.google.cloud.compute.v1.DeleteGlobalOperationRequest)) {
return super.equals(obj);
}
com.google.cloud.compute.v1.DeleteGlobalOperationRequest other =
(com.google.cloud.compute.v1.DeleteGlobalOperationRequest) obj;
if (!getOperation().equals(other.getOperation())) return false;
if (!getProject().equals(other.getProject())) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + OPERATION_FIELD_NUMBER;
hash = (53 * hash) + getOperation().hashCode();
hash = (37 * hash) + PROJECT_FIELD_NUMBER;
hash = (53 * hash) + getProject().hashCode();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseDelimitedFrom(
java.io.InputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseDelimitedFrom(
java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
PARSER, input, extensionRegistry);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
com.google.protobuf.CodedInputStream input) throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() {
return newBuilder();
}
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(
com.google.cloud.compute.v1.DeleteGlobalOperationRequest prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
*
*
* <pre>
* A request message for GlobalOperations.Delete. See the method description for details.
* </pre>
*
* Protobuf type {@code google.cloud.compute.v1.DeleteGlobalOperationRequest}
*/
public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder>
implements
// @@protoc_insertion_point(builder_implements:google.cloud.compute.v1.DeleteGlobalOperationRequest)
com.google.cloud.compute.v1.DeleteGlobalOperationRequestOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
return com.google.cloud.compute.v1.Compute
.internal_static_google_cloud_compute_v1_DeleteGlobalOperationRequest_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return com.google.cloud.compute.v1.Compute
.internal_static_google_cloud_compute_v1_DeleteGlobalOperationRequest_fieldAccessorTable
.ensureFieldAccessorsInitialized(
com.google.cloud.compute.v1.DeleteGlobalOperationRequest.class,
com.google.cloud.compute.v1.DeleteGlobalOperationRequest.Builder.class);
}
// Construct using com.google.cloud.compute.v1.DeleteGlobalOperationRequest.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {}
}
@java.lang.Override
public Builder clear() {
super.clear();
operation_ = "";
project_ = "";
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() {
return com.google.cloud.compute.v1.Compute
.internal_static_google_cloud_compute_v1_DeleteGlobalOperationRequest_descriptor;
}
@java.lang.Override
public com.google.cloud.compute.v1.DeleteGlobalOperationRequest getDefaultInstanceForType() {
return com.google.cloud.compute.v1.DeleteGlobalOperationRequest.getDefaultInstance();
}
@java.lang.Override
public com.google.cloud.compute.v1.DeleteGlobalOperationRequest build() {
com.google.cloud.compute.v1.DeleteGlobalOperationRequest result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public com.google.cloud.compute.v1.DeleteGlobalOperationRequest buildPartial() {
com.google.cloud.compute.v1.DeleteGlobalOperationRequest result =
new com.google.cloud.compute.v1.DeleteGlobalOperationRequest(this);
result.operation_ = operation_;
result.project_ = project_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof com.google.cloud.compute.v1.DeleteGlobalOperationRequest) {
return mergeFrom((com.google.cloud.compute.v1.DeleteGlobalOperationRequest) other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(com.google.cloud.compute.v1.DeleteGlobalOperationRequest other) {
if (other == com.google.cloud.compute.v1.DeleteGlobalOperationRequest.getDefaultInstance())
return this;
if (!other.getOperation().isEmpty()) {
operation_ = other.operation_;
onChanged();
}
if (!other.getProject().isEmpty()) {
project_ = other.project_;
onChanged();
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
com.google.cloud.compute.v1.DeleteGlobalOperationRequest parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage =
(com.google.cloud.compute.v1.DeleteGlobalOperationRequest) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private java.lang.Object operation_ = "";
/**
*
*
* <pre>
* Name of the Operations resource to delete.
* </pre>
*
* <code>string operation = 52090215 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The operation.
*/
public java.lang.String getOperation() {
java.lang.Object ref = operation_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
operation_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* Name of the Operations resource to delete.
* </pre>
*
* <code>string operation = 52090215 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The bytes for operation.
*/
public com.google.protobuf.ByteString getOperationBytes() {
java.lang.Object ref = operation_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
operation_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* Name of the Operations resource to delete.
* </pre>
*
* <code>string operation = 52090215 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @param value The operation to set.
* @return This builder for chaining.
*/
public Builder setOperation(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
operation_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Name of the Operations resource to delete.
* </pre>
*
* <code>string operation = 52090215 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return This builder for chaining.
*/
public Builder clearOperation() {
operation_ = getDefaultInstance().getOperation();
onChanged();
return this;
}
/**
*
*
* <pre>
* Name of the Operations resource to delete.
* </pre>
*
* <code>string operation = 52090215 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @param value The bytes for operation to set.
* @return This builder for chaining.
*/
public Builder setOperationBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
operation_ = value;
onChanged();
return this;
}
private java.lang.Object project_ = "";
/**
*
*
* <pre>
* Project ID for this request.
* </pre>
*
* <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The project.
*/
public java.lang.String getProject() {
java.lang.Object ref = project_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
project_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* Project ID for this request.
* </pre>
*
* <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The bytes for project.
*/
public com.google.protobuf.ByteString getProjectBytes() {
java.lang.Object ref = project_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
project_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* Project ID for this request.
* </pre>
*
* <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @param value The project to set.
* @return This builder for chaining.
*/
public Builder setProject(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
project_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* Project ID for this request.
* </pre>
*
* <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return This builder for chaining.
*/
public Builder clearProject() {
project_ = getDefaultInstance().getProject();
onChanged();
return this;
}
/**
*
*
* <pre>
* Project ID for this request.
* </pre>
*
* <code>string project = 227560217 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @param value The bytes for project to set.
* @return This builder for chaining.
*/
public Builder setProjectBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);
project_ = value;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:google.cloud.compute.v1.DeleteGlobalOperationRequest)
}
// @@protoc_insertion_point(class_scope:google.cloud.compute.v1.DeleteGlobalOperationRequest)
private static final com.google.cloud.compute.v1.DeleteGlobalOperationRequest DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new com.google.cloud.compute.v1.DeleteGlobalOperationRequest();
}
public static com.google.cloud.compute.v1.DeleteGlobalOperationRequest getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<DeleteGlobalOperationRequest> PARSER =
new com.google.protobuf.AbstractParser<DeleteGlobalOperationRequest>() {
@java.lang.Override
public DeleteGlobalOperationRequest parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new DeleteGlobalOperationRequest(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<DeleteGlobalOperationRequest> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<DeleteGlobalOperationRequest> getParserForType() {
return PARSER;
}
@java.lang.Override
public com.google.cloud.compute.v1.DeleteGlobalOperationRequest getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
| [
"[email protected]"
] | |
bc5d1c96c478a3bcb2a0cfc2dca5dcbf829fc9dc | 1e47314717b2152f8f7b2bff884d4fa9ffe6d635 | /app/src/main/java/suda/sudamodweather/dao/greendao/RealWeatherDao.java | 8412a72bc5f1fe6e7415f769c1e46d969f4c9af0 | [
"Apache-2.0"
] | permissive | ghbhaha/MyWeather | 664f13fb3250aec3d7a6fb7888b2ec9b153ebf40 | 2d22396d67a6a17089919b2c16f99766a1ef60fc | refs/heads/master | 2020-12-24T07:07:04.247649 | 2019-03-28T01:14:10 | 2019-03-28T01:14:10 | 58,930,570 | 78 | 27 | null | null | null | null | UTF-8 | Java | false | false | 7,660 | java | package suda.sudamodweather.dao.greendao;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;
import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.DaoConfig;
import suda.sudamodweather.dao.greendao.RealWeather;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "REAL_WEATHER".
*/
public class RealWeatherDao extends AbstractDao<RealWeather, Void> {
public static final String TABLENAME = "REAL_WEATHER";
/**
* Properties of entity RealWeather.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Areaid = new Property(0, String.class, "areaid", false, "AREAID");
public final static Property AreaName = new Property(1, String.class, "areaName", false, "AREA_NAME");
public final static Property WeatherCondition = new Property(2, String.class, "weatherCondition", false, "WEATHER_CONDITION");
public final static Property Fx = new Property(3, String.class, "fx", false, "FX");
public final static Property Fj = new Property(4, String.class, "fj", false, "FJ");
public final static Property Temp = new Property(5, Integer.class, "temp", false, "TEMP");
public final static Property Feeltemp = new Property(6, Integer.class, "feeltemp", false, "FEELTEMP");
public final static Property Shidu = new Property(7, Integer.class, "shidu", false, "SHIDU");
public final static Property Sunrise = new Property(8, String.class, "sunrise", false, "SUNRISE");
public final static Property Sundown = new Property(9, String.class, "sundown", false, "SUNDOWN");
public final static Property LastUpdate = new Property(10, java.util.Date.class, "lastUpdate", false, "LAST_UPDATE");
};
public RealWeatherDao(DaoConfig config) {
super(config);
}
public RealWeatherDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"REAL_WEATHER\" (" + //
"\"AREAID\" TEXT," + // 0: areaid
"\"AREA_NAME\" TEXT," + // 1: areaName
"\"WEATHER_CONDITION\" TEXT," + // 2: weatherCondition
"\"FX\" TEXT," + // 3: fx
"\"FJ\" TEXT," + // 4: fj
"\"TEMP\" INTEGER," + // 5: temp
"\"FEELTEMP\" INTEGER," + // 6: feeltemp
"\"SHIDU\" INTEGER," + // 7: shidu
"\"SUNRISE\" TEXT," + // 8: sunrise
"\"SUNDOWN\" TEXT," + // 9: sundown
"\"LAST_UPDATE\" INTEGER);"); // 10: lastUpdate
}
/** Drops the underlying database table. */
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"REAL_WEATHER\"";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, RealWeather entity) {
stmt.clearBindings();
String areaid = entity.getAreaid();
if (areaid != null) {
stmt.bindString(1, areaid);
}
String areaName = entity.getAreaName();
if (areaName != null) {
stmt.bindString(2, areaName);
}
String weatherCondition = entity.getWeatherCondition();
if (weatherCondition != null) {
stmt.bindString(3, weatherCondition);
}
String fx = entity.getFx();
if (fx != null) {
stmt.bindString(4, fx);
}
String fj = entity.getFj();
if (fj != null) {
stmt.bindString(5, fj);
}
Integer temp = entity.getTemp();
if (temp != null) {
stmt.bindLong(6, temp);
}
Integer feeltemp = entity.getFeeltemp();
if (feeltemp != null) {
stmt.bindLong(7, feeltemp);
}
Integer shidu = entity.getShidu();
if (shidu != null) {
stmt.bindLong(8, shidu);
}
String sunrise = entity.getSunrise();
if (sunrise != null) {
stmt.bindString(9, sunrise);
}
String sundown = entity.getSundown();
if (sundown != null) {
stmt.bindString(10, sundown);
}
java.util.Date lastUpdate = entity.getLastUpdate();
if (lastUpdate != null) {
stmt.bindLong(11, lastUpdate.getTime());
}
}
/** @inheritdoc */
@Override
public Void readKey(Cursor cursor, int offset) {
return null;
}
/** @inheritdoc */
@Override
public RealWeather readEntity(Cursor cursor, int offset) {
RealWeather entity = new RealWeather( //
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // areaid
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // areaName
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // weatherCondition
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // fx
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // fj
cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5), // temp
cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6), // feeltemp
cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // shidu
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // sunrise
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // sundown
cursor.isNull(offset + 10) ? null : new java.util.Date(cursor.getLong(offset + 10)) // lastUpdate
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, RealWeather entity, int offset) {
entity.setAreaid(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
entity.setAreaName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setWeatherCondition(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setFx(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setFj(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setTemp(cursor.isNull(offset + 5) ? null : cursor.getInt(offset + 5));
entity.setFeeltemp(cursor.isNull(offset + 6) ? null : cursor.getInt(offset + 6));
entity.setShidu(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7));
entity.setSunrise(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
entity.setSundown(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
entity.setLastUpdate(cursor.isNull(offset + 10) ? null : new java.util.Date(cursor.getLong(offset + 10)));
}
/** @inheritdoc */
@Override
protected Void updateKeyAfterInsert(RealWeather entity, long rowId) {
// Unsupported or missing PK type
return null;
}
/** @inheritdoc */
@Override
public Void getKey(RealWeather entity) {
return null;
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
}
| [
"[email protected]"
] | |
e2b73573d7e6c5a080436ebd764bdb264314abd7 | cc3903479b0c8a7c6703919a5f4b40e07deca7d1 | /src/main/java/com/drmtx/app/demo/controller/WordFrequenceController.java | aa5ff75dac31a150f68ed407bc9e4516400a5fcf | [] | no_license | satishjs2297/dr_excercise | 48529908551ccb8fc16110d604ce20e0adebb2a9 | 55e36eb8d4f22eaf017a3c67b44ab2516aa90b71 | refs/heads/master | 2021-01-18T11:29:47.272679 | 2015-12-09T06:17:09 | 2015-12-09T06:17:09 | 47,633,969 | 0 | 0 | null | 2015-12-08T16:23:09 | 2015-12-08T16:23:09 | null | UTF-8 | Java | false | false | 2,745 | java | package com.drmtx.app.demo.controller;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import com.drmtx.app.demo.dto.WordFrequencyResp;
import com.drmtx.app.demo.service.WordFrequenceSvc;
@RestController
@RequestMapping(value = "/frequency")
public class WordFrequenceController {
private static final Logger LOG = LoggerFactory.getLogger(WordFrequenceController.class);
@Autowired
private WordFrequenceSvc wordFrequenceSvc;
@Autowired
private RestTemplate restTemplate;
@RequestMapping(value = "/new", method = RequestMethod.GET)
public String commentsReader(@RequestParam(value = "inputUrl", required = true) String inputUrl) {
LOG.debug("commentsReader#Begin :: inputUrl :: {}", inputUrl);
Long persistedId = 0l;
long strTime = System.currentTimeMillis();
long duration1 = 0l, duration2 = 0l;
try {
URI uri = new URI(inputUrl);
ResponseEntity<Object> responseEntity = restTemplate.getForEntity(uri, Object.class);
LOG.info(">>>>>>>>> response code :: {}", responseEntity.getStatusCode());
List<Map> respArryLst = (List<Map>) responseEntity.getBody();
duration1 = System.currentTimeMillis() - strTime;
long strTime1 = System.currentTimeMillis();
persistedId = wordFrequenceSvc.persistWordFrequence(respArryLst);
duration2 = System.currentTimeMillis() - strTime1;
} catch (URISyntaxException e) {
LOG.error("commentsReader @ Error :: {}", e.getMessage());
}
return "Generated Id :: " + persistedId + " Total Time :: " + (System.currentTimeMillis() - strTime)
+ ", DB insert time:" + duration2 + ", Rest Resp Time :: " + duration1;
}
@RequestMapping(value = "/{id}")
public List<WordFrequencyResp> getWordFrequency(@PathVariable("id") Long id,
@RequestParam(value = "count") Integer count) {
List<WordFrequencyResp> wordFrequencyRespLst = null;
try {
LOG.debug(" id :: {} and count :: {} ", id, count);
wordFrequencyRespLst = wordFrequenceSvc.getWordFrequencyById(id, count);
LOG.debug("wordFrequencyById :: {}", wordFrequencyRespLst);
} catch (Exception ex) {
LOG.error("getWordFrequency @ Error :: {}", ex.getMessage());
}
return wordFrequencyRespLst;
}
}
| [
"syandagudita"
] | syandagudita |
18cb5be77bdd0c59952553dd2582aa0816283d47 | 1496bee599e2d7e0d7fbcee815dfad2349d1ce25 | /app/src/main/java/com/example/kamarol/infoten_v1/Tools/TableAdapter.java | 60a7f65a84039418c9d268eb0240b6bf279cb4f7 | [] | no_license | kamarolzaman/infoten | e17db80fb538b7feb8622d59bf373baec5c306bd | d04fc22cf269e8882624f7fa64d8908a2fdfd207 | refs/heads/master | 2021-09-08T22:41:46.026296 | 2018-03-12T15:19:45 | 2018-03-12T15:19:45 | 109,330,155 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,856 | java | package com.example.kamarol.infoten_v1.Tools;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.kamarol.infoten_v1.R;
import java.util.ArrayList;
/**
* Created by musyrif on 19-Nov-17.
*/
public class TableAdapter extends ArrayAdapter <SubjectData> {
ArrayList<SubjectData> mylist;
public TableAdapter(@NonNull Context context, int resource, ArrayList<SubjectData> myList) {
super(context, resource, myList);
this.mylist = myList;
}
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View v;
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = inflater.inflate(R.layout.item_class, parent,false);
TextView startTime = v.findViewById(R.id.startTime);
TextView endTime = v.findViewById(R.id.endTime);
TextView name = v.findViewById(R.id.name);
TextView lecturer = v.findViewById(R.id.prof);
TextView loc = v.findViewById(R.id.place);
LinearLayout height = v.findViewById(R.id.height);
height.getLayoutParams().height = Math.round(v.getResources().getDimension(R.dimen.class_item_height)*mylist.get(position).getDuration());
startTime.setText(mylist.get(position).getStart24());
endTime.setText(mylist.get(position).getEnd24());
name.setText(mylist.get(position).getName());
lecturer.setText(mylist.get(position).getLecturer());
loc.setText(mylist.get(position).getLoc());
return v;
}
}
| [
"[email protected]"
] | |
5dbdd837786da2e36008069ac8b76322510c91cd | 0f42b069aec06487b09f038944a3ae8771908e30 | /spring초초보입문/spring(di)/src/spring/di/Program.java | 35e134272624768a7559f82c616ef43ee155c848 | [] | no_license | auddl0756/Spring | fa38371953d7a017710c6019ebcc2903ec0bee03 | 1f168478ef8e9ffe00818e697277aee8b74cad7e | refs/heads/master | 2023-03-30T02:15:36.485539 | 2021-04-06T03:06:05 | 2021-04-06T03:06:05 | 308,855,041 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 676 | java | //뉴렉처
//스프링 프레임워크 강의 5강 - Dependency를 직접 Injection하기
package spring.di;
import spring.di.entity.Exam;
import spring.di.entity.NewlecExam;
import spring.di.ui.ExamConsole;
import spring.di.ui.GridExamConsole;
import spring.di.ui.InlineExamConsole;
public class Program {
public static void main(String[] args) {
Exam exam = new NewlecExam();
// ExamConsole console = new InlineExamConsole(exam);
// console.print();
//dependency injection :: 조립.
//ExamConsole console = new GridExamConsole(exam);
//using setter.
ExamConsole console =new GridExamConsole();
console.setExam(exam);
console.print();
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.