blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
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
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dd8aef6a381e6e55c4de9e4655b5ae13c134710c | 618310e0ee42aa084779df14f08b8e0bf48f62f4 | /app/src/main/java/com/faishalbadri/hijab/data/sponsor/SponsorResponse.java | d83bc0ee58b2a0f590ca0362a94aed827466001a | []
| no_license | FaishalAlbadri/WarningMVP | d1e1394e62ba4c0f8f988bace2c60c9d48e37180 | e8f7509822d89fb50c084a904a21c8e085c4882b | refs/heads/master | 2021-05-07T18:40:00.203797 | 2018-03-03T14:15:05 | 2018-03-03T14:15:05 | 108,804,138 | 0 | 0 | null | 2018-02-17T18:07:18 | 2017-10-30T05:06:10 | Java | UTF-8 | Java | false | false | 1,053 | java | package com.faishalbadri.hijab.data.sponsor;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import javax.annotation.Generated;
@Generated("com.robohorse.robopojogenerator")
public class SponsorResponse {
@SerializedName("sponsor")
private List<SponsorItem> sponsor;
@SerializedName("error")
private boolean error;
@SerializedName("message")
private String message;
public List<SponsorItem> getSponsor() {
return sponsor;
}
public void setSponsor(List<SponsorItem> sponsor) {
this.sponsor = sponsor;
}
public boolean isError() {
return error;
}
public void setError(boolean error) {
this.error = error;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public String toString() {
return
"SponsorResponse{" +
"sponsor = '" + sponsor + '\'' +
",error = '" + error + '\'' +
",message = '" + message + '\'' +
"}";
}
} | [
"[email protected]"
]
| |
74adb9690dc290e21bc206f49c81f96b451ce8cf | 7ccea5116358732dbcf9d6b780ea516d8e958938 | /src/main/java/com/collection/MyBlockQueue.java | fe39bf958d2901f34fe8a74fbe25dfc927d84d35 | []
| no_license | missyoufv/study | ceb7c60708dee621ae6ca625d5e65355b9283a48 | e6f9a318e5c7c3c6459a183d30717c606b50b46b | refs/heads/master | 2022-12-07T03:29:02.414628 | 2020-04-28T08:22:43 | 2020-04-28T08:22:43 | 181,400,672 | 4 | 0 | null | 2022-11-16T09:49:00 | 2019-04-15T02:47:26 | Java | UTF-8 | Java | false | false | 3,025 | java | package com.collection;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 自己实现阻塞队列,解决生产消费者问题
*/
@Slf4j
public class MyBlockQueue {
private Object lock = new Object();
/**
* 队列默认大小
*/
private static final int DEFAULT_CAPACITY = 16;
/**
* 容器大小
*/
private int capicaity;
/**
* 存放数据类型数组
*/
private ArrayList<Object> table;
MyBlockQueue(int initialCapacity) {
if (initialCapacity < 0) {
throw new IllegalArgumentException();
}
int cap = initialCapacity > Integer.MAX_VALUE ? Integer.MAX_VALUE : initialCapacity;
capicaity = cap;
table = new ArrayList(cap);
}
/**
* 队列默认初始大小为16
*/
MyBlockQueue() {
this(DEFAULT_CAPACITY);
}
public synchronized void put(Object data) throws InterruptedException {
// 如果当前容器已满,则阻塞
while (isFull()){
wait();
}
table.add(data);
log.info(" ------元素{}入队完成------", data);
notify();
}
public synchronized Object get() throws InterruptedException {
while (isEmpty()){
wait();
}
Object result = table.remove(0);
notify();
log.info(" ------元素{}出队完成------", result);
return result;
}
private boolean isEmpty() {
if (CollectionUtils.isEmpty(table)) {
return true;
}
return false;
}
private boolean isFull() {
if (table != null && table.size() == capicaity) {
return true;
}
return false;
}
public static void main(String[] args) throws Exception{
AtomicInteger atomicInteger = new AtomicInteger(100);
MyBlockQueue blockQueue = new MyBlockQueue(200);
for (int i = 0; i < 5; i++) {
new Thread(() -> {
while (atomicInteger.compareAndSet(atomicInteger.get(),atomicInteger.get()-1)) {
try {
if (atomicInteger.get() > 0) {
blockQueue.put(atomicInteger.get());
}else {
return;
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}, "product" + i).start();
}
for (int i = 0; i < 1; i++) {
new Thread(() -> {
while (true) {
try {
blockQueue.get();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}, "consumer" + i).start();
}
}
}
| [
"1234qwer"
]
| 1234qwer |
7e04219022772825c36a31346b2b418ff1e48e8e | 1ec25226b708f419318bbb3daa2bf37de353d453 | /araqne-pcap-smb/src/main/java/org/araqne/pcap/smb/transreq/QueryNmpipeStateRequest.java | 157e5d6d90a3c5c6a7fc482182661c252ffac1f7 | []
| no_license | sjkbar/pcap | c3d5cb946ec9e4f4d852e5d9347935027a8fcf17 | 860773e6c9aa22d20a9945d5ceba8f9ee782b6fb | refs/heads/master | 2021-01-17T13:09:17.949098 | 2014-07-10T06:22:05 | 2014-07-10T06:30:08 | 21,682,446 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package org.araqne.pcap.smb.transreq;
import org.araqne.pcap.smb.TransData;
public class QueryNmpipeStateRequest implements TransData{
short subcommand;
short fid;
public short getSubcommand() {
return subcommand;
}
public void setSubcommand(short subcommand) {
this.subcommand = subcommand;
}
public short getFid() {
return fid;
}
public void setFid(short fid) {
this.fid = fid;
}
@Override
public String toString(){
return String.format("");
}
}
| [
"[email protected]"
]
| |
e1f47f9c7cb635f3fcfd346292c722bca889d8bf | 4fdc5824b41411e0c0f8599936df0c7f71488426 | /Homework3/RMIImplementation.java | ec745faee3e9e7893c0bf2b3d7d0a3cab25130eb | []
| no_license | SevkiBekir/CENG443_OOP | c3126d8fc945562131dce4a35d90fb9fe10f776c | 00177164c6521ba62d551f9f32380f07df83fb9f | refs/heads/master | 2020-03-12T06:58:02.990823 | 2018-06-06T18:44:08 | 2018-06-06T18:44:08 | 130,497,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,096 | java | //***************************************************************************************************************************************************
// TODO : imports
//***************************************************************************************************************************************************
//***************************************************************************************************************************************************
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class RMIImplementation implements RMIInterface {
//=================================================================================================================================================
private final String driver;
private final String url;
private final String database;
private final String username;
private final String password;
private Connection connection;
private Statement statement;
//=================================================================================================================================================
public RMIImplementation() throws Exception {
this.driver = "com.mysql.jdbc.Driver";
this.url = "jdbc:mysql://localhost:3306/";
this.database = "Ceng443";
this.username = "root";
this.password = "123";
this.connection = null;
this.statement = null;
connect();
}
//=================================================================================================================================================
public RMIImplementation(String driver, String url, String database, String username, String password) throws Exception {
this.driver = driver;
this.url = url;
this.database = database;
this.username = username;
this.password = password;
this.connection = null;
this.statement = null;
connect();
}
//=================================================================================================================================================
private void connect() throws Exception {
// TODO
// ....
try {
connection = DriverManager.getConnection(url + database, username, password);
} catch (SQLException e) {
e.printStackTrace();
}
}
//=================================================================================================================================================
@Override
protected void finalize() throws Throwable {
// TODO
// ....
connection.close();
statement.close();
}
//=================================================================================================================================================
@Override
public SerializableResult processSQL(String sql, boolean isQuery) throws RemoteException, SQLException {
// TODO
// ....
if(isQuery){
try {
statement = connection.createStatement();
SerializableResult serializableResult = new SerializableResult(statement.executeQuery(sql));
return serializableResult;
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}else{
statement = connection.createStatement();
SerializableResult serializableResult = new SerializableResult(statement.executeUpdate(sql));
return serializableResult;
}
return null;
}
//=================================================================================================================================================
}
//***************************************************************************************************************************************************
| [
"[email protected]"
]
| |
3848ce3dcbbfe2ecd60aaa87b841a43192745c54 | 6ca1fabd94d9455db892fed878ea521aa86ae7b3 | /MVP/src/main/java/com/zy/mvp/BaseActivity.java | f83e55de72c95ac1e8edb4f9cd695e115a3af726 | []
| no_license | hahajing0000/mvp | 7a5d5f671597c618b03f7ae04f40fcb0bc57fa01 | 10aa659750496a4a00395f1fcac80e6fec5365bc | refs/heads/main | 2023-04-11T10:35:02.357708 | 2021-04-16T08:27:25 | 2021-04-16T08:27:25 | 358,516,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package com.zy.mvp;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
/**
* @author:zhangyue
* @date:2021/4/16
*/
public abstract class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initView();
initData();
}
protected abstract void initView();
protected abstract void initData();
}
| [
"[email protected]"
]
| |
660f51fac6dc4db3efd26f1e29b6b7ef739cc4e3 | 8c2d50197b50d91344368cc9892b32cfd2bb72a6 | /xsdtest/ConRev/src/xcos/ExplicitOutputPort.java | facd8eecb1a080ac03796f6c6ef4b8ca223b0180 | []
| no_license | sarangsingh29/fossee-current | 835158afcd1008d79ef3f0b9b7eefaf58669d23f | 33fca3631c8144e1f477133c4896c664efb51ebf | refs/heads/master | 2021-01-17T09:53:21.819132 | 2016-06-14T16:39:17 | 2016-06-14T16:39:17 | 59,749,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,065 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.05.26 at 04:32:45 PM IST
//
package xcos;
import java.math.BigInteger;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{}mxGeometry"/>
* </sequence>
* <attribute name="as" type="{http://www.w3.org/2001/XMLSchema}NCName" />
* <attribute name="connectable" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="connectedLinkId" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="dataColumns" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="dataLines" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="dataType" type="{http://www.w3.org/2001/XMLSchema}NCName" />
* <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
* <attribute name="ordering" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="parent" type="{http://www.w3.org/2001/XMLSchema}NMTOKEN" />
* <attribute name="style" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
* <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}anySimpleType" />
* <attribute name="visible" type="{http://www.w3.org/2001/XMLSchema}integer" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"mxGeometry"
})
@XmlRootElement(name = "ExplicitOutputPort")
public class ExplicitOutputPort {
@XmlElement(required = true)
protected MxGeometry mxGeometry;
@XmlAttribute(name = "as")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "NCName")
protected String as;
@XmlAttribute(name = "connectable")
protected BigInteger connectable;
@XmlAttribute(name = "connectedLinkId")
protected BigInteger connectedLinkId;
@XmlAttribute(name = "dataColumns")
protected BigInteger dataColumns;
@XmlAttribute(name = "dataLines")
protected BigInteger dataLines;
@XmlAttribute(name = "dataType")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "NCName")
protected String dataType;
@XmlAttribute(name = "id", required = true)
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "NMTOKEN")
protected String id;
@XmlAttribute(name = "ordering")
protected BigInteger ordering;
@XmlAttribute(name = "parent")
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
@XmlSchemaType(name = "NMTOKEN")
protected String parent;
@XmlAttribute(name = "style")
@XmlSchemaType(name = "anySimpleType")
protected String style;
@XmlAttribute(name = "value")
@XmlSchemaType(name = "anySimpleType")
protected String value;
@XmlAttribute(name = "visible")
protected BigInteger visible;
/**
* Gets the value of the mxGeometry property.
*
* @return
* possible object is
* {@link MxGeometry }
*
*/
public MxGeometry getMxGeometry() {
return mxGeometry;
}
/**
* Sets the value of the mxGeometry property.
*
* @param value
* allowed object is
* {@link MxGeometry }
*
*/
public void setMxGeometry(MxGeometry value) {
this.mxGeometry = value;
}
/**
* Gets the value of the as property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getAs() {
return as;
}
/**
* Sets the value of the as property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAs(String value) {
this.as = value;
}
/**
* Gets the value of the connectable property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getConnectable() {
return connectable;
}
/**
* Sets the value of the connectable property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setConnectable(BigInteger value) {
this.connectable = value;
}
/**
* Gets the value of the connectedLinkId property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getConnectedLinkId() {
return connectedLinkId;
}
/**
* Sets the value of the connectedLinkId property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setConnectedLinkId(BigInteger value) {
this.connectedLinkId = value;
}
/**
* Gets the value of the dataColumns property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getDataColumns() {
return dataColumns;
}
/**
* Sets the value of the dataColumns property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setDataColumns(BigInteger value) {
this.dataColumns = value;
}
/**
* Gets the value of the dataLines property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getDataLines() {
return dataLines;
}
/**
* Sets the value of the dataLines property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setDataLines(BigInteger value) {
this.dataLines = value;
}
/**
* Gets the value of the dataType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDataType() {
return dataType;
}
/**
* Sets the value of the dataType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDataType(String value) {
this.dataType = value;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setId(String value) {
this.id = value;
}
/**
* Gets the value of the ordering property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getOrdering() {
return ordering;
}
/**
* Sets the value of the ordering property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setOrdering(BigInteger value) {
this.ordering = value;
}
/**
* Gets the value of the parent property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getParent() {
return parent;
}
/**
* Sets the value of the parent property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setParent(String value) {
this.parent = value;
}
/**
* Gets the value of the style property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStyle() {
return style;
}
/**
* Sets the value of the style property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStyle(String value) {
this.style = value;
}
/**
* Gets the value of the value property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the visible property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getVisible() {
return visible;
}
/**
* Sets the value of the visible property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setVisible(BigInteger value) {
this.visible = value;
}
}
| [
"[email protected]"
]
| |
6225d4b54636a8c238f5d53d50ea8c7c33b11714 | cbe35148fbda9bd5eb9dc82b124d47658dadaf4f | /SportiduinoManager/app/src/main/java/ru/mmb/sportiduinomanager/model/StationAPI.java | b82431d890a7bae6a203f3da445781524bcbda7c | []
| no_license | dichlofos/mmb | a05adc3197dedf1736d1c29ac238e112f6914543 | 7bd43dda22b79c454f10b138c60a4a402cf1d8e1 | refs/heads/master | 2020-09-02T06:11:47.315522 | 2019-11-02T12:38:23 | 2019-11-02T12:38:23 | 219,151,842 | 0 | 0 | null | 2019-11-02T12:39:25 | 2019-11-02T12:39:25 | null | UTF-8 | Java | false | false | 22,216 | java | package ru.mmb.sportiduinomanager.model;
import android.bluetooth.BluetoothDevice;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.TimeZone;
import ru.mmb.sportiduinomanager.R;
/**
* Provides all communication with a Bluetooth station.
*/
public final class StationAPI extends StationRaw {
/**
* Station mode for chips initialization.
*/
public static final int MODE_INIT_CHIPS = 0;
/**
* Station mode for an ordinary control point.
*/
public static final int MODE_OTHER_POINT = 1;
/**
* Station mode for control point at distance segment end.
*/
public static final int MODE_FINISH_POINT = 2;
/**
* Size of last teams buffer in station.
*/
public static final int LAST_TEAMS_LEN = 10;
/**
* Max number of punches that we can get in one request from station.
*/
public static final int MAX_PUNCH_COUNT = 61;
/**
* Indicate "Low battery" status at this voltage and below.
*/
public static final float BATTERY_LOW = 3.1f;
/**
* Number of pages to read from NTAG213 chip.
*/
private static final int SIZE_NTAG213 = 37;
/**
* Number of pages to read from NTAG215 chip.
*/
private static final int SIZE_NTAG215 = 125;
/**
* Number of pages to read from NTAG216 chip.
*/
private static final int SIZE_NTAG216 = 219;
/**
* Max number of pages to read in one request to station.
*/
private static final int MAX_READ_PAGES = 59;
/**
* List of last teams (up to 10) which punched at the station.
*/
// TODO: change to LinkedHashSet
private final List<Integer> mLastTeams;
/**
* Chip records received from fetchTeamHeader/fetchTeamPunches methods.
*/
private final Records mRecords;
/**
* Current station mode (0, 1 or 2).
*/
private int mMode;
/**
* Station local time at the end of getStatus/setTime.
*/
private long mStationTime;
/**
* Time difference in seconds between the station and Android.
*/
private int mTimeDrift;
/**
* Time of last chip initialization written in a chip.
*/
private long mLastInitTime;
/**
* Time of last punch at the station.
*/
private long mLastPunchTime;
/**
* Number of teams which already punched at the station.
*/
private int mTeamsPunched;
/**
* Number of nonempty records in chip from fetchTeamHeader method.
*/
private int mChipRecordsN;
/**
* Station firmware version received from getConfig.
*/
private int mFirmware;
/**
* Station battery voltage in Volts.
*/
private float mVoltage;
/**
* Station temperature received from getStatus.
*/
private int mTemperature;
/**
* Station battery voltage coefficient to convert to Volts from getStatus.
*/
private float mVCoeff;
/**
* Create Station from Bluetooth scan.
*
* @param device Bluetooth device handler
*/
public StationAPI(final BluetoothDevice device) {
super(device);
mLastTeams = new ArrayList<>();
mRecords = new Records(0);
mMode = 0;
mStationTime = 0;
mTimeDrift = 0;
mLastInitTime = 0;
mLastPunchTime = 0;
mTeamsPunched = 0;
mChipRecordsN = 0;
mFirmware = 0;
mVoltage = 0;
mTemperature = 0;
mVCoeff = 0.005_870f;
}
/**
* Get list of last teams punched at the station.
*
* @return Copy of mLastTeams array containing last teams numbers
*/
public List<Integer> getLastTeams() {
return new ArrayList<>(mLastTeams);
}
/**
* Get chip records received from fetchTeamHeader/fetchTeamPunches methods.
*
* @return Single record from fetchTeamHeader or list from fetchTeamPunches
*/
public Records getRecords() {
return mRecords;
}
/**
* Get station mode.
*
* @return Mode code (0, 1 or 2)
*/
public int getMode() {
return mMode;
}
/**
* Get station time at the end of last command processing.
*
* @return Time as unixtime
*/
public long getStationTime() {
return mStationTime;
}
/**
* Get station time drift.
*
* @return Time difference in seconds between the station and Android
*/
public int getTimeDrift() {
return mTimeDrift;
}
/**
* Get last initialization time written in a chip.
*
* @return Time as unixtime
*/
public long getLastInitTime() {
return mLastInitTime;
}
/**
* Get the time of last punch.
*
* @return Unixtime of last punch
*/
public long getLastPunchTime() {
return mLastPunchTime;
}
/**
* Get number of teams which already punched at the station.
*
* @return Number of punched teams
*/
public int getTeamsPunched() {
return mTeamsPunched;
}
/**
* Get number of nonempty records in team chip from getTeamRecord call.
*
* @return Total number of chip records to read from station flash
*/
public int getChipRecordsN() {
return mChipRecordsN;
}
/**
* Get station firmware version.
*
* @return Firmware version
*/
public int getFirmware() {
return mFirmware;
}
/**
* Get station battery voltage.
*
* @return Battery voltage in Volts
*/
public float getVoltage() {
return mVoltage;
}
/**
* Get station temperature.
*
* @return Station temperature in Celsius degrees
*/
public int getTemperature() {
return mTemperature;
}
/**
* Convert byte array section to int.
*
* @param array Array of bytes
* @param start Starting position of byte sequence which will be converted to int
* @param end Ending position of byte sequence
* @return Long representation of byte sequence
*/
private long byteArray2Long(final byte[] array, final int start, final int end) {
long result = 0;
for (int i = start; i <= end; i++) {
result = result | (array[i] & 0xFF) << ((end - i) * 8);
}
return result;
}
/**
* Copy first count bytes from int value to the section of byte array.
*
* @param value Long value to copy
* @param array Target byte array
* @param starting Starting position in byte array to copy long value
* @param count Number of bytes to copy
*/
private void long2ByteArray(final long value, final byte[] array, final int starting,
final int count) {
byte[] converted = new byte[count];
for (int i = 0; i < count; i++) {
converted[count - 1 - i] = (byte) ((value >> 8 * i) & 0xFF);
}
System.arraycopy(converted, 0, array, starting, count);
}
/**
* Set station mode and number.
*
* @param mode New station mode (chip initialization, ordinary or finish point)
* @return True if we got valid response from station, check mLastError otherwise
*/
public boolean newMode(final int mode) {
// Zero number is only for chip initialization
if (getNumber() == 0 && mode != MODE_INIT_CHIPS) {
setLastError(R.string.err_init_wrong_mode);
return false;
}
final byte[] response = new byte[0];
if (command(new byte[]{CMD_SET_MODE, (byte) mode}, response)) {
mMode = mode;
return true;
} else {
return false;
}
}
/**
* Set station clock to Android local time converted to UTC timezone.
*
* @return True if we got valid response from station, check mLastError otherwise
*/
public boolean syncTime() {
byte[] commandData = new byte[7];
commandData[0] = CMD_SET_TIME;
// Get current UTC time
final Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
commandData[1] = (byte) (calendar.get(Calendar.YEAR) - 2000);
commandData[2] = (byte) (calendar.get(Calendar.MONTH) + 1);
commandData[3] = (byte) calendar.get(Calendar.DAY_OF_MONTH);
commandData[4] = (byte) calendar.get(Calendar.HOUR_OF_DAY);
commandData[5] = (byte) calendar.get(Calendar.MINUTE);
commandData[6] = (byte) (calendar.get(Calendar.SECOND));
// Send it to station
final byte[] response = new byte[4];
if (!command(commandData, response)) return false;
// Get new station time
mStationTime = byteArray2Long(response, 0, 3);
mTimeDrift = (int) (mStationTime - System.currentTimeMillis() / 1000L);
return true;
}
/**
* Reset station by giving it new number and erasing all data in it.
*
* @param number New station number
* @return True if we got valid response from station, check mLastError otherwise
*/
public boolean resetStation(final int number) {
// Don't allow 0xFF station number
if (number < 0 || number >= 0xFF) {
setLastError(R.string.err_station_wrong_number);
return false;
}
// Prepare command payload
byte[] commandData = new byte[8];
commandData[0] = CMD_RESET_STATION;
long2ByteArray(mTeamsPunched, commandData, 1, 2);
long2ByteArray((int) mLastPunchTime, commandData, 3, 4);
commandData[7] = (byte) number;
// Send it to station
final byte[] response = new byte[0];
if (!command(commandData, response)) return false;
// Update station number and mode in class object
setNumber(number);
mMode = MODE_INIT_CHIPS;
// Forget all teams and their punches which have been occurred before reset
mChipRecordsN = 0;
mRecords.clear();
mLastTeams.clear();
return true;
}
/**
* Get station local time, mode, number, etc.
*
* @return True if we got valid response from station, check mLastError otherwise
*/
public boolean fetchStatus() {
// Get response from station
final byte[] response = new byte[14];
if (!command(new byte[]{CMD_GET_STATUS}, response)) return false;
// Get station time
mStationTime = byteArray2Long(response, 0, 3);
mTimeDrift = (int) (mStationTime - System.currentTimeMillis() / 1000L);
// Get number of teams already punched at the station
mTeamsPunched = (int) byteArray2Long(response, 4, 5);
// Get last chips punch time
mLastPunchTime = byteArray2Long(response, 6, 9);
// Get station battery voltage in "parrots"
final int voltage = (int) byteArray2Long(response, 10, 11);
// Convert value to Volts
mVoltage = voltage * mVCoeff;
// Get station temperature
mTemperature = (int) byteArray2Long(response, 12, 13);
return true;
}
/**
* Init a chip with team number and members mask.
*
* @param teamNumber Team number
* @param teamMask Mask of team members presence
* @return True if succeeded
*/
public boolean initChip(final int teamNumber, final int teamMask) {
// Note: last 4 byte are reserved and equal to zero now
byte[] commandData = new byte[5];
commandData[0] = CMD_INIT_CHIP;
// Prepare command payload
long2ByteArray(teamNumber, commandData, 1, 2);
long2ByteArray(teamMask, commandData, 3, 2);
// Send command to station
final byte[] response = new byte[12];
if (!command(commandData, response)) return false;
// Get init time from station response
mLastInitTime = byteArray2Long(response, 0, 3);
// Update station time and drift
mStationTime = mLastInitTime;
mTimeDrift = (int) (mStationTime - getStartTime());
// Chip UID (bytes 4-11) is ignored right now
return true;
}
/**
* Get list of last LAST_TEAMS_LEN teams which has been punched at the station.
*
* @return True if succeeded
*/
public boolean fetchLastTeams() {
// Get response from station
final byte[] response = new byte[LAST_TEAMS_LEN * 2];
if (!command(new byte[]{CMD_LAST_TEAMS}, response)) return false;
mLastTeams.clear();
for (int i = 0; i < LAST_TEAMS_LEN; i++) {
final int teamNumber = (int) byteArray2Long(response, i * 2, i * 2 + 1);
if (teamNumber > 0 && !mLastTeams.contains(teamNumber)) mLastTeams.add(teamNumber);
}
return true;
}
/**
* Get info about team with teamNumber number punched at the station.
*
* @param teamNumber Number of team to fetch
* @return True if succeeded
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean fetchTeamHeader(final int teamNumber) {
// Prepare command payload
byte[] commandData = new byte[3];
commandData[0] = CMD_TEAM_RECORD;
long2ByteArray(teamNumber, commandData, 1, 2);
// Send command to station
final byte[] response = new byte[13];
mChipRecordsN = 0;
mRecords.clear();
if (!command(commandData, response)) return false;
// Parse response
final int checkTeamNumber = (int) byteArray2Long(response, 0, 1);
if (checkTeamNumber != teamNumber) {
setLastError(R.string.err_station_team_changed);
return false;
}
final long initTime = byteArray2Long(response, 2, 5);
final int teamMask = (int) byteArray2Long(response, 6, 7);
final long teamTime = byteArray2Long(response, 8, 11);
mChipRecordsN = response[12] & 0xFF;
// Save team punch at our station as single record in mRecords
mRecords.addRecord(this, initTime, teamNumber, teamMask, getNumber(), teamTime);
// Check if we have a valid number of punches in copy of the chip in flash memory
if (mChipRecordsN <= 8 || mChipRecordsN >= 0xFF) {
mChipRecordsN = 0;
setLastError(R.string.err_station_flash_empty);
return false;
}
mChipRecordsN -= 8;
return true;
}
/**
* Read all data from chip placed near the station.
*
* @return true if succeeded
*/
public boolean readCard() {
int pagesLeft = 0;
int pagesInRequest = SIZE_NTAG213;
byte pageFrom = 3;
int punchesOffset = 29;
boolean cardHeader = true;
int teamNumber = 0;
long initTime = 0;
int teamMask = 0;
mRecords.clear();
// Prepare command payload
byte[] commandData = new byte[3];
commandData[0] = CMD_READ_CARD;
do {
commandData[1] = pageFrom;
commandData[2] = (byte) (pageFrom + pagesInRequest - 1);
// Send command to station
final byte[] response = new byte[pagesInRequest * 4 + 9];
if (!command(commandData, response)) return false;
if (response[8] != commandData[1]) {
setLastError(R.string.err_station_address_changed);
return false;
}
// Parse card header
if (cardHeader) {
cardHeader = false;
// Detect card type and update number of pages to read according to card size
final int ntagType = response[11] & 0xFF;
switch (ntagType) {
case 0x12:
pagesLeft = SIZE_NTAG213;
break;
case 0x3e:
pagesLeft = SIZE_NTAG215;
break;
case 0x6d:
pagesLeft = SIZE_NTAG216;
break;
default:
setLastError(R.string.err_station_bad_chip_type);
return false;
}
// Check if it is Sportiduino chip
final int sportiduinoType = response[15] & 0xFF;
if (!(pagesLeft == SIZE_NTAG213 && sportiduinoType == 213
|| pagesLeft == SIZE_NTAG215 && sportiduinoType == 215
|| pagesLeft == SIZE_NTAG216 && sportiduinoType == 216)) {
setLastError(R.string.err_station_bad_chip_content);
return false;
}
// Get team number, init time amd members mask from header
teamNumber = (int) byteArray2Long(response, 13, 14);
initTime = byteArray2Long(response, 17, 20);
teamMask = (int) byteArray2Long(response, 21, 22);
// Create fake punch record at chip init point
mRecords.addRecord(this, initTime, teamNumber, teamMask, 0, initTime);
}
// Get punches from fetched pages
for (int i = punchesOffset; i < response.length; i = i + 4) {
final int pointNumber = response[i];
final long pointTime = byteArray2Long(response, i + 1, i + 3);
// Stop parsing and making request to station if zero record is found
if (pointNumber == 0 && pointTime == 0) {
pagesLeft = 0;
break;
}
mRecords.addRecord(this, initTime, teamNumber, teamMask, pointNumber,
pointTime + (initTime & 0xff000000));
}
punchesOffset = 9;
// Detect how many pages we still need to read in next cycle
pageFrom += pagesInRequest;
pagesLeft -= pagesInRequest;
if (pagesLeft < MAX_READ_PAGES) {
pagesInRequest = pagesLeft;
} else {
pagesInRequest = MAX_READ_PAGES;
}
} while (pagesInRequest > 0);
return true;
}
/**
* Update team mask in station.
*
* @param teamNumber Number of team to update
* @param initTime Chip init time
* (along with team number it is the primary key of a chip)
* @param teamMask New team members mask
* @return true if succeeded
*/
public boolean updateTeamMask(final int teamNumber, final long initTime, final int teamMask) {
// Prepare command payload
byte[] commandData = new byte[9];
commandData[0] = CMD_UPDATE_MASK;
long2ByteArray(teamNumber, commandData, 1, 2);
long2ByteArray(initTime, commandData, 3, 4);
long2ByteArray(teamMask, commandData, 7, 2);
// Send command to station
final byte[] response = new byte[0];
return command(commandData, response);
}
/**
* Get some punches from a copy of a chip in station flash memory.
*
* @param teamNumber Team number
* @param initTime Chip init time (for creation of new punch records)
* @param teamMask Chip team mask (for creation of new punch records)
* @param fromPunch Starting position in the list of punches
* @param count Number of punches to read
* @return True if succeeded, fills mRecords with punches as Record instances
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean fetchTeamPunches(final int teamNumber, final long initTime, final int teamMask, final int fromPunch,
final int count) {
if (count <= 0 || count > MAX_PUNCH_COUNT) {
setLastError(R.string.err_station_buffer_overflow);
return false;
}
// Prepare command payload
byte[] commandData = new byte[6];
commandData[0] = CMD_READ_FLASH;
final long punchesZone = teamNumber * 1024L + 48L;
final long startAddress = punchesZone + fromPunch * 4L;
long2ByteArray(startAddress, commandData, 1, 4);
commandData[5] = (byte) ((count * 4) & 0xFF);
// Send command to station
final byte[] response = new byte[4 + count * 4];
mChipRecordsN = 0;
mRecords.clear();
if (!command(commandData, response)) return false;
// Check that read address in response is equal to read address in command
if (startAddress != byteArray2Long(response, 0, 3)) {
setLastError(R.string.err_station_address_changed);
return false;
}
// Get first byte of current time
final long timeCorrection = mStationTime & 0xFF000000;
// Add new records
for (int i = 0; i < count; i++) {
final int pointNumber = response[4 + i * 4] & 0xFF;
final long pointTime =
byteArray2Long(response, 5 + i * 4, 7 + i * 4) + timeCorrection;
// Check if the record is non-empty
if (pointNumber == 0xFF && (pointTime - timeCorrection) == 0x00FFFFFF) break;
mRecords.addRecord(this, initTime, teamNumber, teamMask, pointNumber, pointTime);
}
// Check number of actually read punches
if (mRecords.size() == count) {
return true;
} else {
setLastError(R.string.err_station_flash_empty);
return false;
}
}
/**
* Get station firmware version and configuration.
*
* @return True if succeeded
*/
public boolean fetchConfig() {
// Get response from station
final byte[] response = new byte[20];
if (!command(new byte[]{CMD_GET_CONFIG}, response)) return false;
// Get station firmware
mFirmware = response[0];
// Get station mode
mMode = response[1] & 0xFF;
// Get voltage coefficient
mVCoeff = ByteBuffer.wrap(response, 7, 4).order(ByteOrder.LITTLE_ENDIAN).getFloat();
// Ignore all other parameters
return true;
}
}
| [
"[email protected]"
]
| |
82e1cb4c939c6dd18ae9837498f5e28273c0616e | 66d004997e10e7ba246d8a113c05011f53ca4efd | /src/domain/Agent.java | ec853f3a6cc7b1815f2297cbdcadcf1b4de5f091 | []
| no_license | dtbinh/SCI_Foundations | 604bd4fc61380e280b2d47777e0db296b86b58a0 | de0b77c76f944b7440b985a2de61c0d8da6927ac | refs/heads/master | 2021-01-11T00:48:54.987234 | 2014-03-31T13:42:09 | 2014-03-31T13:42:09 | 70,484,202 | 1 | 0 | null | 2016-10-10T12:09:32 | 2016-10-10T12:09:32 | null | UTF-8 | Java | false | false | 360 | java | package domain;
public abstract class Agent {
protected Environnement env;
protected SMA sma;
public Agent(Environnement env, SMA sma) {
super();
this.env = env;
this.sma = sma;
}
public Environnement getEnv() {
return env;
}
public SMA getSma() {
return sma;
}
public abstract void decide();
public abstract boolean isPhysique();
}
| [
"[email protected]"
]
| |
c099511241ec814bfc86f38278712de3f4b6e4c4 | cfb3170ee3e43205b19ee873212d64d23f284426 | /CursoLogicaCapitulo04/src/OperadoresLogicos.java | b668c8ea2727b63992c62487e524e66d37d7e407 | []
| no_license | Scorsatto/curso-01-lpji | 0c6a8d9af5244ffe0763d1e5502d61bb962b606f | c7f5dd2b361260f53d0ad0519b131bea79252c78 | refs/heads/main | 2023-07-10T13:19:10.242002 | 2021-07-30T00:31:08 | 2021-07-30T00:31:08 | 390,872,562 | 3 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,939 | java | public class OperadoresLogicos {
public static void main(String[] args) {
Boolean carrinhoMaiorQue100 = true;
Boolean periodoDePromocao = false;
Boolean jaFezCompraNaLoja = false;
Boolean pagamentoAVista = true;
System.out.println("**** && - E ****");
Boolean aplicarDesconto = carrinhoMaiorQue100 && periodoDePromocao;
if (aplicarDesconto) {
System.out.println("Sim! Aplique o desconto.");
} else {
System.out.println("Não aplique o desconto.");
}
System.out.println("**** || - OU ****");
aplicarDesconto = carrinhoMaiorQue100 || periodoDePromocao;
if (aplicarDesconto) {
System.out.println("Sim! Aplique o desconto.");
} else {
System.out.println("Não aplique o desconto.");
}
System.out.println("**** && - Varias condições ****");
aplicarDesconto = periodoDePromocao && carrinhoMaiorQue100 && jaFezCompraNaLoja;
if (aplicarDesconto) {
System.out.println("Sim! Aplique o desconto.");
} else {
System.out.println("Não aplique o desconto.");
}
System.out.println("**** || - Varias condições ****");
aplicarDesconto = periodoDePromocao || carrinhoMaiorQue100 || jaFezCompraNaLoja;
if (aplicarDesconto) {
System.out.println("Sim! Aplique o desconto.");
} else {
System.out.println("Não aplique o desconto.");
}
System.out.println("**** && e || - Varias condições ****");
aplicarDesconto = periodoDePromocao && (carrinhoMaiorQue100 || jaFezCompraNaLoja);
if (aplicarDesconto) {
System.out.println("Sim! Aplique o desconto.");
} else {
System.out.println("Não aplique o desconto.");
}
System.out.println("**** && e || e && - Varias condições ****");
aplicarDesconto = periodoDePromocao && (carrinhoMaiorQue100 || jaFezCompraNaLoja) && pagamentoAVista;
if (aplicarDesconto) {
System.out.println("Sim! Aplique o desconto.");
} else {
System.out.println("Não aplique o desconto.");
}
}
}
| [
"[email protected]"
]
| |
ba21ab6fe04d5f892436dc13cc103c454f8ec1db | cf9851c03246b5865e6ec67abb97e27e989964af | /src/main/java/com/voole/ad/model/inventory/Location.java | 86bef9ccf16e9717dee235dc7a8a61c401870d01 | []
| no_license | leilei53401/spring_mytest | f4883af3a54bcd33a8f268a5496bcca1c18848a0 | 862229690a77b708a3f1364cb3208336225c887a | refs/heads/master | 2020-03-22T09:16:33.338817 | 2018-07-05T09:27:50 | 2018-07-05T09:27:50 | 139,826,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.voole.ad.model.inventory;
public class Location {
private String locatid;
private Integer quantity;
public String getLocatid() {
return locatid;
}
public void setLocatid(String locatid) {
this.locatid = locatid;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public boolean equals(Object obj){
if (obj instanceof Location) {
Location location = (Location) obj;
return this.locatid.equals(location.getLocatid());
}
return super.equals(obj);
}
}
| [
"[email protected]"
]
| |
ebc662dd52851063d9f566dd37865c9baac7cb44 | 5ca3901b424539c2cf0d3dda52d8d7ba2ed91773 | /src_cfr/com/google/common/cache/LocalCache$LoadingValueReference.java | c937d02a5882ea67e5832309072c7d634de8f1b8 | []
| no_license | fjh658/bindiff | c98c9c24b0d904be852182ecbf4f81926ce67fb4 | 2a31859b4638404cdc915d7ed6be19937d762743 | refs/heads/master | 2021-01-20T06:43:12.134977 | 2016-06-29T17:09:03 | 2016-06-29T17:09:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,066 | java | /*
* Decompiled with CFR 0_115.
*
* Could not load the following classes:
* javax.annotation.Nullable
*/
package com.google.common.cache;
import com.google.common.base.Stopwatch;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LocalCache;
import com.google.common.cache.LocalCache$LoadingValueReference$1;
import com.google.common.cache.LocalCache$ReferenceEntry;
import com.google.common.cache.LocalCache$ValueReference;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.Uninterruptibles;
import java.lang.ref.ReferenceQueue;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
class LocalCache$LoadingValueReference
implements LocalCache$ValueReference {
volatile LocalCache$ValueReference oldValue;
final SettableFuture futureValue = SettableFuture.create();
final Stopwatch stopwatch = Stopwatch.createUnstarted();
public LocalCache$LoadingValueReference() {
this(LocalCache.unset());
}
public LocalCache$LoadingValueReference(LocalCache$ValueReference localCache$ValueReference) {
this.oldValue = localCache$ValueReference;
}
@Override
public boolean isLoading() {
return true;
}
@Override
public boolean isActive() {
return this.oldValue.isActive();
}
@Override
public int getWeight() {
return this.oldValue.getWeight();
}
public boolean set(@Nullable Object object) {
return this.futureValue.set(object);
}
public boolean setException(Throwable throwable) {
return this.futureValue.setException(throwable);
}
private ListenableFuture fullyFailedFuture(Throwable throwable) {
return Futures.immediateFailedFuture(throwable);
}
@Override
public void notifyNewValue(@Nullable Object object) {
if (object != null) {
this.set(object);
return;
}
this.oldValue = LocalCache.unset();
}
public ListenableFuture loadFuture(Object object, CacheLoader cacheLoader) {
try {
SettableFuture settableFuture /* !! */ ;
this.stopwatch.start();
Object object2 = this.oldValue.get();
if (object2 != null) {
ListenableFuture listenableFuture = cacheLoader.reload(object, object2);
if (listenableFuture != null) return Futures.transform(listenableFuture, new LocalCache$LoadingValueReference$1(this));
return Futures.immediateFuture(null);
}
Object object3 = cacheLoader.load(object);
if (this.set(object3)) {
settableFuture /* !! */ = this.futureValue;
return settableFuture /* !! */ ;
}
settableFuture /* !! */ = Futures.immediateFuture(object3);
return settableFuture /* !! */ ;
}
catch (Throwable var3_4) {
ListenableFuture listenableFuture = this.setException(var3_4) ? this.futureValue : this.fullyFailedFuture(var3_4);
if (!(var3_4 instanceof InterruptedException)) return listenableFuture;
Thread.currentThread().interrupt();
return listenableFuture;
}
}
public long elapsedNanos() {
return this.stopwatch.elapsed(TimeUnit.NANOSECONDS);
}
@Override
public Object waitForValue() {
return Uninterruptibles.getUninterruptibly(this.futureValue);
}
@Override
public Object get() {
return this.oldValue.get();
}
public LocalCache$ValueReference getOldValue() {
return this.oldValue;
}
@Override
public LocalCache$ReferenceEntry getEntry() {
return null;
}
@Override
public LocalCache$ValueReference copyFor(ReferenceQueue referenceQueue, @Nullable Object object, LocalCache$ReferenceEntry localCache$ReferenceEntry) {
return this;
}
}
| [
"[email protected]"
]
| |
514a7086f31d281a388718b669f1676ec9784901 | 049004ccf202645aef0d159a5f8a7629a369ea70 | /Lab1/src/main/java/model/database/Table.java | 50936004aef255cc45714cdc8f8af0451b8afb96 | []
| no_license | i1red/oop-6th-sem | aa2a80bfb955bc29e83974bfc89c3ccb5e7ce8a7 | cbdf5a26028c4a5027445f9226acb993856325a1 | refs/heads/master | 2023-05-31T03:37:43.269216 | 2021-06-16T18:09:15 | 2021-06-16T18:09:15 | 358,947,912 | 0 | 0 | null | 2021-06-16T18:09:16 | 2021-04-17T18:00:20 | Java | UTF-8 | Java | false | false | 2,454 | java | package model.database;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Table {
public static class User {
public static final String NAME = "\"user\"";
public static class Column {
public static final String ID = "id";
public static final String USERNAME = "username";
public static final String PASSWORD = "password";
public static final String IS_ADMIN = "is_admin";
}
public static final List<String> COLUMNS = Arrays.asList(Column.ID, Column.USERNAME, Column.PASSWORD, Column.IS_ADMIN);
}
public static class Payment {
public static final String NAME = "payment";
public static class Column {
public static final String ID = "id";
public static final String FROM_CARD_ID = "from_card_id";
public static final String TO_CARD_ID = "to_card_id";
public static final String SUM = "sum";
}
public static final List<String> COLUMNS = Arrays.asList(Column.ID, Column.FROM_CARD_ID, Column.TO_CARD_ID, Column.SUM);
}
public static class Card {
public static final String NAME = "card";
public static class Column {
public static final String ID = "id";
public static final String NUMBER = "number";
public static final String BALANCE = "balance";
public static final String ACCOUNT_ID = "account_id";
}
public static final List<String> COLUMNS = Arrays.asList(Column.ID, Column.NUMBER, Column.BALANCE, Column.ACCOUNT_ID);
}
public static class BankAccount {
public static final String NAME = "bank_account";
public static class Column {
public static final String ID = "id";
public static final String NUMBER = "number";
public static final String USER_ID = "user_id";
public static final String IS_BLOCKED = "is_blocked";
}
public static final List<String> COLUMNS = Arrays.asList(Column.ID, Column.NUMBER, Column.USER_ID, Column.IS_BLOCKED);
}
public static class RefreshToken {
public static final String NAME = "refresh_token";
public static class Column {
public static final String VALUE = "value";
}
public static final List<String> COLUMNS = Collections.singletonList(Column.VALUE);
}
}
| [
"[email protected]"
]
| |
720e89d4f5b779f557e202be7aca23c7afcdadce | 5312ec3caf7aa02968a7b0899f0ad4c8bc155674 | /kripton-processor/src/test/java/sqlite/feature/relations/case3/DaoSong.java | e76718f30ba54cc77f86e0e56e02b5365cf65dc0 | [
"Apache-2.0"
]
| permissive | xcesco/kripton | 90657215d5e4a37f694c82fbd25a4691091e2c65 | 1995bf462677d7de993c50de31f01c9e5f13603f | refs/heads/master | 2023-01-21T20:28:29.373376 | 2023-01-04T14:57:00 | 2023-01-04T14:57:00 | 31,342,939 | 134 | 19 | Apache-2.0 | 2023-01-04T14:57:01 | 2015-02-26T00:24:15 | Java | UTF-8 | Java | false | false | 474 | java | package sqlite.feature.relations.case3;
import java.util.List;
import com.abubusoft.kripton.android.annotation.BindDao;
import com.abubusoft.kripton.android.annotation.BindSqlParam;
import com.abubusoft.kripton.android.annotation.BindSqlSelect;
@BindDao(Song.class)
public interface DaoSong extends DaoBase<Song> {
@BindSqlSelect
List<Song> selectAll();
@BindSqlSelect(where="albumId=${albumId}")
List<Song> selectByAlbumId(@BindSqlParam("albumId") long dummy);
}
| [
"[email protected]"
]
| |
efff2443ca601afcc05090b469b01b6ced14fefc | d7ea6d63ecb6e3fd720c609b13ab3fe098f5825c | /src/main/java/com/example/demo/dao/astro/daoAstro.java | 626bb00b92ace0fdd3b469f0446b955e62c0d62f | []
| no_license | Akshay272000/AssignmentIndiaToday | fc842ad80081c9d687cf49274fcb2090fa780692 | 6e3d7bed94b9f140a1f0c1ebc0e988aba82e2581 | refs/heads/main | 2023-08-06T20:45:32.935251 | 2021-10-03T11:24:37 | 2021-10-03T11:24:37 | 412,919,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 281 | java | package com.example.demo.dao.astro;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.example.demo.entity.astro.astro;
@Repository
public interface daoAstro extends JpaRepository<astro, Integer> {
}
| [
"[email protected]"
]
| |
fbca4f2a460dd7aa7738b6106fdecf0966f2b023 | c6cfb080aa6a84c5c7edc91169ffd553827f9e10 | /dongyimai_user_interface/src/main/java/com/offcn/user/service/AddressService.java | c2a087433f7dcbad55159d86eb82381301a2a5a7 | []
| no_license | 1762121278/yifan_parent | 421b999fe601f15deb848aba1c6e2d41edcfc857 | a3460ac3e4f1a721db78bb2f1ef544750c4c5f56 | refs/heads/master | 2022-12-21T09:20:33.828371 | 2020-09-27T07:32:33 | 2020-09-27T07:32:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,016 | java | package com.offcn.user.service;
import com.offcn.entity.PageResult;
import com.offcn.pojo.TbAddress;
import java.util.List;
/**
* 服务层接口
* @author Administrator
*
*/
public interface AddressService {
/**
* 返回全部列表
* @return
*/
public List<TbAddress> findAll();
/**
* 返回分页列表
* @return
*/
public PageResult findPage(int pageNum, int pageSize);
/**
* 增加
*/
public void add(TbAddress address);
/**
* 修改
*/
public void update(TbAddress address);
/**
* 根据ID获取实体
* @param id
* @return
*/
public TbAddress findOne(Long id);
/**
* 批量删除
* @param ids
*/
public void delete(Long[] ids);
/**
* 分页
* @param pageNum 当前页 码
* @param pageSize 每页记录数
* @return
*/
public PageResult findPage(TbAddress address, int pageNum, int pageSize);
/**
* 根据用户查询地址
* @param userId
* @return
*/
public List<TbAddress> findListByUserId(String userId);
}
| [
"[email protected]"
]
| |
d774da74a2297825be5848ab3d9c4c3c3b33203c | cf7058d83427f739cffd81cfdad4459ceded8ab3 | /src/main/java/com/maolintu/flashsale/util/UserUtil.java | 059af17375d2f9b0e9f778b2feff9ba51a1c94d9 | []
| no_license | tumaolin94/e-commerce_flashsale | ee2120dfaaac414ac42740a12a02922c79ccc0ec | 7bf5d342dfaeb22132e4e34fd6fc03afc750303a | refs/heads/master | 2020-04-16T05:50:41.188874 | 2019-02-19T02:45:26 | 2019-02-19T02:45:26 | 165,323,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,662 | java | package com.maolintu.flashsale.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.maolintu.flashsale.domain.SaleUser;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.URL;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UserUtil {
private static Logger logger = LoggerFactory.getLogger(UserUtil.class);
private static void insertDB(List<SaleUser> users) throws Exception{
logger.info("Insert users");
//insert database
Connection conn = DBUtil.getConn();
String sql = "insert into users(login_count, nickname, register_date, salt, password, id)values(?,?,?,?,?,?)";
PreparedStatement pstmt = conn.prepareStatement(sql);
for(int i=0;i<users.size();i++) {
SaleUser user = users.get(i);
pstmt.setInt(1, user.getLoginCount());
pstmt.setString(2, user.getNickname());
pstmt.setTimestamp(3, new Timestamp(user.getRegisterDate().getTime()));
pstmt.setString(4, user.getSalt());
pstmt.setString(5, user.getPassword());
pstmt.setLong(6, user.getId());
pstmt.addBatch();
}
pstmt.executeBatch();
pstmt.close();
conn.close();
logger.info("insert to db");
}
private static void createUser(int count) throws Exception {
List<SaleUser> users = new ArrayList<SaleUser>(count);
//Genereate users
for(int i=0;i<count;i++) {
SaleUser user = new SaleUser();
user.setId(13000000000L+i);
user.setLoginCount(1);
user.setNickname("user"+i);
user.setRegisterDate(new Date());
user.setSalt("1a2b3c");
user.setPassword(MD5Util.inputPassToDBPass("123456", user.getSalt()));
users.add(user);
}
//insert database
insertDB(users);
//generate tokens
generateTokens(users);
}
public static void generateTokens(List<SaleUser> users) throws Exception{
String urlString = "http://localhost:8080/login/do_login";
File file = new File("tokens.txt");
if(file.exists()) {
file.delete();
}
RandomAccessFile raf = new RandomAccessFile(file, "rw");
file.createNewFile();
raf.seek(0);
for(int i=0;i<users.size();i++) {
SaleUser user = users.get(i);
URL url = new URL(urlString);
HttpURLConnection co = (HttpURLConnection)url.openConnection();
co.setRequestMethod("POST");
co.setDoOutput(true);
OutputStream out = co.getOutputStream();
String params = "mobile="+user.getId()+"&password="+MD5Util.inputPassFormPass("123456");
out.write(params.getBytes());
out.flush();
InputStream inputStream = co.getInputStream();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
byte buff[] = new byte[1024];
int len = 0;
while((len = inputStream.read(buff)) >= 0) {
bout.write(buff, 0 ,len);
}
inputStream.close();
bout.close();
String response = new String(bout.toByteArray());
JSONObject jo = JSON.parseObject(response);
String token = jo.getString("data");
System.out.println("create token : " + user.getId());
String row = user.getId()+","+token;
raf.seek(raf.length());
raf.write(row.getBytes());
raf.write("\r\n".getBytes());
System.out.println("write to file : " + user.getId());
}
raf.close();
System.out.println("over");
}
public static void main(String[] args)throws Exception {
createUser(5000);
}
}
| [
"[email protected]"
]
| |
bbce95238cf7a7aacf18410c967a67b538767add | 426040f19e4ab0abb5977e8557451cfd94bf6c2d | /apks/aldi/src/com/google/android/gms/auth/api/accounttransfer/AccountTransferStatusCodes.java | 5348ad37c0bbe9a274e0c823c893e7e15a66a6e2 | []
| no_license | kmille/android-pwning | 0e340965f4c27dfc9df6ecadddd124448e6cec65 | e82b96d484e618fe8b2c3f8ff663e74f793541b8 | refs/heads/master | 2020-05-09T17:22:54.876992 | 2020-04-06T18:04:16 | 2020-04-06T18:04:16 | 181,300,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,152 | java | package com.google.android.gms.auth.api.accounttransfer;
import com.google.android.gms.common.api.CommonStatusCodes;
public final class AccountTransferStatusCodes
extends CommonStatusCodes
{
public static final int CHALLENGE_NOT_ALLOWED = 20503;
public static final int INVALID_REQUEST = 20502;
public static final int NOT_ALLOWED_SECURITY = 20500;
public static final int NO_DATA_AVAILABLE = 20501;
public static final int SESSION_INACTIVE = 20504;
public static String getStatusCodeString(int paramInt)
{
switch (paramInt)
{
default:
return CommonStatusCodes.getStatusCodeString(paramInt);
case 20504:
return "SESSION_INACTIVE";
case 20503:
return "CHALLENGE_NOT_ALLOWED";
case 20502:
return "INVALID_REQUEST";
case 20501:
return "NO_DATA_AVAILABLE";
}
return "NOT_ALLOWED_SECURITY";
}
}
/* Location: /home/kmille/projects/android-pwning/apks/aldi/ALDI TALK_v6.2.1_apkpure.com-dex2jar.jar!/com/google/android/gms/auth/api/accounttransfer/AccountTransferStatusCodes.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
]
| |
7721c0e1d3807a93d3e9eda478ac81b828a459be | ee0f69719a194455445e7ca227362962fa8f9196 | /src/main/java/net/mcreator/morethingsmod/MCreatorCobaltFragment.java | a01463f02439fcd063e02e993f7818cacc2e1c58 | []
| no_license | exe76600/Mcreator | 0539bfc4b153ed32a5f2d16d8668787503c8fc05 | 48c8981b4d51a1b5ce18cd69625a6f194158a71f | refs/heads/master | 2021-01-14T05:44:30.703488 | 2020-02-24T00:48:15 | 2020-02-24T00:48:15 | 242,616,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,694 | java | package net.mcreator.morethingsmod;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Item;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.block.state.IBlockState;
@Elementsmorethingsmod.ModElement.Tag
public class MCreatorCobaltFragment extends Elementsmorethingsmod.ModElement {
@GameRegistry.ObjectHolder("morethingsmod:cobaltfragment")
public static final Item block = null;
public MCreatorCobaltFragment(Elementsmorethingsmod instance) {
super(instance, 195);
}
@Override
public void initElements() {
elements.items.add(() -> new ItemCustom());
}
@SideOnly(Side.CLIENT)
@Override
public void registerModels(ModelRegistryEvent event) {
ModelLoader.setCustomModelResourceLocation(block, 0, new ModelResourceLocation("morethingsmod:cobaltfragment", "inventory"));
}
public static class ItemCustom extends Item {
public ItemCustom() {
setMaxDamage(0);
maxStackSize = 64;
setUnlocalizedName("cobaltfragment");
setRegistryName("cobaltfragment");
setCreativeTab(MCreatorMoreThingsMod.tab);
}
@Override
public int getItemEnchantability() {
return 0;
}
@Override
public int getMaxItemUseDuration(ItemStack itemstack) {
return 0;
}
@Override
public float getDestroySpeed(ItemStack par1ItemStack, IBlockState par2Block) {
return 1F;
}
}
}
| [
"[email protected]"
]
| |
8f98f04ef69231134a1daa7dad7b725eeedee416 | 5be4947b6ba8409ef65f718bdc3b1a2000a079fe | /dragonLand/src/guiPractice/components/ClickableGraphic.java | e58da8587988e4fdee5da994c56e7e66004b6a68 | []
| no_license | katsemenova/dragonLand | c79d5504449fdac54fcd67917e66632db856f204 | 3728f8fce0880ba46093e7c65a3b692770842fdb | refs/heads/master | 2021-01-11T17:44:23.457559 | 2017-03-17T20:07:35 | 2017-03-17T20:07:35 | 79,831,223 | 0 | 3 | null | 2017-02-07T18:54:31 | 2017-01-23T17:54:33 | Java | UTF-8 | Java | false | false | 987 | java | package guiPractice.components;
public class ClickableGraphic extends Graphic implements Clickable {
private Action action;
public ClickableGraphic(int x, int y, String imageLocation) {
super(x, y, imageLocation);
// TODO Auto-generated constructor stub
}
public ClickableGraphic(int x, int y, int w, int h, String imageLocation) {
super(x, y, w, h, imageLocation);
// TODO Auto-generated constructor stub
}
public void setAction(Action a){
this.action=a;
}
public ClickableGraphic(int x, int y, double scale, String imageLocation) {
super(x, y, scale, imageLocation);
// TODO Auto-generated constructor stub
}
@Override
public boolean isHovered(int x, int y) {
return x>getX()&&y>getY()&&x<getX()+getWidth()&&y<getY()+getHeight();
}
@Override
public void act() {
if(action !=null)
action.act();
}
@Override
public Action getAction() {
// TODO Auto-generated method stub
return action;
}
}
| [
"[email protected]"
]
| |
7a993611f49b42e6f5d593f3d6bb9434b94de36f | 451da5b41aadeaf2032119e3299be04a48653bd7 | /src/main/java/org/test/camunda/springboot/config/servicetask/CalculateInterestService.java | 12e4af882d9c935c6f7f0aabeb1362124eb16d59 | []
| no_license | ZenGuLhe/PourMed | fcd28a669989124e1e1060bc80259d14baa2fe8b | 44f5f0e380bacfb5f4f27c4d0b76d1162048767b | refs/heads/master | 2020-12-02T17:52:22.251898 | 2017-07-06T14:35:56 | 2017-07-06T15:28:16 | 96,442,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 672 | java | package org.test.camunda.springboot.config.servicetask;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class CalculateInterestService implements JavaDelegate {
private static final Logger LOGGER = LoggerFactory.getLogger(CalculateInterestService.class);
public void execute(DelegateExecution delegate) throws Exception {
String taskName = delegate.getCurrentActivityName();
LOGGER.info("Calculate Interest Service, from task name ::: " + taskName);
}
}
| [
"[email protected]"
]
| |
0cd127ccd10f8ffff0580d9930d2063d2b89f664 | e340e6c4a1742a99975b15dc8a443d8afad09020 | /nd4j-api/src/test/java/org/nd4j/linalg/indexing/conditions/TestAll.java | 8da2434aee1dc0641f39eb4b7cf8f700aa74aeb2 | [
"Apache-2.0"
]
| permissive | ameyp1992/nd4j | 1f13ccdbcd6648e84fee0ada888e797dda2dbc4b | 165147e19e6dbee52d08ddb8a3f3c00b17e484bf | refs/heads/master | 2020-11-30T12:31:24.264678 | 2015-03-08T01:55:41 | 2015-03-08T01:55:41 | 31,827,018 | 0 | 0 | null | 2015-03-07T20:51:07 | 2015-03-07T20:51:07 | null | UTF-8 | Java | false | false | 1,085 | java | package org.nd4j.linalg.indexing.conditions;
import org.junit.runner.JUnitCore;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
* The class <code>TestAll</code> builds a suite that can be used to run all
* of the tests within its package as well as within any subpackages of its
* package.
*
* @generatedBy CodePro at 3/7/15 7:14 PM
* @author saurabh
* @version $Revision: 1.0 $
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
EpsilonEqualsTest.class,
GreaterThanTest.class,
IsInfiniteTest.class,
AndTest.class,
OrTest.class,
ConditionTest.class,
EqualsConditionTest.class,
GreaterThanOrEqualTest.class,
IsNaNTest.class,
BaseConditionTest.class,
ConditionBuilderTest.class,
NotTest.class,
ConditionsTest.class,
LessThanTest.class,
ConditionEqualsTest.class,
LessThanOrEqualTest.class,
})
public class TestAll {
/**
* Launch the test.
*
* @param args the command line arguments
*
* @generatedBy CodePro at 3/7/15 7:14 PM
*/
public static void main(String[] args) {
JUnitCore.runClasses(new Class[] { TestAll.class });
}
}
| [
"[email protected]"
]
| |
fca78c82d11d5c3080c0280356a913a5a092f202 | b395027c029081f9d5ce3cc8f9116263eeca9373 | /battlematrix2/engine/src/main/java/za/co/entelect/competition/ai/decision/behavior/InFireLine.java | 6f5753a5e8798b18d0658e72156f9c577db0cacb | []
| no_license | leonardseymore/entelect_2013 | 81fd55a33a6aeb7bb47028ecd0072b9bf8f98e36 | 843b4689e3f22de1a8e465a0b19f603ccdcada1f | refs/heads/master | 2021-01-17T08:48:54.264779 | 2013-08-04T18:54:19 | 2013-08-04T18:54:19 | 60,601,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,228 | java | package za.co.entelect.competition.ai.decision.behavior;
import za.co.entelect.competition.Constants;
import za.co.entelect.competition.RayCast;
import za.co.entelect.competition.Util;
import za.co.entelect.competition.ai.blackboard.Blackboard;
import za.co.entelect.competition.domain.Bullet;
import za.co.entelect.competition.domain.Direction;
import za.co.entelect.competition.domain.GameState;
import za.co.entelect.competition.domain.Tank;
import java.util.ArrayList;
import java.util.Collection;
public class InFireLine extends Task {
public boolean run(GameState gameState, Tank tank) {
Collection<Bullet> bullets = new ArrayList<>();
for (Bullet bullet : gameState.getBullets().values()) {
Direction direction = bullet.getDirection();
int x = bullet.getX();
int y = bullet.getY();
if (RayCast.castRay(gameState, new RayCast.RayCaseTestTarget(tank), direction, x, y, Constants.FIRE_RANGE)) {
bullets.add(bullet);
}
}
Blackboard blackboard = tank.getBlackboard();
blackboard.setThreatBullets(bullets);
if (bullets.size() > 0) {
return true;
}
return false;
}
@Override
protected String getLabel() {
return "InFireLine?";
}
}
| [
"[email protected]"
]
| |
91ea3db8dc147aee04c2c442772db8cfcd6dbd4b | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-11/u-11-111/u-11-111-f6124.java | ee218136fda407f79bae10225b9071c48b9bfdca | []
| no_license | apertureatf/perftest | f6c6e69efad59265197f43af5072aa7af8393a34 | 584257a0c1ada22e5486052c11395858a87b20d5 | refs/heads/master | 2020-06-07T17:52:51.172890 | 2019-06-21T18:53:01 | 2019-06-21T18:53:01 | 193,039,805 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 106 | java | mastercard 5555555555554444 4012888888881881 4222222222222 378282246310005 6011111111111117
8033934477101 | [
"[email protected]"
]
| |
88cf211a4daef7031b0a266ca8f835429206bb62 | 4d681d9157f3f723be2ac47cd762204fe9e13d9a | /src/pointofsalesystem/PaymentDetails.java | cc980f66777bd3cd596dd1e3fb91dfe8fbaeb3eb | []
| no_license | ManmAgarwal/PointOfSaleSystem | 8b8d7f0a89516698e3ba1ad6b8af57e9b7d92f8e | 97dd882543283d4e6c2a97523f5f02d3bdd06d3e | refs/heads/master | 2022-11-24T23:54:17.427778 | 2020-08-01T19:09:23 | 2020-08-01T19:09:23 | 284,322,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,199 | 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 pointofsalesystem;
/**
*
* @author Manmath
*/
class PaymentDetails {
private int receiptNumber;
private OrderDetails orderDetails;
private String paymentMode;
private OrderInterface orderInterface;
public PaymentDetails(int receiptNumber, OrderDetails orderDetails, String paymentMode)
{
this.receiptNumber = receiptNumber;
this.orderDetails = orderDetails;
this.paymentMode = paymentMode;
}
public int getReceiptNumber(){
return this.receiptNumber;
}
public void setReceiptNumber(int receiptNumber){
this.receiptNumber = receiptNumber;
}
public OrderDetails getOrderDetails(){
return this.orderDetails;
}
public String getPaymentMode(){
return this.paymentMode;
}
public void setPaymentMode (String paymentMode){
this.paymentMode = paymentMode;
}
@Override
public String toString(){
return receiptNumber + " " + paymentMode;
}
}
| [
"[email protected]"
]
| |
898b177c772619f4dda53f96828f19c6fd78012b | 4bbfa242353fe0485fb2a1f75fdd749c7ee05adc | /ims-core/framework/com/ailk/openbilling/persistence/acct/entity/CaNotifyExempt.java | df4fee00b355b5ee2d3e6598bb8bc8b66019c304 | []
| no_license | 859162000/infosystem | 88b23a5b386600503ec49b14f3b4da4df7a6d091 | 96d4d50cd9964e713bb95520d6eeb7e4aa32c930 | refs/heads/master | 2021-01-20T04:39:24.383807 | 2017-04-01T10:59:24 | 2017-04-01T10:59:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,290 | java | package com.ailk.openbilling.persistence.acct.entity;
import javax.persistence.Table;
import jef.database.DataObject;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.builder.HashCodeBuilder;
import java.util.Date;
import jef.codegen.support.NotModified;
/**
* This class was generated by EasyFrame according to the table in database.
* You need to modify the type of primary key field, to the strategy your own.
*
*/
@NotModified
@Entity
@Table(schema="AD",name="CA_NOTIFY_EXEMPT")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder={"objectType","objectId","exemptionType","recType","exempChannelId","validDate","expireDate","staffId","createDate","soDate","billingType","soNbr","officePhone"})
public class CaNotifyExempt extends DataObject{
@Column(name="OBJECT_TYPE",precision=8,columnDefinition="NUMBER")
@XmlElement(name="objectType")
private Integer objectType;
@Id
@Column(name="OBJECT_ID",precision=8,columnDefinition="NUMBER")
@XmlElement(name="objectId")
private Long objectId;
@Id
@Column(name="EXEMPTION_TYPE",precision=8,columnDefinition="NUMBER")
@XmlElement(name="exemptionType")
private Integer exemptionType;
@Column(name="REC_TYPE",precision=8,columnDefinition="NUMBER")
@XmlElement(name="recType")
private Integer recType;
@Column(name="EXEMP_CHANNEL_ID",precision=8,columnDefinition="NUMBER")
@XmlElement(name="exempChannelId")
private Integer exempChannelId;
@Id
@Column(name="VALID_DATE",columnDefinition="TimeStamp")
@XmlElement(name="validDate")
private Date validDate;
@Column(name="EXPIRE_DATE",columnDefinition="TimeStamp")
@XmlElement(name="expireDate")
private Date expireDate;
@Column(name="STAFF_ID",precision=8,columnDefinition="NUMBER")
@XmlElement(name="staffId")
private Long staffId;
@Column(name="CREATE_DATE",columnDefinition="TimeStamp")
@XmlElement(name="createDate")
private Date createDate;
@Column(name="SO_DATE",columnDefinition="TimeStamp")
@XmlElement(name="soDate")
private Date soDate;
@Column(name="BILLING_TYPE",precision=8,columnDefinition="NUMBER")
@XmlElement(name="billingType")
private Integer billingType;
@Id
@Column(name="SO_NBR",precision=8,columnDefinition="NUMBER")
@XmlElement(name="soNbr")
private Long soNbr;
@Column(name="OFFICE_PHONE",columnDefinition="Varchar",length=28)
@XmlElement(name="officePhone")
private String officePhone;
public void setObjectType(Integer obj){
this.objectType = obj;
}
public Integer getObjectType(){
return objectType;
}
public void setObjectId(Long obj){
this.objectId = obj;
}
public Long getObjectId(){
return objectId;
}
public void setExemptionType(Integer obj){
this.exemptionType = obj;
}
public Integer getExemptionType(){
return exemptionType;
}
public void setRecType(Integer obj){
this.recType = obj;
}
public Integer getRecType(){
return recType;
}
public void setExempChannelId(Integer obj){
this.exempChannelId = obj;
}
public Integer getExempChannelId(){
return exempChannelId;
}
public void setValidDate(Date obj){
this.validDate = obj;
}
public Date getValidDate(){
return validDate;
}
public void setExpireDate(Date obj){
this.expireDate = obj;
}
public Date getExpireDate(){
return expireDate;
}
public void setStaffId(Long obj){
this.staffId = obj;
}
public Long getStaffId(){
return staffId;
}
public void setCreateDate(Date obj){
this.createDate = obj;
}
public Date getCreateDate(){
return createDate;
}
public void setSoDate(Date obj){
this.soDate = obj;
}
public Date getSoDate(){
return soDate;
}
public void setBillingType(Integer obj){
this.billingType = obj;
}
public Integer getBillingType(){
return billingType;
}
public void setSoNbr(Long obj){
this.soNbr = obj;
}
public Long getSoNbr(){
return soNbr;
}
public void setOfficePhone(String obj){
this.officePhone = obj;
}
public String getOfficePhone(){
return officePhone;
}
public CaNotifyExempt(){
}
public CaNotifyExempt(Long objectId,Integer exemptionType,Date validDate,Long soNbr){
this.objectId = objectId;
this.exemptionType = exemptionType;
this.validDate = validDate;
this.soNbr = soNbr;
}
public boolean equals(final Object rhs0){
if (rhs0 == null)return false;
CaNotifyExempt rhs=(CaNotifyExempt)rhs0;
if(!ObjectUtils.equals(objectId, rhs.objectId)) return false;
if(!ObjectUtils.equals(validDate, rhs.validDate)) return false;
if(!ObjectUtils.equals(soNbr, rhs.soNbr)) return false;
if(!ObjectUtils.equals(exemptionType, rhs.exemptionType)) return false;
return super.isEquals(rhs);
}
public int hashCode(){
return new HashCodeBuilder()
.append(objectId)
.append(validDate)
.append(soNbr)
.append(exemptionType)
.append(super.getHashCode())
.toHashCode();
}
public enum Field implements jef.database.Field{objectType,objectId,exemptionType,recType,exempChannelId,validDate,expireDate,staffId,createDate,soDate,billingType,soNbr,officePhone}
} | [
"[email protected]"
]
| |
afe8265626f452d91aab321213a0a589bc933e13 | 7058d199cb93a5fe999b1fe483aef595a0e81d02 | /EatYourBeetSVG/src/main/java/eatyourbeets/cards/animator/Konayuki.java | c5ecdbb1fd5d3dba2bb993bfc6d47b25dabdbeb8 | [
"Apache-2.0"
]
| permissive | CICSilver/STS-AnimatorMod | 7ddd0334f78eec086af35d90b5159f5e64cbff99 | aa1ff6598d0597f937ced1cba96f01f94c33645e | refs/heads/master | 2020-04-22T04:23:38.311418 | 2019-02-14T05:45:51 | 2019-02-14T05:45:51 | 170,122,262 | 0 | 0 | Apache-2.0 | 2019-02-11T12:06:52 | 2019-02-11T12:06:49 | null | UTF-8 | Java | false | false | 2,959 | java | package eatyourbeets.cards.animator;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.actions.common.DamageAction;
import com.megacrit.cardcrawl.cards.DamageInfo;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.AbstractCreature;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import com.megacrit.cardcrawl.powers.AbstractPower;
import com.megacrit.cardcrawl.powers.StrengthPower;
import eatyourbeets.Utilities;
import eatyourbeets.cards.AnimatorCard;
import eatyourbeets.cards.Synergies;
import eatyourbeets.powers.PlayerStatistics;
import eatyourbeets.subscribers.OnApplyPowerSubscriber;
import eatyourbeets.subscribers.OnBattleStartSubscriber;
public class Konayuki extends AnimatorCard implements OnBattleStartSubscriber, OnApplyPowerSubscriber
{
public static final String ID = CreateFullID(Konayuki.class.getSimpleName());
public Konayuki()
{
super(ID, 2, CardType.ATTACK, CardRarity.COMMON, CardTarget.SELF);
Initialize(30,0, 2);
if (PlayerStatistics.InBattle())
{
OnBattleStart();
}
SetSynergy(Synergies.Katanagatari);
}
@Override
public void use(AbstractPlayer p, AbstractMonster m)
{
if (CurrentStrength() >= 10)
{
AbstractDungeon.actionManager.addToBottom(new DamageAction(m, new DamageInfo(p, this.damage, this.damageTypeForTurn), AbstractGameAction.AttackEffect.BLUNT_HEAVY));
}
else
{
AbstractDungeon.actionManager.addToTop(new ApplyPowerAction(p, p, new StrengthPower(p, this.magicNumber), this.magicNumber));
}
}
@Override
public void upgrade()
{
if (TryUpgrade())
{
upgradeDamage(3);
upgradeMagicNumber(1);
}
}
@Override
public void OnApplyPower(AbstractPower power, AbstractCreature target, AbstractCreature source)
{
if (target.isPlayer && power.ID.equals(StrengthPower.POWER_ID))
{
if ((CurrentStrength() + power.amount) >= 10)
{
this.target = CardTarget.ENEMY;
}
else
{
this.target = CardTarget.SELF;
}
}
}
@Override
public void OnBattleStart()
{
PlayerStatistics.onApplyPower.Subscribe(this);
if (CurrentStrength() >= 10)
{
this.target = CardTarget.ENEMY;
}
else
{
this.target = CardTarget.SELF;
}
}
private int CurrentStrength()
{
StrengthPower strength = Utilities.SafeCast(AbstractDungeon.player.getPower(StrengthPower.POWER_ID), StrengthPower.class);
return (strength != null ? strength.amount : 0);
}
} | [
"[email protected]"
]
| |
302cef3a33a48651019af7da263ce1d11fd8018e | 400211f8ba8ee352ce4a63a8c0a768ecf46aca65 | /src/dao/cn/com/atnc/ioms/dao/maintain/pollinginfo/hibernate/KuNodeParameterDaoImpl.java | 324512b4bc9e3b69dbf91c4eb2a1e840b3fce4c7 | []
| no_license | jyf666/IOMS | 76003040489dc8f594c88ff35c07bd77d1447da4 | 6d3c8428c06298bee8d1f056aab7b21d81fd4ce2 | refs/heads/master | 2021-05-10T18:38:37.276724 | 2018-01-19T14:50:34 | 2018-01-19T14:50:34 | 118,130,382 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,680 | java | /**
* @ProjectName IOMS
* @FileName KuNodeParameterDaoImpl.java
* @PackageName:cn.com.atnc.ioms.dao.operstat.ku.hibernate
* @author KuYonggang
* @date 2015年4月1日下午1:25:23
* @since 1.0.0
* @Copyright (c) 2015,ATNC ###@atnc.com All Rights Reserved.
*/
package cn.com.atnc.ioms.dao.maintain.pollinginfo.hibernate;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;
import cn.com.atnc.common.entity.Pagination;
import cn.com.atnc.ioms.dao.MyBaseDao;
import cn.com.atnc.ioms.entity.maintain.pollinginfo.KuNodeParameter;
import cn.com.atnc.ioms.model.maintain.pollinginfo.PollingInfoQueryModel;
import cn.com.atnc.ioms.dao.maintain.pollinginfo.IKuNodeParameterDao;
/**
*
* @author KuYonggang
* @date 2015年4月1日 下午1:25:23
* @since 1.0.0
*/
@Repository
public class KuNodeParameterDaoImpl extends MyBaseDao<KuNodeParameter> implements IKuNodeParameterDao {
@Override
public Pagination queryPage(PollingInfoQueryModel queryModel) {
StringBuilder hql = new StringBuilder("from KuNodeParameter where 1=1");
Map<String, Object> params = new HashMap<String, Object>();
if (queryModel.getBureau() != null) {
hql.append(" and equipId.satelliteSite.bureau =:bureau");
params.put("bureau", queryModel.getBureau());
}
if (StringUtils.isEmpty(queryModel.getStname()) == false) {
hql.append(" and equipId.satelliteSite.siteName like:stname escape '\\' ");
params.put("stname", "%" + queryModel.getStname() + "%");
}
if(queryModel.getStartRecordTime() != null){
hql.append(" and recordTime>=:startRecordTime");
params.put("startRecordTime",queryModel.getStartRecordTime());
}
if(queryModel.getStartRecordTime() != null){
hql.append(" and recordTime<=:endRecordTime");
params.put("endRecordTime",queryModel.getEndRecordTime());
}
hql.append(" order by recordTime desc");
String countHql = COUNT_ID + hql.toString();
return super.pageQuery(hql.toString(), params, countHql,
queryModel.getPageNo(), queryModel.getPageSize());
}
@Override
public Pagination queryViewPage(PollingInfoQueryModel queryModel) {
StringBuilder hql = new StringBuilder("from KuNodeParameter where 1=1");
Map<String, Object> params = new HashMap<String, Object>();
if (queryModel.getKuNodeParameter() != null) { //id
hql.append(" and id =:id");
params.put("id", queryModel.getKuNodeParameter().getId());
}
String countHql = COUNT_ID + hql.toString();
return super.pageQuery(hql.toString(), params, countHql,
queryModel.getPageNo(), queryModel.getPageSize());
}
}
| [
"[email protected]"
]
| |
e769cdb9438acfdc2e1e313a8c3b437002a6c09a | ff2d36f1b58c4d663ecd25fbbf1ae30ad48a35d9 | /LargestNumber.java | f3c5ba452d5849d6423a90b3a8d02ed53bf28483 | []
| no_license | JayBajpai/Javarepodemo | 00c42a490982810e67205f4ab4438e3b9367c5d6 | 1b1aead6a293eb2aaf10c672757e4181713cf897 | refs/heads/main | 2023-06-25T14:17:23.336270 | 2021-07-30T04:54:14 | 2021-07-30T04:54:14 | 388,086,326 | 0 | 0 | null | 2021-07-30T04:54:14 | 2021-07-21T10:53:36 | Java | UTF-8 | Java | false | false | 776 | java | import java.util.Scanner;
public class LargestNumber
{
public static void main(String[] args)
{
int a, b, c, largest, temp;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the first number:");
a = sc.nextInt();
System.out.println("Enter the second number:");
b = sc.nextInt();
System.out.println("Enter the third number:");
c = sc.nextInt();
//variable = (expression) ? expressionIsTrue : expressionIsFalse;
//expression is the expression the operator should evaluate
//expressionIsTrue is the value assigned to variable if the expression is true
//expressionIsFalse is the value assigned to variable if the expression is false
temp=a>b?a:b;
largest=c>temp?c:temp;
System.out.println("The largest number is: "+largest);
}
} | [
"Jay22031999"
]
| Jay22031999 |
3d9d57de12dc94c6d4361f638913c78c3c519e97 | b8bc2a71f0cb19a8f0693f3bbc3e527469f845be | /src/main/java/com/xtel/examthread/Bai6a/RandomNumber.java | aebab2480a853cf0df87940cf0beaed0aac35d0e | []
| no_license | buivantuan1998/BaiTapVeMultiThreading | 76ed39aea8085f0e97f52431e422e04a5fab4f23 | 4f4e5ff1894c431ddc5694dd0e75a9ed8fbf1983 | refs/heads/master | 2022-12-19T20:06:42.129666 | 2020-10-10T03:11:45 | 2020-10-10T03:11:45 | 302,803,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | /**
*
*/
package com.xtel.examthread.Bai6a;
import org.apache.log4j.Logger;
/**
* @author TUAN
*
*/
public class RandomNumber {
Logger logger = Logger.getLogger(RandomNumber.class);
int randomNumberInteger = 0;
public RandomNumber() {
}
}
| [
"[email protected]"
]
| |
e75bc8ea017dd76e4d7e2a1f9fd5cc0b4d22eaec | bb2175e01992b6c0e01f52f0c2c7bd0aff3e2197 | /ehealth-webgui/ehealth-modaclouds-gui/src/eu/ehealth/security/ClientePasswordCallback.java | eff7489cde79d098a9a6015f5e37e0adad6e03a6 | [
"Apache-2.0"
]
| permissive | modaclouds-atos/ehealth-app-final-prototype | 329dc770b231ff2e295223193bad697dc380fea5 | e6453f07fe612450f653112c28afb8d6f36514ac | refs/heads/master | 2021-01-10T06:43:43.571173 | 2015-11-03T10:52:10 | 2015-11-03T10:52:10 | 43,057,417 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,935 | java | package eu.ehealth.security;
import java.io.IOException;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;
//import org.apache.wss4j.common.ext.WSPasswordCallback;
//import org.apache.ws.security.WSPasswordCallback;
import eu.ehealth.SystemDictionary;
/**
*
* @author a572832
*
*/
public class ClientePasswordCallback //implements CallbackHandler
{
/**
* KEYSTORE HANDLER
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException
{
SystemDictionary.webguiLog("DEBUG", "_______________________________________");
SystemDictionary.webguiLog("DEBUG", "WebGUI ... ClientePasswordCallback ...");
for (int i = 0; i < callbacks.length; i++) {
WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
String id = pwcb.getIdentifier();
int usage = pwcb.getUsage();
if (usage == WSPasswordCallback.DECRYPT)
SystemDictionary.webguiLog("DEBUG", "WebGUI ... DECRYPT...............");
else if (usage == WSPasswordCallback.SIGNATURE)
SystemDictionary.webguiLog("DEBUG", "WebGUI ... SIGNATURE.............");
else
SystemDictionary.webguiLog("DEBUG", "WebGUI ... TYPE : " + usage + "...........");
// DEBUG
SystemDictionary.webguiLog("DEBUG", "Services ... id : " + id);
if (usage == WSPasswordCallback.DECRYPT || usage == WSPasswordCallback.SIGNATURE) {
if ("myclientkey".equals(id.toLowerCase()))
{
pwcb.setPassword("ckpass");
}
else
{
SystemDictionary.webguiLog("WARN", "WebGUI ... ERROR - set password error -");
}
}
}
}*/
}
| [
"[email protected]"
]
| |
8ff4d14bcb25b6a4be04b8a9d73d70bdac7f2c79 | c787ca6cfc5ccb38a336bc4373d2ee636edf51fc | /src/main/java/net/imglib2/img/basictypeaccess/volatiles/VolatileShortAccess.java | e0d946deedd15c057a7b44e8a9cf62681db11d63 | [
"BSD-2-Clause"
]
| permissive | maxkleinhenz/bigdataviewer-core | 1789f47ea9807ad64dab2c6f7c622251216ab5c2 | 9a489758aeded17b3e2358d52b8e433eb392ee09 | refs/heads/master | 2021-01-11T07:00:19.606584 | 2017-04-23T12:46:49 | 2017-04-23T12:46:49 | 72,344,186 | 0 | 0 | null | 2016-10-30T11:01:48 | 2016-10-30T11:01:48 | null | UTF-8 | Java | false | false | 1,812 | java | /*
* #%L
* BigDataViewer core classes with minimal dependencies
* %%
* Copyright (C) 2012 - 2016 Tobias Pietzsch, Stephan Saalfeld, Stephan Preibisch,
* Jean-Yves Tinevez, HongKee Moon, Johannes Schindelin, Curtis Rueden, John Bogovic
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package net.imglib2.img.basictypeaccess.volatiles;
import net.imglib2.img.basictypeaccess.ShortAccess;
/**
* @author Tobias Pietzsch <[email protected]>
*/
public interface VolatileShortAccess extends ShortAccess, VolatileAccess
{}
| [
"[email protected]"
]
| |
49eda14a8e355b8bc87762bdac57af466a8347e9 | 3c49f0766779f1c4b5865b0a70f82ab790d9866a | /01trunk/xwoa/src/main/java/com/centit/oa/action/AddressbooksAction.java | e2cb5cbf7bdfc8af4b46acb13e03351def2846d8 | []
| no_license | laoqianlaile/xwoa | bfa9e64ca01e9333efbc5602b41c1816f1fa746e | fe8a618ff9c0ddfcb8b51bc9d6786e2658b62fa1 | refs/heads/master | 2022-01-09T23:27:17.273124 | 2019-05-21T08:35:34 | 2019-05-21T08:35:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,112 | java | package com.centit.oa.action;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONArray;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.extremecomponents.table.limit.Limit;
import org.springframework.util.StringUtils;
import com.centit.core.action.BaseEntityDwzAction;
import com.centit.core.dao.CodeBook;
import com.centit.core.utils.ExtremeTableUtils;
import com.centit.core.utils.PageDesc;
import com.centit.oa.po.AddressBookRelection;
import com.centit.oa.po.Addressbooks;
import com.centit.oa.service.AddressbooksManager;
import com.centit.oa.service.OaPowerrolergroupManager;
import com.centit.support.utils.ExportExcelUtil;
import com.centit.sys.po.FUnitinfo;
import com.centit.sys.po.FUserinfo;
import com.centit.sys.service.CodeRepositoryUtil;
import com.centit.sys.service.SysUnitManager;
import com.opensymphony.xwork2.ActionContext;
public class AddressbooksAction extends BaseEntityDwzAction<Addressbooks> {
private static final Log log = LogFactory.getLog(AddressbooksAction.class);
// private static final ISysOptLog sysOptLog =
// SysOptLogFactoryImpl.getSysOptLog("optid");
private static final long serialVersionUID = 1L;
private AddressbooksManager addressbooksMag;
private OaPowerrolergroupManager oaPowerrolergroupManager;
private String selectedUserCode;// 弹出页面选中
List<FUnitinfo> units;
List<FUserinfo> users;
private String bodycode;
private String s_type;
private Addressbooks addressbooks;
private SysUnitManager sysUnitManager;
public void setSysUnitManager(SysUnitManager sysUnitManager) {
this.sysUnitManager = sysUnitManager;
}
public void setAddressbooksManager(AddressbooksManager basemgr) {
addressbooksMag = basemgr;
this.setBaseEntityManager(addressbooksMag);
}
private List<AddressBookRelection> addressBookRelections;
public List<AddressBookRelection> getNewAddressBookRelections() {
return this.addressBookRelections;
}
public void setNewAddressBookRelections(
List<AddressBookRelection> addressBookRelections) {
this.addressBookRelections = addressBookRelections;
}
/**
* 通讯录列表
*
* @return
*/
@SuppressWarnings("unchecked")
public String list() {
try {
Map<Object, Object> paramMap = request.getParameterMap();
resetPageParam(paramMap);
Limit limit = ExtremeTableUtils.getLimit(request);
String orderField = request.getParameter("orderField");
String orderDirection = request.getParameter("orderDirection");
Map<String, Object> filterMap = convertSearchColumn(paramMap);
if (StringUtils.hasText(orderField)
&& StringUtils.hasText(orderDirection)) {
filterMap.put(CodeBook.SELF_ORDER_BY, orderField + " "
+ orderDirection);
}
//获取类型
object.setType(s_type);
PageDesc pageDesc = ExtremeTableUtils.makePageDesc(limit);
// creater为当前登录人员
// filterMap.put("creater",getLoginUserCode());
objList = addressbooksMag.listObjects(filterMap, pageDesc,
getLoginUserCode());
totalRows = pageDesc.getTotalRows();
setbackSearchColumn(filterMap);
this.pageDesc = pageDesc;
//return object.getType()+"List";
return object.getType()+"ListV2";
} catch (Exception e) {
e.printStackTrace();
return ERROR;
}
}
/**
* 通讯录列表_new 包含机关,公共,个人
*
* @return
*/
public String list_new() {
//返回一个lab页面组装这3类通讯
return "lab";
}
public String save() {
// add新增
if (!StringUtils.hasText(object.getAddrbookid())) {
object.setCreater(getLoginUserCode());
object.setCreatedate(new Date());
object.setAddrbookid(addressbooksMag.genNextAddressbookId());
}
Addressbooks dbObject = baseEntityManager.getObject(object);
if (dbObject != null) {
baseEntityManager.copyObjectNotNullProperty(dbObject, object);
object = dbObject;
}
addressbooksMag.saveObject(object);
if("P".equals(object.getType())){
return list();
}else{
return oaList();
}
}
public String saveTree(){
Addressbooks dbObject = addressbooksMag.getObjectByCode(
object.getUnitcode(), object.getType());
if (dbObject != null) {
// add新增
if (!StringUtils.hasText(dbObject.getAddrbookid())) {
object.setCreater(getLoginUserCode());
object.setCreatedate(new Date());
object.setAddrbookid(addressbooksMag.genNextAddressbookId());
}
baseEntityManager.copyObjectNotNullProperty(dbObject, object);
object = dbObject;
}
baseEntityManager.saveObject(object);
return oaView();
}
@Override
public String delete() {
Addressbooks dbObj = addressbooksMag.getObject(object);
super.delete();
if(null != dbObj && "P".equals(dbObj.getType())){
return list();
}else{
return oaList();
}
}
/**
* 批量删除功能
* @return
*/
public String deleteAdds() {
//批量addrbookid
String addrbookids = request.getParameter("addrbookids");
if (StringUtils.hasText(addrbookids)) {
for (String msgcode : addrbookids.split(",")) {
object.setAddrbookid(msgcode);
super.delete();
}
}
if("P".equals(object.getType())){
return list();
}else{
return oaList();
}
}
@Override
public String edit() {
Addressbooks o = baseEntityManager.getObject(object);
if (o != null) {
// 将对象o copy给object,object自己的属性会保留
baseEntityManager.copyObject(object, o);
request.setAttribute("usercodes",
getShareUsercodes(object.getAddrbookid()));
} else {
String type=object.getType();
baseEntityManager.clearObjectProperties(object);
//设置隐藏值
object.setType(type);
}
//当前登录人员主部门
// String unitcode=CodeRepositoryUtil.getPrimaryUnit(getLoginUserCode());
//默认为选着树形节点作为unitcode
if("C".equals(object.getType())&&!StringUtils.hasText(object.getUnitcode())){
object.setUnitcode(bodycode);
object.setDeptName(CodeRepositoryUtil.getValue("unitcode", bodycode));
putAllUserTree();
//不同类型的通讯录备选信息不一样机构为所有机构下拉框,人员为所有人员信息
units = CodeRepositoryUtil.getAllUnits("T");
users = CodeRepositoryUtil.getAllUsers("T");
}
//根据通讯录类型确定返回页面
return object.getType()+"Form";
}
public String oaEdit() {
try {
putUnitTree();
if (object != null) {
//根据部门编号,通讯录类型获取信息
object.setUnitcode(bodycode);
Addressbooks o = addressbooksMag.getObjectByCode(
object.getUnitcode(), object.getType());
if (o != null && o.getAddrbookid() != null) {
// 将对象o copy给object,object自己的属性会保留
baseEntityManager.copyObject(object, o);
}
}
return "oaUnitEdit";
} catch (Exception e) {
e.printStackTrace();
return ERROR;
}
}
public String oaView() {
putUnitTree();
String turn = null;
//这边人员和usercode无紧密联系,同时需要显示所在的部门信息
if ("C".equals(object.getType())) {
object.setUserName(bodycode);//username在做机关内人员通讯录是存放usercode字段
Addressbooks o = addressbooksMag.getUserByCode(object.getUserName(),object.getType());
if (o != null && o.getAddrbookid() != null) {
// 将对象o copy给object,object自己的属性会保留
baseEntityManager.copyObject(object, o);
}
addressbooks = addressbooksMag.getObjectByCode(
object.getUnitcode(), "O");
request.setAttribute("addressbooks",addressbooks);
turn = "oaUserView";
} else if ("O".equals(object.getType())) {
//根据部门编号,通讯录类型获取信息
object.setUnitcode(bodycode);
Addressbooks o = addressbooksMag.getObjectByCode(
object.getUnitcode(), object.getType());
if (o != null && o.getAddrbookid() != null) {
// 将对象o copy给object,object自己的属性会保留
baseEntityManager.copyObject(object, o);
}
turn = "oaUnitView";
} else {
turn = "oaUnitView";
}
return turn;
}
/**
* 获取当前部门所有人员 该人员可能不在adderssbooks表中 部门编号bodycode
* @return
*/
@SuppressWarnings("unchecked")
public String oaList(){
// putAllUserTree();
Map<Object, Object> paramMap = request.getParameterMap();
resetPageParam(paramMap);
Map<String, Object> filterMap = convertSearchColumn(paramMap);
PageDesc pageDesc = makePageDesc();
objList=addressbooksMag.addressbooksCList(filterMap, pageDesc,bodycode);
totalRows = pageDesc.getTotalRows();
setbackSearchColumn(filterMap);
Map<String,Object> unitFilter = new HashMap<String, Object>();
unitFilter.put("isvalid", "T");
List<FUnitinfo> units = sysUnitManager.listObjects(unitFilter);
request.setAttribute("allUnits", units);
return "CList";
}
HttpServletResponse response;
public void setResponse(HttpServletResponse response) {
this.response = response;
}
/* @Override
public String exportExcel() {
try {
exportFileName = new String("内部通讯录列表.xls".getBytes("GBK"),
"ISO8859-1");// 将导出Excel的文件名进行ISO8859-1编码,否则中文文件名会乱码
} catch (UnsupportedEncodingException e) {
}
return "exportExcel";
}
public InputStream getExportExcelFile() {
@SuppressWarnings("unchecked")
Map<Object, Object> paramMap = (Map<Object, Object>) request.getParameterMap();
Map<String, Object> filterMap = convertSearchColumn(paramMap);
List<Addressbooks> objectList = addressbooksMag.addressbooksCList(filterMap,bodycode);
// 获取需要生成Excel的数据
if (objectList != null) {
int i = 1;
for (Addressbooks o : objectList) {
o.setNo(String.valueOf(i++)); // 订单编号
}
}
String[] header = { "编号", "姓名","部门","手机", "固定电话"};// 列头
String[] property = { "no", "userName", "deptName","mobilephone","telphone"};// --订单内容
// response.reset();
// response.setContentType("APPLICATION/vnd.ms-excel");
// 注意,如果去掉下面一行代码中的attachment; 那么也会使IE自动打开文件。
// response.setHeader("Content-Disposition", "attachment;filename=" + new String(("通讯录列表.xls").getBytes("GBK"), "ISO8859-1"));
return ExportExcelUtil.generateExcel(objectList, header, property);
}*/
/**
* 导出个人通讯录
* @return
*/
public String exportExcelP() {
try {
exportFileName = new String("个人通讯录列表.xls".getBytes("GBK"),
"ISO8859-1");// 将导出Excel的文件名进行ISO8859-1编码,否则中文文件名会乱码
} catch (UnsupportedEncodingException e) {
}
return "exportExcelP";
}
public InputStream getExportExcelFileP() {
@SuppressWarnings("unchecked")
Map<Object, Object> paramMap = (Map<Object, Object>) request.getParameterMap();
Map<String, Object> filterMap = convertSearchColumn(paramMap);
filterMap.put("creater", getLoginUserCode());//筛选自己个人通讯录的数据
List<Addressbooks> objectList = addressbooksMag.listObjects(filterMap);
// 获取需要生成Excel的数据
if (objectList != null) {
int i = 1;
for (Addressbooks o : objectList) {
o.setNo(String.valueOf(i++)); // 订单编号
}
}
String[] header = { "编号", "姓名","单位","手机", "固定电话"};// 列头
String[] property = { "no", "userName", "unitName","mobilephone","telphone"};// --订单内容
return ExportExcelUtil.generateExcel(objectList, header, property);
}
/**
* 获取部门人员数据
*
* @return
*/
public void putAllUserTree() {
JSONArray ja =oaPowerrolergroupManager.putUnitsUsersTree();
request.setAttribute("unit", ja.toString());
}
/**
* 获取部门数据
*
* @return
*/
public void putUnitTree() {
JSONArray ja =oaPowerrolergroupManager.putUnitsTree();
request.setAttribute("unit", ja.toString());
}
/**
* 获取部门人员数据 树形结构
*
* @return
*/
public void putInnermsgTree() {
List<FUnitinfo> units = CodeRepositoryUtil.getAllUnits("T");
List<Map<String, String>> unit = new ArrayList<Map<String, String>>();
// List<Addressbooks> users=addressbooksMag.addressbooksCList();
for (FUnitinfo unitinfo : units) {
Map<String, String> m = new HashMap<String, String>();
m.put("id", unitinfo.getUnitcode());
m.put("pId",
"0".equals(unitinfo.getParentunit()) ? null : unitinfo
.getParentunit());
m.put("name", unitinfo.getUnitname());
// 一级目录下菜单展开
m.put("open", "0".equals(unitinfo.getParentunit()) ? "true"
: "false");
m.put("p", "O");
m.put("choosetype", "unit");
// if(unitinfo.getParentunit().equalsIgnoreCase("1")){
m.put("icon", "../scripts/inputZtree/img/diy/unit.png");
// }
unit.add(m);
}
// for (Addressbooks userinfo : users) {
// Map<String, String> m = new HashMap<String, String>();
// m.put("id", userinfo.getAddrbookid());
// if (!StringUtils.hasText(userinfo.getUnitcode())) {
// continue;
// }
// m.put("pId", userinfo.getUnitcode());
// m.put("name", userinfo.getUserName());
// m.put("p", "C");
// m.put("choosetype", "user");
// m.put("icon", "../scripts/inputZtree/img/diy/person.png");
// unit.add(m);
// }
JSONArray ja = new JSONArray();
ja.addAll(unit);
ActionContext.getContext().put("unit", ja.toString());
totalRows = unit.size();
}
/*
* 当前登录人员usercode
*/
private String getLoginUserCode() {
return ((FUserinfo) this.getLoginUser()).getUsercode();
}
/*
* 取共享人员
*/
private String getShareUsercodes(String addrbookid) {
List<String> usercodes = addressbooksMag
.listUsercodesByAddressbookId(addrbookid);
return StringUtils.collectionToDelimitedString(usercodes, ",");
}
public String getSelectedUserCode() {
return selectedUserCode;
}
public void setSelectedUserCode(String selectedUserCode) {
this.selectedUserCode = selectedUserCode;
}
public static Log getLog() {
return log;
}
public OaPowerrolergroupManager getOaPowerrolergroupManager() {
return oaPowerrolergroupManager;
}
public void setOaPowerrolergroupManager(OaPowerrolergroupManager oaPowerrolergroupManager) {
this.oaPowerrolergroupManager = oaPowerrolergroupManager;
}
public List<FUnitinfo> getUnits() {
return units;
}
public void setUnits(List<FUnitinfo> units) {
this.units = units;
}
public List<FUserinfo> getUsers() {
return users;
}
public void setUsers(List<FUserinfo> users) {
this.users = users;
}
public String getBodycode() {
return bodycode;
}
public void setBodycode(String bodycode) {
this.bodycode = bodycode;
}
public Addressbooks getAddressbooks() {
return addressbooks;
}
public void setAddressbooks(Addressbooks addressbooks) {
this.addressbooks = addressbooks;
}
public String getS_type() {
return s_type;
}
public void setS_type(String s_type) {
this.s_type = s_type;
}
}
| [
"[email protected]"
]
| |
c80356a8abcc02f6648c34ac8a99317e876f4dcc | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.minihd.qq/assets/exlibs.3.jar/classes.jar/com/tencent/component/network/downloader/handler/ReportHandler$DownloadReportObject.java | 1195ceacb9a3c580d91300528b148f94cc9dbc7d | []
| no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 5,415 | java | package com.tencent.component.network.downloader.handler;
import android.text.TextUtils;
import android.util.Log;
import com.tencent.component.network.module.report.ExtendData;
import com.tencent.component.network.module.report.ReportObj;
import org.json.JSONObject;
public class ReportHandler$DownloadReportObject
extends ReportObj
{
public int a;
public long a;
public String a;
public Throwable a;
public int b;
public long b;
public String b;
public int c;
public long c;
public String c;
public int d;
public long d;
public String d;
public int e;
public long e;
public String e;
public int f;
public long f;
public String f;
public long g;
public ReportHandler$DownloadReportObject()
{
this.jdField_a_of_type_Int = 0;
this.jdField_c_of_type_Int = 1;
this.jdField_d_of_type_Int = 0;
this.jdField_e_of_type_Int = 100;
}
public ReportHandler$DownloadReportObject(String paramString1, String paramString2, int paramInt1, int paramInt2, String paramString3, long paramLong1, long paramLong2, long paramLong3, int paramInt3, String paramString4, ExtendData paramExtendData)
{
super(paramInt1, paramInt2, paramString3, paramLong1, paramLong2, paramLong3, paramInt3, paramString4, paramExtendData);
this.jdField_a_of_type_Int = 0;
this.jdField_c_of_type_Int = 1;
this.jdField_d_of_type_Int = 0;
this.jdField_e_of_type_Int = 100;
this.jdField_a_of_type_JavaLangString = paramString1;
this.jdField_b_of_type_JavaLangString = paramString2;
}
private void b()
{
if ((!TextUtils.isEmpty(this.jdField_a_of_type_JavaLangString)) && (this.jdField_a_of_type_JavaLangString.indexOf("store.qq.com/qun/") >= 0)) {
this.jdField_a_of_type_Int = 10;
}
}
protected String a()
{
if (this.jdField_a_of_type_Int == 10) {
return "mqun";
}
return super.a();
}
public JSONObject a()
{
JSONObject localJSONObject = super.a();
localJSONObject.put("url", this.jdField_a_of_type_JavaLangString);
localJSONObject.put("dnsip", this.jdField_b_of_type_JavaLangString);
localJSONObject.put("retry", this.jdField_b_of_type_Int);
localJSONObject.put("clientip", this.jdField_d_of_type_JavaLangString);
localJSONObject.put("t_wait", this.jdField_b_of_type_Long);
localJSONObject.put("t_prepare", this.jdField_c_of_type_Long);
localJSONObject.put("t_conn", this.jdField_d_of_type_Long);
localJSONObject.put("t_recvrsp", this.jdField_e_of_type_Long);
localJSONObject.put("t_recvdata", this.jdField_f_of_type_Long);
localJSONObject.put("t_process", this.g);
localJSONObject.put("content_type", this.jdField_e_of_type_JavaLangString);
localJSONObject.put("concurrent", this.jdField_f_of_type_Int);
if (this.jdField_f_of_type_JavaLangString != null) {
localJSONObject.put("refer", this.jdField_f_of_type_JavaLangString);
}
if (!TextUtils.isEmpty(this.jdField_c_of_type_JavaLangString))
{
if (this.jdField_a_of_type_ComTencentComponentNetworkModuleReportExtendData == null) {
this.jdField_a_of_type_ComTencentComponentNetworkModuleReportExtendData = new ExtendData();
}
this.jdField_a_of_type_ComTencentComponentNetworkModuleReportExtendData.a(10, this.jdField_c_of_type_JavaLangString);
localJSONObject.put("extend", this.jdField_a_of_type_ComTencentComponentNetworkModuleReportExtendData.a());
}
if (this.jdField_a_of_type_JavaLangThrowable != null)
{
if (this.jdField_a_of_type_ComTencentComponentNetworkModuleReportExtendData == null) {
this.jdField_a_of_type_ComTencentComponentNetworkModuleReportExtendData = new ExtendData();
}
String str2 = Log.getStackTraceString(this.jdField_a_of_type_JavaLangThrowable);
String str1 = str2;
if (!TextUtils.isEmpty(str2)) {
str1 = str2.replaceAll("\n\t", "--");
}
this.jdField_a_of_type_ComTencentComponentNetworkModuleReportExtendData.a(11, str1);
localJSONObject.put("extend", this.jdField_a_of_type_ComTencentComponentNetworkModuleReportExtendData.a());
}
if (this.jdField_c_of_type_Int == 2)
{
localJSONObject.put("orgurl", this.jdField_a_of_type_JavaLangString);
localJSONObject.put("directip", this.k);
localJSONObject.put("contentlen", this.h);
localJSONObject.put("size", this.jdField_d_of_type_Int);
localJSONObject.put("sample", this.jdField_e_of_type_Int);
if ((this.jdField_a_of_type_JavaLangStringBuilder != null) && (this.jdField_a_of_type_JavaLangStringBuilder.length() > 0))
{
if (localJSONObject.has("msg")) {
localJSONObject.remove("msg");
}
localJSONObject.put("errdetail", this.jdField_a_of_type_JavaLangStringBuilder.toString());
}
}
return localJSONObject;
}
public void a(String paramString)
{
this.jdField_a_of_type_JavaLangString = paramString;
b();
}
public boolean a()
{
return this.jdField_b_of_type_Int > 0;
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.minihd.qq\assets\exlibs.3.jar\classes.jar
* Qualified Name: com.tencent.component.network.downloader.handler.ReportHandler.DownloadReportObject
* JD-Core Version: 0.7.0.1
*/ | [
"[email protected]"
]
| |
73dfdc194cba7ec665d6b975882319780c2ce9b1 | beda14e4453477debb56e4ea28f0c6243d4f1cf4 | /src/EjercicioLibro/PruebaLibro.java | 1e5dc3972c307580b1ff5fddd7437ccdda94e6ec | []
| no_license | kjimenezh/Clase050918 | 65030ceb15a3329dbf581c1c223b66a869d22374 | 1b6a57c4b0145803f0bc47541bdc251bae53a882 | refs/heads/master | 2020-03-28T01:43:02.613803 | 2018-09-05T13:53:31 | 2018-09-05T13:53:31 | 147,525,557 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java |
package EjercicioLibro;
public class PruebaLibro {
public static void main(String[] args){
//Relacion de Dependencia
ConjuntoLibro biblioteca=new ConjuntoLibro();
//Dependencia
Autor autor=new Autor ("Gabriel","Garcia");
Libro libro=new Libro("Cien ", 300, 8);
libro.setAutor(autor);
boolean resultado=biblioteca.anadirLibro(libro);
if(resultado==true){
System.out.println("Insercion satisfactoria");
}else{
System.out.println("Problemas para insertar el libro");
}
}
//...
}
| [
"[email protected]"
]
| |
0a7de43b15c01f478914e7beda7bfe3d0f4cb662 | 32f718d5943f9c2d20bb0bf6b3165bc204a3043a | /src/main/Calculator.java | e6ade69f233b854d7d7da98eb14631570e3366d2 | []
| no_license | maxdecken/FunwithCalculators-2 | 504c57d75f0b5351df7b7b360416e6dca72f74e7 | c4038a5268952248bb761d187778a6970beafcff | refs/heads/master | 2023-05-24T01:18:46.691755 | 2021-06-13T16:37:40 | 2021-06-13T16:37:40 | 374,970,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | package main;
import main.ReversePolishNotation.CalcEngineStr;
import main.ReversePolishNotation.UserInterfaceRPN;
import main.hex.CalcEngineHex;
import main.hex.UserInterfaceHex;
public class Calculator {
public static void main(String args []) {
/**
* Create a new Calculator and combine the engine with the interface.
*/
CalcEngineStr calcEngine = new CalcEngineStr();
UserInterfaceRPN userInterface = new UserInterfaceRPN(calcEngine);
userInterface.setVisible(true);
}
}
| [
"[email protected]"
]
| |
e1c8761919211e90d3e6cae788269e374af4804e | ce031e18b4b1a808b99b08e6c56b07ff7475a114 | /src/main/java/com/fun/uncle/hello/rabbitmq/config/RabbitMQConfiguration.java | cbc7be3ee9bb2422ca2a235065e4340007ac6d58 | []
| no_license | ruanjiayu/hello-rabbitmq | 6dd7f9e53a7f06712b5ecc07231d8d3235103dd8 | 992751277902b1d284ad7aa300af29ce5dad6d19 | refs/heads/master | 2020-11-30T08:50:53.476582 | 2019-12-27T03:06:31 | 2019-12-27T03:06:31 | 230,360,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package com.fun.uncle.hello.rabbitmq.config;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Description: 创建一个队列
* @Author: Xian
* @CreateDate: 2019/12/27 10:43
* @Version: 0.0.1-SNAPSHOT
*/
@Configuration
public class RabbitMQConfiguration {
@Bean
public Queue queue() {
return new Queue("helloRabbit");
}
}
| [
"[email protected]"
]
| |
472be8ff3da8ca5a8e569dcd579b75274018c68d | c885ef92397be9d54b87741f01557f61d3f794f3 | /tests-without-trycatch/JacksonCore-23/com.fasterxml.jackson.core.util.DefaultPrettyPrinter/BBC-F0-opt-70/10/com/fasterxml/jackson/core/util/DefaultPrettyPrinter_ESTest_scaffolding.java | 648ff5941dd69541b217f5349a208191fb7c83d2 | [
"CC-BY-4.0",
"MIT"
]
| permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 10,611 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Oct 14 03:50:26 GMT 2021
*/
package com.fasterxml.jackson.core.util;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class DefaultPrettyPrinter_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "com.fasterxml.jackson.core.util.DefaultPrettyPrinter";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.dir", "/experiment");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DefaultPrettyPrinter_ESTest_scaffolding.class.getClassLoader() ,
"com.fasterxml.jackson.core.base.GeneratorBase",
"com.fasterxml.jackson.core.filter.TokenFilter",
"com.fasterxml.jackson.core.util.DefaultPrettyPrinter$NopIndenter",
"com.fasterxml.jackson.core.JsonParser$NumberType",
"com.fasterxml.jackson.core.io.CharTypes",
"com.fasterxml.jackson.core.json.WriterBasedJsonGenerator",
"com.fasterxml.jackson.core.filter.TokenFilterContext",
"com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer",
"com.fasterxml.jackson.core.SerializableString",
"com.fasterxml.jackson.core.Versioned",
"com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate",
"com.fasterxml.jackson.core.util.RequestPayload",
"com.fasterxml.jackson.core.json.DupDetector",
"com.fasterxml.jackson.core.util.Separators",
"com.fasterxml.jackson.core.type.TypeReference",
"com.fasterxml.jackson.core.JsonParseException",
"com.fasterxml.jackson.core.json.JsonWriteContext",
"com.fasterxml.jackson.core.io.JsonStringEncoder",
"com.fasterxml.jackson.core.Version",
"com.fasterxml.jackson.core.util.DefaultIndenter",
"com.fasterxml.jackson.core.util.BufferRecyclers",
"com.fasterxml.jackson.core.util.Instantiatable",
"com.fasterxml.jackson.core.Base64Variant",
"com.fasterxml.jackson.core.util.JsonGeneratorDelegate",
"com.fasterxml.jackson.core.base.ParserBase",
"com.fasterxml.jackson.core.json.JsonGeneratorImpl",
"com.fasterxml.jackson.core.async.NonBlockingInputFeeder",
"com.fasterxml.jackson.core.io.JsonEOFException",
"com.fasterxml.jackson.core.json.ReaderBasedJsonParser",
"com.fasterxml.jackson.core.JsonLocation",
"com.fasterxml.jackson.core.util.DefaultPrettyPrinter$Indenter",
"com.fasterxml.jackson.core.JsonGenerator",
"com.fasterxml.jackson.core.io.CharacterEscapes",
"com.fasterxml.jackson.core.ObjectCodec",
"com.fasterxml.jackson.core.json.JsonReadContext",
"com.fasterxml.jackson.core.JsonParser$Feature",
"com.fasterxml.jackson.core.io.SerializedString",
"com.fasterxml.jackson.core.util.DefaultPrettyPrinter$FixedSpaceIndenter",
"com.fasterxml.jackson.core.JsonEncoding",
"com.fasterxml.jackson.core.util.DefaultPrettyPrinter",
"com.fasterxml.jackson.core.JsonGenerationException",
"com.fasterxml.jackson.core.JsonToken",
"com.fasterxml.jackson.core.util.BufferRecycler",
"com.fasterxml.jackson.core.TreeNode",
"com.fasterxml.jackson.core.TreeCodec",
"com.fasterxml.jackson.core.JsonParser",
"com.fasterxml.jackson.core.JsonGenerator$Feature",
"com.fasterxml.jackson.core.json.UTF8JsonGenerator",
"com.fasterxml.jackson.core.JsonProcessingException",
"com.fasterxml.jackson.core.JsonStreamContext",
"com.fasterxml.jackson.core.util.TextBuffer",
"com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer$Bucket",
"com.fasterxml.jackson.core.type.WritableTypeId",
"com.fasterxml.jackson.core.base.ParserMinimalBase",
"com.fasterxml.jackson.core.util.ByteArrayBuilder",
"com.fasterxml.jackson.core.io.IOContext",
"com.fasterxml.jackson.core.FormatSchema",
"com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer$TableInfo",
"com.fasterxml.jackson.core.PrettyPrinter"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(DefaultPrettyPrinter_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"com.fasterxml.jackson.core.io.SerializedString",
"com.fasterxml.jackson.core.util.DefaultPrettyPrinter",
"com.fasterxml.jackson.core.util.DefaultPrettyPrinter$NopIndenter",
"com.fasterxml.jackson.core.util.DefaultPrettyPrinter$FixedSpaceIndenter",
"com.fasterxml.jackson.core.util.Separators",
"com.fasterxml.jackson.core.PrettyPrinter",
"com.fasterxml.jackson.core.util.DefaultIndenter",
"com.fasterxml.jackson.core.util.BufferRecyclers",
"com.fasterxml.jackson.core.io.CharTypes",
"com.fasterxml.jackson.core.io.JsonStringEncoder",
"com.fasterxml.jackson.core.util.ByteArrayBuilder",
"com.fasterxml.jackson.core.util.TextBuffer",
"com.fasterxml.jackson.core.filter.TokenFilter",
"com.fasterxml.jackson.core.JsonGenerator",
"com.fasterxml.jackson.core.util.JsonGeneratorDelegate",
"com.fasterxml.jackson.core.filter.FilteringGeneratorDelegate",
"com.fasterxml.jackson.core.JsonStreamContext",
"com.fasterxml.jackson.core.filter.TokenFilterContext",
"com.fasterxml.jackson.core.util.BufferRecycler",
"com.fasterxml.jackson.core.io.IOContext",
"com.fasterxml.jackson.core.JsonParser",
"com.fasterxml.jackson.core.util.JsonParserDelegate",
"com.fasterxml.jackson.core.util.JsonParserSequence",
"com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer",
"com.fasterxml.jackson.core.sym.CharsToNameCanonicalizer$TableInfo",
"com.fasterxml.jackson.core.base.ParserMinimalBase",
"com.fasterxml.jackson.core.base.ParserBase",
"com.fasterxml.jackson.core.json.ReaderBasedJsonParser",
"com.fasterxml.jackson.core.json.JsonReadContext",
"com.fasterxml.jackson.core.filter.FilteringParserDelegate",
"com.fasterxml.jackson.core.io.CharacterEscapes",
"com.fasterxml.jackson.core.JsonpCharacterEscapes",
"com.fasterxml.jackson.core.JsonFactory$Feature",
"com.fasterxml.jackson.core.TreeCodec",
"com.fasterxml.jackson.core.ObjectCodec",
"com.fasterxml.jackson.core.base.GeneratorBase",
"com.fasterxml.jackson.core.json.JsonGeneratorImpl",
"com.fasterxml.jackson.core.json.UTF8JsonGenerator",
"com.fasterxml.jackson.core.json.JsonWriteContext",
"com.fasterxml.jackson.core.json.DupDetector",
"com.fasterxml.jackson.core.json.WriterBasedJsonGenerator",
"com.fasterxml.jackson.core.JsonProcessingException",
"com.fasterxml.jackson.core.JsonGenerationException",
"com.fasterxml.jackson.core.io.NumberOutput",
"com.fasterxml.jackson.core.json.UTF8DataInputJsonParser",
"com.fasterxml.jackson.core.Base64Variant",
"com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer",
"com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer$TableInfo",
"com.fasterxml.jackson.core.Base64Variants",
"com.fasterxml.jackson.core.json.UTF8StreamJsonParser",
"com.fasterxml.jackson.core.type.WritableTypeId",
"com.fasterxml.jackson.core.JsonParseException",
"com.fasterxml.jackson.core.JsonLocation",
"com.fasterxml.jackson.core.util.MinimalPrettyPrinter",
"com.fasterxml.jackson.core.type.TypeReference",
"com.fasterxml.jackson.core.util.VersionUtil",
"com.fasterxml.jackson.core.Version",
"com.fasterxml.jackson.core.json.PackageVersion",
"com.fasterxml.jackson.core.util.InternCache",
"com.fasterxml.jackson.core.util.RequestPayload",
"com.fasterxml.jackson.core.JsonGenerator$Feature",
"com.fasterxml.jackson.core.JsonParser$Feature",
"com.fasterxml.jackson.core.JsonToken"
);
}
}
| [
"[email protected]"
]
| |
aa5d1038d5314cabd107445fdbc7da5f494bb8fc | 0a24ada4ff13d21ee159291295b7ee61f196237a | /component/src/main/java/org/ballerinalang/redis/actions/connection/Close.java | a9291c57c5f8ce9f3643d53b59376b497f478533 | [
"Apache-2.0"
]
| permissive | muharihar/package-redis | bd5f29cc320f41fc746f9df719009470767569f8 | 728a29b5a7f7b43e59889f2ba1737dd40c55769a | refs/heads/master | 2020-03-14T12:22:58.734844 | 2018-04-16T09:56:17 | 2018-04-16T09:56:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,811 | java | /*
* Copyright (c) 2018, WSO2 Inc. (http:www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http:www.apache.orglicensesLICENSE-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.ballerinalang.redis.actions.connection;
import org.ballerinalang.bre.Context;
import org.ballerinalang.model.types.TypeKind;
import org.ballerinalang.model.values.BStruct;
import org.ballerinalang.natives.annotations.BallerinaFunction;
import org.ballerinalang.natives.annotations.Receiver;
import org.ballerinalang.redis.Constants;
import org.ballerinalang.redis.RedisDataSource;
import org.ballerinalang.redis.actions.AbstractRedisAction;
/**
* {@code Close} action is used to close the Redis connection pool.
*
* @since 0.5.0
*/
@BallerinaFunction(orgName = "ballerina",
packageName = "redis",
functionName = "close",
receiver = @Receiver(type = TypeKind.STRUCT,
structType = Constants.REDIS_CLIENT))
public class Close extends AbstractRedisAction {
@Override
public void execute(Context context) {
BStruct bConnector = (BStruct) context.getRefArgument(0);
RedisDataSource redisDataSource = (RedisDataSource) bConnector.getNativeData(Constants.REDIS_CLIENT);
close(redisDataSource);
}
}
| [
"[email protected]"
]
| |
6cb6d831c73bc3a75d1ae51b9f79d0e6354b1985 | 3756f01b5a7322f8ed07078146771c45e8d82adf | /src/main/java/com/raoulvdberge/refinedstorage/apiimpl/solderer/SoldererRecipePrintedProcessor.java | 3af673412a54a84470ee58745aee7af4ea20bad0 | [
"MIT"
]
| permissive | p455w0rd/refinedstorage | ae3c66379369ac2ec2e8d2cf18c6270cf90778db | 647faf1120910f1711f66775fa2f9eec7d95448f | refs/heads/mc1.11 | 2021-01-13T03:26:27.589157 | 2016-12-28T17:08:48 | 2016-12-28T17:08:48 | 77,552,286 | 0 | 1 | null | 2016-12-28T18:14:26 | 2016-12-28T18:14:26 | null | UTF-8 | Java | false | false | 2,465 | java | package com.raoulvdberge.refinedstorage.apiimpl.solderer;
import com.raoulvdberge.refinedstorage.RSItems;
import com.raoulvdberge.refinedstorage.api.solderer.ISoldererRecipe;
import com.raoulvdberge.refinedstorage.item.ItemProcessor;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import javax.annotation.Nonnull;
public class SoldererRecipePrintedProcessor implements ISoldererRecipe {
private int type;
private boolean fullBlock;
private ItemStack result;
private ItemStack requirement;
public SoldererRecipePrintedProcessor(int type, boolean fullBlock) {
this.type = type;
this.fullBlock = fullBlock;
this.result = new ItemStack(RSItems.PROCESSOR, fullBlock ? 9 : 1, type);
switch (type) {
case ItemProcessor.TYPE_PRINTED_BASIC:
this.requirement = fullBlock ? new ItemStack(Blocks.IRON_BLOCK) : new ItemStack(Items.IRON_INGOT);
break;
case ItemProcessor.TYPE_PRINTED_IMPROVED:
this.requirement = fullBlock ? new ItemStack(Blocks.GOLD_BLOCK) : new ItemStack(Items.GOLD_INGOT);
break;
case ItemProcessor.TYPE_PRINTED_ADVANCED:
this.requirement = fullBlock ? new ItemStack(Blocks.DIAMOND_BLOCK) : new ItemStack(Items.DIAMOND);
break;
case ItemProcessor.TYPE_PRINTED_SILICON:
if (fullBlock) {
throw new IllegalArgumentException("Printed silicon can't be made from block form!");
}
this.requirement = new ItemStack(RSItems.SILICON);
break;
}
}
@Override
@Nonnull
public ItemStack getRow(int row) {
return row == 1 ? requirement : ItemStack.EMPTY;
}
@Override
@Nonnull
public ItemStack getResult() {
return result;
}
@Override
public int getDuration() {
switch (type) {
case ItemProcessor.TYPE_PRINTED_BASIC:
return 100 * (fullBlock ? 9 : 1);
case ItemProcessor.TYPE_PRINTED_IMPROVED:
return 150 * (fullBlock ? 9 : 1);
case ItemProcessor.TYPE_PRINTED_ADVANCED:
return 200 * (fullBlock ? 9 : 1);
case ItemProcessor.TYPE_PRINTED_SILICON:
return 90 * (fullBlock ? 9 : 1);
default:
return 0;
}
}
}
| [
"[email protected]"
]
| |
cc2dd89e7bbb5db6592f160bd10dbd6ea60f2795 | e4094a119fcb5e3869b98cf8f0d323d9a3594bfd | /src/main/java/imcamilo/com/github/wlx/model/CommentPlus.java | 570b0e9a1cd5be55f70557f551f679605298ed34 | []
| no_license | imcamilo/exchangegram | e41c9638e428f8971331db43ffd75118541d1caa | 753adb45c434fb2e1c35fb3f4a29c83f87baba31 | refs/heads/master | 2020-04-29T04:43:35.967021 | 2019-03-27T21:36:21 | 2019-03-27T21:36:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package imcamilo.com.github.wlx.model;
import imcamilo.com.github.wlx.dto.CommentPlusDTO;
import lombok.Getter;
import lombok.Setter;
/**
* Created by Camilo Jorquera on 3/18/19
*/
@Getter
@Setter
public class CommentPlus extends Comment {
private Integer userId;
public CommentPlusDTO toDTO() {
CommentPlusDTO plusDTO = new CommentPlusDTO();
plusDTO.setId(this.getId());
plusDTO.setUserId(this.getUserId());
plusDTO.setPostId(this.getPostId());
plusDTO.setName(this.getName());
plusDTO.setEmail(this.getEmail());
plusDTO.setBody(this.getBody());
return plusDTO;
}
}
| [
"[email protected]"
]
| |
d7bdf745453d79f55d2e8b573a7f14c9c5a8d8a3 | 2c700f1934e3efde85ccf04c9591e15d21f10ab3 | /app/src/main/java/com/cloudcreativity/peoplepass_zy/utils/NetworkUtils.java | 5d4d36de1d96a342cafc54e958f62ee2fa079714 | []
| no_license | TasteBlood/PeoplePassForZY | b0b7bfaa1da030a2e8b0f0c6530c53e726e9184e | 4e9a2a8268a5fed86e7224f5c5d0057861455bbc | refs/heads/master | 2021-03-03T05:42:14.659569 | 2020-03-09T03:33:32 | 2020-03-09T03:33:32 | 245,935,938 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 646 | java | package com.cloudcreativity.peoplepass_zy.utils;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import com.cloudcreativity.peoplepass_zy.base.BaseApp;
/**
* 网络状态,操作的工具
*/
public class NetworkUtils {
/**
* @return 网络是否可用
*/
public static boolean isAvailable(){
ConnectivityManager manager = (ConnectivityManager) BaseApp.app.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = manager.getActiveNetworkInfo();
return null!=activeNetworkInfo&&activeNetworkInfo.isAvailable();
}
}
| [
"[email protected]"
]
| |
5a198264601baa0a83b754d84cc454da0612cae9 | 6950c552b45190461053dcba8c17db79b5535ffe | /recsys/matrix_factorization/okapi/src/main/okapi/aggregators/FloatAvgAggregator.java | d36d112ddf80e1b0c4be5a50f02a1e13ff41a2ce | []
| no_license | zihaolucky/data-science-in-action | e755ab5a4a7f10cd31a7fd793a05035776995b5f | faf7d74b194988fe2d7372c9500e92f62f14fb03 | refs/heads/master | 2021-01-10T01:47:52.522914 | 2016-11-24T16:06:22 | 2016-11-24T16:06:22 | 36,588,521 | 48 | 18 | null | null | null | null | UTF-8 | Java | false | false | 2,101 | java | /**
* Copyright 2014 Grafos.ml
*
* 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 main.okapi.aggregators;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import ml.grafos.okapi.aggregators.FloatAvgAggregator.PartialAvg;
import org.apache.giraph.aggregators.BasicAggregator;
import org.apache.hadoop.io.Writable;
public class FloatAvgAggregator extends BasicAggregator<FloatAvgAggregator.PartialAvg> {
@Override
public void aggregate(PartialAvg value) {
getAggregatedValue().combine(value);
}
@Override
public PartialAvg createInitialValue() {
return new PartialAvg(0,0);
}
public static class PartialAvg implements Writable {
public float partialSum;
public int partialCount;
public PartialAvg() {
partialSum = 0;
partialCount = 0;
}
public PartialAvg(float sum, int count) {
partialSum = sum;
partialCount = count;
}
public void combine(PartialAvg other) {
this.partialSum += other.partialSum;
this.partialCount += other.partialCount;
}
public float get() {
return partialSum/(float)partialCount;
}
@Override
public void readFields(DataInput input) throws IOException {
partialSum = input.readFloat();
partialCount = input.readInt();
}
@Override
public void write(DataOutput output) throws IOException {
output.writeFloat(partialSum);
output.writeInt(partialCount);
}
@Override
public String toString() {
return partialCount+" "+partialSum+" "+get();
}
}
}
| [
"[email protected]"
]
| |
cec549d4f85475660222e26cadbec4a61d3cd559 | 62b38e52b23eaa376293b248262c09474ad9bee9 | /src/com/suniceman/po/GroupUser.java | e5c3489c70eb2ccb8f609041bd13aae6d8644c91 | []
| no_license | suniceman/chat | 81c320cd38496dd037f6682fec8b756782c1222c | 84d904ce27c92ab015840c0e8a4b7999616c8c14 | refs/heads/master | 2021-04-18T21:31:26.938000 | 2018-05-07T15:40:09 | 2018-05-07T15:40:09 | 126,590,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 815 | java | package com.suniceman.po;
import java.io.Serializable;
public class GroupUser implements Serializable {
private static final long serialVersionUID = 1L;
private int id;
private int groupId;
private int userId;
private int ownId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getOwnId() {
return ownId;
}
public void setOwnId(int ownId) {
this.ownId = ownId;
}
}
| [
"[email protected]"
]
| |
7f3d828ba61d82f3d8d40d304ba470d88aba043a | 6c74698a95bcf543aaba9ca90846209bed9dea71 | /AtmecsAutomation/src/main/java/com/atmecs/constants/Locators.java | a9b849d3834213f3e75257945639a2acbba635dd | []
| no_license | C-O-D-Y/Atmecs-Automation | edb30416953a9fe2c91f75ac73aef375f4abd4bb | 2626db1f6531cfa5becacaa3fad37eeb774ff6a0 | refs/heads/master | 2021-06-21T00:16:44.937639 | 2019-09-26T14:38:17 | 2019-09-26T14:38:17 | 211,106,432 | 0 | 0 | null | 2021-04-26T19:33:09 | 2019-09-26T14:16:23 | HTML | UTF-8 | Java | false | false | 933 | java | package com.atmecs.constants;
import java.io.IOException;
import java.util.Properties;
import com.atmecs.utils.ReadPropertiesFile;
/**
* In this class, property file is loaded for getting locators.
*/
public class Locators {
static Properties homePageProperty;
/**
* In this constructor, reading of property file is being done.
*/
public Locators() {
try {
homePageProperty = ReadPropertiesFile.loadProperty(FilePath.LOCATOR_FILE);
} catch (IOException e) {
e.getMessage();
}
}
/**
* In this method, locator data from the property file is taken.
*
* @param key
*/
public static String getLocators(String key) {
String value = homePageProperty.getProperty(key);
return value;
}
// public static void main(String[] args) {
// YatraFlightBookingLocators details = new YatraFlightBookingLocators();
// System.out.println(YatraFlightBookingLocators.getLocators("loc.btn.roundTrip"));
// }
}
| [
"[email protected]"
]
| |
869cb22ff58c7fde4ef2121e49ceb9e7108404f2 | 207954783b016ba1525738992a23361615eebc19 | /IntModel/src/com/televisa/integration/model/EvetvIntServicesLogTabViewRowImpl.java | 860398a6f001c0b70d0b83518aed84d0fd03aa46 | []
| no_license | jorge82lbs/IntegrationParadigmNeptuno | 89f50aa48b3ea2ea82253f11e5c56826684ee297 | 5763fcce002eb1c5a4e1f4d0001afa0e5fa140d3 | refs/heads/master | 2020-04-15T19:46:02.362717 | 2019-01-10T01:06:43 | 2019-01-10T01:06:43 | 164,963,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,857 | java | package com.televisa.integration.model;
import java.sql.Timestamp;
import oracle.jbo.server.EntityImpl;
import oracle.jbo.server.ViewRowImpl;
// ---------------------------------------------------------------------
// --- File generated by Oracle ADF Business Components Design Time.
// --- Mon Oct 23 20:44:04 CDT 2017
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class EvetvIntServicesLogTabViewRowImpl extends ViewRowImpl {
public static final int ENTITY_EVETVINTSERVICESLOGTAB = 0;
/**
* AttributesEnum: generated enum for identifying attributes and accessors. DO NOT MODIFY.
*/
public enum AttributesEnum {
IdLogServices,
IdService,
IndProcess,
IndResponse,
NumUser,
FecResponse,
FecRequest,
NumEvtbProcessId,
NumPgmProcessId,
IndEstatus,
AttributeCategory,
Attribute1,
Attribute2,
Attribute3,
Attribute4,
Attribute5,
Attribute6,
Attribute7,
Attribute8,
Attribute9,
Attribute10,
Attribute11,
Attribute12,
Attribute13,
Attribute14,
Attribute15,
FecCreationDate,
NumCreatedBy,
FecLastUpdateDate,
NumLastUpdatedBy,
NumLastUpdateLogin;
private static AttributesEnum[] vals = null;
private static final int firstIndex = 0;
public int index() {
return AttributesEnum.firstIndex() + ordinal();
}
public static final int firstIndex() {
return firstIndex;
}
public static int count() {
return AttributesEnum.firstIndex() + AttributesEnum.staticValues().length;
}
public static final AttributesEnum[] staticValues() {
if (vals == null) {
vals = AttributesEnum.values();
}
return vals;
}
}
public static final int IDLOGSERVICES = AttributesEnum.IdLogServices.index();
public static final int IDSERVICE = AttributesEnum.IdService.index();
public static final int INDPROCESS = AttributesEnum.IndProcess.index();
public static final int INDRESPONSE = AttributesEnum.IndResponse.index();
public static final int NUMUSER = AttributesEnum.NumUser.index();
public static final int FECRESPONSE = AttributesEnum.FecResponse.index();
public static final int FECREQUEST = AttributesEnum.FecRequest.index();
public static final int NUMEVTBPROCESSID = AttributesEnum.NumEvtbProcessId.index();
public static final int NUMPGMPROCESSID = AttributesEnum.NumPgmProcessId.index();
public static final int INDESTATUS = AttributesEnum.IndEstatus.index();
public static final int ATTRIBUTECATEGORY = AttributesEnum.AttributeCategory.index();
public static final int ATTRIBUTE1 = AttributesEnum.Attribute1.index();
public static final int ATTRIBUTE2 = AttributesEnum.Attribute2.index();
public static final int ATTRIBUTE3 = AttributesEnum.Attribute3.index();
public static final int ATTRIBUTE4 = AttributesEnum.Attribute4.index();
public static final int ATTRIBUTE5 = AttributesEnum.Attribute5.index();
public static final int ATTRIBUTE6 = AttributesEnum.Attribute6.index();
public static final int ATTRIBUTE7 = AttributesEnum.Attribute7.index();
public static final int ATTRIBUTE8 = AttributesEnum.Attribute8.index();
public static final int ATTRIBUTE9 = AttributesEnum.Attribute9.index();
public static final int ATTRIBUTE10 = AttributesEnum.Attribute10.index();
public static final int ATTRIBUTE11 = AttributesEnum.Attribute11.index();
public static final int ATTRIBUTE12 = AttributesEnum.Attribute12.index();
public static final int ATTRIBUTE13 = AttributesEnum.Attribute13.index();
public static final int ATTRIBUTE14 = AttributesEnum.Attribute14.index();
public static final int ATTRIBUTE15 = AttributesEnum.Attribute15.index();
public static final int FECCREATIONDATE = AttributesEnum.FecCreationDate.index();
public static final int NUMCREATEDBY = AttributesEnum.NumCreatedBy.index();
public static final int FECLASTUPDATEDATE = AttributesEnum.FecLastUpdateDate.index();
public static final int NUMLASTUPDATEDBY = AttributesEnum.NumLastUpdatedBy.index();
public static final int NUMLASTUPDATELOGIN = AttributesEnum.NumLastUpdateLogin.index();
/**
* This is the default constructor (do not remove).
*/
public EvetvIntServicesLogTabViewRowImpl() {
}
/**
* Gets EvetvIntServicesLogTab entity object.
* @return the EvetvIntServicesLogTab
*/
public EntityImpl getEvetvIntServicesLogTab() {
return (EntityImpl) getEntity(ENTITY_EVETVINTSERVICESLOGTAB);
}
/**
* Gets the attribute value for ID_LOG_SERVICES using the alias name IdLogServices.
* @return the ID_LOG_SERVICES
*/
public Integer getIdLogServices() {
return (Integer) getAttributeInternal(IDLOGSERVICES);
}
/**
* Sets <code>value</code> as attribute value for ID_LOG_SERVICES using the alias name IdLogServices.
* @param value value to set the ID_LOG_SERVICES
*/
public void setIdLogServices(Integer value) {
setAttributeInternal(IDLOGSERVICES, value);
}
/**
* Gets the attribute value for ID_SERVICE using the alias name IdService.
* @return the ID_SERVICE
*/
public Integer getIdService() {
return (Integer) getAttributeInternal(IDSERVICE);
}
/**
* Sets <code>value</code> as attribute value for ID_SERVICE using the alias name IdService.
* @param value value to set the ID_SERVICE
*/
public void setIdService(Integer value) {
setAttributeInternal(IDSERVICE, value);
}
/**
* Gets the attribute value for IND_PROCESS using the alias name IndProcess.
* @return the IND_PROCESS
*/
public Integer getIndProcess() {
return (Integer) getAttributeInternal(INDPROCESS);
}
/**
* Sets <code>value</code> as attribute value for IND_PROCESS using the alias name IndProcess.
* @param value value to set the IND_PROCESS
*/
public void setIndProcess(Integer value) {
setAttributeInternal(INDPROCESS, value);
}
/**
* Gets the attribute value for IND_RESPONSE using the alias name IndResponse.
* @return the IND_RESPONSE
*/
public String getIndResponse() {
return (String) getAttributeInternal(INDRESPONSE);
}
/**
* Sets <code>value</code> as attribute value for IND_RESPONSE using the alias name IndResponse.
* @param value value to set the IND_RESPONSE
*/
public void setIndResponse(String value) {
setAttributeInternal(INDRESPONSE, value);
}
/**
* Gets the attribute value for NUM_USER using the alias name NumUser.
* @return the NUM_USER
*/
public Integer getNumUser() {
return (Integer) getAttributeInternal(NUMUSER);
}
/**
* Sets <code>value</code> as attribute value for NUM_USER using the alias name NumUser.
* @param value value to set the NUM_USER
*/
public void setNumUser(Integer value) {
setAttributeInternal(NUMUSER, value);
}
/**
* Gets the attribute value for FEC_RESPONSE using the alias name FecResponse.
* @return the FEC_RESPONSE
*/
public Timestamp getFecResponse() {
return (Timestamp) getAttributeInternal(FECRESPONSE);
}
/**
* Sets <code>value</code> as attribute value for FEC_RESPONSE using the alias name FecResponse.
* @param value value to set the FEC_RESPONSE
*/
public void setFecResponse(Timestamp value) {
setAttributeInternal(FECRESPONSE, value);
}
/**
* Gets the attribute value for FEC_REQUEST using the alias name FecRequest.
* @return the FEC_REQUEST
*/
public Timestamp getFecRequest() {
return (Timestamp) getAttributeInternal(FECREQUEST);
}
/**
* Sets <code>value</code> as attribute value for FEC_REQUEST using the alias name FecRequest.
* @param value value to set the FEC_REQUEST
*/
public void setFecRequest(Timestamp value) {
setAttributeInternal(FECREQUEST, value);
}
/**
* Gets the attribute value for NUM_EVTB_PROCESS_ID using the alias name NumEvtbProcessId.
* @return the NUM_EVTB_PROCESS_ID
*/
public Integer getNumEvtbProcessId() {
return (Integer) getAttributeInternal(NUMEVTBPROCESSID);
}
/**
* Sets <code>value</code> as attribute value for NUM_EVTB_PROCESS_ID using the alias name NumEvtbProcessId.
* @param value value to set the NUM_EVTB_PROCESS_ID
*/
public void setNumEvtbProcessId(Integer value) {
setAttributeInternal(NUMEVTBPROCESSID, value);
}
/**
* Gets the attribute value for NUM_PGM_PROCESS_ID using the alias name NumPgmProcessId.
* @return the NUM_PGM_PROCESS_ID
*/
public Integer getNumPgmProcessId() {
return (Integer) getAttributeInternal(NUMPGMPROCESSID);
}
/**
* Sets <code>value</code> as attribute value for NUM_PGM_PROCESS_ID using the alias name NumPgmProcessId.
* @param value value to set the NUM_PGM_PROCESS_ID
*/
public void setNumPgmProcessId(Integer value) {
setAttributeInternal(NUMPGMPROCESSID, value);
}
/**
* Gets the attribute value for IND_ESTATUS using the alias name IndEstatus.
* @return the IND_ESTATUS
*/
public String getIndEstatus() {
return (String) getAttributeInternal(INDESTATUS);
}
/**
* Sets <code>value</code> as attribute value for IND_ESTATUS using the alias name IndEstatus.
* @param value value to set the IND_ESTATUS
*/
public void setIndEstatus(String value) {
setAttributeInternal(INDESTATUS, value);
}
/**
* Gets the attribute value for ATTRIBUTE_CATEGORY using the alias name AttributeCategory.
* @return the ATTRIBUTE_CATEGORY
*/
public String getAttributeCategory() {
return (String) getAttributeInternal(ATTRIBUTECATEGORY);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE_CATEGORY using the alias name AttributeCategory.
* @param value value to set the ATTRIBUTE_CATEGORY
*/
public void setAttributeCategory(String value) {
setAttributeInternal(ATTRIBUTECATEGORY, value);
}
/**
* Gets the attribute value for ATTRIBUTE1 using the alias name Attribute1.
* @return the ATTRIBUTE1
*/
public String getAttribute1() {
return (String) getAttributeInternal(ATTRIBUTE1);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE1 using the alias name Attribute1.
* @param value value to set the ATTRIBUTE1
*/
public void setAttribute1(String value) {
setAttributeInternal(ATTRIBUTE1, value);
}
/**
* Gets the attribute value for ATTRIBUTE2 using the alias name Attribute2.
* @return the ATTRIBUTE2
*/
public String getAttribute2() {
return (String) getAttributeInternal(ATTRIBUTE2);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE2 using the alias name Attribute2.
* @param value value to set the ATTRIBUTE2
*/
public void setAttribute2(String value) {
setAttributeInternal(ATTRIBUTE2, value);
}
/**
* Gets the attribute value for ATTRIBUTE3 using the alias name Attribute3.
* @return the ATTRIBUTE3
*/
public String getAttribute3() {
return (String) getAttributeInternal(ATTRIBUTE3);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE3 using the alias name Attribute3.
* @param value value to set the ATTRIBUTE3
*/
public void setAttribute3(String value) {
setAttributeInternal(ATTRIBUTE3, value);
}
/**
* Gets the attribute value for ATTRIBUTE4 using the alias name Attribute4.
* @return the ATTRIBUTE4
*/
public String getAttribute4() {
return (String) getAttributeInternal(ATTRIBUTE4);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE4 using the alias name Attribute4.
* @param value value to set the ATTRIBUTE4
*/
public void setAttribute4(String value) {
setAttributeInternal(ATTRIBUTE4, value);
}
/**
* Gets the attribute value for ATTRIBUTE5 using the alias name Attribute5.
* @return the ATTRIBUTE5
*/
public String getAttribute5() {
return (String) getAttributeInternal(ATTRIBUTE5);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE5 using the alias name Attribute5.
* @param value value to set the ATTRIBUTE5
*/
public void setAttribute5(String value) {
setAttributeInternal(ATTRIBUTE5, value);
}
/**
* Gets the attribute value for ATTRIBUTE6 using the alias name Attribute6.
* @return the ATTRIBUTE6
*/
public String getAttribute6() {
return (String) getAttributeInternal(ATTRIBUTE6);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE6 using the alias name Attribute6.
* @param value value to set the ATTRIBUTE6
*/
public void setAttribute6(String value) {
setAttributeInternal(ATTRIBUTE6, value);
}
/**
* Gets the attribute value for ATTRIBUTE7 using the alias name Attribute7.
* @return the ATTRIBUTE7
*/
public String getAttribute7() {
return (String) getAttributeInternal(ATTRIBUTE7);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE7 using the alias name Attribute7.
* @param value value to set the ATTRIBUTE7
*/
public void setAttribute7(String value) {
setAttributeInternal(ATTRIBUTE7, value);
}
/**
* Gets the attribute value for ATTRIBUTE8 using the alias name Attribute8.
* @return the ATTRIBUTE8
*/
public String getAttribute8() {
return (String) getAttributeInternal(ATTRIBUTE8);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE8 using the alias name Attribute8.
* @param value value to set the ATTRIBUTE8
*/
public void setAttribute8(String value) {
setAttributeInternal(ATTRIBUTE8, value);
}
/**
* Gets the attribute value for ATTRIBUTE9 using the alias name Attribute9.
* @return the ATTRIBUTE9
*/
public String getAttribute9() {
return (String) getAttributeInternal(ATTRIBUTE9);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE9 using the alias name Attribute9.
* @param value value to set the ATTRIBUTE9
*/
public void setAttribute9(String value) {
setAttributeInternal(ATTRIBUTE9, value);
}
/**
* Gets the attribute value for ATTRIBUTE10 using the alias name Attribute10.
* @return the ATTRIBUTE10
*/
public String getAttribute10() {
return (String) getAttributeInternal(ATTRIBUTE10);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE10 using the alias name Attribute10.
* @param value value to set the ATTRIBUTE10
*/
public void setAttribute10(String value) {
setAttributeInternal(ATTRIBUTE10, value);
}
/**
* Gets the attribute value for ATTRIBUTE11 using the alias name Attribute11.
* @return the ATTRIBUTE11
*/
public String getAttribute11() {
return (String) getAttributeInternal(ATTRIBUTE11);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE11 using the alias name Attribute11.
* @param value value to set the ATTRIBUTE11
*/
public void setAttribute11(String value) {
setAttributeInternal(ATTRIBUTE11, value);
}
/**
* Gets the attribute value for ATTRIBUTE12 using the alias name Attribute12.
* @return the ATTRIBUTE12
*/
public String getAttribute12() {
return (String) getAttributeInternal(ATTRIBUTE12);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE12 using the alias name Attribute12.
* @param value value to set the ATTRIBUTE12
*/
public void setAttribute12(String value) {
setAttributeInternal(ATTRIBUTE12, value);
}
/**
* Gets the attribute value for ATTRIBUTE13 using the alias name Attribute13.
* @return the ATTRIBUTE13
*/
public String getAttribute13() {
return (String) getAttributeInternal(ATTRIBUTE13);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE13 using the alias name Attribute13.
* @param value value to set the ATTRIBUTE13
*/
public void setAttribute13(String value) {
setAttributeInternal(ATTRIBUTE13, value);
}
/**
* Gets the attribute value for ATTRIBUTE14 using the alias name Attribute14.
* @return the ATTRIBUTE14
*/
public String getAttribute14() {
return (String) getAttributeInternal(ATTRIBUTE14);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE14 using the alias name Attribute14.
* @param value value to set the ATTRIBUTE14
*/
public void setAttribute14(String value) {
setAttributeInternal(ATTRIBUTE14, value);
}
/**
* Gets the attribute value for ATTRIBUTE15 using the alias name Attribute15.
* @return the ATTRIBUTE15
*/
public String getAttribute15() {
return (String) getAttributeInternal(ATTRIBUTE15);
}
/**
* Sets <code>value</code> as attribute value for ATTRIBUTE15 using the alias name Attribute15.
* @param value value to set the ATTRIBUTE15
*/
public void setAttribute15(String value) {
setAttributeInternal(ATTRIBUTE15, value);
}
/**
* Gets the attribute value for FEC_CREATION_DATE using the alias name FecCreationDate.
* @return the FEC_CREATION_DATE
*/
public Timestamp getFecCreationDate() {
return (Timestamp) getAttributeInternal(FECCREATIONDATE);
}
/**
* Sets <code>value</code> as attribute value for FEC_CREATION_DATE using the alias name FecCreationDate.
* @param value value to set the FEC_CREATION_DATE
*/
public void setFecCreationDate(Timestamp value) {
setAttributeInternal(FECCREATIONDATE, value);
}
/**
* Gets the attribute value for NUM_CREATED_BY using the alias name NumCreatedBy.
* @return the NUM_CREATED_BY
*/
public Integer getNumCreatedBy() {
return (Integer) getAttributeInternal(NUMCREATEDBY);
}
/**
* Sets <code>value</code> as attribute value for NUM_CREATED_BY using the alias name NumCreatedBy.
* @param value value to set the NUM_CREATED_BY
*/
public void setNumCreatedBy(Integer value) {
setAttributeInternal(NUMCREATEDBY, value);
}
/**
* Gets the attribute value for FEC_LAST_UPDATE_DATE using the alias name FecLastUpdateDate.
* @return the FEC_LAST_UPDATE_DATE
*/
public Timestamp getFecLastUpdateDate() {
return (Timestamp) getAttributeInternal(FECLASTUPDATEDATE);
}
/**
* Sets <code>value</code> as attribute value for FEC_LAST_UPDATE_DATE using the alias name FecLastUpdateDate.
* @param value value to set the FEC_LAST_UPDATE_DATE
*/
public void setFecLastUpdateDate(Timestamp value) {
setAttributeInternal(FECLASTUPDATEDATE, value);
}
/**
* Gets the attribute value for NUM_LAST_UPDATED_BY using the alias name NumLastUpdatedBy.
* @return the NUM_LAST_UPDATED_BY
*/
public Integer getNumLastUpdatedBy() {
return (Integer) getAttributeInternal(NUMLASTUPDATEDBY);
}
/**
* Sets <code>value</code> as attribute value for NUM_LAST_UPDATED_BY using the alias name NumLastUpdatedBy.
* @param value value to set the NUM_LAST_UPDATED_BY
*/
public void setNumLastUpdatedBy(Integer value) {
setAttributeInternal(NUMLASTUPDATEDBY, value);
}
/**
* Gets the attribute value for NUM_LAST_UPDATE_LOGIN using the alias name NumLastUpdateLogin.
* @return the NUM_LAST_UPDATE_LOGIN
*/
public Integer getNumLastUpdateLogin() {
return (Integer) getAttributeInternal(NUMLASTUPDATELOGIN);
}
/**
* Sets <code>value</code> as attribute value for NUM_LAST_UPDATE_LOGIN using the alias name NumLastUpdateLogin.
* @param value value to set the NUM_LAST_UPDATE_LOGIN
*/
public void setNumLastUpdateLogin(Integer value) {
setAttributeInternal(NUMLASTUPDATELOGIN, value);
}
}
| [
"[email protected]"
]
| |
e93657594453d6728d0a4d57ffc72f92b6a22d14 | 11c73c9a056768478a941c3afb3868eaaad4a79a | /app/src/androidTest/java/com/shaheen/developer/consorstopvpn/ExampleInstrumentedTest.java | 5ae9df167544abf3fae0f4340298d5fe1ca04744 | []
| no_license | shaheenaslam10/ConsorStopVpn | 535d6ad9b242782654fc9304ddbfdf4b3afba2ae | b7e58b046e5a243c4a83261e958fa38fc772ab92 | refs/heads/master | 2020-12-26T09:04:32.959868 | 2020-01-31T15:36:31 | 2020-01-31T15:36:31 | 237,458,468 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package com.shaheen.developer.consorstopvpn;
import android.content.Context;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.shaheen.developer.consorstopvpn", appContext.getPackageName());
}
}
| [
"[email protected]"
]
| |
a4108da71247b406ae2b9a1d35350d75120051c8 | 28d8da2900384a13a342f15d3f35f2a37a09f067 | /Misc/PalinOrPerfect.java | d4ecf955ea725cd27afa2bb2942db0231ce1372c | []
| no_license | ankushKun/Java-Codes | 8be61dcbfc7297e0c1fb5321cdef6e9faa4e99bf | b2c03e10279741943457fabaf50d47777d786f53 | refs/heads/master | 2023-08-05T16:12:10.738437 | 2021-09-26T10:56:57 | 2021-09-26T10:56:57 | 280,129,750 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,442 | java | import java.util.Scanner;
public class PalinOrPerfect {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter a number : ");
int in = sc.nextInt();
System.out.println("1. Check for Palindrome number");
System.out.println("2. Check for Perfect number");
int c = sc.nextInt();
switch (c) {
case 1:
if (isPalindrome(in))
System.out.println("It is a Palindrome number");
else
System.out.println("It is not a Palindrome number");
break;
case 2:
if (isPerfect(in))
System.out.println("It is a Perfect number");
else
System.out.println("It is not a Perfect number");
break;
default:
System.out.println("Invalid choice try again");
}
}
public static boolean isPalindrome(int in) {
int ni = 0;
for (int i = in; i > 0; i /= 10) {
ni = (ni * 10) + i % 10;
}
return (ni == in);
}
public static boolean isPerfect(int in) {
int sum = 0;
for (int i = 1; i < in; i++) {
if (in % i == 0) {
sum += i;
}
}
return (sum == in);
}
}
| [
"[email protected]"
]
| |
9072644cc09873902ff741ca78c64ee8079dae5a | cd15a9cf3307441e3b36403b21086f9e4c7b4343 | /MySWTTEst/src/PlistParserTest.java | fc02e3a730c46b2fe78d26c9e4cd628e20f813a9 | [
"Apache-2.0"
]
| permissive | bigleuxenchef/JavaSwing | 1181e5fa58b3fd3e556c12ecf18d90c2980598fd | fa5a4d205b637c2b4b6aacf9ea3e2eb8962723dc | refs/heads/master | 2021-01-16T19:37:08.588450 | 2017-08-13T14:31:41 | 2017-08-13T14:31:41 | 100,181,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | import static org.junit.Assert.*;
import org.junit.Test;
public class PlistParserTest extends PlistParser {
/**
*
*/
public PlistParserTest() {
super();
// TODO Auto-generated constructor stub
}
@Test
public final void test() {
System.out.println("unit test : test");
this.getDoc();
//succeed("succeed");
//fail("Not yet implemented"); // TODO
}
}
| [
"[email protected]"
]
| |
dc2953a8ff4166566b992f154690676d65cd1b27 | 04830478a2c88b6d25ebc7462a8c858e3ce586d6 | /src/test/java/com/weborders/pages/ViewAllProductPage.java | 29e5429672c4110dbc3a2b47f69a7f8f17a04ec7 | []
| no_license | MakonB/WebOrdersAutomation2020 | 114f63e2a518582653c1e4674d418f67d07323f6 | 309f5243e5b45173315c269c61293ca09bcc5dc8 | refs/heads/master | 2023-05-12T10:27:05.456544 | 2020-04-05T23:22:25 | 2020-04-05T23:22:25 | 253,297,630 | 0 | 0 | null | 2023-05-09T18:23:14 | 2020-04-05T17:55:53 | Java | UTF-8 | Java | false | false | 94 | java | package com.weborders.pages;
public class ViewAllProductPage extends AbstractPageBase {
}
| [
"[email protected]"
]
| |
c9b60610e4ef6f0f865570e799c80f48953b0770 | f0daa6b19883f22a277af509888ee611eff184c7 | /src/vn/greenglobal/front/service/HeaderService.java | cbf53d41b8dac25989b5a722b445f0fc16af14d2 | []
| no_license | alliwannado1/lasstdemo | f28a03395aa6c0ca9ebe69626a4ae46bb288ed0e | b98ca4077bc7579f31b8b374af62987b52bc95f5 | refs/heads/master | 2020-03-25T13:36:48.793645 | 2018-08-07T07:18:43 | 2018-08-07T07:18:43 | 143,834,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,378 | java | package vn.greenglobal.front.service;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.MapUtils;
import org.zkoss.bind.annotation.Command;
import org.zkoss.zk.ui.Executions;
import vn.toancauxanh.gg.model.DanhMuc;
import vn.toancauxanh.model.NhanVien;
public class HeaderService extends FrontService {
private DanhMuc gioiThieu;
private DanhMuc tinTuc;
private NhanVien user;
public NhanVien getUser() {
if (user == null) {
user = getNhanVien();
}
return user;
}
@Command
public void search() {
String tuKhoa = MapUtils.getString(argDeco(), "tukhoa");
if (tuKhoa != null && !tuKhoa.isEmpty()) {
String param = "";
param = ("".equals(param) ? "" : param + "&") + (tuKhoa != null ? "tukhoa=" + tuKhoa.trim() : "");
Executions.sendRedirect("/timkiem?" + param);
}
}
public boolean isOpen(String resource, String cat) {
if (cat.equals("tintuc")) {
for (DanhMuc each : tinTuc.getChild()) {
if (each.getAlias().equals(resource)) {
return true;
}
}
}
if (cat.equals("gioithieu")) {
for (DanhMuc each : gioiThieu.getChild()) {
if (each.getAlias().equals(resource)) {
return true;
}
}
}
return false;
}
@Override
public void redirectLogin(HttpServletRequest req, HttpServletResponse res) {
// K redirect
}
}
| [
"[email protected]"
]
| |
e30bdb93e42d48bdcab25b92e336d35c56e7c63b | 4a474fad2b5851cb425d968e579efaf9efee7ef4 | /eureka-order/src/main/java/com/sam/eurekaorder/controller/OrderController.java | 703bad72865cbbbab79be013772b8e1ee39d4fa0 | []
| no_license | samteacher/springcloud-repsoitory | 5f52e83ae02ab8a7c743627177aa168f7eb30200 | a6aff49414ce64267110af6a94bc6c148444dc90 | refs/heads/master | 2022-07-07T21:26:50.848034 | 2019-07-04T08:52:52 | 2019-07-04T08:52:52 | 152,039,046 | 0 | 1 | null | 2022-06-29T17:18:56 | 2018-10-08T07:47:06 | Java | UTF-8 | Java | false | false | 871 | java | package com.sam.eurekaorder.controller;
import com.sam.eurekaorder.service.OrderMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
public class OrderController {
@Autowired
private OrderMemberService orderMemberService;
/**
* 消费者
* @return
*/
@RequestMapping("/getOrderUserAll")
public List<String> getOrderUserAll(){
System.out.println("会员服务正在被消费");
return orderMemberService.getOrderUserAll();
}
/**
* 接口网关部分
* @return
*/
@RequestMapping("/gerOrderServiceApi")
public String gerOrderServiceApi(){
return "this is a order 服务工程";
}
}
| [
"[email protected]"
]
| |
edcd41b01941c9e7b4a28a3501003012605e570c | 95bf08a832db97220b651ce64c6c8e7eb8ae9fc8 | /core/src/main/java/ch/dissem/bitmessage/entity/valueobject/InventoryVector.java | 9a3b258dee7a47594940c945462ca9e420c870a2 | [
"Apache-2.0"
]
| permissive | Carcophan/Jabit | ec4cec302997307d055cf95357c4fccd880acebb | 9adbace11c300e34e4e33fab982bc41d3e430061 | refs/heads/master | 2020-05-07T13:40:36.303645 | 2019-04-12T13:36:21 | 2019-04-12T13:36:21 | 180,559,601 | 1 | 0 | Apache-2.0 | 2019-04-10T10:36:45 | 2019-04-10T10:36:45 | null | UTF-8 | Java | false | false | 1,885 | java | /*
* Copyright 2015 Christian Basler
*
* 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 ch.dissem.bitmessage.entity.valueobject;
import ch.dissem.bitmessage.entity.Streamable;
import ch.dissem.bitmessage.utils.Strings;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
import java.nio.ByteBuffer;
import java.util.Arrays;
public class InventoryVector implements Streamable, Serializable {
private static final long serialVersionUID = -7349009673063348719L;
/**
* Hash of the object
*/
private final byte[] hash;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof InventoryVector)) return false;
InventoryVector that = (InventoryVector) o;
return Arrays.equals(hash, that.hash);
}
@Override
public int hashCode() {
return hash == null ? 0 : Arrays.hashCode(hash);
}
public byte[] getHash() {
return hash;
}
public InventoryVector(byte[] hash) {
this.hash = hash;
}
@Override
public void write(OutputStream out) throws IOException {
out.write(hash);
}
@Override
public void write(ByteBuffer buffer) {
buffer.put(hash);
}
@Override
public String toString() {
return Strings.hex(hash).toString();
}
}
| [
"[email protected]"
]
| |
35bb1b5eb23500a2dcb95d74f11dc7acc676e60c | eab408f749f7afa939af5919e1a3998a2b698a54 | /app/src/main/java/com/example/cammovil1/Punto3.java | 6b20bdeac1ce4d392bf9dc94d03c4bc1a088d4f6 | []
| no_license | aleortbas/Taller-1-moviles | d57cbfb3a4108b9ffc3c266b78373ece857a5bc6 | b80300e57258e8f7f84c67b1ab1fdd83dcfe2e7f | refs/heads/master | 2023-07-17T10:09:25.724275 | 2021-08-25T13:12:28 | 2021-08-25T13:12:28 | 398,159,817 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,878 | java | package com.example.cammovil1;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class Punto3 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_punto3);
}
public void calcular(View v){
EditText empleado1 = findViewById(R.id.empleado1);
EditText empleado2 = findViewById(R.id.empleado2);
EditText empleado3 = findViewById(R.id.empleado3);
String emple1 = empleado1.getText().toString();
String emple2 = empleado2.getText().toString();
String emple3 = empleado3.getText().toString();
EditText sal1 = findViewById(R.id.salario1);
EditText sal2 = findViewById(R.id.salario2);
EditText sal3 = findViewById(R.id.salario3);
int sala1 = Integer.parseInt(sal1.getText().toString());
int sala2 = Integer.parseInt(sal2.getText().toString());
int sala3 = Integer.parseInt(sal3.getText().toString());
double aumento1 = (sala1*0.05)+sala1;
double aumento2 = (sala2*0.1)+sala2;
double aumento3 = (sala3*0.25)+sala3;
TextView Aumento1 = (TextView) findViewById(R.id.aumento5);
Aumento1.setText("Nombre: "+emple1 + " Salario: " + aumento1);
TextView Aumento2 = (TextView) findViewById(R.id.aumento10);
Aumento2.setText("Nombre: "+emple2 + "Salario: " + aumento2);
TextView Aumento3 = (TextView) findViewById(R.id.aumento25);
Aumento3.setText("Nombre: "+emple3 + "Salario: " + aumento3);
}
public void atras(View v){
Intent home = new Intent(this,MainActivity.class);
startActivity(home);
}
} | [
"[email protected]"
]
| |
e733b6ba68fc15c138e307059d598444b85a5613 | 3b308a31a11706a6f9a2d783b4ae61964beeb448 | /src/main/java/objects/Breakfast.java | 31ca0f9f94f586fc24ee4ca553e1a284fb4357c4 | []
| no_license | vicadrozdovskaya/testTaskHotels | 3e4cc2008dcb4d013f76f0864db1ddd47cd5714f | 55bc6f260f675a29a54518bf6a50d6ba610f1fe0 | refs/heads/master | 2023-04-30T01:32:48.178058 | 2019-07-21T10:59:01 | 2019-07-21T10:59:30 | 178,192,726 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package objects;
public enum Breakfast {
INCLUDED("breakfast_included"), NOT_INCLUDED("breakfast_not_included");
private String typeBreakfast;
Breakfast (String typeBreakfast) {
this.typeBreakfast = typeBreakfast;
}
public String getTypeBreakfast () {
return typeBreakfast;
}
@Override
public String toString () {
return typeBreakfast;
}
}
| [
"[email protected]"
]
| |
2d7feb9ad41504d5eac3d571d6b92aae12b81522 | f4f8a0f29064a6d753c66622ff015398ecddfd0d | /app/src/main/java/com/test/wordcheck/Model/WordResponse.java | ad0dae1cbbf3e107e167170aa141781b1fb3575a | []
| no_license | savadmv/WordCheckNew | 6f7992635fcce81ba32869c4a7095ed0673cc87d | 39d1b053168bd5231e15d3607da18f258ad3f549 | refs/heads/master | 2020-04-28T20:44:55.310413 | 2019-03-14T12:39:11 | 2019-03-14T12:39:11 | 175,555,161 | 1 | 0 | null | 2019-03-14T07:07:48 | 2019-03-14T05:37:17 | Java | UTF-8 | Java | false | false | 1,392 | java |
package com.test.wordcheck.Model;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class WordResponse {
@SerializedName("word")
@Expose
private String word;
@SerializedName("results")
@Expose
private List<Result> results = null;
@SerializedName("syllables")
@Expose
private Syllables syllables;
@SerializedName("pronunciation")
@Expose
private Pronunciation pronunciation;
@SerializedName("frequency")
@Expose
private Double frequency;
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public List<Result> getResults() {
return results;
}
public void setResults(List<Result> results) {
this.results = results;
}
public Syllables getSyllables() {
return syllables;
}
public void setSyllables(Syllables syllables) {
this.syllables = syllables;
}
public Pronunciation getPronunciation() {
return pronunciation;
}
public void setPronunciation(Pronunciation pronunciation) {
this.pronunciation = pronunciation;
}
public Double getFrequency() {
return frequency;
}
public void setFrequency(Double frequency) {
this.frequency = frequency;
}
}
| [
"[email protected]"
]
| |
684e0a3641b2d441c4c8f104dc149d3f4124a920 | aec2e8026e298c9fe61ae4c75e6229cb5ee30cbd | /FINAL/src/main/java/com/spring/bookmanage/library/JGHservice/JGHLibraryService.java | 5c2d5010e3a8d20343f0a38b481270656fc9c552 | []
| no_license | qweaa11/Ananas2 | 9c68a07d1953af0e411b3501ebb859813aa30223 | 0d64e767ac1bc9be270582ec14a0b8cbaa0ab4c6 | refs/heads/master | 2020-04-17T17:08:54.824986 | 2019-02-19T01:53:24 | 2019-02-19T01:53:24 | 166,764,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | package com.spring.bookmanage.library.JGHservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.spring.bookmanage.library.JGHmodel.JGHLibraryMapper;
@Service
public class JGHLibraryService {
@Autowired private JGHLibraryMapper mapper;
/**
* 스케줄러 실행
*/
public int schedulerRunService() {
int row = mapper.runScheduler();
return row;
}// end of schedulerRunService
} | [
"user1@jeong"
]
| user1@jeong |
364ce5ed1cdd5e3b7ae56f08da10760671723cda | 45975ffad99de6ee95775904b88bafa7a970c96f | /src/main/java/com/mycompany/webapp/dto/Stock.java | 031fb250353338e6f1f10049eb629de9db8a58b8 | []
| no_license | smc5720/Hyundai-ITE-Spring-Midterm-Project | 07841b90cb09f6f8d9630e5fef2355c1d8d52f08 | 8264092a09172ff685f726af47cfc056329de2f3 | refs/heads/master | 2023-08-26T18:20:13.267547 | 2021-10-23T11:31:15 | 2021-10-23T11:31:15 | 364,183,220 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package com.mycompany.webapp.dto;
import lombok.Data;
@Data
public class Stock {
private String scode;
private String sproductcolor;
private String sproductsize;
private int sproductamount;
private String pcode;
}
| [
"[email protected]"
]
| |
507cbc3e2ae68fdd225c777ecf2a07ebaad0662c | 49440c275d9cccde71067a72a2fa494a68391852 | /myschool-server/src/main/java/com/ls/myschool/vo/EClass.java | 890c5fa2f978a3979bfebbf304e7c233e044a007 | []
| no_license | Priyokumar/node-server | 14a3c2269cc29bb52bcaf2d7c07c77fd571b53eb | 1e0d13ed644f5808cf8b9fd27bc105a80ac191e8 | refs/heads/master | 2023-01-23T07:56:53.243967 | 2020-01-12T03:01:11 | 2020-01-12T03:01:11 | 134,413,591 | 0 | 0 | null | 2023-01-07T14:36:28 | 2018-05-22T12:43:53 | JavaScript | UTF-8 | Java | false | false | 425 | java | package com.ls.myschool.vo;
public enum EClass {
NUSSERY("Nussery"), CLASS_I("Class I"), CLASS_II("Class II"), CLASS_III("Class III"), CLASS_IV("Class IV"),
CLASS_V("Class V"), CLASS_VI("Class VI"), CLASS_VII("Class VII"), CLASS_VIII("Class VIII"), CLASS_IX("Class IX"),
CLASS_X("Class X");
private String value;
public String getValue() {
return this.value;
}
EClass(String value) {
this.value = value;
}
}
| [
"[email protected]"
]
| |
0716479454a56313694e8d4944fe9a6689221f09 | d8c556d4f0d921d8ea0650bb6294c2b8ad993c41 | /src/team2659/subsystems/Climber.java | 5b3f88f6d2331d48e68fac37c6f668ba7f4ce868 | []
| no_license | FRCTeam2659/2018-inseason | dd35f6396fd4752ea6ad4aeb82ae93b0ad4a28d3 | 984bc6eb79ccb0fb37c8a8acc1e71765e734175a | refs/heads/master | 2018-11-03T12:28:05.665997 | 2018-09-08T17:07:54 | 2018-09-08T17:07:54 | 112,047,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,355 | java | package team2659.subsystems;
import edu.wpi.first.wpilibj.PWMSpeedController;
import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.command.Subsystem;
import team2659.RobotMap;
public class Climber extends Subsystem {
Solenoid liftCylinder = RobotMap.liftCylinder;
//VictorSPX SC = RobotMap.lifterLeft;
PWMSpeedController SC = RobotMap.climber;
//VictorSPX leftWing = RobotMap.lifterLeft;
//VictorSPX rightWing = RobotMap.lifterRight;
//PWMSpeedController leftWing = RobotMap.lifterLeft;
//PWMSpeedController rightWing = RobotMap.lifterRight;
boolean isActuated = false;
@Override
protected void initDefaultCommand() {
}
public void activate() {
if (!isActuated) {
isActuated = true;
set(-0.3);
Timer.delay(0.15);
set(0);
Timer.delay(.1);
set(1);
Timer.delay(2.4);
set(0);
}
/*liftCylinder.set(true);
leftWing.set(.4);
rightWing.set(.4);
Timer.delay(.6);
disable();
//liftCylinder.set(false);*/
}
public void set(double power) {
//if (isActuated)
SC.set(power);
}
/*public void up() {
if (isActuated)
SC.set(ControlMode.PercentOutput, 1);
}
public void down() {
if (isActuated)
SC.set(ControlMode.PercentOutput, -1);
}*/
public boolean getAcutated() {
return isActuated;
}
public void disable() {
SC.set(0);
}
}
| [
"[email protected]"
]
| |
b1951e48efbecc57c3207ac8fd1b78cee957a78f | 7b3aad782107025658d340f52cf6d51a8373a8b8 | /src/com/jeeplus/modules/audio/web/ATouchController.java | c5114caf0a661787204153981dee6f324653a0ce | []
| no_license | Qifeng-Wu/Showhand | be50c1ba7001394cc1475f6e0dfa2503c07c22f4 | 74108df65d07d317d877b30a9b3728d8c03777a2 | refs/heads/master | 2023-04-05T08:02:37.351805 | 2021-04-11T12:36:57 | 2021-04-11T12:36:57 | 312,972,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,420 | java | package com.jeeplus.modules.audio.web;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.jeeplus.common.config.Global;
import com.jeeplus.common.persistence.Page;
import com.jeeplus.common.web.BaseController;
import com.jeeplus.modules.audio.entity.ATouch;
import com.jeeplus.modules.audio.service.ATouchService;
import com.jeeplus.common.utils.StringUtils;
/**
* 触屏操作Controller
* @author stephen
* @version 2020-5-12
*/
@Controller
@RequestMapping(value = "${adminPath}/audio/touch")
public class ATouchController extends BaseController {
@Autowired
private ATouchService aTouchService;
@ModelAttribute
public ATouch get(@RequestParam(required=false) String id) {
ATouch entity = null;
if (StringUtils.isNotBlank(id)){
entity = aTouchService.get(id);
}
if (entity == null){
entity = new ATouch();
}
return entity;
}
/**
* 列表页面
*/
@RequiresPermissions("audio:touch:list")
@RequestMapping(value = {"list", ""})
public String list(@ModelAttribute("aTouch")ATouch aTouch, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<ATouch> page = aTouchService.findPage(new Page<ATouch>(request, response), aTouch);
model.addAttribute("page", page);
return "modules/audio/touchList";
}
/**
* 查看,增加,编辑表单页面
*/
@RequiresPermissions(value={"audio:touch:view","audio:touch:add","audio:touch:edit"},logical=Logical.OR)
@RequestMapping(value = "form")
public String form(ATouch aTouch, Model model) {
model.addAttribute("aTouch", aTouch);
return "modules/audio/touchForm";
}
/**
* 保存
*/
@RequestMapping(value = "save")
public String save(ATouch aTouch, HttpServletRequest request, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, aTouch)){
return form(aTouch, model);
}
aTouch.setName(request.getParameter("name"));
aTouch.setAudio(request.getParameter("audio"));
aTouchService.customSave(aTouch);
addMessage(redirectAttributes, "保存成功");
return "redirect:"+Global.getAdminPath()+"/audio/touch/?repage";
}
/**
* 删除
*/
@RequiresPermissions("audio:touch:delete")
@RequestMapping(value = "delete")
public String delete(ATouch aTouch, RedirectAttributes redirectAttributes) {
aTouchService.delete(aTouch);
addMessage(redirectAttributes, "删除成功");
return "redirect:"+Global.getAdminPath()+"/audio/touch/?repage";
}
/**
* 批量删除
*/
@RequiresPermissions("audio:touch:delete")
@RequestMapping(value = "deleteAll")
public String deleteAll(String ids, RedirectAttributes redirectAttributes) {
String idArray[] =ids.split(",");
for(String id : idArray){
aTouchService.delete(aTouchService.get(id));
}
addMessage(redirectAttributes, "删除成功");
return "redirect:"+Global.getAdminPath()+"/audio/touch/?repage";
}
} | [
"[email protected]"
]
| |
d03bf618f80c4c622cd8772dbf77ea8970bdc626 | f28a009666b1c3da28860f68955f66c6dd4088dd | /src/main/java/com/group2/repository/TransportRepository.java | f954ec33d69bf8d1e37a6578a405236b1fa1b30f | []
| no_license | HaonTshau/BusLine-SpringBoot-H2 | 6aed9194fe9fbdce0170d04fdd9ff9cc2854c4da | 68943ff8b9485fdc11e57417555e997cc0ea08e4 | refs/heads/master | 2021-12-24T04:03:03.307324 | 2017-09-19T12:50:19 | 2017-09-19T12:50:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package com.group2.repository;
import com.group2.model.Transport;
import org.springframework.data.jpa.repository.JpaRepository;
public interface TransportRepository extends JpaRepository<Transport, Long> {
}
| [
"[email protected]"
]
| |
7c3830ec4c6f757be86ea1a06550f35c761cee93 | 0207e5887754717516020ab1472d70305be2a895 | /src/main/java/ru/spbau/mit/Connection.java | e44dc326bdbafeed1055b7a53f40615b22580531 | []
| no_license | N-buga/spbau-software-design | f284c8d93ae69599bf5f75808d528fd6c2d88a46 | 37cc3c429784b27347f30ba78e3869d086a57ecf | refs/heads/master | 2020-06-13T06:19:49.865785 | 2016-11-30T21:58:07 | 2016-11-30T21:58:07 | 75,422,563 | 0 | 0 | null | 2016-12-02T18:56:41 | 2016-12-02T18:56:41 | null | UTF-8 | Java | false | false | 1,635 | java | package ru.spbau.mit;
import java.io.*;
/**
* The Connection class provides realisation of receiving messages from input stream,
* and sending messages to output stream,
* that is common for client and server
*/
public class Connection {
private DataInputStream inputStream;
private DataOutputStream outputStream;
private boolean isClosed;
private MessagesReceiver messagesReceiver;
public Connection(InputStream inputStream, OutputStream outputStream, MessagesReceiver messengerGUIMain) {
this.inputStream = new DataInputStream(inputStream);
this.outputStream = new DataOutputStream(outputStream);
this.messagesReceiver = messengerGUIMain;
}
/**
* This method receives messages and calls receiver while connection is not closed
*/
public void start() throws IOException {
while (!isClosed) {
int query = inputStream.readInt();
if (query == 1) {
String name = inputStream.readUTF();
String message = inputStream.readUTF();
messagesReceiver.receiveMessage(name, message);
} else {
isClosed = true;
break;
}
}
}
/**
* This method sends message to output stream
*/
public void sendMessage(String name, String message) throws IOException {
outputStream.writeInt(1);
outputStream.writeUTF(name);
outputStream.writeUTF(message);
outputStream.flush();
}
/**
* This method stops connection
*/
public void stop() {
isClosed = true;
}
}
| [
"[email protected]"
]
| |
04efee80789a2ae6ea6838a73b2e00813d28e965 | 4afeccec857e810487145c115f228ef95c439f8d | /leetcode/problem55/JumpGame.java | c18bd7d241eeccfba8dfdfdad3cf758c9f758092 | []
| no_license | Zerxoi/Algorithm | 81135403696c9c30696f5840bced20f21dff745e | 983c400f5b4c51f6d3c8900156acd9a47708b11d | refs/heads/main | 2023-07-18T23:01:28.482862 | 2021-08-30T17:15:02 | 2021-08-30T17:15:02 | 348,571,882 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,504 | java | package leetcode.problem55;
public class JumpGame {
public static void main(String[] args) {
System.out.println(new JumpGame().canJump(new int[] { 2, 3, 1, 1, 4 }));
}
// public boolean canJump(int[] nums) {
// int len = nums.length;
// for (int i = len - 2; i >= 0; i--) { // 最后一个元素无论是多少都可以,因为已经到终点了
// if (nums[i] == 0) { // 如果 i 位置的元素为零,看 i 位置之前有没有一个 j 位置,能够跳过 i 位置
// int j = i - 1;
// while (j >= 0 && nums[j] <= i - j) {
// j--;
// }
// if (j < 0) { // 没有直接返回 false
// return false;
// } else { // 有的话,下次i从j-1(因为for循环有个i--)开始继续
// i = j;
// }
// }
// }
// return true;
// }
// 贪心算法(同45题 跳跃游戏II,只不过加了一个最长长度等于终结长度的判断)
// 时间复杂度 O(N) 空间复杂度 O(1)
public boolean canJump(int[] nums) {
int len = nums.length;
int j = 0;
int longest = 0;
for (int i = 0; i < len - 1; i++) { // 该次跳跃的可选范围[i,j]
longest = Math.max(longest, i + nums[i]);
if (i == j) {
if (longest == j) { // 可选范围都遍历完后发现最长长度还是j,说明跳不出去了
return false;
}
j = longest;
}
}
return true;
}
}
| [
"[email protected]"
]
| |
a0f27ed9906568956156592eac21356916ad591e | 42fc25dee3645ea557c8c3c092b048868a781e5e | /2 Venmo Capstone/module2-capstone-java-team-5/java/tenmo-server/src/main/java/com/techelevator/tenmo/dao/JdbcUserDAO.java | 5776ac34f0a56c2a31e26721f022ebc2cf95af64 | []
| no_license | Garrettjohnson7374/Capstone | 75667ac5ee457f93699965f43c55a3ab06731fdc | be349583b5ac8be785b101fd762c0a85f648ff87 | refs/heads/main | 2023-04-15T11:29:47.509517 | 2021-04-29T01:08:12 | 2021-04-29T01:08:12 | 362,648,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,881 | java | package com.techelevator.tenmo.dao;
import com.techelevator.tenmo.model.User;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.util.ArrayList;
import java.util.List;
@Component
public class JdbcUserDAO implements UserDAO {
private static final BigDecimal STARTING_BALANCE = new BigDecimal("1000.00");
private JdbcTemplate jdbcTemplate;
public JdbcUserDAO(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
@Override
public int findIdByUsername(String username) {
String sql = "SELECT user_id FROM users WHERE username ILIKE ?;";
Integer id = jdbcTemplate.queryForObject(sql, Integer.class, username);
if (id != null) {
return id;
} else {
return -1;
}
}
@Override
public List<User> findAll() {
List<User> users = new ArrayList<>();
String sql = "SELECT users.user_id, users.username, users.password_hash, accounts.account_id FROM users FULL OUTER JOIN accounts ON users.user_id = accounts.user_id";
SqlRowSet results = jdbcTemplate.queryForRowSet(sql);
while(results.next()) {
User user = mapRowToUserWithAccount(results);
users.add(user);
}
return users;
}
@Override
public User findByUsername(String username) throws UsernameNotFoundException {
String sql = "SELECT user_id, username, password_hash FROM users WHERE username ILIKE ?;";
SqlRowSet rowSet = jdbcTemplate.queryForRowSet(sql, username);
if (rowSet.next()){
return mapRowToUser(rowSet);
}
throw new UsernameNotFoundException("User " + username + " was not found.");
}
@Override
public boolean create(String username, String password) {
// create user
String sql = "INSERT INTO users (username, password_hash) VALUES (?, ?) RETURNING user_id";
String password_hash = new BCryptPasswordEncoder().encode(password);
Integer newUserId;
try {
newUserId = jdbcTemplate.queryForObject(sql, Integer.class, username, password_hash);
} catch (DataAccessException e) {
return false;
}
// create account
sql = "INSERT INTO accounts (user_id, balance) values(?, ?)";
try {
jdbcTemplate.update(sql, newUserId, STARTING_BALANCE);
} catch (DataAccessException e) {
return false;
}
return true;
}
public int findAccountIdByUserId(int Id) {
String sql = "SELECT account_id FROM accounts WHERE user_id = ?;";
int result = jdbcTemplate.queryForObject(sql, Integer.class, Id);
return result;
}
private User mapRowToUser(SqlRowSet rs) {
User user = new User();
user.setId(rs.getLong("user_id"));
user.setUsername(rs.getString("username"));
user.setPassword(rs.getString("password_hash"));
user.setActivated(true);
user.setAuthorities("USER");
return user;
} private User mapRowToUserWithAccount(SqlRowSet rs) {
User user = new User();
user.setId(rs.getLong("user_id"));
user.setUsername(rs.getString("username"));
user.setPassword(rs.getString("password_hash"));
user.setAccountId(rs.getLong("account_id"));
user.setActivated(true);
user.setAuthorities("USER");
return user;
}
}
| [
"[email protected]"
]
| |
f4cb6a0af658274db38e84bdf6030082aa94e27d | b9a3860622a88cb4a825c45870b8d95a901581d5 | /Spring06_TestAop01_Test/src/com/test01/Person.java | d315c2f8bade5f8504137946145a87c91478771a | []
| no_license | KOKOPA/Spring_Study | de1a51f7091672c37f899b6a9cbd63cdcdbf2e63 | 1a67765c5345a027d28beb645b856eedbfdb3eb0 | refs/heads/master | 2022-12-26T16:27:26.760596 | 2019-09-03T12:46:52 | 2019-09-03T12:46:52 | 203,728,437 | 0 | 0 | null | 2022-12-16T01:03:26 | 2019-08-22T06:26:40 | Java | UTF-8 | Java | false | false | 638 | java | package com.test01;
public class Person implements Human {
protected String name;
protected String job;
public Person() {}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
@Override
public String sayName(String name) {
System.out.println("나의 이름은 " + name + " 입니다.");
return "직업이 무엇입니까?";
}
@Override
public String sayJob(String job) {
return "나의 직업은 " + job + " 입니다.";
}
}
| [
"user2@user2-PC"
]
| user2@user2-PC |
c47e0318852abd1141426a97d1d3cec0231b2ff5 | e497bc4c356c4b4d15deb28f12f4ad802f0ac8d6 | /lab3/src/it/polito/dp2/NFFG/sol3/service/resource/NffgsResource.java | 12ec02bd0732d07a0ac1fac11c8ebd4d69e14f28 | []
| no_license | sia4/dp2_labs | f058dcb337d41717043a7d7b01eaf300db90d5f6 | 7dda35094c3854c4d47c90300105752c8e3b064e | refs/heads/master | 2020-03-20T07:11:23.243771 | 2018-06-14T08:14:37 | 2018-06-14T08:14:37 | 137,273,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,064 | java | package it.polito.dp2.NFFG.sol3.service.resource;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import it.polito.dp2.NFFG.sol3.service.NffgService;
import it.polito.dp2.NFFG.sol3.service.generated.model.Nffgs;
@Path("/nffgs")
@Api(value = "/nffgs", description = "A collection of Nffgs")
public class NffgsResource {
NffgService service = new NffgService();
@GET
@ApiOperation(value = "Get all the Nffgs")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "OK"),
@ApiResponse(code = 204, message = "The service is empty"),
@ApiResponse(code = 500, message = "Internal Server Error")})
@Produces( { MediaType.APPLICATION_XML})
public Nffgs getNffgs() {
return service.getAllNffgs();
}
}
| [
"[email protected]"
]
| |
4a32367d3ff8b7d33a43d211ee39c40de949c968 | d1b49fdba71e6ee8ef93c4cddc1be5e8d64573ec | /src/main/java/com.alaska/HelloWorld.java | 5a8d86924212a037e7a48b32c50ee653602a242c | []
| no_license | Laoshuaitou-AlaSKa/personal-study | 4463b10fe8aa7221aea8338a9b3769b7967442f5 | eb098d807f38da0089ce24211a2d1bf6490c3800 | refs/heads/master | 2020-05-23T10:27:36.923605 | 2019-05-22T06:07:42 | 2019-05-22T06:07:42 | 186,719,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.alaska;
/**
* 功能描述:
*
* @ClassName: HelloWorld
* Workstation:AlaSKa_
* @Author: Laoshuaitou-AlaSKa
* @Date: 2019/5/22 13:43
* @Version:0.1
*/
public class HelloWorld {
public void hello(){
System.out.println("HelloWorld1");
}
public static void main(String[] args) {
HelloWorld helloWorld = new HelloWorld();
helloWorld.hello();
}
}
| [
"[email protected]"
]
| |
c678871014252b852b322ac6294d5fa87d42701f | 988121d3a4148a65f09be2c1e0dde08f063db3da | /sdks/java/io/sparkreceiver/src/test/java/org/apache/beam/sdk/io/sparkreceiver/CustomReceiverWithOffset.java | 6bba7bee9af3be857da265c4a60676c38bb15893 | [
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-protobuf",
"Apache-2.0",
"Python-2.0"
]
| permissive | lukecwik/incubator-beam | 4dfb03b4efb5e302e1ad1c77f91e298f9a2b9e05 | e8559c4eb9358e57ebe74652858191f1bddf65bd | refs/heads/master | 2023-08-29T09:16:41.460308 | 2022-10-28T23:19:00 | 2022-10-28T23:19:00 | 52,895,685 | 3 | 1 | Apache-2.0 | 2023-09-14T10:35:56 | 2016-03-01T17:24:29 | Java | UTF-8 | Java | false | false | 2,933 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.beam.sdk.io.sparkreceiver;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.spark.storage.StorageLevel;
import org.apache.spark.streaming.receiver.Receiver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Imitation of Spark {@link Receiver} that implements {@link HasOffset} interface. Used to test
* {@link SparkReceiverIO#read()}.
*/
public class CustomReceiverWithOffset extends Receiver<String> implements HasOffset {
private static final Logger LOG = LoggerFactory.getLogger(CustomReceiverWithOffset.class);
private static final int TIMEOUT_MS = 500;
public static final int RECORDS_COUNT = 20;
/*
Used in test for imitation of reading with exception
*/
public static boolean shouldFailInTheMiddle = false;
private Long startOffset;
CustomReceiverWithOffset() {
super(StorageLevel.MEMORY_AND_DISK_2());
}
@Override
public void setStartOffset(Long startOffset) {
if (startOffset != null) {
this.startOffset = startOffset;
}
}
@Override
@SuppressWarnings("FutureReturnValueIgnored")
public void onStart() {
Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().build()).submit(this::receive);
}
@Override
public void onStop() {}
@Override
public Long getEndOffset() {
return Long.MAX_VALUE;
}
private void receive() {
Long currentOffset = startOffset;
while (!isStopped()) {
if (currentOffset < RECORDS_COUNT) {
if (shouldFailInTheMiddle && currentOffset == RECORDS_COUNT / 2) {
shouldFailInTheMiddle = false;
LOG.debug("Expected fail in the middle of reading");
throw new IllegalStateException("Expected exception");
}
store(String.valueOf(currentOffset));
currentOffset++;
} else {
break;
}
try {
TimeUnit.MILLISECONDS.sleep(TIMEOUT_MS);
} catch (InterruptedException e) {
LOG.error("Interrupted", e);
}
}
}
}
| [
"[email protected]"
]
| |
d5e160525fb2afa197889e269d05b957ea640deb | ffa559c91932d55c8bdf7b59e3f7ce0f7defe839 | /src/main/java/com/example/PraksaDrustvenaMreza/model/Post.java | e6cb474d4e41953c7fc62b426f1954f13f562fbd | []
| no_license | Svetozar99/DrustvenaMrezaBackend | c5c73678e8d583263b400bb744ed62dec23efdbd | c78533e4f15fb08044144bfcb3721c0106fe5a70 | refs/heads/main | 2023-08-26T09:56:56.948796 | 2021-11-08T19:22:44 | 2021-11-08T19:22:44 | 422,962,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 553 | java | package com.example.PraksaDrustvenaMreza.model;
import lombok.*;
import java.util.List;
import javax.persistence.*;
@Entity
@Table(name="post")
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
public class Post extends JpaEntity{
@Column(name = "body", nullable = false)
private String body;
@ManyToOne
@JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false)
private User user;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "post")
private List<Comment> comments;
}
| [
"[email protected]"
]
| |
00335f93c121025c587102c00615cf230ff5fc1e | c43789206c33f8a2e529dddcf532f91f99c3e892 | /views/FrmInicio.java | 6ce90d2d6a80c6bf181b49d1725a0ac378cee560 | []
| no_license | karlaMtz156758/PatronesDeDise-oDeSoftware- | ee3030eb1a2a8385f9b6290d2d6b32451363c372 | 41a54400b8d12200bee775181f9ce51f9e6cee2c | refs/heads/master | 2020-05-24T14:57:15.422123 | 2019-05-18T05:58:30 | 2019-05-18T05:58:30 | 187,320,129 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 8,750 | 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 views;
/**
*
* @author Karla Michell Martínez de la torre ID 156758 */
public class FrmInicio extends javax.swing.JFrame {
/**
* Creates new form FrmInicio
*/
public FrmInicio() {
initComponents();
}
/**
* 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();
lb_titulo = new javax.swing.JLabel();
btn_transferencia = new javax.swing.JButton();
btn_retirar1 = new javax.swing.JButton();
btn_deposito = new javax.swing.JButton();
btn_salir = new javax.swing.JButton();
txt_monto = new javax.swing.JTextField();
btn_realizar = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
lb_titulo.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N
lb_titulo.setText("Bienvenido ...");
btn_transferencia.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
btn_transferencia.setText("Transferencia");
btn_retirar1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
btn_retirar1.setText("Retirar");
btn_deposito.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
btn_deposito.setText("Deposito");
btn_salir.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
btn_salir.setText("Salir");
txt_monto.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
btn_realizar.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
btn_realizar.setText("Realizar");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(54, 54, 54)
.addComponent(lb_titulo, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
.addGap(42, 42, 42))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(36, 36, 36)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btn_transferencia, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn_retirar1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn_deposito, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btn_salir, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txt_monto, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(32, 32, 32))
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btn_realizar, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(34, 34, 34)
.addComponent(lb_titulo, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(59, 59, 59)
.addComponent(btn_retirar1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn_transferencia)
.addComponent(txt_monto, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_deposito)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_salir))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(btn_realizar)))
.addContainerGap(80, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @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(FrmInicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FrmInicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FrmInicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FrmInicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FrmInicio().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
public javax.swing.JButton btn_deposito;
public javax.swing.JButton btn_realizar;
public javax.swing.JButton btn_retirar1;
public javax.swing.JButton btn_salir;
public javax.swing.JButton btn_transferencia;
private javax.swing.JPanel jPanel1;
public javax.swing.JLabel lb_titulo;
public javax.swing.JTextField txt_monto;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
efd07f97fc35552e0e0f3aa886578a16598943e6 | 2c229007e12ca1b027e0afcb9e44105cbfe38b7f | /main/java/edu/uspg/exception/ResponseExceptionHandler.java | fcc441af0487988856ca730c69e5c79fd861abbc | []
| no_license | JustinPiche/restaurante-1 | 6ac00814bc6c928deefac1a65a54ac76f1788ef7 | f4cedda20ff29c37976f7ec527e58ded6eccb992 | refs/heads/main | 2023-05-10T01:51:03.265357 | 2021-06-12T04:58:31 | 2021-06-12T04:58:31 | 376,204,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,960 | java | package edu.uspg.exception;
import java.util.Date;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
@ControllerAdvice
@RestController
public class ResponseExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(Exception.class)
public final ResponseEntity<Object> manejarTodasExcepciones(Exception ex, WebRequest request){
ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), ex.getMessage(), request.getDescription(false));
return new ResponseEntity(exceptionResponse, HttpStatus.INTERNAL_SERVER_ERROR);
}
@ExceptionHandler(ModeloNotFoundException.class)
public final ResponseEntity<Object> manejarModeloExcepciones(ModeloNotFoundException ex, WebRequest request){
ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), ex.getMessage(),
request.getDescription(false));
return new ResponseEntity(exceptionResponse, HttpStatus.NOT_FOUND);
}
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex,
HttpHeaders headers, HttpStatus status, WebRequest request){
String errores = "";
for(ObjectError e : ex.getBindingResult().getAllErrors()) {
errores += e.getObjectName();
}
ExceptionResponse exceptionResponse = new ExceptionResponse(new Date(), "Validación Fallida", errores);
return new ResponseEntity(exceptionResponse, HttpStatus.BAD_REQUEST);
}
} | [
"[email protected]"
]
| |
5914028d30307deeedb78af9bec69ed16e954c80 | 49c62d4be36245575466cc74aa303a9f28c5c24f | /WeekB/src/com/revature/collections/CollectionsDemo.java | d183bdc4654e2ea2e23b08054e286edf94bf9a7f | []
| no_license | Jolie-G/demo-reference | ed748453838ef7c6ad96a6c210fd630f2e8336df | 59b4b511766b864059fc562a228a87e2e2f05234 | refs/heads/master | 2020-07-02T11:41:21.758291 | 2019-08-08T16:13:18 | 2019-08-08T16:13:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,364 | java | package com.revature.collections;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.Vector;
import com.revature.model.User;
public class CollectionsDemo {
public static void main(String[] args) {
funWithIterator();
}
public static void funWithIterator() {
// initialize a Collection (extends Iterable interface)
Set<User> userSet = new HashSet<>();
userSet.add(new User("Gandalf", "Grey", "mithrandir", "you_shall_not"));
userSet.add(new User("Paul", "Hewson", "bono", "u2RuleZ"));
userSet.add(new User("David", "Tennant", "doc10", "tardis"));
/*
* Iterator:
*
* -Iterable is an interface which is extended by Collection
* -Iterable provides methods for easy traversal of any concrete subtype
* -defines iterator() method, which return an Iterator
* -Iterator has methods .next(), .hasNext(), .remove()
* -using the Iterator allows us to safely remove elements in place and traverse multiple Collections at once
*
* https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html
*/
Iterator<User> userIterator = userSet.iterator();
// use hasNext() method (returns a boolean) as the condition for a while loop
while(userIterator.hasNext()) {
User u = userIterator.next(); // next() returns the next element, and steps forward the position of the iterator
// could use remove() to remove elements from the Collection (filtering a Collection)
System.out.println(u);
}
}
public static void funWithMaps() {
/*
* Map:
*
* -object which maps keys to values
* -no duplicate keys
* -every key may map to at most one value
* -most implementations allow keys to be null
*
* https://docs.oracle.com/javase/8/docs/api/java/util/Map.html
*/
Map<String, String> credentialsMap = new HashMap<>();
credentialsMap.put("mithrandir", "you_shall_not");
credentialsMap.put(null, ""); // is fine, as long as there is only one null key
credentialsMap.put("bono", null); // null values are fine, any number of keys may have null values
credentialsMap.put("bono2", null);
credentialsMap.put("doc10", "tardis");
// retrieve objects by their keys
System.out.println(credentialsMap.get("doc10"));
// iterate through the map
for (Map.Entry<String, String> entry : credentialsMap.entrySet()) {
System.out.println("Key: "+entry.getKey()+", Value: "+entry.getValue());
}
}
public static void funWithQueues() {
/*
* Queue:
*
* -typically for holding elements while waiting to process them
* -provides methods for adding, removing, and, inspecting elements
* -two versions for each of these behaviors: one which throws an exception if the operation fails,
* and one which does not.
* -FIFO (first-in, first-out, except for PriorityQueue, which uses a Comparator or elements' natural ordering
* -duplicates are allowed
*
* https://docs.oracle.com/javase/8/docs/api/java/util/Queue.html
*/
Queue<User> userQueue = new LinkedList<>();
User u1 = new User("Gandalf", "Grey", "mithrandir", "you_shall_not");
User u2 = new User("Paul", "Hewson", "bono", "u2RuleZ");
User u3 = new User("David", "Tennant", "doc10", "tardis");
userQueue.add(u1);
userQueue.add(u2);
userQueue.add(u3);
userQueue.add(u1);
while (userQueue.size() != 0) {
System.out.println("Queue size: "+userQueue.size());
System.out.println("Processing: "+ userQueue.poll()); // removes and returns head of queue
}
}
public static void funWithSets() {
/*
* Set:
*
* -Sets are not ordered
* -Duplicate elements are not allowed
* -Two sets are equal if they have the same elements (enforced by equals() and hashcode() implementations)
*
* https://docs.oracle.com/javase/8/docs/api/java/util/Set.html
*/
Set<User> userSet = new HashSet<>();
User u1 = new User("Gandalf", "Grey", "mithrandir", "you_shall_not");
User u2 = new User("Paul", "Hewson", "bono", "u2RuleZ");
User u3 = new User("David", "Tennant", "doc10", "tardis");
userSet.add(u1);
userSet.add(u2);
userSet.add(u3);
// no duplicates... addition of duplicate elements will be ignored.
userSet.add(u1); // same object (according to ==) as an existing element
User u4 = new User("David", "Tennant", "doc10", "tardis");
userSet.add(u4); // different object (according to ==) with the same fields as an existing element
// both are ignored, it's the .equals() comparison that's being used (equality, not identity)
for (User user : userSet) {
System.out.println(user);
}
// notice that insertion order is ignored!
}
public static void funWithLists() {
/*
* List:
*
* -Lists are ordered Collections -Duplicate elements are allowed
*
* Some additional List features (beyond methods defined in Collection):
* -Positional access: access/manipulate elements based on position in List
* -Search: search for an element and retrieve its numerical position
* -Iteration: listIterator() expands on capabilities of Iterator -Range-view:
* access/manipulate subsets of the List
*
* https://docs.oracle.com/javase/8/docs/api/java/util/List.html
*
*/
List<User> users = new ArrayList<>();
// generally want to use the supertype of whatever Collection
// User is the type of each element in the List, replaces the generic type
// parameter in List<E> specification
User u1 = new User("Gandalf", "Grey", "mithrandir", "you_shall_not");
User u2 = new User("Paul", "Hewson", "bono", "u2RuleZ");
User u3 = new User("David", "Tennant", "doc10", "tardis");
users.add(u1);
users.add(u2);
users.add(u3);
// we have a addAll() method, but it takes a Collection
// duplicates are allowed, so the following should work:
users.add(u1);
for (User user : users) {
System.out.println(user);
}
System.out.println("Size of list: " + users.size());
System.out.println("---------------------------------------------------------");
// List of Integers
List<Integer> integerList = new Vector<>();
// must use wrapper class Integer
// wrapper class - datatype which wraps around a primitive value
// every primitive datatype has a corresponding wrapper class
integerList.add(10); // implicitly converting from int (primitive) to Integer (Object). This is
// called autoboxing
integerList.add(-255);
integerList.add(new Integer(9)); // this is NOT autoboxing!
integerList.add(75);
integerList.add(-12);
System.out.println("integer list, in insertion order");
for (Integer integer : integerList) {
System.out.println(integer);
}
/*
* Collections utility class has static methods for operating on Collection
* objects.
*
* sort() method:
* must be used with a Collection of Comparable elements
* (or be provided a Comparator for that datatype)
*/
Collections.sort(integerList);
System.out.println("integer list, sorted");
for (Integer integer : integerList) {
System.out.println(integer);
}
System.out.println("---------------------------------------------------------");
}
}
| [
"[email protected]"
]
| |
e2c7272246d8e73ed84b57a56c4e7ba6f675b143 | 6c3d07a33d89494b36d1f44a6117503fec984090 | /app/src/main/java/com/example/miranlee/lifewithaac/MyAACDB.java | f3db04dc548fea2179c4a8d8266c88aa94c810a0 | []
| no_license | miraniyam/LifeWithAAC | b5a54a2db98e4de511eea9ea93ed0179b0f21c21 | a01d9648c04dadff4ed6fc89599413a7eb3302b2 | refs/heads/master | 2020-12-30T12:22:36.811987 | 2017-06-20T07:44:31 | 2017-06-20T07:44:31 | 91,421,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 972 | java | package com.example.miranlee.lifewithaac;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by hojingong on 2017. 6. 7..
*/
public class MyAACDB extends SQLiteOpenHelper{
public static final String DB_NAME = "MyAAC.db";
public static final int DB_VERSION=1;
public MyAACDB(Context context){
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS");
onCreate(sqLiteDatabase);
}
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
sqLiteDatabase.execSQL("CREATE TABLE if not exists MyAAC(voice TEXT, img BLOB, txt TEXT);");
}
public void delete(){
SQLiteDatabase db = getWritableDatabase();
db.execSQL("DELETE FROM MyAAC;");
db.close();
}
}
| [
"[email protected]"
]
| |
e84761c5a2d4db819e3d0154d691cce2e4e2ce36 | 67a90c46242fa143f25a4bc70660059650ae876c | /app/src/main/java/com/example/compuworld/learnforkids/Qd7Activity.java | ca5ae2e357bd6aaf41daff81a4d1ab61a6b35578 | []
| no_license | AhmedAbdallah125/AppAppliction | d7045b638acfd29a7c90d7675b089d21ad19e26c | cc6b3737923319b56d57c496ae9d0577642957ef | refs/heads/master | 2021-01-16T10:59:16.028504 | 2020-02-25T22:33:17 | 2020-02-25T22:33:17 | 243,092,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,436 | java | package com.example.compuworld.learnforkids;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import android.app.LoaderManager;
import android.content.ContentValues;
import android.content.CursorLoader;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Loader;
import android.database.Cursor;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.compuworld.learnforkids.data.PetContract.PetEntry;
import com.example.compuworld.learnforkids.data.PetProvider;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.MobileAds;
import com.google.android.gms.ads.initialization.InitializationStatus;
import com.google.android.gms.ads.initialization.OnInitializationCompleteListener;
import com.google.android.gms.ads.reward.RewardItem;
import com.google.android.gms.ads.reward.RewardedVideoAd;
import com.example.compuworld.learnforkids.data.PetContract.PetEntry;
import com.google.android.gms.ads.reward.RewardedVideoAdListener;
@SuppressWarnings("ALL")
public class Qd7Activity extends program implements
LoaderManager.LoaderCallbacks<Cursor>, RewardedVideoAdListener {
private static final int PET_LOADER = 0;
TextView first;
TextView second;
TextView third;
TextView question;
TextView solText;
TextView mtrys;
private RewardedVideoAd mRewardedVideoAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qd7);
MobileAds.initialize(this, "ca-app-pub-8871183720829585~8202918105");
MobileAds.initialize(this, new OnInitializationCompleteListener() {
@Override
public void onInitializationComplete(InitializationStatus initializationStatus) {
}
});
// for rewarding video
// Use an activity context to get the rewarded video instance.
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
mRewardedVideoAd.setRewardedVideoAdListener(this);
mRewardedVideoAd.loadAd("ca-app-pub-3940256099942544/5224354917",new AdRequest.Builder().build());
// for banner advertisment
AdView adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111");
// TODO: Add adView to your view hierarchy.
adView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
TextView backmain = (TextView) findViewById(R.id.back);
question = (TextView) findViewById(R.id.question);
first = (TextView) findViewById(R.id.first);
second = (TextView) findViewById(R.id.second);
third = (TextView) findViewById(R.id.third);
solText = findViewById(R.id.solv);
mtrys =(TextView) findViewById(R.id.trys);
// Kick off the loader
backmain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View e) {
mRewardedVideoAd.loadAd("",new AdRequest.Builder().build());
startActivity(new Intent(Qd7Activity.this,GroupDActivity.class));
finish();
}
});
getLoaderManager().initLoader(PET_LOADER, null, this);
}
@Override
protected void onResume() {
// mRewardedVideoAd.resume(this);
super.onResume();
getBaseContext().getContentResolver().notifyChange(PetEntry.CONTENT_URI, null);
}
@Override
public void onPause() {
// mRewardedVideoAd.pause(this);
super.onPause();
}
@Override
public void onDestroy() {
// mRewardedVideoAd.destroy(this);
super.onDestroy();
}
@Override
public void onBackPressed() {
super.onBackPressed();
mRewardedVideoAd.loadAd("",new AdRequest.Builder().build());
startActivity(new Intent(Qd7Activity.this,GroupDActivity.class));
finish();
}
@Override
protected void onStart() {
getBaseContext().getContentResolver().notifyChange(PetEntry.CONTENT_URI, null);
// for rewarding video
// Use an activity context to get the rewarded video instance.
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
mRewardedVideoAd.setRewardedVideoAdListener(this);
mRewardedVideoAd.loadAd("ca-app-pub-3940256099942544/5224354917",new AdRequest.Builder().build());
super.onStart();
question.setText("الصحابى الملقب بحبر الامه وترجمان القران ....");
first.setText("عبد الله بن عباس رضى الله عنه");
second.setText("ابو عبيده بن الجراح رضى الله عنه ");
third.setText("عبد الله بن عمر رضى الله عنهما");
// rewarding vido
mtrys.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View e) {
if(mRewardedVideoAd.isLoaded()){
mRewardedVideoAd.show();
}
else {
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, close the current activity.
}
};
// Show dialog that there are unsaved changes
noHelpedAvailable(discardButtonClickListener);
}
}
});if(tr>0) {
if(tr>2){
solText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View e) {
tr=tr-2;
va=1;
vb=1;
ContentValues values = new ContentValues();
values.put(PetEntry.PET_COLUMN_NAME, tr);
values.put(PetEntry.PET_COLUMN_VA, va);
values.put(PetEntry.PET_COLUMN_VB, vb);
getContentResolver().update(PetEntry.CONTENT_URI, values, null, null);
second.setVisibility(View.INVISIBLE);
third.setVisibility(View.INVISIBLE);
}
});
}
if (score == 66) {
first.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(view.getContext(), "اجابه صحيحه" + "\n" + "يمكنك الذهاب للسؤال التالى", Toast.LENGTH_SHORT).show();
score++;
va=0;
vb=0;
ContentValues values = new ContentValues();
values.put(PetEntry.PET_COLUMN_SCORE, score);
values.put(PetEntry.PET_COLUMN_VA, va);
values.put(PetEntry.PET_COLUMN_VB, vb);
getContentResolver().update(PetEntry.CONTENT_URI, values, null, null);
mRewardedVideoAd.loadAd("",new AdRequest.Builder().build());
startActivity(new Intent(Qd7Activity.this, Qd8Activity.class));
finish();
}
});
if(va==0) {
third.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
tr = tr - 1;
va++;
ContentValues values = new ContentValues();
values.put(PetEntry.PET_COLUMN_NAME, tr);
values.put(PetEntry.PET_COLUMN_VA, va);
getContentResolver().update(PetEntry.CONTENT_URI, values, null, null);
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, close the current activity.
}
};
third.setVisibility(View.INVISIBLE);
// Show dialog that there are unsaved changes
showWrongAnswer(discardButtonClickListener);
onStart();
}
});
}
else{
third.setVisibility(View.INVISIBLE);
}
if(vb==0){
second.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
tr = tr - 1;
vb++;
ContentValues values = new ContentValues();
values.put(PetEntry.PET_COLUMN_NAME, tr);
values.put(PetEntry.PET_COLUMN_VB, vb);
getContentResolver().update(PetEntry.CONTENT_URI, values, null, null);
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, close the current activity.
}
};
second.setVisibility(View.INVISIBLE);
// Show dialog that there are unsaved changes
showWrongAnswer(discardButtonClickListener);
onStart();
}
});
}else {
second.setVisibility(View.INVISIBLE);
}
}
} else{
first.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View e) {
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, close the current activity.
}
};
// Show dialog that there are unsaved changes
gone(discardButtonClickListener);
}
});
second.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View e) {
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, close the current activity.
}
};
// Show dialog that there are unsaved changes
gone(discardButtonClickListener);
}
});
third.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View e) {
DialogInterface.OnClickListener discardButtonClickListener =
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
// User clicked "Discard" button, close the current activity.
}
};
// Show dialog that there are unsaved changes
gone(discardButtonClickListener);
}
});
}
if(score>66){
first.setBackgroundColor(Color.parseColor("#FFC107"));
second.setBackgroundColor(Color.parseColor("#FFECB3"));
third.setBackgroundColor(Color.parseColor("#FFECB3"));
solText.setVisibility(View.INVISIBLE);
solText.setBackgroundColor(Color.parseColor("#000000"));
}
}
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
// Define a projection that specifies the columns from the table we care about.
String[] projection = {
PetEntry.PET_COLUMN_NAME,
PetEntry.PET_COLUMN_SCORE,
PetEntry.PET_COLUMN_VA,
PetEntry.PET_COLUMN_VB
};
// This loader will execute the ContentProvider's query method on a background thread
return new CursorLoader(this, // Parent activity context
PetEntry.CONTENT_URI, // Provider content URI to query
projection, // Columns to include in the resulting Cursor
null, // No selection clause
null, // No selection arguments
null); // Default sort order
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
int scoreIndex =cursor.getColumnIndex(PetEntry.PET_COLUMN_SCORE);
int nameIndex = cursor.getColumnIndex(PetEntry.PET_COLUMN_NAME);
int vaIndex = cursor.getColumnIndex(PetEntry.PET_COLUMN_VA);
int vbIndex = cursor.getColumnIndex(PetEntry.PET_COLUMN_VB);
while (cursor.moveToNext()) {
int cureentscore = cursor.getInt(scoreIndex);
tr =cursor.getInt(nameIndex);
score = cureentscore;
mtrys.setText("+" + ""+String.valueOf(tr));
va = cursor.getInt(vaIndex);
vb =cursor.getInt(vbIndex);
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
}
@Override
public void onRewarded(RewardItem reward) {
// Reward the user.
tr++;
ContentValues values = new ContentValues();
values.put(PetEntry.PET_COLUMN_NAME, tr);
getContentResolver().update(PetEntry.CONTENT_URI, values, null, null);
onStart();
Toast.makeText(this,"حصلت على محاوله جديده",Toast.LENGTH_SHORT).show();
}
@Override
public void onRewardedVideoAdLeftApplication() {
}
@Override
public void onRewardedVideoAdClosed() {
}
@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
}
@Override
public void onRewardedVideoAdLoaded() {
mtrys.setEnabled(true);
}
@Override
public void onRewardedVideoAdOpened() {
}
@Override
public void onRewardedVideoStarted() {
}
@Override
public void onRewardedVideoCompleted() {
}
}
| [
"[email protected]"
]
| |
3923394bb45de4e88c1931b8a891ab7216a41e37 | 56026427d469a3104a69cb0e6977bb329adf3266 | /app/src/test/java/com/example/asus/scorekeeper/ExampleUnitTest.java | 2ab7753ce70fbe945b8b5752eeb9d1034905f38f | []
| no_license | mmagdaadamczak/PizzaGame | cb9634316b0e587d919d4c3f651b11723d9c8c0d | d4b8d6d2a5b10aab67b84a5ee0c0fdfbdc1e3115 | refs/heads/master | 2021-04-27T08:04:07.807053 | 2018-02-25T13:07:18 | 2018-02-25T13:07:18 | 120,105,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package com.example.asus.scorekeeper;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals ( 4, 2 + 2 );
}
} | [
"[email protected]"
]
| |
0d2891d18b41cb661d193e30c96534c857eb6d32 | 6392035b0421990479baf09a3bc4ca6bcc431e6e | /projects/hazelcast-76d7f5e3/curr/hazelcast-client/src/test/java/com/hazelcast/client/test/TestClientRegistry.java | 3c7ff40bf53671f9b641e1acf4f11bf5936ed7f5 | []
| no_license | ameyaKetkar/RMinerEvaluationTools | 4975130072bf1d4940f9aeb6583eba07d5fedd0a | 6102a69d1b78ae44c59d71168fc7569ac1ccb768 | refs/heads/master | 2020-09-26T00:18:38.389310 | 2020-05-28T17:34:39 | 2020-05-28T17:34:39 | 226,119,387 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 12,360 | java | /*
* Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.client.test;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientAwsConfig;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.client.connection.AddressTranslator;
import com.hazelcast.client.connection.ClientConnectionManager;
import com.hazelcast.client.connection.nio.ClientConnection;
import com.hazelcast.client.connection.nio.ClientConnectionManagerImpl;
import com.hazelcast.client.impl.ClientServiceFactory;
import com.hazelcast.client.impl.HazelcastClientInstanceImpl;
import com.hazelcast.client.spi.impl.AwsAddressTranslator;
import com.hazelcast.client.spi.impl.DefaultAddressTranslator;
import com.hazelcast.core.HazelcastException;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.instance.MemberImpl;
import com.hazelcast.instance.Node;
import com.hazelcast.instance.TestUtil;
import com.hazelcast.logging.ILogger;
import com.hazelcast.logging.Logger;
import com.hazelcast.nio.Address;
import com.hazelcast.nio.Connection;
import com.hazelcast.nio.ConnectionType;
import com.hazelcast.nio.Packet;
import com.hazelcast.nio.SocketWritable;
import com.hazelcast.spi.impl.NodeEngineImpl;
import com.hazelcast.test.TestNodeRegistry;
import com.hazelcast.util.ExceptionUtil;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.util.logging.Level;
public class TestClientRegistry {
private static final ILogger LOGGER = Logger.getLogger(HazelcastClient.class);
private final TestNodeRegistry nodeRegistry;
public TestClientRegistry(TestNodeRegistry nodeRegistry) {
this.nodeRegistry = nodeRegistry;
}
ClientServiceFactory createClientServiceFactory(Address clientAddress) {
return new MockClientServiceFactory(clientAddress);
}
private class MockClientServiceFactory implements ClientServiceFactory {
private final Address clientAddress;
public MockClientServiceFactory(Address clientAddress) {
this.clientAddress = clientAddress;
}
@Override
public ClientConnectionManager createConnectionManager(ClientConfig config, HazelcastClientInstanceImpl client) {
final ClientAwsConfig awsConfig = config.getNetworkConfig().getAwsConfig();
AddressTranslator addressTranslator;
if (awsConfig != null && awsConfig.isEnabled()) {
try {
addressTranslator = new AwsAddressTranslator(awsConfig);
} catch (NoClassDefFoundError e) {
LOGGER.log(Level.WARNING, "hazelcast-cloud.jar might be missing!");
throw e;
}
} else {
addressTranslator = new DefaultAddressTranslator();
}
return new MockClientConnectionManager(client, addressTranslator, clientAddress);
}
}
private class MockClientConnectionManager extends ClientConnectionManagerImpl {
private final Address clientAddress;
private final HazelcastClientInstanceImpl client;
public MockClientConnectionManager(HazelcastClientInstanceImpl client, AddressTranslator addressTranslator,
Address clientAddress) {
super(client, addressTranslator);
this.client = client;
this.clientAddress = clientAddress;
}
@Override
protected void initializeSelectors(HazelcastClientInstanceImpl client) {
}
@Override
protected void startSelectors() {
}
@Override
protected void shutdownSelectors() {
}
@Override
protected ClientConnection createSocketConnection(Address address) throws IOException {
if (!alive) {
throw new HazelcastException("ConnectionManager is not active!!!");
}
try {
HazelcastInstance instance = nodeRegistry.getInstance(address);
if (instance == null) {
throw new IOException("Can not connected to " + address + ": instance does not exist");
}
Node node = TestUtil.getNode(instance);
return new MockedClientConnection(client, connectionIdGen.incrementAndGet(),
node.nodeEngine, address, clientAddress);
} catch (Exception e) {
throw ExceptionUtil.rethrow(e, IOException.class);
}
}
}
private class MockedClientConnection extends ClientConnection {
private volatile long lastReadTime;
private volatile long lastWriteTime;
private final NodeEngineImpl serverNodeEngine;
private final Address remoteAddress;
private final Address localAddress;
private final Connection serverSideConnection;
public MockedClientConnection(HazelcastClientInstanceImpl client, int connectionId, NodeEngineImpl serverNodeEngine,
Address address, Address localAddress) throws IOException {
super(client, connectionId);
this.serverNodeEngine = serverNodeEngine;
this.remoteAddress = address;
this.localAddress = localAddress;
this.serverSideConnection = new MockedNodeConnection(connectionId, remoteAddress,
localAddress, serverNodeEngine, this);
}
void handlePacket(Packet packet) {
lastReadTime = System.currentTimeMillis();
getConnectionManager().handlePacket(packet);
}
@Override
public boolean write(SocketWritable socketWritable) {
Packet newPacket = readFromPacket((Packet) socketWritable);
MemberImpl member = serverNodeEngine.getClusterService().getMember(remoteAddress);
lastWriteTime = System.currentTimeMillis();
if (member != null) {
member.didRead();
}
serverNodeEngine.getNode().clientEngine.handlePacket(newPacket);
return true;
}
private Packet readFromPacket(Packet packet) {
Packet newPacket = new Packet();
ByteBuffer buffer = ByteBuffer.allocate(4096);
boolean writeDone;
boolean readDone;
do {
writeDone = packet.writeTo(buffer);
buffer.flip();
readDone = newPacket.readFrom(buffer);
if (buffer.hasRemaining()) {
throw new IllegalStateException("Buffer should be empty! " + buffer);
}
buffer.clear();
} while (!writeDone);
if (!readDone) {
throw new IllegalStateException("Read should be completed!");
}
newPacket.setConn(serverSideConnection);
return newPacket;
}
@Override
public void init() throws IOException {
}
@Override
public long lastReadTime() {
return lastReadTime;
}
@Override
public long lastWriteTime() {
return lastWriteTime;
}
@Override
public InetAddress getInetAddress() {
try {
return remoteAddress.getInetAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
return null;
}
}
@Override
public InetSocketAddress getRemoteSocketAddress() {
try {
return remoteAddress.getInetSocketAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
return null;
}
}
@Override
public int getPort() {
return remoteAddress.getPort();
}
@Override
public InetSocketAddress getLocalSocketAddress() {
try {
return localAddress.getInetSocketAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void innerClose() throws IOException {
serverSideConnection.close();
}
}
private class MockedNodeConnection extends TestNodeRegistry.MockConnection {
private final MockedClientConnection responseConnection;
private final int connectionId;
public MockedNodeConnection(int connectionId, Address localEndpoint, Address remoteEndpoint, NodeEngineImpl nodeEngine
, MockedClientConnection responseConnection) {
super(localEndpoint, remoteEndpoint, nodeEngine);
this.responseConnection = responseConnection;
this.connectionId = connectionId;
}
@Override
public boolean write(SocketWritable socketWritable) {
final Packet packet = (Packet) socketWritable;
if (nodeEngine.getNode().isActive()) {
Packet newPacket = readFromPacket(packet);
MemberImpl member = nodeEngine.getClusterService().getMember(localEndpoint);
if (member != null) {
member.didRead();
}
responseConnection.handlePacket(newPacket);
return true;
}
return false;
}
@Override
public boolean isClient() {
return true;
}
private Packet readFromPacket(Packet packet) {
Packet newPacket = new Packet();
ByteBuffer buffer = ByteBuffer.allocate(4096);
boolean writeDone;
boolean readDone;
do {
writeDone = packet.writeTo(buffer);
buffer.flip();
readDone = newPacket.readFrom(buffer);
if (buffer.hasRemaining()) {
throw new IllegalStateException("Buffer should be empty! " + buffer);
}
buffer.clear();
} while (!writeDone);
if (!readDone) {
throw new IllegalStateException("Read should be completed!");
}
newPacket.setConn(responseConnection);
return newPacket;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MockedNodeConnection that = (MockedNodeConnection) o;
if (connectionId != that.connectionId) return false;
Address remoteEndpoint = getEndPoint();
return !(remoteEndpoint != null ? !remoteEndpoint.equals(that.getEndPoint()) : that.getEndPoint() != null);
}
@Override
public void close() {
super.close();
responseConnection.close();
}
@Override
public int hashCode() {
int result = connectionId;
Address remoteEndpoint = getEndPoint();
result = 31 * result + (remoteEndpoint != null ? remoteEndpoint.hashCode() : 0);
return result;
}
@Override
public ConnectionType getType() {
return ConnectionType.JAVA_CLIENT;
}
@Override
public String toString() {
return "MockedNodeConnection{" +
" remoteEndpoint = " + getEndPoint() +
", localEndpoint = " + localEndpoint +
", connectionId = " + connectionId +
'}';
}
}
}
| [
"[email protected]"
]
| |
b63ecc22e6e372d1911e888847242511165840c3 | 0eaace682d03d897e1336b8555a3e4cb5df37511 | /src/main/java/net/celestemagisteel/entity/EntityState.java | 606a44cd8e4083474f20674f1e90aec7a9715037 | []
| no_license | CelesteGateley/MetroidVaniaDemo | 1bac50587c9557e8481eb6b5d52ec907aa6405c1 | 488e7e230b1eab3bf00cd6d748f883e5f86379b4 | refs/heads/master | 2022-12-22T17:10:53.321477 | 2020-10-04T21:03:38 | 2020-10-04T21:03:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package net.celestemagisteel.entity;
public enum EntityState {
DEFAULT,
HURT,
VICTORY,
DEAD;
@Override
public String toString() {
return super.toString().toLowerCase();
}
}
| [
"[email protected]"
]
| |
6ee69c4e4d9f36f204089a8b953fd703b7e0487a | c5e6eac602e3c4cd8daf832289a5833e1b946d78 | /ejercicio_ClubDeBeneficios/src/main/java/ar/edu/untref/aydoo/Producto.java | d412ea06f74ae6936e90b200143740c131ea1f6d | []
| no_license | WaldoGaspari/Aydoo2017 | b5fdca0f1622cae0ec6fd24b3aee262aefd715a0 | d187310f0a37fcf1a112dea7638de7703ea96291 | refs/heads/master | 2021-01-22T20:49:18.093185 | 2017-05-27T19:19:56 | 2017-05-27T19:19:56 | 85,361,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 547 | java | package ar.edu.untref.aydoo;
public class Producto {
private String descripcion;
private double precio;
private boolean conDescuento;
public Producto(String descripcion, double precio){
this.descripcion = descripcion;
this.precio = precio;
this.conDescuento = false;
}
public double obtenerPrecio(){
return this.precio;
}
public String obtenerDescripcion(){
return this.descripcion;
}
public boolean saberSiHayDescuento(){
return this.conDescuento;
}
public void aplicarDescuento(){
this.conDescuento = true;
}
}
| [
"[email protected]"
]
| |
d02079e4df2a0393e07e868331561a62aa8c281a | de807ba98cbde8f8045d3e15b878bc5168af98d0 | /app/src/main/java/com/example/hackherthon/MainActivity.java | dc077332a124246fa670e85aff7f8833b9b7fb99 | []
| no_license | zeegtab/HackHERThon | 4fe7f5c65a04d1b401d3501dd6bb817e7b1f756c | 8e8fd28c7b75574ee021469fe639ab546445a5e1 | refs/heads/master | 2023-03-23T09:59:26.574222 | 2021-03-06T14:22:15 | 2021-03-06T14:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 910 | java | package com.example.hackherthon;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.view.View.OnClickListener;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button isolating = (Button) findViewById(R.id.isolatingButton);
//add the onClick listener
isolating.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View view){
Intent isolatingIntent = new Intent(MainActivity.this, IsolatingMainActivity.class);
startActivity(isolatingIntent);
}
});
}
} | [
"[email protected]"
]
| |
9a2b9a1eaa082c275b90aa3ccad4ca638ae81f82 | 6722a98f8b0069ecef94fff787d6cbebb3ebe759 | /back/online_booking/src/main/java/com/booking/online_booking/model/DetailHotel.java | e026afeb64f98685d5970344c8215cafc8ca4250 | []
| no_license | trcweb/booking_back_spring-boot | ac1712ff8e4346417edddee11c6148872efd2296 | 392edc4eef1d269162f8683c439eef5b0feb2df1 | refs/heads/master | 2023-05-23T13:53:14.378333 | 2021-06-18T23:23:03 | 2021-06-18T23:23:03 | 357,171,738 | 0 | 0 | null | 2021-05-07T00:21:49 | 2021-04-12T11:43:57 | Java | UTF-8 | Java | false | false | 766 | java | package com.booking.online_booking.model;
import java.sql.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@Entity
@Table(name = "detail_hotel")
public class DetailHotel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id_detailhotel;
@ManyToOne
@JoinColumn(name = "id_hotel")
private Hotel hotel;
private Date date_debut;
private Date date_fin;
private String detail_hotel;
}
| [
"[email protected]"
]
| |
a54cc191ef10a2b352eeda021c6137908b7c27f8 | 9324b9d0934956d8a47de3e2c26c7fe05dddfebc | /src/com/holub/life/Life.java | 2f131c382682a6edb82388f364a4be454ed63471 | []
| no_license | zhang-yan-talendbj/holub-on-patterns | e024ac54f89e7da7b6a5f06885f90477b8628673 | a72744255c6db158dc525dfa4df12e55381178c2 | refs/heads/master | 2021-09-06T13:57:04.945644 | 2018-02-07T07:58:47 | 2018-02-07T07:58:47 | 117,694,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 907 | java | package com.holub.life;
import com.holub.ui.MenuSite;
import javax.swing.*;
import java.awt.*;
/*******************************************************************
* An implemenation of Conway's Game of Life.
*
* @include /etc/license.txt
*/
public final class Life extends JFrame
{
private static JComponent universe;
public static void main( String[] arguments )
{ new Life();
}
private Life()
{ super( "The Game of Life. "
+"(c)2003 Allen I. Holub <http://www.holub.com>");
// Must establish the MenuSite very early in case
// a subcomponent puts menus on it.
MenuSite.establish( this ); //{=life.java.establish}
setDefaultCloseOperation ( EXIT_ON_CLOSE );
getContentPane().setLayout ( new BorderLayout() );
Universe universe = Universe.instance();
getContentPane().add(universe, BorderLayout.CENTER); //{=life.java.install}
pack();
setVisible( true );
}
}
| [
"[email protected]"
]
| |
7ba06085987f87025d2a1f86a42f132713b56877 | 060d576437865e4b1d05247a2575ae1e674c7f58 | /hw7/mlhw7/mlhw7/src/com/ml/hw7/MNISTReader.java | 46470565cbb645c35d0eb24d5c1613b278a6d3ad | []
| no_license | Qartks/Machine-Learning | ad952c0e9d327338d0d7758e7f2877bc2ae364f7 | 1f15b3e0e24ed910447834464f82409a7e1c571f | refs/heads/master | 2021-06-08T10:27:00.758971 | 2016-10-16T17:48:58 | 2016-10-16T17:48:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,657 | java | package com.ml.hw7;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* This class implements a reader for the MNIST dataset of handwritten digits.
* The dataset is found at http://yann.lecun.com/exdb/mnist/.
*
* @author Gabe Johnson <[email protected]>
*/
public class MNISTReader {
List<Image> imgList = new ArrayList<Image>();
public List<Image> getImgList() {
return imgList;
}
public void ReadImages(String labelFilename, String imageFileName)
throws IOException {
DataInputStream labels = new DataInputStream(new FileInputStream(labelFilename));
DataInputStream images = new DataInputStream(new FileInputStream(imageFileName));
int magicNumber = labels.readInt();
if (magicNumber != 2049) {
System.err.println("Label file has wrong magic number: " + magicNumber + " (should be 2049)");
System.exit(0);
}
magicNumber = images.readInt();
if (magicNumber != 2051) {
System.err.println("Image file has wrong magic number: " + magicNumber + " (should be 2051)");
System.exit(0);
}
int numLabels = labels.readInt();
int numImages = images.readInt();
int numRows = images.readInt();
int numCols = images.readInt();
if (numLabels != numImages) {
System.err.println("Image file and label file do not contain the same number of entries.");
System.err.println(" Label file contains: " + numLabels);
System.err.println(" Image file contains: " + numImages);
System.exit(0);
}
long start = System.currentTimeMillis();
int numLabelsRead = 0;
int numImagesRead = 0;
while (labels.available() > 0 && numLabelsRead < numLabels) {
byte label = labels.readByte();
numLabelsRead++;
int[][] image = new int[numCols][numRows];
for (int colIdx = 0; colIdx < numCols; colIdx++) {
for (int rowIdx = 0; rowIdx < numRows; rowIdx++) {
image[colIdx][rowIdx] = images.readUnsignedByte() == 0 ? 0 : 1;
// System.out.print(image[colIdx][rowIdx]);
}
// System.out.println();
}
// System.out.println();
// System.out.println(label);
// System.out.println();
numImagesRead++;
Image img = new Image(numRows, numCols, numImagesRead);
img.setImage(image);
img.setLabel(label);
imgList.add(img);
// if(numImagesRead == 8000){
// break;
// }
}
System.out.println();
long end = System.currentTimeMillis();
long elapsed = end - start;
long minutes = elapsed / (1000 * 60);
long seconds = (elapsed / 1000) - (minutes * 60);
System.out.println("Read " + numLabelsRead + " samples in " + minutes + " m " + seconds + " s ");
}
} | [
"[email protected]"
]
| |
985d1f1bca8274840697190339c4b864b171a8c7 | 21c77a3d8211177eab1da2a68b0e966ad5e85656 | /src/DP/ED/List.java | e0951d09ce4f406626835e436f001a543e31edbb | []
| no_license | StickBrush/GoTDP | 03eb825725c722d58582c54f852abf463d1fee55 | e2d1d5f1aeed08fb05d0b46aacb6796b471c7539 | refs/heads/master | 2022-12-11T18:54:07.700416 | 2017-01-15T00:02:16 | 2017-01-15T00:02:16 | 70,515,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,449 | java | package DP.ED;
import java.util.LinkedList;
/**
* Implementación de la Lista
*
* @version 4.0
* @author Juan Luis Herrera González Curso: 2º (Grupo Grande A) EC4
* @param <tipoDato> Tipo de dato de la lista
*/
public class List<tipoDato> {
/**
* Lista usada
*/
private LinkedList<tipoDato> l;
/**
* Constructor por defecto de lista
*/
public List() {
l = new LinkedList<tipoDato>();
}
/**
* Constructor parametrizado de lista
*
* @param data Dato con el que crear la lista
*/
public List(tipoDato data) {
l = new LinkedList<tipoDato>();
addLast(data);
}
/**
* Retorna el primer elemento de la lista
*
* @return Primer elemento de la lista
*/
public tipoDato getFirst() {
return l.getFirst();
}
/**
* Devuelve el último deato de la lista
*
* @return Último dato de la lista
*/
public tipoDato getLast() {
return l.getLast();
}
/**
* Devuelve si la lista está vacía
*
* @return True si está vacía, false si no
*/
public boolean estaVacia() {
return l.isEmpty();
}
/**
* Devuelve el tamaño de la lista
*
* @return Tamaño de la lista
*/
public Integer size() {
return l.size();
}
/**
* Retorna el elemento de la posición pos. pos siempre debe ser menor que el
* tamaño de la lista.
*
* @param pos Posición del elemento a retornar
* @return Elemento de la posición pos
*/
public tipoDato get(Integer pos) {
return l.get(pos);
}
/**
* Elimina el dato de la posición pos. pos siempre debe ser menor que el
* tamaño de la lista.
*
* @param pos Dato a eliminar
*/
public void delete(Integer pos) {
l.remove((int) pos);
}
/**
* Método que añade un dato al final
*
* @param Data Dato a añadir al final
*/
public void addLast(tipoDato Data) {
l.addLast(Data);
}
/**
* Elimina el último elemento de la lista
*
*/
public void removeLast() {
l.removeLast();
}
/**
* Devuelve si Data está en la lista
*
* @param Data Dato a comprobar
* @return True si el dato está, false si no
*/
public boolean contains(tipoDato Data) {
return l.contains(Data);
}
}
| [
"冷"
]
| 冷 |
888e37e3adff8d49c17cee65af74b97e65736b1d | 62bd3373e84cc6f2f9d72e1782c0e1f525488224 | /java/hole1/src/main/java/hole1/Incalculable.java | 541c17de700c249a67337a9484b62acec6d7828f | []
| no_license | imsuarezprieto/refactoring-golf | a2ca6c3e547acf506e29156341f407ca41a1bcff | 78fb5f2bd8c5633a8f55fb1b3cd688737c6c0039 | refs/heads/main | 2023-09-02T23:36:56.604097 | 2021-11-01T10:53:36 | 2021-11-01T10:53:36 | 423,109,523 | 1 | 0 | null | 2021-10-31T09:56:31 | 2021-10-31T09:56:30 | null | UTF-8 | Java | false | false | 71 | java | package hole1;
public class Incalculable extends RuntimeException {
} | [
"[email protected]"
]
| |
189758b764f8019f7f074c51656749a562eef9b5 | 51cdd0bea4e10d511be247625ba5ba7811a9d078 | /src/main/java/com/willowleaf/ldapsync/data/AttributeMapRepository.java | 2925363f0378bdcb0dd274fb7c5c0c1a23337197 | [
"Apache-2.0"
]
| permissive | dengbin19910916/ldap-sync | 990988931730299eeb664361f48f104067375b17 | 488b7229fe8aa2694d1258e9af27e9aacb3200f6 | refs/heads/master | 2023-05-28T07:41:01.025392 | 2023-04-19T01:00:26 | 2023-04-19T01:00:26 | 161,566,826 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package com.willowleaf.ldapsync.data;
import com.willowleaf.ldapsync.domain.AttributeMap;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AttributeMapRepository extends JpaRepository<AttributeMap, Integer> {
}
| [
"[email protected]"
]
| |
4a64f2013585cff190332b088369c968121fca27 | 48568731e35efd05bb42424f3a092b74f8ebbf36 | /src/main/java/com/upgrade/qa/data/StateInfoBean.java | 9eac5d8198b54063ebaf985941678f8ee0c6ca0a | []
| no_license | jessideng/upgrade | 9e185889692a314f28bcd0a693ae54776240a30d | c617d7e2860cdbce20cc1276d61c110f6fca76a2 | refs/heads/master | 2023-05-10T19:28:39.421953 | 2019-09-09T00:06:27 | 2019-09-09T00:06:27 | 205,472,436 | 0 | 0 | null | 2023-05-09T18:15:18 | 2019-08-31T00:02:51 | Java | UTF-8 | Java | false | false | 983 | java | package com.upgrade.qa.data;
public class StateInfoBean {
private String label;
private String abbreviation;
private String minLoanAmount;
private String minAge;
public StateInfoBean() {
super();
}
public StateInfoBean(String label, String abbreviation, String minLoanAmount, String minAge) {
super();
this.label = label;
this.abbreviation = abbreviation;
this.minLoanAmount = minLoanAmount;
this.minAge = minAge;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getAbbreviation() {
return abbreviation;
}
public void setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
}
public String getMinLoanAmount() {
return minLoanAmount;
}
public void setMinLoanAmount(String minLoanAmount) {
this.minLoanAmount = minLoanAmount;
}
public String getMinAge() {
return minAge;
}
public void setMinAge(String minAge) {
this.minAge = minAge;
}
}
| [
"[email protected]"
]
| |
e2a3fb4e1feae1ac712071d4c2f15335172f95ca | dcd123da08f87bb671665f0c0556d60b4575fe0b | /src/main/java/com/lwj/controller/JobController.java | 3cdfa6bf68e153738edb4f9a7723a00abb6b6ea0 | []
| no_license | liwj007/wsp | e876451e15032084148c3307222a47c6a2b346c6 | ea21f7414864d32adf24b37bbdd01baa279480b6 | refs/heads/master | 2021-01-09T23:42:16.752969 | 2017-09-08T03:13:50 | 2017-09-08T03:13:50 | 102,811,550 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,549 | java | package com.lwj.controller;
import com.lwj.annotation.UserRight;
import com.lwj.bo.JobBO;
import com.lwj.bo.UnitBO;
import com.lwj.data.ResponseData;
import com.lwj.entity.*;
import com.lwj.exception.WSPException;
import com.lwj.repository.ApplicationRepository;
import com.lwj.repository.EvaluationRepository;
import com.lwj.repository.JobRepository;
import com.lwj.repository.UnitRepository;
import com.lwj.service.*;
import com.lwj.status.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.*;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.servlet.http.HttpSession;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import static com.lwj.status.StaticParams.PAGE_SIZE;
/**
* Created by liwj0 on 2017/7/17.
*/
@RestController
@RequestMapping(value = "/jobs")
public class JobController {
@Autowired
private IUserService userService;
@Autowired
private IJobService jobService;
@Autowired
private IApplicationService applicationService;
@Autowired
private IUnitService unitService;
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseData getJob(@PathVariable long id) {
Job job = jobService.getJobById(id);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(job);
return responseData;
}
@UserRight(authorities = {Rights.SCHOOL})
@RequestMapping(value = "/check", method = RequestMethod.PUT)
public ResponseData check(@RequestParam(value = "id") Long jobId,
@RequestParam(value = "number", required = false) Integer number,
@RequestParam(value = "type") JobStatus jobStatus) throws WSPException {
if (jobStatus == JobStatus.PASS && number <= 0) {
ResponseData responseData = new ResponseData();
responseData.setFail(ErrorInfo.PARAMS_ERROR);
return responseData;
}
jobService.updateStatus(jobId, jobStatus, number);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(null);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/extension", method = RequestMethod.PUT)
public ResponseData extension(@RequestParam(value = "id") Long jobId,
@RequestParam(value = "number") Integer number) throws WSPException {
jobService.extension(jobId, number);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(null);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/finish", method = RequestMethod.PUT)
public ResponseData finishHire(String token, @RequestParam(value = "id") Long jobId) throws WSPException {
User user = userService.getUserByToken(token);
jobService.finishRecruit(user, jobId);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(null);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/close", method = RequestMethod.PUT)
public ResponseData closeJob(String token, @RequestParam(value = "id") Long jobId) throws WSPException {
User user = userService.getUserByToken(token);
jobService.closeJob(user, jobId);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(null);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/begin", method = RequestMethod.PUT)
public ResponseData beginHire(String token, @RequestParam(value = "id") Long jobId) throws WSPException {
User user = userService.getUserByToken(token);
jobService.beginRecruit(user, jobId);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(null);
return responseData;
}
@UserRight(authorities = {Rights.STUDENT})
@RequestMapping(value = "/apply/{jobId}", method = RequestMethod.POST)
public ResponseData applyJob(String token, @PathVariable long jobId, @ModelAttribute Application application) throws WSPException {
User user = userService.getUserByToken(token);
jobService.createApplication(application, user, jobId);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(application.getId());
return responseData;
}
@UserRight(authorities = {Rights.UNIT, Rights.SCHOOL})
@RequestMapping(value = "/{id}/applications", method = RequestMethod.GET)
public ResponseData getApplicationsOfJob(@PathVariable long id, @PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) throws WSPException {
Job job = jobService.getJobById(id);
if (job == null) {
throw new WSPException(ErrorInfo.PARAMS_ERROR);
}
Page<Application> list = applicationService.getApplicationOfJobForPage(job, pageable);
HashMap<String, Object> map = new HashMap<>();
map.put("res", list);
map.put("numberOfOn", applicationService.getHireApplicationsNumberOfJob(job));
map.put("numberOfNeed", job.getNumberOfNeed());
ResponseData responseData = new ResponseData();
responseData.setSuccessData(map);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/open", method = RequestMethod.GET)
public ResponseData getJobsOnOpen(String token, @PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) throws WSPException {
User user = userService.getUserByToken(token);
Page<Job> res = jobService.getOpenJobsOfUnitForPage(user.getUnit(), pageable);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.SCHOOL})
@RequestMapping(value = "/on_recruit", method = RequestMethod.GET)
public ResponseData getJobsOnRecruiting(@RequestParam(value = "unitId", required = false) Long unitId,
@PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) throws WSPException {
Page<Job> res;
if (unitId != null && unitId > 0) {
Unit unit = unitService.getOriginUnitById(unitId);
res = jobService.getOpenJobsOfUnitForPage(unit, pageable);
} else
res = jobService.getOpenJobsForPage(pageable);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/history", method = RequestMethod.GET)
public ResponseData getHistoryJobs(String token,
@PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) {
User user = userService.getUserByToken(token);
Page<Job> res = jobService.getHistoryJobs(user.getUnit(), pageable);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.SCHOOL})
@RequestMapping(value = "/unit_history", method = RequestMethod.GET)
public ResponseData getUnitHistoryJobs(Long unitId,
@PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) {
UnitBO unit = unitService.getUnitById(unitId);
Unit tmp = new Unit();
tmp.setId(unit.getId());
Page<Job> res = jobService.getHistoryJobs(tmp, pageable);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.STUDENT})
@RequestMapping(value = "/recruit", method = RequestMethod.GET)
public ResponseData getJobsOnRecruiting(String token,
@PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) {
User user = userService.getUserByToken(token);
Page<Job> res = jobService.getOpenJobsForPage(pageable);
for (Job job : res.getContent()) {
boolean flag = applicationService.hasApplyJobForUser(job, user);
job.setHasApply(flag);
}
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/", method = RequestMethod.POST)
public ResponseData createJob(String token, @ModelAttribute Job job) throws WSPException {
User user = userService.getUserByToken(token);
jobService.createJob(job, user);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(job.getId());
return responseData;
}
@UserRight(authorities = {Rights.SCHOOL})
@RequestMapping(value = "/all", method = RequestMethod.GET)
public ResponseData searchJobs(Long uid, JobType jobType, JobStatus jobStatus, @PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) {
Page<Job> res = jobService.searchJobByUnitAndJobTypeAndJobStatusForPage(uid, jobType, jobStatus, pageable);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/max_number_money", method = RequestMethod.GET)
public ResponseData maxNumberAndMoney(String token, Integer number) {
User user = userService.getUserByToken(token);
HashMap<String, Object> res = new HashMap<>();
res.put("number", user.getUnit().getRestOfNumber());
res.put("money", user.getUnit().getRestOfMoney());
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/validate_number", method = RequestMethod.GET)
public ResponseData validateNumber(String token, Integer number) {
User user = userService.getUserByToken(token);
boolean rest = user.getUnit().getRestOfNumber() >= number;
HashMap<String, Object> res = new HashMap<>();
res.put("flag", rest);
res.put("rest", user.getUnit().getRestOfNumber());
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/validate_money", method = RequestMethod.GET)
public ResponseData validateMoney(String token, Double money) {
User user = userService.getUserByToken(token);
boolean rest = user.getUnit().getRestOfMoney() >= money;
HashMap<String, Object> res = new HashMap<>();
res.put("flag", rest);
res.put("rest", user.getUnit().getRestOfMoney());
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.SCHOOL})
@RequestMapping(value = "/unit", method = RequestMethod.GET)
public ResponseData getJobsOfUnit(String token, Long unitId,
@PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) {
JobStatus[] statuses = {JobStatus.FINISH, JobStatus.PASS};
Unit unit = unitService.getOriginUnitById(unitId);
List<JobBO> res = jobService.getJobsByUnit(unit);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT, Rights.SCHOOL})
@RequestMapping(value = "/unit_search", method = RequestMethod.GET)
public ResponseData getJobsOfUnitForPage2(String token,
@RequestParam(value = "unitId", required = false) Long unitId,
@RequestParam(value = "status", required = false) JobStatus jobStatus,
@PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) {
User user = userService.getUserByToken(token);
Page<Job> res;
if (jobStatus == null && unitId != null) {
JobStatus[] statuses = {JobStatus.FINISH, JobStatus.PASS};
res = jobService.getAllJobsOfUnitForPage(unitId, statuses, pageable);
} else {
res = jobService.getAllJobsOfUnitForPage(user.getUnit().getId(), jobStatus, pageable);
}
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/current", method = RequestMethod.GET)
public ResponseData getCurrentJobsOfUnit(String token, @PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable) {
User user = userService.getUserByToken(token);
JobStatus[] statuses = {JobStatus.PASS, JobStatus.FINISH};
Page<Job> res = jobService.getJobs(user.getUnit(), statuses, null,null, pageable);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/unit/all", method = RequestMethod.GET)
public ResponseData getJobsOfUnit(String token) {
User user = userService.getUserByToken(token);
List<JobBO> res = jobService.getJobsByUnit(user.getUnit());
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
@UserRight(authorities = {Rights.UNIT})
@RequestMapping(value = "/evaluation", method = RequestMethod.GET)
public ResponseData getCurrentJobsForEvaluation(String token,
@PageableDefault(sort = {"id"}, direction = Sort.Direction.DESC) Pageable pageable,
@RequestParam(value = "year") Integer year,
@RequestParam(value = "month") Integer month) throws ParseException {
User user = userService.getUserByToken(token);
Page<Job> res = jobService.getCurrentJobsWithEvaluationOfUnitForPage(user.getUnit(), pageable, year, month);
ResponseData responseData = new ResponseData();
responseData.setSuccessData(res);
return responseData;
}
}
| [
"[email protected]"
]
| |
a4db79352e3c52232df4787e3919305fab7ceada | 794fdaf0cd66a3b10bff75b4c568626552886f1f | /jeeplat/src/main/java/com/jeeplat/modules/cms/web/CmsController.java | 269b504fed10051cf45795f4eddf0336ddc76515 | [
"Apache-2.0"
]
| permissive | lbyoo/JeePlat | d4a0b64812f80dca9d42247de1f90eaef85f086a | d8af19713bce469c0ae2d58a6a8740f10570aff9 | refs/heads/master | 2021-06-20T23:00:19.233596 | 2017-08-12T04:52:59 | 2017-08-12T04:52:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,088 | java | package com.jeeplat.modules.cms.web;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.jeeplat.common.web.BaseController;
import com.jeeplat.modules.cms.service.CategoryService;
/**
* 内容管理Controller
*/
@Controller
@RequestMapping(value = "${adminPath}/cms")
public class CmsController extends BaseController {
@Autowired
private CategoryService categoryService;
@RequiresPermissions("cms:view")
@RequestMapping(value = "")
public String index() {
return "modules/cms/cmsIndex";
}
@RequiresPermissions("cms:view")
@RequestMapping(value = "tree")
public String tree(Model model) {
model.addAttribute("categoryList", categoryService.findByUser(true, null));
return "modules/cms/cmsTree";
}
@RequiresPermissions("cms:view")
@RequestMapping(value = "none")
public String none() {
return "modules/cms/cmsNone";
}
}
| [
"lijian@bogon"
]
| lijian@bogon |
e2679d3c02b55918bd83a410c5f9fa635c28d4e2 | 7e5e80bf80071b820b9c380ccdb6a26bcbe36c56 | /src/com/capgemini/files/client/FileHandlingDemo.java | b2aae19eacd6b3232df7a54f5e7890922b69ddd0 | []
| no_license | tanmay286/file-handling | 23959f836faa1461733091f5ef67f30e7213425a | a473a8ce690e6bfee41c571971b957dc18184056 | refs/heads/master | 2020-05-07T19:09:58.789971 | 2019-04-11T13:46:04 | 2019-04-11T13:46:04 | 180,800,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,159 | java | package com.capgemini.files.client;
import java.io.File;
import java.io.IOException;
public class FileHandlingDemo {
public static void main(String[] args) throws IOException {
// File exits or not
/*
* File file=new
* File("C:\\Users\\tkukkar\\Downloads\\Re__Core_Java_Assignments\\Date.java");
* System.out.println(file.exists());
*
* File folder=new
* File("C:\\Users\\tkukkar\\Downloads\\Re__Core_Java_Assignments");
* System.out.println(folder.exists());
*/
/*
* File file=new File("Text.txt"); if(!(file.exists())) { file.createNewFile();
* System.out.println("File is created Successfully"); } //BufferedWriter
* writer=new BufferedWriter(new FileWriter(file)); //(file,true) will append
* the text file
*
* PrintWriter writer=new PrintWriter(file); writer.println("Hello..\n");
* writer.println("How are you\n "); writer.println("I hope you are fine");
* writer.println("Bye...");
*
*
* writer.close(); System.out.println("Content has been written successfully");
*/
/*-------Copy the content in File1.java--------------------
* FileReader reader=new
* FileReader("C:\\Tanmay\\Core Java\\file-handling\\src\\com\\capgemini\\files\\client\\FileHandlingDemo.java"
* ); BufferedReader bReader=new BufferedReader(reader); PrintWriter writer=new
* PrintWriter("File1.java"); String content;
*
* while((content=bReader.readLine())!=null) { //System.out.println(content);
* writer.println(content); } writer.close(); bReader.close(); reader.close();
*/
/*-----------List of Windows is Displayed----------------------------
* File windowsDirectory = new File("c:\\windows");
* System.out.println(windowsDirectory.isDirectory()); String content[] =
* windowsDirectory.list();
*
* for (String s : content) { System.out.println(s); }
*/
File newDir = new File("myDir");
if (!newDir.exists()) {
newDir.mkdir();
System.out.println("Folder is Successfully created");
}
File file= new File(newDir,"myfile.txt");
if(!file.exists()) {
file.createNewFile();
System.out.println("File is Successfully created");
}
}
} | [
"[email protected]"
]
| |
a6eb028f56964a241b84693fe2534a35c9b7eb71 | e23acfaa284259fecf9f0bccedb8e20ee0779ae7 | /study/src/main/java/com/seesea/study/mongodb/TestDao.java | 0fd9d46295e0f8a9c39ebcb66948b886e909d29b | []
| no_license | xiechongyang7/study | 4b1761583fca72bd16b4bc3b1ef2a1c92c789802 | f77ade4d9914c14b4476efdffbf454d9d08ad656 | refs/heads/master | 2022-11-23T11:33:33.400421 | 2020-11-20T07:32:08 | 2020-11-20T07:32:08 | 161,575,180 | 0 | 1 | null | 2022-11-16T11:32:50 | 2018-12-13T02:51:52 | Java | UTF-8 | Java | false | false | 327 | java | package com.seesea.study.mongodb;
import org.springframework.stereotype.Repository;
/**
* @Description
* @Since JDK1.8
* @Createtime 2018/12/25 10:59
* @Author xie
*/
@Repository
public class TestDao extends MongoTest<TestBig> {
@Override
protected Class getEntityClass() {
return TestDao.class;
}
}
| [
"[email protected]"
]
| |
2f3e3d5348137487cfaeb51aad9fbdca27e3f5d9 | 466f842e6a71b069aae10e54976535f235c84bbf | /src/main/java/model/Arquivo.java | 7938f3eeacb4c1b704d708226ce8658ba4fa176d | []
| no_license | brunovieira97/unisinos-lab2-pgc | 53c7877695a91934a91813fb853db04b0a41fe45 | 17c1b073bc030c63f94184535e0d47ec371a570c | refs/heads/master | 2020-05-30T18:45:55.932842 | 2019-06-03T02:02:18 | 2019-06-03T02:02:18 | 189,905,401 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,471 | java | package model;
/**
*
* @author bruno
*/
public class Arquivo {
private String nome, usuario;
private int prioridade;
private boolean colorido;
public Arquivo(String nome, boolean colorido) {
this.nome = nome;
this.colorido = colorido;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getUsuario() {
return usuario;
}
public void setUsuario(String usuario) {
this.usuario = usuario;
}
public int getPrioridade() {
return prioridade;
}
public void setPrioridade(int prioridade) {
if (prioridade <= 0 || prioridade > 3) {
System.out.println("Nível de Prioridade Inválido!");
} else {
this.prioridade = prioridade;
if (getPrioridade() == 1) {
setUsuario("Estagiário");
} else if (getPrioridade() == 2) {
setUsuario("Funcionário");
} else {
setUsuario("Gerente");
}
}
}
public boolean isColorido() {
return colorido;
}
public void setColorido(boolean colorido) {
this.colorido = colorido;
}
@Override
public String toString() {
return "Arquivo {" + "nome=" + nome + ", usuario=" + usuario + ", prioridade=" + prioridade + ", colorido=" + colorido + "}";
}
}
| [
"[email protected]"
]
| |
35d18c19a13a782fa9b2046c5781800734a0eada | d4be23d5b810fa388eb3c17db7bcd55e521d9b0e | /src/com/viroyal/socket/test/Client.java | e9b5d7a12de482366ec59f3cbeedfbb9c7645df6 | []
| no_license | wys484112/SocketServerClient | 338817d008d4bf97d93037bd0256a86734260a99 | 387806931e6c681d74fd6815856f1d23dc59eaf0 | refs/heads/master | 2020-12-07T10:44:29.249889 | 2020-03-31T01:54:41 | 2020-03-31T01:54:41 | 232,706,162 | 0 | 0 | null | 2020-01-09T07:33:09 | 2020-01-09T02:38:52 | Java | GB18030 | Java | false | false | 3,433 | java | package com.viroyal.socket.test;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.Socket;
public class Client {
static int portStart=50000;
/**
* 入口
* @param args
*/
public static void main(String[] args) {
// 开启三个客户端,一个线程代表一个客户端
for (int i = 0; i < 3; i++) {
new Thread(new Runnable() {
@Override
public void run() {
try {
TestClient client = TestClientFactory.createClient(8899);
client.send(String.format("Hello,Server!I'm %d.这周末天气如何。", client.client.getLocalPort()));
client.receive();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
}
/**
* 生产测试客户端的工厂
*/
static class TestClientFactory {
public static TestClient createClient(int port) throws Exception {
return new TestClient("localhost", port);
}
}
/**
* 测试客户端
*/
static class TestClient {
/**
* 构造函数
* @param host 要连接的服务端IP地址
* @param port 要连接的服务端对应的监听端口
* @throws Exception
*/
public TestClient(String host, int port) throws Exception {
// 与服务端建立连接
this.client = new Socket(host, port);
System.out.println("Cliect[port:" + client.getLocalPort() + "] 与服务端建立连接...");
}
private Socket client;
private Writer writer;
/**
* 发送消息
* @param msg
* @throws Exception
*/
public void send(String msg) throws Exception {
// 建立连接后就可以往服务端写数据了
if(writer == null) {
writer = new OutputStreamWriter(client.getOutputStream(), "UTF-8");
}
writer.write(msg);
writer.write("eof\n");
writer.flush();// 写完后要记得flush
System.out.println("Cliect[port:" + client.getLocalPort() + "] 消息发送成功");
}
/**
* 接收消息
* @throws Exception
*/
public void receive() throws Exception {
// 写完以后进行读操作
Reader reader = new InputStreamReader(client.getInputStream(), "UTF-8");
// 设置接收数据超时间为10秒
client.setSoTimeout(10*1000);
char[] chars = new char[64];
int len;
StringBuilder sb = new StringBuilder();
while ((len = reader.read(chars)) != -1) {
sb.append(new String(chars, 0, len));
}
System.out.println("Cliect[port:" + client.getLocalPort() + "] 消息收到了,内容:" + sb.toString());
reader.close();
// 关闭连接
writer.close();
client.close();
}
}
}
| [
"[email protected]"
]
| |
33392a5b715bcbc63f84839f3b9d9ca736a80cfa | 465cd71ddc70830e3a0ef443d2ac0268290f5802 | /app/src/main/java/com/example/connect3/MainActivity.java | 291d7689b891e6215f771dd9a25f0dc0cd36896d | []
| no_license | Purav22/Connect-3 | 5eb2492668fb422be176f7b2aa2c8a3666f29366 | 6281faef503018b0e4da974662c3f887911b0e18 | refs/heads/master | 2023-06-03T05:26:59.101354 | 2021-06-21T19:34:00 | 2021-06-21T19:34:00 | 379,035,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,135 | java | package com.example.connect3;
import androidx.appcompat.app.AppCompatActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Arrays;
public class MainActivity extends AppCompatActivity {
int[] gameState = {2, 2, 2, 2, 2, 2, 2, 2, 2};
int[][] winningPositions = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}};
int activePlayer = 0; // 0 == tom 1 == jerry
boolean gameActive = true;
@SuppressLint("SetTextI18n")
public void dropIn(View view) {
ImageView counter = (ImageView) view;
int tappedCounter = Integer.parseInt(counter.getTag().toString());
if(gameState[tappedCounter] == 2 && gameActive) {
gameState[tappedCounter] = activePlayer;
counter.setTranslationY(-1500);
if (activePlayer == 0) {
counter.setImageResource(R.drawable.tom);
activePlayer = 1;
} else {
activePlayer = 0;
counter.setImageResource(R.drawable.jerry);
}
counter.animate().translationYBy(1500).rotation(3600).setDuration(500);
for (int[] win : winningPositions) {
if (gameState[win[0]] == gameState[win[1]] && gameState[win[1]] == gameState[win[2]] && gameState[win[0]] != 2) {
gameActive = false;
String winner = "";
if (activePlayer == 1) {
winner = "Tom";
} else {
winner = "Jerry";
}
// Toast.makeText(this, winner + "has won!", Toast.LENGTH_SHORT).show();
Button playAgain = (Button) findViewById(R.id.playAgainButton);
TextView winnerText = (TextView) findViewById(R.id.winnerTextView);
winnerText.setText(winner + " has won!");
playAgain.setVisibility(View.VISIBLE);
winnerText.setVisibility(View.VISIBLE);
}
}
}
}
public void playAgain(View view){
Button playAgain = (Button) findViewById(R.id.playAgainButton);
TextView winnerText = (TextView) findViewById(R.id.winnerTextView);
playAgain.setVisibility(View.INVISIBLE);
winnerText.setVisibility(View.INVISIBLE);
GridLayout gridLayout = (GridLayout) findViewById(R.id.gridLayout);
for(int i = 0; i < gridLayout.getChildCount(); i++){
ImageView ct = (ImageView) gridLayout.getChildAt(i);
ct.setImageDrawable(null);
}
Arrays.fill(gameState, 2);
activePlayer = 0;
gameActive = true;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
} | [
"[email protected]"
]
| |
549df3d4b9b0b69275465a0fb4638862405e872e | 4b83f78b5dbf0576986909efdabde7dfca2eaa15 | /app/src/test/java/com/ezcommerce/ExampleUnitTest.java | 2bb0ec5360aaef6360ccde847c40091f5be0c0dd | []
| no_license | ncksp/ezcommerce-mobile-apps | d09a64fe78f389f126efc25a812035d8a49cee0a | 310177d47da33ae8c682765b51164f4e30516cc0 | refs/heads/main | 2023-02-24T07:09:51.836739 | 2021-02-05T21:47:54 | 2021-02-05T21:47:54 | 336,392,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package com.ezcommerce;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
]
| |
eacc017f9c66a6258c31380946d71cfdc467b374 | 5702eb53222af6e3e41672853c98e87c76fda0e3 | /mockets/java.old/us/ihmc/mockets/DataBuffer.java | 18e0df0cd12c0d3bef1702f3d9a3ad010bd4abda | []
| no_license | agilecomputing/nomads | fe46464f62440d29d6074370c1750f69c75ea309 | 0c381bfe728fb24d170721367336c383f209d839 | refs/heads/master | 2021-01-18T11:12:29.670874 | 2014-12-13T00:46:40 | 2014-12-13T00:46:40 | 50,006,520 | 1 | 0 | null | 2016-01-20T05:19:14 | 2016-01-20T05:19:13 | null | UTF-8 | Java | false | false | 1,055 | java | /**
* The DataBuffer class represents the data buffer contained in a DATA chunk.
*
* @author Mauro Tortonesi
*/
package us.ihmc.mockets;
import java.lang.Math;
import java.util.logging.Logger;
class DataBuffer
{
DataBuffer (byte[] buf, int off, int len)
{
_logger = Logger.getLogger ("us.ihmc.mockets");
_buf = buf;
_offset = off;
_size = len;
}
int getData (byte[] buf, int off, int len)
throws NotEnoughSizeException
{
int toCopy = Math.min (len, _size);
System.arraycopy (_buf, _offset, buf, off, toCopy);
if (len < _size) {
_logger.warning ("output buffer too small: discarded " +
(_size - toCopy) + " bytes.");
throw new NotEnoughSizeException (len, _size);
}
return toCopy;
}
int getSize()
{
return _size;
}
private Logger _logger;
private byte[] _buf;
private int _size;
private int _offset;
}
/*
* vim: et ts=4 sw=4
*/
| [
"[email protected]"
]
| |
f0ee36a1343fe8dc592a8230239ca4569defba3c | 4ff2df56ee85f15d6a758783f9bac4f79cb188ec | /bme/src/main/java/medizin/client/a_nonroo/app/client/ui/QuestiontypesEditView.java | 3854da861fbc37e599171d617d600168fbb61a7f | []
| no_license | nikotsunami/bme2 | fbbcf7bb08e36c27e0415e800bc6d0ef80fa5c42 | ee0e154a2b386ab26733e7422cb772a6748aa565 | refs/heads/master | 2016-09-06T19:42:20.104957 | 2012-11-28T20:38:00 | 2012-11-28T20:38:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,042 | java | package medizin.client.a_nonroo.app.client.ui;
import medizin.client.a_nonroo.app.client.ui.question.QuestionEditViewImpl;
import medizin.client.managed.request.QuestionProxy;
import medizin.client.managed.request.QuestionTypeProxy;
import com.google.gwt.place.shared.Place;
import com.google.web.bindery.requestfactory.gwt.client.RequestFactoryEditorDriver;
import com.google.gwt.user.client.ui.IsWidget;
public interface QuestiontypesEditView extends IsWidget {
void setPresenter(Presenter activityAcceptAnswer);
void setDelegate(Delegate delegate);
void setValue(QuestionTypeProxy proxy);
public interface Presenter {
void goTo(Place place);
}
interface Delegate {
void cancelClicked();
// void saveClicked(String questionTypeName, Boolean isWeil, Integer trueAnswers, Integer falseAnswers, Integer sumAnswers, Integer maxLetters);
void saveClicked();
}
RequestFactoryEditorDriver<QuestionTypeProxy, QuestiontypesEditViewImpl> createEditorDriver();
void setEditTitle(boolean edit);
}
| [
"[email protected]"
]
| |
3c07ee343e76cde044e8adff60009e6e38d5f950 | 71ac0b4fa15d592a1bdbf720fd2c992a0621c5fc | /base-android/src/main/java/com/sjjd/wyl/baseandroid/bean/Register.java | ab135d05eafb854291f12a9ecf40901a6dc0f92e | []
| no_license | wylIwwg/BaseLibrary | ab318220101624c16c542b9bff47d70c412f8c04 | e05a719ced08c7f7055867d5116a283c068815b8 | refs/heads/master | 2020-04-05T11:26:57.322859 | 2020-03-17T07:18:46 | 2020-03-17T07:18:46 | 156,835,192 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 907 | java | package com.sjjd.wyl.baseandroid.bean;
/**
* Created by wyl on 2019/4/1.
*/
public class Register {
private String identity;//标识 如MAC值
private String date;//注册时间
private String limit;//注册限制/天数
private String mark;//标记
public String getDate() {
return date == null ? "" : date;
}
public void setDate(String date) {
this.date = date;
}
public String getIdentity() {
return identity == null ? "" : identity;
}
public void setIdentity(String identity) {
this.identity = identity;
}
public String getLimit() {
return limit == null ? "" : limit;
}
public void setLimit(String limit) {
this.limit = limit;
}
public String getMark() {
return mark == null ? "" : mark;
}
public void setMark(String mark) {
this.mark = mark;
}
}
| [
"[email protected]"
]
| |
33403312a2c38729d49f3bb2f8163725fb1784b9 | 9db6efa2f14baa0f4172272e361e1ed0c9940065 | /aliyun-java-sdk-slb/src/main/java/com/aliyuncs/slb/model/v20140515/ModifyLoadBalancerPayTypeResponse.java | 87c7b88135fe8e0d570476a99c19eb5883f626bd | [
"Apache-2.0"
]
| permissive | ResetFull/aliyun-openapi-java-sdk | 31fb2c2f7c2b939df4c9067f7a221c3f2c7cef2e | e299d1778d514cd555c870a3b1de117ae3b34474 | refs/heads/master | 2021-08-31T04:50:07.771585 | 2017-12-20T12:28:50 | 2017-12-20T12:28:50 | 114,978,860 | 1 | 0 | null | 2017-12-21T07:57:54 | 2017-12-21T07:57:54 | null | UTF-8 | Java | false | false | 1,670 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.aliyuncs.slb.model.v20140515;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.slb.transform.v20140515.ModifyLoadBalancerPayTypeResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class ModifyLoadBalancerPayTypeResponse extends AcsResponse {
private String requestId;
private Long orderId;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public Long getOrderId() {
return this.orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
@Override
public ModifyLoadBalancerPayTypeResponse getInstance(UnmarshallerContext context) {
return ModifyLoadBalancerPayTypeResponseUnmarshaller.unmarshall(this, context);
}
}
| [
"[email protected]"
]
| |
58944c491a1ae17da7e613c6eeeaf5d80120ea4e | d8c8c3ec4e50dbfd8785e3c9bb6886c2c7ea0728 | /src/ch5/ArrayEx4.java | e1a527c226c6ebb83a395e7db678fbb13009eebc | []
| no_license | truesunrise/java_ex | 61867459d04c3f1057e4392599f25882e4496bf2 | 8d51fe110eda44ca317b58655b93060bebce3a11 | refs/heads/master | 2020-08-06T11:16:28.741313 | 2020-01-02T12:23:27 | 2020-01-02T12:23:27 | 212,949,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,686 | java | package ch5;
/**
* System.arraycopy() 를 이용한 배열의 복사
*
* for문: 배열의 요소 하나하나에 접근해서 복사
* arraycopy(): 지정된 범위의 값들을 한 번에 통째로 복사 (각 요소들이 연속적으로 저장된 배열의 특성 때문에 이렇게 처리하는 것이 가능)
* => 배열의 복사는 for문보다 System.arraycopy()를 사용하는게 효율적
*
* System.arraycopy(num, 0, newNum, 0, num.length);
* => num[0]에서 newNum[0]으로 num.length개의 데이터를 복사
*/
public class ArrayEx4 {
public static void main(String[] args) {
// 다른 배열과 달리 char 배열은 for문을 사용하지 않고도 print()나 println()으로 배열에 저장된 모든 문자를 출력할 수 있다.
char[] abc = { 'A', 'B', 'C', 'D' };
char[] num = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
System.out.println(abc);
System.out.println(num);
// 배열 abc와 num을 붙여서 하나의 배열(result)로 만든다.
char[] result = new char[abc.length + num.length];
System.arraycopy(abc, 0, result, 0, abc.length);
System.arraycopy(num, 0, result, abc.length, num.length);
System.out.println(result); // ABCD0123456789
// 배열 abc를 배열 num의 첫번째 위치부터 배열 abc의 길이만큼 복사
System.arraycopy(abc, 0, num, 0, abc.length);
System.out.println(num); // ABCD456789
// 배열 num의 인덱스6 위치에 배열 abc 값 3개를 복사
System.arraycopy(abc, 0, num, 6, abc.length);
System.out.println(num); // ABCD45ABCD
}
}
| [
"[email protected]"
]
| |
efe33cae3cb9e49e245941904482aed2b9347e4d | 565aa34ccd96c5cba7f37980f0385995e0ac6d43 | /src/main/java/by/teachmeskills/taxes/model/CalculateTaxes.java | 2ad406c8f618911ec641e5fd5dd4a08e5d9a994a | []
| no_license | Yuliya-Davydova/homeworks-base | 2cb2d3dab88f1202b7a23447241ffae79301a9f0 | 5b5a6ce809710aa6365cc32b7108abbb82713317 | refs/heads/main | 2023-03-10T12:29:18.121686 | 2021-02-23T19:45:14 | 2021-02-23T19:45:14 | 311,418,897 | 0 | 0 | null | 2020-11-09T17:46:00 | 2020-11-09T17:46:00 | null | UTF-8 | Java | false | false | 1,335 | java | package by.teachmeskills.taxes.model;
import by.teachmeskills.taxes.model.laws.ComplexTaxLaw;
import by.teachmeskills.taxes.model.laws.PercentInRangeLaw;
import java.util.List;
public class CalculateTaxes {
public static void main(String[] args) {
double basePayInBelarus = 25; //базовая величина в РБ
TaxLaw belarusIncomeTax = new ComplexTaxLaw(List.of(
new PercentInRangeLaw(9, 0, 240 * basePayInBelarus),
new PercentInRangeLaw(15, 240 * basePayInBelarus, 600 * basePayInBelarus),
new PercentInRangeLaw(20, 600 * basePayInBelarus, 840 * basePayInBelarus),
new PercentInRangeLaw(25, 840 * basePayInBelarus, 1080 * basePayInBelarus),
new PercentInRangeLaw(30, 1080 * basePayInBelarus, Double.MAX_VALUE)
));
Salary superSalary = new SimpleSalary(650 * basePayInBelarus, belarusIncomeTax);
for (Tax tax : superSalary.taxes()) {
System.out.println(tax);
}
System.out.println();
System.out.println("Salary: " + superSalary.total());
double taxes = superSalary.taxes().stream().mapToDouble(t -> t.amount()).sum();
System.out.println("Total taxes: " + taxes);
System.out.println("On hands: " + (superSalary.total() - taxes));
}
}
| [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.