blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a0745bc5addffe3790606e40520e690a47304919 | 215480e6ee19beb7fe06b2fd2264940275a08128 | /456/src/com/company/BreakAndContinueDemo02.java | 6ccbda3e9328e3fa69f553c0e0fe15bec186c9b0 | [
"Apache-2.0"
] | permissive | 19935816340/JavaSE02 | 87ab5ecb0da9502703864d1b460e23443f54e6cf | c44bab64aa491c52a5f6cb90e0edbcaa229669d5 | refs/heads/master | 2022-04-22T00:51:13.449421 | 2020-04-21T13:39:26 | 2020-04-21T13:39:26 | 257,607,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.company;
public class BreakAndContinueDemo02 {
public static void main(String[] args) {
//关于continue的入门案例
//打印1~10之间,所有不是3的倍数的整数
for (int i = 1; i < 10; i++) {
if (i % 3 == 0)
continue;
//如果不是3的倍数,就打印i
System.out.println(i);
}
}
}
| [
"63945531+19935816340@users.noreply.github.com"
] | 63945531+19935816340@users.noreply.github.com |
09b09ca89a32f60a33e2ec90e59cadc8fae95919 | afef80e3196c7243fd25dce7a02285a44b68482d | /src/main/java/com/gimnasio/gimnasio/GimnasioDao/GimnasioClienteDao.java | 540182ddfb7de449e95190e6ef3558a2fb6eae85 | [] | no_license | fdagz96/GymTech | c81fe5f33f252cbb9fc61edaf771b7682fefc08e | 23d6b1abe6b7d982b5983f9aef3f093095817b63 | refs/heads/master | 2020-04-24T00:40:56.980665 | 2019-02-20T01:04:17 | 2019-02-20T01:04:17 | 171,573,537 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,364 | java | package com.gimnasio.gimnasio.GimnasioDao;
import com.gimnasio.gimnasio.repositories.IClienteRepository;
import com.gimnasio.gimnasio.repositories.IGymRepository;
import com.gimnasio.gimnasio.utileria.Cliente;
import com.gimnasio.gimnasio.utileria.Gimnasio;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class GimnasioClienteDao {
List<Cliente> clien=new ArrayList<>();
@Autowired
IGymRepository iGimnasioRepository;
@Autowired
IClienteRepository iClienteRepository;
public boolean registroCliente (String id, Cliente cliente) {
Gimnasio gym =iGimnasioRepository.findGimnasioById(id);
if(gym!=null){
cliente.setIdgym(gym.getId());
clien.add(cliente);
gym.setClientes(clien);
iClienteRepository.save(cliente);
iGimnasioRepository.save(gym);
return true;
}
else{
return false;
}
}
public List<Cliente> getClientesDeGimnasio(String id) {
Gimnasio gym = iGimnasioRepository.findGimnasioById(id);
return gym.getClientes();
}
public Cliente getClienteById(String idCliente) {
return iClienteRepository.findClienteById(idCliente);
}
}
| [
"gym.tech.communication@gmail.com"
] | gym.tech.communication@gmail.com |
c69976afd36e63890f846505e6c19d1e3bc4d0a4 | bea2b2ec96172f416be093eb49fc44543946af18 | /src/main/java/pathfinder/datastructures/Path.java | 12f5ee2b298901c6fd694fd44e672646985c9d04 | [] | no_license | rhuang1564/CampusMaps | 50486909b6af54872657008670cc899a9873272a | a11d0a03ac53c05571c57ef9481f5e7855d738de | refs/heads/master | 2022-05-29T05:18:13.146613 | 2019-10-14T00:50:24 | 2019-10-14T00:50:24 | 214,915,568 | 0 | 0 | null | 2022-05-20T21:12:19 | 2019-10-14T00:35:57 | Java | UTF-8 | Java | false | false | 9,607 | java | package pathfinder.datastructures;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* This represents an immutable path between two nodes with types T , particularly
* {@link Path#getStart()} and {@link Path#getEnd()}. Also contains a cached
* version of the total cost along this path, for efficient repeated access.
*/
public class Path<T> implements Iterable<Path<T>.Segment> {
// AF(this) =
// first node with type T in the path => start
// each "step" along the path between nodes with types T => elements of list path, where
// path.get(0) is the first step from the start node with type T to an intermediate node, and
// path.get(path.size() - 1) is the final step from an intermediate node with type T to the end
// total cost along the path => cost
// the destination node with type T in this path, opposite the start node with type T => getEnd()
// Rep Invariant:
// cost >= 0 &&
// Double.isFinite(cost) &&
// start != null &&
// path != null &&
// path does not contain null elements
/**
* The total cost along all the segments in this path.
*/
private double cost;
/**
* The node with type T at the beginning of this path.
*/
private T start;
/**
* The ordered sequence of segments representing a path between nodes.
*/
private List<Segment> path;
/**
* Creates a new, empty path containing a start node. Essentially this represents a path
* from the start node with type T to itself with a total cost of "0".
* @param start The starting node with type T of the path.
* @spec.requires start to be immutable or never to be modified
*/
public Path(T start) {
this.start = start;
this.cost = 0;
this.path = new ArrayList<>();
checkRep();
}
/**
* Appends a new single segment to the end of this path, originating at the current last node
* in this path and terminating at {@code newEnd}. The cost of adding this additional segment
* to the existing path is {@code segmentCost}. Thus, the returned Path represents a path
* from {@code this.getStart()} to {@code newEnd}, with a cost of {@code this.getCost() +
* segmentCost}.
*
* @param newEnd The node with type T being added at the end of the segment being appended to this path
* @param segmentCost The cost of the segment being added to the end of this path.
* @return A new path representing the current path with the given segment appended to the end.
*/
public Path<T> extend(T newEnd, double segmentCost) {
checkRep();
//
Path<T> extendedPath = new Path<>(start);
extendedPath.path.addAll(this.path);
extendedPath.path.add(new Segment(this.getEnd(), newEnd, segmentCost));
extendedPath.cost = this.cost + segmentCost;
//
extendedPath.checkRep();
checkRep();
//
return extendedPath;
}
/**
* @return The total cost along this path.
*/
public double getCost() {
return cost;
}
/**
* @return The node with type T at the beginning of this path.
*/
public T getStart() {
return start;
}
/**
* @return The node with type T at the end of this path, which may be the start node with type T if this path
* contains no segments (i.e. this path is from the start node with type T to itself).
*/
public T getEnd() {
if(path.size() == 0) {
return start;
}
return path.get(path.size() - 1).getEnd();
}
/**
* @return An iterator of the segments in this path, in order, beginning from the starting
* node with type T and ending at the end node. In the case that this path represents a path between
* the start node with type T and itself, this iterator contains no elements. This iterator does not
* support the optional {@link Iterator#remove()} operation and will throw an
* {@link UnsupportedOperationException} if {@link Iterator#remove()} is called.
*/
@Override
public Iterator<Segment> iterator() {
// Create a wrapping iterator to guarantee exceptional behavior on Iterator#remove.
return new Iterator<Segment>() {
private Iterator<Segment> backingIterator = path.iterator();
@Override
public boolean hasNext() {
return backingIterator.hasNext();
}
@Override
public Path<T>.Segment next() {
return backingIterator.next();
}
@Override
public void remove() {
throw new UnsupportedOperationException("Paths may not be modified.");
}
};
}
/**
* Ensures that the representation invariant has not been violated. Returns normally if
* there is no violation.
*/
private void checkRep() {
assert cost >= 0;
assert Double.isFinite(cost);
assert start != null;
assert path != null;
for(Segment segment : path) {
assert segment != null;
}
}
/**
* Checks this path for equality with another object. Two paths are equal if and only if
* they contain exactly the same sequence of segments in the same order. In the case that
* both paths are empty, they are only equal if their starting node with type T is equal.
*
* @param obj The object to compare with {@code this}.
* @return {@literal true} if and only if {@code obj} is equal to {@code this}.
*/
@Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
if(!(obj instanceof Path)) {
return false;
}
Path other = (Path) obj;
if(this.path.size() != other.path.size()) {
return false;
}
if(this.path.size() == 0 && !this.start.equals(other.start)) {
return false;
}
for(int i = 0; i < this.path.size(); i++) {
if(!this.path.get(i).equals(other.path.get(i))) {
return false;
}
}
return true;
}
@Override
public int hashCode() {
return (31 * start.hashCode()) + path.hashCode();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(start.toString());
for(Segment segment : path) {
sb.append(" =(");
sb.append(String.format("%.3f", segment.getCost()));
sb.append(")=> ");
sb.append(segment.getEnd().toString());
}
return sb.toString();
}
/**
* Segment represents a single segment as part of a longer, more complex path between nodes.
* Segments are immutable parts of a larger path that cannot be instantiated directly, and
* are created as part of larger paths by calling Path.extend(T, double).
*/
public class Segment {
// AF(this) = the beginning of the path segment => start
// the end of the path segment => end
// the cost of travelling along this segment => cost
// Rep. Invariant = start != null
// && end != null
// && Double.isFinite(cost)
/**
* The beginning of this segment.
*/
private final T start;
/**
* The end of this segment.
*/
private final T end;
/**
* The cost of travelling this segment.
*/
private final double cost;
/**
* Constructs a new segment with the provided characteristics.
*
* @param start The starting node with type T of this segment.
* @param end The ending node with type T of this segment.
* @param cost The cost of travelling this segment.
* @throws NullPointerException if either node with type T is null.
* @throws IllegalArgumentException if cost is infinite or NaN
*/
private Segment(T start, T end, double cost) {
if(start == null || end == null) {
throw new NullPointerException("Segments cannot have null nodes.");
}
if(!Double.isFinite(cost)) {
throw new IllegalArgumentException("Segment cost may not be NaN or infinite.");
}
this.start = start;
this.end = end;
this.cost = cost;
// checkRep not necessary: it's impossible for this constructor to create a Segment that
// violates the rep invariant because of the exception check, and all fields are final
// and immutable themselves.
}
/**
* @return The beginning node with type T of this segment.
*/
public T getStart() {
// Note: Since Points are immutable, this isn't rep exposure.
return this.start;
}
/**
* @return The ending node with type T of this segment.
*/
public T getEnd() {
return this.end;
}
/**
* @return The cost of this segment.
*/
public double getCost() {
return this.cost;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("[");
sb.append(start.toString());
sb.append(" -> ");
sb.append(end.toString());
sb.append(" (");
sb.append(String.format("%.3f", cost));
sb.append(")]");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if(this == obj) {
return true;
}
if(!(obj instanceof Path<?>.Segment)) {
return false;
}
Path<?>.Segment other = (Path<?>.Segment) obj;
return other.getStart().equals(this.getStart())
&& other.getEnd().equals(this.getEnd())
&& (Double.compare(this.cost, other.cost) == 0);
}
@Override
public int hashCode() {
int result = start.hashCode();
result += (31 * result) + end.hashCode();
result += (31 * result) + Double.hashCode(cost);
return result;
}
}
}
| [
"rrhuang@uw.edu"
] | rrhuang@uw.edu |
7669aff1fa688cb4b1850b60f1e2c04079b4acee | 68a32a6749eedbdcc7ca248cc6201467256e46d0 | /src/main/java/nasa/logic/parser/ExportCalendarCommandParser.java | 376cdf10ec77cdd10f393c7cf433d73b9001fcb3 | [
"MIT"
] | permissive | CharmaineKoh/main | 5016501fac887b530941af2252e4e0209729f252 | 283a91b618712c343a3dd78a438d99f51159ddd6 | refs/heads/master | 2021-01-05T03:26:37.021762 | 2020-04-13T15:54:00 | 2020-04-13T15:54:00 | 240,862,049 | 0 | 0 | null | 2020-02-16T09:11:38 | 2020-02-16T09:11:37 | null | UTF-8 | Java | false | false | 1,083 | java | package nasa.logic.parser;
import static nasa.logic.parser.CliSyntax.PREFIX_FILEPATH;
import java.nio.file.Path;
import nasa.logic.commands.ExportCalendarCommand;
import nasa.logic.parser.exceptions.ParseException;
/**
* Parses input arguments and return an ExportCalendarCommand object.
*/
public class ExportCalendarCommandParser implements Parser<ExportCalendarCommand> {
/**
* Parses the given {@code String} of arguments in the context of the ExportCalendarCommand
* and returns an ExportCalendarCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/
public ExportCalendarCommand parse(String args) throws ParseException {
ArgumentMultimap argMultimap =
ArgumentTokenizer.tokenize(args, PREFIX_FILEPATH);
Path filepath = null;
if (argMultimap.getValue(PREFIX_FILEPATH).isPresent()) {
filepath = ParserUtil.parseFilePath(argMultimap.getValue(PREFIX_FILEPATH).get());
}
return new ExportCalendarCommand(filepath);
}
}
| [
"kester.ng@visenze.com"
] | kester.ng@visenze.com |
f2aea436a0041c68c7d03f09417e20e84807a49b | c20d273f38efe31e7f128ce4b1b7449addb8af4c | /app/src/test/java/kz/helpnetwork/myapplorainstall/ExampleUnitTest.java | a02cf6256f2bfbd6ccbdbe0fa0ff7dca2c8de975 | [] | no_license | salmovs/MyAppLoraInstall | 8e229af6ff5185de4206d542d73d6d467bebec77 | bc5ebe8eb62243b5d99c213c64b02a01694bf9cc | refs/heads/master | 2020-03-30T15:23:47.260927 | 2018-10-03T04:39:26 | 2018-10-03T04:39:26 | 151,361,167 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package kz.helpnetwork.myapplorainstall;
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);
}
} | [
"salmov@rambler.ru"
] | salmov@rambler.ru |
4ce718a9b46be2678274d121ac4b8bda53161e33 | b67f93f8268bd78ba3988ece05ed49dd498b0106 | /src/main/java/com/bluegraybox/sample/connection_pool/ConnectionWrapper.java | cbd78f33a1e7b26d8dce529490ac4ad0f2be8ac6 | [
"MIT"
] | permissive | bluegraybox/Sample-Connection-Pool | 9dc78423e0d3924a9efe2886e752f136414acd0a | 9ddf14817eab1ff17ec928538dca14c694395ec0 | refs/heads/master | 2016-09-05T21:34:58.130253 | 2014-03-21T09:36:50 | 2014-03-21T09:36:50 | 1,599,626 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,291 | java | package com.bluegraybox.sample.connection_pool;
import java.sql.Connection;
import java.sql.SQLException;
/**
* Wraps a Connection to keep track of state information needed by an {@link ExampleConnectionPool}.
* <p>The lifecycle for a ConnectionWrapper is: Available -> checkOut() -> In Use -> checkIn() -> Used.
* The {@link Connection} methods can only be invoked while it is In Use.
* Each wrapper can only be used once. To get a new wrapper for the same SQL connection, use {@link #reWrap()}.</p>
* <p>The boilerplate methods to wrap the Connection are defined in {@link ConnectionPassThrough}, just for tidiness.</p>
*/
class ConnectionWrapper extends ConnectionPassThrough {
private static enum State { AVAILABLE, IN_USE, USED }
private State state = State.AVAILABLE;
private long lastUsed = 0;
/**
* @param conn An actual SQL database connection.
* @see ExampleConnectionPool
*/
public ConnectionWrapper(Connection conn) {
super(conn);
}
/**
* Returns the last time this connection was used, or when it was checked out.
* @return System time in milliseconds.
* @throws IllegalStateException if the connection is not in use.
*/
public long getLastUsed() {
if (! state.equals(State.IN_USE))
throw new IllegalStateException("Connection not in use");
return lastUsed;
}
/**
* A connection is available if it has not been checked out yet.
*/
public boolean available() {
return state.equals(State.AVAILABLE);
}
/**
* A connection is in use if it has been checked out, but not checked in yet.
*/
public boolean inUse() {
return state.equals(State.IN_USE);
}
/**
* Mark the connection as in use.
* Note that each connection can only be checked out once.
* @return false if the connection is already in use.
* @throws IllegalStateException if the connection has already been checked in.
*/
public synchronized boolean checkOut() {
if (state.equals(State.IN_USE))
return false;
if (state.equals(State.USED))
throw new IllegalStateException("Connection has already been checked in, and cannot be re-used.");
state = State.IN_USE;
lastUsed = System.currentTimeMillis();
return true;
}
/**
* Mark the connection as no longer in use.
* @throws IllegalStateException if the connection was not in use.
*/
public void checkIn() {
if (state.equals(State.USED))
throw new IllegalStateException("Connection already checked in");
if (! state.equals(State.IN_USE))
throw new IllegalStateException("Connection not checked out");
state = State.USED;
}
/**
* Create a new ConnectionWrapper for our SQL connection.
* @throws IllegalStateException if the connection has not been checked in.
*/
public ConnectionWrapper reWrap() {
if (! state.equals(State.USED))
throw new IllegalStateException("Connection not checked in");
return new ConnectionWrapper(this.conn);
}
/**
* Checks that the connection is in use, and updates its idle time.
* Protected, not private, so we can extend this class for testing.
* @throws IllegalStateException if the connection has not been checked out, or has already been checked in.
*/
protected void validateState() {
if (! state.equals(State.IN_USE))
throw new IllegalStateException("Connection not in use");
lastUsed = System.currentTimeMillis();
}
/**
* Because the {@link ConnectionPool} is managing the opening and closing of connections,
* the normal Connection.close() does nothing.
* The connection pool uses the {@link #forceClose()} method instead.
*/
public void close() throws SQLException {
/* FIXME: Arguably, this should throw a runtime exception, since it should never be called.
* If you're converting code that used to create and close its own connections, you should
* replace all the close() calls with releaseConnection(). But you don't want ugly surprises
* (runtime production failures) if you miss anything.
*/
}
/**
* Actually close our database connection (unlike {@link #close()}).
* This is used internally by the {@link ConnectionPool} implementation, and is not part of the public interface.
* Unlike other Connection methods, this does not validate the state of the connection.
*/
protected void forceClose() throws SQLException {
this.conn.close();
}
}
| [
"colin@bluegraybox.com"
] | colin@bluegraybox.com |
568a098e61ea0f4c77a5637dc2c9dbeb17222cd1 | 9e92540d8d29e642e42cee330aeb9c81c3ab11db | /D2FSClient/src/main/java/com/emc/d2fs/services/d2_template_service/SetTemplateResponse.java | b6c52e397c91eb9e257a5a5144e81260e548e107 | [] | no_license | ambadan1/demotrial | c8a64f6f26b5f0e5a9c8a2047dfb11d354ddec42 | 9b4dd17ad423067eca376a4bad204986ed039fee | refs/heads/master | 2020-04-29T10:52:03.614348 | 2019-03-17T09:26:26 | 2019-03-17T09:26:26 | 176,076,767 | 0 | 0 | null | 2019-03-17T09:26:27 | 2019-03-17T08:48:00 | Java | UTF-8 | Java | false | false | 1,305 | java |
package com.emc.d2fs.services.d2_template_service;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <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">
* <attribute name="success" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "setTemplateResponse")
public class SetTemplateResponse {
@XmlAttribute(name = "success", required = true)
protected boolean success;
/**
* Gets the value of the success property.
*
*/
public boolean isSuccess() {
return success;
}
/**
* Sets the value of the success property.
*
*/
public void setSuccess(boolean value) {
this.success = value;
}
}
| [
"aniket.ambadkar@novartis.com"
] | aniket.ambadkar@novartis.com |
40bcaed0e76797981447fa4ab884921ce9390bcc | b7b274ac7784a953fa38147f7596aa1e24bb5583 | /src/main/java/com/smalaca/rentalapplication/infrastructure/persistence/jpa/apartmentbookinghistory/JpaApartmentBookingHistoryRepository.java | 8de724d9bd721b50a9530612bf163cc926b05aef | [] | no_license | smalaca/clean-arch-25 | 9f0879c0947005fc730e27cb18f46a9cde39ab53 | a254d001501b1c71ceeccb874d0a50feedd3e7fe | refs/heads/master | 2023-02-02T17:40:53.828252 | 2020-12-19T02:59:39 | 2020-12-20T09:32:26 | 323,036,657 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,231 | java | package com.smalaca.rentalapplication.infrastructure.persistence.jpa.apartmentbookinghistory;
import com.smalaca.rentalapplication.domain.apartmentbookinghistory.ApartmentBookingHistory;
import com.smalaca.rentalapplication.domain.apartmentbookinghistory.ApartmentBookingHistoryRepository;
class JpaApartmentBookingHistoryRepository implements ApartmentBookingHistoryRepository {
private final SpringJpaApartmentBookingHistoryRepository springJpaApartmentBookingHistoryRepository;
JpaApartmentBookingHistoryRepository(SpringJpaApartmentBookingHistoryRepository springJpaApartmentBookingHistoryRepository) {
this.springJpaApartmentBookingHistoryRepository = springJpaApartmentBookingHistoryRepository;
}
@Override
public boolean existsFor(String apartmentId) {
return springJpaApartmentBookingHistoryRepository.existsById(apartmentId);
}
@Override
public ApartmentBookingHistory findFor(String apartmentId) {
return springJpaApartmentBookingHistoryRepository.findById(apartmentId).get();
}
@Override
public void save(ApartmentBookingHistory apartmentBookingHistory) {
springJpaApartmentBookingHistoryRepository.save(apartmentBookingHistory);
}
}
| [
"ab13.krakow@gmail.com"
] | ab13.krakow@gmail.com |
df2171a8ccbb8785207653f08cfe0a34b695d6f4 | da6aaf2b64b3dcbe9da1d37cfd5ef73166832158 | /tree/construct_binary_tree_from_preorder_and_inorder_traversal.java | 2c84e62793f24e1e6d83310f00c27895cb418d92 | [] | no_license | Jug1378/leetcode | 97995624e66667d128246b2e084b5b81a981c88f | 2205f338a341c2deee2a340e0bd05d690789a2cb | refs/heads/master | 2021-01-20T21:00:40.485626 | 2014-04-14T19:23:54 | 2014-04-14T19:23:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 711 | java | public class Solution {
public TreeNode buildTree(int[] preorder, int[] inorder) {
int l1 = preorder.length;
int l2 = inorder.length;
return build(preorder, 0, l1-1, inorder, 0, l2-1);
}
public TreeNode build(int[] preorder, int pl, int pr, int[] inorder, int il, int ir) {
if(pl > pr || il > ir) return null;
int head = preorder[pl];
int k = 0;
TreeNode root = new TreeNode(head);
for(int i = il; i <= ir; i++) {
if(inorder[i] == head)
{
k = i;
break;
}
}
root.left = build(preorder, pl+1, pl+k-il, inorder, il, k-1);
root.right = build(preorder, pl+k-il+1, pr, inorder, k+1, ir);
return root;
}
} | [
"zhuge1378@gmail.com"
] | zhuge1378@gmail.com |
f91ad2a874a427644e98ba6ef70ef749a15e4002 | 9e7f2456c04cd4f656298d1ab63fd7cf051958e1 | /app/src/main/java/com/example/calculator/MainActivity.java | ad8bcf5a2c512aa54dc1eb8021b6d73ac273f413 | [
"Apache-2.0"
] | permissive | songjachin/calculator | 329963a888488f8ca6b355897a2ebde26ae56e69 | c4f7e93ec3b706388e28039d41bbfcd0af47066e | refs/heads/master | 2021-01-06T12:02:03.903921 | 2020-02-19T16:28:27 | 2020-02-19T16:28:27 | 241,319,189 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,342 | java | package com.example.calculator;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
private TextView tv_problem;
private TextView tv_result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv_problem = findViewById(R.id.tv_problem);
tv_result = findViewById(R.id.tv_result);
findViewById(R.id.btn_0).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_1).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_2).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_3).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_4).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_5).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_6).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_7).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_8).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_9).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_cal).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_clc).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_dev).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_dot).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_equal).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_minus).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_mul).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_plus).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_left).setOnClickListener(new MyOnClickListener());
findViewById(R.id.btn_right).setOnClickListener(new MyOnClickListener());
}
private String problemText = "";
private String resultText = "";
private String lastInput = "";
private Arith arith = new Arith();
class MyOnClickListener implements View.OnClickListener {
@Override
public void onClick(View view) {
int btn = view.getId();
String inputText;
inputText = ((TextView) view).getText().toString();
Log.d(TAG, " onClick: " + btn + " inputText " + inputText);
switch (view.getId()) {
case R.id.btn_clc:
handleC();
break;
case R.id.btn_0:
case R.id.btn_1:
case R.id.btn_2:
case R.id.btn_3:
case R.id.btn_4:
case R.id.btn_5:
case R.id.btn_6:
case R.id.btn_7:
case R.id.btn_8:
case R.id.btn_9:
if (!lastInput.equals(")")) {
problemText = problemText + inputText;
tv_problem.setText(problemText);
lastInput = inputText;
}
break;
case R.id.btn_dot://输入是点时需判定
if (!lastInput.equals("") && lastIsNum(lastInput) && !numContainsDot(problemText)) //上一个数有小数点,一个数不能有两个小数点
{
problemText = problemText + inputText;
tv_problem.setText(problemText);
lastInput = inputText;
}
break;
case R.id.btn_left:
if (!lastIsNum(lastInput)) {
problemText = problemText + inputText;
tv_problem.setText(problemText);
lastInput = inputText;
}
break;
case R.id.btn_right:
if (lastIsNum(lastInput)) {
problemText = problemText + inputText;
tv_problem.setText(problemText);
lastInput = inputText;
}
//
break;
case R.id.btn_minus:
if (!lastInput.equals("-")) {
problemText = problemText + inputText;
tv_problem.setText(problemText);
lastInput = inputText;
}
break;
case R.id.btn_plus:
case R.id.btn_dev:
case R.id.btn_mul:
if (problemText.length() < 1) break;
if (!lastInput.equals("(") && !lastInput.equals("+") && !lastInput.equals("-") && !lastInput.equals("÷") && !lastInput.equals("×")) {
problemText = problemText + inputText;
tv_problem.setText(problemText);
lastInput = inputText;
}
break;
case R.id.btn_equal:
if (lastInput.equals("=")) {
problemText = resultText;
tv_problem.setText(problemText);
resultText = "";
tv_result.setText(resultText);
lastInput = problemText.substring(problemText.length() - 1);
} else {
resultText = arith.calculate(problemText);
tv_result.setText(resultText);
lastInput = inputText;
}
break;
case R.id.btn_cal:
if (problemText.length() <= 1) handleC();
if (problemText.length() > 1) {
handleBack();
Log.d(TAG, "onClick: lastinput " + lastInput);
}
break;
default:
break;
}
}
}
private void handleC() {
problemText = "";
resultText = "";
lastInput = "";
tv_problem.setText(problemText);
tv_result.setText(resultText);
}
private void handleBack() {
int i = problemText.length();
problemText = problemText.substring(0, i - 1);
tv_problem.setText(problemText);
lastInput = problemText.substring(i - 1);
}
private boolean numContainsDot(String str) {
if (str.length() == 0) return false;
int p = str.length() - 1;
char c = str.charAt(p);
while (c != '+' && c != '-' && c != '÷' && c != '×' && p > 0) {
p--;
c = str.charAt(p);
}
return str.substring(p, str.length() - 1).contains(".");
}
private boolean lastIsNum(String last) {
if (last == null) return false;
char c = last.charAt(0);
boolean b = c <= '9' && c >= '0';
return b;
}
}
| [
"song_2_vv@163.com"
] | song_2_vv@163.com |
f0f417be1e8cf7eacb97ee89cf3dc8d6f7215df2 | 851557e3d52a1e00fe443b66c14565478c818743 | /oldVersion/src/main/java/reloaded/convintobot/Settings.java | 97f91695a25d274f32ac8ce20b35634968b9170d | [] | no_license | sergiolaca/ConvintoBot | e7186a0ae59058abfc7092363d9059112f976c3d | ea56baed668bf5ac107e5cbd9a852b4d026a3e6f | refs/heads/master | 2023-06-03T05:20:10.438912 | 2020-04-20T19:14:24 | 2020-04-20T19:14:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,375 | java | package reloaded.convintobot;
import java.io.File;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONObject;
public class Settings {
private long startTime;
private boolean phraseStatus;
private String gToken, tToken, id, chat, botName, dir = "";
private ArrayList<String> admins = new ArrayList<String>();
public boolean loadSettings(long sTime){
try {
if(!FileO.exist("config.json")){
Main.logger("File \"config.json\" not found.");
FileO.newFile("config.json");
FileO.writer("{", "config.json");
FileO.addWrite("config.json", " \"gToken\" : \"INSERIT YOUR GOOGLE APIS TOKEN HERE\",");
FileO.addWrite("config.json", " \"tToken\" : \"INSERIT YOUR TELEGRAM TOKEN HERE\",");
FileO.addWrite("config.json", " \"id\" : \"INSERIT YOUR CHANNEL ID HERE\",");
FileO.addWrite("config.json", " \"chat\" : \"INSERIT THE CHAT ID HERE\",");
FileO.addWrite("config.json", " \"botName\" : \"INSERIT THE NAME OF YOUR BOT HERE\",");
FileO.addWrite("config.json", " \"admins\" : [");
FileO.addWrite("config.json", " \"INSERIT THE TELEGRAM ACCOUNT ID OF YOUR FIRST ADMIN HERE\",");
FileO.addWrite("config.json", " \"INSERIT THE TELEGRAM ACCOUNT ID OF YOUR SECOND ADMIN HERE\",");
FileO.addWrite("config.json", " \"...\"");
FileO.addWrite("config.json", " ]");
FileO.addWrite("config.json", "}");
Main.logger("File \"config.json\" created. Edit your settings and then turn on again the bot.");
return false;
}
Main.loggerL("Loading configs... ");
JSONObject config = new JSONObject(FileO.allLine("config.json"));
gToken = config.getString("gToken");
tToken = config.getString("tToken");
id = config.getString("id");
chat = config.getString("chat");
botName = config.getString("botName");
startTime = sTime;
Main.logger("done");
dir = System.getProperty("user.dir") + File.separator;
JSONArray admin = config.getJSONArray("admins");
for(int i = 0; i < admin.length(); i++) admins.add(admin.getString(i));
} catch (Exception e) {
Main.ea.alert(e);
return false;
}
return true;
}
public ArrayList<String> getAdmins(){
return admins;
}
public String getBotName(){
return botName;
}
public String getChatId(){
return chat;
}
public String getChannelId(){
return id;
}
public String getTelegramToken(){
return tToken;
}
public String getGoogleToken(){
return gToken;
}
public String getDefaultDirectory(){
return dir;
}
public boolean getPhraseStatus(){
return phraseStatus;
}
public void setPhraseStatus(boolean status){
phraseStatus = status;
}
public void removeDirectory(){
dir = "";
}
public String getGoogleApiFullUrl(int n){
return "https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=" + id + "&order=date&type=video&key=" + gToken + "&maxResults=" + n;
}
public String getUrlVideoType(String id){
return "https://www.googleapis.com/youtube/v3/videos?part=snippet&id=" + id + "&maxResults=1&key=" + gToken;
}
public String getUpTime(){
long estimatedTime = (System.currentTimeMillis() - startTime) / 1000;
int hours = (int) estimatedTime / 3600;
int secs = (int) estimatedTime - hours * 3600;
int mins = secs / 60;
secs = secs - mins * 60;
return hours + ":" + mins + ":" + secs;
}
}
| [
"strdjn@gmail.com"
] | strdjn@gmail.com |
016d082d8188a3707dae8f8e1bf324114c214a98 | 4faa0f06b794d68018fdba00bef8b4ba3a391b61 | /mobile/src/main/java/intrepid/weardemo/services/WearableService.java | acc6cec439035091958971b8fa2564aef3f5f597 | [] | no_license | IntrepidPursuits/wear-music-app | 60652e3d6e72128dae57f82ea0c68da73003b780 | 9dd88f44faa01162fa237cfd9f0976d14d5a061e | refs/heads/master | 2016-09-16T04:27:15.773265 | 2014-09-12T17:59:39 | 2014-09-12T17:59:39 | 23,431,564 | 6 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,314 | java | package intrepid.weardemo.services;
import android.content.Intent;
import android.net.Uri;
import android.os.IBinder;
import android.os.ResultReceiver;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.data.FreezableUtils;
import com.google.android.gms.wearable.DataEvent;
import com.google.android.gms.wearable.DataEventBuffer;
import com.google.android.gms.wearable.DataMap;
import com.google.android.gms.wearable.DataMapItem;
import com.google.android.gms.wearable.MessageEvent;
import com.google.android.gms.wearable.Node;
import com.google.android.gms.wearable.Wearable;
import com.google.android.gms.wearable.WearableListenerService;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class WearableService extends WearableListenerService {
private static final String TAG = "DataLayerSample";
private static final String START_ACTIVITY_PATH = "/start-activity";
private static final String DATA_ITEM_RECEIVED_PATH = "/count";
public ResultReceiver mReceiver;
public WearableService() {
super();
}
@Override
public void onCreate() {
super.onCreate();
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onDataChanged(DataEventBuffer dataEvents) {
final List<DataEvent> events = FreezableUtils
.freezeIterable(dataEvents);
GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.build();
ConnectionResult connectionResult =
googleApiClient.blockingConnect(30, TimeUnit.SECONDS);
if (!connectionResult.isSuccess()) {
Log.e(TAG, "Failed to connect to GoogleApiClient.");
return;
}
// Loop through the events and send a message
// to the node that created the data item.
for (DataEvent event : events) {
Uri uri = event.getDataItem().getUri();
DataMapItem item = DataMapItem.fromDataItem(event.getDataItem());
DataMap map = item.getDataMap();
Boolean containsKey = map.containsKey("HR");
if (containsKey) {
int heartRate = map.getInt("HR");
Log.d("HR", String.valueOf(heartRate));
// Broadcast message to wearable activity for display
Intent messageIntent = new Intent();
messageIntent.setAction("message-forwarded-from-data-layer");
messageIntent.putExtra("heartRate", heartRate);
LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);
} else if (map.containsKey("Track") || map.containsKey("Artist")) {
String trackName = map.getString("Track");
String artistName = map.getString("Artist");
Intent messageIntent = new Intent();
messageIntent.setAction("message-forwarded-from-data-layer");
messageIntent.putExtra("Track", trackName);
messageIntent.putExtra("Artist", artistName);
LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent);
}
// Intent returnIntent = new Intent("SERVICE");
// returnIntent.putExtra("HR", heartRate);
// sendBroadcast(returnIntent);
// Get the node id from the host value of the URI
// String nodeId = uri.getHost();
// // Set the data of the message to be the bytes of the URI.
// byte[] payload = uri.toString().getBytes();
//
// // Send the RPC
// Wearable.MessageApi.sendMessage(googleApiClient, nodeId,
// DATA_ITEM_RECEIVED_PATH, payload);
}
}
@Override
public void onMessageReceived(MessageEvent messageEvent) {
super.onMessageReceived(messageEvent);
}
@Override
public void onPeerConnected(Node peer) {
super.onPeerConnected(peer);
}
@Override
public void onPeerDisconnected(Node peer) {
super.onPeerDisconnected(peer);
}
}
| [
"chris@intrepid.io"
] | chris@intrepid.io |
66b9a1674c5763be993ba96571e3f9af8556eedc | 4bb83687710716d91b5da55054c04f430474ee52 | /dsrc/sku.0/sys.server/compiled/game/script/theme_park/poi/tatooine/pirate/poi_pirate_outpost8.java | 33af10008df8dbe354a4b30604ed5cfd24ac5af1 | [] | no_license | geralex/SWG-NGE | 0846566a44f4460c32d38078e0a1eb115a9b08b0 | fa8ae0017f996e400fccc5ba3763e5bb1c8cdd1c | refs/heads/master | 2020-04-06T11:18:36.110302 | 2018-03-19T15:42:32 | 2018-03-19T15:42:32 | 157,411,938 | 1 | 0 | null | 2018-11-13T16:35:01 | 2018-11-13T16:35:01 | null | UTF-8 | Java | false | false | 2,675 | java | package script.theme_park.poi.tatooine.pirate;
import script.*;
import script.base_class.*;
import script.combat_engine.*;
import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
import script.base_script;
import script.library.ai_lib;
import script.library.factions;
public class poi_pirate_outpost8 extends script.theme_park.poi.base
{
public poi_pirate_outpost8()
{
}
public int OnAttach(obj_id self) throws InterruptedException
{
String objective = poiGetObjective(self);
if (objective.equals("pirates"))
{
obj_id outpost = poiCreateObject(self, "center", "object/installation/turret/turret_tower_sm.iff", 0, 0);
setPirateFaction(outpost);
poiSetDestroyMessage(outpost, "outpostKilled");
obj_id tr1 = poiCreateNpc("st1", "pirate", 6, 6);
setPirateFaction(tr1);
obj_id tr2 = poiCreateNpc("st2", "pirate", -10, 13);
setPirateFaction(tr2);
obj_id tr3 = poiCreateNpc("st3", "pirate", -10, 11);
setPirateFaction(tr3);
obj_id tr4 = poiCreateNpc("st4", "pirate", 5, 5);
setPirateFaction(tr4);
obj_id tr5 = poiCreateNpc("st5", "pirate", 0, -5);
setPirateFaction(tr5);
obj_id tr6 = poiCreateNpc("st6", "pirate", 10, 2);
setPirateFaction(tr6);
attachScript(tr1, "theme_park.poi.tatooine.behavior.stormtrooper_stationary_poi");
attachScript(tr2, "theme_park.poi.tatooine.behavior.stormtrooper_stationary_poi");
attachScript(tr3, "theme_park.poi.tatooine.behavior.poi_waiting");
attachScript(tr4, "theme_park.poi.tatooine.behavior.poi_waiting");
String[] patrolPoints = new String[4];
patrolPoints[0] = "-20, 20";
patrolPoints[1] = "-20, -20.3";
patrolPoints[2] = "20, 20";
patrolPoints[3] = "20, -20";
ai_lib.setPatrolPath(tr5, patrolPoints);
String[] patrolPoints2 = new String[5];
patrolPoints2[0] = "15, 15";
patrolPoints2[1] = "15, -15.3";
patrolPoints2[2] = "-15, -15";
patrolPoints2[3] = "-15, 15";
patrolPoints2[4] = "-20, 20";
ai_lib.setPatrolPath(tr6, patrolPoints2);
}
return SCRIPT_CONTINUE;
}
public void setPirateFaction(obj_id target) throws InterruptedException
{
factions.setFaction(target, "pirate");
}
public int outpostKilled(obj_id self, dictionary params) throws InterruptedException
{
poiComplete(POI_SUCCESS);
return SCRIPT_CONTINUE;
}
}
| [
"tmoflash@gmail.com"
] | tmoflash@gmail.com |
51e0b2023e4e248b83da6dd57cd060ecb9b65e0d | b61c8a3b0d29ac69a3f858b24a78bcc407ef28e4 | /spring-rabbitmq/src/test/java/com/ytq/SSa.java | 3901116a5d8310fc822056c5bb67e6f1cb8d817d | [] | no_license | changeYe/spring-cloud-list | 16bcc961fa4c20e746ca733212680253d25ce12e | a80317c6c1181820fcb04ed508f0d5c4c214bd00 | refs/heads/master | 2022-11-17T07:35:53.152965 | 2020-06-21T11:58:02 | 2020-06-21T11:58:02 | 170,611,188 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package com.ytq;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ytq.m.annotation.BigDecimalFormat;
/**
* @author yuantongqin
* 2019/9/19
*/
public class SSa {
@BigDecimalFormat("###.##")
private BigDecimal age;
@JsonSerialize()
private String name;
public BigDecimal getAge() {
return age;
}
public void setAge(BigDecimal age) {
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"1335992463@qq.com"
] | 1335992463@qq.com |
48529b0c99e3c0723485c9da8e37afdc2fe76605 | fc07df47032fe362c9c21fe7c3eeb4ea19c34eed | /src/com/oa/commons/model/LoginInfo.java | 209f134372addf75c9632a77ab7cf74f670c57e3 | [] | no_license | admindxh/test7oa | 14b962bf5683ff8c0e155dede559f73530600893 | 00c9e7f7168bbedced1216e2fdb7a744dba71a5f | refs/heads/master | 2016-08-12T08:03:14.793248 | 2015-06-09T03:44:23 | 2015-06-09T03:44:23 | 36,922,234 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,277 | java | /**
* @Title: LoginInfo.java
* @date 2013-10-11 上午9:26:54
* @Copyright: 2013
*/
package com.oa.commons.model;
import java.sql.Timestamp;
/**
* 用户登录时的信息
* @author LiuJincheng
* @version 1.0
*
*/
public class LoginInfo implements java.io.Serializable{
/**
* @Fields serialVersionUID :
*/
private static final long serialVersionUID = 1L;
/**
* id uuid 自定义,用于一些业务操作
*/
private String id;
/**
* 登录类型 1:网页 2:安卓客户端
*/
private int loginType;
/**
* 登录ip 信息
*/
private IpInfo ipInfo;
/**
* 登陆时间
*/
private Timestamp loginTime;
public Timestamp getLoginTime() {
return loginTime;
}
public void setLoginTime(Timestamp loginTime) {
this.loginTime = loginTime;
}
public int getLoginType() {
return loginType;
}
public void setLoginType(int loginType) {
this.loginType = loginType;
}
public IpInfo getIpInfo() {
return ipInfo;
}
public void setIpInfo(IpInfo ipInfo) {
this.ipInfo = ipInfo;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
| [
"dengxh@WIN7-JAVA03.rimi.com"
] | dengxh@WIN7-JAVA03.rimi.com |
08b8c036f4792b6acb09336ec88db3ba53d8ed2d | 2c4c7f61dd1607154a8de2ba324abf90f886cc5a | /src/leetcode/Leetcode19.java | c159088d0f7401f4124ccd207f6c9849331288d6 | [] | no_license | coderookier/codingforoffer | be7ee19d8853dee0aaeed1fae6356923aa0996cd | 5837a3b9a25ceded845f16e2540eaa57ea2e34b4 | refs/heads/master | 2020-07-23T04:48:22.342724 | 2020-02-28T07:41:16 | 2020-02-28T07:41:16 | 207,449,908 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,192 | java | package leetcode;
import structure.ListNode;
/**
* @author gutongxue
* @date 2019/9/19 20:48
* 删除链表的倒数第N个节点
**/
public class Leetcode19 {
/**
*采用快慢指针,快指针先移动n步,慢指针再开始移动,则当快指针指到链表尾时,慢指针指向需要删除的前一个节点
*/
public ListNode removeNthFromEnd(ListNode head, int n) {
ListNode dummy = new ListNode(-1);
dummy.next = head;
ListNode fast = dummy;
ListNode slow = dummy;
for (int i = 1; i < n + 1; i++) {
fast = fast.next;
}
while (fast.next != null) {
fast = fast.next;
slow = slow.next;
}
slow.next = slow.next.next;
return dummy.next;
}
public static void main(String[] args) {
ListNode head = new ListNode(3);
head.next = new ListNode(4);
head.next.next = new ListNode(5);
Leetcode19 leetcode19 = new Leetcode19();
ListNode node = leetcode19.removeNthFromEnd(head, 2);
while (node != null) {
System.out.println(node.val);
node = node.next;
}
}
}
| [
"gupp0816@163.com"
] | gupp0816@163.com |
437fee1c382d6d868ba696399f93c0c543254fc4 | 44a9c106f9ac62064440cfa5b0459f19c3ea436a | /Tanks/battlefieldobjects/Rock.java | bf0dd2ca527bafac4d7561e0025ac5a4af488313 | [] | no_license | yurastepanyuk/HW | 9255eafc12ac5eb25b094cf1025370b62e8a7a07 | 376d9bbbe682b2d2b5cdb9b6c7670853e60611ed | refs/heads/master | 2020-04-15T10:56:54.413219 | 2016-02-28T16:27:49 | 2016-02-28T16:27:49 | 37,338,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 705 | java | package tanks.battlefieldobjects;
import tanks.Launcher;
import javax.imageio.ImageIO;
import java.awt.*;
import java.io.IOException;
import java.net.URL;
public class Rock extends BattleFieldObjects {
private final static String IMAGE_NAME = "images/rock.jpg";
public Rock(int x, int y) {
super(x, y);
setColor(new Color(100,100,100));
URL pathToResource = Launcher.class.getResource(IMAGE_NAME);
try {
image = ImageIO.read(pathToResource);
} catch (IOException e){
System.err.println("Can't find image: " + IMAGE_NAME);
}
}
@Override
public void destroy() {
}
}
| [
"yu.stepanyuk.ra@gmail.com"
] | yu.stepanyuk.ra@gmail.com |
eb5c751d61362b92547c1803b5b12990f70f45b2 | b1e1ee966f01b21fbe6142d96fda9fc40671f52e | /org/iata/iata/edist/_2017/BagOfferAssocType.java | 93d715ffb597cf09cb1a33bd28496669f0c40e42 | [] | no_license | swinghigh/ndc-java | d19cd6bc3fbf83e9d48dd1612e24db0277c11839 | 2973dedde0da18e2035141073bca42c04d6431d5 | refs/heads/master | 2023-03-15T14:43:24.850915 | 2019-09-13T15:59:53 | 2019-09-13T15:59:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,084 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// 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: 2019.09.13 at 05:58:59 PM CEST
//
package org.iata.iata.edist._2017;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* Baggage Offer Association definition.
*
* <p>Java class for BagOfferAssocType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="BagOfferAssocType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.iata.org/IATA/EDIST/2017.2}AssociatedPassenger"/>
* <element ref="{http://www.iata.org/IATA/EDIST/2017.2}ApplicableFlight"/>
* <element ref="{http://www.iata.org/IATA/EDIST/2017.2}OfferDetailAssociation" minOccurs="0"/>
* <element ref="{http://www.iata.org/IATA/EDIST/2017.2}BagDetailAssociation" minOccurs="0"/>
* <element ref="{http://www.iata.org/IATA/EDIST/2017.2}AssociatedService" minOccurs="0"/>
* <element ref="{http://www.iata.org/IATA/EDIST/2017.2}OtherAssociation" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BagOfferAssocType", propOrder = {
"associatedPassenger",
"applicableFlight",
"offerDetailAssociation",
"bagDetailAssociation",
"associatedService",
"otherAssociation"
})
public class BagOfferAssocType {
@XmlElement(name = "AssociatedPassenger", required = true)
protected PassengerInfoAssocType associatedPassenger;
@XmlElement(name = "ApplicableFlight", required = true)
protected ApplicableFlight applicableFlight;
@XmlElement(name = "OfferDetailAssociation")
protected OfferDetailInfoAssocType offerDetailAssociation;
@XmlElement(name = "BagDetailAssociation")
protected BagDetailAssociation bagDetailAssociation;
@XmlElement(name = "AssociatedService")
protected ServiceInfoAssocType associatedService;
@XmlElement(name = "OtherAssociation")
protected OtherOfferAssocType otherAssociation;
/**
* Gets the value of the associatedPassenger property.
*
* @return
* possible object is
* {@link PassengerInfoAssocType }
*
*/
public PassengerInfoAssocType getAssociatedPassenger() {
return associatedPassenger;
}
/**
* Sets the value of the associatedPassenger property.
*
* @param value
* allowed object is
* {@link PassengerInfoAssocType }
*
*/
public void setAssociatedPassenger(PassengerInfoAssocType value) {
this.associatedPassenger = value;
}
/**
* Gets the value of the applicableFlight property.
*
* @return
* possible object is
* {@link ApplicableFlight }
*
*/
public ApplicableFlight getApplicableFlight() {
return applicableFlight;
}
/**
* Sets the value of the applicableFlight property.
*
* @param value
* allowed object is
* {@link ApplicableFlight }
*
*/
public void setApplicableFlight(ApplicableFlight value) {
this.applicableFlight = value;
}
/**
* Gets the value of the offerDetailAssociation property.
*
* @return
* possible object is
* {@link OfferDetailInfoAssocType }
*
*/
public OfferDetailInfoAssocType getOfferDetailAssociation() {
return offerDetailAssociation;
}
/**
* Sets the value of the offerDetailAssociation property.
*
* @param value
* allowed object is
* {@link OfferDetailInfoAssocType }
*
*/
public void setOfferDetailAssociation(OfferDetailInfoAssocType value) {
this.offerDetailAssociation = value;
}
/**
* Gets the value of the bagDetailAssociation property.
*
* @return
* possible object is
* {@link BagDetailAssociation }
*
*/
public BagDetailAssociation getBagDetailAssociation() {
return bagDetailAssociation;
}
/**
* Sets the value of the bagDetailAssociation property.
*
* @param value
* allowed object is
* {@link BagDetailAssociation }
*
*/
public void setBagDetailAssociation(BagDetailAssociation value) {
this.bagDetailAssociation = value;
}
/**
* Gets the value of the associatedService property.
*
* @return
* possible object is
* {@link ServiceInfoAssocType }
*
*/
public ServiceInfoAssocType getAssociatedService() {
return associatedService;
}
/**
* Sets the value of the associatedService property.
*
* @param value
* allowed object is
* {@link ServiceInfoAssocType }
*
*/
public void setAssociatedService(ServiceInfoAssocType value) {
this.associatedService = value;
}
/**
* Gets the value of the otherAssociation property.
*
* @return
* possible object is
* {@link OtherOfferAssocType }
*
*/
public OtherOfferAssocType getOtherAssociation() {
return otherAssociation;
}
/**
* Sets the value of the otherAssociation property.
*
* @param value
* allowed object is
* {@link OtherOfferAssocType }
*
*/
public void setOtherAssociation(OtherOfferAssocType value) {
this.otherAssociation = value;
}
}
| [
"axel@ucpa.se"
] | axel@ucpa.se |
2a266be20d37498621bd7a34f06734fbd68daa26 | e51c210ccf72a8ac1414791d8af552662c3fb034 | /passerelle-eclipse-workbench/com.isencia.passerelle.workbench/src/main/java/com/isencia/passerelle/workbench/ApplicationWorkbenchWindowAdvisor.java | 3e14663b816c4bdc82f2a506dc4c797f95986c70 | [] | no_license | eclipselabs/passerelle | 0187efa4fba411265ab58d60b5d83e74af09b203 | e327dea8f4188e4bfe5ef4a76dd2476ad6f5664d | refs/heads/master | 2021-01-18T09:26:07.614275 | 2017-06-28T10:05:12 | 2017-06-28T10:05:12 | 36,805,342 | 5 | 3 | null | 2015-08-04T18:43:19 | 2015-06-03T13:27:15 | Java | UTF-8 | Java | false | false | 1,243 | java | package com.isencia.passerelle.workbench;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;
public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
super(configurer);
}
public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
return new ApplicationActionBarAdvisor(configurer);
}
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
//configurer.setInitialSize(new Point(1024, 800));
configurer.setShowCoolBar(true);
configurer.setShowStatusLine(false);
configurer.setShowFastViewBars(true);
configurer.setShowPerspectiveBar(true);
}
// @Override
// public void postWindowCreate() {
// IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
// IWorkbenchWindow window = configurer.getWindow();
// window.getShell().setMaximized(true);
// }
}
| [
"erwindl0@gmail.com"
] | erwindl0@gmail.com |
fc4e2540d7aa9bc365a1f102851c5c119d1eca43 | d0c9e3cb08f448cb675f356eeef580d87216a6ec | /app/src/main/java/org/chengpx/domain/CarBean.java | 4bc9706c4a449fc8d1b368e42a0abf1ae1b20e08 | [] | no_license | 2018MI/ProblemSolution | 445ba81717aced28e0324f23e8be13d17a6015d7 | 49ed41f61b88be3ce4c7b45c4acaaded610934d4 | refs/heads/master | 2020-03-16T17:17:17.488465 | 2018-05-20T05:33:55 | 2018-05-20T05:33:55 | 132,825,319 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,286 | java | package org.chengpx.domain;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import java.util.Date;
@DatabaseTable(tableName = "car_recharge_history")
public class CarBean {
@DatabaseField(generatedId = true)
private Integer id;
@DatabaseField(columnName = "CarId")
private Integer CarId;
@DatabaseField(columnName = "Balance")
private Integer Balance;
@DatabaseField(columnName = "Money")
private Integer Money;
@DatabaseField(columnName = "rechargeTime")
private Date rechargeTime;
@DatabaseField(columnName = "rechargeUName")
private String rechargeUName;
@DatabaseField(persisted = false)
private Boolean enable;
@DatabaseField(persisted = false)
private String CarAction;
public CarBean(Integer carId) {
CarId = carId;
}
public CarBean() {
}
public Integer getCarId() {
return CarId;
}
public void setCarId(Integer carId) {
CarId = carId;
}
public Integer getBalance() {
return Balance;
}
public void setBalance(Integer balance) {
Balance = balance;
}
public Integer getMoney() {
return Money;
}
public void setMoney(Integer money) {
Money = money;
}
@Override
public String toString() {
return "CarBean{" +
"CarId=" + CarId +
", Balance=" + Balance +
", Money=" + Money +
'}';
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getRechargeTime() {
return rechargeTime;
}
public void setRechargeTime(Date rechargeTime) {
this.rechargeTime = rechargeTime;
}
public String getRechargeUName() {
return rechargeUName;
}
public void setRechargeUName(String rechargeUName) {
this.rechargeUName = rechargeUName;
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
public Boolean getEnable() {
return enable;
}
public String getCarAction() {
return CarAction;
}
public void setCarAction(String carAction) {
CarAction = carAction;
}
}
| [
"2819573709@qq.com"
] | 2819573709@qq.com |
46a0e74c8d7f31273484f369550cf6995619cd8b | 746572ba552f7d52e8b5a0e752a1d6eb899842b9 | /JDK8Source/src/main/java/com/sun/org/apache/xml/internal/dtm/ref/ExpandedNameTable.java | e53b98608fad38736d5d5bc7fa28ce2ae5878ef3 | [] | no_license | lobinary/Lobinary | fde035d3ce6780a20a5a808b5d4357604ed70054 | 8de466228bf893b72c7771e153607674b6024709 | refs/heads/master | 2022-02-27T05:02:04.208763 | 2022-01-20T07:01:28 | 2022-01-20T07:01:28 | 26,812,634 | 7 | 5 | null | null | null | null | UTF-8 | Java | false | false | 15,625 | java | /***** Lobxxx Translate Finished ******/
/*
* Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* 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.
* <p>
* 版权所有1999-2004 Apache软件基金会。
*
* 根据Apache许可证2.0版("许可证")授权;您不能使用此文件,除非符合许可证。您可以通过获取许可证的副本
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 除非适用法律要求或书面同意,否则根据许可证分发的软件按"原样"分发,不附带任何明示或暗示的担保或条件。请参阅管理许可证下的权限和限制的特定语言的许可证。
*
*/
/*
* $Id: ExpandedNameTable.java,v 1.2.4.1 2005/09/15 08:15:06 suresh_emailid Exp $
* <p>
* $ Id:ExpandedNameTable.java,v 1.2.4.1 2005/09/15 08:15:06 suresh_emailid Exp $
*
*/
package com.sun.org.apache.xml.internal.dtm.ref;
import com.sun.org.apache.xml.internal.dtm.DTM;
/**
* This is a default implementation of a table that manages mappings from
* expanded names to expandedNameIDs.
*
* %OPT% The performance of the getExpandedTypeID() method is very important
* to DTM building. To get the best performance out of this class, we implement
* a simple hash algorithm directly into this class, instead of using the
* inefficient java.util.Hashtable. The code for the get and put operations
* are combined in getExpandedTypeID() method to share the same hash calculation
* code. We only need to implement the rehash() interface which is used to
* expand the hash table.
* <p>
* 这是管理从扩展名称到expandedNameID的映射的表的默认实现。
*
* %OPT%getExpandedTypeID()方法的性能对DTM构建非常重要。
* 为了获得这个类的最佳性能,我们直接在这个类中实现一个简单的哈希算法,而不是使用低效的java.util.Hashtable。
* get和put操作的代码在getExpandedTypeID()方法中组合以共享相同的散列计算代码。我们只需要实现rehash()接口,用于扩展哈希表。
*
*/
public class ExpandedNameTable
{
/** Array of extended types for this document */
private ExtendedType[] m_extendedTypes;
/** The initial size of the m_extendedTypes array */
private static int m_initialSize = 128;
/** Next available extended type */
// %REVIEW% Since this is (should be) always equal
// to the length of m_extendedTypes, do we need this?
private int m_nextType;
// These are all the types prerotated, for caller convenience.
public static final int ELEMENT = ((int)DTM.ELEMENT_NODE) ;
public static final int ATTRIBUTE = ((int)DTM.ATTRIBUTE_NODE) ;
public static final int TEXT = ((int)DTM.TEXT_NODE) ;
public static final int CDATA_SECTION = ((int)DTM.CDATA_SECTION_NODE) ;
public static final int ENTITY_REFERENCE = ((int)DTM.ENTITY_REFERENCE_NODE) ;
public static final int ENTITY = ((int)DTM.ENTITY_NODE) ;
public static final int PROCESSING_INSTRUCTION = ((int)DTM.PROCESSING_INSTRUCTION_NODE) ;
public static final int COMMENT = ((int)DTM.COMMENT_NODE) ;
public static final int DOCUMENT = ((int)DTM.DOCUMENT_NODE) ;
public static final int DOCUMENT_TYPE = ((int)DTM.DOCUMENT_TYPE_NODE) ;
public static final int DOCUMENT_FRAGMENT =((int)DTM.DOCUMENT_FRAGMENT_NODE) ;
public static final int NOTATION = ((int)DTM.NOTATION_NODE) ;
public static final int NAMESPACE = ((int)DTM.NAMESPACE_NODE) ;
/** Workspace for lookup. NOT THREAD SAFE!
/* <p>
/*
* */
ExtendedType hashET = new ExtendedType(-1, "", "");
/** The array to store the default extended types. */
private static ExtendedType[] m_defaultExtendedTypes;
/**
* The default load factor of the Hashtable.
* This is used to calcualte the threshold.
* <p>
* Hashtable的默认负载因子。这用于计算阈值。
*
*/
private static float m_loadFactor = 0.75f;
/**
* The initial capacity of the hash table. Use a bigger number
* to avoid the cost of expanding the table.
* <p>
* 散列表的初始容量。使用更大的数字可以避免展开表格的成本。
*
*/
private static int m_initialCapacity = 203;
/**
* The capacity of the hash table, i.e. the size of the
* internal HashEntry array.
* <p>
* 散列表的容量,即内部HashEntry数组的大小。
*
*/
private int m_capacity;
/**
* The threshold of the hash table, which is equal to capacity * loadFactor.
* If the number of entries in the hash table is bigger than the threshold,
* the hash table needs to be expanded.
* <p>
* 散列表的阈值,等于capacity * loadFactor。如果哈希表中的条目数大于阈值,则需要扩展哈希表。
*
*/
private int m_threshold;
/**
* The internal array to store the hash entries.
* Each array member is a slot for a hash bucket.
* <p>
* 用于存储哈希条目的内部数组。每个阵列成员是用于哈希桶的槽。
*
*/
private HashEntry[] m_table;
/**
* Init default values
* <p>
* Init默认值
*
*/
static {
m_defaultExtendedTypes = new ExtendedType[DTM.NTYPES];
for (int i = 0; i < DTM.NTYPES; i++)
{
m_defaultExtendedTypes[i] = new ExtendedType(i, "", "");
}
}
/**
* Create an expanded name table.
* <p>
* 创建扩展名称表。
*
*/
public ExpandedNameTable()
{
m_capacity = m_initialCapacity;
m_threshold = (int)(m_capacity * m_loadFactor);
m_table = new HashEntry[m_capacity];
initExtendedTypes();
}
/**
* Initialize the vector of extended types with the
* basic DOM node types.
* <p>
* 使用基本DOM节点类型初始化扩展类型的向量。
*
*/
private void initExtendedTypes()
{
m_extendedTypes = new ExtendedType[m_initialSize];
for (int i = 0; i < DTM.NTYPES; i++) {
m_extendedTypes[i] = m_defaultExtendedTypes[i];
m_table[i] = new HashEntry(m_defaultExtendedTypes[i], i, i, null);
}
m_nextType = DTM.NTYPES;
}
/**
* Given an expanded name represented by namespace, local name and node type,
* return an ID. If the expanded-name does not exist in the internal tables,
* the entry will be created, and the ID will be returned. Any additional
* nodes that are created that have this expanded name will use this ID.
*
* <p>
* 给定由命名空间,本地名称和节点类型表示的扩展名称,返回一个ID。如果扩展名不存在于内部表中,则将创建该条目,并返回ID。创建的具有此扩展名称的任何其他节点将使用此标识。
*
*
* @param namespace The namespace
* @param localName The local name
* @param type The node type
*
* @return the expanded-name id of the node.
*/
public int getExpandedTypeID(String namespace, String localName, int type)
{
return getExpandedTypeID(namespace, localName, type, false);
}
/**
* Given an expanded name represented by namespace, local name and node type,
* return an ID. If the expanded-name does not exist in the internal tables,
* the entry will be created, and the ID will be returned. Any additional
* nodes that are created that have this expanded name will use this ID.
* <p>
* If searchOnly is true, we will return -1 if the name is not found in the
* table, otherwise the name is added to the table and the expanded name id
* of the new entry is returned.
*
* <p>
* 给定由命名空间,本地名称和节点类型表示的扩展名称,返回一个ID。如果扩展名不存在于内部表中,则将创建该条目,并返回ID。创建的具有此扩展名称的任何其他节点将使用此标识。
* <p>
* 如果searchOnly为true,如果在表中找不到名称,我们将返回-1,否则会将名称添加到表中,并返回新条目的扩展名称id。
*
*
* @param namespace The namespace
* @param localName The local name
* @param type The node type
* @param searchOnly If it is true, we will only search for the expanded name.
* -1 is return is the name is not found.
*
* @return the expanded-name id of the node.
*/
public int getExpandedTypeID(String namespace, String localName, int type, boolean searchOnly)
{
if (null == namespace)
namespace = "";
if (null == localName)
localName = "";
// Calculate the hash code
int hash = type + namespace.hashCode() + localName.hashCode();
// Redefine the hashET object to represent the new expanded name.
hashET.redefine(type, namespace, localName, hash);
// Calculate the index into the HashEntry table.
int index = hash % m_capacity;
if (index < 0)
index = -index;
// Look up the expanded name in the hash table. Return the id if
// the expanded name is already in the hash table.
for (HashEntry e = m_table[index]; e != null; e = e.next)
{
if (e.hash == hash && e.key.equals(hashET))
return e.value;
}
if (searchOnly)
{
return DTM.NULL;
}
// Expand the internal HashEntry array if necessary.
if (m_nextType > m_threshold) {
rehash();
index = hash % m_capacity;
if (index < 0)
index = -index;
}
// Create a new ExtendedType object
ExtendedType newET = new ExtendedType(type, namespace, localName, hash);
// Expand the m_extendedTypes array if necessary.
if (m_extendedTypes.length == m_nextType) {
ExtendedType[] newArray = new ExtendedType[m_extendedTypes.length * 2];
System.arraycopy(m_extendedTypes, 0, newArray, 0,
m_extendedTypes.length);
m_extendedTypes = newArray;
}
m_extendedTypes[m_nextType] = newET;
// Create a new hash entry for the new ExtendedType and put it into
// the table.
HashEntry entry = new HashEntry(newET, m_nextType, hash, m_table[index]);
m_table[index] = entry;
return m_nextType++;
}
/**
* Increases the capacity of and internally reorganizes the hashtable,
* in order to accommodate and access its entries more efficiently.
* This method is called when the number of keys in the hashtable exceeds
* this hashtable's capacity and load factor.
* <p>
* 增加散列表的容量,并在内部重新组织散列表,以便更有效地容纳和访问其条目。当哈希表中的键数超过此哈希表的容量和负载系数时,将调用此方法。
*
*/
private void rehash()
{
int oldCapacity = m_capacity;
HashEntry[] oldTable = m_table;
int newCapacity = 2 * oldCapacity + 1;
m_capacity = newCapacity;
m_threshold = (int)(newCapacity * m_loadFactor);
m_table = new HashEntry[newCapacity];
for (int i = oldCapacity-1; i >=0 ; i--)
{
for (HashEntry old = oldTable[i]; old != null; )
{
HashEntry e = old;
old = old.next;
int newIndex = e.hash % newCapacity;
if (newIndex < 0)
newIndex = -newIndex;
e.next = m_table[newIndex];
m_table[newIndex] = e;
}
}
}
/**
* Given a type, return an expanded name ID.Any additional nodes that are
* created that have this expanded name will use this ID.
*
* <p>
* 给定一个类型,返回扩展名称ID。创建的具有此扩展名称的任何其他节点将使用此ID。
*
*
* @return the expanded-name id of the node.
*/
public int getExpandedTypeID(int type)
{
return type;
}
/**
* Given an expanded-name ID, return the local name part.
*
* <p>
* 给定扩展名称ID,返回本地名称部分。
*
*
* @param ExpandedNameID an ID that represents an expanded-name.
* @return String Local name of this node, or null if the node has no name.
*/
public String getLocalName(int ExpandedNameID)
{
return m_extendedTypes[ExpandedNameID].getLocalName();
}
/**
* Given an expanded-name ID, return the local name ID.
*
* <p>
* 给定扩展名称ID,返回本地名称ID。
*
*
* @param ExpandedNameID an ID that represents an expanded-name.
* @return The id of this local name.
*/
public final int getLocalNameID(int ExpandedNameID)
{
// ExtendedType etype = m_extendedTypes[ExpandedNameID];
if (m_extendedTypes[ExpandedNameID].getLocalName().equals(""))
return 0;
else
return ExpandedNameID;
}
/**
* Given an expanded-name ID, return the namespace URI part.
*
* <p>
* 给定扩展名称ID,返回名称空间URI部分。
*
*
* @param ExpandedNameID an ID that represents an expanded-name.
* @return String URI value of this node's namespace, or null if no
* namespace was resolved.
*/
public String getNamespace(int ExpandedNameID)
{
String namespace = m_extendedTypes[ExpandedNameID].getNamespace();
return (namespace.equals("") ? null : namespace);
}
/**
* Given an expanded-name ID, return the namespace URI ID.
*
* <p>
* 给定扩展名称ID,返回名称空间URI ID。
*
*
* @param ExpandedNameID an ID that represents an expanded-name.
* @return The id of this namespace.
*/
public final int getNamespaceID(int ExpandedNameID)
{
//ExtendedType etype = m_extendedTypes[ExpandedNameID];
if (m_extendedTypes[ExpandedNameID].getNamespace().equals(""))
return 0;
else
return ExpandedNameID;
}
/**
* Given an expanded-name ID, return the local name ID.
*
* <p>
* 给定扩展名称ID,返回本地名称ID。
*
*
* @param ExpandedNameID an ID that represents an expanded-name.
* @return The id of this local name.
*/
public final short getType(int ExpandedNameID)
{
//ExtendedType etype = m_extendedTypes[ExpandedNameID];
return (short)m_extendedTypes[ExpandedNameID].getNodeType();
}
/**
* Return the size of the ExpandedNameTable
*
* <p>
* 返回ExpandedNameTable的大小
*
*
* @return The size of the ExpandedNameTable
*/
public int getSize()
{
return m_nextType;
}
/**
* Return the array of extended types
*
* <p>
* 返回扩展类型数组
*
*
* @return The array of extended types
*/
public ExtendedType[] getExtendedTypes()
{
return m_extendedTypes;
}
/**
* Inner class which represents a hash table entry.
* The field next points to the next entry which is hashed into
* the same bucket in the case of "hash collision".
* <p>
* 表示哈希表条目的内部类。该字段接下来指向在"哈希冲突"的情况下被哈希到相同存储桶中的下一个条目。
*/
private static final class HashEntry
{
ExtendedType key;
int value;
int hash;
HashEntry next;
protected HashEntry(ExtendedType key, int value, int hash, HashEntry next)
{
this.key = key;
this.value = value;
this.hash = hash;
this.next = next;
}
}
}
| [
"919515134@qq.com"
] | 919515134@qq.com |
80cf00cfec507064a2497ee7e558ead617a544cf | aa721013f5ed1fb65ed39958d025dc398a2c2b52 | /app/src/main/java/com/protect/kid/filter/CustomIpFilter.java | a7f666f53f2b81a53ea32d1b7c87e173f6d73527 | [] | no_license | myth2loki/Firewall | 408f5ea5e94b0fc12755e6f6e4f509864cf680b1 | 2085a30e72562986f6c685c89b554c8f347943c0 | refs/heads/master | 2020-03-12T06:21:53.363112 | 2018-09-26T11:59:30 | 2018-09-26T12:00:57 | 130,483,470 | 0 | 0 | null | 2018-04-21T14:53:44 | 2018-04-21T14:53:44 | null | UTF-8 | Java | false | false | 5,448 | java | package com.protect.kid.filter;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.protect.kid.BuildConfig;
import com.protect.kid.R;
import com.protect.kid.activity.SettingActivity;
import com.protect.kid.app.GlobalApplication;
import com.protect.kid.core.blackwhite.BlackIP;
import com.protect.kid.core.blackwhite.WhiteIP;
import com.protect.kid.core.filter.DomainFilter;
import com.protect.kid.core.logger.Logger;
import com.protect.kid.core.tcpip.CommonMethods;
import com.protect.kid.db.DAOFactory;
import com.protect.kid.db.GeneralDAO;
import com.protect.kid.util.SharedPrefUtil;
import java.util.ArrayList;
import java.util.List;
public class CustomIpFilter implements DomainFilter {
private static final String TAG = "CustomIpFilter";
private static final boolean DEBUG = BuildConfig.DEBUG;
private List<String> mBlackList = new ArrayList<>();
private List<String> mWhiteList = new ArrayList<>();
private static boolean isWhite;
private static boolean isReload;
public static void setWhiteEnabled(boolean enabled) {
isWhite = enabled;
}
public static void reload() {
isReload = true;
}
private static int[] IGNORED_IP_ARRAY = {CommonMethods.ipStringToInt("113.31.17.107"),
CommonMethods.ipStringToInt("113.31.136.60"),
CommonMethods.ipStringToInt("124.202.138.31"),
CommonMethods.ipStringToInt("103.229.215.60"),
CommonMethods.ipStringToInt("118.145.3.80"),
CommonMethods.ipStringToInt("117.121.49.100"),
CommonMethods.ipStringToInt("121.46.20.41"),
CommonMethods.ipStringToInt("139.198.14.15"),
CommonMethods.ipStringToInt("183.232.57.12")
};
private static String[] IGNORED_DOMAIN_ARRAY = {
"jpush.cn",
"jiguang.cn"
};
@Override
public void prepare() {
Context context = GlobalApplication.getInstance();
String str = SharedPrefUtil.getValue(context, SettingActivity.PREF_NAME, "isWhiteList", "false");
isWhite = "true".equals(str);
GeneralDAO<BlackIP> blackIpDAO = DAOFactory.getDAO(context, BlackIP.class);
List<BlackIP> tempBlackList = blackIpDAO.queryForAll();
for (BlackIP ip : tempBlackList) {
mBlackList.add(ip.ip);
}
GeneralDAO<WhiteIP> whiteIpDAO = DAOFactory.getDAO(context, WhiteIP.class);
List<WhiteIP> tempWhiteList = whiteIpDAO.queryForAll();
for (WhiteIP ip : tempWhiteList) {
mWhiteList.add(ip.ip);
}
if (DEBUG) {
Log.d(TAG, "prepare: mBlackList = " + mBlackList);
Log.d(TAG, "prepare: mWhiteList = " + mWhiteList);
}
}
private static boolean isIpIgnored(int ip) {
for (int ignoredIp : IGNORED_IP_ARRAY) {
if (ignoredIp == ip) {
return true;
}
}
return false;
}
private static boolean isDomainIgnored(String domain) {
if (TextUtils.isEmpty(domain)) {
return false;
}
for (String d : IGNORED_DOMAIN_ARRAY) {
if (d.equals(domain)) {
return true;
}
}
return false;
}
private static boolean isPortIgnored(int port) {
if (port == 19000 ||
(port >= 3000 && port <= 3020) ||
(port >= 7000 && port <= 7020) ||
(port >= 8000 && port <= 8020)) {
return true;
}
return false;
}
@Override
public int filter(String ipAddress, int ip, int port) {
if (isReload) {
isReload = false;
mBlackList.clear();
mWhiteList.clear();
prepare();
}
if (isDomainIgnored(ipAddress)) {
return NO_FILTER;
}
if (isPortIgnored(port)) {
return NO_FILTER;
}
if (ipAddress == null) {
return NO_FILTER;
}
if (port > -1) {
ipAddress = ipAddress + ":" + port;
}
if (isWhite) {
Context context = GlobalApplication.getInstance();
Logger logger = Logger.getInstance(context);
for (String white : mWhiteList) {
if (ipAddress.contains(white)) {
logger.insert(context.getString(R.string.allow_to_navigate_x, white));
return NO_FILTER;
}
}
logger.insert(context.getString(R.string.stop_navigate_x, ipAddress));
return FILTER_LIST;
} else {
for (String black : mBlackList) {
if (ipAddress.contains(black)) {
Context context = GlobalApplication.getInstance();
Logger logger = Logger.getInstance(context);
logger.insert(context.getString(R.string.stop_navigate_x, black));
return FILTER_LIST;
}
}
return NO_FILTER;
}
}
}
| [
"myth2loki@gmail.com"
] | myth2loki@gmail.com |
5d34c7fd5a944b79aa00940be691c2d072cb3756 | 0aeb24692771f6936ba7dd90a5a639aeb449adea | /app/src/main/java/com/reader/read/view/BookViewHolder.java | 3255ddfd3e76c4193ee8f52ee5cd4b933d770b6e | [] | no_license | operatium/commonsdk | 3bc3495df71b4f611ec20d11bf216db055629602 | cd66af1708fc09b7ffe8ccc8efcda67c270a4df8 | refs/heads/master | 2020-04-07T23:12:03.502538 | 2018-11-26T06:31:33 | 2018-11-26T06:31:33 | 158,802,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,721 | java | package com.reader.read.view;
import android.content.Context;
import android.graphics.Color;
import android.support.constraint.ConstraintLayout;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.qicaibear.bookplayer.c.FileController;
import com.qicaibear.bookplayer.c.PermissionManger;
import com.reader.R;
import com.reader.Rout;
import com.reader.net.BookDownloader;
import com.reader.read.m.BookViewHolderData;
import com.yanzhenjie.permission.Action;
import com.yanzhenjie.permission.AndPermission;
import com.yanzhenjie.permission.Permission;
import com.yyx.commonsdk.app.GlideApp;
import com.yyx.commonsdk.log.MyLog;
import com.yyx.commonsdk.screenadaptation.SceenFitFactory;
import java.util.List;
public class BookViewHolder extends RecyclerView.ViewHolder {
public BookViewHolder(View itemView) {
super(itemView);
}
public static BookViewHolder createViewHolder(Context context, SceenFitFactory fitFactory) {
View view = View.inflate(context, R.layout.read_view_bookitem, null);
ConstraintLayout root15 = view.findViewById(R.id.root15);
TextView text = view.findViewById(R.id.text15);
root15.setLayoutParams(new ViewGroup.LayoutParams(fitFactory.getSizeInt(200), fitFactory.getSizeInt(300)));
fitFactory.textViewSets(text, 24, null, 0);
text.setMaxWidth(fitFactory.getSizeInt(150));
return new BookViewHolder(view);
}
public void bind(BookViewHolderData data) {
if (data == null)
return;
final int id = data.getBookId();
final int type = data.getType();
String url = data.getBookUrl();
final String name = data.getBookName();
ImageView cover = itemView.findViewById(R.id.pic15);
final TextView text = itemView.findViewById(R.id.text15);
GlideApp.with(cover).load(url).placeholder(R.drawable.home_bg).error(R.drawable.home_bg).into(cover);
text.setText(name);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Context context = v.getContext();
if(AndPermission.hasPermissions(v.getContext(),Permission.Group.STORAGE)){
clickEvent(context,id,type,text);
}else {
AndPermission.with(v.getContext()).runtime().permission(Permission.Group.STORAGE)
.onDenied(new Action<List<String>>() {
@Override
public void onAction(List<String> data) {
Toast.makeText(context,"没有权限",Toast.LENGTH_SHORT).show();
}
}).onGranted(new Action<List<String>>() {
@Override
public void onAction(List<String> data) {
clickEvent(context,id,type,text);
}
}).start();
}
}
});
}
private void clickEvent(final Context context,final int id,final int type, final TextView text){
final String path = new FileController().getBookDir(String.valueOf(id)).getAbsolutePath();
if (type == 2) {
BookDownloader downloader = new BookDownloader();
downloader.setListaner(new BookDownloader.DownloadListenerAdapter() {
@Override
public void success() {
try {
new Rout().ToPreReadActivity(context, path);
} catch (Exception e) {
MyLog.e("201811141751", e.toString(), e);
}
}
@Override
public void error(String error) {
try {
String str = "重试";
text.setText(str);
} catch (Exception e) {
MyLog.e("201811141751", e.toString(), e);
}
}
@Override
public void progress(int currentCount, int totalCount) {
try {
String str = String.valueOf(currentCount) + " / " + totalCount;
text.setText(str);
} catch (Exception e) {
MyLog.e("201811141751", e.toString(), e);
}
}
});
downloader.getBook(id);
}
}
} | [
"yuyuexing@hellokid.cn"
] | yuyuexing@hellokid.cn |
f45176568bc1306386fcb5a44f3d6f09c57d0911 | 4d0a11298989848cdaed1c06dfabfff182472010 | /src/controller/action/DeleteFeedAction.java | 010a5606103050c3e19a655572df0df17f9d3f2c | [] | no_license | j00hyun/SNSProject | 50cb1542973676ee16f5200c6d4c926891568468 | 94cf300da5bb062d65f1ff05b7f25fc2f8c875ac | refs/heads/master | 2022-12-18T10:02:08.460661 | 2020-09-24T04:13:57 | 2020-09-24T04:13:57 | 298,165,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,240 | java | package controller.action;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.feed.FeedDAO;
public class DeleteFeedAction implements Action{
public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String strNum = request.getParameter("fno");
//String id = request.getParameter("memberId");
try{
if(strNum == null || strNum.trim().length() == 0){
throw new Exception("입력값이 충분하지 않습니다.");
}
int fno = Integer.parseInt(strNum);
boolean result = FeedDAO.deleteFeed(fno);
if(result){
response.sendRedirect("index.html");
return;
}else{
throw new Exception("이미 삭제된 게시물이거나, 비밀번호가 올바르지 않습니다.");
}
}catch (SQLException e) {
request.setAttribute("errorMsg", "시스템 문제가 발생했습니다.");
}catch (Exception e){
request.setAttribute("errorMsg", e.getMessage());
}
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
| [
"loove1997@naver.com"
] | loove1997@naver.com |
e3127fed19b2d264a0765fe0647d5a2f50847dd1 | 9d620b4293e53b0c9f3ac7ef986d87a490ed69a0 | /app/src/main/java/com/example/pixaflip/JSONParse.java | 5f1481e9c14ed3be59289c1d29905fb190c8bb6e | [] | no_license | Muskaan24888/Pixaflip1 | 20bd4810946977385f48c11a06c4246dc6f8f914 | 1aebba54666f04b93c6efc1d41ff4c63f1592b09 | refs/heads/master | 2023-04-01T01:58:50.593599 | 2021-04-08T20:11:21 | 2021-04-08T20:11:21 | 337,629,650 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,052 | java | package com.example.pixaflip;
import android.content.Context;
import android.util.Log;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
public class JSONParse {
// constructor
public JSONParse() {
}
public JSONParse(Context contextForPreExecute) {
}
public static String makeHttpRequest(String requestURL,
HashMap<String, String> postDataParams) {
URL url;
String response = "";
try {
url = new URL(requestURL);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(10000);
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
OutputStream os = conn.getOutputStream();
BufferedWriter writer = new BufferedWriter(
new OutputStreamWriter(os, "UTF-8"));
writer.write(getPostDataString(postDataParams));
writer.flush();
writer.close();
os.close();
int responseCode = conn.getResponseCode();
if (responseCode == HttpsURLConnection.HTTP_OK) {
String line;
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((line = br.readLine()) != null) {
response += line;
}
} else {
Log.d("33333333", "noInternet");
response = "";
}
} catch (UnknownHostException e) {
response="noAccess";
Log.d("UnknownHostException333", "noInternet");
return response;
} catch (Exception e) {
response="noAccess";
Log.d("UnknownException", "unknown");
e.printStackTrace();
return response;
}
return response;
}
private static String getPostDataString(HashMap<String, String> params) throws UnsupportedEncodingException {
StringBuilder result = new StringBuilder();
boolean first = true;
if (params == null) {
result.append(" ");
return result.toString();
}
for (Map.Entry<String, String> entry : params.entrySet()) {
if (first)
first = false;
else
result.append("&");
result.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
result.append("=");
result.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
}
return result.toString();
}
}
| [
"muskanashaikh786@gmail.com"
] | muskanashaikh786@gmail.com |
1b34a90539f1289673b35961b949287e6c969949 | 3444f367937ae33fd6cbbd61eef38a4c26e4319a | /NotificationsDemo/app/src/main/java/com/charan/notificationsdemo/MainActivity.java | d6ffda84c56a9e91309df40e3601a5783f7b676f | [] | no_license | ckotha/Android-Studio-projects | 2b47121db7239f12f40185d1befda720cfa75fec | b85149031347074b2cdb0a4859d36421729d7acc | refs/heads/master | 2020-03-29T12:33:19.171210 | 2019-11-10T01:00:00 | 2019-11-10T01:00:00 | 149,905,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,251 | java | package com.charan.notificationsdemo;
import androidx.appcompat.app.AppCompatActivity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Intent intent = new Intent(getApplicationContext(),MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(),1, intent,0);
Notification notification = new Notification.Builder(getApplicationContext())
.setContentTitle("Lunch is ready!")
.setContentText("its getting cold!")
.setContentIntent(pendingIntent)
.addAction(android.R.drawable.sym_action_chat, "Chat", pendingIntent)
.setSmallIcon(android.R.drawable.sym_def_app_icon)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(1, notification);
}
}
| [
"ckotha@ufl.com"
] | ckotha@ufl.com |
622caa513809b11dce84e2c3a68d6d673b1e6cf7 | a6cb259fc9c550c36d7a6b11dbb9fa269d5e31df | /TripKitAndroid/src/main/java/com/skedgo/android/tripkit/tsp/RegionInfoService.java | d4eefa00bc04f2d5fb452e4450a5b16be39c255a | [
"Apache-2.0"
] | permissive | mbarringer/tripkit-android | 26b5c445a4ddc2a291bf96a6cca7a4f14996f8fd | ed369f9017444ce8ea169db77657e43b9e91246d | refs/heads/master | 2020-07-17T10:16:50.780656 | 2018-11-25T16:13:50 | 2018-11-25T16:13:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,822 | java | package com.skedgo.android.tripkit.tsp;
import com.skedgo.android.common.model.Region;
import java.util.List;
import javax.inject.Inject;
import dagger.Lazy;
import okhttp3.HttpUrl;
import rx.Observable;
import rx.functions.Func1;
import static org.apache.commons.collections4.CollectionUtils.isNotEmpty;
/**
* A facade of {@link RegionInfoApi} that has failover on multiple servers.
*/
public class RegionInfoService {
private final Lazy<RegionInfoApi> regionInfoApiLazy;
@Inject public RegionInfoService(Lazy<RegionInfoApi> regionInfoApiLazy) {
this.regionInfoApiLazy = regionInfoApiLazy;
}
/**
* @param baseUrls Can be {@link Region#getURLs()}.
* @param regionName Can be {@link Region#getName()}.
*/
public Observable<RegionInfo> fetchRegionInfoAsync(
List<String> baseUrls,
final String regionName) {
return Observable.from(baseUrls)
.concatMapDelayError(new Func1<String, Observable<RegionInfoResponse>>() {
@Override public Observable<RegionInfoResponse> call(final String baseUrl) {
final String url = HttpUrl.parse(baseUrl).newBuilder()
.addPathSegment("regionInfo.json")
.build()
.toString();
return regionInfoApiLazy.get().fetchRegionInfoAsync(
url,
ImmutableRegionInfoBody.of(regionName)
);
}
})
.first(new Func1<RegionInfoResponse, Boolean>() {
@Override public Boolean call(RegionInfoResponse response) {
return isNotEmpty(response.regions());
}
})
.map(new Func1<RegionInfoResponse, RegionInfo>() {
@Override public RegionInfo call(RegionInfoResponse response) {
return response.regions().get(0);
}
});
}
} | [
"noreply@github.com"
] | noreply@github.com |
45fe6fcf78ebfeee80f8b57c01782586f771f688 | 46621c5b7acb2b44be2c24e06e574bbab2b251a6 | /MoPub/Android/AppLovinRewardedAdapter.java | ad8982027ff588e009959f20486600197131a08c | [
"MIT"
] | permissive | herizonsusanto/SDK-Network-Adapters | dc30b0c0077332ddf5b54e95b577f693d7cee48f | b468f042166d21d5839a26b367b27eb8c5ab18b9 | refs/heads/master | 2020-05-09T16:43:40.676971 | 2019-03-24T09:36:26 | 2019-03-24T09:36:26 | 181,281,322 | 0 | 0 | MIT | 2019-04-14T08:38:36 | 2019-04-14T08:38:36 | null | UTF-8 | Java | false | false | 251 | java | package YOUR_PACKAGE_NAME;
/**
* Created by thomasso on 10/10/17.
*/
// This class with the old classname is left here for backwards compatibility purposes.
public class AppLovinRewardedAdapter
extends AppLovinCustomEventRewardedVideo { }
| [
"thomas.m.so33@gmail.com"
] | thomas.m.so33@gmail.com |
6b762719d17b7e48828b4121a9c156db09eff1c1 | 9b8f067f3195f9d6c07517b85bc1fd4799647ff2 | /src/工厂方法模式/OperationAdd.java | 2f3098c7393127053c62de6bebd0bc3bf33bf5b3 | [] | no_license | JYBeYonDing/DesignMode | 7d23969607887200e581d78cce14edb7374d8cd9 | 3a52df59495a59df36c009fda79d7ec9165d5562 | refs/heads/master | 2021-08-11T05:45:16.533778 | 2017-11-13T07:00:07 | 2017-11-13T07:00:07 | 109,581,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package 工厂方法模式;
public class OperationAdd extends Operation {
@Override
public double getResult() {
double result = 0;
result = getNumberA() + getNumberB();
return result;
}
}
| [
"1370319648@qq.com"
] | 1370319648@qq.com |
e9ed1fc5828038c0345c5f39f28dd5939e44c28c | 0cc419ff78e16d8926105afecf13443aeb4ceece | /implementation.controller/src/main/java/br/ufsc/ine/ppgcc/consumer/Consumers.java | 05c21f885864a3ea2d5da710b34e808cb1b093d7 | [] | no_license | vandersonsampaio/5ions-implementation | b06d67d23077559e7db223075b5fb3132b8206e5 | 9b4cb8417c1fc695478c59d254f3e4ab799444d9 | refs/heads/master | 2022-11-10T09:05:58.957358 | 2022-09-30T01:33:03 | 2022-09-30T01:33:03 | 235,565,617 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,154 | java | package br.ufsc.ine.ppgcc.consumer;
import br.ufsc.ine.ppgcc.model.Document;
import br.ufsc.ine.ppgcc.service.interfaces.IFiveIonsManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;
@Component
public class Consumers {
private final Logger logger = LoggerFactory.getLogger(Consumers.class);
private final IFiveIonsManager manager;
public Consumers(IFiveIonsManager manager) {
this.manager = manager;
}
@RabbitListener(queues = {"${rabbit.queues.consumer.queue.document.input}"})
public void firstQueueListener(@Payload Document document) {
logger.debug("Document received: d={}", document.getTitle());
manager.start(document);
}
@RabbitListener(queues = {"${rabbit.queues.consumer.queue.document.original}"})
public void originalQueueListener(@Payload Document document) {
logger.debug("Original Document received: d={}", document.getId());
manager.firstStep(document);
}
}
| [
"vandersons.sampaio@gmail.com"
] | vandersons.sampaio@gmail.com |
6bfa15d3e705c034cfdd26f8f0fb95dde740bfcf | 4dead78c85fe8855d526ff686815c2df041b0cbc | /ORMDroid/src/com/roscopeco/ormdroid/TypeMapper.java | 6f5675f83dd10a8e2a773aaf883324a0b4c9cddc | [
"Apache-2.0"
] | permissive | rilsikane/sparkphoto | 5473163f8b56dd5164fe18d552103175b07ff3c1 | 1bc94a73c5a6785973cd9d34a80ee93b02864f14 | refs/heads/master | 2021-01-10T20:11:56.051487 | 2015-04-18T14:10:43 | 2015-04-18T14:10:43 | 32,306,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,034 | java | /*
* Copyright 2012 Ross Bamford
*
* 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.roscopeco.ormdroid;
import android.database.sqlite.SQLiteDatabase;
/**
* <p>Supports mappings between Java types and their SQL representations.</p>
*
* <p>By default, ORMDroid provides a mapping for all primitive types
* and Entity classes. All other types are mapped by the <em>default
* mapping</em>, which simply stores their <code>toString</code> results
* in a <code>VARCHAR</code> column.</p>
*
* <p>Custom types may be mapped by registering an instance of
* {@link TypeMapping} via the {@link #mapType(TypeMapping) mapType} method.
* The default mapping can also be overriden using the
* {@link #setDefaultMapping(TypeMapping) setDefaultMapping} method.</p>
*
* <p>Mappings are made based on assignability. When searching for a
* mapping for a given type, this class will return the most recently
* added mapping with a type that is assignable from the type being
* searched for.</p>
*
* <p>Any custom mappings should be registered before any database operations
* are performed. If mappings are changed when schemas already exist in
* the database, errors are very likely to result.</p>
*/
public final class TypeMapper {
private static final MappingList TYPEMAPS = new MappingList();
private static TypeMapping mDefaultMapping = new StringTypeMapping(Object.class, "VARCHAR");
public static String sqlType(Class<?> type) {
return getMapping(type).sqlType(type);
}
/**
* Obtain the configured mapping the the specified Java type.
*
* @param type the Java type.
* @return the configured mapping.
*/
public static TypeMapping getMapping(Class<?> type) {
TypeMapping r = TYPEMAPS.findMapping(type);
if (r != null) {
return r;
} else {
TypeMapping def = mDefaultMapping;
if (def != null) {
return def;
} else {
throw new TypeMappingException("No mapping found for type `" + type + "'");
}
}
}
/**
* Shortcut to the {@link TypeMapping#encodeValue(SQLiteDatabase, Object)}
* method for the given value.
*
* @param db The {@link SQLiteDatabase} instance to use.
* @param value The value to encode.
* @return The SQL representation of the value.
*/
public static String encodeValue(SQLiteDatabase db, Object value) {
return getMapping(value.getClass()).encodeValue(db, value);
}
/**
* Add the specified mapping to the mapping list. New items
* are added at the front of the list, allowing remapping
* of already-mapped types.
*/
public static void mapType(TypeMapping mapping) {
TYPEMAPS.addMapping(mapping);
}
/**
* Override the default mapping. This is used when no mapping
* is configured for a given type.
*
* @param mapping The {@link TypeMapping} to use by default.
*/
public static void setDefaultMapping(TypeMapping mapping) {
mDefaultMapping = mapping;
}
static {
// standard types.
// Added in reverse order of (perceived) popularity because new items
// are added at the front of the list...
mapType(new NumericTypeMapping(Short.class, "SMALLINT"));
mapType(new NumericTypeMapping(short.class, "SMALLINT"));
mapType(new NumericTypeMapping(Byte.class, "TINYINT"));
mapType(new NumericTypeMapping(byte.class, "TINYINT"));
mapType(new NumericTypeMapping(Float.class, "FLOAT"));
mapType(new NumericTypeMapping(float.class, "FLOAT"));
mapType(new NumericTypeMapping(Double.class, "DOUBLE"));
mapType(new NumericTypeMapping(double.class, "DOUBLE"));
mapType(new NumericTypeMapping(Boolean.class, "TINYINT"));
mapType(new NumericTypeMapping(boolean.class, "TINYINT"));
mapType(new NumericTypeMapping(Long.class, "BIGINT"));
mapType(new NumericTypeMapping(long.class, "BIGINT"));
mapType(new EntityTypeMapping());
mapType(new NumericTypeMapping(Integer.class, "INTEGER"));
mapType(new NumericTypeMapping(int.class, "INTEGER"));
// String is mapped, even though it would be handled by the default,
// so we don't have to traverse all the mappings before we decide
// on the default handler.
mapType(new StringTypeMapping(String.class, "VARCHAR"));
}
private TypeMapper() throws InstantiationException { throw new InstantiationException(); }
}
| [
"jutha.se@gmail.com@d8d245ee-1ed0-584e-c05a-70c02fc8b848"
] | jutha.se@gmail.com@d8d245ee-1ed0-584e-c05a-70c02fc8b848 |
0f680eb406143279ef4b2a8129b7d7d0f83da4a5 | 1905e78c44aaf092f3761426c8e1c701b6844b64 | /Algorithms/src/test/java/com/algorithms/graphtheory/networkflow/MaxFlowTests.java | 0bfd87095a65377b3b6fb1b185bd70106369cd64 | [] | no_license | khshaik/Algorithms | 6f7cb68faa3100e6a2457a6ebbf7c15567161785 | 44932c2ed409e295800b0cb0612b009a46a1572e | refs/heads/master | 2022-08-25T18:07:03.398454 | 2020-05-31T13:44:38 | 2020-05-31T13:44:38 | 236,345,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,823 | java | package com.algorithms.graphtheory.networkflow;
import static com.google.common.truth.Truth.assertThat;
import com.algorithms.graphtheory.networkflow.CapacityScalingSolverAdjacencyList;
import com.algorithms.graphtheory.networkflow.Dinics;
import com.algorithms.graphtheory.networkflow.EdmondsKarpAdjacencyList;
import com.algorithms.graphtheory.networkflow.FordFulkersonDfsSolverAdjacencyList;
import com.algorithms.graphtheory.networkflow.MinCostMaxFlowJohnsons;
import com.algorithms.graphtheory.networkflow.MinCostMaxFlowWithBellmanFord;
import com.algorithms.graphtheory.networkflow.NetworkFlowSolverBase;
import com.algorithms.graphtheory.networkflow.NetworkFlowSolverBase.Edge;
import java.util.*;
import org.junit.*;
public class MaxFlowTests {
List<NetworkFlowSolverBase> solvers;
@Before
public void setUp() {
solvers = new ArrayList<>();
}
void createAllSolvers(int n, int s, int t) {
solvers.add(new CapacityScalingSolverAdjacencyList(n, s, t));
solvers.add(new Dinics(n, s, t));
solvers.add(new EdmondsKarpAdjacencyList(n, s, t));
solvers.add(new FordFulkersonDfsSolverAdjacencyList(n, s, t));
solvers.add(new MinCostMaxFlowWithBellmanFord(n, s, t));
solvers.add(new MinCostMaxFlowJohnsons(n, s, t));
}
void addEdge(int f, int t, int c) {
for (NetworkFlowSolverBase solver : solvers) {
solver.addEdge(f, t, c);
}
}
void assertFlow(long flow) {
for (NetworkFlowSolverBase solver : solvers) {
assertThat(solver.getMaxFlow()).isEqualTo(flow);
}
}
@Test
public void lineGraphTest() {
int n = 4, s = n - 1, t = n - 2;
createAllSolvers(n, s, t);
addEdge(s, 0, 5);
addEdge(0, 1, 3);
addEdge(1, t, 7);
assertFlow(3);
}
@Test
public void testDisconnectedGraph() {
int n = 4, s = n - 1, t = n - 2;
createAllSolvers(n, s, t);
// There's no edge connecting 0 and 1
addEdge(s, 0, 9);
addEdge(1, t, 9);
assertFlow(0);
}
// Testing graph from:
// http://crypto.cs.mcgill.ca/~crepeau/COMP251/KeyNoteSlides/07demo-maxflowCS-C.pdf
@Test
public void testSmallFlowGraph() {
int n = 6, s = n - 1, t = n - 2;
createAllSolvers(n, s, t);
// Source edges
addEdge(s, 0, 10);
addEdge(s, 1, 10);
// Sink edges
addEdge(2, t, 10);
addEdge(3, t, 10);
// Middle edges
addEdge(0, 1, 2);
addEdge(0, 2, 4);
addEdge(0, 3, 8);
addEdge(1, 3, 9);
addEdge(3, 2, 6);
assertFlow(19);
}
@Test
public void classicNetwork() {
int n = 4, s = n - 1, t = n - 2;
createAllSolvers(n, s, t);
final int k = 10000;
addEdge(s, 0, k);
addEdge(s, 1, k);
addEdge(0, t, k);
addEdge(1, t, k);
addEdge(0, 1, 1);
assertFlow(2 * k);
}
@Test
public void evilNetwork1() {
final int k = 250, t = 2 * k; // source = 0
createAllSolvers(2 * k + 1, 0, t);
for (int i = 0; i < k - 1; i++) addEdge(i, i + 1, k);
for (int i = 0; i < k; i++) {
addEdge(k - 1, k + i, 1);
addEdge(k + i, t, 1);
}
assertFlow(k);
}
@Test
public void testMediumSizeFlowGraph() {
int n = 12, s = n - 1, t = n - 2;
createAllSolvers(n, s, t);
// Source edges
addEdge(s, 0, 5);
addEdge(s, 1, 20);
addEdge(s, 2, 10);
addEdge(0, 1, 3);
addEdge(0, 5, 4);
addEdge(1, 4, 14);
addEdge(1, 5, 14);
addEdge(2, 1, 5);
addEdge(2, 3, 4);
addEdge(3, 4, 3);
addEdge(3, 9, 11);
addEdge(4, 6, 4);
addEdge(4, 8, 22);
addEdge(5, 6, 8);
addEdge(5, 7, 3);
addEdge(6, 7, 12);
addEdge(7, 8, 9);
addEdge(7, t, 7);
addEdge(8, 9, 11);
addEdge(8, t, 15);
addEdge(9, t, 60);
assertFlow(29);
}
@Test
public void testFlowInEqualsFlowOut() {
int n = 12, s = n - 1, t = n - 2;
createAllSolvers(n, s, t);
// Source edges
addEdge(s, 0, 5);
addEdge(s, 1, 20);
addEdge(s, 2, 10);
addEdge(0, 1, 3);
addEdge(0, 5, 4);
addEdge(1, 4, 14);
addEdge(1, 5, 14);
addEdge(2, 1, 5);
addEdge(2, 3, 4);
addEdge(3, 4, 3);
addEdge(3, 9, 11);
addEdge(4, 6, 4);
addEdge(4, 8, 22);
addEdge(5, 6, 8);
addEdge(5, 7, 3);
addEdge(6, 7, 12);
addEdge(7, 8, 9);
addEdge(7, t, 7);
addEdge(8, 9, 11);
addEdge(8, t, 15);
addEdge(9, t, 60);
for (NetworkFlowSolverBase solver : solvers) {
List<Edge>[] g = solver.getGraph();
int[] inFlows = new int[n];
int[] outFlows = new int[n];
for (int i = 0; i < n; i++) {
List<Edge> edges = g[i];
for (Edge e : edges) {
inFlows[e.from] += e.flow;
outFlows[e.to] += e.flow;
}
}
for (int i = 0; i < n; i++) {
if (i == s || i == t) continue;
assertThat(inFlows[i]).isEqualTo(outFlows[i]);
}
}
}
}
| [
"khaja.shaik@192.168.1.4"
] | khaja.shaik@192.168.1.4 |
05ed0300c7d5ea410e4d8b53f0e7ffc46014b337 | c385ce6441d7500444be44b5e04498e97705eb0b | /src/main/java/com/profesorfalken/wmi4java/WMI4JavaUtil.java | b7292e497cd39cf07c6c821f1d535791c9d54c60 | [
"Apache-2.0"
] | permissive | effad/WMI4Java | d47f38cdc78acadbced7c8f73ce010890bbc97d5 | e252757db30af610c41f7fbd9a7c27ec85336f84 | refs/heads/master | 2021-01-06T14:43:06.406425 | 2020-02-20T15:56:14 | 2020-02-20T15:56:14 | 241,365,476 | 2 | 0 | null | 2020-02-18T13:18:09 | 2020-02-18T13:18:08 | null | UTF-8 | Java | false | false | 466 | java | package com.profesorfalken.wmi4java;
public final class WMI4JavaUtil {
public static String join(String delimiter, Iterable<?> parts) {
StringBuilder joinedString = new StringBuilder();
for (final Object part : parts) {
joinedString.append(part);
joinedString.append(delimiter);
}
joinedString.delete(joinedString.length() - delimiter.length(), joinedString.length());
return joinedString.toString();
}
}
| [
"profesorfalken.github@gmail.com"
] | profesorfalken.github@gmail.com |
77adfaa314fcf4f0152f66f59b460bc103cf0cc2 | caac8a089f7e4121ccae5d5104488f0199bf27fc | /src/com/huigao/dao/UsersDao.java | 87823621b740a89ebc4b00bde8b95eff479b941d | [] | no_license | zqHero/AttendanceCheckPro | d9ae8cfb3059a6b0dddedf7b835f0670e68809d6 | 78de4d90e4305dbe583156ed1c697d29e46fd5d8 | refs/heads/master | 2020-06-21T07:19:29.337954 | 2019-07-28T12:00:47 | 2019-07-28T12:00:47 | 197,380,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,518 | java | package com.huigao.dao;
import java.util.List;
import com.huigao.pojo.Users;
/**
* 用户管理部分数据库操作
* @author cgx
* @version 1.0
*/
public interface UsersDao {
/**
* 添加新的用户<br>
* 更新密码的时候,对象中的密码为明文,更新的时候自动转换为经过MD5加密后的密码
* @param users 用户
*/
public void save(Users users);
/**
* 用户登录(未用,未实现)
* @param username 用户名
* @param password 密码
* @return 用户
*/
public Users login(String username, String password);
/**
* 检查某个用户名是否已经存在
* @param username 用户名
* @return 如果存在返回true,否则返回false
*/
public boolean checkUsername(String username);
/**
* 所有用户集合
* @return 用户集合
*/
public List<Users> list();
/**
* 通过 部门编号 和用 户名前缀 匹配查询用户,如果部门编号为0表示查询所有部门
* @param departmentId 部门编号
* @param userName 用户名前缀
* @return 用户集合
*/
public List<Users> listByDepartmentAndRealName(int departmentId, String userName);
/**
* 按部门分页查询用户集合,如果部门编号为0表示查询所有部门
* @param departmentId 部门编号
* @param start 开始记录数
* @param limit 每页显示记录数
* @return 用户集合
*/
public List<Users> listByDepartment(int departmentId, int start, int limit);
/**
* 按部门查询员工数量,如果部门编号为0表示查询所有部门
* @param departmentID 部门编号
* @return 部门员工数量
*/
public Integer getCountByDepartment(Integer departmentID);
/**
* 查询用户
* @param userId 用户编号
* @return 用户
*/
public Users getById(Integer userId);
/**
* 通过用户名查询用户
* @param username 用户名
* @return 用户
*/
public Users getByUsername(String username);
/**
* 删除用户
* @param users 用户
*/
public void delete(Users users);
/**
* 删除用户
* @param userId 用户编号
*/
public void delete(Integer userId);
/**
* 更新用户信息。<br>
* 更新密码的时候,对象中的密码为明文,更新的时候自动转换为经过MD5加密后的密码
* @param user 用户
*/
public void update(Users user);
/**
* 将用户实例与数据库中的某条记录合并
* @param user 用户
*/
public void merge(Users user);
}
| [
"229457269@qq.com"
] | 229457269@qq.com |
2095fcab270498dc7606ed25284195309add8757 | d6cd99e39831f646582491cc7dfcc5e36fa90177 | /Item/Comprehension/AddMCQ2.java | 89121053dfc893ee2f57dd4f8b26c6cb6900293c | [] | no_license | AmoghJohri/DesignPatternsProject | b28730ff2818b5ca67955ecf548dad8f18bd96fe | 43581e392c838b4ff5c8f4b1953ff1438a5f4045 | refs/heads/master | 2023-01-21T22:51:49.869300 | 2020-11-30T02:46:51 | 2020-11-30T02:46:51 | 316,855,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,626 | java | package Item.Comprehension;
import Item.Item;
import Item.MCQ2.MCQ2Answer;
import Item.MCQ2.MCQ2Question;
// concrete decorator corresponding to MCQ2
public class AddMCQ2 extends Decorator
{
private MCQ2Question question; // MCQ2 question
private MCQ2Answer answer; // MCQ2 answer
public AddMCQ2(Comprehension tempComprehension, MCQ2Question question, MCQ2Answer answer)
{
super(tempComprehension);
this.question = question;
this.answer = answer;
}
public AddMCQ2(Comprehension tempComprehension, Item item)
{
super(tempComprehension);
this.question = (MCQ2Question)item.getQuestion();
this.answer = (MCQ2Answer)item.getAnswer();
}
// adding the required functionalities
public String getQuestionDescription()
{
String s = "Question " + Integer.toString(this.tempComprehension.getNumberOfItems().intValue()+1) + " : "+ this.question.getQuestion() + "\n" + "Options: \n";
Integer i = 1;
for(String each : this.question.getOptions())
{
s = s + i.toString() + ": " + each + "\n";
i ++;
}
return this.tempComprehension.getQuestionDescription() + "\n" + s;
}
public String getAnswerDescription()
{
String s = "Answer " + Integer.toString(this.tempComprehension.getNumberOfItems().intValue()+1) + " : ";
for(Integer each : this.answer.getCorrectAnswers())
{
s = s + each.toString() + " ";
}
s = s + "\n";
return this.tempComprehension.getAnswerDescription() + "\n" + s;
}
}
| [
"amogh.johri@iiitb.org"
] | amogh.johri@iiitb.org |
ae32baad0ad1144ed4b0ff8f3257eab820202c7d | e8f9fe2285f1598fee5860d2447fd1a1f6557306 | /MPC/temp/src/minecraft_server/net/minecraft/src/BlockLeaves.java | 75d0c238bba712806824cd0f8376aac925500881 | [] | no_license | pedroreisuft/minecraft | 8e71c74ee37ffbf863b0e89c7051ed2b3ce80a7f | 64ba09bce02603abea3270e4030be2aac4555822 | refs/heads/master | 2016-09-06T01:24:36.812128 | 2012-11-30T19:34:19 | 2012-11-30T19:34:19 | 6,943,629 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,705 | java | package net.minecraft.src;
import java.util.Random;
import net.minecraft.src.Block;
import net.minecraft.src.BlockLeavesBase;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Material;
import net.minecraft.src.StatList;
import net.minecraft.src.World;
public class BlockLeaves extends BlockLeavesBase {
private int field_72134_cr;
public static final String[] field_72136_a = new String[]{"oak", "spruce", "birch", "jungle"};
int[] field_72135_b;
protected BlockLeaves(int p_i3961_1_, int p_i3961_2_) {
super(p_i3961_1_, p_i3961_2_, Material.field_76257_i, false);
this.field_72134_cr = p_i3961_2_;
this.func_71907_b(true);
this.func_71849_a(CreativeTabs.field_78031_c);
}
public void func_71852_a(World p_71852_1_, int p_71852_2_, int p_71852_3_, int p_71852_4_, int p_71852_5_, int p_71852_6_) {
byte var7 = 1;
int var8 = var7 + 1;
if(p_71852_1_.func_72904_c(p_71852_2_ - var8, p_71852_3_ - var8, p_71852_4_ - var8, p_71852_2_ + var8, p_71852_3_ + var8, p_71852_4_ + var8)) {
for(int var9 = -var7; var9 <= var7; ++var9) {
for(int var10 = -var7; var10 <= var7; ++var10) {
for(int var11 = -var7; var11 <= var7; ++var11) {
int var12 = p_71852_1_.func_72798_a(p_71852_2_ + var9, p_71852_3_ + var10, p_71852_4_ + var11);
if(var12 == Block.field_71952_K.field_71990_ca) {
int var13 = p_71852_1_.func_72805_g(p_71852_2_ + var9, p_71852_3_ + var10, p_71852_4_ + var11);
p_71852_1_.func_72881_d(p_71852_2_ + var9, p_71852_3_ + var10, p_71852_4_ + var11, var13 | 8);
}
}
}
}
}
}
public void func_71847_b(World p_71847_1_, int p_71847_2_, int p_71847_3_, int p_71847_4_, Random p_71847_5_) {
if(!p_71847_1_.field_72995_K) {
int var6 = p_71847_1_.func_72805_g(p_71847_2_, p_71847_3_, p_71847_4_);
if((var6 & 8) != 0 && (var6 & 4) == 0) {
byte var7 = 4;
int var8 = var7 + 1;
byte var9 = 32;
int var10 = var9 * var9;
int var11 = var9 / 2;
if(this.field_72135_b == null) {
this.field_72135_b = new int[var9 * var9 * var9];
}
int var12;
if(p_71847_1_.func_72904_c(p_71847_2_ - var8, p_71847_3_ - var8, p_71847_4_ - var8, p_71847_2_ + var8, p_71847_3_ + var8, p_71847_4_ + var8)) {
int var13;
int var14;
int var15;
for(var12 = -var7; var12 <= var7; ++var12) {
for(var13 = -var7; var13 <= var7; ++var13) {
for(var14 = -var7; var14 <= var7; ++var14) {
var15 = p_71847_1_.func_72798_a(p_71847_2_ + var12, p_71847_3_ + var13, p_71847_4_ + var14);
if(var15 == Block.field_71951_J.field_71990_ca) {
this.field_72135_b[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0;
} else if(var15 == Block.field_71952_K.field_71990_ca) {
this.field_72135_b[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2;
} else {
this.field_72135_b[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -1;
}
}
}
}
for(var12 = 1; var12 <= 4; ++var12) {
for(var13 = -var7; var13 <= var7; ++var13) {
for(var14 = -var7; var14 <= var7; ++var14) {
for(var15 = -var7; var15 <= var7; ++var15) {
if(this.field_72135_b[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11] == var12 - 1) {
if(this.field_72135_b[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2) {
this.field_72135_b[(var13 + var11 - 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12;
}
if(this.field_72135_b[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] == -2) {
this.field_72135_b[(var13 + var11 + 1) * var10 + (var14 + var11) * var9 + var15 + var11] = var12;
}
if(this.field_72135_b[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] == -2) {
this.field_72135_b[(var13 + var11) * var10 + (var14 + var11 - 1) * var9 + var15 + var11] = var12;
}
if(this.field_72135_b[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] == -2) {
this.field_72135_b[(var13 + var11) * var10 + (var14 + var11 + 1) * var9 + var15 + var11] = var12;
}
if(this.field_72135_b[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] == -2) {
this.field_72135_b[(var13 + var11) * var10 + (var14 + var11) * var9 + (var15 + var11 - 1)] = var12;
}
if(this.field_72135_b[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] == -2) {
this.field_72135_b[(var13 + var11) * var10 + (var14 + var11) * var9 + var15 + var11 + 1] = var12;
}
}
}
}
}
}
}
var12 = this.field_72135_b[var11 * var10 + var11 * var9 + var11];
if(var12 >= 0) {
p_71847_1_.func_72881_d(p_71847_2_, p_71847_3_, p_71847_4_, var6 & -9);
} else {
this.func_72132_l(p_71847_1_, p_71847_2_, p_71847_3_, p_71847_4_);
}
}
}
}
private void func_72132_l(World p_72132_1_, int p_72132_2_, int p_72132_3_, int p_72132_4_) {
this.func_71897_c(p_72132_1_, p_72132_2_, p_72132_3_, p_72132_4_, p_72132_1_.func_72805_g(p_72132_2_, p_72132_3_, p_72132_4_), 0);
p_72132_1_.func_72859_e(p_72132_2_, p_72132_3_, p_72132_4_, 0);
}
public int func_71925_a(Random p_71925_1_) {
return p_71925_1_.nextInt(20) == 0?1:0;
}
public int func_71885_a(int p_71885_1_, Random p_71885_2_, int p_71885_3_) {
return Block.field_71987_y.field_71990_ca;
}
public void func_71914_a(World p_71914_1_, int p_71914_2_, int p_71914_3_, int p_71914_4_, int p_71914_5_, float p_71914_6_, int p_71914_7_) {
if(!p_71914_1_.field_72995_K) {
byte var8 = 20;
if((p_71914_5_ & 3) == 3) {
var8 = 40;
}
if(p_71914_1_.field_73012_v.nextInt(var8) == 0) {
int var9 = this.func_71885_a(p_71914_5_, p_71914_1_.field_73012_v, p_71914_7_);
this.func_71929_a(p_71914_1_, p_71914_2_, p_71914_3_, p_71914_4_, new ItemStack(var9, 1, this.func_71899_b(p_71914_5_)));
}
if((p_71914_5_ & 3) == 0 && p_71914_1_.field_73012_v.nextInt(200) == 0) {
this.func_71929_a(p_71914_1_, p_71914_2_, p_71914_3_, p_71914_4_, new ItemStack(Item.field_77706_j, 1, 0));
}
}
}
public void func_71893_a(World p_71893_1_, EntityPlayer p_71893_2_, int p_71893_3_, int p_71893_4_, int p_71893_5_, int p_71893_6_) {
if(!p_71893_1_.field_72995_K && p_71893_2_.func_71045_bC() != null && p_71893_2_.func_71045_bC().field_77993_c == Item.field_77745_be.field_77779_bT) {
p_71893_2_.func_71064_a(StatList.field_75934_C[this.field_71990_ca], 1);
this.func_71929_a(p_71893_1_, p_71893_3_, p_71893_4_, p_71893_5_, new ItemStack(Block.field_71952_K.field_71990_ca, 1, p_71893_6_ & 3));
} else {
super.func_71893_a(p_71893_1_, p_71893_2_, p_71893_3_, p_71893_4_, p_71893_5_, p_71893_6_);
}
}
public int func_71899_b(int p_71899_1_) {
return p_71899_1_ & 3;
}
public boolean func_71926_d() {
return !this.field_72131_c;
}
public int func_71858_a(int p_71858_1_, int p_71858_2_) {
return (p_71858_2_ & 3) == 1?this.field_72059_bZ + 80:((p_71858_2_ & 3) == 3?this.field_72059_bZ + 144:this.field_72059_bZ);
}
}
| [
"phsmreis@gmail.com"
] | phsmreis@gmail.com |
ead3081843b8cdb1078656f541a7258e32021085 | 47aec655ff3abe4ee98f36c03a7903bf4e842fa8 | /src/main/java/org/alessio29/savagebot/apiActions/bennies/InitBenniesAction.java | f87f51187e604612cb4f40e540191107c824524a | [] | no_license | alessio29/savagebot | 3e86bc116114dc868b2e455983380570f41e47db | de11e7bdfa7a09c863db07fbb9e5790ad0df7541 | refs/heads/master | 2023-07-23T23:52:54.136392 | 2023-07-04T06:08:04 | 2023-07-04T06:08:04 | 159,931,777 | 49 | 12 | null | 2023-07-16T14:26:21 | 2018-12-01T10:06:28 | Java | UTF-8 | Java | false | false | 648 | java | package org.alessio29.savagebot.apiActions.bennies;
import org.alessio29.savagebot.internal.IMessageReceived;
import org.alessio29.savagebot.internal.commands.CommandExecutionResult;
import org.alessio29.savagebot.internal.utils.ChannelConfig;
import org.alessio29.savagebot.internal.utils.ChannelConfigs;
public class InitBenniesAction {
public CommandExecutionResult doAction(IMessageReceived message, String[] args) {
ChannelConfig config = ChannelConfigs.getChannelConfig(message.getChannelId());
config.initBenniesPoool();
return new CommandExecutionResult("Bennies pool initialized", args.length + 1);
}
}
| [
"alessio29@yandex.ru"
] | alessio29@yandex.ru |
4d162634c0c0500b64a9da4c8a283a99d745d793 | 31308c0dd1d8bfc074f10b1bf8b40fa26f45cf51 | /FirstAndLastPosition.java | 128cddba84c78f03671e7e765b3436d8b779e5be | [] | no_license | SunavaP/DataStructureAndAlgorithm | 6f81c35ee50d7fec1122c5f32906813dd0581423 | c69b57a5d1aadb2d894f7546973a78654883365f | refs/heads/master | 2022-01-09T19:49:34.903718 | 2019-05-14T04:38:05 | 2019-05-14T04:38:05 | 45,674,225 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,863 | java | import java.util.Arrays;
public class FirstAndLastPosition {
public static void main(String[] args) {
int n[] = {5, 7, 7, 8, 8, 10, 11, 14, 15, 15, 16, 17};
System.out.println(Arrays.toString(searchRange(n, 1)));
}
private static int[] searchRange(int[] nums, int target) {
boolean found = false;
int low = 0;
int high = nums.length - 1;
int mid = 0;
while (low <= high) {
mid = (high + low) / 2;
if (nums[mid] < target)
low = mid + 1;
else if (nums[mid] > target)
high = mid - 1;
else {
found = true;
break;
}
}
if (!found)
return new int[]{-1, -1};
System.out.println(found + " " + mid);
low = 0;
high = mid;
int temp = mid;
int[] position = new int[2];
while (low <= high) {
mid = (low + high) / 2;
if (nums[mid] != target)
low = mid + 1;
else if (nums[mid] == target) {
if (mid == 0 || nums[mid] != nums[mid - 1]) {
position[0] = mid;
break;
}
high = mid - 1;
}
}
System.out.println(position[0]);
low = temp;
high = nums.length - 1;
while (low <= high) {
mid = (low + high) / 2;
if (nums[mid] != target)
high = mid - 1;
else if (nums[mid] == target) {
if (mid == nums.length - 1 || nums[mid] != nums[mid + 1]) {
position[1] = mid;
break;
}
low = mid + 1;
}
}
System.out.println(position[1]);
return nums;
}
}
| [
"sunava@sunavas-MacBook-Pro.local"
] | sunava@sunavas-MacBook-Pro.local |
830e7a4fceb831c3884adc2fc55a85044107d5a2 | 09379a45dc3d3a22db90be2d348a7a8c707e7ec7 | /admin-video-common/src/main/java/com/Echoplus/utils/MD5Utils.java | 61a1082df8222b8a4d6769b4eefe7f8f6e3e5404 | [] | no_license | EchoPluslp/admin-video | 958edb9d00161a3d78929adbad7cca1c90d67134 | 3f66d46a40d4f5715c2a11eafeb43b3b67d749b3 | refs/heads/master | 2020-04-12T11:38:32.350122 | 2019-04-17T10:12:44 | 2019-04-17T10:12:44 | 162,466,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 594 | java | package com.Echoplus.utils;
import java.security.MessageDigest;
import org.apache.commons.codec.binary.Base64;
public class MD5Utils {
/**
* @Description: 对字符串进行md5加密
*/
public static String getMD5Str(String strValue) throws Exception {
MessageDigest md5 = MessageDigest.getInstance("MD5");
String newstr = Base64.encodeBase64String(md5.digest(strValue.getBytes()));
return newstr;
}
public static void main(String[] args) {
try {
String md5 = getMD5Str("Echoplus");
System.out.println(md5);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"qazwsxedc219@qq.com"
] | qazwsxedc219@qq.com |
56f6a11b6799822c18703db7be18e1f2e9d4903b | 513eff831b877b256fb07a637913476c16620488 | /src/main/java/com/google/devtools/build/lib/exec/CheckUpToDateFilter.java | 7390cb3a040867171f85866713962d900f742287 | [
"Apache-2.0"
] | permissive | kudddy/bazel | 3a3c49fc8081c8306b1492cdbdf0cc338673a6e8 | 76555482873ffcf1d32fb40106f89231b37f850a | refs/heads/master | 2020-07-03T05:48:16.907289 | 2017-06-04T23:54:37 | 2017-06-05T14:19:20 | 201,805,076 | 2 | 0 | Apache-2.0 | 2019-08-11T19:15:28 | 2019-08-11T19:15:28 | null | UTF-8 | Java | false | false | 2,759 | java | // Copyright 2014 The Bazel Authors. 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.google.devtools.build.lib.exec;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.rules.test.TestRunnerAction;
/**
* Class implements --check_???_up_to_date execution filter predicate
* that prevents certain actions from being executed (thus aborting
* the build if action is not up-to-date).
*/
public final class CheckUpToDateFilter implements Predicate<Action> {
/**
* Determines an execution filter based on the --check_up_to_date and
* --check_tests_up_to_date options. Returns a singleton if possible.
*/
public static Predicate<Action> fromOptions(ExecutionOptions options) {
if (!options.testCheckUpToDate && !options.checkUpToDate) {
return Predicates.alwaysTrue();
}
return new CheckUpToDateFilter(options);
}
private final boolean allowBuildActionExecution;
private final boolean allowTestActionExecution;
/**
* Creates new execution filter based on --check_up_to_date and
* --check_tests_up_to_date options.
*/
private CheckUpToDateFilter(ExecutionOptions options) {
// If we want to check whether test is up-to-date, we should disallow
// test execution.
this.allowTestActionExecution = !options.testCheckUpToDate;
// Build action execution should be prohibited in two cases - if we are
// checking whether build is up-to-date or if we are checking that tests
// are up-to-date (and test execution is not allowed).
this.allowBuildActionExecution = allowTestActionExecution && !options.checkUpToDate;
}
/**
* @return true if actions' execution is allowed, false - otherwise
*/
@Override
public boolean apply(Action action) {
if (action instanceof AlwaysOutOfDateAction) {
// Always allow fileset manifest action to execute because it identifies files included
// in the fileset during execution time.
return true;
} else if (action instanceof TestRunnerAction) {
return allowTestActionExecution;
} else {
return allowBuildActionExecution;
}
}
}
| [
"hanwen@google.com"
] | hanwen@google.com |
6947350d4e78c14ef4b5395289d7c419418a3ffb | 443490d1ced4082dda836963b202877292aef889 | /src/com/moon/biz/register/RegisterAct.java | eda369d4ae6f728840207bdc20728f57c647e630 | [] | no_license | Bye-2012/SinaNews | 4e10c9cbbda682cfcf80ed4fc3d406df02981a10 | 7306b0648de668e48ead55ba1184634239f90126 | refs/heads/master | 2021-01-23T02:54:07.687552 | 2015-04-27T13:00:22 | 2015-04-27T13:00:22 | 34,258,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,198 | java | package com.moon.biz.register;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.moon.app.AppCtx;
import com.moon.biz.R;
import com.moon.common.utils.UrlUtils;
/**
* Created by IntelliJ IDEA
* User: Moon
* Date:2015/4/24
*/
public class RegisterAct extends Activity {
@ViewInject(R.id.editText_reg_name)
private EditText editText_reg_name;
@ViewInject(R.id.editText_reg_pwd)
private EditText editText_reg_pwd;
@ViewInject(R.id.editText_reg_check)
private EditText editText_reg_check;
@ViewInject(R.id.img_reg_verifyCode)
private NetworkImageView img_reg_verifyCode;
private AppCtx appCtx;
private ImageLoader imageLoader;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
ViewUtils.inject(this);
initView();
}
private void initView(){
appCtx = AppCtx.getInstance();
imageLoader = appCtx.getImageLoader();
String sequence = appCtx.getSequence();
img_reg_verifyCode.setDefaultImageResId(R.drawable.logo);
if (sequence != null) {
img_reg_verifyCode.setImageUrl(UrlUtils.VERIFY_CODE+sequence,imageLoader);
}
}
public void btnNext(View v){
if (v.getId() == R.id.textView_reg_next){
Intent intent = new Intent();
intent.setClass(this,RegisterMoreInfoAct.class);
Bundle bundle = new Bundle();
bundle.putString("name",editText_reg_name.getText().toString());
bundle.putString("pwd",editText_reg_pwd.getText().toString());
bundle.putString("check",editText_reg_check.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
}
}
} | [
"1695966051@qq.com"
] | 1695966051@qq.com |
49b5a7e8183edfb38794bd67b7803f40a5fb3423 | dcdbdc17698184d5cd0b93f67c898260d2252661 | /UltraEmojiCombate/src/ultraemojicombate/Lutador.java | 7690f3d45f9ae69d72dae77bf3f40460652f13f5 | [
"MIT"
] | permissive | PatriciaCarla/Exercicios-JavaPOO | bb12e574f18612d20590d3ec4f5be88449ceb474 | c127bd3d7627f86a9894f4fa12a68c7737d08163 | refs/heads/main | 2023-03-27T03:02:41.594205 | 2021-03-29T00:28:57 | 2021-03-29T00:28:57 | 350,228,277 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,627 | java | package ultraemojicombate;
public class Lutador {
//Atributos
private String nome;
private String nacional;
private int idade;
private float altura;
private float peso;
private String categoria;
private int vitorias;
private int derrotas;
private int empates;
//Métodos especiais
public Lutador(String no, String na, int i, float a, float p, int v, int d, int e) {
setNome(no);
setNacional(na);
setIdade(i);
setAltura(a);
setPeso(p);
setVitorias(v);
setDerrotas(d);
setEmpates(e);
}
public String getNome() {
return this.nome;
}
public void setNome(String n) {
this.nome = n;
}
public String getNacional() {
return this.nacional;
}
public void setNacional(String n) {
this.nacional = n;
}
public int getIdade() {
return this.idade;
}
public void setIdade(int i) {
this.idade = i;
}
public float getAltura() {
return this.altura;
}
public void setAltura(float a) {
this.altura = a;
}
public float getPeso() {
return this.peso;
}
public void setPeso(float p) {
this.peso = p;
setCategoria();
}
public String getCategoria() {
return this.categoria;
}
private void setCategoria() {
if (getPeso() < 52.2f) {
categoria = "Inválido";
} else if (getPeso() <= 70.3f) {
categoria = "Leve";
} else if (getPeso() <= 83.9f) {
categoria = "Médio";
} else if (getPeso() <= 120.2f){
categoria = "Pesado";
} else {
categoria = "Inválido";
}
}
public int getVitorias() {
return this.vitorias;
}
public void setVitorias(int v) {
this.vitorias = v;
}
public int getDerrotas() {
return derrotas;
}
public void setDerrotas(int d) {
this.derrotas = d;
}
public int getEmpates() {
return this.empates;
}
public void setEmpates(int e) {
this.empates = e;
}
//Métodos
public void apresentacao() {
System.out.printf("Desse lado, diretamente de seu país %s, pesando %.2f quilos, %.2f de altura, %d vitórias,"
+ " %d derrotas e %d empates, o %s!! \n\n",this.getNacional(),this.getPeso(),this.getAltura(),this.getVitorias(),
this.getDerrotas(),this.getEmpates(),this.getNome());
}
public void apresentar() {
System.out.println("Nome: " + getNome());
System.out.println("Nacionalidade: " + getNacional());
System.out.println("Idade :" + getIdade());
System.out.println("Altura: " + getAltura());
System.out.println("Peso: " + getPeso());
System.out.println("Categoria: " + getCategoria());
System.out.println("Vitórias: " + getVitorias());
System.out.println("Derrotas: " + getDerrotas());
System.out.printf("Empates: " + getEmpates() + "\n\n");
}
public void status() {
System.out.println(getNome());
System.out.println("Categoria: " + getCategoria());
System.out.println(getVitorias() + " Vitórias");
System.out.println(getDerrotas() + " Derrotas");
System.out.printf(getEmpates() + " Empates\n\n");
}
public void ganharLuta() {
setVitorias(getVitorias() + 1);
}
public void perderLuta() {
setDerrotas(getDerrotas() + 1);
}
public void empatarLuta() {
setEmpates(getEmpates() + 1);
}
}
| [
"patycarlasoares@gmail.com"
] | patycarlasoares@gmail.com |
2a88854d17ce7e1cc072823298563e5ca904fa1c | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /files/File_1020797.java | 7f026af2b9f6175f2671001a1a03ad866f61ce16 | [
"Apache-2.0"
] | permissive | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,493 | java | package com.fisher.gateway.interceptor;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
@Slf4j
@Configuration
public class OAuth2FeignRequestInterceptor implements RequestInterceptor {
private final Logger LOGGER = LoggerFactory.getLogger(getClass());
private static final String AUTHORIZATION_HEADER = "Authorization";
private static final String BEARER_TOKEN_TYPE = "Bearer";
@Override
public void apply(RequestTemplate requestTemplate) {
SecurityContext securityContext = SecurityContextHolder.getContext();
Authentication authentication = securityContext.getAuthentication();
if (authentication != null && authentication.getDetails() instanceof OAuth2AuthenticationDetails) {
OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) authentication.getDetails();
requestTemplate.header(AUTHORIZATION_HEADER, String.format("%s %s", BEARER_TOKEN_TYPE, details.getTokenValue()));
}
}
}
| [
"sonnguyen@utdallas.edu"
] | sonnguyen@utdallas.edu |
fe046087772994832eccf48578f611bf24f31a0c | 10017e6e4fae86ba9c7d6ac891c5ca8988d8b3e4 | /app/src/main/java/cn/see/chat/controller/MenuItemController.java | 9c8d3e22961261b4ec60bbe2614154892bbf5ebf | [] | no_license | TiAmoGxb/See | e5f94cb139d4c00f242fab1a564eea8a6b983d6b | 4e7d774218828978733e6ef551bfb439e0a17978 | refs/heads/master | 2020-03-22T17:47:06.596872 | 2018-12-27T07:46:48 | 2018-12-27T07:46:48 | 140,415,559 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,004 | java | package cn.see.chat.controller;
import android.content.Intent;
import android.view.View;
import cn.see.R;
import cn.see.chat.activity.CommonScanActivity;
import cn.see.chat.activity.CreateGroupActivity;
import cn.see.chat.activity.SearchForAddFriendActivity;
import cn.see.chat.activity.fragment.ConversationListFragment;
import cn.see.chat.model.Constant;
/**
* Created by ${chenyn} on 2017/4/9.
*/
public class MenuItemController implements View.OnClickListener {
private ConversationListFragment mFragment;
public MenuItemController(ConversationListFragment fragment) {
this.mFragment = fragment;
}
//会话界面的加号
@Override
public void onClick(View v) {
Intent intent;
switch (v.getId()) {
case R.id.create_group_ll:
mFragment.dismissPopWindow();
intent = new Intent(mFragment.getContext(), CreateGroupActivity.class);
mFragment.getContext().startActivity(intent);
break;
case R.id.add_friend_with_confirm_ll:
mFragment.dismissPopWindow();
intent = new Intent(mFragment.getContext(), SearchForAddFriendActivity.class);
intent.setFlags(1);
mFragment.startActivity(intent);
break;
case R.id.send_message_ll:
mFragment.dismissPopWindow();
intent = new Intent(mFragment.getContext(), SearchForAddFriendActivity.class);
intent.setFlags(2);
mFragment.startActivity(intent);
break;
//扫描二维码
case R.id.ll_saoYiSao:
intent = new Intent(mFragment.getContext(), CommonScanActivity.class);
intent.putExtra(Constant.REQUEST_SCAN_MODE, Constant.REQUEST_SCAN_MODE_QRCODE_MODE);
mFragment.getContext().startActivity(intent);
break;
default:
break;
}
}
}
| [
"78997767@qq.com"
] | 78997767@qq.com |
685a60cbc46c073642025113de755b8245e0ee1c | fdb6375e39c563fa204d03d8a9716f53af80bd95 | /trinkedemo/src/main/java/com/rk/trinkedemo/Text.java | 14674e2ddda50c12e4ea5001132871f2d59f4b25 | [] | no_license | wyj3531/Demo | b6845f4dba7c4d3a44472876fcdec41300feede7 | cfb067af474f98a09f2c1e88ade21fbf8cba6884 | refs/heads/master | 2020-05-05T09:55:09.388466 | 2019-04-23T16:10:51 | 2019-04-23T16:10:51 | 179,923,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package com.rk.trinkedemo;
import java.util.TreeMap;
/**
* @author orange
* @time 2019-04-14 10:51
*/
public class Text {
public static void main(String[] args){
int [] target={10, -2, 5, 8, -4, 2, -3, 7, 12, -88, -23, 35};
count(target);
TreeMap<Integer,Integer> map=new TreeMap<>();
map.put(5,10);
map.put(1,2);
}
private static void count(int[] target) {
int temp=0;
int index=-1;
for (int i = 0; i < target.length; i++) {
if (target[i] < 0) {
temp=target[i];
target[i]=target[index+1];
target[index+1]=temp;
index++;
}
}
for (int i = 0; i < target.length; i++) {
System.out.print(""+target[i]+"\r\n");
}
}
}
| [
"wyj842537@163.com"
] | wyj842537@163.com |
65dddac499f45f99376f276177ab395339b99fe3 | 83d0883cd6f4581ca39c02c59f0c6df994bd38eb | /src/view/graphicmanager/IShapeGraphicCollectionObservers.java | b92465337ec27b61a6340c879e4905fba6931c91 | [] | no_license | Carl-K/Drawing-Application | b483f1769ac6271d9c191ba2b6e2bee493b6e9b3 | 9194f27fc4b24a0f6148572b63cb38d63825b48a | refs/heads/master | 2020-03-30T17:41:03.652114 | 2018-10-03T19:13:14 | 2018-10-03T19:13:14 | 151,459,041 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package view.graphicmanager;
import view.subscriptions.ShapeGraphicCreatedObserver;
import view.subscriptions.ShapeGraphicRemovedObserver;
import view.subscriptions.ShapeGraphicUpdatedObserver;
public interface IShapeGraphicCollectionObservers extends ShapeGraphicCreatedObserver, ShapeGraphicUpdatedObserver, ShapeGraphicRemovedObserver {
}
| [
"noreply@github.com"
] | noreply@github.com |
1065cb9cc24f14a41b7e8a4829bdd6cc5761058b | 1f19aec2ecfd756934898cf0ad2758ee18d9eca2 | /u-1/u-12/u-11-112/u-11-112-f1283.java | 9e6cc8a44b1b43051e86df6e74083586541f13e8 | [] | 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
3048133123010 | [
"jenkins@khan.paloaltonetworks.local"
] | jenkins@khan.paloaltonetworks.local |
febaf161d91c3df7d209be05bae222bdcd9a4a78 | 6cfdb394477b5af7caf3a78a94f3da8bbf7ea146 | /AddItems.java | 97dc8e68c61db80db52b55dae720024c2ff0d4e6 | [] | no_license | shravanthimadhugiri/VendorCustomerApplication | 13683abcd008896b12cd352392061ec6671192f0 | 552b659469ff72ba89512f6cf08c6167e41760c1 | refs/heads/main | 2023-07-10T00:02:04.708682 | 2021-08-04T14:59:18 | 2021-08-04T14:59:18 | 392,727,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,155 | java | package com.example.vendorproject;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class AddItems extends AppCompatActivity implements AdapterView.OnItemSelectedListener, View.OnClickListener{
DatabaseReference reff;
Shops shop;
String ss, phone, land, types, goods, cost;
Bundle bundle;
Spinner spinum;
EditText goods1, cost1;
Button b1, b2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_items);
bundle=getIntent().getBundleExtra("data");
goods1 = (EditText)findViewById(R.id.nameofitem);
cost1 = (EditText)findViewById(R.id.priceofitem);
//land =bundle.getString("land");
phone = bundle.getString("phone");
//types = bundle.getString("type");
b1 = (Button)findViewById(R.id.addtoshop);
b2 = (Button)findViewById(R.id.button3);
b1.setOnClickListener(this);
b2.setOnClickListener(this);
spinum = (Spinner) findViewById(R.id.spin_num);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.number, android.R.layout.simple_dropdown_item_1line);
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spinum.setAdapter(adapter);
spinum.setOnItemSelectedListener(this);
shop = new Shops();
reff = FirebaseDatabase.getInstance().getReference().child("Shops");
}
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
Object selected = parent.getItemAtPosition(pos);
ss = selected.toString();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
@Override
public void onClick(View v) {
if(v.equals(b1)){
cost = cost1.getText().toString();
goods = goods1.getText().toString();
//shop.setType(types);
//shop.setLandmark(land);
shop.setPrice(cost);
shop.setItem(goods);
shop.setPhone(Long.parseLong(phone));
reff.push().setValue(shop);
Toast.makeText(getBaseContext(), "Successfully added!", Toast.LENGTH_SHORT).show();
Bundle bundle = new Bundle();
bundle.putString("phone", phone);
Intent i = new Intent(this, AddItems.class);
i.putExtra("data", bundle);
startActivity(i);
}
else{
Intent i = new Intent(this, MainActivity.class);
startActivity(i);
}
finish();
}
} | [
"noreply@github.com"
] | noreply@github.com |
ac2ba15f19b782e420066c88d4caeb4681fd8a0c | 4d69b8b3a8025dc9a8660090005e93943924b915 | /src/day40_CustomClass/Computer.java | 1b6f1421fd9e3ee069a2957cec60c7f516e74265 | [] | no_license | HurmaH/JavaCore | 648de2cbb2935ac0edcb0760caf70832a33e65ac | b7ba23c74849dbb6131cceb7fc5db676ac094e03 | refs/heads/master | 2020-06-04T00:47:46.598461 | 2019-07-21T21:42:27 | 2019-07-21T21:42:27 | 191,799,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 873 | java | package day40_CustomClass;
public class Computer {
/*
* instance variables/field get default value
* if it's not specified in template class
*
* default values can be changed
* in template class by providing value
* in template class itself while declaring the field
*
*/
String type="unknown";//changing default value from null to "unknown"
int ram;
double screenSize;
String color;
String OS;
boolean isPersonal;
//it ;s highly not recommended to have main method directly
//inside your template class--> use different class to create object
public static void main(String[] args) {
Computer iMac = new Computer();
//System.out.println(type); //we cannot access instance variable outside of instance method
System.out.println(iMac.type); //we had to creat object to pass instance field,
}
}
| [
"hurmahm@gmail.com"
] | hurmahm@gmail.com |
d49d998163449a41db1e7a522ca7951bff396c23 | f6323b3fa8f57aa17b170243ddcff9265b3ace0b | /app/src/main/java/com/dts/mpos/RepesajeLista.java | 899fd98be9320ddcf1d59c8c7a4fcc18ca174639 | [] | no_license | dtsolutionsgt/mpos | ffa16e2a48ec4b61850837c6c47ae76dec95f857 | 0b592c9ed5fccf9f190eea2eec7bc4813591131a | refs/heads/master | 2023-08-17T16:11:47.002520 | 2019-11-24T17:17:45 | 2019-11-24T17:17:45 | 192,608,901 | 0 | 1 | null | 2023-06-16T12:29:49 | 2019-06-18T20:34:12 | Java | UTF-8 | Java | false | false | 5,921 | java | package com.dts.mpos;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import java.util.ArrayList;
public class RepesajeLista extends PBase {
private ListView listView;
private TextView lblProd,lblPres,lblCant,lblPrec,lblTot;
private ArrayList<clsClasses.clsCD> items= new ArrayList<clsClasses.clsCD>();
private ListAdaptRepesList adapter;
private String prodid;
private boolean esbarra;
private AppMethods app;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_repesaje_lista);
super.InitBase();
addlog("RepesajeLista",""+du.getActDateTime(),gl.vend);
listView = (ListView) findViewById(R.id.listView1);
lblProd= (TextView) findViewById(R.id.textView31);
lblPres= (TextView) findViewById(R.id.textView42);
lblCant= (TextView) findViewById(R.id.textView35);
lblPrec= (TextView) findViewById(R.id.textView36);
lblTot = (TextView) findViewById(R.id.textView37);
prodid=gl.gstr;
lblProd.setText(gl.gstr2);
app = new AppMethods(this, gl, Con, db);
esbarra=app.prodBarra(prodid);
if (esbarra) lblPres.setText("Barra"); else lblPres.setText("Codigo");
setHandlers();
listItems();
}
//region Events
public void repesaje(View view) {
if (items.size()==0) {
msgbox("No se puede realizar repesaje");return;
}
try{
browse=1;
startActivity(new Intent(this,Repesaje.class));
}catch (Exception e){
addlog(new Object(){}.getClass().getEnclosingMethod().getName(),e.getMessage(),"");
}
}
public void exit(View view) {
finish();
}
private void setHandlers() {
try{
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
try {
Object lvObj = listView.getItemAtPosition(position);
clsClasses.clsCD vItem = (clsClasses.clsCD) lvObj;
prodid = vItem.Cod;
adapter.setSelectedIndex(position);
} catch (Exception e) {
addlog(new Object(){}.getClass().getEnclosingMethod().getName(),e.getMessage(),"");
mu.msgbox(e.getMessage());
}
}
});
}catch (Exception e){
addlog(new Object(){}.getClass().getEnclosingMethod().getName(),e.getMessage(),"");
}
}
//endregion
//region Main
private void listItems() {
try{
if (esbarra) listItemsBarra();else listItemsSingle();
}catch (Exception e){
addlog(new Object(){}.getClass().getEnclosingMethod().getName(),e.getMessage(),"");
}
}
private void listItemsSingle() {
Cursor dt;
clsClasses.clsCD item;
items.clear();
try {
sql = "SELECT PESO,TOTAL FROM T_VENTA WHERE PRODUCTO='"+prodid+"' ";
dt = Con.OpenDT(sql);
dt.moveToFirst();
item = clsCls.new clsCD();
item.Cod = prodid;
item.Desc = mu.frmdecimal(dt.getDouble(0),gl.peDecImp);
item.Text = mu.frmdecimal(dt.getDouble(1),2);
items.add(item);
lblCant.setText("1");
lblPrec.setText(mu.frmdecimal(dt.getDouble(0),gl.peDecImp));
lblTot.setText(mu.frmdecimal(dt.getDouble(1),2));
} catch (Exception e) {
addlog(new Object(){}.getClass().getEnclosingMethod().getName(),e.getMessage(),sql);
mu.msgbox(e.getMessage());
}
adapter=new ListAdaptRepesList(this, items);
listView.setAdapter(adapter);
}
private void listItemsBarra() {
Cursor dt;
clsClasses.clsCD item;
double ppeso,pprec,tpeso=0,tprec=0;
items.clear();
try {
//sql = "SELECT BARRA,PESO,PRECIO FROM T_BARRA WHERE CODIGO='"+prodid+"' AND VENTA=1";
sql = "SELECT BARRA,PESO,PRECIO FROM T_BARRA WHERE CODIGO='"+prodid+"'";
dt = Con.OpenDT(sql);
dt.moveToFirst();
while (!dt.isAfterLast()) {
item = clsCls.new clsCD();
ppeso=mu.round(dt.getDouble(1),gl.peDecImp);tpeso+=ppeso;
pprec=mu.round(dt.getDouble(2),2);tprec+=pprec;
item.Cod = dt.getString(0);
item.Desc = mu.frmdecimal(ppeso,gl.peDecImp);
item.Text = mu.frmdecimal(pprec,2);
items.add(item);
dt.moveToNext();
}
lblCant.setText(""+items.size());
lblPrec.setText(mu.frmdecimal(tpeso,gl.peDecImp));
lblTot.setText(mu.frmdecimal(tprec,2));
} catch (Exception e) {
addlog(new Object(){}.getClass().getEnclosingMethod().getName(),e.getMessage(),sql);
mu.msgbox(e.getMessage());
}
adapter=new ListAdaptRepesList(this, items);
listView.setAdapter(adapter);
}
//endregion
//region Aux
//endregion
//region Activity Events
@Override
protected void onResume() {
try{
super.onResume();
if (browse==1) {
browse=0;
listItems();return;
}
}catch (Exception e){
addlog(new Object(){}.getClass().getEnclosingMethod().getName(),e.getMessage(),"");
}
}
//endregion
} | [
"dtsolutionsgt@gmail.com"
] | dtsolutionsgt@gmail.com |
4791846fb5adff2830f22ef325a9573237310a44 | c9b767cdaac2cbe0785ff95712b4484a384f7720 | /app/src/main/java/com/dex/teufelsturmoffline/views/SearchViewFragment.java | 200f7cadf0073dbb76e406342be03a7998d6ef93 | [] | no_license | jomaresch/TeufelsTurmOffline | 8c2661464bbaf0f2534f4e5f42e6651510511f8a | 813a9469bd36f1344f14e8535754b2d6e6525240 | refs/heads/master | 2023-06-08T09:35:38.658175 | 2023-06-04T09:39:16 | 2023-06-04T09:39:16 | 160,845,639 | 0 | 0 | null | 2023-06-04T09:39:17 | 2018-12-07T16:03:51 | Java | UTF-8 | Java | false | false | 5,751 | java | package com.dex.teufelsturmoffline.views;
import android.content.Intent;
import android.os.Bundle;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.SearchView;
import android.widget.Spinner;
import com.dex.teufelsturmoffline.R;
import com.dex.teufelsturmoffline.activities.CommentActivity;
import com.dex.teufelsturmoffline.adapter.RouteRecycleAdapter;
import com.dex.teufelsturmoffline.adapter.SpinnerAreaAdapter;
import com.dex.teufelsturmoffline.database.DatabaseHelper;
import com.dex.teufelsturmoffline.database.SettingsSaver;
import com.dex.teufelsturmoffline.model.AreaSpinnerData;
import com.dex.teufelsturmoffline.model.Route;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class SearchViewFragment extends Fragment {
Spinner spinner_area;
RecyclerView recyclerView;
RouteRecycleAdapter routeRecycleAdapter;
View view;
DatabaseHelper db;
SearchView searchView;
private String currentFilterText = "";
FloatingActionButton fab_map;
public SearchViewFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
db = new DatabaseHelper(getContext());
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.search_menu, menu);
MenuItem searchButton = menu.findItem(R.id.search);
searchView = (SearchView) searchButton.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
currentFilterText = query;
if (query.equals(""))
resetRouteList();
else
filterRouteList(query);
return false;
}
@Override
public boolean onQueryTextChange(String s) {
currentFilterText = s;
if(s.equals(""))
resetRouteList();
else
filterRouteList(s);
return false;
}
});
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_search_view, container, false);
recyclerView = view.findViewById(R.id.recyclerView_routes);
spinner_area = view.findViewById(R.id.spinner_area);
List<Pair<String, Integer>> areaPairs = db.getAreas();
List<AreaSpinnerData> spinnerData = new ArrayList<>();
for (Pair<String, Integer> pair : areaPairs) {
spinnerData.add(new AreaSpinnerData(pair.first, pair.second));
}
SpinnerAreaAdapter spinnerAreaAdapter = new SpinnerAreaAdapter(view.getContext(), R.layout.row_spinner_area, spinnerData);
spinner_area.setAdapter(spinnerAreaAdapter);
spinner_area.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
updateRouteList(parent.getItemAtPosition(position).toString());
searchView.onActionViewCollapsed();
SettingsSaver.setArea(getActivity(), position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
spinner_area.setSelection(SettingsSaver.getArea(getActivity()));
List<Route> routeList = new ArrayList<>();
if (spinnerData.size() > 0) {
routeList = db.getRoutesByArea(spinnerData.get(0).getArea());
}
LinearLayoutManager mLinearLayoutManager = new LinearLayoutManager(getActivity(),
LinearLayoutManager.VERTICAL, false);
routeRecycleAdapter = new RouteRecycleAdapter(getActivity(), routeList, new RouteRecycleAdapter.OnItemClickListener() {
@Override
public void onItemClick(Route item) {
Intent intent = new Intent(getContext(), CommentActivity.class);
intent.putExtra("ID", item.getId());
startActivity(intent);
}
});
recyclerView.setLayoutManager(mLinearLayoutManager);
recyclerView.setAdapter(routeRecycleAdapter);
return view;
}
public void updateRouteList(String area) {
List<Route> list = db.getRoutesByArea(area);
Collections.sort(list);
routeRecycleAdapter.updateData(list);
}
public void filterRouteList(String filter) {
routeRecycleAdapter.filterData(filter);
}
public void resetRouteList() {
routeRecycleAdapter.resetData();
}
@Override
public void onResume() {
super.onResume();
recyclerView.requestFocus();
if (db == null) {
db = new DatabaseHelper(getContext());
}
routeRecycleAdapter.updateData(db.getRoutesByArea(spinner_area.getSelectedItem().toString()));
if (!currentFilterText.equals(""))
filterRouteList(currentFilterText);
}
}
| [
"johannes_ma@web.de"
] | johannes_ma@web.de |
37961bea998bf644fcf403e19e7dd1ed58e826c7 | 8efbd2c63d20f2180dac564bbf76aa695e05c779 | /core/src/com/mygdx/game/InputHandling/KeyBoardInputManager.java | 3a59d47486e6b20809f587acddd569393a884f15 | [] | no_license | val92130/Rpg | 30151906f1dcb1853c170609842eb75f0bb48c4c | ebc8708f3af91e4e5b6536ddc27a1d5ed7fe4019 | refs/heads/master | 2016-08-03T18:51:38.390999 | 2015-08-19T18:27:42 | 2015-08-19T18:27:42 | 39,652,523 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,340 | java | package com.mygdx.game.InputHandling;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.math.Vector2;
import com.mygdx.game.Constants;
import com.mygdx.game.Screens.GameScreen;
/**
* Created by val on 23/07/2015.
*/
public class KeyBoardInputManager implements InputProcessor {
GameScreen game;
boolean left,right,up,down;
Vector2 touchPos;
public KeyBoardInputManager(GameScreen game)
{
this.game = game;
}
public void Update()
{
if(Gdx.input.isKeyPressed(Constants.KEY_MOVE_LEFT))
{
game.getCamera().Move(new Vector2(-Constants.CAMERA_SPEED * Gdx.graphics.getDeltaTime() ,0 ));
}
if(Gdx.input.isKeyPressed(Constants.KEY_MOVE_RIGHT))
{
game.getCamera().Move(new Vector2(Constants.CAMERA_SPEED* Gdx.graphics.getDeltaTime() ,0 ));
}
if(Gdx.input.isKeyPressed(Constants.KEY_MOVE_UP))
{
game.getCamera().Move(new Vector2(0,Constants.CAMERA_SPEED* Gdx.graphics.getDeltaTime() ));
}
if(Gdx.input.isKeyPressed(Constants.KEY_MOVE_DOWN))
{
game.getCamera().Move(new Vector2(0,-Constants.CAMERA_SPEED* Gdx.graphics.getDeltaTime() ));
}
}
public boolean keyDown(int keycode) {
if(keycode == Constants.KEY_TOGGLE_NIGHT)
{
game.getAmbientEventManager().setNightTime(!game.getAmbientEventManager().getNightTime());
}
return false;
}
public boolean keyUp(int keycode) {
return false;
}
public boolean keyTyped(char character) {
return false;
}
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
return false;
}
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
return false;
}
public boolean touchDragged(int screenX, int screenY, int pointer) {
return false;
}
public boolean mouseMoved(int screenX, int screenY) {
return false;
}
public boolean scrolled(int amount) {
if(amount == -1)
{
game.getCamera().Zoom(-Constants.CAMERA_ZOOM_SPEED);
} else
{
game.getCamera().Zoom(Constants.CAMERA_ZOOM_SPEED);
}
return false;
}
}
| [
"chatelain@intechinfo.fr"
] | chatelain@intechinfo.fr |
d9138b4b32a8033d02d59c5af3c66bbbdead20df | 267408dbb8cf439d48ed60614b5a69196eab3fba | /CadastroFuncionario/src/main/java/br/com/cadastro/domain/Cargo.java | aeaf1283c29f8b5f4cdefa0e9ba487444ee452ce | [] | no_license | jbwinchesterjw/CadastroFuncionarios | ad27a5696df829991e2011e6736f4ac35cf4b66b | 1e56e5efc6d523a26c2c1713c1a04a81c6c8ca59 | refs/heads/main | 2023-06-01T05:40:20.573113 | 2021-06-23T00:27:10 | 2021-06-23T00:27:10 | 379,433,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,428 | java | package br.com.cadastro.domain;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@SuppressWarnings("serial")
@Entity
@Table(name = "CARGOS")
public class Cargo extends AbstractEntity<Long> {
@NotBlank(message = "O nome do cargo é obrigatório.")
@Size(max = 60, message = "O nome do cargo deve conter no máximo 60 caracteres.")
@Column(name = "nome", nullable = false, unique = true, length = 60)
private String nome;
@NotNull(message = "Selecione o departamento relativo ao cargo.")
@ManyToOne
@JoinColumn(name = "id_departamento_fk")
private Departamento departamento;
@OneToMany(mappedBy = "cargo")
private List<Funcionario> funcionarios;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public Departamento getDepartamento() {
return departamento;
}
public void setDepartamento(Departamento departamento) {
this.departamento = departamento;
}
public List<Funcionario> getFuncionarios() {
return funcionarios;
}
public void setFuncionarios(List<Funcionario> funcionarios) {
this.funcionarios = funcionarios;
}
}
| [
"jbwincheaster@gmail.com"
] | jbwincheaster@gmail.com |
a38ff2d5a3faa7562854bcbdab72c88ebf7c427f | 7a7f3f22c4ea6fbe57ee8af2062233af56285f5d | /src/main/java/it/academy/project/projectonspring/repository/CourseRepository.java | 61bfe09d83e79712231deed3574f28b02110262f | [] | no_license | Rauan020302/FinalProjectOnSpring | 2d6f5b8aeea96fa605e096aacd2d36aa21adf089 | dc3c145e59a1e11156fa6c2d8a82c64bca7b845c | refs/heads/main | 2023-06-17T12:42:28.593217 | 2021-07-07T11:55:50 | 2021-07-07T11:55:50 | 369,592,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package it.academy.project.projectonspring.repository;
import it.academy.project.projectonspring.entity.Course;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface CourseRepository extends JpaRepository<Course,Long> {
}
| [
"ibragimov020302@gmail.com"
] | ibragimov020302@gmail.com |
3e4aadd12f327a70b7c618cdcdd23b909b7ec356 | 2a3f19a4a2b91d9d715378aadb0b1557997ffafe | /sources/com/newrelic/agent/android/instrumentation/okhttp2/CallbackExtension.java | d66652eb94161d2b5e02aa329ddc54fd72d41e03 | [] | no_license | amelieko/McDonalds-java | ce5062f863f7f1cbe2677938a67db940c379d0a9 | 2fe00d672caaa7b97c4ff3acdb0e1678669b0300 | refs/heads/master | 2022-01-09T22:10:40.360630 | 2019-04-21T14:47:20 | 2019-04-21T14:47:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,468 | java | package com.newrelic.agent.android.instrumentation.okhttp2;
import com.newrelic.agent.android.TaskQueue;
import com.newrelic.agent.android.api.common.TransactionData;
import com.newrelic.agent.android.instrumentation.TransactionState;
import com.newrelic.agent.android.instrumentation.TransactionStateUtil;
import com.newrelic.agent.android.logging.AgentLog;
import com.newrelic.agent.android.logging.AgentLogManager;
import com.newrelic.agent.android.measurement.http.HttpTransactionMeasurement;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;
import java.io.IOException;
public class CallbackExtension implements Callback {
private static final AgentLog log = AgentLogManager.getAgentLog();
private Callback impl;
private TransactionState transactionState;
public CallbackExtension(Callback impl, TransactionState transactionState) {
this.impl = impl;
this.transactionState = transactionState;
}
public void onFailure(Request request, IOException e) {
error(e);
this.impl.onFailure(request, e);
}
public void onResponse(Response response) throws IOException {
this.impl.onResponse(checkResponse(response));
}
private Response checkResponse(Response response) {
if (getTransactionState().isComplete()) {
return response;
}
log.verbose("CallbackExtension.checkResponse() - transaction is not complete. Inspecting and instrumenting response.");
return OkHttp2TransactionStateUtil.inspectAndInstrumentResponse(getTransactionState(), response);
}
private TransactionState getTransactionState() {
return this.transactionState;
}
private void error(Exception e) {
TransactionState transactionState = getTransactionState();
TransactionStateUtil.setErrorCodeFromException(transactionState, e);
if (!transactionState.isComplete()) {
TransactionData transactionData = transactionState.end();
if (transactionData != null) {
TaskQueue.queue(new HttpTransactionMeasurement(transactionData.getUrl(), transactionData.getHttpMethod(), transactionData.getStatusCode(), transactionData.getErrorCode(), transactionData.getTimestamp(), (double) transactionData.getTime(), transactionData.getBytesSent(), transactionData.getBytesReceived(), transactionData.getAppData()));
}
}
}
}
| [
"makfc1234@gmail.com"
] | makfc1234@gmail.com |
a44372fe4b21292a417f58bf2360a45f3fefc828 | 074a12d70f3b8cc5d490b168358dfabc95ece3d0 | /artemis-weaver/src/main/java/com/artemis/weaver/packed/FieldToStructMethodTransformer.java | 451f92de5a5d032061ff5d66081747d87b3dbdae | [
"Apache-2.0"
] | permissive | pakoito/artemis-odb | 8ad351b45458e754e25da93d5e829f371236cad2 | 42fd1f279dc95da775d1bba8d64bd8a2ce70bccf | refs/heads/master | 2021-01-25T00:29:29.408053 | 2014-07-17T11:01:19 | 2014-07-17T11:01:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,278 | java | package com.artemis.weaver.packed;
import static com.artemis.weaver.packed.InstructionMutator.on;
import java.util.List;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.InsnList;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.IntInsnNode;
import org.objectweb.asm.tree.MethodNode;
import com.artemis.meta.ClassMetadata;
import com.artemis.meta.ClassMetadataUtil;
import com.artemis.meta.FieldDescriptor;
import com.artemis.transformer.MethodTransformer;
public class FieldToStructMethodTransformer extends MethodTransformer implements Opcodes {
private final ClassMetadata meta;
private final String fieldDesc;
private static final String BYTEBUFFER_DESC = "Ljava/nio/ByteBuffer;";
private static final boolean LOG = false;
public FieldToStructMethodTransformer(MethodTransformer mt, ClassMetadata meta, FieldDescriptor f) {
super(mt);
this.meta = meta;
fieldDesc = f.desc;
}
@Override
public boolean transform(MethodNode mn) {
InsnList instructions = mn.instructions;
String owner = meta.type.getInternalName();
if (LOG) System.out.println("OWNER: " + owner + " " + mn.name);
ByteBufferHelper bufferHelper = new ByteBufferHelper(meta);
boolean shouldDoSetter = true;
for (int i = 0; instructions.size() > i; i++) {
AbstractInsnNode node = instructions.get(i);
switch(node.getType()) {
case AbstractInsnNode.FIELD_INSN:
FieldInsnNode f = (FieldInsnNode)node;
if (shouldDoSetter && isSettingFieldWithPrimitive(f)) {
if (LOG) System.out.println(">> SETTING FIELD index=" + i);
i = on(instructions, f)
.insertAtOffset(2,
new FieldInsnNode(GETSTATIC, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(1,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD))
.insertAtOffset(0,
bufferHelper.invokePutter(f.name),
new InsnNode(POP))
.delete(0)
.transform();
} else if (!shouldDoSetter && isSettingFieldWithPrimitive(f)) {
if (LOG) System.out.println(">> SETTING FIELD index=" + i);
i = on(instructions, f)
.insertAtOffset(0,
bufferHelper.invokePutter(f.name),
new InsnNode(POP))
.delete(0)
.transform();
} else if (isSettingFieldWithObject(f)) {
if (LOG) System.out.println(">> SETTING FIELD FROM OBJECT index=" + i);
i = on(instructions, f)
.insertAtOffset(3,
new FieldInsnNode(GETSTATIC, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(2,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD))
.insertAtOffset(0,
bufferHelper.invokePutter(f.name),
new InsnNode(POP))
.delete(0)
.transform();
} else if (isModifyingFieldWithObject(f)) {
if (LOG) System.out.println(">> SETTING-MODIFYING FIELD FROM OBJECT index=" + i);
i = on(instructions, f)
.insertAtOffset(6,
new FieldInsnNode(GETSTATIC, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(5,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD),
new InsnNode(DUP2),
bufferHelper.invokeGetter(f.name))
.insertAtOffset(0,
bufferHelper.invokePutter(f.name),
new InsnNode(POP))
.delete(5)
.delete(4)
.delete(0)
.transform();
} else if (isLoadingFromField(f)) {
if (LOG) System.out.println("<< LOAD FIELD index=" + i);
i = on(instructions, f)
.insertAtOffset(2,
new FieldInsnNode(GETSTATIC, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(0,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD),
new InsnNode(DUP2),
bufferHelper.invokeGetter(f.name))
.delete(1)
.delete(0)
.transform();
shouldDoSetter = false;
} else if (isGettingField(f)) {
if (LOG) System.out.println("<< GETTING FIELD index=" + i);
i = on(instructions, f)
.insertAtOffset(1,
new FieldInsnNode(GETSTATIC, owner, "$data", BYTEBUFFER_DESC))
.insertAtOffset(0,
new FieldInsnNode(GETFIELD, owner, "$stride", "I"),
fieldOffsetInstruction(f.name),
new InsnNode(IADD),
bufferHelper.invokeGetter(f.name))
.delete(0)
.transform();
}
if (LOG) System.out.println("\tindex=" + i);
break;
default:
break;
}
}
return super.transform(mn);
}
private boolean isSettingFieldWithPrimitive(FieldInsnNode f) {
return PUTFIELD == f.getOpcode() &&
f.owner.equals(meta.type.getInternalName()) &&
f.desc.equals(fieldDesc) &&
hasInstanceField(meta, f.name) &&
!isObjectAccess(f.getPrevious()) &&
!isObjectAccess(f.getPrevious().getPrevious());
}
private boolean isSettingFieldWithObject(FieldInsnNode f) {
return PUTFIELD == f.getOpcode() &&
isObjectAccess(f.getPrevious()) &&
f.owner.equals(meta.type.getInternalName()) &&
f.desc.equals(fieldDesc) &&
hasInstanceField(meta, f.name);
}
private boolean isModifyingFieldWithObject(FieldInsnNode f) {
return PUTFIELD == f.getOpcode() &&
isObjectAccess(f.getPrevious().getPrevious()) &&
f.owner.equals(meta.type.getInternalName()) &&
f.desc.equals(fieldDesc) &&
hasInstanceField(meta, f.name);
}
private boolean isLoadingFromField(FieldInsnNode f) {
return GETFIELD == f.getOpcode() &&
DUP == f.getPrevious().getOpcode() &&
!isObjectAccess(f.getNext().getNext()) &&
f.owner.equals(meta.type.getInternalName()) &&
f.desc.equals(fieldDesc) &&
hasInstanceField(meta, f.name);
}
private boolean isGettingField(FieldInsnNode f) {
return GETFIELD == f.getOpcode() &&
DUP != f.getPrevious().getOpcode() &&
f.owner.equals(meta.type.getInternalName()) &&
f.desc.equals(fieldDesc) &&
hasInstanceField(meta, f.name);
}
private static boolean hasInstanceField(ClassMetadata meta, String fieldName) {
for (FieldDescriptor f : ClassMetadataUtil.instanceFields(meta)) {
if (f.name.equals(fieldName))
return true;
}
return false;
}
private boolean isObjectAccess(AbstractInsnNode n) {
if (n == null) return false;
int opcode = n.getOpcode();
return
opcode == INVOKESPECIAL ||
opcode == INVOKEVIRTUAL ||
opcode == INVOKEINTERFACE ||
(opcode == GETFIELD && !((FieldInsnNode)n).owner.equals(meta.type.getInternalName()));
}
private AbstractInsnNode fieldOffsetInstruction(String name) {
int offset = offset(name);
if (offset <= 5)
return new InsnNode(ICONST_0 + offset);
else if (offset <= 0xff)
return new IntInsnNode(BIPUSH, offset);
else
return new IntInsnNode(SIPUSH, offset);
}
private int offset(String name) {
List<FieldDescriptor> fields = meta.fields;
int offset = 0;
for (int i = 0; fields.size() > i; i++) {
FieldDescriptor fd = fields.get(i);
if (fd.name.equals(name))
break;
offset += ClassMetadataUtil.sizeOf(fd);
}
return offset;
}
}
| [
"blackrax@gmail.com"
] | blackrax@gmail.com |
9395e69c31ef3e3bbf7c44a4687aec971fa3675b | 89eb3c078aec72d8e7cd1208830656d30c4ad9ef | /src/main/java/domain/com/library/domain/Toy.java | 15281011519416e97a3c40235bbaa684908aefca | [] | no_license | xiaobinbupt/library | 355605dc3112806ad16977a40331a498ed601dcb | 42722962c08ce5e5b5853334aa6defe9eaeeaea7 | refs/heads/master | 2020-03-30T23:38:02.444451 | 2015-06-10T10:05:18 | 2015-06-10T10:05:18 | 23,606,095 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,458 | java | package com.library.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "toy")
public class Toy implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private long id;
private String name;
private String isdn;
private String img;
private String info_img1;
private String info_img2;
private String info_img3;
private String info_img4;
private String info_img5;
private String des;
private float price;
private int stock;
@Column(name = "price")
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column(name = "name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column(name = "isdn")
public String getIsdn() {
return isdn;
}
public void setIsdn(String isdn) {
this.isdn = isdn;
}
@Column(name = "img")
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
@Column(name = "info_img1")
public String getInfo_img1() {
return info_img1;
}
public void setInfo_img1(String info_img1) {
this.info_img1 = info_img1;
}
@Column(name = "info_img2")
public String getInfo_img2() {
return info_img2;
}
public void setInfo_img2(String info_img2) {
this.info_img2 = info_img2;
}
@Column(name = "info_img3")
public String getInfo_img3() {
return info_img3;
}
public void setInfo_img3(String info_img3) {
this.info_img3 = info_img3;
}
@Column(name = "info_img4")
public String getInfo_img4() {
return info_img4;
}
public void setInfo_img4(String info_img4) {
this.info_img4 = info_img4;
}
@Column(name = "info_img5")
public String getInfo_img5() {
return info_img5;
}
public void setInfo_img5(String info_img5) {
this.info_img5 = info_img5;
}
@Column(name = "des")
public String getDes() {
return des;
}
public void setDes(String des) {
this.des = des;
}
@Column(name = "stock")
public int getStock() {
return stock;
}
public void setStock(int stock) {
this.stock = stock;
}
}
| [
"xiaobin@xiaobin.com"
] | xiaobin@xiaobin.com |
83871f7a6a10b7925a34ca3394fa13501c9058df | fb1f96e131ce606404c69972db07297ed81c400e | /src/main/java/com/filmer/service/IPeliculasService.java | 7341a8566ba87a98bea698db63a81b3eb898e312 | [] | no_license | JandroCode/filmerApp | f5864a480eef19255ec97df89a2bcbb25e09eccf | cee4cc769d84789e353df390c544e245f5f37e1f | refs/heads/main | 2023-05-22T03:32:27.653433 | 2021-06-14T12:45:43 | 2021-06-14T12:45:43 | 376,559,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package com.filmer.service;
import java.util.List;
import com.filmer.entities.Pelicula;
public interface IPeliculasService {
void save(Pelicula pelicula);
List<Pelicula> listadoPeliculas();
Pelicula peliculaPorId(Long id);
void eliminarPelicula(Long id);
Pelicula peliPorTitulo(String titulo);
}
| [
"Algarrobeando@hotmail.com"
] | Algarrobeando@hotmail.com |
f0bc8271715e9c9868cb59926af120d0ca2c018a | 5d00b27e4022698c2dc56ebbc63263f3c44eea83 | /src/com/ah/apiengine/response/QueryVhmMovingStatusResponse.java | 4f86e3581fd5dbe7af28a9ac22289f7aadba4d66 | [] | no_license | Aliing/WindManager | ac5b8927124f992e5736e34b1b5ebb4df566770a | f66959dcaecd74696ae8bc764371c9a2aa421f42 | refs/heads/master | 2020-12-27T23:57:43.988113 | 2014-07-28T17:58:46 | 2014-07-28T17:58:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,261 | java | package com.ah.apiengine.response;
import java.nio.ByteBuffer;
import java.util.Collection;
import com.ah.apiengine.AbstractResponse;
import com.ah.apiengine.Element;
import com.ah.apiengine.EncodeException;
import com.ah.apiengine.agent.HmApiEngineMastAgent;
import com.ah.apiengine.agent.HmApiEngineMastAgentImpl;
import com.ah.apiengine.agent.subagent.CommonAgent;
import com.ah.apiengine.element.ExecutionResult;
import com.ah.apiengine.element.MvResponseInfo;
import com.ah.apiengine.element.VhmMovingStatusElement;
import com.ah.apiengine.request.QueryVhmMovingStatusRequest;
import com.ah.be.common.NmsUtil;
import com.ah.util.Tracer;
public class QueryVhmMovingStatusResponse extends AbstractResponse<QueryVhmMovingStatusRequest> {
private static final long serialVersionUID = 1L;
private static final Tracer log = new Tracer(QueryVhmMovingStatusResponse.class);
private VhmMovingStatusElement vhmMovingStatus;
public VhmMovingStatusElement getVhmMovingStatus() {
return vhmMovingStatus;
}
public void setVhmMovingStatus(VhmMovingStatusElement vhmMovingStatus) {
this.vhmMovingStatus = vhmMovingStatus;
}
/* Execution Result */
private ExecutionResult executionResult;
public ExecutionResult getExecutionResult() {
return executionResult;
}
@Override
public String getMsgName() {
return "Query VHM moving status response";
}
@Override
public int getMsgType() {
return QUERY_VHM_MOVING_STATUS_RESPONSE;
}
@Override
public void setElements(Collection<Element> elements) {
}
@Override
public ByteBuffer build(QueryVhmMovingStatusRequest request) throws EncodeException {
boolean isSucc = false;
String failureReason;
Collection<MvResponseInfo> result = null;
// Check session validity.
boolean validSess = request.checkValidity();
if (validSess) {
// Check HHM working status
boolean serviced = NmsUtil.isHmInService();
if (serviced) {
String flag = request.getApiString().getStr();
if (flag.equals(QueryVhmMovingStatusRequest.CLEAR_STATUS)) {
Object[] objs = clearStatus();
isSucc = (Boolean) objs[0];
failureReason = (String) objs[1];
} else {
Object[] objs = queryStatus();
isSucc = (Boolean) objs[0];
failureReason = (String) objs[1];
result = (Collection<MvResponseInfo>) objs[2];
}
} else {
failureReason = "HHM is out of service currently.";
}
} else {
failureReason = "Session must have expired.";
}
if (!isSucc) {
log.error("build", failureReason);
}
ByteBuffer respBB = super.build(request);
/* Header */
int headerLen = encodeHeader(respBB);
/* Execution Result */
executionResult = new ExecutionResult(true, isSucc, failureReason);
int erElemLen = executionResult.encode(respBB);
if (result != null) {
vhmMovingStatus = new VhmMovingStatusElement();
vhmMovingStatus.setVhmMovingInfos(result);
erElemLen += vhmMovingStatus.encode(respBB);
}
/* Message Elements Length */
fillPendingElementsLength(respBB, headerLen, erElemLen);
return respBB;
}
private Object[] queryStatus() {
boolean isSucc = false;
String failureReason = "";
Collection<MvResponseInfo> result = null;
try {
HmApiEngineMastAgent mastAgent = HmApiEngineMastAgentImpl.getInstance();
CommonAgent agent = mastAgent.getCommonAgent();
result = agent.doQueryVhmMovingStatus();
isSucc = true;
} catch (Exception e) {
log.error("executeRequest", "Failed to call doQueryVhmMovingStatus", e);
failureReason = e.getMessage();
}
return new Object[] { isSucc, failureReason, result };
}
private Object[] clearStatus() {
boolean isSucc = false;
String failureReason = "";
Collection<MvResponseInfo> result = null;
try {
HmApiEngineMastAgent mastAgent = HmApiEngineMastAgentImpl.getInstance();
CommonAgent agent = mastAgent.getCommonAgent();
agent.doClearVhmMovingStatus();
isSucc = true;
} catch (Exception e) {
log.error("executeRequest", "Failed to call doClearVhmMovingStatus", e);
failureReason = e.getMessage();
}
return new Object[] { isSucc, failureReason, result };
}
}
| [
"zjie@aerohive.com"
] | zjie@aerohive.com |
98990a8d0dd326b8737004ed5e64ea29215be14f | 484c7ae73cfa0aa8263fdd484236c2fe91d3ac4a | /spring-context-xml/src/main/java/com/github/wesleyegberto/springcontextxml/model/Customer.java | 8d628afde37532da1fa476b9098bee2f5d135dd9 | [
"MIT"
] | permissive | wesleyegberto/spring-study | 07e25737e75823d1da5880d391774109fbb0775f | 1714fad96d45f6aada2fd1c95ccf9a1fb5c6c83c | refs/heads/master | 2022-12-25T11:00:21.153544 | 2022-11-26T20:13:27 | 2022-11-26T20:13:33 | 131,788,908 | 5 | 3 | MIT | 2022-12-16T03:01:15 | 2018-05-02T02:42:45 | Java | UTF-8 | Java | false | false | 327 | java | package com.github.wesleyegberto.springcontextxml.model;
public class Customer {
private Long id;
private String name;
public Customer() {
}
public Customer(Long id, String name) {
super();
this.id = id;
this.name = name;
}
public Long getId() {
return id;
}
public String getName() {
return name;
}
}
| [
"wesleyegberto@gmail.com"
] | wesleyegberto@gmail.com |
c2e7dcbea471dfe59d556578c174d7037e6d440f | e05f43dcdf1cc0dd2e2627283574e4a8345ee446 | /FCB_DAO/src/test/java/com/fcb/dao/EducationDetailsDAOImpl.java | 0b9349269e7c5cdfe3850f30dffd2e61ea87868a | [] | no_license | kaushalkbca15/SpringJDBC | a466db3bd3947e6f9a98e08b365160dcb826a6bf | fe242615dab6612c59b2c7c039ca56bf5849f2bc | refs/heads/master | 2021-05-02T03:51:58.271456 | 2018-02-09T13:47:15 | 2018-02-09T13:47:15 | 120,865,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 595 | java | /*
* Copyright (c) 2017, 2018, FCBDM and/or its affiliates. All rights reserved.
* FCBDM PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package com.fcb.dao;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
/**
* This DAO is used to perform persistence operations on EducationDetails Table
*
* @author sathish
* @since FCBDM 1.0
*/
@Repository
public class EducationDetailsDAOImpl implements EducationDetailsDAO {
@Autowired
private SessionFactory sessionFactory;
}
| [
"email@example.com"
] | email@example.com |
0dadffa26586b65c925b9b174152bcc7c7d65257 | 385ad4174af5b9f884d67a7467527c957162d1a0 | /src/main/java/com/catas/audit/common/Constant.java | ff7419ad38602e95fc0f993e1b29612b32c2a0fe | [] | no_license | Kili666/J-sparrow- | 105b540dbf9f9763c5eb8fe62c806ce1ea1e9896 | 88e4f782f1069240e0e8cf32b1a923dbaf0d9bc8 | refs/heads/main | 2023-06-29T17:40:27.168912 | 2021-08-06T13:05:01 | 2021-08-06T13:05:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,322 | java | package com.catas.audit.common;
public class Constant {
public static final Integer OK = 200;
public static final Integer ERROR = -1;
public static final Integer USER_ACTIVE = 1;
public static final Integer USER_LOCKED = 0;
public static final Integer USER_IS_ADMIN = 1;
public static final Integer AUTH_PASSWORD = 0;
public static final Integer AUTH_SSL = 1;
public static final String DEFAULT_PWS = "123456";
// ---------- glimmer ------------
public static final Integer EXEC_COMMAND_TASK = 0;
public static final Integer EXEC_SCP_TASK = 1;
public static final Integer TASK_STATUS_CLOSED = 0;
public static final Integer TASK_STATUS_RUNNING = 1;
public static final Integer TASK_STATUS_PAUSED = 2;
public static final Integer TASK_STATUS_FAILED = 3;
public static final Integer PLAN_STATUS_CLOSED = 0;
public static final Integer PLAN_STATUS_RUNNING = 1;
public static final Integer PLAN_STATUS_PAUSED = 2;
public static final Integer PLAN_STATUS_FAILED = 3;
public static final Integer MULTI_TASK_CMD = 0;
public static final Integer MULTI_TASK_SCP = 1;
public static final Integer MULTI_TASK_RUNNING = 0;
public static final Integer MULTI_TASK_SUCCESS = 1;
public static final Integer MULTI_TASK_FAILED = 2;
}
| [
"1014518525@qq.com"
] | 1014518525@qq.com |
c30e2858310ff2db6ce9eebe18fd2f0462d42eb8 | f5d8030a075f9ac859ac6c4f6b050753be65bdcd | /src/main/java/org/libermundi/theorcs/services/impl/StringFormatServiceImpl.java | fd4a1ffe970dc6b1f883d3e5768019f76812b1cd | [
"Apache-2.0"
] | permissive | kheldar666/theorcs | 413de1383ee6eca2051318057b868e3c2d418ece | 77ddc219c45c73b094302c7832af66a65de5db7c | refs/heads/master | 2021-08-28T01:44:37.582374 | 2018-02-22T02:25:17 | 2018-02-22T02:25:17 | 73,893,726 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,991 | java | package org.libermundi.theorcs.services.impl;
import org.libermundi.theorcs.services.StringFormatService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@Service("StringFormatService")
public class StringFormatServiceImpl implements StringFormatService {
private static final long A_DAY_IN_MILLISECONDS = 24*60*60*1000;
private final SimpleDateFormat dateFormat;
private final SimpleDateFormat timeFormat;
private final MessageSource messageSource;
public StringFormatServiceImpl(@Value("${theorcs.general.dateformat}") String dateformat,
@Value("${theorcs.general.timeformat}") String timeformat,
MessageSource messageSource) {
this.dateFormat = new SimpleDateFormat(dateformat);
this.timeFormat = new SimpleDateFormat(timeformat);
this.messageSource = messageSource;
}
@Override
public String formatDate(Date date) {
return dateFormat.format(date);
}
@Override
public String formatTime(Date date) {
return timeFormat.format(date);
}
@Override
public String formatDateForMessaging(Date date) {
Locale locale = LocaleContextHolder.getLocale();
Date now = new Date();
long dateDiff = now.getTime() - date.getTime();
if(dateDiff > A_DAY_IN_MILLISECONDS) {
Object[] args = {formatDate(date),formatTime(date)};
return messageSource.getMessage("components.messaging.date_sent",args,null,locale);
} else {
Object[] args = {formatTime(date)};
return messageSource.getMessage("components.messaging.time_sent",args,null,locale);
}
}
}
| [
"martin.papy@gmail.com"
] | martin.papy@gmail.com |
cb405a3191714a92609edbb58919fb86e2316f56 | 20a3b8a9097fe2fab52751d458e5e0f951ec9fd4 | /src/lessons/Employee.java | bb635d677ddc0c31f13673dec39d83224dc09402 | [] | no_license | RomaBlaSo/StudyJOOP_ACO10 | 12ecaf79d95df15e7f322cef95c58bbd1d30875d | 8671f4553c79cf25b8e1ee28a41165f0c4f68972 | refs/heads/master | 2021-01-10T15:29:04.741988 | 2016-01-23T13:40:08 | 2016-01-23T13:40:08 | 47,500,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package lessons;
public class Employee {
private String name;
private int age;
private int salary;
public Employee(){}
public Employee(String name, int age, int salary){
this.name = name;
this.age = age;
this.salary = salary;
}
public void doCoffee(){
System.out.println();
}
public String toString(){
return String.format("My name is %s, i'm %d", name, age);
}
}
| [
"voloshyn.roman@gmail.com"
] | voloshyn.roman@gmail.com |
49cb1c94bcd53020361044b7197abebff8026cda | 4f41aa43a58148bff6e1b9a7786b4a892cc318ff | /src/test/java/com/diffplug/gradle/eclipse/MavenCentralPluginTest.java | a41b79e4d75f561c32c2cbe14cf5a6fdbdf14c70 | [
"Apache-2.0"
] | permissive | gkgeorgiev/goomph | bba51779688ad843d809649a7e035d18f747ee0c | 1b09ca0cc814f074e7421eb1174758616a4461ab | refs/heads/master | 2023-08-04T01:58:01.030857 | 2020-06-15T22:57:49 | 2020-06-15T22:57:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,180 | java | /*
* Copyright 2020 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.diffplug.gradle.eclipse;
import com.diffplug.gradle.GradleIntegrationTest;
import java.io.IOException;
import org.junit.Test;
public class MavenCentralPluginTest extends GradleIntegrationTest {
@Test
public void test() throws IOException {
write("build.gradle",
"plugins {",
" id 'com.diffplug.eclipse.mavencentral'",
"}",
"eclipseMavenCentral {",
" release '4.7.0', {",
" compile 'org.eclipse.equinox.common'",
" }",
"}",
"apply plugin: 'java'");
gradleRunner().withArguments("jar", "--stacktrace").build();
}
}
| [
"ned.twigg@diffplug.com"
] | ned.twigg@diffplug.com |
5412cf82e765d920ca29fb696c967e9722cf039d | 74a81b5cd2deb0f77c818fdecc28d525b19e2ed8 | /src/Cat/Cat.java | 32135bee7311e302b6129ccbd19c5639e0876866 | [] | no_license | flussigkatz/Education | 34a28cc7088308af43a45d887e7d0a47e4ec9656 | 825f62f8f4c80ae00a181d8494a92db97440aaa5 | refs/heads/master | 2023-03-25T22:46:46.441146 | 2021-03-27T13:58:09 | 2021-03-27T13:58:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,459 | java | package Cat;
public class Cat {
private double weight;
private String name;
private int age;
private String color;
public static int catCount;
//Конструктор по умолчанию
public Cat() {
this(3000, "Barsik", 1, "Grey");
}
//Конструктор, принимающий параметры
public Cat(double weight, String name, int age, String color) {
this.weight = weight;
this.name = name;
this.age = age;
this.color = color;
catCount++; //Увеличиваем счётчик кошек
}
public void feed(double foodAmount) {
if(foodAmount < 1000) {
System.out.println("Кошку покормили! Она довольна!");
} else {
System.out.println("Кошку перекормили и она лопнула.");
catCount--;
}
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
} | [
"flussigkatz@gmail.com"
] | flussigkatz@gmail.com |
0a86e4441e94754b696f83151995917cab429934 | c247985454f83a5ea73c5b49a7f31d52e28716dc | /src/main/java/pl/grizwold/ugamela/page/ResourcePanel.java | 3e821b6201713e942971ca012187e006d0db3f5a | [
"MIT"
] | permissive | tomekbielaszewski/ugamela-automation | e52c56e8bce23c82d48e608eaf0cbda453ef481b | 5fc1a9f8dc1314a6605b965fc91b06e421bd75e7 | refs/heads/master | 2022-09-23T10:07:08.429463 | 2022-08-29T11:55:35 | 2022-08-29T11:55:35 | 164,703,098 | 0 | 0 | null | 2019-01-08T21:06:06 | 2019-01-08T17:48:50 | Java | UTF-8 | Java | false | false | 1,831 | java | package pl.grizwold.ugamela.page;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import pl.grizwold.ugamela.UgamelaSession;
import pl.grizwold.ugamela.page.model.Resources;
import java.util.Scanner;
public class ResourcePanel extends Page {
public ResourcePanel(UgamelaSession session) {
super(session);
}
public Resources availableResources() {
return new Resources(
metal(),
crystal(),
deuterium()
);
}
public Resources capacity() {
return new Resources(
metalCapacity(),
crystalCapacity(),
deuteriumCapacity()
);
}
public long metal() {
return getResource("metal");
}
public long crystal() {
return getResource("crystal");
}
public long deuterium() {
return getResource("deut");
}
public long metalCapacity() {
return getResource("metalmax");
}
public long crystalCapacity() {
return getResource("crystalmax");
}
public long deuteriumCapacity() {
return getResource("deuteriummax");
}
private Long getResource(String resourceId) {
return $().findElements(By.id(resourceId)).stream()
.findFirst()
.map(WebElement::getText)
.map(this::toNumber)
.orElse(0L);
}
private Long toNumber(String text) {
String formatted = text.replaceAll("\\.", "")
.replaceAll("\\(-", "")
.replaceAll("\\)", "");
Scanner scanner = new Scanner(formatted);
if (scanner.hasNextLong())
return scanner.nextLong();
throw new IllegalStateException("Cannot convert " + text + " to resource amount");
}
}
| [
"tomekbielaszewski@gmail.com"
] | tomekbielaszewski@gmail.com |
58056043f5720794b25090d65051654c4f6d9e17 | 7951b011669b2347cad79d74811df5c0e7f812e4 | /VladDziubko/src/week1/dynamicArray/Run.java | f6aa531e542aaa7424e84d45b32549cf7e3b6c7b | [] | no_license | gorobec/ACO18TeamProject | 77c18e12cefb4eda3186dc6f7b84aed14040a691 | ae48c849915c8cb41aab637d001d2b492cc53432 | refs/heads/master | 2021-01-11T15:20:56.092695 | 2017-02-18T14:22:11 | 2017-02-18T14:22:11 | 80,338,687 | 1 | 1 | null | 2017-02-22T20:10:45 | 2017-01-29T09:48:23 | Java | UTF-8 | Java | false | false | 457 | java | package week1.dynamicArray;
public class Run {
public static void main(String[] args) {
NewArrayList<String> list = new NewArrayList<>();
list.add("cat");
list.add(1, "dog");
System.out.println(list.size());
list.remove(0);
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i));
}
System.out.println();
System.out.println(list.get(0));
}
}
| [
"777reed777@gmail.com"
] | 777reed777@gmail.com |
04eb66763ffed6e167000c89a964f47b4def6472 | f9a574454f39e022121ac8ddd01ad5d3f6cda4d8 | /src/main/java/com/wance/entity/Animal.java | 69c7dbfe9238cd0bcd7facfbbb36294bad077660 | [] | no_license | 1569185189/gittest | 7a940c9fbba64392aaf13ececdb1b70005a74545 | 763f4f39c71d3e544f0e2f4a48cf7888477bc57b | refs/heads/master | 2022-12-21T03:47:29.950572 | 2020-09-15T09:41:36 | 2020-09-15T09:41:36 | 289,595,525 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,587 | java | package com.wance.entity;
public class Animal {
private int aid;
private String aname;
private String sex;
private int feetcount;
private Owner owner;
public Owner getOwner() {
return owner;
}
public void setOwner(Owner owner) {
this.owner = owner;
}
public Animal() {
}
public Animal(int aid, String aname, String sex, int feetcount) {
this.aid = aid;
this.aname = aname;
this.sex = sex;
this.feetcount = feetcount;
}
public Animal(int aid, String aname, String sex, int feetcount, Owner owner) {
this.aid = aid;
this.aname = aname;
this.sex = sex;
this.feetcount = feetcount;
this.owner = owner;
}
public int getAid() {
return aid;
}
public void setAid(int aid) {
this.aid = aid;
}
public String getAname() {
return aname;
}
public void setAname(String aname) {
this.aname = aname;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public int getFeetcount() {
return feetcount;
}
public void setFeetcount(int feetcount) {
this.feetcount = feetcount;
}
@Override
public String toString() {
return "Animal{" +
"aid=" + aid +
", aname='" + aname + '\'' +
", sex='" + sex + '\'' +
", feetcount=" + feetcount +
", owner=" + owner +
'}';
}
}
| [
"1569185189@qq.com"
] | 1569185189@qq.com |
3a03bad9b235fd6e97c30e7cb5cee1d2ef726dad | e451bd84f3b251c6ccbd9ec4dfe6bf952d34390a | /src/main/java/uk/org/glendale/worldgen/astro/planets/generators/jovian/Sokarian.java | 3351bf087d65577220d31c085c58d5715a058f95 | [
"BSD-2-Clause"
] | permissive | samuelpenn/worldgen | 1fe618eae5dd6a05d99a1577e9659f549451a8b5 | c97a6d0a9cee42f6cae108e5b13704b974d1b23f | refs/heads/master | 2018-09-01T02:14:57.225507 | 2018-06-03T21:32:17 | 2018-06-03T21:32:17 | 117,744,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,659 | java | /*
* Copyright (c) 2017, Samuel Penn (sam@glendale.org.uk).
* See the file LICENSE at the root of the project.
*/
package uk.org.glendale.worldgen.astro.planets.generators.jovian;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import uk.org.glendale.utils.rpg.Die;
import uk.org.glendale.worldgen.WorldGen;
import uk.org.glendale.worldgen.astro.planets.Planet;
import uk.org.glendale.worldgen.astro.planets.codes.*;
import uk.org.glendale.worldgen.astro.planets.generators.Jovian;
import uk.org.glendale.worldgen.astro.stars.Star;
import uk.org.glendale.worldgen.astro.systems.StarSystem;
import static uk.org.glendale.worldgen.astro.commodities.CommodityName.*;
import static uk.org.glendale.worldgen.astro.planets.generators.Jovian.JovianFeature.*;
import static uk.org.glendale.worldgen.astro.planets.generators.Jovian.JovianFeature.SilicateClouds;
/**
* Sokarian worlds of the SubJovian class of the Jovian group. They are very hot worlds, close
* to their star, often with silicate clouds (Sudarsky class V).
*/
public class Sokarian extends Jovian {
private static final Logger logger = LoggerFactory.getLogger(Sokarian.class);
public Sokarian(WorldGen worldgen, StarSystem system, Star star, Planet previous, long distance) {
super(worldgen, system, star, previous, distance);
}
private void generateFeatures(Planet planet) {
planet.addFeature(SilicateClouds);
}
public Planet getPlanet(String name, PlanetType type) {
Planet planet = definePlanet(name, type);
planet.setRadius(45000 + Die.die(5000, 4));
if (planet.getTemperature() < Temperature.SilicatesMelt.getKelvin()) {
planet.setTemperature(Temperature.SilicatesMelt.getKelvin());
}
planet.setAtmosphere(Atmosphere.Hydrogen);
planet.setPressure(Pressure.SuperDense);
switch (Die.d6(2)) {
case 2: case 3:
planet.setMagneticField(MagneticField.Standard);
break;
case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11:
planet.setMagneticField(MagneticField.Strong);
break;
case 12:
planet.setMagneticField(MagneticField.VeryStrong);
break;
}
// Set default day length to be around 10 hours.
planet.setDayLength(10 * 86400 + Die.die(3600, 2));
generateFeatures(planet);
addPrimaryResource(planet, Hydrogen);
addTertiaryResource(planet, Helium);
addTertiaryResource(planet, OrganicGases);
addTertiaryResource(planet, Water);
return planet;
}
}
| [
"sam@glendale.org.uk"
] | sam@glendale.org.uk |
589943000fa57bada7a0bac0be03bee31906b3bd | 20504a5958ca64284c5d7bd539426d5120227e43 | /src/main/java/com/intercorp/clientmanager/utils/StatisticsHelperMethods.java | cb0791346c5b3028029f657461d3794e77bdec6f | [] | no_license | patomezi/client-manager-intercorp | 42f4d7f8e3a5f84a5abcb63e6ca9f75e39b68f87 | 0047b3f01d7861ce2f7528fb04aec9515dba89e1 | refs/heads/master | 2022-12-09T14:20:18.639361 | 2020-09-19T17:29:44 | 2020-09-19T17:29:44 | 296,447,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 696 | java | package com.intercorp.clientmanager.utils;
import java.util.Collection;
public class StatisticsHelperMethods {
public static double calculateAverage(Collection<Integer> numbers) {
return numbers
.stream()
.mapToInt(Integer::intValue)
.average()
.orElse(0.0);
}
public static double calculateStandardDeviation(Collection<Integer> values) {
double average = calculateAverage(values);
double standardDeviation = 0.0;
for (double num : values) {
standardDeviation += Math.pow(num - average, 2);
}
return Math.sqrt(standardDeviation / values.size());
}
}
| [
"mmezi"
] | mmezi |
6c04150bf985dfb3bff5beb07e3c89ae5c35bbc0 | 75474a4d0a5351b0836b21648c51baaa10d437b7 | /src/test/Scalability/section1/JGFCreateBench.java | 58a80c077cdcf5abf8eb845c0c9051e1993d2a08 | [] | no_license | suncongxd/jMoped-Flow | 71fe1a9237e7a2dc995562a40a6b3af9fefc8794 | 520e9e48275718ac03404c50be0f6998747c86a2 | refs/heads/main | 2023-03-04T06:55:42.722403 | 2021-02-09T16:45:00 | 2021-02-09T16:45:00 | 337,446,495 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,481 | java | /**************************************************************************
* *
* Java Grande Forum Benchmark Suite - Version 2.0 *
* *
* produced by *
* *
* Java Grande Benchmarking Project *
* *
* at *
* *
* Edinburgh Parallel Computing Centre *
* *
* email: epcc-javagrande@epcc.ed.ac.uk *
* *
* Original version of this code by DHPC Group, Univ. of Adelaide *
* See copyright notice below. *
* *
* *
* This version copyright (c) The University of Edinburgh, 1999. *
* All rights reserved. *
* *
**************************************************************************/
/*
* Copyright (C) 1998, University of Adelaide, under its participation
* in the Advanced Computational Systems Cooperative Research Centre
* Agreement.
*
* THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND THE UNIVERSITY
* OF ADELAIDE DOES NOT MAKE ANY WARRANTY ABOUT THE SOFTWARE, ITS
* PERFORMANCE, ITS MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
* USE, FREEDOM FROM ANY COMPUTER DISEASES OR ITS CONFORMITY TO ANY
* SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND PERFORMANCE OF
* THE SOFTWARE IS WITH THE USER.
*
* Copyright of the software and supporting documentation is owned by the
* University of Adelaide, and free access is hereby granted as a license
* to use this software, copy this software and prepare derivative works
* based upon this software. However, any distribution of this software
* source code or supporting documentation or derivative works (source
* code and supporting documentation) must include this copyright notice
* and acknowledge the University of Adelaide.
*
*
* Developed by: Distributed High Performance Computing (DHPC) Group
* Department of Computer Science
* The University of Adelaide
* South Australia 5005
* Tel +61 8 8303 4519, Fax +61 8 8303 4366
* http://dhpc.adelaide.edu.au
* Last Modified: 26 January 1999
*/
package test.Scalability.section1;
import test.Scalability.jgfutil.*;
public class JGFCreateBench implements JGFSection1 {
private static final int INITSIZE = 10000;
private static final int MAXSIZE = 1000000000;
private static final double TARGETTIME = 10.0;
public void JGFrun(){
int i,size;
double time;
int j[];
long k[];
float c[];
Object d[];
A a; A1 a1; A2 a2; A4 a4; A4L a4l; A4F a4f;
AA aa; B b; AB ab; Object o; ABC abc;
int max=128;
int n=1;
// Create arrays of integers of varying sizes (1-128)
while(n<=max) {
JGFInstrumentor.addTimer("Section1:Create:Array:Int:"+n, "arrays");
time = 0.0;
size = INITSIZE;
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Array:Int:"+n);
JGFInstrumentor.startTimer("Section1:Create:Array:Int:"+n);
for (i=0;i<size;i++) {
j = new int[n]; j = new int[n]; j = new int[n]; j = new int[n];
j = new int[n]; j = new int[n]; j = new int[n]; j = new int[n];
j = new int[n]; j = new int[n]; j = new int[n]; j = new int[n];
j = new int[n]; j = new int[n]; j = new int[n]; j = new int[n];
}
JGFInstrumentor.stopTimer("Section1:Create:Array:Int:"+n);
time = JGFInstrumentor.readTimer("Section1:Create:Array:Int:"+n);
JGFInstrumentor.addOpsToTimer("Section1:Create:Array:Int:"+n, (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Array:Int:"+n);
System.gc(); // Reclaim memory
n*=2;
}
// Create arrays of long integers of varying sizes (1-128)
n=1;
while(n<=max) {
JGFInstrumentor.addTimer("Section1:Create:Array:Long:"+n, "arrays");
time = 0.0;
size = INITSIZE;
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Array:Long:"+n);
JGFInstrumentor.startTimer("Section1:Create:Array:Long:"+n);
for (i=0;i<size;i++) {
k = new long[n]; k = new long[n]; k = new long[n]; k = new long[n];
k = new long[n]; k = new long[n]; k = new long[n]; k = new long[n];
k = new long[n]; k = new long[n]; k = new long[n]; k = new long[n];
k = new long[n]; k = new long[n]; k = new long[n]; k = new long[n];
}
JGFInstrumentor.stopTimer("Section1:Create:Array:Long:"+n);
time = JGFInstrumentor.readTimer("Section1:Create:Array:Long:"+n);
JGFInstrumentor.addOpsToTimer("Section1:Create:Array:Long:"+n, (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Array:Long:"+n);
System.gc(); // Reclaim memory
n*=2;
}
// Create arrays of floats of varying sizes (1-128)
n=1;
while(n<=max) {
JGFInstrumentor.addTimer("Section1:Create:Array:Float:"+n, "arrays");
time = 0.0;
size = INITSIZE;
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Array:Float:"+n);
JGFInstrumentor.startTimer("Section1:Create:Array:Float:"+n);
for (i=0;i<size;i++) {
c = new float[n]; c = new float[n]; c = new float[n]; c = new float[n];
c = new float[n]; c = new float[n]; c = new float[n]; c = new float[n];
c = new float[n]; c = new float[n]; c = new float[n]; c = new float[n];
c = new float[n]; c = new float[n]; c = new float[n]; c = new float[n];
}
JGFInstrumentor.stopTimer("Section1:Create:Array:Float:"+n);
time = JGFInstrumentor.readTimer("Section1:Create:Array:Float:"+n);
JGFInstrumentor.addOpsToTimer("Section1:Create:Array:Float:"+n, (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Array:Float:"+n);
System.gc(); // Reclaim memory
n*=2;
}
// Create arrays of Objects of varying sizes (1-128)
n=1;
while(n<=max) {
JGFInstrumentor.addTimer("Section1:Create:Array:Object:"+n, "arrays");
time = 0.0;
size = INITSIZE;
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Array:Object:"+n);
JGFInstrumentor.startTimer("Section1:Create:Array:Object:"+n);
for (i=0;i<size;i++) {
d=new Object[n]; d=new Object[n]; d=new Object[n]; d=new Object[n];
d=new Object[n]; d=new Object[n]; d=new Object[n]; d=new Object[n];
d=new Object[n]; d=new Object[n]; d=new Object[n]; d=new Object[n];
d=new Object[n]; d=new Object[n]; d=new Object[n]; d=new Object[n];
}
JGFInstrumentor.stopTimer("Section1:Create:Array:Object:"+n);
time = JGFInstrumentor.readTimer("Section1:Create:Array:Object:"+n);
JGFInstrumentor.addOpsToTimer("Section1:Create:Array:Object:"+n, (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Array:Object:"+n);
System.gc(); // Reclaim memory
n*=2;
}
// Basic object
JGFInstrumentor.addTimer("Section1:Create:Object:Base", "objects");
time = 0.0;
size = INITSIZE;
o = new Object();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Base");
JGFInstrumentor.startTimer("Section1:Create:Object:Base");
for (i=0;i<size;i++) {
o = new Object(); o = new Object(); o = new Object(); o = new Object();
o = new Object(); o = new Object(); o = new Object(); o = new Object();
o = new Object(); o = new Object(); o = new Object(); o = new Object();
o = new Object(); o = new Object(); o = new Object(); o = new Object();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Base");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Base");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Base", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Base");
System.gc(); // Reclaim memory
// User defined object
JGFInstrumentor.addTimer("Section1:Create:Object:Simple", "objects");
time = 0.0;
size = INITSIZE;
a = new A();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Simple");
JGFInstrumentor.startTimer("Section1:Create:Object:Simple");
for (i=0;i<size;i++) {
a = new A(); a = new A(); a = new A(); a = new A();
a = new A(); a = new A(); a = new A(); a = new A();
a = new A(); a = new A(); a = new A(); a = new A();
a = new A(); a = new A(); a = new A(); a = new A();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Simple");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Simple");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Simple", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Simple");
System.gc(); // Reclaim memory
// User defined object with empty contructor
JGFInstrumentor.addTimer("Section1:Create:Object:Simple:Constructor", "objects");
time = 0.0;
size = INITSIZE;
aa = new AA();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Simple:Constructor");
JGFInstrumentor.startTimer("Section1:Create:Object:Simple:Constructor");
for (i=0;i<size;i++) {
aa = new AA(); aa = new AA(); aa = new AA(); aa = new AA();
aa = new AA(); aa = new AA(); aa = new AA(); aa = new AA();
aa = new AA(); aa = new AA(); aa = new AA(); aa = new AA();
aa = new AA(); aa = new AA(); aa = new AA(); aa = new AA();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Simple:Constructor");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Simple:Constructor");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Simple:Constructor", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Simple:Constructor");
System.gc(); // Reclaim memory
// User defined object with 1 integer field
JGFInstrumentor.addTimer("Section1:Create:Object:Simple:1Field", "objects");
time = 0.0;
size = INITSIZE;
a1 = new A1();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Simple:1Field");
JGFInstrumentor.startTimer("Section1:Create:Object:Simple:1Field");
for (i=0;i<size;i++) {
a1 = new A1(); a1 = new A1(); a1 = new A1(); a1 = new A1();
a1 = new A1(); a1 = new A1(); a1 = new A1(); a1 = new A1();
a1 = new A1(); a1 = new A1(); a1 = new A1(); a1 = new A1();
a1 = new A1(); a1 = new A1(); a1 = new A1(); a1 = new A1();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Simple:1Field");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Simple:1Field");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Simple:1Field", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Simple:1Field");
System.gc(); // Reclaim memory
// User defined object with 2 integer fields
JGFInstrumentor.addTimer("Section1:Create:Object:Simple:2Field", "objects");
time = 0.0;
size = INITSIZE;
a2 = new A2();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Simple:2Field");
JGFInstrumentor.startTimer("Section1:Create:Object:Simple:2Field");
for (i=0;i<size;i++) {
a2 = new A2(); a2 = new A2(); a2 = new A2(); a2 = new A2();
a2 = new A2(); a2 = new A2(); a2 = new A2(); a2 = new A2();
a2 = new A2(); a2 = new A2(); a2 = new A2(); a2 = new A2();
a2 = new A2(); a2 = new A2(); a2 = new A2(); a2 = new A2();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Simple:2Field");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Simple:2Field");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Simple:2Field", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Simple:2Field");
System.gc(); // Reclaim memory
// User defined object with 2 integer fields
JGFInstrumentor.addTimer("Section1:Create:Object:Simple:4Field", "objects");
time = 0.0;
size = INITSIZE;
a4 =new A4();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Simple:4Field");
JGFInstrumentor.startTimer("Section1:Create:Object:Simple:4Field");
for (i=0;i<size;i++) {
a4 = new A4(); a4 = new A4(); a4 = new A4(); a4 = new A4();
a4 = new A4(); a4 = new A4(); a4 = new A4(); a4 = new A4();
a4 = new A4(); a4 = new A4(); a4 = new A4(); a4 = new A4();
a4 = new A4(); a4 = new A4(); a4 = new A4(); a4 = new A4();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Simple:4Field");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Simple:4Field");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Simple:4Field", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Simple:4Field");
System.gc(); // Reclaim memory
// User defined object with 4 integer fields
JGFInstrumentor.addTimer("Section1:Create:Object:Simple:4fField", "objects");
time = 0.0;
size = INITSIZE;
a4f = new A4F();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Simple:4fField");
JGFInstrumentor.startTimer("Section1:Create:Object:Simple:4fField");
for (i=0;i<size;i++) {
a4f = new A4F(); a4f = new A4F(); a4f = new A4F(); a4f = new A4F();
a4f = new A4F(); a4f = new A4F(); a4f = new A4F(); a4f = new A4F();
a4f = new A4F(); a4f = new A4F(); a4f = new A4F(); a4f = new A4F();
a4f = new A4F(); a4f = new A4F(); a4f = new A4F(); a4f = new A4F();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Simple:4fField");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Simple:4fField");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Simple:4fField", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Simple:4fField");
System.gc(); // Reclaim memory
// User defined object with 4 long integer fields
JGFInstrumentor.addTimer("Section1:Create:Object:Simple:4LField", "objects");
time = 0.0;
size = INITSIZE;
a4l = new A4L();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Simple:4LField");
JGFInstrumentor.startTimer("Section1:Create:Object:Simple:4LField");
for (i=0;i<size;i++) {
a4l = new A4L(); a4l = new A4L(); a4l = new A4L(); a4l = new A4L();
a4l = new A4L(); a4l = new A4L(); a4l = new A4L(); a4l = new A4L();
a4l = new A4L(); a4l = new A4L(); a4l = new A4L(); a4l = new A4L();
a4l = new A4L(); a4l = new A4L(); a4l = new A4L(); a4l = new A4L();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Simple:4LField");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Simple:4LField");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Simple:4LField", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Simple:4LField");
System.gc(); // Reclaim memory
// User defined object that is a subclass
JGFInstrumentor.addTimer("Section1:Create:Object:Subclass", "objects");
time = 0.0;
size = INITSIZE;
b = new B();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Subclass");
JGFInstrumentor.startTimer("Section1:Create:Object:Subclass");
for (i=0;i<size;i++) {
b = new B(); b = new B(); b = new B(); b = new B();
b = new B(); b = new B(); b = new B(); b = new B();
b = new B(); b = new B(); b = new B(); b = new B();
b = new B(); b = new B(); b = new B(); b = new B();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Subclass");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Subclass");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Subclass", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Subclass");
System.gc(); // Reclaim memory
// User defined object that instantiates another object
JGFInstrumentor.addTimer("Section1:Create:Object:Complex", "objects");
time = 0.0;
size = INITSIZE;
ab = new AB();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Complex");
JGFInstrumentor.startTimer("Section1:Create:Object:Complex");
for (i=0;i<size;i++) {
ab = new AB(); ab = new AB(); ab = new AB(); ab = new AB();
ab = new AB(); ab = new AB(); ab = new AB(); ab = new AB();
ab = new AB(); ab = new AB(); ab = new AB(); ab = new AB();
ab = new AB(); ab = new AB(); ab = new AB(); ab = new AB();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Complex");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Complex");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Complex", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Complex");
System.gc(); // Reclaim memory
// User defined object that instantiates another object in it's contructor
JGFInstrumentor.addTimer("Section1:Create:Object:Complex:Constructor", "objects");
time = 0.0;
size = INITSIZE;
abc = new ABC();
while (time < TARGETTIME && size < MAXSIZE){
JGFInstrumentor.resetTimer("Section1:Create:Object:Complex:Constructor");
JGFInstrumentor.startTimer("Section1:Create:Object:Complex:Constructor");
for (i=0;i<size;i++) {
abc = new ABC(); abc = new ABC(); abc = new ABC(); abc = new ABC();
abc = new ABC(); abc = new ABC(); abc = new ABC(); abc = new ABC();
abc = new ABC(); abc = new ABC(); abc = new ABC(); abc = new ABC();
abc = new ABC(); abc = new ABC(); abc = new ABC(); abc = new ABC();
}
JGFInstrumentor.stopTimer("Section1:Create:Object:Complex:Constructor");
time = JGFInstrumentor.readTimer("Section1:Create:Object:Complex:Constructor");
JGFInstrumentor.addOpsToTimer("Section1:Create:Object:Complex:Constructor", (double) 16*size);
size *=2;
}
JGFInstrumentor.printperfTimer("Section1:Create:Object:Complex:Constructor");
System.gc(); // Reclaim memory
}
public static void main (String argv[]){
JGFInstrumentor.printHeader(1,0);
JGFCreateBench crb = new JGFCreateBench();
crb.JGFrun();
}
}
class A {}
class AA {
public AA() {}
}
class A1 {
int a;
}
class A2 {
int a,b;
}
class A4 {
int a,b,c,d;
}
class A4L {
long a,b,c,d;
}
class A4F {
float a,b,c,d;
}
class A4if {
int a,b,c,d;
float g,h,i,j;
}
class AB {
A a= new A();
}
class ABC {
A a;
public ABC() {
a = new A();
}
}
class B extends A {};
| [
"suncong@xidian.edu.cn"
] | suncong@xidian.edu.cn |
f44d01af6e2f77cbf7ba52c79e5de38205a332ae | facf0aa790dafe79a78d2949e4e781f690e3844a | /xwiki-platform-search-solrj/src/main/java/org/xwiki/platform/search/internal/SolrjIndexerProcessor.java | eab92a55ae58aae7901c189b7e584767dd572671 | [] | no_license | savis/xwiki-platform-solr | 43f425bdd3aa4c0c750429764836a93a83c4acc4 | 358651836675287e9dfdf52c4c8370e810640af1 | refs/heads/master | 2021-01-18T09:10:29.559727 | 2012-06-10T09:05:58 | 2012-06-10T09:05:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,682 | java | /*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.platform.search.internal;
import java.util.List;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.platform.search.IndexerProcess;
/**
*
* @version $Id$
*/
public class SolrjIndexerProcessor implements IndexerProcess
{
/**
* {@inheritDoc}
*
* @see org.xwiki.platform.search.IndexerProcess#getEstimatedCompletionTime()
*/
@Override
public String getEstimatedCompletionTime()
{
// TODO Auto-generated method stub
return null;
}
/**
* {@inheritDoc}
*
* @see org.xwiki.platform.search.IndexerProcess#getIndexingSpeed()
*/
@Override
public String getIndexingSpeed()
{
// TODO Auto-generated method stub
return null;
}
/**
* {@inheritDoc}
*
* @see org.xwiki.platform.search.IndexerProcess#getLastIndexedDocuments(int)
*/
@Override
public List<DocumentReference> getLastIndexedDocuments(int count)
{
// TODO Auto-generated method stub
return null;
}
/**
* {@inheritDoc}
*
* @see org.xwiki.platform.search.IndexerProcess#getNextIndexerProcess()
*/
@Override
public IndexerProcess getNextIndexerProcess()
{
// TODO Auto-generated method stub
return null;
}
/**
* {@inheritDoc}
*
* @see org.xwiki.platform.search.IndexerProcess#getPreQueueSize()
*/
@Override
public int getPreQueueSize()
{
// TODO Auto-generated method stub
return 0;
}
/**
* {@inheritDoc}
*
* @see org.xwiki.platform.search.IndexerProcess#getQueueSize()
*/
@Override
public int getQueueSize()
{
// TODO Auto-generated method stub
return 0;
}
}
| [
"savitha.s131@gmail.com"
] | savitha.s131@gmail.com |
795d44636e1523bef14e6cab715310d27b34e8a3 | ac5016ff95e2de208ed45aa383e892e59433a549 | /app/src/main/java/com/mk/gifpper/service/entities/TrendingResponse.java | 83e1174bf3052e8bb6027d3b005285626e365a37 | [
"Apache-2.0"
] | permissive | mikekudzin/Gifpper | 2476b6c1d1e72b6c1f54fecdf42974f354b7e801 | cf593ff8442371a3a8bd4341d4f846b72094eb60 | refs/heads/master | 2020-12-25T15:09:08.626441 | 2016-06-23T23:31:27 | 2016-06-23T23:31:27 | 61,842,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,135 | java |
package com.mk.gifpper.service.entities;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.util.ArrayList;
import java.util.List;
public class TrendingResponse {
@SerializedName("data")
@Expose
private List<GifModel> data = new ArrayList<GifModel>();
@SerializedName("meta")
@Expose
private Meta meta;
@SerializedName("pagination")
@Expose
private Pagination pagination;
/**
*
* @return
* The data
*/
public List<GifModel> getData() {
return data;
}
/**
*
* @param data
* The data
*/
public void setData(List<GifModel> data) {
this.data = data;
}
/**
*
* @return
* The meta
*/
public Meta getMeta() {
return meta;
}
/**
*
* @param meta
* The meta
*/
public void setMeta(Meta meta) {
this.meta = meta;
}
/**
*
* @return
* The pagination
*/
public Pagination getPagination() {
return pagination;
}
/**
*
* @param pagination
* The pagination
*/
public void setPagination(Pagination pagination) {
this.pagination = pagination;
}
@Override
public String toString() {
return ToStringBuilder.reflectionToString(this);
}
@Override
public int hashCode() {
return new HashCodeBuilder().append(data).append(meta).append(pagination).toHashCode();
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof TrendingResponse) == false) {
return false;
}
TrendingResponse rhs = ((TrendingResponse) other);
return new EqualsBuilder().append(data, rhs.data).append(meta, rhs.meta).append(pagination, rhs.pagination).isEquals();
}
}
| [
"MikeKudzin@iba.by"
] | MikeKudzin@iba.by |
12eeb66f87a49f3f75cc507ba9425e1eeca90598 | 83fd5126925a245322d350188a04eec58699562e | /PlayingCat/src/PlayingCat.java | 3025ffaa20a3e1e911e5fcef5f8d19657875a9e8 | [] | no_license | PraveenSelvamTCE/Java | 9e25da2d6b1cdda59c82fc844a3feccea7b9d2be | 36022a6a5851a9fb36214ca338cf142a3c0c98a8 | refs/heads/master | 2023-01-03T20:48:27.201251 | 2020-10-31T17:58:54 | 2020-10-31T17:58:54 | 268,713,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 350 | java | public class PlayingCat {
public static boolean isCatPlaying(boolean summer, int temperature){
if (summer && temperature >= 25 && temperature <= 45){
return true;
}
else if (!summer && temperature >= 25 && temperature <= 35){
return true;
}
else
return false;
}
}
| [
"47314027+PraveenSelvamTCE@users.noreply.github.com"
] | 47314027+PraveenSelvamTCE@users.noreply.github.com |
d6c9b1ebd10d7d31c8badefdcad1986a222dfc10 | 421cad1aa1f9cf055e817fc0199465e8e0189bcb | /src/main/java/com/jay/statements/security/PersistentTokenRememberMeServices.java | 2fd281b58d943834749cc802a59913cc0502f8f6 | [] | no_license | JayRaparla/jhipster | db77bdd13912cf02743219c60c653edee75395f8 | 4e50eaae23a8a218ad95653f4dfe2242e988b5e9 | refs/heads/master | 2021-01-17T17:09:53.310260 | 2017-04-21T01:25:30 | 2017-04-21T01:25:30 | 60,309,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,312 | java | package com.jay.statements.security;
import com.jay.statements.domain.PersistentToken;
import com.jay.statements.repository.PersistentTokenRepository;
import com.jay.statements.repository.UserRepository;
import com.jay.statements.service.util.RandomUtil;
import io.github.jhipster.config.JHipsterProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.web.authentication.rememberme.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.Arrays;
/**
* Custom implementation of Spring Security's RememberMeServices.
* <p>
* Persistent tokens are used by Spring Security to automatically log in users.
* <p>
* This is a specific implementation of Spring Security's remember-me authentication, but it is much
* more powerful than the standard implementations:
* <ul>
* <li>It allows a user to see the list of his currently opened sessions, and invalidate them</li>
* <li>It stores more information, such as the IP address and the user agent, for audit purposes<li>
* <li>When a user logs out, only his current session is invalidated, and not all of his sessions</li>
* </ul>
* <p>
* This is inspired by:
* <ul>
* <li><a href="http://jaspan.com/improved_persistent_login_cookie_best_practice">Improved Persistent Login Cookie
* Best Practice</a></li>
* <li><a href="https://github.com/blog/1661-modeling-your-app-s-user-session">Github's "Modeling your App's User Session"</a></li>
* </ul>
* <p>
* The main algorithm comes from Spring Security's PersistentTokenBasedRememberMeServices, but this class
* couldn't be cleanly extended.
*/
@Service
public class PersistentTokenRememberMeServices extends
AbstractRememberMeServices {
private final Logger log = LoggerFactory.getLogger(PersistentTokenRememberMeServices.class);
// Token is valid for one month
private static final int TOKEN_VALIDITY_DAYS = 31;
private static final int TOKEN_VALIDITY_SECONDS = 60 * 60 * 24 * TOKEN_VALIDITY_DAYS;
private final PersistentTokenRepository persistentTokenRepository;
private final UserRepository userRepository;
public PersistentTokenRememberMeServices(JHipsterProperties jHipsterProperties,
org.springframework.security.core.userdetails.UserDetailsService userDetailsService,
PersistentTokenRepository persistentTokenRepository, UserRepository userRepository) {
super(jHipsterProperties.getSecurity().getRememberMe().getKey(), userDetailsService);
this.persistentTokenRepository = persistentTokenRepository;
this.userRepository = userRepository;
}
@Override
protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request,
HttpServletResponse response) {
PersistentToken token = getPersistentToken(cookieTokens);
String login = token.getUser().getLogin();
// Token also matches, so login is valid. Update the token value, keeping the *same* series number.
log.debug("Refreshing persistent login token for user '{}', series '{}'", login, token.getSeries());
token.setTokenDate(LocalDate.now());
token.setTokenValue(RandomUtil.generateTokenData());
token.setIpAddress(request.getRemoteAddr());
token.setUserAgent(request.getHeader("User-Agent"));
try {
persistentTokenRepository.saveAndFlush(token);
addCookie(token, request, response);
} catch (DataAccessException e) {
log.error("Failed to update token: ", e);
throw new RememberMeAuthenticationException("Autologin failed due to data access problem", e);
}
return getUserDetailsService().loadUserByUsername(login);
}
@Override
protected void onLoginSuccess(HttpServletRequest request, HttpServletResponse response, Authentication
successfulAuthentication) {
String login = successfulAuthentication.getName();
log.debug("Creating new persistent login for user {}", login);
PersistentToken token = userRepository.findOneByLogin(login).map(u -> {
PersistentToken t = new PersistentToken();
t.setSeries(RandomUtil.generateSeriesData());
t.setUser(u);
t.setTokenValue(RandomUtil.generateTokenData());
t.setTokenDate(LocalDate.now());
t.setIpAddress(request.getRemoteAddr());
t.setUserAgent(request.getHeader("User-Agent"));
return t;
}).orElseThrow(() -> new UsernameNotFoundException("User " + login + " was not found in the database"));
try {
persistentTokenRepository.saveAndFlush(token);
addCookie(token, request, response);
} catch (DataAccessException e) {
log.error("Failed to save persistent token ", e);
}
}
/**
* When logout occurs, only invalidate the current token, and not all user sessions.
* <p>
* The standard Spring Security implementations are too basic: they invalidate all tokens for the
* current user, so when he logs out from one browser, all his other sessions are destroyed.
*/
@Override
@Transactional
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
String rememberMeCookie = extractRememberMeCookie(request);
if (rememberMeCookie != null && rememberMeCookie.length() != 0) {
try {
String[] cookieTokens = decodeCookie(rememberMeCookie);
PersistentToken token = getPersistentToken(cookieTokens);
persistentTokenRepository.delete(token);
} catch (InvalidCookieException ice) {
log.info("Invalid cookie, no persistent token could be deleted", ice);
} catch (RememberMeAuthenticationException rmae) {
log.debug("No persistent token found, so no token could be deleted", rmae);
}
}
super.logout(request, response, authentication);
}
/**
* Validate the token and return it.
*/
private PersistentToken getPersistentToken(String[] cookieTokens) {
if (cookieTokens.length != 2) {
throw new InvalidCookieException("Cookie token did not contain " + 2 +
" tokens, but contained '" + Arrays.asList(cookieTokens) + "'");
}
String presentedSeries = cookieTokens[0];
String presentedToken = cookieTokens[1];
PersistentToken token = persistentTokenRepository.findOne(presentedSeries);
if (token == null) {
// No series match, so we can't authenticate using this cookie
throw new RememberMeAuthenticationException("No persistent token found for series id: " + presentedSeries);
}
// We have a match for this user/series combination
log.info("presentedToken={} / tokenValue={}", presentedToken, token.getTokenValue());
if (!presentedToken.equals(token.getTokenValue())) {
// Token doesn't match series value. Delete this session and throw an exception.
persistentTokenRepository.delete(token);
throw new CookieTheftException("Invalid remember-me token (Series/token) mismatch. Implies previous " +
"cookie theft attack.");
}
if (token.getTokenDate().plusDays(TOKEN_VALIDITY_DAYS).isBefore(LocalDate.now())) {
persistentTokenRepository.delete(token);
throw new RememberMeAuthenticationException("Remember-me login has expired");
}
return token;
}
private void addCookie(PersistentToken token, HttpServletRequest request, HttpServletResponse response) {
setCookie(
new String[]{token.getSeries(), token.getTokenValue()},
TOKEN_VALIDITY_SECONDS, request, response);
}
}
| [
"dhananjay.raparla@gmail.com"
] | dhananjay.raparla@gmail.com |
055e3b330dd3654bc36cff8798db85e716eee1d0 | 04ab2018a461a74ebcd748c26e7eac87642b3c4a | /exa-web-api/src/main/java/com/skm/exa/webapi/conf/SwaggerConfiguration.java | 2f57b0ce905b22b767cdd1b2abba0ee168a90240 | [] | no_license | Chen-Hao-190228254/demo1 | bd5a8a12e6865f79424dfc58482a838bdaf57271 | 967d64821b1b3b6b0bcada48743460a74dd3ade7 | refs/heads/master | 2020-06-21T04:17:46.079743 | 2019-06-28T09:20:18 | 2019-06-28T09:20:18 | 197,341,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,661 | java | package com.skm.exa.webapi.conf;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.paths.RelativePathProvider;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import javax.servlet.ServletContext;
import java.util.Collections;
import java.util.List;
/**
* @author dhc
* 2019-03-08 23:29
*/
@Configuration
@EnableSwagger2
@Profile("swagger")
public class SwaggerConfiguration {
private static final ApiInfo API_INFO = new ApiInfo(
"项目接口",
"项目SWAGGER接口文档",
"1.0.0",
null,
null,
null,
null,
Collections.emptyList()
);
@Bean
public Docket docket(ServletContext servletContext) {
SecurityContext securityContext = SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("/(web|api)/.*")).build();
ApiKey apiKey = new ApiKey("xkey", "X-Auth-Token", "header");
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(API_INFO)
.pathProvider(new RelativePathProvider(servletContext) {
@Override
public String getApplicationBasePath() {
return super.getApplicationBasePath();
}
})
.select()
.apis(RequestHandlerSelectors.basePackage("com.skm.exa.webapi.controller"))
.build()
.securitySchemes(Collections.singletonList(apiKey))
.securityContexts(Collections.singletonList(securityContext));
}
private List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
return Collections.singletonList(new SecurityReference("xkey", authorizationScopes));
}
}
| [
"351531626@qq.com"
] | 351531626@qq.com |
a5dbfed1f7a55a22406f09d18bf8b5b6d185bf44 | 07abf0515a20e1f30598a7a9556f47fb0e85ac82 | /src/test/java/command/TaskListTest.java | 477d16434fea9b276879ddeeeb7d574a872756aa | [] | no_license | IrvingHe000/ip | 6f4086294882b2a529975e8a5c37cefe16302327 | e1daf17a7593aa8dbcda53fd2e7b2bf5f2531d9f | refs/heads/master | 2023-07-28T01:12:57.258714 | 2021-09-14T11:05:10 | 2021-09-14T11:05:10 | 397,495,288 | 0 | 0 | null | 2021-09-07T12:10:29 | 2021-08-18T06:22:44 | Java | UTF-8 | Java | false | false | 1,848 | java | package command;
import duke.command.TaskList;
import duke.exception.DuplicateException;
import duke.task.Task;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class TaskListTest {
private static TaskList testingList = new TaskList();
private static Task task1 = new Task("task1");
private static Task task2 = new Task("task2");
private static Task task3 = new Task("task3");
@Test
public void sizeTest() {
try {
testingList = new TaskList();
assertEquals(0, testingList.size());
testingList.addTask(task1);
testingList.addTask(task2);
assertEquals(2, testingList.size());
testingList.addTask(task3);
assertEquals(3, testingList.size());
} catch (DuplicateException e) {
System.out.println("There are duplicate elements want to be added in the list");
}
}
@Test
public void getTest() {
testingList = new TaskList();
try {
testingList.addTask(task1);
testingList.addTask(task2);
assertEquals(task1, testingList.getTask(0));
assertEquals(task2, testingList.getTask(1));
} catch (DuplicateException e) {
System.out.println("There are duplicate elements want to be added in the list");
}
}
@Test
public void removeTest() {
try {
testingList = new TaskList();
testingList.addTask(task1);
testingList.addTask(task2);
assertEquals(task2, testingList.removeTask(1));
assertEquals(task1, testingList.removeTask(0));
} catch (DuplicateException e) {
System.out.println("There are duplicate elements want to be added in the list");
}
}
}
| [
"heoutong@gmail.com"
] | heoutong@gmail.com |
7353c6e36edd07fc643ed28246e1e547f2c39453 | cdbd53ceb24f1643b5957fa99d78b8f4efef455a | /vertx-semper/aeon-eternal/aeon-inlet/src/main/java/io/vertx/tp/ipc/eon/UpStatus.java | ec96f1c8ef0fba9d690ca049a4cca24b66799d39 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | chundcm/vertx-zero | f3dcb692ae6b9cc4ced52386cab01e5896e69d80 | d2a2d096426c30d90be13b162403d66c8e72cc9a | refs/heads/master | 2023-04-27T18:41:47.489584 | 2023-04-23T01:53:40 | 2023-04-23T01:53:40 | 244,054,093 | 0 | 0 | Apache-2.0 | 2020-02-29T23:00:59 | 2020-02-29T23:00:58 | null | UTF-8 | Java | false | true | 4,849 | java | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: zero.status.proto
package io.vertx.tp.ipc.eon;
public final class UpStatus {
private UpStatus() {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
static final com.google.protobuf.Descriptors.Descriptor
internal_static_io_vertx_tp_ipc_eon_IpcStatus_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_io_vertx_tp_ipc_eon_IpcStatus_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_io_vertx_tp_ipc_eon_RetryParams_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_io_vertx_tp_ipc_eon_RetryParams_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_io_vertx_tp_ipc_eon_RetryInfo_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_io_vertx_tp_ipc_eon_RetryInfo_fieldAccessorTable;
static final com.google.protobuf.Descriptors.Descriptor
internal_static_io_vertx_tp_ipc_eon_ResponseParams_descriptor;
static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_io_vertx_tp_ipc_eon_ResponseParams_fieldAccessorTable;
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\021zero.status.proto\022\023io.vertx.tp.ipc.eon" +
"\"*\n\tIpcStatus\022\014\n\004code\030\001 \001(\005\022\017\n\007message\030\002" +
" \001(\t\"$\n\013RetryParams\022\025\n\rmax_reconnect\030\001 \001" +
"(\005\"/\n\tRetryInfo\022\016\n\006passed\030\001 \001(\010\022\022\n\nbacko" +
"ff_ms\030\002 \003(\005\"3\n\016ResponseParams\022\014\n\004size\030\001 " +
"\001(\005\022\023\n\013interval_us\030\002 \001(\005B!\n\023io.vertx.tp." +
"ipc.eonB\010UpStatusP\001b\006proto3"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
com.google.protobuf.Descriptors.FileDescriptor root) {
descriptor = root;
return null;
}
};
com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[]{
}, assigner);
internal_static_io_vertx_tp_ipc_eon_IpcStatus_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_io_vertx_tp_ipc_eon_IpcStatus_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_io_vertx_tp_ipc_eon_IpcStatus_descriptor,
new java.lang.String[]{"Code", "Message",});
internal_static_io_vertx_tp_ipc_eon_RetryParams_descriptor =
getDescriptor().getMessageTypes().get(1);
internal_static_io_vertx_tp_ipc_eon_RetryParams_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_io_vertx_tp_ipc_eon_RetryParams_descriptor,
new java.lang.String[]{"MaxReconnect",});
internal_static_io_vertx_tp_ipc_eon_RetryInfo_descriptor =
getDescriptor().getMessageTypes().get(2);
internal_static_io_vertx_tp_ipc_eon_RetryInfo_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_io_vertx_tp_ipc_eon_RetryInfo_descriptor,
new java.lang.String[]{"Passed", "BackoffMs",});
internal_static_io_vertx_tp_ipc_eon_ResponseParams_descriptor =
getDescriptor().getMessageTypes().get(3);
internal_static_io_vertx_tp_ipc_eon_ResponseParams_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_io_vertx_tp_ipc_eon_ResponseParams_descriptor,
new java.lang.String[]{"Size", "IntervalUs",});
}
// @@protoc_insertion_point(outer_class_scope)
}
| [
"silentbalanceyh@126.com"
] | silentbalanceyh@126.com |
6f4290983551b1a0d9d23a824439731c3e1addff | c1d1352f866bcf5dba4455959c7a4212baf101cf | /src/MiscTools/MiscTools.java | d146f0181670d022999b9d23b0fd60ae049b7ed6 | [] | no_license | Bmaxfi1/AppointmentScheduler | cc2aaa99e063c92ea5da869d4b1ce50e1676d7e6 | 7450e8dea92c1f049fee06ffa00d825af0a776c1 | refs/heads/master | 2023-05-28T19:02:20.376849 | 2021-06-09T22:38:34 | 2021-06-09T22:38:34 | 353,494,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,093 | java | package MiscTools;
import Model.Appointment;
import Model.AppointmentList;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import static java.nio.file.StandardOpenOption.APPEND;
import static java.nio.file.StandardOpenOption.CREATE;
/**
* The MiscTools Class holds several general static methods that are used throughout the app
*/
public abstract class MiscTools {
/**
*
* @param str the string to check
* @return true if the parameter is an integer
*/
public static boolean isInteger(String str) {
if (str == null) {
return false;
}
int length = str.length();
if (length == 0) {
return false;
}
int i = 0;
if (str.charAt(0) == '-') {
if (length == 1) {
return false;
}
i = 1;
}
for (; i < length; i++) {
char c = str.charAt(i);
if (c < '0' || c > '9') {
return false;
}
}
return true;
}
/**
*
* @param timeToCheck the time to check
* @return string containing AM or PM
*/
public static String getAmOrPm(LocalTime timeToCheck) {
if (timeToCheck.getHour() >= 12) {
return "PM";
} else {
return "AM";
}
}
/**
*
* @param startTimeToCheck the start time
* @param endTimeToCheck the end time
* @return true if the business is closed between the start time and end time
*/
public static boolean isOutsideBusinessHours(LocalDateTime startTimeToCheck, LocalDateTime endTimeToCheck) {
ZoneId myZone = ZoneId.systemDefault();
ZoneId EST = ZoneId.of("America/New_York");
ZonedDateTime startTimeToCheckLocalZone = startTimeToCheck.atZone(myZone);
ZonedDateTime startTimeToCheckEST = startTimeToCheckLocalZone.withZoneSameInstant(EST);
ZonedDateTime endTimeToCheckLocalZone = endTimeToCheck.atZone(myZone);
ZonedDateTime endTimeToCheckEST = endTimeToCheckLocalZone.withZoneSameInstant(EST);
LocalTime startOfBusinessHours = LocalTime.of(8,0);
LocalTime endOfBusinessHours = LocalTime.of(22, 0);
return startTimeToCheckEST.toLocalTime().isBefore(startOfBusinessHours) ||
startTimeToCheckEST.toLocalTime().isAfter(endOfBusinessHours) ||
endTimeToCheckEST.toLocalTime().isBefore(startOfBusinessHours) ||
endTimeToCheckEST.toLocalTime().isAfter(endOfBusinessHours) ||
!startTimeToCheckEST.toLocalDate().toString().equals(endTimeToCheckEST.toLocalDate().toString());
}
/**
*
* @param customerId the customer to check for overlapping appointments
* @param start the start time
* @param end the end time
* @return true if the customer has an appointment between the start time and end time
*/
public static boolean appointmentOverlaps(int customerId, LocalDateTime start, LocalDateTime end) {
for (Appointment appointment: AppointmentList.getAppointmentList()) {
if (customerId == appointment.getCustomerId()) {
if (appointment.getStartInstant().isAfter(start) && appointment.getEndInstant().isBefore(end)) {
return true;
}
}
}
return false;
}
/**
* When modifying an appointment, it is important to ignore the appointment we are changing. This overloaded method
* takes into account an existing appointment.
* @param customerId the int of the customer to check for overlapping appointments
* @param start the start time
* @param end the end time
* @param appointmentIdToDisregard the appointment that is being modified
* @return true if the customer has an appointment between the start time and end time, ignoring a certain appointment
*/
public static boolean appointmentOverlaps(int customerId, LocalDateTime start, LocalDateTime end, int appointmentIdToDisregard) {
for (Appointment appointment: AppointmentList.getAppointmentList()) {
if (appointment.getAppointmentId() != appointmentIdToDisregard) {
if (customerId == appointment.getCustomerId()) {
if (appointment.getStartInstant().isAfter(start) && appointment.getEndInstant().isBefore(end)) {
return true;
}
}
}
}
return false;
}
/**
*
* @param loginDetails a string containing details to be logged
* @throws IOException
*/
public static void recordLoginToFile(String loginDetails) throws IOException {
Files.writeString(
Path.of(System.getProperty("java.io.tmpdir"), "login_activity.txt"),
loginDetails + System.lineSeparator(),
CREATE, APPEND
);
}
}
| [
"brandon.maxfield@gmail.com"
] | brandon.maxfield@gmail.com |
9170599062f2db18e224614813b9a8030428940a | e315c2bb2ea17cd8388a39aa0587e47cb417af0a | /src/tn/com/smartsoft/framework/presentation/view/report/ReportModel.java | 9e119c16abdb5d439631502ca3bd6172b34935dc | [] | no_license | wissem007/badges | 000536a40e34e20592fe6e4cb2684d93604c44c9 | 2064bd07b52141cf3cff0892e628cc62b4f94fdc | refs/heads/master | 2020-12-26T14:06:11.693609 | 2020-01-31T23:40:07 | 2020-01-31T23:40:07 | 237,530,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,250 | java | package tn.com.smartsoft.framework.presentation.view.report;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
public class ReportModel implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public static final String PDF = "pdf";
public static final String EXCEL = "xls";
public static final String HTML = "html";
public static final String CSV = "csv";
private String propertyDataSource;
private String fileName;
protected boolean isImprimerAlert = true;
private String path;
private Map<String, Object> paramValues = new HashMap<String, Object>();
private ByteArrayOutputStream source;
private boolean responseToWeb = true;
private InputStream reportStream;
private Boolean isReportStream = false;
public ReportModel(String fileName, String path) {
super();
this.fileName = fileName;
this.path = path;
this.isImprimerAlert = false;
}
public ReportModel(String propertyDataSource, String fileName, String path) {
super();
this.propertyDataSource = propertyDataSource;
this.fileName = fileName;
this.path = path;
this.isImprimerAlert = false;
}
public ReportModel(String fileName, String path, InputStream reportStream) {
super();
this.fileName = fileName;
this.path = path;
this.isImprimerAlert = false;
this.isReportStream = true;
this.reportStream = reportStream;
}
public ReportModel(String propertyDataSource, String fileName, String path, InputStream reportStream) {
super();
this.propertyDataSource = propertyDataSource;
this.fileName = fileName;
this.path = path;
this.isImprimerAlert = false;
this.isReportStream = true;
this.reportStream = reportStream;
}
public boolean isResponseToWeb() {
return responseToWeb;
}
public void setResponseToWeb(boolean responseToWeb) {
this.responseToWeb = responseToWeb;
}
public ByteArrayOutputStream getSource() {
return source;
}
public void setSource(ByteArrayOutputStream source) {
this.source = source;
}
public void addParam(String key, Object value) {
this.paramValues.put(key, value);
}
public Map<String, Object> getParamValues() {
return paramValues;
}
public void setPath(String path) {
this.path = path;
}
public String getPath() {
return this.path;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getPropertyDataSource() {
return propertyDataSource;
}
public void setPropertyDataSource(String propertyDataSource) {
this.propertyDataSource = propertyDataSource;
}
public boolean isImprimerAlert() {
return isImprimerAlert;
}
public void setImprimerAlert(boolean isImprimerAlert) {
this.isImprimerAlert = isImprimerAlert;
}
public InputStream getReportStream() {
return reportStream;
}
public void setReportStream(InputStream reportStream) {
this.reportStream = reportStream;
}
public Boolean getIsReportStream() {
return isReportStream;
}
public void setIsReportStream(Boolean isReportStream) {
this.isReportStream = isReportStream;
}
}
| [
"alouiwiss@gmail.com"
] | alouiwiss@gmail.com |
7117f12c2aa9ee89268ebf421bbbf602526aaf85 | f5e9e002f61894a0f71ddde97afbca6d157bd7b9 | /app/src/main/java/com/bq2015/rxjavalambda/MainActivity.java | 0d494f7ed92bba5b1f64baf2dd81dc7bf8aea6c0 | [] | no_license | bq2015/RxJava-lambda | a0bf711f7337e214316ae0f0fa12d021a6f1abb7 | 2a4db024143a5037d79d0f5a4d8b5a274b944da5 | refs/heads/master | 2020-06-15T16:50:24.702987 | 2016-12-01T09:57:26 | 2016-12-01T09:57:26 | 75,269,079 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package com.bq2015.rxjavalambda;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private Handler mHandler;
private Button mFuck;
private String mString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mFuck = (Button) findViewById(R.id.btn_main_ui);
mString = mFuck.getText().toString();
mHandler = new Handler();
new Thread(() -> {
int i = 7;
while (i > 0) {
SystemClock.sleep(800);
int finalI = i;
mHandler.postDelayed(() -> {
mFuck.setText(String.valueOf(mString + finalI));
if (finalI == 1) {
Toast.makeText(MainActivity.this, getString(R.string.massage_main_ui), Toast.LENGTH_SHORT).show();
}
}, 800);
i--;
}
}).start();
}
}
| [
"kylinff@qq.com"
] | kylinff@qq.com |
933a1f95e287070f5843cd8ea697e70584e09c4e | c3064d9af8afb3c132c069ca7a60c9a1d567298d | /src/day18_conditions_practice_strings_intro/IfWithoutCurlyBraces.java | 4f798ca0cfdec3b860d0d7c9a63b4209687af720 | [] | no_license | mustafa0770/java-programming | 8e40f6fda45a355a3ad96c81e059a19f52924fa4 | d6cd460e5cd214791383c395104d1b6a4b530b9f | refs/heads/master | 2023-06-16T17:00:37.609700 | 2021-06-09T06:52:16 | 2021-06-09T06:52:16 | 360,332,886 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package day18_conditions_practice_strings_intro;
public class IfWithoutCurlyBraces {
public static void main(String[] args) {
String todaysClass = "python";
if(todaysClass.equals("java"))
System.out.println("java is fun");
else
System.out.println("it is not java. It is " +todaysClass);
}
}
| [
"mustafa310897@gmail.com"
] | mustafa310897@gmail.com |
ee118f354b8dd6570200a3f61c0b4ceb385b758b | 498de498aa9e8fa31f72a0985f9797246b6d762b | /Board.java | 2227fa8d3a8eb808622a284eaa86bc39e09c1d3a | [] | no_license | DhruvKrishnaswamy/Tablut_Game | 5e89abd8d8dcb08721ba4c5eb5b6858a270142a9 | b4fa73b09f00aafae3fc93fa5bb82088fd6b9b19 | refs/heads/master | 2020-09-13T14:19:50.869608 | 2019-11-20T00:16:21 | 2019-11-20T00:16:21 | 222,814,472 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 19,817 | java | package tablut;
import java.util.ArrayList;
import java.util.Stack;
import java.util.HashSet;
import java.util.List;
import java.util.Formatter;
import static tablut.Piece.*;
import static tablut.Square.*;
import static tablut.Move.mv;
/**
* The state of a Tablut Game.
*
* @author Dhruv Krishnaswamy
*/
class Board {
/**
* The number of squares on a side of the board.
*/
static final int SIZE = 9;
/**
* The throne (or castle) square and its four surrounding squares..
*/
static final Square THRONE = sq(4, 4),
NTHRONE = sq(4, 5),
STHRONE = sq(4, 3),
WTHRONE = sq(3, 4),
ETHRONE = sq(5, 4);
/**
* Initial positions of attackers.
*/
static final Square[] INITIAL_ATTACKERS = {
sq(0, 3), sq(0, 4), sq(0, 5), sq(1, 4),
sq(8, 3), sq(8, 4), sq(8, 5), sq(7, 4),
sq(3, 0), sq(4, 0), sq(5, 0), sq(4, 1),
sq(3, 8), sq(4, 8), sq(5, 8), sq(4, 7)
};
/**
* Initial positions of defenders of the king.
*/
static final Square[]INITIAL_DEFENDERS = {NTHRONE,
ETHRONE, STHRONE, WTHRONE,
sq(4, 6), sq(4, 2), sq(2, 4), sq(6, 4)
};
/**
* Initializes a game board with SIZE squares on a side in the
* initial position.
*/
Board() {
init();
}
/**
* Initializes a copy of MODEL.
*/
Board(Board model) {
copy(model);
}
/**
* Copies MODEL into me.
*/
void copy(Board model) {
init();
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
this._board[i][j] = model._board[i][j];
}
}
this._board = model._board;
this._turn = model._turn;
this._winner = model._winner;
this._repeated = model._repeated;
this._lim = model._lim;
this._moveCount = model._moveCount;
this._kingpos = model._kingpos;
this.boars = model.boars;
}
/**
* Clears the board to the initial position.
*/
void init() {
_turn = BLACK;
_winner = null;
clearUndo();
_board = new Piece[SIZE][SIZE];
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
this._board[i][j] = EMPTY;
}
}
for (Square s : INITIAL_ATTACKERS) {
put(BLACK, s);
}
for (Square def : INITIAL_DEFENDERS) {
put(WHITE, def);
}
put(KING, THRONE);
boars.add(encodedBoard());
}
/**
* Set the move limit to LIM. It is an error if 2*LIM <= moveCount().
*
* @param n : This is the number of moves.
*/
void setMoveLimit(int n) {
if (2 * n <= moveCount()) {
throw new IllegalArgumentException();
} else {
_lim = n;
}
}
/**
* Return a Piece representing whose move it is (WHITE or BLACK).
*/
Piece turn() {
return _turn;
}
/**
* Return the winner in the current position, or null if there is no winner
* yet.
*/
Piece winner() {
return _winner;
}
/**
* Returns true iff this is a win due to a repeated position.
*/
boolean repeatedPosition() {
return _repeated;
}
/**
* Record current position and set winner() next mover if the current
* position is a repeat.
*/
private void checkRepeated() {
String state = encodedBoard();
if (boars.search(state) == -1) {
boars.add(state);
} else {
_winner = _turn.opponent();
}
}
/**
* Return the number of moves since the initial position that have not been
* undone.
*/
int moveCount() {
return _moveCount;
}
/**
* Return location of the king.
*/
Square kingPosition() {
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
if (get(i, j) == KING) {
return sq(i, j);
}
}
}
return null;
}
/**
* Return the contents the square at S.
*/
final Piece get(Square s) {
return get(s.col(), s.row());
}
/**
* Return the contents of the square at (COL, ROW), where
* 0 <= COL, ROW <= 9.
*/
final Piece get(int col, int row) {
if (col < SIZE && row < SIZE && col >= 0 && row >= 0) {
return _board[col][row];
} else {
return EMPTY;
}
}
/**
* Return the contents of the square at COL ROW.
*/
final Piece get(char col, char row) {
return get(col - 'a', row - '1');
}
/**
* Set square S to P.
*/
final void put(Piece p, Square s) {
_board[s.col()][s.row()] = p;
if (p == KING) {
_kingpos = s;
}
}
/**
* Set square S to P and record for undoing.
*/
final void revPut(Piece p, Square s) {
Board newb = new Board();
newb.copy(this);
}
/**
* Set square COL ROW to P.
*/
final void put(Piece p, char col, char row) {
put(p, sq(col - 'a', row - '1'));
}
/**
* Return true iff FROM - TO is an unblocked rook move on the current
* board. For this to be true, FROM-TO must be a rook move and the
* squares along it, other than FROM, must be empty.
*/
boolean isUnblockedMove(Square from, Square to) {
if (!from.isRookMove(to)) {
return false;
}
int direc = from.direction(to);
if (from.row() == to.row()) {
int dist = Math.abs(from.col() - to.col());
for (int a = 1; a <= dist; a++) {
if (get(from.rookMove(direc, a)) != EMPTY) {
return false;
}
}
}
if (from.col() == to.col()) {
int dist = Math.abs(from.row() - to.row());
for (int b = 1; b <= dist; b++) {
if (get(from.rookMove(direc, b)) != EMPTY) {
return false;
}
}
}
return true;
}
/**
* Return true iff FROM is a valid starting square for a move.
*/
boolean isLegal(Square from) {
if (get(from) == KING && _turn == WHITE) {
return true;
} else {
return get(from).side() == _turn;
}
}
/**
* Return true iff FROM-TO is a valid move.
*/
boolean isLegal(Square from, Square to) {
if (to == THRONE) {
if (get(from) != KING) {
return false;
}
}
if (from.col() >= SIZE || from.row() >= SIZE) {
return false;
}
if (to.col() >= SIZE || to.row() >= SIZE) {
return false;
}
if (!isUnblockedMove(from, to)) {
return false;
}
return true;
}
/**
* Return true iff MOVE is a legal move in the current
* position.
*/
boolean isLegal(Move move) {
return isLegal(move.from(), move.to());
}
/**
* Move FROM-TO, assuming this is a legal move.
*/
void makeMove(Square from, Square to) {
assert isLegal(from, to);
if (!isLegal(from)) {
throw new IllegalArgumentException();
}
put(get(from), to);
put(EMPTY, from);
for (int x = 0; x < 4; x++) {
Square c = to.rookMove(x, 2);
if (c != null) {
capture(to, c);
}
}
if ((get(to.col(), to.row()) == KING) && to.isEdge()) {
_winner = WHITE;
}
_moveCount++;
checkRepeated();
_turn = _turn.opponent();
}
/**
* Move FROM-TO, assuming this is a legal move.
*
* @param s : takes a board string to decode.
* @return string of decoded board
*
*/
Piece[][] decode(String s) {
char[] arr = s.toCharArray();
int a = 0;
int b = 0;
Piece[][] newb1 = new Piece[SIZE][SIZE];
for (int i = 1; i < arr.length; i++) {
Piece c = convPiece(arr[i]);
newb1[a][b] = c;
if (a == SIZE - 1) {
b += 1;
a = 0;
} else {
a++;
}
}
return newb1;
}
/**
* Move FROM-TO, assuming this is a legal move.
*
* @param c : takes a char to convert to piece.
* @return Piece
*
*/
Piece convPiece(char c) {
if (c == 'W') {
return WHITE;
} else if (c == 'B') {
return BLACK;
} else if (c == '-') {
return EMPTY;
} else {
return KING;
}
}
/**
* Move according to MOVE, assuming it is a legal move.
*/
void makeMove(Move move) {
makeMove(move.from(), move.to());
}
/**
* Capture the piece between SQ0 and SQ2, assuming a piece just moved to
* SQ0 and the necessary conditions are satisfied.
*/
private void capture(Square sq0, Square sq2) {
assert sq0.between(sq2) != null;
assert sq2 != null;
Piece p2 = get(sq2.col(), sq2.row());
Square middlesq = sq0.between(sq2);
Piece pMiddle = get(middlesq.col(), middlesq.row());
Piece p0 = get(sq0.col(), sq0.row());
if (Square.exists(sq0.col(), sq2.row())
&& Square.exists(sq2.col(), sq2.row())) {
if (sq2 != THRONE && middlesq
!= THRONE && sq0 != THRONE) {
if (p2.side() == p0.side()) {
if (pMiddle == p0.opponent()) {
put(EMPTY, middlesq);
}
} else if (p0 == KING || p2 == KING) {
if (p0 == WHITE || p2 == WHITE) {
if (pMiddle == BLACK) {
put(EMPTY, middlesq);
}
}
}
}
if (pMiddle == KING) {
if ((p0 == BLACK || p2 == BLACK)
&& (sq2 == THRONE || sq0 == THRONE)) {
if (get(sq0.diag1(sq2).col(),
sq0.diag1(sq2).row()) == BLACK
&& get(sq0.diag2(sq2).col(),
sq0.diag2(sq2).row()) == BLACK) {
put(EMPTY, middlesq);
_winner = BLACK;
}
} else if (p0 == BLACK && p2 == BLACK) {
if ((get(sq0.diag1(sq2).col(),
sq0.diag1(sq2).row()) == BLACK
|| get(sq0.diag2(sq2).col(),
sq0.diag2(sq2).row()) == BLACK)
&& (sq0.diag1(sq2) == THRONE
|| sq0.diag2(sq2) == THRONE)) {
put(EMPTY, middlesq);
_winner = BLACK;
}
}
}
capture2(sq0, sq2);
}
}
/** This method is continuing capture.
* @param sq0 square0
* @param sq2 square2
* */
private void capture2(Square sq0, Square sq2) {
Piece p2 = get(sq2.col(), sq2.row());
Square middlesq = sq0.between(sq2);
Piece pMiddle = get(middlesq.col(), middlesq.row());
Piece p0 = get(sq0.col(), sq0.row());
Piece sThrone = get(STHRONE.col(), STHRONE.row());
Piece nThrone = get(NTHRONE.col(), NTHRONE.row());
Piece wThrone = get(WTHRONE.col(), WTHRONE.row());
Piece eThrone = get(ETHRONE.col(), ETHRONE.row());
if (sq2 == THRONE && p2 == KING
|| p0 == KING && sq0 == THRONE) {
if (p0 == BLACK && pMiddle == WHITE
|| p2 == BLACK && pMiddle == WHITE) {
if (nThrone == BLACK && wThrone
== BLACK && sThrone == BLACK
|| wThrone == BLACK && sThrone
== BLACK && eThrone == BLACK
|| sThrone == BLACK && eThrone
== BLACK && nThrone == BLACK
|| eThrone == BLACK && nThrone
== BLACK && wThrone == BLACK) {
put(EMPTY, middlesq);
}
}
}
if (p0 == BLACK && p2
== BLACK && pMiddle == WHITE) {
put(EMPTY, middlesq);
}
if (p0 == WHITE && p2
== WHITE && pMiddle == BLACK) {
put(EMPTY, middlesq);
}
if (p0 == BLACK && p2 == BLACK && pMiddle
== KING && middlesq != THRONE) {
if (middlesq != WTHRONE || middlesq != ETHRONE
|| middlesq != STHRONE || middlesq != NTHRONE) {
put(EMPTY, middlesq);
_winner = BLACK;
}
}
capture3(sq0, sq2);
}
/** This method is continuing capture2.
* @param sq0 square0
* @param sq2 square2
* */
public void capture3(Square sq0, Square sq2) {
Piece p2 = get(sq2.col(), sq2.row());
Square middlesq = sq0.between(sq2);
Piece pMiddle = get(middlesq.col(), middlesq.row());
Piece p0 = get(sq0.col(), sq0.row());
Piece sThrone = get(STHRONE.col(), STHRONE.row());
Piece nThrone = get(NTHRONE.col(), NTHRONE.row());
Piece wThrone = get(WTHRONE.col(), WTHRONE.row());
Piece eThrone = get(ETHRONE.col(), ETHRONE.row());
if (sq0 == THRONE || sq2 == THRONE) {
if (sq0 == THRONE && p0 == KING) {
if (pMiddle == p2.opponent()) {
put(EMPTY, middlesq);
}
} else if (sq2 == THRONE && p2 == KING) {
if (p0 == WHITE && pMiddle == p0.opponent()) {
put(EMPTY, middlesq);
}
}
}
if (pMiddle == KING && middlesq == THRONE) {
if (wThrone == BLACK && eThrone == BLACK
&& sThrone == BLACK && nThrone == BLACK) {
put(EMPTY, middlesq);
_winner = BLACK;
}
}
if (sq2 == THRONE && get(ETHRONE) == KING
&& get(WTHRONE) == WHITE
&& get(STHRONE) == WHITE) {
if (p0 == BLACK && pMiddle == WHITE) {
put(EMPTY, middlesq);
}
if (p0 == WHITE && pMiddle == BLACK) {
put(EMPTY, middlesq);
}
}
}
/**
* Undo one move. Has no effect on the initial board.
*/
void undo() {
if (_moveCount > 0) {
undoPosition();
this._turn = convPiece(boars.peek().charAt(0)).opponent();
}
}
/**
* Remove record of current position in the set of positions encountered,
* unless it is a repeated position or we are at the first move.
*/
private void undoPosition() {
if (!_repeated && moveCount() > 0) {
boars.pop();
this._board = decode(boars.peek());
_moveCount = _moveCount - 1;
}
}
/**
* Clear the undo stack and board-position counts. Does not modify the
* current position or win status.
*/
void clearUndo() {
while (!boars.isEmpty()) {
boars.pop();
}
_moveCount = 0;
_repeated = false;
}
/**
* Return a new mutable list of all legal moves on the current board for
* SIDE (ignoring whose turn it is at the moment).
*/
List<Move> legalMoves(Piece side) {
ArrayList<Square> squa = new ArrayList<Square>();
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
if (get(i, j) == side) {
squa.add(sq(i, j));
}
}
}
ArrayList<Move> possiblemv = new ArrayList<Move>();
for (Square s : squa) {
for (int x = 0; x < SIZE; x++) {
for (int y = 0; y < SIZE; y++) {
if (isLegal(s, sq(x, y))) {
possiblemv.add(mv(s, sq(x, y)));
}
}
}
}
return possiblemv;
}
/**
* Return true iff SIDE has a legal move.
*/
boolean hasMove(Piece side) {
if (legalMoves(side).size() > 0) {
return true;
}
return false;
}
@Override
public String toString() {
return toString(true);
}
/**
* Return a text representation of this Board. If COORDINATES, then row
* and column designations are included along the left and bottom sides.
*/
String toString(boolean coordinates) {
Formatter out = new Formatter();
for (int r = SIZE - 1; r >= 0; r -= 1) {
if (coordinates) {
out.format("%2d", r + 1);
} else {
out.format(" ");
}
for (int c = 0; c < SIZE; c += 1) {
out.format(" %s", get(c, r));
}
out.format("%n");
}
if (coordinates) {
out.format(" ");
for (char c = 'a'; c <= 'i'; c += 1) {
out.format(" %c", c);
}
out.format("%n");
}
return out.toString();
}
/**
* Return the locations of all pieces on SIDE.
*/
private HashSet<Square> pieceLocations(Piece side) {
assert side != EMPTY;
HashSet<Square> plocations = new HashSet<Square>();
for (int i = 0; i < SIZE; i++) {
for (int j = 0; j < SIZE; j++) {
if (get(i, j) == side) {
plocations.add(sq(i, j));
}
}
}
return plocations;
}
/**
* Return the contents of _board in the order of SQUARE_LIST as a sequence
* of characters: the toString values of the current turn and Pieces.
*/
String encodedBoard() {
char[] result = new char[Square.SQUARE_LIST.size() + 1];
result[0] = turn().toString().charAt(0);
for (Square sq : SQUARE_LIST) {
result[sq.index() + 1] = get(sq).toString().charAt(0);
}
return new String(result);
}
/**
* Piece whose turn it is (WHITE or BLACK).
*/
private Piece _turn = BLACK;
/**
* Cached value of winner on this board, or EMPTY if it has not been.
* computed.
*/
private Piece _winner = EMPTY;
/**
* Number of (still undone) moves since initial position.
*/
private int _moveCount = 0;
/**
* True when current board is a repeated position (ending the game).
*/
/**
* True when current board is a repeated position (ending the game).
*/
private boolean _repeated;
/**
* This is the limit on the number of moves.
*/
private int _lim;
/**
* This is my board.
*/
private Piece[][] _board;
/**
* This is a kingposition.
*/
private Square _kingpos;
/**
* Hashet of encoded boards.
*/
private Stack<String> boars = new Stack<String>();
/**
* This is a variable which stores the capture counts of black.
*/
private int blackcapcount = 0;
/**
* This is a variable which stores the capture counts of white.
*/
private int whitecapcount = 0;
/**
* This is the current move.
*/
private Move currmove = null;
}
| [
"noreply@github.com"
] | noreply@github.com |
7a0ed339a0868d1f065f36e8ccb77c81e79ec840 | 3a6637d0a51b8ae3f75498de9182097e428f72a0 | /workspace_java/4370 Program 2/src/program2/FileList.java | 5599dd30bc478179644189427f237c1a652638e6 | [] | no_license | maizaAvaro/side_pieces | aa37e4213c6eddf3bed3fcc10905c2190abd9809 | 3df7bb99b59bd26f7661048611de13e8c8f4de24 | refs/heads/master | 2016-09-01T18:22:41.598019 | 2014-08-25T21:05:39 | 2014-08-25T21:05:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,232 | java | package program2;
/*******************************************************************************
* @file FileList.java
*/
import java.io.*;
import static java.lang.System.out;
import java.util.*;
/*******************************************************************************
* This class allows data tuples/tuples (e.g., those making up a relational table)
* to be stored in a random access file. This implementation requires that each
* tuple be packed into a fixed length byte array.
*/
public class FileList
extends AbstractList <Comparable []>
implements List <Comparable []>, RandomAccess
{
/** File extension for data files.
*/
private static final String EXT = ".dat";
/** The random access file that holds the tuples.
*/
private RandomAccessFile file;
/** The table it is used to store.
*/
private final Table table;
/** The number bytes required to store a "packed tuple"/record.
*/
private final int recordSize;
/** Counter for the number of tuples in this list.
*/
private int nRecords = 0;
/***************************************************************************
* Construct a FileList.
* @param _table the name of list
* @param _recordSize the size of tuple in bytes.
*/
public FileList (Table _table, int _recordSize)
{
table = _table;
recordSize = _recordSize;
try {
file = new RandomAccessFile (table.getName () + EXT, "rw");
} catch (FileNotFoundException ex) {
file = null;
out.println ("FileList.constructor: unable to open - " + ex);
} // try
} // constructor
/***************************************************************************
* Add a new tuple into the file list by packing it into a record and writing
* this record to the random access file. Write the record either at the
* end-of-file or into a empty slot.
* @param tuple the tuple to add
* @return whether the addition succeeded
*/
public boolean add (Comparable [] tuple)
{
byte [] record = table.pack(tuple); // FIX: table.pack (tuple);
if (record.length != recordSize) {
out.println ("FileList.add: wrong record size " + record.length);
return false;
}
try {
file.seek(recordSize * nRecords);
file.write(record);
nRecords++;
}
catch (EOFException e) {
System.out.println(e.getStackTrace());
}
catch (IOException e) {
System.out.println(e.getStackTrace());
}
return true;
} // add
/***************************************************************************
* Get the ith tuple by seeking to the correct file position and reading the
* record.
* @param i the index of the tuple to get
* @return the ith tuple
*/
public Comparable [] get (int i)
{
if (i >= nRecords || i < 0) {
System.out.println("index out of bounds");
return null;
}
byte [] record = new byte [recordSize];
try {
file.seek(recordSize * i);
file.read(record);
}
catch (EOFException e) {
System.out.println(e.getStackTrace());
}
catch (IOException e) {
System.out.println(e.getStackTrace());
}
return table.unpack(record);
} // get
/***************************************************************************
* Return the size of the file list in terms of the number of tuples/records.
* @return the number of tuples
*/
public int size ()
{
return nRecords;
} // size
/***************************************************************************
* Close the file.
*/
public void close ()
{
try {
file.close ();
} catch (IOException ex) {
out.println ("FileList.close: unable to close - " + ex);
} // try
} // close
} // FileList class | [
"ntray1@gmail.com"
] | ntray1@gmail.com |
b709aaffbbfe683e76f6f29093f548b0b99658ca | a49038245f0658cc78065c53ad87495ae81885fc | /src/main/java/JPosServer.java | aa5f2d176977deee621a29786bdd14bdf5e826af | [] | no_license | puguhTri/server-jpos | 312e6b0522e6cf961f695124e235cd8d7ac3d699 | 7d07e01faf60070547fbfba380ff08e7297e1632 | refs/heads/main | 2023-08-07T15:08:28.143051 | 2021-09-19T07:55:19 | 2021-09-19T07:55:19 | 408,065,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | import org.jpos.iso.ISOException;
import org.jpos.q2.Q2;
public class JPosServer {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws ISOException {
System.out.println("Server Start");
Q2 aplikasiJpos = new Q2();
aplikasiJpos.start();
System.out.println("Server UP");
}
}
| [
"puguh@powercommerce.asia"
] | puguh@powercommerce.asia |
1e58460b62045334d2701675f05751c5d438923e | cad9062037e02780811e4ba1f9754376f11a0565 | /NoSpeakableText/GalleryApp/app/src/test/java/com/maronean/andy/galleryapp/ExampleUnitTest.java | 1dc2e4ce9a3704840ae99a3743c7679797d3725b | [] | no_license | maronean/Accessibility-Test-Oracle | a4e071bf8dc6c4888f42deadf10e882c998c1942 | 8dc228b9c8f67d8da3844e39ebbc5cecf3eabb42 | refs/heads/master | 2021-01-15T22:10:13.458138 | 2017-08-10T06:30:24 | 2017-08-10T06:30:24 | 99,888,636 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.maronean.andy.galleryapp;
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);
}
} | [
"Andy@Andrews-MacBook-Pro.local"
] | Andy@Andrews-MacBook-Pro.local |
023e962bf100417494e4747b9ae68d2de0b592c8 | c6dc3346f5bc2e63b18d1491b3be4f9ccebe3209 | /src/main/java/com/hotelserver/model/booking/ErrorsType.java | 59a93c7afeb4b125363aa00f492b19f87fa40c76 | [] | no_license | codingBitsKolkata/hotel-server | bd3293172fa5c796454d59f23b333b698765adcc | 97e5c1c3229eef72992cdbd01436f93158ba3103 | refs/heads/master | 2020-04-13T14:16:18.712379 | 2019-03-27T06:40:00 | 2019-03-27T06:40:00 | 163,256,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,194 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// 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: 2019.03.13 at 11:52:17 PM IST
//
package com.hotelserver.model.booking;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ErrorsType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ErrorsType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Error" type="{http://www.opentravel.org/OTA/2003/05}ErrorType" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ErrorsType", propOrder = {
"error"
})
public class ErrorsType {
@XmlElement(name = "Error", required = true)
protected List<ErrorType> error;
/**
* Gets the value of the error property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the error property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getError().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ErrorType }
*
*
*/
public List<ErrorType> getError() {
if (error == null) {
error = new ArrayList<ErrorType>();
}
return this.error;
}
}
| [
"avirup.pal@gmail.com"
] | avirup.pal@gmail.com |
5410ac7148591d250118016dbf1bd8e06e7b2c48 | 7ffbbcd59fe2f97214dce9e8d7d955dfdd066966 | /noark-network/src/main/java/xyz/noark/network/init/PolicyFileHandler.java | a5589022fcac89ae5b0df661122b92d8eba8622b | [
"LicenseRef-scancode-mulanpsl-1.0-en",
"LicenseRef-scancode-unknown-license-reference",
"MulanPSL-1.0"
] | permissive | stephenlam520/noark3 | fcfda6c692c7d76bc70a1870dbfb0c8f9e71ff39 | ac73971f8535ed44246b0a6536618de135a4a493 | refs/heads/master | 2023-01-07T02:03:33.391288 | 2020-11-10T06:00:52 | 2020-11-10T06:00:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,800 | java | /*
* Copyright © 2018 www.noark.xyz All Rights Reserved.
*
* 感谢您选择Noark框架,希望我们的努力能为您提供一个简单、易用、稳定的服务器端框架 !
* 除非符合Noark许可协议,否则不得使用该文件,您可以下载许可协议文件:
*
* http://www.noark.xyz/LICENSE
*
* 1.未经许可,任何公司及个人不得以任何方式或理由对本框架进行修改、使用和传播;
* 2.禁止在本项目或任何子项目的基础上发展任何派生版本、修改版本或第三方版本;
* 3.无论你对源代码做出任何修改和改进,版权都归Noark研发团队所有,我们保留所有权利;
* 4.凡侵犯Noark版权等知识产权的,必依法追究其法律责任,特此郑重法律声明!
*/
package xyz.noark.network.init;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import xyz.noark.core.annotation.Component;
import xyz.noark.network.InitializeHandler;
import static xyz.noark.log.LogHelper.logger;
/**
* Flash所需要的策略文件.
*
* @author 小流氓[176543888@qq.com]
* @since 3.0
*/
@Component(name = "<policy-file-request/>\0")
public class PolicyFileHandler implements InitializeHandler {
private final static byte[] POLICY = "<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\"/></cross-domain-policy>\0".getBytes();
@Override
public void handle(ChannelHandlerContext ctx) {
ctx.writeAndFlush(Unpooled.wrappedBuffer(POLICY)).addListener(ChannelFutureListener.CLOSE);
logger.debug("无法访问843端口,从主端口获取安全策略文件 ip={}", ctx.channel().remoteAddress());
}
} | [
"176543888@qq.com"
] | 176543888@qq.com |
72e9a2e7ef49bc06016c2de46f17c90d5840d66e | 5162b4bee533f04856fcaf2ef6669e189184d547 | /realm-browser/src/main/java/de/jonasrottmann/realmbrowser/models/model/ModelPojo.java | f94f36e900efb27ea82ae413f674ec221f45d876 | [
"MIT"
] | permissive | jonasrottmann/realm-browser | c22f96e65ad1e3cc7b85ab557997b930c314dfd7 | 1b39fc356c6f957c730e33e6edd8b357e471daa3 | refs/heads/release | 2020-04-12T02:26:19.033328 | 2017-06-06T10:43:13 | 2017-06-06T10:43:13 | 52,554,746 | 116 | 17 | null | 2017-06-30T14:35:53 | 2016-02-25T20:32:00 | Java | UTF-8 | Java | false | false | 607 | java | package de.jonasrottmann.realmbrowser.models.model;
import android.support.annotation.RestrictTo;
import io.realm.RealmModel;
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public class ModelPojo {
final Class<? extends RealmModel> klass;
long count;
public ModelPojo(Class<? extends RealmModel> klass, long count) {
this.klass = klass;
this.count = count;
}
public Class<? extends RealmModel> getKlass() {
return klass;
}
public long getCount() {
return count;
}
public void setCount(long count) {
this.count = count;
}
}
| [
"jonasrottmann@gmail.com"
] | jonasrottmann@gmail.com |
e79f9951dc2042cec377a2998c97724811c8aefd | 752209e0f5db4a8823e899e84a87bb8f5fc06184 | /src/DSA/DP/Try_1/scs.java | 1d4aea0932818676bb65b6a451092c628d0f951f | [] | no_license | anubhav1006/Programming | d6f4161771444255753a2d32f7b91ec6f876daa7 | 8fe60df525253da1720d548c3803b254bacdc536 | refs/heads/master | 2021-07-05T20:46:10.339479 | 2020-11-06T04:12:24 | 2020-11-06T04:12:24 | 198,764,807 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,581 | java | package DSA.DP.Try_1;
import java.util.Map;
//Shortest Common Supersequence
public class scs {
public static void main(String[] args) {
String a = "algorithm";
String b = "rhythm";
char[] arr1 = a.toCharArray();
char[] arr2 = b.toCharArray();
System.out.println(scs_print(arr1,arr2,arr1.length,arr2.length));
}
private static int scs_print(char[] arr1, char[] arr2, int m, int n) {
int[][] dp = new int[m+1][n+1];
for(int i=0;i<=m;i++){
for (int j = 0; j <=n; j++) {
if(i==0)
dp[i][j] = j;
else if(j==0)
dp[i][j]= i;
else if (arr1[i-1]==arr2[j-1]){
dp[i][j] = dp[i-1][j-1]+1;
}else {
dp[i][j] = 1+Math.min(dp[i-1][j],dp[i][j-1]);
}
}
}
String res = "";
int i = m,j=n;
while(i>0&& j>0){
if(arr1[i-1]==arr2[j-1]){
res = arr1[i-1]+res;
i--;
j--;
}else{
if(dp[i-1][j]<dp[i][j-1]){
res = arr1[i-1]+res;
i--;
}else {
res = arr2[j-1]+res;
j--;
}
}
}
while(i>0){
res=arr1[i-1]+res;
i--;
}
while(j>0){
res = arr2[j-1]+res;
j--;
}
System.out.println(res);
return dp[m][n];
}
}
| [
"aj1006.aj@gmail.com"
] | aj1006.aj@gmail.com |
e6ecc8c45eba09e777da2c6613ec8a4c8f252aca | 10cef5bf6d1c3391d9bce5dda082794e8033f115 | /src/main/java/com/example/geocoder/config/FeignConfiguration.java | 55e19c3c0fba9b83e4bb06bce1c466cf1b3a0f63 | [] | no_license | ArtemAlt/Geocoder | e586f7fd67734b57464e006f32ef22f7d09691bf | 55e8408fafc0b3a8b9b8f2bbe76bdb80f9d608b6 | refs/heads/master | 2023-08-07T03:28:48.995584 | 2021-09-23T12:15:53 | 2021-09-23T12:15:53 | 409,575,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 515 | java | package com.example.geocoder.config;
import com.example.geocoder.exceptions.CustomErrorDecoder;
import feign.codec.ErrorDecoder;
import feign.okhttp.OkHttpClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class FeignConfiguration {
@Bean
public OkHttpClient client() {
return new OkHttpClient();
}
@Bean
public ErrorDecoder errorDecoder() {
return new CustomErrorDecoder();
}
}
| [
"artem.altunin.vit@gmail.com"
] | artem.altunin.vit@gmail.com |
23ace8dba0d82228471cb4a4ab32fd92b09d3437 | b1bd1a82596e1baeee23f60866afb400cd45310e | /Saim_Act2/src/fact_metodo/MetodoDevolucion.java | 43684b6622c6e0f86a06dea4b8cc685c5a1b0173 | [] | no_license | yulibeth/pruebaS | 68b9b67f819a0a4f688da559de29366e728d8f94 | 8ad5f2c7658a6be4598a6cce46758c932f12ceb9 | refs/heads/master | 2021-01-09T21:48:04.802054 | 2015-05-21T21:34:22 | 2015-05-21T21:34:22 | 36,033,863 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 28,331 | java | package fact_metodo;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.Time;
import adm_logica.Conexion;
public class MetodoDevolucion {
public java.sql.ResultSet reportedev(String cons){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery(" SELECT DISTINCT CONCAT('DEV',ffd.consDev)consecutivo, fn.consecutivo, fef.valor, fef.razon_social, fef.nombre_paciente,ffd.motivo, CONCAT(sdt.nombre,' ',sdt.apellido) usuario, ffd.fecha "+
"FROM fact_factdev ffd, fact_movfacturas ffm, fact_numeradas fn, seg_usuario su, fact_facturas_dev ffdev , fact_enc_factura fef, seg_datos_personales sdt "+
"WHERE ffd.consDev=ffdev.consdev AND ffdev.codFact=ffm.codFactNumerada AND fn.cod_fact_numerada=ffm.codFactNumerada AND fef.cod_enc_factura=fn.cod_enc_fact_fk "+
"AND ffd.cod_usuario=su.usu_codigo AND sdt.dat_codigo=su.dat_codigo_fk AND ffd.consDev= '"+cons+"'");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>reportedev "+ex);
}
return rs;
}
public java.sql.ResultSet GeneraSQLCtaFactDev(String sql, String ri){
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
if(ri.equals("1")){
rs=st.executeQuery(" SELECT DISTINCT CONCAT('DEV0000',ffd.consDev)consecutivo,ffd.valor,ffd.fecha,ae.nombre_entidad,CONCAT(sdt.nombre,' ',sdt.apellido) usuario,ftd.descripcion, ffd.consDev "+
"FROM fact_factdev ffd, seg_usuario su, seg_datos_personales sdt, fact_numeradas fn, fact_tipodevoluciones ftd, "+
"fact_facturas_devueltas ffdev,fact_enc_factura fef, adm_admisiones ad, adm_paciente ap, adm_entidad ae "+
" WHERE ffd.cod_usuario=su.usu_codigo AND su.dat_codigo_fk=sdt.dat_codigo AND ffd.consDev=ffdev.consdev "+
" AND ffdev.codFact=fn.cod_fact_numerada AND fn.cod_enc_fact_fk=fef.cod_enc_factura "+
"AND fef.cod_admision=ad.adm_numero_ingreso AND ad.pac_codigo_paciente_fk=ap.pac_codigo_paciente "+
"AND fef.cod_eps=ae.ent_nit AND ftd.codigo=ffd.motivo "+sql);
}
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>GeneraSQLCtaFactDev "+ex);
}
return rs;
}
public java.sql.ResultSet FactEst168(String sql){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT fn.cod_fact_numerada,fn.consecutivo,CONCAT(p.nombre,' ',p.primer_apellido,' ',p.segundo_apellido) paciente, " +
"CONCAT(p.tipo_documento,' ',p.numero_documento) documento,fef.fecha_ingreso AS 'f.ingreso', IF(fef.fecha_egreso<>NULL,'Sin alta',fef.fecha_egreso) AS 'f.egreso', " +
"fef.valor,ae.nombre_entidad,am.nombre,fn.estadoFact " +
"FROM fact_numeradas fn,fact_enc_factura fef,adm_entidad ae,adm_paciente p, adm_admisiones adm, adm_municipio am " +
"WHERE (fn.estadoFact='8' or fn.estadoFact='6' or fn.estadoFact='1' or fn.estadoFact='2') " +
"AND fn.cod_enc_fact_fk=fef.cod_enc_factura " +
"AND fef.cod_eps=ae.ent_nit " +
"AND fef.cod_admision=adm.adm_numero_ingreso " +
"AND adm.pac_codigo_paciente_fk=p.pac_codigo_paciente " +
"AND p.mun_codigo_fk=am.muni_cod"+sql+" ORDER BY fn.consecutivo ");
System.out.println("SELECT fn.cod_fact_numerada,fn.consecutivo,CONCAT(p.nombre,' ',p.primer_apellido,' ',p.segundo_apellido) paciente, " +
"CONCAT(p.tipo_documento,' ',p.numero_documento) documento,fef.fecha_ingreso AS 'f.ingreso', IF(fef.fecha_egreso<>NULL,'Sin alta',fef.fecha_egreso) AS 'f.egreso', " +
"fef.valor,ae.nombre_entidad,am.nombre,fn.estadoFact " +
"FROM fact_numeradas fn,fact_enc_factura fef,adm_entidad ae,adm_paciente p, adm_admisiones adm, adm_municipio am " +
"WHERE (fn.estadoFact='8' or fn.estadoFact='6' or fn.estadoFact='1' or fn.estadoFact='2') " +
"AND fn.cod_enc_fact_fk=fef.cod_enc_factura " +
"AND fef.cod_eps=ae.ent_nit " +
"AND fef.cod_admision=adm.adm_numero_ingreso " +
"AND adm.pac_codigo_paciente_fk=p.pac_codigo_paciente " +
"AND p.mun_codigo_fk=am.muni_cod"+sql+" ORDER BY fn.consecutivo ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>FactEst168 "+ex);
}
return rs;
}
public java.sql.ResultSet Fact2Est168(String sql){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT fn.cod_fact_numerada,fn.consecutivo,CONCAT(p.nombre,' ',p.primer_apellido,' ',p.segundo_apellido) paciente, " +
"CONCAT(p.tipo_documento,' ',p.numero_documento) documento,fef.fecha_ingreso AS 'f.ingreso', IF(fef.fecha_egreso<>NULL,'Sin alta',fef.fecha_egreso) AS 'f.egreso', " +
"fef.valor,ae.nombre_entidad,am.nombre,fn.estadoFact " +
"FROM fact_numeradas fn,fact_enc_factura fef,adm_entidad ae,adm_paciente p, adm_admisiones adm, adm_municipio am, fact_facturas_enviadas ffe " +
"WHERE (fn.estadoFact='8' or fn.estadoFact='6' or fn.estadoFact='1' or fn.estadoFact='2') " +
"AND fn.cod_enc_fact_fk=fef.cod_enc_factura " +
"AND fef.cod_eps=ae.ent_nit " +
"AND fef.cod_admision=adm.adm_numero_ingreso " +
"AND adm.pac_codigo_paciente_fk=p.pac_codigo_paciente " +
"AND p.mun_codigo_fk=am.muni_cod AND ffe.codFact=fn.cod_fact_numerada"+sql+" ORDER BY fn.consecutivo ");
System.out.println("SELECT fn.cod_fact_numerada,fn.consecutivo,CONCAT(p.nombre,' ',p.primer_apellido,' ',p.segundo_apellido) paciente, " +
"CONCAT(p.tipo_documento,' ',p.numero_documento) documento,fef.fecha_ingreso AS 'f.ingreso', IF(fef.fecha_egreso<>NULL,'Sin alta',fef.fecha_egreso) AS 'f.egreso', " +
"fef.valor,ae.nombre_entidad,am.nombre,fn.estadoFact " +
"FROM fact_numeradas fn,fact_enc_factura fef,adm_entidad ae,adm_paciente p, adm_admisiones adm, adm_municipio am, fact_facturas_enviadas ffe " +
"WHERE (fn.estadoFact='8' or fn.estadoFact='6' or fn.estadoFact='1' or fn.estadoFact='2') " +
"AND fn.cod_enc_fact_fk=fef.cod_enc_factura " +
"AND fef.cod_eps=ae.ent_nit " +
"AND fef.cod_admision=adm.adm_numero_ingreso " +
"AND adm.pac_codigo_paciente_fk=p.pac_codigo_paciente " +
"AND p.mun_codigo_fk=am.muni_cod AND ffe.codFact=fn.cod_fact_numerada"+sql);
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>Fact2Est168 "+ex);
}
return rs;
}
public java.sql.ResultSet BuscarNotasCredito(String codfact, String est){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
if(est.equals("1")){
//enviada
rs=st.executeQuery("SELECT valornc from fact_facturas_enviadas where codFact='"+codfact+"' ");
}else{
if(est.equals("2")){
//radicada
rs=st.executeQuery("SELECT valornc from fact_facturas_radicadas where codFact='"+codfact+"' ");
}else{
if(est.equals("8")){
//radicacion interna
rs=st.executeQuery("SELECT valornc from fact_facturas_radicadas where codFact='"+codfact+"' ");
}else{
if(est.equals("6")){
//auditoia interna
rs=st.executeQuery("SELECT valornc from fact_facturas_auditadas where codFact='"+codfact+"' ");
}
}
}
}
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarNotasCredito "+ex);
}
return rs;
}
public java.sql.ResultSet BuscarNotasRc(String consecutivo){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT SUM(cdf.cantidad) FROM cont_detalle_factura cdf, cont_factura cf WHERE cdf.cod_fact_fk=cf.codigo AND cf.numero_factura='"+consecutivo+"' ");
System.out.println("SELECT SUM(cdf.cantidad) FROM cont_detalle_factura cdf, cont_factura cf WHERE cdf.cod_fact_fk=cf.codigo AND cf.numero_factura='"+consecutivo+"' ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarNotasRc "+ex);
}
return rs;
}
public java.sql.ResultSet Empresas(){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery(" SELECT ent_nit, nombre_entidad FROM adm_entidad ORDER BY nombre_entidad ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>Empresas "+ex);
}
return rs;
}
public java.sql.ResultSet TipoDoc(){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery(" SELECT codigo, sigla FROM adm_tipodocumento ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>Empresas "+ex);
}
return rs;
}
public java.sql.ResultSet ConsultarCodigoDevolucion(String ValorFactura,String ValorLetra,String txtCodusuario,String fecha,String Motivo){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT * FROM fact_factdev WHERE valor='"+ValorFactura+"' AND valorLetra='"+ValorLetra+"' AND cod_usuario='"+txtCodusuario+"' AND fecha='"+fecha+"' AND motivo='"+Motivo+"' ORDER BY consDev DESC LIMIT 1");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>ConsultarCodigoDevolucion "+ex);
}
return rs;
}
public java.sql.ResultSet obtenerConsecutivoCR(String ri){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
if(ri.equals("0")){
rs=st.executeQuery("SELECT consRadicado FROM fact_factradicadas ORDER BY consRadicado DESC LIMIT 1");
}
if(ri.equals("1")){
rs=st.executeQuery("SELECT consRadicado FROM fact_factradicadasi ORDER BY consRadicado DESC LIMIT 1");
}
if(ri.equals("2")){
rs=st.executeQuery("SELECT consDev FROM fact_factdev ORDER BY consDev DESC LIMIT 1");
}
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>obtenerConsecutivoCR "+ex);
}
return rs;
}
public void asignarCDevFact(String consCC,String consFact,String Fecha,String valornc){
try{
PreparedStatement ps = null;
Conexion con=new Conexion();
ps=con.conn.prepareStatement("INSERT INTO fact_facturas_devueltas(consDev,codFact,fechadev,valornc) VALUES (?,?,?,?)");
ps.setString(1,consCC);
ps.setString(2,consFact);
ps.setString(3, Fecha);
ps.setString(4, valornc);
ps.executeUpdate();
ps.close();
con.cerrar();
}catch(Exception ex){
System.out.println("ERROR EN. MetodoDevolucion>>asignarCDevFact "+ex);
}
}
public java.sql.ResultSet BuscarDetalleFacturaEnvio(String CodNumerada){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT ffr.consEnvio,(ff.valor - (fef.valor+ffr.valornc)) AS NuevoValorEnvio,fef.valor as ValorFactura,ffr.valornc FROM fact_facturas_enviadas ffr,fact_numeradas fn,fact_enc_factura fef,fact_factenviadas ff WHERE ffr.codFact=fn.cod_fact_numerada AND fn.cod_enc_fact_fk=fef.cod_enc_factura AND ff.consEnvio=ffr.consEnvio AND ffr.codFact='"+CodNumerada+"' ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarDetalleFacturaEnvio "+ex);
}
return rs;
}
public java.sql.ResultSet BuscarDetalleFacturaradicada(String CodNumerada){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT ffr.consRadicado,(ff.valor - (fef.valor+ffr.valornc)) AS NuevoValorRadicacion FROM fact_facturas_radicadas ffr,fact_numeradas fn,fact_enc_factura fef,fact_factradicadas ff WHERE ffr.codFact=fn.cod_fact_numerada AND fn.cod_enc_fact_fk=fef.cod_enc_factura AND ff.consRadicado=ffr.consRadicado AND ffr.codFact='"+CodNumerada+"' ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarDetalleFacturaradicada "+ex);
}
return rs;
}
public java.sql.ResultSet BuscarCodigoNumerada(String NumeroFactura){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT * FROM fact_numeradas where consecutivo='"+NumeroFactura+"' ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarCodigoNumerada "+ex);
}
return rs;
}
public java.sql.ResultSet BuscarMotivo(){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT * FROM fact_tipodevoluciones order by descripcion");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarMotivo "+ex);
}
return rs;
}
public java.sql.ResultSet BuscarEstadoFact(String Codfact){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT estadoFact from fact_numeradas where cod_fact_numerada='"+Codfact+"' ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarEstadoFact "+ex);
}
return rs;
}
public java.sql.ResultSet BuscarCtaE(String Codfact){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery("SELECT fn.cod_fact_numerada, ffe.consEnvio, fn.consecutivo, ffe.codigo FROM fact_facturas_enviadas ffe, fact_numeradas fn WHERE fn.cod_fact_numerada=ffe.codFact AND ffe.codFact='"+Codfact+"' ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarCtaE "+ex);
}
return rs;
}
public java.sql.ResultSet BuscarCtaA(String Codfact){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
rs=st.executeQuery(" SELECT fn.cod_fact_numerada, fa.consAudita, fn.consecutivo, fa.codigo FROM fact_facturas_auditadas fa, fact_numeradas fn WHERE fa.codFact='"+Codfact+"' AND fn.cod_fact_numerada=fa.codFact ");
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarCtaA "+ex);
}
return rs;
}
public void registroEliminacion(String codFact,String consec,String usuario,Date Fecha, Time Hora,String tabla){
try{
PreparedStatement ps = null;
Conexion con=new Conexion();
ps=con.conn.prepareStatement("INSERT INTO fact_regeliminacion(codFact,consec,Fecha,Hora,usuario,tabla) VALUES(?,?,?,?,?,?)");
//System.out.println("Valor de Motivo en insercion de factdev "+motivo);
ps.setString(1,codFact);
ps.setString(2,consec);
ps.setDate(3,Fecha);
ps.setTime(4,Hora);
ps.setString(5,usuario);
ps.setString(6,tabla);
ps.executeUpdate();
ps.close();
con.cerrar();
}catch(Exception ex){
System.out.println("ERROR EN. MetodoDevolucion>>registroEliminacion"+ex);
}
}
public void actualizarEstFactR(String codFactNum,String ea){
PreparedStatement st = null;
try{
Conexion con=new Conexion();
if(ea.equals("0")){
st= con.conn.prepareStatement("UPDATE fact_numeradas SET estadoFact='2' WHERE cod_fact_numerada='"+codFactNum+"'");
}
if(ea.equals("1")){
st= con.conn.prepareStatement("UPDATE fact_numeradas SET estadoFact='6' WHERE cod_fact_numerada='"+codFactNum+"'");
//System.out.print("UPDATE fact_numeradas SET estadoFact='6' WHERE cod_fact_numerada='"+codFactNum+"'");
}
if(ea.equals("2")){
st= con.conn.prepareStatement("UPDATE fact_numeradas SET estadoFact='8' WHERE cod_fact_numerada='"+codFactNum+"'");
}
if(ea.equals("3")){
st= con.conn.prepareStatement("UPDATE fact_numeradas SET estadoFact='0' WHERE cod_fact_numerada='"+codFactNum+"'");
//System.out.println("UPDATE fact_numeradas SET estadoFact='0' WHERE cod_fact_numerada='"+codFactNum+"'");
}
st.executeUpdate();
st.close();
con.cerrar();
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>actualizarEstFact "+ex);
ex.getMessage();
}
}
public void CrearDevolucion(String valor,String valorLetra,String cod_usuario,String fecha, String motivo){
System.out.print("cod_usuario "+cod_usuario);
try{
PreparedStatement ps = null;
Conexion con=new Conexion();
ps=con.conn.prepareStatement("INSERT INTO fact_factdev(valor,valorLetra,cod_usuario,fecha,motivo) VALUES(?,?,?,?,?)");
ps.setString(1,valor);
ps.setString(2,valorLetra);
ps.setString(3,cod_usuario);
ps.setString(4,fecha);
ps.setString(5,motivo);
ps.executeUpdate();
ps.close();
con.cerrar();
}catch(Exception ex){
System.out.println("ERROR EN. MetodoDevolucion>>CrearDevolucion "+ex);
}
}
public void asignarCuentaDev(String valor,String valorLetra,String cod_usuario,String fecha, String motivo, String ri){
//System.out.print(cod_medico);
try{
PreparedStatement ps = null;
Conexion con=new Conexion();
if(ri.equals("1")){
ps=con.conn.prepareStatement("INSERT INTO fact_factdev(valor,valorLetra,cod_usuario,fecha,motivo) VALUES(?,?,?,?,?)");
System.out.println("Valor de Motivo en insercion de factdev "+motivo);
ps.setString(1,valor);
ps.setString(2,valorLetra);
ps.setString(3,cod_usuario);
ps.setString(4,fecha);
ps.setString(5,motivo);
ps.executeUpdate();
ps.close();
}
con.cerrar();
}catch(Exception ex){
System.out.println("ERROR EN. MetodoDevolucion>>asignarCuentaDev "+ex);
}
}
public void recordEstadoFactDEV(String codFact,String estado,String fecha,String usuario,String motivo, String consecutivo){
try{
PreparedStatement ps = null;
Conexion con=new Conexion();
ps=con.conn.prepareStatement("INSERT INTO fact_movfacturas(codFactNumerada,estadoFact,fecha,usuario,Observacion,cod_Devfk) VALUES (?,?,?,?,?,?)");
System.out.print("ya se inserttaron los mov");
ps.setString(1,codFact);
ps.setString(2,estado);
ps.setString(3,fecha);
ps.setString(4,usuario);
ps.setString(5,motivo);
ps.setString(6,consecutivo);
ps.executeUpdate();
ps.close();
con.cerrar();
System.out.println("Ingresando datos a fact_movfacturas");
}catch(Exception ex){
System.out.println("ERROR EN. MetodoDevolucion>>recordEstadoFactDev "+ex);
}
}
public void ActualizarDatosCtaEnvio(String CodEnvio,String ValorNuevoCtaEnvio,String ValorLetrasCtaEnvio){
PreparedStatement st = null;
try{
Conexion con=new Conexion();
st= con.conn.prepareStatement("UPDATE fact_factenviadas SET valor='"+ValorNuevoCtaEnvio+"',valorLetra='"+ValorLetrasCtaEnvio+"' WHERE consEnvio='"+CodEnvio+"' ");
st.executeUpdate();
st.close();
con.cerrar();
}
catch(Exception ex){
System.out.println("ERROR EN MetodoDevolucion>>ActualizarDatosCtaEnvio "+ex);
}
}
public void ActualizarEstadoFactura(String CodNumerada){
PreparedStatement st = null;
try{
Conexion con=new Conexion();
st= con.conn.prepareStatement("UPDATE fact_numeradas SET estadoFact='0' WHERE cod_fact_numerada='"+CodNumerada+"' ");
st.executeUpdate();
st.close();
con.cerrar();
}
catch(Exception ex){
System.out.println("ERROR EN MetodoDevolucion>>ActualizarEstadoFactura "+ex);
}
}
public void ActualizarDatosCtaRadicacion(String CodRadicacion,String ValorNuevoCtaRadicacion,String ValorLetrasCtaRadicacion){
PreparedStatement st = null;
try{
Conexion con=new Conexion();
st= con.conn.prepareStatement("UPDATE fact_factradicadas SET valor='"+ValorNuevoCtaRadicacion+"',valorLetra='"+ValorLetrasCtaRadicacion+"' WHERE consRadicado='"+CodRadicacion+"' ");
st.executeUpdate();
st.close();
con.cerrar();
}
catch(Exception ex){
System.out.println("ERROR EN MetodoDevolucion>>ActualizarDatosCtaRadicacion "+ex);
}
}
public void EliminarFacturaCuentaEnvio(String CodNumerada){
PreparedStatement st = null;
try{
Conexion con=new Conexion();
st= con.conn.prepareStatement("delete from fact_facturas_enviadas WHERE codFact='"+CodNumerada+"' ");
st.executeUpdate();
st.close();
con.cerrar();
}
catch(Exception ex){
System.out.println("ERROR EN MetodoDevolucion>>EliminarFacturaCuentaEnvio "+ex);
}
}
public void EliminarFacturaCuentaRadicacion(String CodNumerada){
PreparedStatement st = null;
try{
Conexion con=new Conexion();
st= con.conn.prepareStatement("delete from fact_facturas_radicadas WHERE codFact='"+CodNumerada+"' ");
st.executeUpdate();
st.close();
con.cerrar();
}
catch(Exception ex){
System.out.println("ERROR EN MetodoDevolucion>>EliminarFacturaCuentaRadicacion "+ex);
}
}
public void EliminarRegCta(String codFact,String consec, String tipo){
PreparedStatement st = null;
try{
Conexion con=new Conexion();
if(tipo.equals("1")){
st= con.conn.prepareStatement(" DELETE FROM fact_facturas_enviadas WHERE consEnvio='"+consec+"' and codFact='"+codFact+"' ");
}else{
if(tipo.equals("2")){
st= con.conn.prepareStatement(" DELETE FROM fact_facturas_auditadas WHERE consAudita='"+consec+"' and codFact='"+codFact+"' ");
}else{
st= con.conn.prepareStatement(" DELETE FROM fact_facturas_radicadasi WHERE consRadicado='"+consec+"' and codFact='"+codFact+"' ");
}
}
st.executeUpdate();
st.close();
con.cerrar();
}
catch(Exception ex){
System.out.println("ERROR EN MetodoDevolucion>>EliminarRegCta "+ex);
}
}
public java.sql.ResultSet BuscarValoresCtaCobro(String consec, String tipo){
/**
*/
java.sql.ResultSet rs=null;
Statement st = null;
try{
Conexion con=new Conexion();
st = con.conn.createStatement();
if(tipo.equals("1")){
rs=st.executeQuery("SELECT fef.valor, ffenv.codFact, fn.consecutivo FROM fact_facturas_enviadas ffenv, fact_numeradas fn, fact_enc_factura fef "+
"WHERE ffenv.codFact=fn.cod_fact_numerada AND fn.cod_enc_fact_fk=fef.cod_enc_factura AND ffenv.consEnvio='"+consec+"' ");
}else{
if(tipo.equals("2")){
rs=st.executeQuery("SELECT fef.valor , a.codFact, fn.consecutivo "+
"FROM fact_facturas_auditadas a, fact_numeradas fn, fact_enc_factura fef "+
"WHERE a.codFact = fn.cod_fact_numerada AND fn.cod_enc_fact_fk = fef.cod_enc_factura AND a.consAudita='"+consec+"' ");
}else{
rs=st.executeQuery("SELECT fef.valor , a.codFact, fn.consecutivo "+
"FROM fact_facturas_radicadasi a, fact_numeradas fn, fact_enc_factura fef "+
"WHERE a.codFact = fn.cod_fact_numerada AND fn.cod_enc_fact_fk = fef.cod_enc_factura AND a.consRadicado='"+consec+"' ");
}
}
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>BuscarValoresCtaCobro "+ex);
}
return rs;
}
public void ActualizarCtaCobro(String consecutivo,long valorfact, String Let,String tipo){
PreparedStatement st = null;
try{
Conexion con=new Conexion();
if(tipo.equals("1")){
st= con.conn.prepareStatement("UPDATE fact_factenviadas SET valorLetra='"+Let+"' , valor='"+valorfact+"' WHERE consEnvio='"+consecutivo+"' ");
//System.out.println("UPDATE fact_factenviadas SET valorLetra='"+Let+"' , valor='"+valorfact+"' WHERE consEnvio='"+consecutivo+"' ");
}else{
if(tipo.equals("2")){
st= con.conn.prepareStatement("UPDATE fact_factauditadas SET valorLetra='"+Let+"' , valor='"+valorfact+"' WHERE consAudita='"+consecutivo+"' ");
}else{
st= con.conn.prepareStatement("UPDATE fact_factradicadasi SET valorLetra='"+Let+"' , valor='"+valorfact+"' WHERE consRadicado='"+consecutivo+"' ");
}
}
st.executeUpdate();
st.close();
con.cerrar();
}
catch(Exception ex){
System.out.println("Error en MetodoDevolucion>>ActualizarCtaCobro "+ex);
ex.getMessage();
}
}
public String formatMoneda(String valor){
String temp2="";
String temp1="";
int ud=1;
int logCad = valor.length();
for (int i=logCad-1;i>=0;i--){
temp2=valor.substring(i,i+1);
temp2+=temp1;
if(ud==3){
if(i!=0){
temp1="."+temp2;
}else{
temp1=temp2;
}
ud=0;
}else{
temp1=temp2;
}
ud++;
}
temp1="$ "+temp1;
return temp1;
}
}
| [
"yulibeth9@gmail.com"
] | yulibeth9@gmail.com |
d0c730ea85a4ba175617acca3ea07643fad13cf6 | e27cdf2cd0b886f998d0afed5c194b9cbfb3be88 | /src/main/java/cn/ncepu/mydeveloping/mapper/FileMapper.java | b07028c19cd4d148cd0e9c625a8118cba281fa56 | [] | no_license | 944814039yangguodong/MyDeveloping | d716b89e4269c89544b3d342f10d82f2aa821ec4 | 355ef57295d29be90f340a6b3fda460981289c40 | refs/heads/master | 2023-09-04T10:15:33.909450 | 2021-11-20T03:25:03 | 2021-11-20T03:25:03 | 384,506,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | package cn.ncepu.mydeveloping.mapper;
import cn.ncepu.mydeveloping.pojo.entity.File;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author Guodong
* @since 2021-11-13
*/
public interface FileMapper extends BaseMapper<File> {
}
| [
"944814039@qq.com"
] | 944814039@qq.com |
dcdaada1bdab49f31d8338649a55fd90f2f59e87 | 217479a23be5f98b5498f6bb0d0d22eef22bb8e9 | /codeLabsRooms/app/src/main/java/com/example/dchikhaoui/codelabsrooms/repository/WordDao.java | 711fe1fea80f856abd8ab34dd5547edd3daea555 | [] | no_license | dhouha90/codeLabsROOM | 88a0b3d84d1aad1ca83f48ee4c4685cc4061b93f | 4af056bd43311ea49b9878e325327cfec76a64a2 | refs/heads/master | 2020-03-22T11:22:33.036897 | 2018-07-06T12:40:45 | 2018-07-06T12:40:45 | 139,967,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,396 | java | package com.example.dchikhaoui.codelabsrooms.repository;
import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import com.example.dchikhaoui.codelabsrooms.Model.Word;
import java.util.List;
@Dao
public interface WordDao {
@Insert
void insert(Word word);
//There are also @Delete and @Update annotations for deleting and updating a row
/*There is no convenience annotation for deleting multiple entities,
so annotate the method with the generic @Query
Room generates all necessary code to update the LiveData when database is updated
If you use LiveData independently from Room, you have to manage updating the data.
LiveData has no publicly available methods to update the stored data.
If you, the developer, want to update the stored data, you must use MutableLiveData
instead of LiveData. The MutableLiveData class has two public methods that allow you to
set the value of a LiveData object, setValue(T) and postValue(T). Usually, MutableLiveData
is used in the ViewModel, and then the ViewModel only exposes immutable LiveData objects
to the observers.*/
@Query("DELETE FROM word_table")
void deleteAll();
@Query("SELECT * from word_table ORDER BY word ASC")
LiveData<List<Word>> getAllWords();
}
| [
"dchikhaoui@alliance.net"
] | dchikhaoui@alliance.net |
89a3a49e8f890bbb596021d0fe706c3d93bbb195 | fa07b97616b06bfbd1c81e5638ae61812331f6d0 | /qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java | 05c8e362a189b6ea52ddc88d338fb14f144d49ca | [
"Python-2.0"
] | permissive | ncdc/Qpid-1 | b386f3077d02471d5548488dc7ae713704e6ecf6 | a665bdb1c72db4fa3817db908bb7658434ae23f3 | refs/heads/master | 2020-04-12T19:41:41.440626 | 2013-02-20T15:36:02 | 2013-03-11T14:19:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,732 | 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.qpid.systest.rest;
import java.io.IOException;
import java.net.URLDecoder;
import java.util.List;
import java.util.Map;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import org.apache.qpid.client.AMQConnection;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.server.model.Connection;
import org.apache.qpid.server.model.Session;
public class ConnectionRestTest extends QpidRestTestCase
{
/**
* Message number to publish into queue
*/
private static final int MESSAGE_NUMBER = 5;
private static final int MESSAGE_SIZE = 6;
private static final String SESSIONS_ATTRIBUTE = "sessions";
private javax.jms.Connection _connection;
private javax.jms.Session _session;
public void setUp() throws Exception
{
super.setUp();
_connection = getConnection();
_session = _connection.createSession(true, javax.jms.Session.SESSION_TRANSACTED);
String queueName = getTestQueueName();
Destination queue = _session.createQueue(queueName);
MessageConsumer consumer = _session.createConsumer(queue);
MessageProducer producer = _session.createProducer(queue);
_connection.start();
// send messages
for (int i = 0; i < MESSAGE_NUMBER; i++)
{
producer.send(_session.createTextMessage("Test-" + i));
}
_session.commit();
Message m = consumer.receive(1000l);
assertNotNull("Message was not received", m);
_session.commit();
// receive the rest of messages for rollback
for (int i = 0; i < MESSAGE_NUMBER - 1; i++)
{
m = consumer.receive(1000l);
assertNotNull("Message was not received", m);
}
_session.rollback();
// receive them again
for (int i = 0; i < MESSAGE_NUMBER - 1; i++)
{
m = consumer.receive(1000l);
assertNotNull("Message was not received", m);
}
}
public void testGetAllConnections() throws Exception
{
List<Map<String, Object>> connections = getRestTestHelper().getJsonAsList("/rest/connection");
assertEquals("Unexpected number of connections", 1, connections.size());
Asserts.assertConnection(connections.get(0), (AMQConnection) _connection);
}
public void testGetVirtualHostConnections() throws Exception
{
List<Map<String, Object>> connections = getRestTestHelper().getJsonAsList("/rest/connection/test");
assertEquals("Unexpected number of connections", 1, connections.size());
Asserts.assertConnection(connections.get(0), (AMQConnection) _connection);
}
public void testGetConnectionByName() throws Exception
{
// get connection name
String connectionName = getConnectionName();
Map<String, Object> connectionDetails = getRestTestHelper().getJsonAsSingletonList("/rest/connection/test/"
+ URLDecoder.decode(connectionName, "UTF-8"));
assertConnection(connectionDetails);
}
public void testGetAllSessions() throws Exception
{
List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("/rest/session");
assertEquals("Unexpected number of sessions", 1, sessions.size());
assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
}
public void testGetVirtualHostSessions() throws Exception
{
List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("/rest/session/test");
assertEquals("Unexpected number of sessions", 1, sessions.size());
assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
}
public void testGetConnectionSessions() throws Exception
{
// get connection name
String connectionName = getConnectionName();
List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("/rest/session/test/"
+ URLDecoder.decode(connectionName, "UTF-8"));
assertEquals("Unexpected number of sessions", 1, sessions.size());
assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
}
public void testGetSessionByName() throws Exception
{
// get connection name
String connectionName = getConnectionName();
List<Map<String, Object>> sessions = getRestTestHelper().getJsonAsList("/rest/session/test/"
+ URLDecoder.decode(connectionName, "UTF-8") + "/" + ((AMQSession<?, ?>) _session).getChannelId());
assertEquals("Unexpected number of sessions", 1, sessions.size());
assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
}
private void assertConnection(Map<String, Object> connectionDetails) throws JMSException
{
Asserts.assertConnection(connectionDetails, (AMQConnection) _connection);
@SuppressWarnings("unchecked")
Map<String, Object> statistics = (Map<String, Object>) connectionDetails.get(Asserts.STATISTICS_ATTRIBUTE);
assertEquals("Unexpected value of connection statistics attribute " + Connection.BYTES_IN, MESSAGE_NUMBER
* MESSAGE_SIZE, statistics.get(Connection.BYTES_IN));
assertEquals("Unexpected value of connection statistics attribute " + Connection.BYTES_OUT, MESSAGE_SIZE
+ ((MESSAGE_NUMBER - 1) * MESSAGE_SIZE) * 2, statistics.get(Connection.BYTES_OUT));
assertEquals("Unexpected value of connection statistics attribute " + Connection.MESSAGES_IN, MESSAGE_NUMBER,
statistics.get(Connection.MESSAGES_IN));
assertEquals("Unexpected value of connection statistics attribute " + Connection.MESSAGES_OUT,
MESSAGE_NUMBER * 2 - 1, statistics.get(Connection.MESSAGES_OUT));
@SuppressWarnings("unchecked")
List<Map<String, Object>> sessions = (List<Map<String, Object>>) connectionDetails.get(SESSIONS_ATTRIBUTE);
assertNotNull("Sessions cannot be found", sessions);
assertEquals("Unexpected number of sessions", 1, sessions.size());
assertSession(sessions.get(0), (AMQSession<?, ?>) _session);
}
private void assertSession(Map<String, Object> sessionData, AMQSession<?, ?> session)
{
assertNotNull("Session map cannot be null", sessionData);
Asserts.assertAttributesPresent(sessionData, Session.AVAILABLE_ATTRIBUTES, Session.STATE, Session.DURABLE,
Session.LIFETIME_POLICY, Session.TIME_TO_LIVE, Session.CREATED, Session.UPDATED);
assertEquals("Unexpecte value of attribute " + Session.NAME, session.getChannelId() + "",
sessionData.get(Session.NAME));
assertEquals("Unexpecte value of attribute " + Session.PRODUCER_FLOW_BLOCKED, Boolean.FALSE,
sessionData.get(Session.PRODUCER_FLOW_BLOCKED));
assertEquals("Unexpecte value of attribute " + Session.CHANNEL_ID, session.getChannelId(),
sessionData.get(Session.CHANNEL_ID));
@SuppressWarnings("unchecked")
Map<String, Object> statistics = (Map<String, Object>) sessionData.get(Asserts.STATISTICS_ATTRIBUTE);
Asserts.assertAttributesPresent(statistics, Session.AVAILABLE_STATISTICS, Session.BYTES_IN, Session.BYTES_OUT,
Session.STATE_CHANGED, Session.UNACKNOWLEDGED_BYTES, Session.LOCAL_TRANSACTION_OPEN,
Session.XA_TRANSACTION_BRANCH_ENDS, Session.XA_TRANSACTION_BRANCH_STARTS,
Session.XA_TRANSACTION_BRANCH_SUSPENDS);
assertEquals("Unexpecte value of statistic attribute " + Session.UNACKNOWLEDGED_MESSAGES, MESSAGE_NUMBER - 1,
statistics.get(Session.UNACKNOWLEDGED_MESSAGES));
assertEquals("Unexpecte value of statistic attribute " + Session.LOCAL_TRANSACTION_BEGINS, 4,
statistics.get(Session.LOCAL_TRANSACTION_BEGINS));
assertEquals("Unexpecte value of statistic attribute " + Session.LOCAL_TRANSACTION_ROLLBACKS, 1,
statistics.get(Session.LOCAL_TRANSACTION_ROLLBACKS));
assertEquals("Unexpecte value of statistic attribute " + Session.CONSUMER_COUNT, 1,
statistics.get(Session.CONSUMER_COUNT));
}
private String getConnectionName() throws IOException
{
Map<String, Object> hostDetails = getRestTestHelper().getJsonAsSingletonList("/rest/virtualhost/test");
@SuppressWarnings("unchecked")
List<Map<String, Object>> connections = (List<Map<String, Object>>) hostDetails
.get(VirtualHostRestTest.VIRTUALHOST_CONNECTIONS_ATTRIBUTE);
assertEquals("Unexpected number of connections", 1, connections.size());
Map<String, Object> connection = connections.get(0);
String connectionName = (String) connection.get(Connection.NAME);
return connectionName;
}
}
| [
"robbie@apache.org"
] | robbie@apache.org |
8b56d3d4b34540ae9a203ee69f536202f5f86c40 | 6c6983979a4df0265d5eb6953db390ccd646de8c | /src/main/java/com/epam/App.java | 3a2cb9c98394950d6245ca2242c80651f5c5934d | [] | no_license | preetigoel10/PreetiGoel_1710991594_JUnit | 687c003ff6e3854222eb1e0da8f3a9ca92d03e4f | 868d805e05f14b950f9a9f04369450ca0ace5c4b | refs/heads/master | 2022-12-26T19:54:37.979795 | 2020-06-26T13:22:31 | 2020-06-26T13:22:31 | 275,149,547 | 0 | 0 | null | 2020-10-13T23:06:17 | 2020-06-26T12:21:36 | Java | UTF-8 | Java | false | false | 406 | java | package com.epam;
import java.util.Scanner;
public class App
{
public static void main( String[] args )
{
StringOperation stringOperation = new StringOperation();
System.out.println("Please enter a string");
Scanner sc = new Scanner(System.in);
String string = sc.next();
System.out.println("Result: "+stringOperation.removeAFromString(string));
}
}
| [
"preeti.goel10@gmail.com"
] | preeti.goel10@gmail.com |
044b4e585557496f8cd6a092710d0f3ca3f93f00 | f09e549c92dfebe1fb467575916ed56e6a6e327e | /snap/src/main/java/org/snapscript/tree/define/EnumInstance.java | 2196f95be6b28b4d771ecb6e95cff70df941f288 | [] | no_license | karino2/FileScripting | 10e2ff7f5d688a7a107d01f1b36936c00bc4d6ad | 4790830a22c2effacaaff6b109ced57cb6a5a230 | refs/heads/master | 2021-04-27T19:28:23.138720 | 2018-05-04T11:09:18 | 2018-05-04T11:09:18 | 122,357,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,871 | java | package org.snapscript.tree.define;
import static org.snapscript.core.Reserved.ENUM_VALUES;
import java.util.List;
import org.snapscript.core.Context;
import org.snapscript.core.InternalStateException;
import org.snapscript.core.convert.proxy.ProxyWrapper;
import org.snapscript.core.function.resolve.FunctionCall;
import org.snapscript.core.module.Module;
import org.snapscript.core.scope.Scope;
import org.snapscript.core.scope.State;
import org.snapscript.core.scope.instance.Instance;
import org.snapscript.core.type.Type;
import org.snapscript.core.variable.Value;
import org.snapscript.tree.ArgumentList;
public class EnumInstance extends StaticBlock {
private final EnumConstantGenerator generator;
private final EnumConstructorBinder binder;
private final String name;
public EnumInstance(String name, ArgumentList arguments, int index) {
this.generator = new EnumConstantGenerator(name, index);
this.binder = new EnumConstructorBinder(arguments);
this.name = name;
}
@Override
protected void allocate(Scope scope) throws Exception {
Type type = scope.getType();
State state = scope.getState();
FunctionCall call = binder.bind(scope, type);
Module module = scope.getModule();
Context context = module.getContext();
ProxyWrapper wrapper = context.getWrapper();
if(call == null){
throw new InternalStateException("No constructor for enum '" + name + "' in '" + type+ "'");
}
Value result = call.call();
Instance instance = result.getValue();
Object object = wrapper.toProxy(instance);
Value value = Value.getConstant(instance);
Value values = state.get(ENUM_VALUES);
List list = values.getValue();
generator.generate(instance, type);
state.add(name, value);
list.add(object);
}
} | [
"hogeika2@gmailcom"
] | hogeika2@gmailcom |
00e06f00a0fa3d0c6252083a29a3867dcd1c1f28 | 1c2f519a3b3dd87e269752261c2d9387552905ca | /app/src/main/java/com/kaku/colorfulnews/mvp/interactor/impl/NewsInteractorImpl.java | a0be0aea8396e896b76d9fae143e065a0eed3890 | [
"Apache-2.0"
] | permissive | luis-wang/ColorfulNews | d19d4385cbfc7c2a7f0d6023c835f0efa79ee7be | ee67a675e1e6c5b1c1fec8ac12196815aa8d73bc | refs/heads/master | 2021-01-22T00:59:06.859846 | 2016-08-20T07:24:58 | 2016-08-20T07:24:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,643 | java | /*
* Copyright (c) 2016 咖枯 <kaku201313@163.com | 3772304@qq.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.kaku.colorfulnews.mvp.interactor.impl;
import com.kaku.colorfulnews.App;
import com.kaku.colorfulnews.R;
import com.kaku.colorfulnews.repository.db.NewsChannelTableManager;
import com.kaku.colorfulnews.greendao.NewsChannelTable;
import com.kaku.colorfulnews.listener.RequestCallBack;
import com.kaku.colorfulnews.mvp.interactor.NewsInteractor;
import java.util.List;
import javax.inject.Inject;
import rx.Observable;
import rx.Subscriber;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
/**
* @author 咖枯
* @version 1.0 2016/6/2
*/
public class NewsInteractorImpl implements NewsInteractor<List<NewsChannelTable>> {
@Inject
public NewsInteractorImpl() {
}
@Override
public Subscription lodeNewsChannels(final RequestCallBack<List<NewsChannelTable>> callback) {
return Observable.create(new Observable.OnSubscribe<List<NewsChannelTable>>() {
@Override
public void call(Subscriber<? super List<NewsChannelTable>> subscriber) {
NewsChannelTableManager.initDB();
subscriber.onNext(NewsChannelTableManager.loadNewsChannelsMine());
subscriber.onCompleted();
}
})
.unsubscribeOn(Schedulers.io())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<List<NewsChannelTable>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
callback.onError(App.getAppContext().getString(R.string.db_error));
}
@Override
public void onNext(List<NewsChannelTable> newsChannelTables) {
callback.success(newsChannelTables);
}
});
}
}
| [
"kaku201313@163.com"
] | kaku201313@163.com |
d0a9a107ea8b0c758f9bd7d13df237eb75312660 | fe30be3159f587b89c531b4dd23f52e3fb9e38a0 | /DataStructures & Algorithm/lecture1/Demo1.java | afca23abe59454dc9782ac8342dd3a15701c67f3 | [] | no_license | aka2029/JavaComplete | f556b86279383cb47d0fba22304f26561f7f4c1e | a2b04dafc9467fd2fbf2c72f80645cbbc0824a64 | refs/heads/master | 2023-01-03T17:25:55.450500 | 2020-11-03T08:34:22 | 2020-11-03T08:34:22 | 240,646,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | // An Erudite Professor - Pg:3
package lecture1;
import java.util.HashMap;
public class Demo1 {
public static void main(String[] args) {
/*
* Approach-1
*
* int arr [] = {1, 2, 3, 4, 7, 55, 1000, 444}; for(int i = 0; i< arr.length-1;
* i++) { for(int j = i + 1; j<arr.length; j++) { if(arr[i] == arr[j]) {
* System.out.println("Boys Party"); return; } } }
* System.out.println("Girls Party");
*/
// Approach-2 O(N)
int arr[] = { 1, 2, 3, 1, 7, 55, 1000, 444 };
HashMap<Integer, Boolean> map = new HashMap<>();
for (int i = 0; i < arr.length; i++) {
if (map.get(arr[i]) != null) {
System.out.println("Boys Party");
return;
}
map.put(arr[i], true);
}
System.out.println("Girls Party");
// Approach-3
/* Hint: int hash[] = new int[10001] & hash[arr[i]] = 1 */
}
}
| [
"asaks22@gmail.com"
] | asaks22@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.