blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M โ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e0aacfa01f4307e8e5814723d9bbdd3c00f36397 | 1dba7b01a2c8b3d6aa8ffdfd7d9f97f17ae57c8f | /hrms/src/main/java/kodlamaio/hrms/core/utilities/results/ErrorDataResult.java | aefb96ccd00090ef80c65df3e847a7ad81ac2b64 | [] | no_license | FurkanBulut00/Hrms | d6922ad3732fbbdf69edf52c3817fc31f24830c1 | b81130657f83ef4c3b8679109e7a75e2fc57ba67 | refs/heads/main | 2023-06-19T12:51:06.380248 | 2021-07-02T14:57:06 | 2021-07-02T14:57:06 | 366,849,108 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package kodlamaio.hrms.core.utilities.results;
public class ErrorDataResult<T> extends DataResult<T> {
public ErrorDataResult(T data, String message) {
super(data, false, message);
}
public ErrorDataResult(T data) {
super(data, false);
}
public ErrorDataResult(String message) {
super(null, false, message);
}
public ErrorDataResult() {
super(null, false);
}
} | [
"bulut@DESKTOP-UUTUELV"
] | bulut@DESKTOP-UUTUELV |
db511f0f908f12d67a6949af1196760e405a3ed3 | 2355f04606960dde1194abcca76725226e82ea6b | /app/src/main/java/com/sean/chatroom/UploadProgressRequestBody.java | 5214a382a75f5f00c984b3a479b775b49dc17a38 | [] | no_license | SeanWang0403/Chatroom | 0adef34389c7902b66a43f44555d5e3a6e36c610 | d7ad7ba8df0db9d02a20b36130898f3cf958b4ff | refs/heads/master | 2020-06-14T11:30:21.864687 | 2019-08-25T02:17:40 | 2019-08-25T02:17:40 | 194,992,938 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,411 | java | package com.sean.chatroom;
import java.io.File;
import java.io.IOException;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import okio.Buffer;
import okio.BufferedSink;
import okio.Okio;
import okio.Source;
public class UploadProgressRequestBody extends RequestBody {
private RequestBody mRequestBody;
private FileUploadObserver<ResponseBody> fileUploadObserver;
private File file;
public UploadProgressRequestBody(File file, FileUploadObserver<ResponseBody> fileUploadObserver) {
this.file = file;
this.mRequestBody = RequestBody.create(MediaType.parse("application/octet-stream"), file);
this.fileUploadObserver = fileUploadObserver;
}
@Override
public MediaType contentType() {
return mRequestBody.contentType();
}
@Override
public long contentLength() throws IOException {
return mRequestBody.contentLength();
}
@Override
public void writeTo(BufferedSink sink) throws IOException {
long max = contentLength();
Source source = Okio.source(file);
Buffer buffer = new Buffer();
long length ;
long sum = 0;
while ((length = source.read(buffer, 1024)) != -1) {
sink.write(buffer, length);
sum += length;
fileUploadObserver.onProgressChange(sum, max);
}
buffer.flush();
}
} | [
"v75365412369@gmail.com"
] | v75365412369@gmail.com |
a58a3a66ec2ba97823afdc0e3eb9859f43d1fd0e | 1ed9ce32e6ef48ddde3b230d57d4aa5fb1640156 | /src/main/java/cpu/Runner.java | b1370ea3f6409ccbafdee99e4ed1d13b943968f6 | [] | no_license | adavidoaiei/cpu-dojo | 6843df4a90c34a03bc682d5c945299229e332b63 | 6f80fcd705bfea5e9fb42132a2cdf345835cab69 | refs/heads/master | 2021-05-28T13:27:51.770124 | 2014-11-12T12:59:52 | 2014-11-12T12:59:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package cpu;
import assembler.Assembler;
import java.nio.file.Files;
import java.nio.file.Paths;
public class Runner {
public static void main(String[] arguments) throws Exception {
String content = new String(Files.readAllBytes(Paths.get("src/main/resources/", arguments[0])));
Assembler assembler = new Assembler();
assembler.parse(content);
CPU cpu = new CPU(assembler.memory());
cpu.execute();
cpu.printAsciiMemory();
}
}
| [
"cliveevans@ntlworld.com"
] | cliveevans@ntlworld.com |
fec91b87c859bdc703801cd7a14e9df1c23ac632 | 75d57f06e1ec08a2bd7e42115c75e233532efe32 | /micro-boot-jpa/src/main/java/com/microboot/cn/controller/BaseController.java | 37e227129d628fff5b7bcd3cf2bc1f7ff3e07717 | [
"Apache-2.0"
] | permissive | javasunCN/Micro-Framework | 6eebd1ae010558025c69c8bc29e812464cec05d8 | d00d1781804251d59c54cf2df43a80377a9b44fc | refs/heads/master | 2022-06-28T19:52:50.404140 | 2020-05-11T09:53:29 | 2020-05-11T09:53:29 | 262,485,395 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 70 | java | package com.microboot.cn.controller;
public class BaseController {
}
| [
"it_javasun@yeah.net"
] | it_javasun@yeah.net |
85c6bb4c6bd850c5e2d3d469588b276360caed85 | ad073825582364c0e7158a8ab9542b413cc3ebd2 | /PlayWall/src/main/java/de/tobias/playpad/server/ServerImpl.java | ca60c2c7bd416bf8da2e0b263172e9affec19ea1 | [] | no_license | Tobisaninfo/PlayWallDesktop | aa78aa8787106f7772b5d5cbc703f9a7d0d7487c | 35d341308189fb65ff2efb5876df8e33f74d2393 | refs/heads/master | 2023-03-30T23:18:26.626721 | 2021-10-31T22:25:29 | 2021-10-31T22:25:29 | 106,997,431 | 1 | 2 | null | 2023-03-28T22:46:28 | 2017-10-15T08:59:58 | Java | UTF-8 | Java | false | false | 13,717 | java | package de.tobias.playpad.server;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.reflect.TypeToken;
import com.neovisionaries.ws.client.WebSocket;
import com.neovisionaries.ws.client.WebSocketException;
import com.neovisionaries.ws.client.WebSocketFactory;
import de.thecodelabs.logger.Logger;
import de.thecodelabs.utils.application.ApplicationUtils;
import de.thecodelabs.utils.application.container.PathType;
import de.thecodelabs.utils.threading.Worker;
import de.thecodelabs.versionizer.service.UpdateService;
import de.tobias.playpad.PlayPadMain;
import de.tobias.playpad.PlayPadPlugin;
import de.tobias.playpad.plugin.ModernPlugin;
import de.tobias.playpad.project.Project;
import de.tobias.playpad.project.ProjectJsonReader;
import de.tobias.playpad.project.ProjectJsonWriter;
import de.tobias.playpad.project.ref.ProjectReference;
import de.tobias.playpad.server.sync.command.CommandManager;
import de.tobias.playpad.server.sync.command.CommandStore;
import de.tobias.playpad.server.sync.command.Commands;
import de.tobias.playpad.server.sync.command.pad.*;
import de.tobias.playpad.server.sync.command.pad.settings.PadSettingsAddCommand;
import de.tobias.playpad.server.sync.command.pad.settings.PadSettingsUpdateCommand;
import de.tobias.playpad.server.sync.command.pad.settings.design.DesignAddCommand;
import de.tobias.playpad.server.sync.command.pad.settings.design.DesignUpdateCommand;
import de.tobias.playpad.server.sync.command.page.PageAddCommand;
import de.tobias.playpad.server.sync.command.page.PageRemoveCommand;
import de.tobias.playpad.server.sync.command.page.PageUpdateCommand;
import de.tobias.playpad.server.sync.command.path.PathAddCommand;
import de.tobias.playpad.server.sync.command.path.PathRemoveCommand;
import de.tobias.playpad.server.sync.command.project.ProjectAddCommand;
import de.tobias.playpad.server.sync.command.project.ProjectRemoveCommand;
import de.tobias.playpad.server.sync.command.project.ProjectUpdateCommand;
import de.tobias.playpad.server.sync.conflict.Version;
import io.github.openunirest.http.HttpResponse;
import io.github.openunirest.http.JsonNode;
import io.github.openunirest.http.Unirest;
import io.github.openunirest.http.exceptions.UnirestException;
import javafx.beans.property.ObjectProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Type;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* Created by tobias on 10.02.17.
*/
public class ServerImpl implements Server, ChangeListener<ConnectionState> {
private static final String OK = "OK";
private static final String CACHE_FOLDER = "Cache";
private static final String PROTOCOL = "https";
private static final String WS_PROTOCOL = "wss";
private final String host;
private WebSocket websocket;
private final ServerSyncListener syncListener;
ServerImpl(String host) {
this.host = host;
this.syncListener = new ServerSyncListener();
this.syncListener.connectionStateProperty().addListener(this);
try {
loadStoredFiles();
} catch (IOException e) {
Logger.error(e);
}
registerCommands();
}
private void registerCommands() {
CommandManager.register(Commands.PROJECT_ADD, new ProjectAddCommand());
CommandManager.register(Commands.PROJECT_UPDATE, new ProjectUpdateCommand());
CommandManager.register(Commands.PROJECT_REMOVE, new ProjectRemoveCommand());
CommandManager.register(Commands.PAGE_ADD, new PageAddCommand());
CommandManager.register(Commands.PAGE_UPDATE, new PageUpdateCommand());
CommandManager.register(Commands.PAGE_REMOVE, new PageRemoveCommand());
CommandManager.register(Commands.PAD_ADD, new PadAddCommand());
CommandManager.register(Commands.PAD_UPDATE, new PadUpdateCommand());
CommandManager.register(Commands.PAD_CLEAR, new PadClearCommand());
CommandManager.register(Commands.PAD_REMOVE, new PadRemoveCommand());
CommandManager.register(Commands.PAD_MOVE, new PadMoveCommand());
CommandManager.register(Commands.PATH_ADD, new PathAddCommand());
CommandManager.register(Commands.PATH_REMOVE, new PathRemoveCommand());
CommandManager.register(Commands.DESIGN_ADD, new DesignAddCommand());
CommandManager.register(Commands.DESIGN_UPDATE, new DesignUpdateCommand());
CommandManager.register(Commands.PAD_SETTINGS_ADD, new PadSettingsAddCommand());
CommandManager.register(Commands.PAD_SETTINGS_UPDATE, new PadSettingsUpdateCommand());
}
@Override
public String getHost() {
return host;
}
@Override
public List<ModernPlugin> getPlugins() throws IOException {
URL url = new URL(PROTOCOL + "://" + host + "/plugins");
Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8);
Type listType = new TypeToken<List<ModernPlugin>>() {
}.getType();
Gson gson = new Gson();
return gson.fromJson(reader, listType);
}
@Override
public ModernPlugin getPlugin(String id) throws IOException {
URL url = new URL(PROTOCOL + "://" + host + "/plugins/" + id);
Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8);
Gson gson = new Gson();
return gson.fromJson(reader, ModernPlugin.class);
}
@Override
public void loadPlugin(ModernPlugin plugin, UpdateService.RepositoryType channel) throws IOException {
Path destination = ApplicationUtils.getApplication().getPath(PathType.LIBRARY, plugin.getFileName());
String url = PROTOCOL + "://" + host + "/plugins/raw/" + plugin.getId();
Logger.debug("Load server resource: {0}", destination);
try {
HttpResponse<InputStream> response = Unirest.get(url).asBinary();
Files.copy(response.getBody(), destination, StandardCopyOption.REPLACE_EXISTING);
} catch (UnirestException e) {
throw new IOException(e.getMessage());
}
}
@Override
public String getSession(String username, String password) throws IOException, LoginException {
String url = PROTOCOL + "://" + host + "/sessions";
try {
HttpResponse<JsonNode> response = Unirest.post(url)
.queryString("username", username)
.queryString("password", password)
.asJson();
JSONObject object = response.getBody().getObject();
// Account Error
if (!object.getString("status").equals(OK)) {
throw new LoginException(object.getString("message"));
}
// Session Key
return object.getString("key");
} catch (UnirestException e) {
throw new IOException(e.getMessage());
}
}
@Override
public void logout(String username, String password, String key) throws IOException {
String url = PROTOCOL + "://" + host + "/sessions";
try {
Unirest.post(url)
.queryString("username", username)
.queryString("password", password)
.queryString("session", key)
.asJson();
} catch (UnirestException e) {
throw new IOException(e.getMessage());
}
}
@Override
public List<ProjectReference> getSyncedProjects() throws IOException, LoginException {
String url = PROTOCOL + "://" + host + "/projects";
try {
Session session = PlayPadMain.getProgramInstance().getSession();
HttpResponse<JsonNode> request = Unirest.get(url)
.queryString("session", session.getKey())
.asJson();
JsonNode body = request.getBody();
if (body.isArray()) {
JSONArray array = body.getArray();
List<ProjectReference> projects = new ArrayList<>();
for (int i = 0; i < array.length(); i++) {
JSONObject object = array.getJSONObject(i);
UUID uuid = UUID.fromString(object.getString("uuid"));
String name = object.getString("name");
ProjectReference ref = new ProjectReference(uuid, name, true);
projects.add(ref);
}
return projects;
} else {
throw new LoginException(body.getObject().getString("message"));
}
} catch (UnirestException e) {
throw new IOException(e.getMessage());
} catch (SessionNotExistsException ignored) {
return new ArrayList<>();
}
}
@Override
public Project getProject(ProjectReference ref) throws IOException {
String url = PROTOCOL + "://" + host + "/projects/" + ref.getUuid();
Session session = PlayPadMain.getProgramInstance().getSession();
try {
HttpResponse<JsonNode> response = Unirest.get(url)
.queryString("session", session.getKey())
.asJson();
JSONObject object = response.getBody().getObject();
ProjectJsonReader reader = new ProjectJsonReader(object);
return reader.read(ref);
} catch (UnirestException e) {
throw new IOException(e.getMessage());
} catch (SessionNotExistsException ignored) {
return null;
}
}
@Override
public void postProject(Project project) throws IOException {
String url = PROTOCOL + "://" + host + "/projects";
Session session = PlayPadMain.getProgramInstance().getSession();
try {
ProjectJsonWriter writer = new ProjectJsonWriter();
String value = writer.write(project).toString();
Unirest.post(url)
.queryString("session", session.getKey())
.queryString("project", value)
.asJson();
} catch (UnirestException e) {
throw new IOException(e.getMessage(), e);
} catch (SessionNotExistsException ignored) {
}
}
@Override
public Version getLastServerModification(ProjectReference ref) throws IOException {
String url = PROTOCOL + "://" + host + "/projects/modification/" + ref.getUuid();
Session session = PlayPadMain.getProgramInstance().getSession();
try {
HttpResponse<JsonNode> response = Unirest.get(url)
.queryString("session", session.getKey())
.asJson();
JSONObject object = response.getBody().getObject();
String remoteSession = object.getString("session");
long time = object.getLong("time");
return new Version(time, remoteSession, false);
} catch (UnirestException e) {
throw new IOException(e.getMessage());
} catch (SessionNotExistsException ignored) {
return null;
}
}
@Override
public void connect(String key) {
try {
WebSocketFactory webSocketFactory = new WebSocketFactory();
webSocketFactory.setConnectionTimeout(5000);
if (PlayPadMain.sslContext != null) {
webSocketFactory.setSSLContext(PlayPadMain.sslContext);
}
websocket = webSocketFactory.createSocket(WS_PROTOCOL + "://" + host + "/project");
websocket.addHeader("key", key);
websocket.addListener(syncListener);
websocket.connect();
} catch (WebSocketException | IOException e) {
Logger.error("Failed to connect to server: " + e.getMessage());
}
}
@Override
public void disconnect() {
Logger.info("Disconnect from Server");
websocket.disconnect();
try {
saveStoredCommands();
} catch (IOException e) {
Logger.error(e);
}
}
@Override
public boolean push(String data) {
if (websocket.isOpen()) {
if (ApplicationUtils.getApplication().isDebug()) {
Logger.debug("Send: " + data);
}
// Send to Server
websocket.sendText(data);
return true;
}
return false;
}
@Override
public boolean push(JsonElement json) {
return push(json.toString());
}
// Reconnect
@Override
public void changed(ObservableValue<? extends ConnectionState> observable, ConnectionState oldValue, ConnectionState newValue) {
if (newValue == ConnectionState.CONNECTION_REFUSED) {
Worker.runLater(this::reconnect);
}
}
@Override
public ConnectionState getConnectionState() {
return syncListener.connectionStateProperty().get();
}
@Override
public ObjectProperty<ConnectionState> connectionStateProperty() {
return syncListener.connectionStateProperty();
}
private void loadStoredFiles() throws IOException {
Path path = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, CACHE_FOLDER);
if (Files.exists(path)) {
try (final DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) {
for (Path file : directoryStream) {
loadStoredFile(file);
}
}
}
}
private void loadStoredFile(Path path) throws IOException {
List<String> lines = Files.readAllLines(path);
JsonParser parser = new JsonParser();
List<JsonObject> commands = lines.stream().map(line -> (JsonObject) parser.parse(line)).collect(Collectors.toList());
CommandStore executor = (CommandStore) PlayPadPlugin.getCommandExecutorHandler().getCommandExecutor();
executor.setStoredCommands(path.getFileName().toString(), commands);
}
private void saveStoredCommands() throws IOException {
Path folder = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, CACHE_FOLDER);
if (Files.notExists(folder)) {
Files.createDirectories(folder);
}
CommandStore executor = (CommandStore) PlayPadPlugin.getCommandExecutorHandler().getCommandExecutor();
Map<UUID, List<JsonObject>> storedCommands = executor.getStoredCommands();
for (Map.Entry<UUID, List<JsonObject>> entry : storedCommands.entrySet()) {
Path file = folder.resolve(entry.getKey().toString());
List<String> lines = entry.getValue().stream().map(JsonElement::toString).collect(Collectors.toList());
Files.write(file, lines, StandardOpenOption.CREATE);
}
}
private void reconnect() {
boolean connected = false;
int count = 0;
while (!connected && count < 20) {
count++;
try {
websocket = websocket.recreate().connect();
connected = true;
Thread.sleep(30 * 1000L);
} catch (InterruptedException e) {
break;
} catch (WebSocketException | IOException ignored) {
}
}
}
}
| [
"thinkdifferent055@gmail.com"
] | thinkdifferent055@gmail.com |
3cd79b5f81b7305e718ba4393646176997cd4b6f | 6ef0b36c1226a2b8147b0e8db08ebee64f4f62a7 | /osgp/platform/osgp-adapter-ws-distributionautomation/src/test/java/org/opensmartgridplatform/adapter/ws/da/infra/jms/messageprocessors/DomainResponseMessageProcessorTest.java | cae2f6b18e7b3b2987758d830cc2ac826b058238 | [
"Apache-2.0"
] | permissive | mohbadar/open-smart-grid-platform | 702d749b803327322f06a58bcd0dc101b83a507b | d6d5554143e89eaef5419c6f9d3f21190644874a | refs/heads/master | 2020-06-16T06:22:17.980221 | 2019-06-13T10:48:51 | 2019-06-13T10:48:51 | 195,500,096 | 2 | 0 | Apache-2.0 | 2019-07-06T05:09:34 | 2019-07-06T05:09:34 | null | UTF-8 | Java | false | false | 4,290 | java | /**
* Copyright 2019 Smart Society Services B.V.
*
* 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
*/
package org.opensmartgridplatform.adapter.ws.da.infra.jms.messageprocessors;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.opensmartgridplatform.adapter.ws.schema.distributionautomation.notification.NotificationType;
import org.opensmartgridplatform.adapter.ws.shared.services.NotificationService;
import org.opensmartgridplatform.adapter.ws.shared.services.ResponseDataService;
import org.opensmartgridplatform.shared.infra.jms.Constants;
@RunWith(MockitoJUnitRunner.class)
public class DomainResponseMessageProcessorTest {
@Mock
private NotificationService notificationService;
@Mock
private ResponseDataService responseDataService;
@InjectMocks
private DomainResponseMessageProcessor responseMessageProcessor = new DomainResponseMessageProcessor();
@Test
public void testProcessGetHealthStatusResponseOkMessage() throws JMSException {
this.testProcessResponse("OK", "GET_HEALTH_STATUS");
}
@Test
public void testProcessGetHealthStatusResponseNotOkMessage() throws JMSException {
this.testProcessResponse("NOT_OK", "GET_HEALTH_STATUS");
}
@Test
public void testProcessGetPowerQualityResponseOkMessage() throws JMSException {
this.testProcessResponse("OK", "GET_POWER_QUALITY_VALUES");
}
@Test
public void testProcessGetPowerQualityResponseNotOkMessage() throws JMSException {
this.testProcessResponse("NOT_OK", "GET_POWER_QUALITY_VALUES");
}
@Test
public void testProcessGetMeasurementReportResponseOkMessage() throws JMSException {
this.testProcessResponse("OK", "GET_MEASUREMENT_REPORT");
}
@Test
public void testProcessGetMeasurementReportResponseNotOkMessage() throws JMSException {
this.testProcessResponse("NOT_OK", "GET_MEASUREMENT_REPORT");
}
@Test
/**
* Tests processing an incoming message, which has an unknown notification
* type. The system should discard the message.
*
* @throws JMSException,
* which should never occur.
*/
public void testProcessUnknownMessageTypeResponseMessage() throws JMSException {
// Arrange
final ObjectMessage myMessage = Mockito.mock(ObjectMessage.class);
when(myMessage.getJMSType()).thenReturn("FAKE_UNKNOWN_NOTIFICATION_TYPE");
// Act
this.responseMessageProcessor.processMessage(myMessage);
// Assert
// Verify no notification was sent
verify(this.notificationService, times(0)).sendNotification(anyString(), anyString(), eq("OK"), anyString(),
anyString(), any());
// Verify no response was enqueued for storage
verify(this.responseDataService, times(0)).enqueue(any());
}
private void testProcessResponse(final String result, final String notificationName) throws JMSException {
// Arrange
final ObjectMessage myMessage = Mockito.mock(ObjectMessage.class);
when(myMessage.getJMSType()).thenReturn(notificationName);
when(myMessage.getStringProperty(Constants.RESULT)).thenReturn(result);
// Act
this.responseMessageProcessor.processMessage(myMessage);
// Assert
// Verify a notification was sent
verify(this.notificationService).sendNotification(anyString(), anyString(), eq(result), anyString(),
anyString(), eq(NotificationType.valueOf(notificationName)));
// Verify a response was enqueued for storage
verify(this.responseDataService).enqueue(any());
}
}
| [
"kevin.smeets@cgi.com"
] | kevin.smeets@cgi.com |
f9b2b79fe3f79f5f3d436c301c78e3f2d1ef679e | b215446d8e1fbdd421d69da8bea3c63bf8be34d0 | /src/test/java/com/lukefowles/mocking/PersonServiceTest.java | c0c4d8986ecbf7cd91279bc2bbbe2b60f95f27c6 | [] | no_license | lukefowles/Java_Testing | 2af9828240469d6b53ab22fd41986fd4c428739c | efbed0a797f0e2dee752ca2741788793d984c608 | refs/heads/main | 2023-08-20T14:03:28.911921 | 2021-10-29T16:27:58 | 2021-10-29T16:27:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,383 | java | package com.lukefowles.mocking;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import java.util.List;
import java.util.Optional;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.*;
class PersonServiceTest {
private PersonDAO personDAO;
private PersonService underTest;
@BeforeEach
void setUp() {
// TODO: create a mock for personDAO
personDAO = mock(PersonDAO.class);
// TODO: create an instance of underTest and pass personDAO into it
underTest = new PersonService(personDAO);
}
/*
TODO: Test all these methods.
You might need to create additional methods. Check test coverage
*/
// Good luck :)
@Test
void itCanSavePerson() {
//Given
//A new instance of a person
Person person = new Person(5, "Luke", 24);
//Person nullPerson = new Person(null, null, null);
//Give an EXPECTED return value of 1 when the savePerson method is called on the personDAO mock
when(personDAO.savePerson(person)).thenReturn(1);
//When the getPeople method is called on the person DAO then return a list of one person with
//a different ID
when(personDAO.getPeople()).thenReturn(List.of(new Person(6, "John", 23)));
//When
int actualValue = underTest.savePerson(person);
//Then
//Return value should be 1 (i.e. the method of savePerson is called on the DAO implementation
assertThat( actualValue).isEqualTo(1);
//the argument of the method savePerson should be person
ArgumentCaptor<Person> personArgumentCaptor = ArgumentCaptor.forClass(Person.class);
//this line verifies that the argument being passed to save person method is an instance of the person class
verify(personDAO).savePerson(personArgumentCaptor.capture());
//this line gets the value of the person passed as the argument in the save person method
Person personSent = personArgumentCaptor.getValue();
//this line asserts that person passed to the argument is the correct person given
assertThat(personSent).isEqualTo(person);
}
@Test
void itWillThrowErrorWhenPersonHasSameID () {
//Given
Person person = new Person(5, "Luke", 24);
when(personDAO.savePerson(person)).thenReturn(1);
//and that the getPeople() method when called on the personDAO returns
//a list with a person with the sameID
when(personDAO.getPeople()).thenReturn(List.of(new Person(5, "John", 23)));
//Then
assertThatThrownBy(() -> underTest.savePerson(person))
.hasMessage("person with id " + person.getId() + " already exists")
.isInstanceOfAny(IllegalStateException.class);
}
@Test
void itWillThrowErrorWhenEmptyPersonSaved () {
//Given
Person person = new Person(null, null, null);
//and that the getPeople() method when called on the personDAO returns
when(personDAO.getPeople()).thenReturn(List.of(new Person(6, "John", 23)));
//Then
assertThatThrownBy(() -> underTest.savePerson(person))
.hasMessage("Person cannot have empty fields")
.isInstanceOfAny(IllegalStateException.class);
}
@Test
void itCanDeletePerson() {
//Given
Integer id = 5;
when(personDAO.getPeople()).thenReturn(List.of(new Person(5, "Luke", 24)));
//When
when(personDAO.deletePerson(id)).thenReturn(1);
Integer actualValue = underTest.deletePerson(id);
//Then
//Return value should be 1 (i.e. the method of savePerson is called on the DAO implementation
assertThat(actualValue).isEqualTo(1);
//the argument of the method savePerson should be person
ArgumentCaptor <Integer> IDArgumentCaptor = ArgumentCaptor.forClass(Integer.class);
//this line verifies that the argument being passed to save person method is an instance of the person class
verify(personDAO).deletePerson(IDArgumentCaptor.capture());
//this line gets the value of the person passed as the argument in the save person method
Integer IDSent = IDArgumentCaptor.getValue();
//this line asserts that person passed to the argument is the correct person given
assertThat(IDSent).isEqualTo(id);
}
@Test
void canGetPeopleFromDB() {
//Given
List<Person> expected = List.of(new Person(6, "John", 23));
when(personDAO.getPeople()).thenReturn(List.of(new Person(6, "John", 23)));
//When
List actual = underTest.getPeople();
//Then
assertThat(actual).isEqualTo(expected);
}
@Test
void canGetPersonById() {
//Given
Optional <Person> expected = Optional.of(new Person(6, "John", 23));
when(personDAO.getPeople()).thenReturn(List.of(new Person(6, "John", 23),
new Person(7, "Ron", 23),
new Person(9, "Vohn", 23)));
Integer id = 6;
//When
Optional<Person> actual = underTest.getPersonById(id);
//Then
assertThat(actual).isEqualTo(expected);
}
} | [
"luke.fowles@gmail.com"
] | luke.fowles@gmail.com |
978295b3e5b1dfb13750606733a159283065dcb7 | 99a1c8600d7a8984d3918010776aebb7c23da407 | /src/main/java/com/backendmadrid/aemet/dao/EstacionDAO.java | a8f7e9d68d68df568298c866c158d97f83fb8983 | [] | no_license | ClimaViz/ClimaViz | 5d0d9c53627e5eaa0fcc69219f6831db0ad39e75 | 110452ae56c1569011944b02a4f61d26c5b902e7 | refs/heads/master | 2021-09-06T22:21:27.163401 | 2018-02-12T13:07:04 | 2018-02-12T13:07:04 | 121,248,272 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.backendmadrid.aemet.dao;
import com.backendmadrid.aemet.modelos.Estacion;
import java.time.LocalDate;
import java.util.List;
/**
*
* @author USUARIO
*/
public interface EstacionDAO {
public List<Estacion> listar();
public List<Estacion> listarFecha(LocalDate fecha);
public void insertar (Estacion e);
public void borrar (String nombre);
public List<Estacion> buscar(String nombre);
public List<Estacion> getEstacionesProvincia(int idProvincia);
}
| [
""
] | |
9fba3673d1532f23c32aab56bc555aead1e91eb6 | 5bec3a47a2051788072774b701889af6223b4087 | /src/test/java/com/example/demo/DemoCicdEksEcrApplicationTests.java | 5dc744da3d7b599d9d3720f47f6882e4713b02fc | [] | no_license | srdsoumya/demo-cicd-eks-ecr | ed21cda2b44714630222b96f32094ce432c6f990 | c71d54b7c1b64408ae4e9da5bf221512e9f46d09 | refs/heads/master | 2023-08-14T04:30:29.853100 | 2021-10-11T16:52:26 | 2021-10-11T16:52:26 | 415,586,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 216 | java | package com.example.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoCicdEksEcrApplicationTests {
@Test
void contextLoads() {
}
}
| [
"soumyadas755@gmail.com"
] | soumyadas755@gmail.com |
0169569cd86aa572b239ddd2b9601e21a1793246 | bc034dd74cd2b67307b20697df86a1a06e08b0ab | /broadbus-api/src/main/java/me/skyun/broadcastex/api/Utils.java | 3d37373fd4f6a0c6f4c04c51ca585187e466ae59 | [] | no_license | skyuning/BroadBus | 3bb9c419f1b19e6267f5de22adef348138ab0fa4 | 8a61c55922c3c6fabc5f908eebc14a497c424cd0 | refs/heads/master | 2021-06-08T03:59:16.326090 | 2016-12-02T09:19:57 | 2016-12-02T09:19:57 | 73,155,580 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package me.skyun.broadcastex.api;
import android.content.IntentFilter;
import android.text.TextUtils;
import android.util.Log;
import java.io.PrintWriter;
import java.io.StringWriter;
/**
* Created by linyun on 16/11/12.
*/
class Utils {
public static void logException(Exception e) {
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
e.printStackTrace(printWriter);
printWriter.flush();
printWriter.close();
Log.d(e.getStackTrace()[0].getMethodName(), writer.toString());
}
public static String filterToString(IntentFilter filter) {
StringBuilder sb = new StringBuilder("[action: ");
for (int i=0; i<filter.countActions(); i++) {
sb.append(filter.getAction(i)).append(", ");
}
sb.append("]");
sb.append(" categories[");
for (int i=0; i<filter.countCategories(); i++) {
sb.append(filter.getCategory(i)).append(",");
}
sb.append("]");
return sb.toString();
}
public static String paramTypesToString(String[] paramTypes) {
return "(" + TextUtils.join(", ", paramTypes) + ")";
}
}
| [
"skyuning@163.com"
] | skyuning@163.com |
bc6a1b2ecf4df986afbacfb201fdb33218f95b85 | 4ccb7a0df5e04097f7b5d8c00740b1f0d78d174b | /src/main/java/com/example/demo/user/controller/UserController.java | 69e800ae7222b5bccc5df7086c9269f17073b4d8 | [] | no_license | caidl95/Reservation | dfc5fe3d3c7001f2a7cc0bfe6bcb114cf29fc7b1 | e92e40a6ffcf025cca292c011013772c35950f44 | refs/heads/master | 2022-06-29T00:42:03.195957 | 2019-08-10T08:42:10 | 2019-08-10T08:42:10 | 201,603,550 | 0 | 0 | null | 2022-06-17T02:23:37 | 2019-08-10T08:40:27 | TSQL | UTF-8 | Java | false | false | 4,522 | java | package com.example.demo.user.controller;
import com.example.demo.common.code.Const;
import com.example.demo.common.controller.BaseController;
import com.example.demo.common.serverResponse.ServerResponse;
import com.example.demo.user.entity.User;
import com.example.demo.user.service.IUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpSession;
import java.util.List;
@RestController
@RequestMapping("/users")
public class UserController extends BaseController<IUserService> {
/**
* ็ปๅฝ
* @param session
* @param loginname
* @param password
* @return
*/
@PostMapping("/login")
public ServerResponse<User> login(HttpSession session, String loginname, String password){
ServerResponse<User> response = service.login(loginname,password);
if (response.isSuccess())
session.setAttribute(Const.SESSION_CURRENT_USER,response.getData());
return response;
}
/**
* ้ๅบ็ปๅฝ
* @param session
* @return
*/
@PostMapping("/logout")
public ServerResponse<String> logout(HttpSession session){
session.removeAttribute(Const.SESSION_CURRENT_USER);
return ServerResponse.createBySuccess();
}
/**
* ๆทปๅ ไธไธชๆฐ็จๆท
* @param user
* @return
*/
@PostMapping("/reg")
public ServerResponse<String> register(User user){
return service.insert(user);
}
/**
* ่ทๅๅฝๅ็ปๅฝ็จๆทไฟกๆฏ
* @param session
* @return
*/
@GetMapping("/get_user")
public ServerResponse<User> getUserInfo(HttpSession session){
return ServerResponse.createBySuccess(getUserFromSession(session));
}
/**
* ๆ นๆฎ็จๆทๅ่ทๅๅฏไฟ้ฎ้ข
* @param loginname
* @return
*/
@GetMapping("/forget_get_question")
public ServerResponse<String> forgetGetQuestion(String loginname){
return service.selectQuestion(loginname);
}
/**
* ๆ นๆฎ็จๆทๅๅฏไฟ้ฎ้ข็ญๆก้ช่ฏ่บซไปฝ
* @param loginname
* @param question
* @param answer
* @return token
*/
@PostMapping("/forget_check_answer")
public ServerResponse<String> forgetCheckAnswer(String loginname,String question,String answer){
return service.checkAnswer(loginname,question,answer);
}
/**
* ๆ นๆฎ็จๆทๅtoken ๆดๆนๆฐ็ๅฏ็
*/
@PostMapping("/forget_rest_password")
public ServerResponse<String> forgetRestPassword(String loginname,String passwordNew,String forgetToken){
return service.forgetRestPassword(loginname,passwordNew,forgetToken);
}
/**
* ๅจ็บฟๆดๆนๅฏ็
* @param session
* @param passwordOld
* @param passwordNew
* @return
*/
@PostMapping("/reset_password")
public ServerResponse<String> resetPassword(HttpSession session, String passwordOld, String passwordNew){
return service.resetPassword(passwordOld,passwordNew,getUserFromSession(session));
}
/**
* ๅจ็บฟๆดๆฐ็จๆทไธชไบบไฟกๆฏ
* @param session
* @param user
* @return
*/
@PostMapping("/update_information")
public ServerResponse<User> updateInformation(HttpSession session, User user){
User currentUser = getUserFromSession(session);
user.setId(currentUser.getId());
user.setLoginname(currentUser.getLoginname());
ServerResponse response = service.updateByPrimaryKey(user);
if (response.isSuccess())
session.setAttribute(Const.SESSION_CURRENT_USER,response.getData());
return response;
}
@GetMapping("/")
public ServerResponse<List<User>> getListUser(){
return service.getListUser();
}
@GetMapping("/delete")
public ServerResponse delete(Integer id){
return service.deleteByPrimaryKey(id);
}
@GetMapping("/get_user_id")
public ServerResponse<User> getUser(Integer id){
return service.selectByPrimaryKey(id);
}
@PostMapping("/update_id")
public ServerResponse updateById(HttpSession session,User user){
if (getRoleAdminFromSession(session)){
return service.updateByPrimaryKey(user);
}
return ServerResponse.createByErrorMessage("ๆ ๆญคๆไฝๆ้๏ผ");
}
}
| [
"49805902+caidl95@users.noreply.github.com"
] | 49805902+caidl95@users.noreply.github.com |
d4cac1951fead5610474ee06ae01f353fb138914 | 018333929fce0efaba1b8656ceb1b09c19e88ced | /customers/src/test/java/com/customer/service/CustomersApplicationTests.java | 914fd1d6505c3c1bfa7263fe168e1f261035d562 | [] | no_license | ruchikabobade/customer-order-app | e12e4c9f9eb954a8c0c468293d72190b3ab528e2 | bdb21b5fcd4fd06d94a6edec7f4fb215bc0d60d1 | refs/heads/master | 2020-03-25T21:01:27.304601 | 2018-08-24T06:14:43 | 2018-08-24T06:14:43 | 144,155,919 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,070 | java | package com.customer.service;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class CustomersApplicationTests {
@Mock
private CustomerRepository customerRepository;
@InjectMocks
private CustomerController customerController;
@Before
public void setup(){
MockitoAnnotations.initMocks(this);
}
@Test
public void testGetCustomers(){
List<Customer> customerList = new ArrayList<Customer>();
customerList.add(new Customer("priya","mg road","koramangla",23,123654));
customerList.add(new Customer("madhu","asv", "suntek park",23,123654));
customerList.add(new Customer("tanvi","hinjewadi","pune",23,123654));
when(customerRepository.findAll()).thenReturn(customerList);
List<Customer> result = customerController.getCustomers();
assertEquals(3, result.size());
}
@Test
public void testSaveCustomer(){
Customer customer = new Customer("priya","mg road","koramangla",23,123654);
when(customerRepository.save(customer)).thenReturn(customer);
Customer result = customerController.addCustomerTest(customer);
assertEquals("priya", result.getName());
assertEquals("mg road", result.getAddressLine1());
assertEquals("koramangla", result.getAddressLine2());
assertEquals(23, result.getAge());
assertEquals(123654, result.getPostCode());
}
@Test
public void testDeleteCustomer(){
Customer customer = new Customer("priya","mg road","koramangla",23,123654);
customerController.deleteCustomer(customer.getId());
verify(customerRepository, times(1)).deleteById(customer.getId());
}
}
| [
"681036@cognizant.com"
] | 681036@cognizant.com |
aa36cf61b910bdc9d29a9d29d6ac90c5441833d2 | 08aee698f98619aaacfb4f6ebf429bfabfa6586c | /src/main/java/com/learn/mongodb/dao/HelloDao.java | 8e4446b4bc86785953fb50d86eabd064ab8e28bd | [] | no_license | wu00yu11/learn-mongodb | 90d12c663e01af7e2b680c9b537fffd9d5cb6961 | 01da5ca57940e08c264d2519f831de20c2dd60ce | refs/heads/master | 2023-03-29T08:12:12.041060 | 2021-04-09T14:22:47 | 2021-04-09T14:22:47 | 355,979,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package com.learn.mongodb.dao;
import com.learn.mongodb.model.HelloEntity;
public interface HelloDao {
void saveDemo(HelloEntity helloEntity);
void removeDemo(Long id);
void updateDemo(HelloEntity helloEntity);
HelloEntity findDemoById(Long id);
}
| [
"wu00yu@163.com"
] | wu00yu@163.com |
0af5d59cf94621f2bdc9f7b17d66cb20960c6e33 | c8688db388a2c5ac494447bac90d44b34fa4132c | /sources/com/google/android/gms/internal/ads/ih0.java | f62513d583c4864417162d78637d18b510accfc5 | [] | no_license | mred312/apk-source | 98dacfda41848e508a0c9db2c395fec1ae33afa1 | d3ca7c46cb8bf701703468ddc88f25ba4fb9d975 | refs/heads/master | 2023-03-06T05:53:50.863721 | 2021-02-23T13:34:20 | 2021-02-23T13:34:20 | 341,481,669 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | package com.google.android.gms.internal.ads;
import android.app.Activity;
import android.app.Application;
/* compiled from: com.google.android.gms:play-services-ads@@19.5.0 */
final class ih0 implements zzrf {
/* renamed from: a */
private final /* synthetic */ Activity f9326a;
ih0(gh0 gh0, Activity activity) {
this.f9326a = activity;
}
public final void zza(Application.ActivityLifecycleCallbacks activityLifecycleCallbacks) {
activityLifecycleCallbacks.onActivityStarted(this.f9326a);
}
}
| [
"mred312@gmail.com"
] | mred312@gmail.com |
2e6f18b560a324c4d2ece717092b560d7aee730a | 38cfa6155a905495bef2634ccf103e8c9a540212 | /ink.core/src/main/java/org/ink/core/vm/lang/internal/annotations/CoreInstanceValuesLocation.java | f1be89887e499c245ddbb159fdef29e0b97f3ee9 | [] | no_license | rodrigovilar/ink | 3feb9d164289b5f3965d7f57f950effd05530072 | 12f2065934f17a4c616616cffa548b728f7b5bd4 | refs/heads/master | 2021-01-10T04:23:27.691216 | 2013-11-02T18:55:36 | 2013-11-02T18:55:36 | 53,296,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package org.ink.core.vm.lang.internal.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* @author Lior Schachter
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface CoreInstanceValuesLocation {
public byte[] indexes();
}
| [
"liorsav@gmail.com"
] | liorsav@gmail.com |
db8ad80c7b1d44a80b10b880f12495c5ceddff4a | ceae88bfd71fe2d8499d55cbd35012dc2316c25d | /src/main/java/com/github/carlinhafuji/iotserver/domain/notification/Notification.java | 5b03a188b0c350caf4c2f0a1d3bae9a8db0becbb | [
"MIT"
] | permissive | carlinhafuji/Iot-server | 71b329d5e7b93559cd160c79d0b409820aed0af2 | 6f2a136dd7f165ff9f1ffcb4663424ec6a69a46d | refs/heads/master | 2020-12-04T18:16:26.392251 | 2016-10-24T01:07:40 | 2016-10-24T01:07:40 | 67,307,361 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,153 | java | package com.github.carlinhafuji.iotserver.domain.notification;
import com.github.carlinhafuji.iotserver.domain.Mobile;
public class Notification {
private String title;
private String body;
private Mobile recipient;
public Notification(String title, String body, Mobile recipient) {
this.body = body;
this.title = title;
this.recipient = recipient;
}
public String title() {
return title;
}
public String body() {
return body;
}
public Mobile recipient() {
return recipient;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Notification that = (Notification) o;
if (!title.equals(that.title)) return false;
if (!body.equals(that.body)) return false;
return recipient.equals(that.recipient);
}
@Override
public int hashCode() {
int result = title.hashCode();
result = 31 * result + body.hashCode();
result = 31 * result + recipient.hashCode();
return result;
}
}
| [
"cmendesce@gmail.com"
] | cmendesce@gmail.com |
47d84a67ff23199316dce1fe0ca0174b1adf1228 | a88360218e6e1d56f2b0f010b3ac41e77f65d8cb | /app/src/main/java/easycommute/EaCeWithMetro/interfaces/FragmentListener.java | d163b0c8b1b79aa61b74a69eed4d303f14f446aa | [] | no_license | Easycommute/EaCeWithMetro | 530f701f20a9129b455dfaeb43284078b00a2cff | 8d1446409c2bfaea3a757a495e35c99fa181d13d | refs/heads/master | 2020-09-21T19:03:12.184020 | 2020-04-09T06:40:43 | 2020-04-09T06:40:43 | 224,892,635 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 745 | java | package easycommute.EaCeWithMetro.interfaces;
import android.app.Activity;
import androidx.fragment.app.Fragment;
/**
* Created by Ram Prasad on 10/28/2015.
*/
public interface FragmentListener {
void setFragment(ActionEventListener fragment);
void navigateToFragment(Fragment fragment, String tag);
void navigateToFragment(Fragment fragment, String tag, boolean noHistory);
void navigateToFragment(Fragment fragment, String tag, boolean noHistory, boolean clearStack);
void showProgressBar();
void showProgressBarWithoutBackground();
void hideProgressBar();
void showNetworkDialog();
void hideSoftKeyboard(Activity activity);
void setActionTitle(String title);
void setProfileInfo();
}
| [
"naveenkukreja28@gmail.com"
] | naveenkukreja28@gmail.com |
e2e790d31fb05c8896be410ccd4f8bc9e5f6f3c6 | 0cb4847bbf36b7f80fd14df411db93bec97c9981 | /src/main/java/executable/ExtractionTesting.java | 5716554586ea8a4d8aedf53bd63016217d9994e7 | [
"Apache-2.0"
] | permissive | chorlang/chor-extractor | 69705aafd5ca32c85f73eb426aa7810d9cfa6919 | fd91df26f7c772344fb6cbc2af390c544b6d4779 | refs/heads/master | 2022-06-03T01:21:39.927765 | 2022-05-16T17:42:12 | 2022-05-16T17:42:12 | 244,318,288 | 3 | 0 | Apache-2.0 | 2021-09-08T16:17:22 | 2020-03-02T08:29:24 | Java | UTF-8 | Java | false | false | 3,937 | java | package executable;
import executable.tests.Benchmarks;
import executable.tests.CruzFilipeLarsenMontesi17;
import executable.tests.LangeTuostoYoshida15;
import executable.tests.LangeTuostoYoshida15Sequential;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Scanner;
public class ExtractionTesting {
private static record Command(Runnable runnable, String description) { }
private static final Map<String, Command> commands = Map.of(
"help", new Command(ExtractionTesting::printHelp, "Prints this help information"),
"theory", new Command(() -> runTests(new CruzFilipeLarsenMontesi17()), "Run the tests from the original theoretical paper [Cruz-Filipe, Larsen, Montesi @ FoSSaCS 2017]"),
"lty15", new Command(() -> runTests(new LangeTuostoYoshida15()), "Run the tests from the paper [Lange, Tuosto, Yoshida @ POPL 2015]"),
"lty15-seq", new Command(() -> runTests(new LangeTuostoYoshida15Sequential()), "Run the tests from the paper [Lange, Tuosto, Yoshida @ POPL 2015] *with parallelization disabled*"),
"benchmark", new Command(ExtractionTesting::runBenchmarks, "Run the extraction benchmarking suite"),
"bisimcheck", new Command(ExtractionTesting::runBisimilarity, "Check that the choreographies extracted in the benchmark are correct, i.e., they are bisimilar to the respective originals"),
"exit", new Command(() -> System.out.println("Goodbye"), "Closes the application")
);
public static void main(String []args){
if (args.length == 0) {
printHelp();
CMDInterface();
}
else{
Command toExecute = commands.get(args[0]);
if (toExecute == null){
System.out.println("Could not recognize argument " + args[0]);
printHelp();
System.exit(1);
}
toExecute.runnable.run();
}
}
private static void CMDInterface(){
var inputReader = new Scanner(System.in);
String command;
do {
System.out.println("Enter command: ");
command = inputReader.next().toLowerCase();
Command toExecute = commands.get(command);
if (toExecute == null){
System.out.println("Could not recognize command");
printHelp();
}
else{
toExecute.runnable.run();
}
} while (!command.equals("exit"));
}
private static void runTests(Object testClass){
for (Method method : testClass.getClass().getDeclaredMethods()){
try {
var inst = testClass.getClass();
var startTime = System.currentTimeMillis();
System.out.println("Running " + method.getName());
method.invoke(testClass);
System.out.println("Elapsed time: " + (System.currentTimeMillis() - startTime) + "ms\n");
} catch (IllegalAccessException | InvocationTargetException e){
System.out.println("ERROR: Could not invoke method in class " + testClass.getClass().getName());
e.printStackTrace();
}
}
}
private static void printHelp() {
System.out.println("List of available commands (<name of command>\t<description>)");
commands.forEach((key, value) -> System.out.println("\t" + key + "\t\t" + value.description));
}
private static void runBenchmarks(){
System.out.println("=== Extracting all test networks from directory tests ===\n");
Benchmarks.INSTANCE.extractionTest();
}
private static void runBisimilarity(){
System.out.println("=== Checking that all extracted choreographies are correct, using bisimilarity ===\n");
Benchmarks.INSTANCE.extractionSoundness();
}
}
| [
"bjoernak@gmail.com"
] | bjoernak@gmail.com |
d9d091e07524d8e240f21197f2be723c1400afb0 | eda0456bb9983a2ce9d324873909121d68f8a980 | /src/com/dev/news/servlet/APIServlet.java | ea5c716dfac0f513c4b29dccb55a692ffe3b4a5a | [
"Apache-2.0"
] | permissive | thiru1906/news-app | a61585f5590550537dd9749c54a0dcb826b20fce | 04501714c76e1a676b8a848c95e7dc1a1ecc6146 | refs/heads/main | 2023-03-12T20:48:31.360955 | 2021-03-02T10:54:05 | 2021-03-02T10:54:05 | 343,674,141 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,621 | java | //$Id$
package com.dev.news.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.JSONObject;
import com.dev.news.db.Db;
import com.dev.news.handler.Handler;
public class APIServlet extends HttpServlet{
static final Logger LOGGER = Logger.getLogger(APIServlet.class.toString());
private static ThreadLocal<Connection> connection = new ThreadLocal<>();
public static Map<Long, JSONObject> userCache = new HashMap<>();
public static ThreadLocal<Long> tokenId = new ThreadLocal<>();
private static Connection getConnection() {
return connection.get();
}
public static JSONObject getUserInfo() {
return userCache.get(tokenId.get());
}
public static void setTokenId(long token) {
tokenId.set(token);
}
private static void createConnection() throws Exception {
if(connection.get() == null) {
connection.set(Db.getSource().getConnection());
}
}
public static PreparedStatement getStatement(String query) {
try {
createConnection();
return getConnection().prepareStatement(query);
} catch (Exception e1) {
LOGGER.log(Level.SEVERE, e1.getMessage(), e1);
}
return null;
}
public static void closeConnection() {
if(connection.get() != null) {
try {
connection.get().close();
connection.remove();
} catch (SQLException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
}
}
/**
*
*/
private static final long serialVersionUID = -3672604105231439511L;
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
JSONObject obj = Handler.operationEntry(req, resp);
resp.setContentType("json/application");
resp.getWriter().write(obj.toString());
} catch (Exception e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
@Override
protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
@Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
doGet(req, resp);
}
}
| [
"venkatam14@gmail.com"
] | venkatam14@gmail.com |
ef0d3e5ea137e3ad7944e44ccf1ca2fc68a67113 | 8b365c3a41c8a6bd0812e1ce3da3ed10cea8bb7f | /SpringPOC/src/main/java/com/example/SpringPOC/repository/CustomerRepository.java | 9b4d70d9330bc835e2ce3f56ba3c0bb0ad2b8516 | [] | no_license | PatelPayal01/SpringPOC | 4311494e0c7fbf659cbc63667529aad697cc76c8 | 6c33bdb5c05f9a74b4a60b3e42bd4a4ba525a367 | refs/heads/master | 2021-04-09T16:29:51.990152 | 2018-03-17T19:06:19 | 2018-03-17T19:06:19 | 125,659,015 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java | package com.example.SpringPOC.repository;
import org.springframework.data.repository.CrudRepository;
import com.example.SpringPOC.entity.Customer;
public interface CustomerRepository extends CrudRepository<Customer, Integer>{
}
| [
"33231522+PatelPayal01@users.noreply.github.com"
] | 33231522+PatelPayal01@users.noreply.github.com |
393c963e80fa265a911c3c7babdfc0b996e0b83f | cb05f24438119190366c9e8f050cdbdf17cb2769 | /Mercado/src/modelo/complementares/UF.java | 9b5f32e48b16f3c9338ba2a7709c269ef86f7c53 | [] | no_license | rafaelbaiolim/iss-2015 | 88d4080c782f703f8b8bfbd02fad1f52970da606 | 33a5a6523df44a644a28d8f103e618b73ac9bd09 | refs/heads/master | 2021-01-10T04:49:51.949489 | 2016-02-15T00:34:36 | 2016-02-15T00:34:36 | 44,496,608 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,177 | java | package modelo.complementares;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
/**
* <p>Classe de <b>Modelo</b> UF.</p>
* <p>Classe responsavel por representar as UFs do Sistema.</p>
* @author Hadyne
* @version 1.0
* @since 07/11/2015
*/
@Entity
@Table (name = "uf")
@TableGenerator (name = "uf_generator", table = "generator_id", pkColumnName = "id", valueColumnName = "valor", pkColumnValue = "uf", allocationSize = 1)
public class UF implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "uf_generator")
@Column (name = "id")
private Long id;
@Column (name = "nome")
private String nome;
@Column (name = "sigla")
private String sigla;
public UF() {
this.id = null;
}
public UF(String sNome, String sSigla) {
this();
this.nome = sNome.toUpperCase().trim();
this.sigla = sSigla.toUpperCase().trim();
}
public Long getId() {
return this.id;
}
public void setId(Long lId) {
this.id = lId;
}
public String getNome() {
return this.nome;
}
public void setNome(String nome) {
this.nome = nome.toUpperCase().trim();
}
public String getSigla() {
return this.sigla;
}
public void setSigla(String sSigla) {
this.sigla = sSigla.toUpperCase().trim();
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object oObject) {
if (!(oObject instanceof UF)) {
return false;
}
UF oUF = (UF) oObject;
return Objects.equals(this.id, oUF.getId());
}
@Override
public String toString() {
return this.sigla;
}
} | [
"hadynecb@gmail.com"
] | hadynecb@gmail.com |
f4c8b7ad9f44bb04241c923fe4ab3d086662648e | 8702b7d42890a01ce79f74a9fd3f225be5876763 | /Q17/Q17.java | beeea7961e7ae649335ab0cb5919f60da12efa98 | [] | no_license | sam-pm/practice | fa0bde5ba476a3d405913a9ebf1120f3f3ee2dd3 | 5ef8f4251ba5bd505d27c5a0a5ea2fb6cc8bf738 | refs/heads/master | 2020-07-14T03:35:29.441325 | 2019-10-02T19:05:11 | 2019-10-02T19:05:11 | 205,227,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | import java.util.ArrayList;
public class Q17{
public List<String> letterCombinations(String digits){
// Variables and data structures
ArrayList<String> answer_list = new ArrayList<String>();
System.out.println(digits);
for(int i = 0; i < digitis.length(); i++){
//stub
}
return null;
}
}
| [
"spayton@prometheusgroup.com"
] | spayton@prometheusgroup.com |
a6f263eedb721720b8bea0b6183d76445e729713 | ecc9a3aa55c5100dd7d811837079afa528904522 | /project/popcustomerservice/src/main/java/com/pop136/core/webservice/client/axis/RecvSmsExResponseRecvSmsExResult.java | cef6970a53c8ec4b7bd62469cc67ae8afd6b30e6 | [] | no_license | vian127/complateCRM | eb01a30b4ca3b7e3e9ac0b69ed334b168c154908 | fe0c0b754240188b1cddfa4a1b8adad6196d7f5a | refs/heads/master | 2020-03-28T23:22:09.975327 | 2018-09-18T13:38:08 | 2018-09-18T13:38:08 | 149,288,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,641 | java | /**
* RecvSmsExResponseRecvSmsExResult.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.pop136.core.webservice.client.axis;
public class RecvSmsExResponseRecvSmsExResult implements java.io.Serializable, org.apache.axis.encoding.AnyContentType, org.apache.axis.encoding.MixedContentType {
private org.apache.axis.message.MessageElement [] _any;
public RecvSmsExResponseRecvSmsExResult() {
}
public RecvSmsExResponseRecvSmsExResult(
org.apache.axis.message.MessageElement [] _any) {
this._any = _any;
}
/**
* Gets the _any value for this RecvSmsExResponseRecvSmsExResult.
*
* @return _any
*/
public org.apache.axis.message.MessageElement [] get_any() {
return _any;
}
/**
* Sets the _any value for this RecvSmsExResponseRecvSmsExResult.
*
* @param _any
*/
public void set_any(org.apache.axis.message.MessageElement [] _any) {
this._any = _any;
}
private Object __equalsCalc = null;
public synchronized boolean equals(Object obj) {
if (!(obj instanceof RecvSmsExResponseRecvSmsExResult)) return false;
RecvSmsExResponseRecvSmsExResult other = (RecvSmsExResponseRecvSmsExResult) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this._any==null && other.get_any()==null) ||
(this._any!=null &&
java.util.Arrays.equals(this._any, other.get_any())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (get_any() != null) {
for (int i=0;
i<java.lang.reflect.Array.getLength(get_any());
i++) {
Object obj = java.lang.reflect.Array.get(get_any(), i);
if (obj != null &&
!obj.getClass().isArray()) {
_hashCode += obj.hashCode();
}
}
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(RecvSmsExResponseRecvSmsExResult.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://tempuri.org/", ">>RecvSmsExResponse>RecvSmsExResult"));
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
String mechType,
Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}
| [
"fengfeng"
] | fengfeng |
a7252c3f1a913b73252af9b3804a9776b0ca6d4b | 99cd4de6e0fda59ea367a850d6b547c735633c69 | /tests/de/espend/idea/laravel/tests/LaravelLightCodeInsightFixtureTestCase.java | fbbdb2dfc3c7812f9e6bf178e42caf295edf4706 | [
"MIT"
] | permissive | xversial/idea-php-laravel-plugin | 2d29087cf690928aff3c5356a8772605640ab271 | 36d4c8b3056217bf5068fa465a68c0ec4f5fa3ee | refs/heads/master | 2021-05-01T14:05:26.253831 | 2017-01-16T17:00:38 | 2017-01-16T17:00:38 | 79,611,287 | 0 | 0 | MIT | 2020-03-05T12:06:21 | 2017-01-21T00:04:57 | Java | UTF-8 | Java | false | false | 26,039 | java | package de.espend.idea.laravel.tests;
import com.intellij.codeInsight.daemon.LineMarkerInfo;
import com.intellij.codeInsight.daemon.LineMarkerProvider;
import com.intellij.codeInsight.daemon.LineMarkerProviders;
import com.intellij.codeInsight.daemon.RelatedItemLineMarkerInfo;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.intention.IntentionManager;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementPresentation;
import com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler;
import com.intellij.codeInspection.*;
import com.intellij.navigation.GotoRelatedItem;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.patterns.ElementPattern;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiRecursiveElementVisitor;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
import com.intellij.util.Processor;
import com.intellij.util.indexing.FileBasedIndexImpl;
import com.intellij.util.indexing.ID;
import com.jetbrains.php.lang.psi.elements.Function;
import com.jetbrains.php.lang.psi.elements.Method;
import com.jetbrains.php.lang.psi.elements.PhpReference;
import de.espend.idea.laravel.LaravelSettings;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.*;
/**
* @author Daniel Espendiller <daniel@espendiller.net>
*
* Copy of SymfonyLightCodeInsightFixtureTestCase
*/
public abstract class LaravelLightCodeInsightFixtureTestCase extends LightCodeInsightFixtureTestCase {
@Override
public void setUp() throws Exception {
super.setUp();
LaravelSettings.getInstance(myFixture.getProject()).pluginEnabled = true;
}
public void assertCompletionContains(LanguageFileType languageFileType, String configureByText, String... lookupStrings) {
myFixture.configureByText(languageFileType, configureByText);
myFixture.completeBasic();
checkContainsCompletion(lookupStrings);
}
public void assertAtTextCompletionContains(String findByText, String... lookupStrings) {
final PsiElement element = myFixture.findElementByText(findByText, PsiElement.class);
assert element != null : "No element found by text: " + findByText;
myFixture.getEditor().getCaretModel().moveToOffset(element.getTextOffset() + 1);
myFixture.completeBasic();
checkContainsCompletion(lookupStrings);
}
public void assertCompletionNotContains(String text, String configureByText, String... lookupStrings) {
myFixture.configureByText(text, configureByText);
myFixture.completeBasic();
assertFalse(myFixture.getLookupElementStrings().containsAll(Arrays.asList(lookupStrings)));
}
public void assertCompletionNotContains(LanguageFileType languageFileType, String configureByText, String... lookupStrings) {
myFixture.configureByText(languageFileType, configureByText);
myFixture.completeBasic();
assertFalse(myFixture.getLookupElementStrings().containsAll(Arrays.asList(lookupStrings)));
}
public void assertCompletionContains(String filename, String configureByText, String... lookupStrings) {
myFixture.configureByText(filename, configureByText);
myFixture.completeBasic();
completionContainsAssert(lookupStrings);
}
private void completionContainsAssert(String[] lookupStrings) {
List<String> lookupElements = myFixture.getLookupElementStrings();
if(lookupElements == null) {
fail(String.format("failed that empty completion contains %s", Arrays.toString(lookupStrings)));
}
for (String s : Arrays.asList(lookupStrings)) {
if(!lookupElements.contains(s)) {
fail(String.format("failed that completion contains %s in %s", s, lookupElements.toString()));
}
}
}
public void assertNavigationContains(LanguageFileType languageFileType, String configureByText, String targetShortcut) {
myFixture.configureByText(languageFileType, configureByText);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
assertNavigationContains(psiElement, targetShortcut);
}
public void assertNavigationContains(PsiElement psiElement, String targetShortcut) {
if(!targetShortcut.startsWith("\\")) {
targetShortcut = "\\" + targetShortcut;
}
Set<String> classTargets = new HashSet<String>();
for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
if(gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) {
for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) {
if(gotoDeclarationTarget instanceof Method) {
String meName = ((Method) gotoDeclarationTarget).getName();
String clName = ((Method) gotoDeclarationTarget).getContainingClass().getPresentableFQN();
if(!clName.startsWith("\\")) {
clName = "\\" + clName;
}
classTargets.add(clName + "::" + meName);
} else if(gotoDeclarationTarget instanceof Function) {
classTargets.add("\\" + ((Function) gotoDeclarationTarget).getName());
}
}
}
}
if(!classTargets.contains(targetShortcut)) {
fail(String.format("failed that PsiElement (%s) navigate to %s on %s", psiElement.toString(), targetShortcut, classTargets.toString()));
}
}
public void assertNavigationMatchWithParent(LanguageFileType languageFileType, String configureByText, IElementType iElementType) {
assertNavigationMatch(languageFileType, configureByText, PlatformPatterns.psiElement().withParent(PlatformPatterns.psiElement(iElementType)));
}
public void assertNavigationMatch(String filename, String configureByText, ElementPattern<?> pattern) {
myFixture.configureByText(filename, configureByText);
assertNavigationMatch(pattern);
}
public void assertNavigationMatch(LanguageFileType languageFileType, String configureByText, ElementPattern<?> pattern) {
myFixture.configureByText(languageFileType, configureByText);
assertNavigationMatch(pattern);
}
public void assertNavigationMatch(LanguageFileType languageFileType, String configureByText) {
myFixture.configureByText(languageFileType, configureByText);
assertNavigationMatch(PlatformPatterns.psiElement());
}
public void assertNavigationMatch(String filename, String configureByText) {
myFixture.configureByText(filename, configureByText);
assertNavigationMatch(PlatformPatterns.psiElement());
}
public void assertNavigationIsEmpty(LanguageFileType languageFileType, String configureByText) {
myFixture.configureByText(languageFileType, configureByText);
assertNavigationIsEmpty();
}
public void assertNavigationIsEmpty(String content, String configureByText) {
myFixture.configureByText(content, configureByText);
assertNavigationIsEmpty();
}
private void assertNavigationIsEmpty() {
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
if(gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) {
fail(String.format("failed that PsiElement (%s) navigate is empty; found target in '%s'", psiElement.toString(), gotoDeclarationHandler.getClass()));
}
}
}
private void assertNavigationMatch(ElementPattern<?> pattern) {
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
Set<String> targetStrings = new HashSet<String>();
for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
if(gotoDeclarationTargets == null || gotoDeclarationTargets.length == 0) {
continue;
}
for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) {
targetStrings.add(gotoDeclarationTarget.toString());
if(pattern.accepts(gotoDeclarationTarget)) {
return;
}
}
}
fail(String.format("failed that PsiElement (%s) navigate matches one of %s", psiElement.toString(), targetStrings.toString()));
}
public void assertNavigationContainsFile(LanguageFileType languageFileType, String configureByText, String targetShortcut) {
myFixture.configureByText(languageFileType, configureByText);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
Set<String> targets = new HashSet<String>();
for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) {
PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor());
if (gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) {
for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) {
if(gotoDeclarationTarget instanceof PsiFile) {
targets.add(((PsiFile) gotoDeclarationTarget).getVirtualFile().getUrl());
}
}
}
}
// its possible to have memory fields,
// so simple check for ending conditions
// temp:///src/interchange.en.xlf
for (String target : targets) {
if(target.endsWith(targetShortcut)) {
return;
}
}
fail(String.format("failed that PsiElement (%s) navigate to file %s", psiElement.toString(), targetShortcut));
}
public void assertCompletionLookupTailEquals(LanguageFileType languageFileType, String configureByText, String lookupString, String tailText) {
assertCompletionLookup(languageFileType, configureByText, lookupString, new LookupElement.TailTextEqualsAssert(tailText));
}
public void assertCompletionLookup(LanguageFileType languageFileType, String configureByText, String lookupString, LookupElement.Assert assertMatch) {
myFixture.configureByText(languageFileType, configureByText);
myFixture.completeBasic();
for (com.intellij.codeInsight.lookup.LookupElement lookupElement : myFixture.getLookupElements()) {
if(!lookupElement.getLookupString().equals(lookupString)) {
continue;
}
LookupElementPresentation presentation = new LookupElementPresentation();
lookupElement.renderElement(presentation);
if(assertMatch.match(presentation)) {
return;
}
fail(String.format("fail that on element '%s' with '%s' matches '%s'", lookupString, assertMatch.getClass(), presentation.toString()));
}
fail(String.format("failed to check '%s' because it's unknown", lookupString));
}
public void assertPhpReferenceResolveTo(LanguageFileType languageFileType, String configureByText, ElementPattern<?> pattern) {
myFixture.configureByText(languageFileType, configureByText);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
psiElement = PsiTreeUtil.getParentOfType(psiElement, PhpReference.class);
if (psiElement == null) {
fail("Element is not PhpReference.");
}
assertTrue(pattern.accepts(((PhpReference) psiElement).resolve()));
}
public void assertPhpReferenceNotResolveTo(LanguageFileType languageFileType, String configureByText, ElementPattern<?> pattern) {
myFixture.configureByText(languageFileType, configureByText);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
psiElement = PsiTreeUtil.getParentOfType(psiElement, PhpReference.class);
if (psiElement == null) {
fail("Element is not PhpReference.");
}
assertFalse(pattern.accepts(((PhpReference) psiElement).resolve()));
}
public void assertPhpReferenceSignatureEquals(LanguageFileType languageFileType, String configureByText, String typeSignature) {
myFixture.configureByText(languageFileType, configureByText);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
psiElement = PsiTreeUtil.getParentOfType(psiElement, PhpReference.class);
if (!(psiElement instanceof PhpReference)) {
fail("Element is not PhpReference.");
}
assertEquals(typeSignature, ((PhpReference) psiElement).getSignature());
}
public void assertCompletionResultEquals(String filename, String complete, String result) {
myFixture.configureByText(filename, complete);
myFixture.completeBasic();
myFixture.checkResult(result);
}
public void assertCompletionResultEquals(LanguageFileType languageFileType, String complete, String result) {
myFixture.configureByText(languageFileType, complete);
myFixture.completeBasic();
myFixture.checkResult(result);
}
public void assertCheckHighlighting(String filename, String result) {
myFixture.configureByText(filename, result);
myFixture.checkHighlighting();
}
public void assertIndexContains(@NotNull ID<String, ?> id, @NotNull String... keys) {
assertIndex(id, false, keys);
}
public void assertIndexNotContains(@NotNull ID<String, ?> id, @NotNull String... keys) {
assertIndex(id, true, keys);
}
public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) {
for (String key : keys) {
final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>();
FileBasedIndexImpl.getInstance().getFilesWithKey(id, new HashSet<String>(Arrays.asList(key)), new Processor<VirtualFile>() {
@Override
public boolean process(VirtualFile virtualFile) {
virtualFiles.add(virtualFile);
return true;
}
}, GlobalSearchScope.allScope(getProject()));
if(notCondition && virtualFiles.size() > 0) {
fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key));
} else if(!notCondition && virtualFiles.size() == 0) {
fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key));
}
}
}
public void assertIndexContainsKeyWithValue(@NotNull ID<String, String> id, @NotNull String key, @NotNull String value) {
assertContainsElements(FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject())), value);
}
public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) {
List<T> values = FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject()));
for (T t : values) {
if(tAssert.match(t)) {
return;
}
}
fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size()));
}
public void assertLocalInspectionContains(String filename, String content, String contains) {
Set<String> matches = new HashSet<String>();
Pair<List<ProblemDescriptor>, Integer> localInspectionsAtCaret = getLocalInspectionsAtCaret(filename, content);
for (ProblemDescriptor result : localInspectionsAtCaret.getFirst()) {
TextRange textRange = result.getPsiElement().getTextRange();
if (textRange.contains(localInspectionsAtCaret.getSecond()) && result.toString().equals(contains)) {
return;
}
matches.add(result.toString());
}
fail(String.format("Fail matches '%s' with one of %s", contains, matches));
}
public void assertIntentionIsAvailable(LanguageFileType languageFileType, String configureByText, String intentionText) {
myFixture.configureByText(languageFileType, configureByText);
PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset());
for (IntentionAction intentionAction : IntentionManager.getInstance().getIntentionActions()) {
if(intentionAction.isAvailable(getProject(), getEditor(), psiElement.getContainingFile()) && intentionAction.getText().equals(intentionText)) {
return;
}
}
fail(String.format("Fail intention action '%s' is available in element '%s'", intentionText, psiElement.getText()));
}
public void assertLocalInspectionContainsNotContains(String filename, String content, String contains) {
Pair<List<ProblemDescriptor>, Integer> localInspectionsAtCaret = getLocalInspectionsAtCaret(filename, content);
for (ProblemDescriptor result : localInspectionsAtCaret.getFirst()) {
TextRange textRange = result.getPsiElement().getTextRange();
if (textRange.contains(localInspectionsAtCaret.getSecond())) {
fail(String.format("Fail inspection not contains '%s'", contains));
}
}
}
private Pair<List<ProblemDescriptor>, Integer> getLocalInspectionsAtCaret(String filename, String content) {
PsiElement psiFile = myFixture.configureByText(filename, content);
int caretOffset = myFixture.getCaretOffset();
if(caretOffset <= 0) {
fail("Please provide <caret> tag");
}
ProblemsHolder problemsHolder = new ProblemsHolder(InspectionManager.getInstance(getProject()), psiFile.getContainingFile(), false);
for (LocalInspectionEP localInspectionEP : LocalInspectionEP.LOCAL_INSPECTION.getExtensions()) {
Object object = localInspectionEP.getInstance();
if(!(object instanceof LocalInspectionTool)) {
continue;
}
((LocalInspectionTool) object).buildVisitor(problemsHolder, false);
}
return new Pair<List<ProblemDescriptor>, Integer>(problemsHolder.getResults(), caretOffset);
}
protected void assertLocalInspectionIsEmpty(String filename, String content) {
Pair<List<ProblemDescriptor>, Integer> localInspectionsAtCaret = getLocalInspectionsAtCaret(filename, content);
for (ProblemDescriptor result : localInspectionsAtCaret.getFirst()) {
TextRange textRange = result.getPsiElement().getTextRange();
if (textRange.contains(localInspectionsAtCaret.getSecond())) {
fail("Fail that matches is empty");
}
}
}
protected void createDummyFiles(String... files) throws Exception {
for (String file : files) {
String path = myFixture.getProject().getBaseDir().getPath() + "/" + file;
File f = new File(path);
f.getParentFile().mkdirs();
f.createNewFile();
}
}
private void checkContainsCompletion(String[] lookupStrings) {
completionContainsAssert(lookupStrings);
}
public void assertLineMarker(@NotNull PsiElement psiElement, @NotNull LineMarker.Assert assertMatch) {
final List<PsiElement> elements = collectPsiElementsRecursive(psiElement);
for (LineMarkerProvider lineMarkerProvider : LineMarkerProviders.INSTANCE.allForLanguage(psiElement.getLanguage())) {
Collection<LineMarkerInfo> lineMarkerInfos = new ArrayList<LineMarkerInfo>();
lineMarkerProvider.collectSlowLineMarkers(elements, lineMarkerInfos);
if(lineMarkerInfos.size() == 0) {
continue;
}
for (LineMarkerInfo lineMarkerInfo : lineMarkerInfos) {
if(assertMatch.match(lineMarkerInfo)) {
return;
}
}
}
fail(String.format("Fail that '%s' matches on of '%s' PsiElements", assertMatch.getClass(), elements.size()));
}
public void assertLineMarkerIsEmpty(@NotNull PsiElement psiElement) {
final List<PsiElement> elements = collectPsiElementsRecursive(psiElement);
for (LineMarkerProvider lineMarkerProvider : LineMarkerProviders.INSTANCE.allForLanguage(psiElement.getLanguage())) {
Collection<LineMarkerInfo> lineMarkerInfos = new ArrayList<LineMarkerInfo>();
lineMarkerProvider.collectSlowLineMarkers(elements, lineMarkerInfos);
if(lineMarkerInfos.size() > 0) {
fail(String.format("Fail that line marker is empty because it matches '%s'", lineMarkerProvider.getClass()));
}
}
}
@NotNull
private List<PsiElement> collectPsiElementsRecursive(@NotNull PsiElement psiElement) {
final List<PsiElement> elements = new ArrayList<PsiElement>();
elements.add(psiElement.getContainingFile());
psiElement.acceptChildren(new PsiRecursiveElementVisitor() {
@Override
public void visitElement(PsiElement element) {
elements.add(element);
super.visitElement(element);
}
});
return elements;
}
public static class IndexValue {
public interface Assert<T> {
boolean match(@NotNull T value);
}
}
public static class LineMarker {
public interface Assert {
boolean match(@NotNull LineMarkerInfo markerInfo);
}
public static class ToolTipEqualsAssert implements Assert {
@NotNull
private final String toolTip;
public ToolTipEqualsAssert(@NotNull String toolTip) {
this.toolTip = toolTip;
}
@Override
public boolean match(@NotNull LineMarkerInfo markerInfo) {
return markerInfo.getLineMarkerTooltip() != null && markerInfo.getLineMarkerTooltip().equals(toolTip);
}
}
public static class TargetAcceptsPattern implements Assert {
@NotNull
private final String toolTip;
@NotNull
private final ElementPattern<? extends PsiElement> pattern;
public TargetAcceptsPattern(@NotNull String toolTip, @NotNull ElementPattern<? extends PsiElement> pattern) {
this.toolTip = toolTip;
this.pattern = pattern;
}
@Override
public boolean match(@NotNull LineMarkerInfo markerInfo) {
if(markerInfo.getLineMarkerTooltip() == null || !markerInfo.getLineMarkerTooltip().equals(toolTip)) {
return false;
}
if(!(markerInfo instanceof RelatedItemLineMarkerInfo)) {
return false;
}
for (Object o : ((RelatedItemLineMarkerInfo) markerInfo).createGotoRelatedItems()) {
if(o instanceof GotoRelatedItem && this.pattern.accepts(((GotoRelatedItem) o).getElement())) {
return true;
}
}
return false;
}
}
}
public static class LookupElement {
public interface Assert {
boolean match(@NotNull LookupElementPresentation lookupElement);
}
public static class TailTextEqualsAssert implements Assert {
@NotNull
private final String contents;
public TailTextEqualsAssert(@NotNull String contents) {
this.contents = contents;
}
@Override
public boolean match(@NotNull LookupElementPresentation lookupElement) {
return this.contents.equals(lookupElement.getTailText());
}
}
public static class TypeTextEqualsAssert implements Assert {
@NotNull
private final String contents;
public TypeTextEqualsAssert(@NotNull String contents) {
this.contents = contents;
}
@Override
public boolean match(@NotNull LookupElementPresentation lookupElement) {
return this.contents.equals(lookupElement.getTypeText());
}
}
public static class TailTextIsBlankAssert implements Assert {
@Override
public boolean match(@NotNull LookupElementPresentation lookupElement) {
return StringUtils.isBlank(lookupElement.getTailText());
}
}
}
}
| [
"daniel@espendiller.net"
] | daniel@espendiller.net |
d36847810fd2a392f50f90be89311c1f4485e175 | 79bfcfcf1e9308019881eab56aec4af6b3468a5a | /Zadanie1/src/main/java/Zadanie1/Zadanie1/ProductMapper.java | 2ad0bd0d09bb56defd60148936e960d5f743a86e | [] | no_license | velislav30Student/BigData_Projects | 3caea4bc298e1125dae28b70637d8a4e1a00a7fa | e31255d19166613e73e506a353ff0254c2ec3eee | refs/heads/master | 2023-08-27T00:12:30.730075 | 2021-10-29T17:17:27 | 2021-10-29T17:17:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,230 | java | package Zadanie1.Zadanie1;
import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
public class ProductMapper extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable>{
@Override
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter)
throws IOException {
//Skip Header Row - contains Column Names
if(key.get() == 0) {
return;
}
int ProductColumnIndex = 1;
String row = value.toString();
StringTokenizer tokenizer = new StringTokenizer(row, ",");
//Array is needed to get the token that corresponds to the needed column
ArrayList<String> tokens = new ArrayList<String>();
while (tokenizer.hasMoreTokens()) {
tokens.add(tokenizer.nextToken().replace(" ", ""));
}
Text outputKey = new Text(tokens.get(ProductColumnIndex));
output.collect(outputKey, new IntWritable(1));
}
} | [
"stu1801321021@uni-plovdiv.bg"
] | stu1801321021@uni-plovdiv.bg |
ccd2c225058fcfb13b97c89fbd0078d488308e4d | f6b601f2414541ac2f2ed200f939fdc6a1cc3c72 | /pet-clinic-data/src/main/java/service/map/AbstractMapService.java | 637f46fb08204e21a1d0b6a5ff9fd7591566fdf9 | [] | no_license | william1099/spring-pet-clinic | 21f8c6f4da65b54f131f2f261c05228aaa453ce1 | 5c1d01a4d580f5892bbb8eb7e31656356a4e7ea1 | refs/heads/main | 2023-02-04T03:43:07.730659 | 2020-12-22T06:52:34 | 2020-12-22T06:52:34 | 321,284,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 615 | java | package service.map;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public abstract class AbstractMapService<T, ID> {
protected Map<ID, T> map = new HashMap<>();
Set<T> findAll() {
return new HashSet<>(map.values());
}
T findById(ID id) {
return map.get(id);
}
T save(ID id, T object) {
map.put(id, object);
return object;
}
void deleteById(ID id) {
map.remove(id);
}
void delete(T object) {
map.entrySet().removeIf(entry -> entry.getValue().equals(object));
}
}
| [
"williamliam1099@gmail.com"
] | williamliam1099@gmail.com |
b9c2c6ae12e804f829896d2a9572d28019e2a115 | ed4e96e0db58fcd8a0719b1858ba4832b188b668 | /src/servlet/HandleExportStudentScore.java | b8adbedb4988c1bc10be17266e8a7d7c61427246 | [] | no_license | nkyyy01/onlineexam | ef62b20dfe2bd5297f39da61b4a781c8d7519c44 | 0f3e543e904a71bb94d139f4cb750e2196f25d4e | refs/heads/master | 2023-07-05T23:16:12.451369 | 2020-09-01T04:39:28 | 2020-09-01T04:39:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,417 | java | package servlet;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
/**
* @author super lollipop
* @date 4/6/20
*/
public class HandleExportStudentScore extends HttpServlet {
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
Class.forName("com.mysql.jdbc.Driver");
}
catch (Exception e){
e.printStackTrace();
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doPost(req,resp);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String TARGET_DIRECTORY="excelfile"; //ไธไผ ๆไปถ็็ฎๅฝ*
String uploadPath = getServletContext().getRealPath("/") + TARGET_DIRECTORY;
String exam_description_id = request.getParameter("exam_description_id");
String message = ""; //็จไฝ้ๅฎๅๆ็คบๅๆฐ
if (exam_description_id != null){
try {//่ฟๆฅๆฐๆฎๅบ
String url = this.getServletContext().getInitParameter("url");
String user = this.getServletContext().getInitParameter("user");
String pwd = this.getServletContext().getInitParameter("password");
Connection connection = DriverManager.getConnection(url, user, pwd);
PreparedStatement preparedStatement = connection.prepareStatement("SELECT users_information.id,users_information.`name`,exam_description,total_score,obtain_score\n" +
" FROM users_information, exams_description,examrecord where users_information.id=examrecord.user_id\n" +
" and exams_description.id=examrecord.exam_description_id and examrecord.exam_description_id=?\n" +
" order by users_information.id;");
preparedStatement.setInt(1,Integer.parseInt(exam_description_id));
ResultSet resultSet = preparedStatement.executeQuery();
List<List<Object>> rowList = new LinkedList<>();
while (resultSet.next()){
List<Object> columnList = new LinkedList<>();
System.out.println(resultSet.getString(1));
columnList.add(resultSet.getString(1));
System.out.println(resultSet.getString(2));
columnList.add(resultSet.getString(2));
System.out.println(resultSet.getString(3));
columnList.add(resultSet.getString(3));
System.out.println(resultSet.getFloat(4));
columnList.add(resultSet.getFloat(4));
System.out.println(resultSet.getFloat(5));
columnList.add(resultSet.getFloat(5));
rowList.add(columnList);
}
//ๅๅปบๅทฅไฝ่ๅฏน่ฑก
HSSFWorkbook workbook=new HSSFWorkbook();//่ฟ้ไนๅฏไปฅ่ฎพ็ฝฎsheet็Name
//ๅๅปบๅทฅไฝ่กจๅฏน่ฑก
HSSFSheet sheet = workbook.createSheet();
workbook.setSheetName(0,"sheet1");//่ฎพ็ฝฎsheet็Name
//ๅๅปบๅทฅไฝ่กจ็่ก
HSSFRow headRow = sheet.createRow(0);//่ฎพ็ฝฎ็ฌฌไธ่ก๏ผไป้ถๅผๅง
headRow.createCell(0).setCellValue("่็ๅท");
headRow.createCell(1).setCellValue("ๅงๅ");
headRow.createCell(2).setCellValue("่ฏ้ขๆ่ฟฐ");
headRow.createCell(3).setCellValue("ๆปๅ");
headRow.createCell(4).setCellValue("ๅพๅ");
for (int i = 0; i < rowList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
System.out.println((String) rowList.get(i).get(0));
row.createCell(0).setCellValue((String) rowList.get(i).get(0));
row.createCell(1).setCellValue((String) rowList.get(i).get(1));
row.createCell(2).setCellValue((String) rowList.get(i).get(2));
row.createCell(3).setCellValue((Float) rowList.get(i).get(3));
row.createCell(4).setCellValue((Float) rowList.get(i).get(4));
}
//ๆๆกฃ่พๅบ
FileOutputStream out = new FileOutputStream(uploadPath + File.separator + exam_description_id + ".xls");
workbook.write(out);
out.close();
System.out.println(uploadPath + File.separator + exam_description_id + ".xls");
response.sendRedirect("../excelfile/" + exam_description_id + ".xls");
}catch (SQLException e){
e.printStackTrace();
}
}else {
}
}
} | [
"1769128867@qq.com"
] | 1769128867@qq.com |
fb807274c691eea09689b02085178b536cc7f500 | 96bb95eca232a4d5f045a6bea54e20048397a0c0 | /src/main/java/com/lbruges/bowling/board/impl/Game.java | f8fdbc1133d23d18e3fe3b6b2eba3876dbd21863 | [] | no_license | lbruges/bowling_game | 9f632da5619a4aefb2b47ce981e7c8d12fac98ba | 27830095d99711575905eea49bdc304d17c651c1 | refs/heads/main | 2023-02-03T06:04:45.619263 | 2020-12-21T17:29:41 | 2020-12-21T17:29:41 | 322,865,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,224 | java | package com.lbruges.bowling.board.impl;
import com.lbruges.bowling.board.BoardObserver;
import com.lbruges.bowling.board.BoardSubject;
import com.lbruges.bowling.calculator.GameScoreCalculator;
import com.lbruges.bowling.model.frame.IFrame;
import com.lbruges.bowling.model.score.IScore;
import java.util.LinkedList;
import java.util.List;
/**
* Single player bowling game representation.
*
* @author Laura Bruges
*/
public class Game implements BoardSubject {
private String playerName;
private List<IFrame> frameList;
private List<BoardObserver> observers;
public Game(String playerName, List<IFrame> frameList) {
this.playerName = playerName;
this.frameList = frameList;
observers = new LinkedList<>();
}
public void setFrameList(List<IFrame> frameList) {
this.frameList = frameList;
}
@Override
public void registerObserver(BoardObserver observer) {
observers.add(observer);
}
@Override
public void notifyObservers() {
List<IScore> scoreList = (new GameScoreCalculator(frameList)).scoreGame();
for (BoardObserver o : observers) {
o.update(playerName, frameList, scoreList);
}
}
}
| [
"laura.bruges.h@gmail.com"
] | laura.bruges.h@gmail.com |
501f1665e358251b2c681fa2eec8c9cfded133f9 | c591472c1e6bca5c30d900c07e1604d1ed119c9d | /src/org/ninjadev/multivim/commandparser/NormalVisualCommandTable.java | 04aeef862d3399355cddb5b953085562cb71d1b8 | [] | no_license | lionleaf/multivim | e59b45436181d518f5d677b2b69d84ac5b49123b | 4f962a8f25bfb2e956e00e866cbf5554f4b701e8 | refs/heads/master | 2021-01-15T18:45:21.503521 | 2013-01-17T10:46:03 | 2013-01-17T10:46:03 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 16,627 | java | package org.ninjadev.multivim.commandparser;
import java.util.EnumSet;
import java.util.HashMap;
import org.ninjadev.multivim.commandparser.normalvisualcommands.*;
import org.ninjadev.multivim.commandparser.normalvisualcommands.Error;
import org.ninjadev.multivim.commandparser.operators.Movement;
import com.googlecode.lanterna.input.Key;
import com.googlecode.lanterna.input.Key.Kind;
public class NormalVisualCommandTable{
public static HashMap<Key, NormalVisualCommand> table;
private static void entry(NormalVisualCommand normalVisualCommand){
table.put(normalVisualCommand.commandKey, normalVisualCommand);
}
public static NormalVisualCommand get(Key key){
NormalVisualCommand nvc = table.get(key);
return nvc == null ? table.get(new Key('\0', false, false)) : nvc;
}
static{
table = new HashMap<Key, NormalVisualCommand>();
boolean F = false;
boolean T = true;
int FALSE = 0;
int TRUE = 1;
int BACKWARD = 3;
int FORWARD = 4;
int SEARCH_REV = 12;
int BL_WHITE = 13;
int BL_FIX = 14;
/* | command | char | ctrl | alt | flags | args | */
entry(new Error (new Key( '\0' , F , F ), null, 0 ));
entry(new AddSub (new Key( 'a' , T , F ), null, 0 ));
entry(new Page (new Key( 'b' , T , F ), EnumSet.of(NormalVisualFlag.MayStopSelectionWithoutShiftModifier), BACKWARD));
entry(new Esc (new Key( 'c' , T , F ), null, TRUE ));
entry(new HalfPage (new Key( 'd' , T , F ), null, 0 ));
entry(new ScrollLine (new Key( 'e' , T , F ), null, TRUE ));
entry(new Page (new Key( 'f' , T , F ), EnumSet.of(NormalVisualFlag.MayStopSelectionWithoutShiftModifier), FORWARD));
entry(new CtrlG (new Key( 'g' , T , F ), null, 0 ));
entry(new CtrlH (new Key( 'h' , T , F ), null, 0 ));
entry(new PCMark (new Key( 'i' , T , F ), null, 0 ));
entry(new Down (new Key( Kind.Enter ), null, FALSE ));
entry(new Error (new Key( 'k' , T , F ), null, 0 ));
entry(new Clear (new Key( 'l' , T , F ), null, 0 ));
entry(new Down (new Key( 'm' , T , F ), null, TRUE ));
entry(new Down (new Key( 'n' , T , F ), EnumSet.of(NormalVisualFlag.MayStopSelectionWithoutShiftModifier), FALSE));
entry(new CtrlO (new Key( 'o' , T , F ), null, 0 ));
entry(new Up (new Key( 'p' , T , F ), EnumSet.of(NormalVisualFlag.MayStopSelectionWithoutShiftModifier), FALSE));
entry(new Visual (new Key( 'q' , T , F ), null, FALSE ));
entry(new Redo (new Key( 'r' , T , F ), null, 0 ));
entry(new Ignore (new Key( 's' , T , F ), null, 0 ));
entry(new TagPop (new Key( 't' , T , F ), EnumSet.of(NormalVisualFlag.NotAllowedInCommandLineWindow), 0));
entry(new HalfPage (new Key( 'u' , T , F ), null, 0 ));
entry(new Visual (new Key( 'v' , T , F ), null, FALSE ));
entry(new Visual (new Key( 'V' , F , F ), null, FALSE ));
entry(new Visual (new Key( 'v' , F , F ), null, FALSE ));
entry(new Window (new Key( 'w' , T , F ), null, 0 ));
entry(new AddSub (new Key( 'x' , T , F ), null, 0 ));
entry(new ScrollLine (new Key( 'y' , T , F ), null, FALSE ));
entry(new Suspend (new Key( 'z' , T , F ), null, 0 ));
entry(new Esc (new Key( Kind.Escape ), null, FALSE ));
entry(new Normal (new Key( '\\', T , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways
), 0));
entry(new Ident (new Key( ']' , T , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar), 0));
entry(new Hat (new Key( '^' , T , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar), 0));
entry(new Error (new Key( '_' , T , F ), null, 0 ));
entry(new Right (new Key( ' ' , F , F ), null, 0 ));
entry(new Operator (new Key( '!' , F , F ), null, 0 ));
entry(new Regname (new Key( '"' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharWhenNoOperatorPending,
NormalVisualFlag.KeepRegisterName
), 0));
entry(new Ident (new Key( '#' , F , F ), null, 0 ));
entry(new Dollar (new Key( '$' , F , F ), null, 0 ));
entry(new Percent (new Key( '%' , F , F ), null, 0 ));
entry(new Optrans (new Key( '&' , F , F ), null, 0 ));
entry(new GoMark (new Key( '\'', F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways
), TRUE));
entry(new Brace (new Key( '(' , F , F ), null, BACKWARD ));
entry(new Brace (new Key( ')' , F , F ), null, FORWARD ));
entry(new Ident (new Key( '*' , F , F ), null, 0 ));
entry(new Down (new Key( '+' , F , F ), null, TRUE ));
entry(new CSearch (new Key( ',' , F , F ), null, TRUE ));
entry(new Up (new Key( '-' , F , F ), null, TRUE ));
entry(new Dot (new Key( '.' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName), 0));
entry(new Search (new Key( '/' , F , F ), null, FALSE ));
entry(new BeginLine (new Key( '0' , F , F ), null, 0 ));
entry(new Ignore (new Key( '1' , F , F ), null, 0 ));
entry(new Ignore (new Key( '2' , F , F ), null, 0 ));
entry(new Ignore (new Key( '3' , F , F ), null, 0 ));
entry(new Ignore (new Key( '4' , F , F ), null, 0 ));
entry(new Ignore (new Key( '5' , F , F ), null, 0 ));
entry(new Ignore (new Key( '6' , F , F ), null, 0 ));
entry(new Ignore (new Key( '7' , F , F ), null, 0 ));
entry(new Ignore (new Key( '8' , F , F ), null, 0 ));
entry(new Ignore (new Key( '9' , F , F ), null, 0 ));
entry(new Colon (new Key( ':' , F , F ), null, 0 ));
entry(new CSearch (new Key( ';' , F , F ), null, FALSE ));
entry(new Operator (new Key( '<' , F , F ), EnumSet.of(NormalVisualFlag.RightLeftModifiesCommand), 0));
entry(new Operator (new Key( '=' , F , F ), null, 0 ));
entry(new Operator (new Key( '>' , F , F ), EnumSet.of(NormalVisualFlag.RightLeftModifiesCommand), 0));
entry(new Search (new Key( '?' , F , F ), null, FALSE ));
entry(new At (new Key( '@' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharWhenNoOperatorPending
), FALSE));
entry(new Edit (new Key( 'A' , F , F ), null, 0 ));
entry(new BackWord (new Key( 'B' , F , F ), null, 0 ));
entry(new Abbrev (new Key( 'C' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName), 0));
entry(new Abbrev (new Key( 'D' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName), 0));
entry(new WordCommand (new Key( 'E' , F , F ), null, TRUE ));
entry(new CSearch (new Key( 'F' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways,
NormalVisualFlag.SecondCharNeedsLanguageAdjustment
), BACKWARD));
entry(new Goto (new Key( 'G' , F , F ), null, TRUE ));
entry(new Scroll (new Key( 'H' , F , F ), null, 0 ));
entry(new Edit (new Key( 'I' , F , F ), null, 0 ));
entry(new Join (new Key( 'J' , F , F ), null, 0 ));
entry(new Ident (new Key( 'K' , F , F ), null, 0 ));
entry(new Scroll (new Key( 'L' , F , F ), null, 0 ));
entry(new Scroll (new Key( 'M' , F , F ), null, 0 ));
entry(new Next (new Key( 'N' , F , F ), null, SEARCH_REV ));
entry(new Open (new Key( 'O' , F , F ), null, 0 ));
entry(new Put (new Key( 'P' , F , F ), null, 0 ));
entry(new ExMode (new Key( 'Q' , F , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar), 0));
entry(new Replace (new Key( 'R' , F , F ), null, FALSE ));
entry(new Subst (new Key( 'S' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName), 0));
entry(new CSearch (new Key( 'T' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways,
NormalVisualFlag.SecondCharNeedsLanguageAdjustment
), BACKWARD));
entry(new Undo (new Key( 'U' , F , F ), null, 0 ));
entry(new WordCommand (new Key( 'W' , F , F ), null, TRUE ));
entry(new Abbrev (new Key( 'X' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 ));
entry(new Abbrev (new Key( 'Y' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 ));
entry(new Zet (new Key( 'Z' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharWhenNoOperatorPending,
NormalVisualFlag.NotAllowedInCommandLineWindow
), 0));
entry(new Brackets (new Key( '[' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways
), BACKWARD));
entry(new Error (new Key( '\\', F , F ), null, 0 ));
entry(new Brackets (new Key( ']' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways
), FORWARD));
entry(new BeginLine (new Key( '^' , F , F ), null, BL_WHITE|BL_FIX));
entry(new LineOp (new Key( '_' , F , F ), null, 0 ));
entry(new GoMark (new Key( '`' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways
), FALSE));
entry(new Edit (new Key( 'a' , F , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar), 0));
entry(new WordCommand (new Key( 'b' , F , F ), null, 0 ));
entry(new Operator (new Key( 'c' , F , F ), null, 0 ));
entry(new Operator (new Key( 'd' , F , F ), null, 0 ));
entry(new WordCommand (new Key( 'e' , F , F ), null, FALSE ));
entry(new CSearch (new Key( 'f' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways,
NormalVisualFlag.SecondCharNeedsLanguageAdjustment
), FORWARD));
entry(new GCommand (new Key( 'g' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways
), FALSE));
entry(new Left (new Key( 'h' , F , F ), EnumSet.of(NormalVisualFlag.RightLeftModifiesCommand) , 0 ));
entry(new Edit (new Key( 'i' , F , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar) , 0 ));
entry(new Down (new Key( 'j' , F , F ), null, FALSE ));
entry(new Up (new Key( 'k' , F , F ), null, FALSE ));
entry(new Right (new Key( 'l' , F , F ), EnumSet.of(NormalVisualFlag.RightLeftModifiesCommand) , 0 ));
entry(new Mark (new Key( 'm' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharWhenNoOperatorPending
), 0));
entry(new Next (new Key( 'n' , F , F ), null, 0 ));
entry(new Open (new Key( 'o' , F , F ), null, 0 ));
entry(new Put (new Key( 'p' , F , F ), null, 0 ));
entry(new Record (new Key( 'q' , F , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar) , 0 ));
entry(new Replace (new Key( 'r' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharWhenNoOperatorPending,
NormalVisualFlag.SecondCharNeedsLanguageAdjustment
), 0));
entry(new Subst (new Key( 's' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 ));
entry(new CSearch (new Key( 't' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways,
NormalVisualFlag.SecondCharNeedsLanguageAdjustment
), FORWARD));
entry(new Undo (new Key( 'u' , F , F ), null, 0 ));
entry(new WordCommand (new Key( 'w' , F , F ), null, FALSE ));
entry(new Abbrev (new Key( 'x' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 ));
entry(new Operator (new Key( 'y' , F , F ), null, 0 ));
entry(new Zet (new Key( 'z' , F , F ), EnumSet.of(
NormalVisualFlag.MayNeedSecondChar,
NormalVisualFlag.NeedSecondCharAlways
) , 0 ));
entry(new FindPar (new Key( '{' , F , F ), null, BACKWARD ));
entry(new Pipe (new Key( '|' , F , F ), null, 0 ));
entry(new FindPar (new Key( '}' , F , F ), null, FORWARD ));
entry(new Tilde (new Key( '~' , F , F ), null, 0 ));
entry(new Ident (new Key( 'ยฃ' , F , F ), null, 0 ));
entry(new Ignore (new Key( Kind.Ignore ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 ));
entry(new Nop (new Key( Kind.Nop ), null, 0 ));
entry(new Edit (new Key( Kind.Insert ), null, 0 ));
entry(new CtrlH (new Key( Kind.Backspace ), null, 0 ));
entry(new Up (new Key( Kind.ArrowUp ), EnumSet.of(
NormalVisualFlag.MayStartSelectionWithShiftModifier,
NormalVisualFlag.MayStopSelectionWithoutShiftModifier
), FALSE));
entry(new Down (new Key( Kind.ArrowDown ), EnumSet.of(
NormalVisualFlag.MayStartSelectionWithShiftModifier,
NormalVisualFlag.MayStopSelectionWithoutShiftModifier
), FALSE));
entry(new Left (new Key( Kind.ArrowLeft ), EnumSet.of(
NormalVisualFlag.MayStartSelectionWithShiftModifier,
NormalVisualFlag.MayStopSelectionWithoutShiftModifier
), 0));
entry(new Right (new Key( Kind.ArrowRight ), EnumSet.of(
NormalVisualFlag.MayStartSelectionWithShiftModifier,
NormalVisualFlag.MayStopSelectionWithoutShiftModifier,
NormalVisualFlag.RightLeftModifiesCommand
), 0));
entry(new Page (new Key( Kind.PageUp ), EnumSet.of(
NormalVisualFlag.MayStartSelectionWithShiftModifier,
NormalVisualFlag.MayStopSelectionWithoutShiftModifier
), BACKWARD ));
entry(new Page (new Key( Kind.PageDown ), EnumSet.of(
NormalVisualFlag.MayStartSelectionWithShiftModifier,
NormalVisualFlag.MayStopSelectionWithoutShiftModifier
), FORWARD ));
entry(new End (new Key( Kind.End ), EnumSet.of(
NormalVisualFlag.MayStartSelectionWithShiftModifier,
NormalVisualFlag.MayStopSelectionWithoutShiftModifier
), FALSE ));
entry(new Home (new Key( Kind.Home ), EnumSet.of(
NormalVisualFlag.MayStartSelectionWithShiftModifier,
NormalVisualFlag.MayStopSelectionWithoutShiftModifier
), 0 ));
entry(new Abbrev (new Key( Kind.Delete ), null, 0 ));
entry(new Help (new Key( Kind.F1 ), EnumSet.of(NormalVisualFlag.NotAllowedInCommandLineWindow), 0));
}
}
| [
"sigvefarstad@gmail.com"
] | sigvefarstad@gmail.com |
5e68688ad0da0e50c054de9828033f6a41ed08df | 33a5fcf025d92929669d53cf2dc3f1635eeb59c6 | /ๆ้ฝๆบๅจ่ฝฆ/core/src/main/java/com/mapuni/core/utils/ToastUtils.java | f1b661e93e7ba64a5b5beff280d1d889036568a9 | [] | no_license | dayunxiang/MyHistoryProjects | 2cacbe26d522eeb3f858d69aa6b3c77f3c533f37 | 6e041f53a184e7c4380ce25f5c0274aa10f06c8e | refs/heads/master | 2020-11-29T09:23:27.085614 | 2018-03-12T07:07:18 | 2018-03-12T07:07:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 694 | java | package com.mapuni.core.utils;
import android.content.Context;
import android.widget.Toast;
public class ToastUtils {
private static Toast mToast;
/**
* ้้ปๅก่ฏๆพ็คบToast,้ฒๆญขๅบ็ฐ่ฟ็ปญ็นๅปToastๆถ็ๆพ็คบ้ฎ้ข
*/
public static void showToast(Context context, CharSequence text, int duration) {
if (mToast == null) {
mToast = Toast.makeText(context, text, duration);
} else {
mToast.setText(text);
mToast.setDuration(duration);
}
mToast.show();
}
public static void showToast(Context context, CharSequence text) {
showToast(context, text, Toast.LENGTH_SHORT);
}
}
| [
"you@example.com"
] | you@example.com |
4ca441fd9fadac9c8b89d8df938e0156cb3eb520 | f157ecb6b5f5dc59504babd1ba87f0e46a5c0667 | /Week_02/G20200343030499/LeetCode_105_499.java | 1b5cefefe5cce84f51690a2f3ac945501b984327 | [] | no_license | algorithm006-class01/algorithm006-class01 | 891da256a54640cf1820db93380f4253f6aacecd | 7ad9b948f8deecf35dced38a62913e462e699b1c | refs/heads/master | 2020-12-27T14:43:13.449713 | 2020-04-20T06:56:33 | 2020-04-20T06:56:33 | 237,936,958 | 19 | 140 | null | 2020-04-20T06:56:34 | 2020-02-03T10:13:53 | Java | UTF-8 | Java | false | false | 3,540 | java | /*
* @lc app=leetcode id=105 lang=java
*
* [105] Construct Binary Tree from Preorder and Inorder Traversal
*/
// @lc code=start
/**
* Definition for a binary tree node. public class TreeNode { int val; TreeNode
* left; TreeNode right; TreeNode(int x) { val = x; } }
*/
class Solution_1 {
public TreeNode buildTree(int[] preorder, int[] inorder) {
// assume preorder and inorder won't be null
if (preorder.length == 0) {
return null;
}
int rootVal = preorder[0];
TreeNode rootNode = new TreeNode(rootVal);
if (preorder.length == 1) {
return rootNode;
}
int rootIndexInInorder = -1;
for (int i = 0; i < inorder.length; i++) {
if (rootVal == inorder[i]) {
rootIndexInInorder = i;
break;
}
}
int leftSize = rootIndexInInorder;
int rightSize = inorder.length - leftSize - 1;
int[][] preorderPartitions = getPreorderPartitions(preorder, leftSize, rightSize);
int[][] inorderPartitions = getInorderPartitions(inorder, leftSize, rightSize);
rootNode.left = buildTree(preorderPartitions[0], inorderPartitions[0]);
rootNode.right = buildTree(preorderPartitions[1], inorderPartitions[1]);
return rootNode;
}
private int[][] getPreorderPartitions(int[] array, int leftSize, int rightSize) {
// int[] root = new int[] { array[0] };
int[] left = new int[leftSize];
int[] right = new int[rightSize];
for (int i = 0; i < leftSize; i++) {
left[i] = array[i + 1];
}
for (int i = 0; i < rightSize; i++) {
right[i] = array[i + leftSize + 1];
}
return new int[][] { left, right };
}
private int[][] getInorderPartitions(int[] array, int leftSize, int rightSize) {
// int[] root = new int[1];
int[] left = new int[leftSize];
int[] right = new int[rightSize];
for (int i = 0; i < leftSize; i++) {
left[i] = array[i];
}
for (int i = 0; i < rightSize; i++) {
right[i] = array[i + leftSize + 1];
}
return new int[][] { left, right };
}
}
class Solution {
public TreeNode buildTree(int[] preorder, int[] inorder) {
return buildTree(preorder, inorder, 0, preorder.length, 0, inorder.length);
}
private TreeNode buildTree(int[] preorder, int[] inorder, int preorderLeftEnd, int preorderRightEnd,
int inorderLeftEnd, int inorderRightEnd) {
if (preorderRightEnd - preorderLeftEnd == 0) {
return null;
}
TreeNode rootNode = new TreeNode(preorder[preorderLeftEnd]);
if (preorderRightEnd - preorderLeftEnd == 1) {
return rootNode;
}
// find index of the root in inorder
int rootInInorder = -1;
for (int i = inorderLeftEnd; i < inorderRightEnd; i++) {
if (preorder[preorderLeftEnd] == inorder[i]) {
rootInInorder = i;
break;
}
}
int leftNodeSize = rootInInorder - inorderLeftEnd;
rootNode.left = buildTree(preorder, inorder, preorderLeftEnd + 1, preorderLeftEnd + leftNodeSize + 1,
inorderLeftEnd, rootInInorder);
rootNode.right = buildTree(preorder, inorder, preorderLeftEnd + leftNodeSize + 1, preorderRightEnd,
rootInInorder + 1, inorderRightEnd);
return rootNode;
}
}
// @lc code=end
| [
"pengwu8421@gmail.com"
] | pengwu8421@gmail.com |
3cb098fc94d0384a9f620c86f18f0cb46ad9a93f | 95e0f69ab7b3ff500ae737c9ba1b2dad42028b7d | /src/main/java/io/github/ourongbin/dev/codegen/util/TemplateUtil.java | b8fd098fbf94a0a931607103f109be3eb019e25c | [] | no_license | ourongbin/code-gen | 17f003b786a3dd6f3abe76ea7b2573da519b52bf | 4eb4e3c5444c6a63bac1e9e27c61b3626a74983b | refs/heads/master | 2023-06-04T01:58:48.280772 | 2021-01-21T07:22:24 | 2021-01-21T07:22:24 | 366,366,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,190 | java | package io.github.ourongbin.dev.codegen.util;
import freemarker.cache.ClassTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import freemarker.template.TemplateExceptionHandler;
import lombok.extern.slf4j.Slf4j;
import java.io.*;
import java.util.Locale;
import java.util.Map;
@Slf4j
public class TemplateUtil {
private static final Configuration freemarkerConfig = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
static {
try {
//2020-06-21 zhengkai ไฟฎๅคpath้ฎ้ขๅฏผ่ดjarๆ ๆณ่ฟ่ก่ๆฌๅฐ้กน็ฎๅฏไปฅ่ฟ่ก็bug
freemarkerConfig.setClassForTemplateLoading(TemplateUtil.class, "/templates");
freemarkerConfig.setTemplateLoader(new ClassTemplateLoader(TemplateUtil.class, "/templates"));
//freemarkerConfig.setDirectoryForTemplateLoading(new File(templatePath, "templates/code-generator"));
freemarkerConfig.setNumberFormat("#");
freemarkerConfig.setClassicCompatible(true);
freemarkerConfig.setDefaultEncoding("UTF-8");
freemarkerConfig.setLocale(Locale.CHINA);
freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
public static void processTemplate(String templateName, String outputName, Map<String, Object> params) throws IOException, TemplateException {
Template template = freemarkerConfig.getTemplate(templateName);
StringWriter stringWriter = new StringWriter();
template.process(params, stringWriter);
String s = MyStringUtils.escapeString(stringWriter.toString());
File file = new File(outputName);
if (!file.getParentFile().exists()) {
if (!file.getParentFile().mkdirs()) {
throw new CodeGenException("ๅๅปบ่พๅบ็ฎๅฝๅคฑ่ดฅ");
}
}
try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) {
bw.write(s);
}
log.info("็ๆ: {}", file.getName());
}
}
| [
"ronou@tencent.com"
] | ronou@tencent.com |
58a4b4e5496b13f12fb0909a27c4ca6ab4abd7ce | ed2fa0fc455cb4a56669b34639bb95b25c6b7f83 | /wen-13/sys/src/main/java/nancy/Dao/studentDao.java | 06545338e5b890f06ecafe97e9ec738845e98632 | [] | no_license | w7436/wen-Java | 5bcc2b09faa478196218e46ff64cd23ba64da441 | 6fc9f2a336c512a0d9be70c69950ad5610b3b152 | refs/heads/master | 2022-11-27T07:51:28.158473 | 2020-09-11T03:49:41 | 2020-09-11T03:49:41 | 210,778,808 | 0 | 0 | null | 2022-11-16T08:36:03 | 2019-09-25T07:08:33 | JavaScript | UTF-8 | Java | false | false | 4,359 | java | package nancy.Dao;
import nancy.Util.DBUtil;
import nancy.exception.SystemException;
import nancy.model.student;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName studentDao
* @Description TODO
* @Author DELL
* @Data 2020/7/1 12:55
* @Version 1.0
**/
public class studentDao {
/**
* ๅญฆ็็ปๅฝ
* @return
* @throws Exception
*/
public static boolean login(Connection con,int id,String password)throws Exception{
String sql="select * from student where Id=? and password=?";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setInt(1,id);
pstmt.setString(2,password);
ResultSet rs=pstmt.executeQuery();
if(!rs.next()){
System.out.println("็ปๅฝๅคฑ่ดฅ");
return false;
}else{
System.out.println("็ปๅฝๆๅ");
return true;
}
}
//ๅญฆ็ไฟกๆฏๆฅ่ฏข
public static List<student> queryList(Connection c){
PreparedStatement p =null;
ResultSet r = null;
String sql ="select * from student ";
List<student> list = new ArrayList<student>();
try {
p = c.prepareStatement(sql);
r = p.executeQuery();
while(r.next()){
student stu = new student();
stu.setId(r.getInt("Id"));
stu.setName(r.getString("name"));
stu.setSex(r.getString("sex"));
stu.setBirthday(r.getDate("bithday"));
stu.setPassword(r.getString("password"));
stu.setDepart(r.getString("depart"));
stu.setPhone(r.getString("phone"));
stu.setEmail(r.getString("email"));
list.add(stu);
}
return list;
} catch (SQLException e) {
throw new SystemException("ๆฅ่ฏขๅบ้");
} finally {
DBUtil.close(c,p,r);
}
}
//ๅญฆ็ๆทปๅ
public static int studentAdd(Connection con,student stu)throws Exception{
String sql="insert into student values(null,?,?,?,?,?,?,?)";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1, stu.getName());
pstmt.setString(2, stu.getSex());
pstmt.setDate(3, (Date) stu.getBirthday());
pstmt.setString(4,stu.getPassword());
pstmt.setString(5, stu.getDepart());
pstmt.setString(6, stu.getPhone());
pstmt.setString(7,stu.getEmail());
return pstmt.executeUpdate();
}
//ๆดๆนๅญฆ็ๅฏ็
public static boolean studentUpdate(Connection con,int id,String password)throws Exception{
String sql="update student set password=? where Id=?";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1, password);
pstmt.setInt(2, id);
int line = pstmt.executeUpdate();
return line > 0 ? true :false;
}
/**
* ๅญฆ็ๅ ้ค
* @param con
* @param id
* @return
* @throws Exception
*/
public static int studentDelete(Connection con,int id)throws Exception{
String sql="delete from student where Id=?";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setInt(1, id);
return pstmt.executeUpdate();
}
//ๆ นๆฎๅงๅๆฅ่ฏขไธชไบบไฟกๆฏ
public static student qustudent(Connection c,int id)throws Exception{
PreparedStatement p =null;
ResultSet r = null;
String sql ="select * from student where Id = ? ";
student stu = new student();
try {
p = c.prepareStatement(sql);
p.setInt(1,id);
r = p.executeQuery();
while(r.next()){
stu.setId(id);
stu.setName(r.getString("name"));
stu.setSex(r.getString("sex"));
stu.setBirthday(r.getDate("bithday"));
stu.setPassword(r.getString("password"));
stu.setDepart(r.getString("depart"));
stu.setPhone(r.getString("phone"));
stu.setEmail(r.getString("email"));
}
return stu;
} catch (SQLException e) {
throw new SystemException("ๆฅ่ฏขๅบ้");
} finally {
DBUtil.close(c,p,r);
}
}
}
| [
"3239741254@qq.com"
] | 3239741254@qq.com |
250db4a51dcd6ce9023d26bc64c8696fc91fee15 | 9e676ac07819d46603a4755cd8247a75d9f6b102 | /src/main/java/org/wicketTutorial/helloworld/model/Group.java | 7db549c29545ec567d8f7e8606c75f394487ac1c | [] | no_license | CManig/WicketChoiceExample | 4231ed9f13b57f7031a4346c97d87947af21f3bb | 3c7063c876853e1582250f7a863c089e207006f4 | refs/heads/master | 2021-01-11T21:42:29.470607 | 2017-01-13T10:11:07 | 2017-01-13T10:11:07 | 78,837,586 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | package org.wicketTutorial.helloworld.model;
import java.io.Serializable;
/**
* Represents a group a user could have.
*
* @author cmanig
*/
public class Group implements Serializable{
/** serialVersionUID */
private static final long serialVersionUID = -1642771056814860900L;
/** The id of the group. */
private Integer groupId;
/** The name of the group */
private String groupname;
public Integer getGroupId() {
return groupId;
}
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
public String getGroupname() {
return groupname;
}
public void setGroupname(String groupname) {
this.groupname = groupname;
}
}
| [
"christoph.manig@t-systems.com"
] | christoph.manig@t-systems.com |
38918ce63569e8b6543212655e71d26fcedafffc | 8899186f794f2fed9da21cb093881e040b2e8cde | /Design Pattern/Observer/src/WeatherData.java | ec04ffa7cdc84312c64c8f4e41da904b7504b016 | [] | no_license | great2soul/soul | 9b98f443b73d921e0834ba8931ee655bcf07d646 | ba32c733c67d2e0d94dbc1bc0a7a21e799d7e8c6 | refs/heads/master | 2020-07-05T08:54:11.065880 | 2014-12-04T15:17:33 | 2014-12-04T15:17:33 | 4,144,528 | 0 | 4 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | import java.util.ArrayList;
public class WeatherData implements Subject{
private ArrayList observers;
private float temp;
private float humidity;
private float pressure;
public WeatherData() {
observers = new ArrayList();
}
@Override
public void registerObserver(Observer o) {
// TODO Auto-generated method stub
observers.add(o);
}
@Override
public void removeObserver(Observer o) {
// TODO Auto-generated method stub
int i = observers.indexOf(o);
if (i >= 0) {
observers.remove(i);
}
}
@Override
public void notifyObserver() {
// TODO Auto-generated method stub
for (int i = 0; i < observers.size(); ++i) {
Observer o = (Observer) observers.get(i);
o.update(temp, humidity, pressure);
}
}
public void measurementsChanged() {
notifyObserver();
}
public void setMeasurements(float temp, float humidity, float pressure) {
this.temp = temp;
this.humidity = humidity;
this.pressure -= pressure;
measurementsChanged();
}
}
| [
"gengsong@adsage.com"
] | gengsong@adsage.com |
bd38c44d2d468de406735fa17b458a7da2f5c67d | 915fe245375aad9838eb305abc740ad2d0d345cb | /src/com/matchimi/options/AvailabilityPreview.java | 5514d84ef14c1261a5335821ae406b1e6edea2c6 | [] | no_license | manishandroid/MatchIMIBit | 0f12492c3a66da1a404304b82d283df34160957e | d9f9cef51492ca1215480b3c1386bc44c349c31f | refs/heads/master | 2021-01-10T18:37:47.664169 | 2014-02-11T19:12:23 | 2014-02-11T19:12:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,663 | java | package com.matchimi.options;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.matchimi.CommonUtilities;
import com.matchimi.R;
import com.matchimi.utils.ApplicationUtils;
import com.matchimi.utils.JSONParser;
import com.matchimi.utils.NetworkUtils;
public class AvailabilityPreview extends SherlockFragmentActivity {
private Context context;
private ProgressDialog progress;
private JSONParser jsonParser = null;
private String jsonStr = null;
private TextView buttonFreeze;
private String avail_id;
private Boolean is_frozen = false;
public static final int RC_PREV_AVAILABILITY_EDIT = 40;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences settings = getSharedPreferences(CommonUtilities.PREFS_NAME,
Context.MODE_PRIVATE);
if (settings.getInt(CommonUtilities.SETTING_THEME,
CommonUtilities.THEME_LIGHT) == CommonUtilities.THEME_LIGHT) {
setTheme(ApplicationUtils.getTheme(true));
} else {
setTheme(ApplicationUtils.getTheme(false));
}
setContentView(R.layout.availability_preview);
context = this;
ActionBar ab = getSupportActionBar();
ab.setDisplayHomeAsUpEnabled(true);
Bundle b = getIntent().getExtras();
final String pt_id = b.getString("pt_id");
avail_id = b.getString("avail_id");
final String start = b.getString("start");
final String end = b.getString("end");
final String repeat = b.getString("repeat");
final String location = b.getString("location");
final String price = b.getString("price");
is_frozen = b.getBoolean("is_frozen");
Calendar calStart = generateCalendar(start);
Calendar calEnd = generateCalendar(end);
TextView textStart = (TextView) findViewById(R.id.textStart);
textStart.setText(CommonUtilities.AVAILABILITY_DATE.format(calStart.getTime())
+ ", "
+ CommonUtilities.AVAILABILITY_TIME.format(calStart.getTime()).toLowerCase(
Locale.getDefault()));
TextView textEnd = (TextView) findViewById(R.id.textEnd);
textEnd.setText(CommonUtilities.AVAILABILITY_TIME.format(calEnd.getTime()).toLowerCase(
Locale.getDefault()));
String[] repeatString = context.getResources().getStringArray(
R.array.repeat_value);
TextView textRepeat = (TextView) findViewById(R.id.textRepeat);
textRepeat.setText(repeat);
final TextView buttonEdit = (TextView) findViewById(R.id.buttonEdit);
buttonEdit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent i = new Intent(context, CreateAvailability.class);
i.putExtra("pt_id", pt_id);
i.putExtra("avail_id", avail_id);
i.putExtra("start", start);
i.putExtra("end", end);
i.putExtra("repeat", repeat);
i.putExtra("location", location);
i.putExtra("price", price);
i.putExtra("update", true);
startActivityForResult(i, RC_PREV_AVAILABILITY_EDIT);
}
});
final TextView buttonDelete = (TextView) findViewById(R.id.buttonDelete);
buttonDelete.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.menu_availability);
builder.setMessage(R.string.delete_availability_question);
builder.setPositiveButton(R.string.delete,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
doDeleteAvailability(avail_id);
}
});
builder.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
});
buttonFreeze = (TextView) findViewById(R.id.buttonFreeze);
// If frozen, change into unfreeze
if(is_frozen) {
buttonFreeze.setText(getString(R.string.unfreeze_availability));
}
buttonFreeze.setOnClickListener(freezeListener);
// loadMap(location);
}
private OnClickListener freezeListener = new OnClickListener() {
@Override
public void onClick(View view) {
// If status is_frozen true, then unfreze them
if(is_frozen) {
doUnfreezeAvailability(avail_id);
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.menu_availability);
builder.setMessage(R.string.freeze_availability_question);
builder.setPositiveButton(R.string.freeze_title,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int arg1) {
doFreezeAvailability(avail_id);
}
});
builder.setNegativeButton(R.string.cancel,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int arg1) {
// Nothing to do
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
}
};
@Deprecated
protected void loadMap(String location) {
if (location != null && !location.equalsIgnoreCase("null")
&& location.length() > 1) {
String latitude = location.substring(0, location.indexOf(","));
String longtitude = location.substring(location.indexOf(",") + 1);
LatLng pos = new LatLng(Double.parseDouble(latitude),
Double.parseDouble(longtitude));
GoogleMap map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
map.addMarker(new MarkerOptions().position(pos).title(getString(R.string.app_name))
.snippet(getString(R.string.map_availability_area))
.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin)));
// Move the camera instantly to hamburg with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(pos, 12));
// Zoom in, animating the camera.
map.animateCamera(CameraUpdateFactory.zoomTo(12), 2000, null);
}
}
protected void doDeleteAvailability(final String avail_id) {
final String url = CommonUtilities.SERVERURL + CommonUtilities.API_DELETE_AVAILABILITY_BY_AVAIL_ID + "?" +
CommonUtilities.PARAM_AVAIL_ID + "=" + avail_id;
RequestQueue queue = Volley.newRequestQueue(this);
StringRequest dr = new StringRequest(Request.Method.DELETE, url,
new Response.Listener<String>()
{
@Override
public void onResponse(String response) {
if (response.equalsIgnoreCase("0")) {
Toast.makeText(context, getString(R.string.delete_availability_success),
Toast.LENGTH_SHORT).show();
Intent i = new Intent(CommonUtilities.BROADCAST_SCHEDULE_RECEIVER);
sendBroadcast(i);
Intent result = new Intent();
setResult(RESULT_OK, result);
finish();
} else if (response.equalsIgnoreCase("1")) {
Toast.makeText(
context,
getString(R.string.delete_availability_failed),
Toast.LENGTH_LONG).show();
Log.d(CommonUtilities.TAG, "Delete failed with result code " + response);
} else {
NetworkUtils.connectionHandler(context, response, "");
}
}
},
new Response.ErrorListener()
{
@Override
public void onErrorResponse(VolleyError error) {
Log.d(CommonUtilities.TAG, "Error " + error.toString());
// TODO Auto-generated method stub
Toast.makeText(
context,
getString(R.string.something_wrong),
Toast.LENGTH_LONG).show();
}
}
);
queue.add(dr);
//
// final Handler mHandlerFeed = new Handler();
// final Runnable mUpdateResultsFeed = new Runnable() {
// public void run() {
// if (jsonStr != null) {
// if (jsonStr.trim().equalsIgnoreCase("0")) {
// Toast.makeText(context, getString(R.string.delete_availability_success),
// Toast.LENGTH_SHORT).show();
// Intent result = new Intent();
// setResult(RESULT_OK, result);
// finish();
// } else {
// Toast.makeText(
// context,
// getString(R.string.delete_availability_failed),
// Toast.LENGTH_LONG).show();
// }
// } else {
// Toast.makeText(
// context,
// getString(R.string.something_wrong),
// Toast.LENGTH_LONG).show();
// }
// }
// };
//
// progress = ProgressDialog.show(context, getString(R.string.menu_availability),
// getString(R.string.delete_availability_progress), true, false);
// new Thread() {
// public void run() {
// jsonParser = new JSONParser();
// try {
// String[] params = { "avail_id" };
// String[] values = { avail_id };
// jsonStr = jsonParser.getHttpResultUrlDelete(url, params,
// values);
// Log.e(TAG, "Deleting availability: " + url + " with avail_id " + avail_id + ". Result >>>\n" + jsonStr);
// } catch (Exception e) {
// jsonStr = null;
// }
//
// if (progress != null && progress.isShowing()) {
// progress.dismiss();
// mHandlerFeed.post(mUpdateResultsFeed);
// }
// }
// }.start();
}
/**
* Freeze user availability
* @param avail_id
*/
protected void doFreezeAvailability(final String avail_id) {
final String url = CommonUtilities.SERVERURL + CommonUtilities.API_FREEZE_AVAILABILITY_BY_AVAIL_ID;
final Handler mHandlerFeed = new Handler();
final Runnable mUpdateResultsFeed = new Runnable() {
public void run() {
if (jsonStr != null) {
if (jsonStr.trim().equalsIgnoreCase("0")) {
Toast.makeText(context, getString(R.string.freeze_availability_success),
Toast.LENGTH_SHORT).show();
Intent i = new Intent(CommonUtilities.BROADCAST_SCHEDULE_RECEIVER);
sendBroadcast(i);
Intent result = new Intent();
setResult(RESULT_OK, result);
finish();
} else if (jsonStr.trim().equalsIgnoreCase("1")) {
Toast.makeText(
context,
getString(R.string.freeze_availability_failed),
Toast.LENGTH_LONG).show();
} else {
NetworkUtils.connectionHandler(context, jsonStr, "");
}
} else {
Toast.makeText(
context,
getString(R.string.something_wrong),
Toast.LENGTH_LONG).show();
}
}
};
progress = ProgressDialog.show(context, getString(R.string.menu_availability),
getString(R.string.freeze_availability_progress), true, false);
new Thread() {
public void run() {
jsonParser = new JSONParser();
String[] params = { "avail_id" };
String[] values = { avail_id };
jsonStr = jsonParser.getHttpResultUrlPut(url, params, values);
if (progress != null && progress.isShowing()) {
progress.dismiss();
mHandlerFeed.post(mUpdateResultsFeed);
}
}
}.start();
}
/**
* Unfreeze availability
* @param avail_id
*/
protected void doUnfreezeAvailability(final String avail_id) {
final String url = CommonUtilities.SERVERURL + CommonUtilities.API_UNFREEZE_AVAILABILITY_BY_AVAIL_ID;
final Handler mHandlerFeed = new Handler();
final Runnable mUpdateResultsFeed = new Runnable() {
public void run() {
if (jsonStr != null) {
if (jsonStr.trim().equalsIgnoreCase("0")) {
Toast.makeText(context, getString(R.string.unfreeze_availability_success),
Toast.LENGTH_SHORT).show();
Intent i = new Intent(CommonUtilities.BROADCAST_SCHEDULE_RECEIVER);
sendBroadcast(i);
Intent result = new Intent();
setResult(RESULT_OK, result);
finish();
} else if (jsonStr.trim().equalsIgnoreCase("0")) {
Toast.makeText(
context,
getString(R.string.unfreeze_availability_failed),
Toast.LENGTH_LONG).show();
} else {
NetworkUtils.connectionHandler(context, jsonStr, "");
}
} else {
Toast.makeText(
context,
getString(R.string.something_wrong),
Toast.LENGTH_LONG).show();
}
}
};
progress = ProgressDialog.show(context, getString(R.string.menu_availability),
getString(R.string.unfreeze_availability_progress), true, false);
new Thread() {
public void run() {
jsonParser = new JSONParser();
String[] params = { "avail_id" };
String[] values = { avail_id };
jsonStr = jsonParser.getHttpResultUrlPut(url, params, values);
if (progress != null && progress.isShowing()) {
progress.dismiss();
mHandlerFeed.post(mUpdateResultsFeed);
}
}
}.start();
}
private Calendar generateCalendar(String str) {
Calendar calRes = new GregorianCalendar(Integer.parseInt(str.substring(
0, 4)), Integer.parseInt(str.substring(5, 7)) - 1,
Integer.parseInt(str.substring(8, 10)), Integer.parseInt(str
.substring(11, 13)), Integer.parseInt(str.substring(14,
16)), Integer.parseInt(str.substring(17, 19)));
return calRes;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.e(CommonUtilities.TAG, "Availability PREVEIEW Fragment");
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == RC_PREV_AVAILABILITY_EDIT) {
Intent result = new Intent();
setResult(RESULT_OK, result);
finish();
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
Intent result = new Intent();
setResult(RESULT_CANCELED, result);
finish();
break;
}
return super.onOptionsItemSelected(item);
}
}
| [
"yodi@polatic.com"
] | yodi@polatic.com |
ab3cf4d43a53804be5bd67c7777044794e1fdf7a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/2/2_816efb1b017296103650239e7e927b65d4435d3d/Fits/2_816efb1b017296103650239e7e927b65d4435d3d_Fits_t.java | 8685fde24b5e731c3f5b60ead33eb53864d2ec3f | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 20,061 | java | /*
* Copyright 2009 Harvard University Library
*
* This file is part of FITS (File Information Tool Set).
*
* FITS 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 3 of the License, or
* (at your option) any later version.
*
* FITS 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 FITS. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.harvard.hul.ois.fits;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionGroup;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.apache.log4j.Logger;
import org.jdom.Document;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import edu.harvard.hul.ois.fits.consolidation.ToolOutputConsolidator;
import edu.harvard.hul.ois.fits.exceptions.FitsConfigurationException;
import edu.harvard.hul.ois.fits.exceptions.FitsException;
import edu.harvard.hul.ois.fits.mapping.FitsXmlMapper;
import edu.harvard.hul.ois.fits.tools.Tool;
import edu.harvard.hul.ois.fits.tools.Tool.RunStatus;
import edu.harvard.hul.ois.fits.tools.ToolBelt;
import edu.harvard.hul.ois.fits.tools.ToolOutput;
import edu.harvard.hul.ois.ots.schemas.XmlContent.XmlContent;
/**
* The main class for FITS.
*/
public class Fits {
private static Logger logger;
public static volatile String FITS_HOME;
public static String FITS_XML;
public static String FITS_TOOLS;
public static XMLConfiguration config;
public static FitsXmlMapper mapper;
public static boolean validateToolOutput;
public static boolean enableStatistics;
public static String externalOutputSchema;
public static String internalOutputSchema;
public static int maxThreads = 20; // GDM 16-Nov-2012
public static final String XML_NAMESPACE = "http://hul.harvard.edu/ois/xml/ns/fits/fits_output";
public static String VERSION = "0.8";
private ToolOutputConsolidator consolidator;
private static XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
private ToolBelt toolbelt;
private static boolean traverseDirs;
public Fits() throws FitsException {
this( null );
}
public Fits( String fits_home ) throws FitsConfigurationException {
// Set BB_HOME dir with environment variable
FITS_HOME = System.getenv( "FITS_HOME" );
if (FITS_HOME == null) {
// if env variable not set check for fits_home passed into constructor
if (fits_home != null) {
FITS_HOME = fits_home;
} else {
// if fits_home is still not set use the current directory
FITS_HOME = "";
}
}
// If fits home is not an empty string and doesn't send with a file
// separator character, add one
if (FITS_HOME.length() > 0 && !FITS_HOME.endsWith( File.separator )) {
FITS_HOME = FITS_HOME + File.separator;
}
FITS_XML = FITS_HOME + "xml" + File.separator;
FITS_TOOLS = FITS_HOME + "tools" + File.separator;
// Set up logging.
// Now using an explicit properties file, because otherwoise DROID will
// hijack it, and it's cleaner this way anyway.
//(SM 1/2/14 -- Note that this statement probably isn't doing what the author intended.
// If log4j.debug=true is set then it shows that this doesn't actually find the specified
// log4j.properties file. Leaving as is for now since overall logging works as intended.
// also note that any logging statements in this class probably do not work.
System.setProperty( "log4j.configuration", FITS_TOOLS + "log4j.properties" );
logger = Logger.getLogger( this.getClass() );
try {
config = new XMLConfiguration( FITS_XML + "fits.xml" );
} catch (ConfigurationException e) {
logger.fatal( "Error reading " + FITS_XML + "fits.xml: " + e.getClass().getName() );
throw new FitsConfigurationException( "Error reading " + FITS_XML + "fits.xml", e );
}
try {
mapper = new FitsXmlMapper();
} catch (Exception e) {
logger.fatal( "Error creating FITS XML Mapper: " + e.getClass().getName() );
throw new FitsConfigurationException( "Error creating FITS XML Mapper", e );
}
// required config values
try {
validateToolOutput = config.getBoolean( "output.validate-tool-output" );
externalOutputSchema = config.getString( "output.external-output-schema" );
internalOutputSchema = config.getString( "output.internal-output-schema" );
enableStatistics = config.getBoolean( "output.enable-statistics" );
} catch (NoSuchElementException e) {
logger.fatal( "Error in configuration file: " + e.getClass().getName() );
System.out.println( "Error inconfiguration file: " + e.getMessage() );
return;
}
// optional config values GDM 16-Nov-2012
try {
maxThreads = config.getShort( "process.max-threads" );
} catch (NoSuchElementException e) {
}
if (maxThreads < 1) {
// If invalid number specified, use a default.
maxThreads = 20;
}
logger.debug( "Maximum threads = " + maxThreads );
String consolidatorClass = config.getString( "output.dataConsolidator[@class]" );
try {
Class<?> c = Class.forName( consolidatorClass );
consolidator = (ToolOutputConsolidator) c.newInstance();
} catch (Exception e) {
throw new FitsConfigurationException( "Error initializing " + consolidatorClass, e );
}
toolbelt = new ToolBelt( FITS_XML + "fits.xml" );
}
public static void main( String[] args ) throws FitsException, IOException, ParseException, XMLStreamException {
Options options = new Options();
options.addOption( "i", true, "input file or directory" );
options.addOption( "r", false, "process directories recursively when -i is a directory " );
options.addOption( "o", true, "output file or directory if -i is a directory" );
options.addOption( "h", false, "print this message" );
options.addOption( "v", false, "print version information" );
OptionGroup outputOptions = new OptionGroup();
Option stdxml = new Option( "x", false, "convert FITS output to a standard metadata schema" );
Option combinedStd = new Option( "xc", false, "output using a standard metadata schema and include FITS xml" );
outputOptions.addOption( stdxml );
outputOptions.addOption( combinedStd );
options.addOptionGroup( outputOptions );
CommandLineParser parser = new GnuParser();
CommandLine cmd = parser.parse( options, args );
if (cmd.hasOption( "h" )) {
printHelp( options );
System.exit( 0 );
}
if (cmd.hasOption( "v" )) {
System.out.println( Fits.VERSION );
System.exit( 0 );
}
if (cmd.hasOption( "r" )) {
traverseDirs = true;
} else {
traverseDirs = false;
}
if (cmd.hasOption( "i" )) {
String input = cmd.getOptionValue( "i" );
File inputFile = new File( input );
if (inputFile.isDirectory()) {
String outputDir = cmd.getOptionValue( "o" );
if (outputDir == null || !(new File( outputDir ).isDirectory())) {
throw new FitsException(
"When FITS is run in directory processing mode the output location must be a directory" );
}
Fits fits = new Fits();
fits.doDirectory( inputFile, new File( outputDir ), cmd.hasOption( "x" ), cmd.hasOption( "xc" ) );
} else {
Fits fits = new Fits();
FitsOutput result = fits.doSingleFile( inputFile );
fits.outputResults( result, cmd.getOptionValue( "o" ), cmd.hasOption( "x" ), cmd.hasOption( "xc" ), false );
}
} else {
System.err.println( "Invalid CLI options" );
printHelp( options );
System.exit( -1 );
}
System.exit( 0 );
}
/**
* Recursively processes all files in the directory.
*
* @param intputFile
* @param useStandardSchemas
* @throws IOException
* @throws XMLStreamException
* @throws FitsException
*/
private void doDirectory(File inputDir, File outputDir,boolean useStandardSchemas, boolean standardCombinedFormat) throws FitsException, XMLStreamException, IOException {
if(inputDir.listFiles() == null) {
return;
}
logger.info("Processing directory " + inputDir.getAbsolutePath());
for (File f : inputDir.listFiles()) {
if(f == null || !f.exists() || !f.canRead()) {
continue;
}
logger.info("processing " + f.getPath());
if (f.isDirectory() && traverseDirs) {
doDirectory(f, outputDir, useStandardSchemas, standardCombinedFormat);
} else if (f.isFile()) {
if (".DS_Store".equals(f.getName())) {
// Mac hidden directory services file, ignore
logger.debug("Skipping .DS_Store");
continue;
}
FitsOutput result = doSingleFile(f);
String outputFile = outputDir.getPath() + File.separator + f.getName() + ".fits.xml";
File output = new File(outputFile);
if (output.exists()) {
int cnt = 1;
while (true) {
outputFile = outputDir.getPath() + File.separator + f.getName() + "-" + cnt + ".fits.xml";
output = new File(outputFile);
if (!output.exists()) {
break;
}
cnt++;
}
}
outputResults(result, outputFile, useStandardSchemas,
standardCombinedFormat, true);
}
}
}
/**
* processes a single file and outputs to the provided output location.
* Outputs to standard out if outputLocation is null
*
* @param inputFile
* @param outputLocation
* @param useStandardSchemas
* - use standard schemas if available for output type
* @throws FitsException
* @throws XMLStreamException
* @throws IOException
*/
private FitsOutput doSingleFile( File inputFile ) throws FitsException, XMLStreamException, IOException {
logger.debug( "Processing file " + inputFile.getAbsolutePath() );
FitsOutput result = this.examine( inputFile );
if (result.getCaughtExceptions().size() > 0) {
for (Exception e : result.getCaughtExceptions()) {
System.err.println( "Warning: " + e.getMessage() );
}
}
return result;
}
private void outputResults( FitsOutput result, String outputLocation, boolean standardSchema,
boolean standardCombinedFormat, boolean dirMode ) throws XMLStreamException, IOException, FitsException {
OutputStream out = null;
logger.debug( "Outputting results" );
try {
// figure out the output location
if (outputLocation != null) {
out = new FileOutputStream( outputLocation );
} else if (!dirMode) {
out = System.out;
} else {
throw new FitsException( "The output location must be provided when running FITS in directory mode" );
}
// if -x is set, then convert to standard metadata schema and output to -o
if (standardSchema) {
outputStandardSchemaXml( result, out );
}
// if we are using -xc output FITS xml and standard format
else if (standardCombinedFormat) {
outputStandardCombinedFormat( result, out );
}
// else output FITS XML to -o
else {
Document doc = result.getFitsXml();
XMLOutputter serializer = new XMLOutputter( Format.getPrettyFormat() );
serializer.output( doc, out );
}
} finally {
if (out != null) {
out.close();
}
}
}
public static void outputStandardCombinedFormat( FitsOutput result, OutputStream out ) throws XMLStreamException,
IOException, FitsException {
// add the normal fits xml output
result.addStandardCombinedFormat();
// output the merged JDOM Document
XMLOutputter serializer = new XMLOutputter( Format.getPrettyFormat() );
serializer.output( result.getFitsXml(), out );
}
public static void outputStandardSchemaXml( FitsOutput fitsOutput, OutputStream out ) throws XMLStreamException,
IOException {
XmlContent xml = fitsOutput.getStandardXmlContent();
// create an xml output factory
Transformer transformer = null;
// initialize transformer for pretty print xslt
TransformerFactory tFactory = TransformerFactory.newInstance();
String prettyPrintXslt = FITS_XML + "prettyprint.xslt";
try {
Templates template = tFactory.newTemplates( new StreamSource( prettyPrintXslt ) );
transformer = template.newTransformer();
} catch (Exception e) {
transformer = null;
}
if (xml != null && transformer != null) {
xml.setRoot( true );
ByteArrayOutputStream xmlOutStream = new ByteArrayOutputStream();
OutputStream xsltOutStream = new ByteArrayOutputStream();
try {
// send standard xml to the output stream
XMLStreamWriter sw = xmlOutputFactory.createXMLStreamWriter( xmlOutStream );
xml.output( sw );
// convert output stream to byte array and read back in as inputstream
Source source = new StreamSource( new ByteArrayInputStream( xmlOutStream.toByteArray() ) );
Result rstream = new StreamResult( xsltOutStream );
// apply the xslt
transformer.transform( source, rstream );
// send to the providedOutpuStream
out.write( xsltOutStream.toString().getBytes( "UTF-8" ) );
out.flush();
} catch (Exception e) {
System.err.println( "error converting output to a standard schema format" );
} finally {
xmlOutStream.close();
xsltOutStream.close();
}
} else {
System.err.println( "Error: output cannot be converted to a standard schema format for this file" );
}
}
private static void printHelp( Options opts ) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp( "fits", opts );
}
/*
* ORIGINAL EXAMINE METHOD WITHOUT THREADS
*
* public FitsOutput examineOriginal(File input) throws FitsException {
* if(!input.exists()) { throw new
* FitsConfigurationException(input+" does not exist or is not readable"); }
*
* List<ToolOutput> toolResults = new ArrayList<ToolOutput>();
*
* //run file through each tool, catching exceptions thrown by tools
* List<Exception> caughtExceptions = new ArrayList<Exception>(); String path
* = input.getPath().toLowerCase(); String ext =
* path.substring(path.lastIndexOf(".")+1); for(Tool t : toolbelt.getTools())
* { if(t.isEnabled()) { if(!t.hasExcludedExtension(ext)) { try { ToolOutput
* tOutput = t.extractInfo(input); toolResults.add(tOutput); } catch(Exception
* e) { caughtExceptions.add(e); } } } }
*
*
* // consolidate the results into a single DOM FitsOutput result =
* consolidator.processResults(toolResults);
* result.setCaughtExceptions(caughtExceptions);
*
* for(Tool t: toolbelt.getTools()) { t.resetOutput(); }
*
* return result; }
*/
public FitsOutput examine( File input ) throws FitsException {
long t1 = System.currentTimeMillis();
if (!input.exists()) {
throw new FitsConfigurationException( input + " does not exist or is not readable" );
}
List<ToolOutput> toolResults = new ArrayList<ToolOutput>();
// run file through each tool, catching exceptions thrown by tools
List<Exception> caughtExceptions = new ArrayList<Exception>();
String path = input.getPath().toLowerCase();
String ext = path.substring( path.lastIndexOf( "." ) + 1 );
ArrayList<Thread> threads = new ArrayList<Thread>();
// GDM 16-Nov-12: Implement limit on maximum threads
for (Tool t : toolbelt.getTools()) {
if (t.isEnabled()) {
// figure out of the tool should be run against the file depending on
// the include and exclude extension lists
RunStatus runStatus = RunStatus.SHOULDNOTRUN;
// if the tool has an include-exts list and it has the extension in it,
// then run
if (t.hasIncludedExtensions()) {
if (t.hasIncludedExtension( ext )) {
runStatus = RunStatus.SHOULDRUN;
}
}
// if the tool has an exclude-exts list and it does NOT have the
// extension in it, then run
else if (t.hasExcludedExtensions()) {
if (!t.hasExcludedExtension( ext )) {
runStatus = RunStatus.SHOULDRUN;
}
}
// if the tool does not have an include-exts or exclude-exts list then
// run
else if (!t.hasIncludedExtensions() && !t.hasExcludedExtensions()) {
runStatus = RunStatus.SHOULDRUN;
}
t.setRunStatus( runStatus );
if (runStatus == RunStatus.SHOULDRUN) {
// Don't exceed the maximum thread count
while (countActiveTools( threads ) >= maxThreads) {
try {
Thread.sleep( 200 );
} catch (InterruptedException e) {
}
}
// spin up new threads
t.setInputFile( input );
// GDM 16-Nov-12: Name the threads as a debugging aid
Thread thread = new Thread( t, t.getToolInfo().getName() );
threads.add( thread );
logger.debug( "Starting thread " + thread.getName() );
thread.start();
}
}
}
// wait for them all to finish
for (Thread thread : threads) {
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// get all output from the tools
for (Tool t : toolbelt.getTools()) {
toolResults.add( t.getOutput() );
}
// consolidate the results into a single DOM
FitsOutput result = consolidator.processResults( toolResults );
result.setCaughtExceptions( caughtExceptions );
long t2 = System.currentTimeMillis();
if (enableStatistics) {
result.createStatistics( toolbelt, ext, t2 - t1 );
}
for (Tool t : toolbelt.getTools()) {
t.resetOutput();
}
return result;
}
public ToolBelt getToolbelt() {
return toolbelt;
}
/* Count up all the threads that are still running */
private int countActiveTools( List<Thread> threads ) {
int count = 0;
for (Thread t : threads) {
if (t.isAlive()) {
++count;
}
}
return count;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
e7b9fe09ab2fc1a414ec5256f80ffb9be5ec1ece | 6ed265d74a0161f10c2f34752483d6d7bf86376a | /src/main/java/net/originmobi/pdv/repository/AjusteProdutoRepository.java | c304c857936332a378b7cb00a752e650cbb0e558 | [
"Apache-2.0"
] | permissive | joaotux/pdv | 4ce3df47c12fb165a443c1cb2410aab5f2f9b9e4 | 8ed96d5d727adec0606a912a0b4a2c65bc0d54fd | refs/heads/master | 2022-07-10T16:57:55.192279 | 2022-06-22T18:30:16 | 2022-06-22T18:30:16 | 137,320,615 | 44 | 38 | Apache-2.0 | 2022-06-22T18:30:17 | 2018-06-14T07:12:49 | Java | UTF-8 | Java | false | false | 1,485 | java | package net.originmobi.pdv.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import net.originmobi.pdv.model.AjusteProduto;
public interface AjusteProdutoRepository extends JpaRepository<AjusteProduto, Long> {
List<AjusteProduto> findByAjusteCodigoEquals(Long codAjuste);
@Transactional
@Modifying
@Query(value = "insert into ajuste_produtos (ajuste_codigo, produto_codigo, estoque_atual, qtd_alteracao, qtd_nova) "
+ "values (:codajuste, :codprod, :estoque_atual, :qtd_alteracao, :qtd_nova)", nativeQuery = true)
void insereProduto(@Param("codajuste") Long codajuste, @Param("codprod") Long codprod,
@Param("estoque_atual") int estoque_aqual, @Param("qtd_alteracao") int qtd_alteracao,
@Param("qtd_nova") int qtd_nova);
@Query(value = "select count(*) from ajuste_produtos where ajuste_codigo = :codAjuste and produto_codigo = :codprod", nativeQuery = true)
int buscaProdAjuste(@Param("codAjuste") Long codAjuste, @Param("codprod") Long codProd);
@Transactional
@Modifying
@Query(value = "delete from ajuste_produtos where ajuste_codigo = :ajuste and codigo = :codigo", nativeQuery = true)
void removeProduto(@Param("ajuste") Long codajuste, @Param("codigo") Long coditem);
}
| [
"j.rafael.tux@gmail.com"
] | j.rafael.tux@gmail.com |
bc8202c2dce29f50baa099286bba8c6eec23f17b | 791ee607a1082653db45dabcb442884eaced94f1 | /src/es/istr/unican/jmastanalysis/analysis/results/GlobalMissRatioList.java | 020b7d5a63fc51e7e58f7ebc6078ede968115e82 | [] | no_license | rivasjm/JMastAnalysis | d4e4ba1e0ab6a5c1b1808767fc0c2be77cd8d688 | ad1f43fb22d29de9b732b78d70cbcc2d5ab9c368 | refs/heads/master | 2021-01-21T13:26:12.288139 | 2016-05-19T09:15:34 | 2016-05-19T09:15:34 | 45,423,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,401 | 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: 2015.08.19 at 05:12:38 PM CEST
//
package es.istr.unican.jmastanalysis.analysis.results;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import java.util.ArrayList;
import java.util.List;
/**
* <p>Java class for Global_Miss_Ratio_List complex type.
* <p>
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <complexType name="Global_Miss_Ratio_List">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Global_Miss_Ratio" type="{http://mast.unican.es/xmlmast/xmlmast_1_4/Mast_Result}Global_Miss_Ratio" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Global_Miss_Ratio_List", propOrder = {
"globalMissRatio"
})
public class GlobalMissRatioList {
@XmlElement(name = "Global_Miss_Ratio", required = true)
protected List<GlobalMissRatio> globalMissRatio;
/**
* Gets the value of the globalMissRatio property.
* <p>
* <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 globalMissRatio property.
* <p>
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getGlobalMissRatio().add(newItem);
* </pre>
* <p>
* <p>
* <p>
* Objects of the following type(s) are allowed in the list
* {@link GlobalMissRatio }
*/
public List<GlobalMissRatio> getGlobalMissRatio() {
if (globalMissRatio == null) {
globalMissRatio = new ArrayList<GlobalMissRatio>();
}
return this.globalMissRatio;
}
}
| [
"jmrivasconcepcion@gmail.com"
] | jmrivasconcepcion@gmail.com |
ce833eaabd0598fd53fac408d9a01bc9976e616d | 4c63a7cf53de6bc07fbec891e1ee7c07d44c321c | /src/main/java/de/workshops/bookdemo/books/BookRepository.java | 54d2a7bd9b9ad17aae7799e58943a1e315ae34af | [] | no_license | workshops-de/spring-boot-example | 68f7ed2c8276f148c1d579e1289ec08ee8b36f4d | a8557e66ca00ec82315e9301252cd603eac2a42e | refs/heads/master | 2022-07-07T17:40:38.933972 | 2020-05-12T08:01:21 | 2020-05-12T08:01:21 | 259,620,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,151 | java | package de.workshops.bookdemo.books;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
//@Repository
public class BookRepository {
@NonNull
private ObjectMapper mapper;
List<Book> books = new ArrayList<Book>();
public List<Book> findAll() throws Exception {
books.addAll(Arrays.asList(mapper.readValue(new File("target/classes/books.json"), Book[].class)));
return books;
}
public Optional<Book> findByIsbn(String isbn) throws Exception {
return Arrays.asList(mapper.readValue(new File("target/classes/books.json"), Book[].class))
.stream().filter(book -> book.getIsbn().equalsIgnoreCase(isbn)).findFirst();
}
public Book create(Book book) {
books.add(book);
return book;
}
}
| [
"hirt@todo42.de"
] | hirt@todo42.de |
842d9a1878af68ccf5ffe90f270bc826063b9cdb | e0af9ba5cd7c1e9e43e7f3e5dc8d9f890cf6ec89 | /Serena and Mugs/Main.java | a789e4831fcafe01f7b101f92430ab48815f8d2d | [] | no_license | neetuchandravadan08/Playground | fc373ef3875dc3b86552784f9ac1c19bde923601 | b7e7794f6d64244daf88ac4abefcff25c5f9819e | refs/heads/master | 2021-06-03T02:48:41.929550 | 2020-06-30T07:59:58 | 2020-06-30T07:59:58 | 254,332,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | #include<iostream>
using namespace std;
int main()
{
int c,sum=0,n;
cin>>n;
cin>>c;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
for(int i=0;i<n;i++)
{
sum=sum+arr[i];
}
if(sum<=c)
{
cout<<"YES";
}
else
{
cout<<"NO";
}
return 0;
}
| [
"58872261+neetuchandravadan08@users.noreply.github.com"
] | 58872261+neetuchandravadan08@users.noreply.github.com |
31c9bbcbb7cd3ceeb5c6998f246368e26aba2a71 | 84659009ccdba5406278c3518666292a7f4668b0 | /videoservice/src/main/java/com/de/vo/SimpleCameraListVO.java | 1ac1df7a59526bc94d354b5c67567fb8f8fdce98 | [] | no_license | Pokman321/gs_bishe | a35a29fa06f93df89d5a2512e53e0133572fb8e7 | 7523b8dc2854400783a74a5c637378640343768e | refs/heads/master | 2023-01-08T10:47:52.414488 | 2020-11-02T08:56:48 | 2020-11-02T08:56:48 | 296,902,777 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package com.de.vo;
import java.io.Serializable;
/**
* @author gs
* @date 2020/6/15 - 0:32
*/
public class SimpleCameraListVO implements Serializable {
private int cameraId;
private String cameraName;
public int getCameraId() {
return cameraId;
}
public void setCameraId(int cameraId) {
this.cameraId = cameraId;
}
public String getCameraName() {
return cameraName;
}
public void setCameraName(String cameraName) {
this.cameraName = cameraName;
}
}
| [
"gaosongtju@163.com"
] | gaosongtju@163.com |
d9e530e2b1c6809902949f284c7819be5c1f151e | aafdc711689797a76bada418d022714495b7894c | /Workspaces/intelij/work/AE_SEM_CS_Interface/ESPInterfaceGenerate/src/main/java/net/aconite/affina/espinterface/xmlmapping/sem/ScriptType.java | f89b2c5e705b1c4c03d4cf95174c9d2ee8e151f2 | [] | no_license | wakmo/WakWork | 07561a1f9d7e089b6ae6a59c33d4187a033ddfbc | b062b35f71721b9d10ca2cf93cc5740e277cb001 | refs/heads/master | 2020-06-04T10:02:31.843536 | 2014-09-16T13:56:14 | 2014-09-16T13:56:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,527 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833
// 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: 2014.07.11 at 04:22:05 PM BST
//
package net.aconite.affina.espinterface.xmlmapping.sem;
import java.math.BigInteger;
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.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for ScriptType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ScriptType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="scriptCommands">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="scriptCommand" maxOccurs="unbounded">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="dataItems">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence maxOccurs="unbounded" minOccurs="0">
* <element name="dataItem" type="{}TagType"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="CLA" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="INS" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="P1" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="P2" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* <element name="validPeriod">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="startDate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="endDate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="businessFunctionID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="businessFunctionGroup" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" />
* <attribute name="scriptType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="validDevices" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="priority" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* <attribute name="autoRestageLimit" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ScriptType", propOrder = {
"scriptCommands",
"validPeriod"
})
public class ScriptType {
@XmlElement(required = true)
protected ScriptType.ScriptCommands scriptCommands;
@XmlElement(required = true)
protected ScriptType.ValidPeriod validPeriod;
@XmlAttribute(required = true)
protected String businessFunctionID;
@XmlAttribute(required = true)
@XmlSchemaType(name = "nonNegativeInteger")
protected BigInteger businessFunctionGroup;
@XmlAttribute(required = true)
protected String scriptType;
@XmlAttribute(required = true)
protected BigInteger validDevices;
@XmlAttribute(required = true)
protected BigInteger priority;
@XmlAttribute(required = true)
protected BigInteger autoRestageLimit;
/**
* Gets the value of the scriptCommands property.
*
* @return
* possible object is
* {@link ScriptType.ScriptCommands }
*
*/
public ScriptType.ScriptCommands getScriptCommands() {
return scriptCommands;
}
/**
* Sets the value of the scriptCommands property.
*
* @param value
* allowed object is
* {@link ScriptType.ScriptCommands }
*
*/
public void setScriptCommands(ScriptType.ScriptCommands value) {
this.scriptCommands = value;
}
/**
* Gets the value of the validPeriod property.
*
* @return
* possible object is
* {@link ScriptType.ValidPeriod }
*
*/
public ScriptType.ValidPeriod getValidPeriod() {
return validPeriod;
}
/**
* Sets the value of the validPeriod property.
*
* @param value
* allowed object is
* {@link ScriptType.ValidPeriod }
*
*/
public void setValidPeriod(ScriptType.ValidPeriod value) {
this.validPeriod = value;
}
/**
* Gets the value of the businessFunctionID property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBusinessFunctionID() {
return businessFunctionID;
}
/**
* Sets the value of the businessFunctionID property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBusinessFunctionID(String value) {
this.businessFunctionID = value;
}
/**
* Gets the value of the businessFunctionGroup property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getBusinessFunctionGroup() {
return businessFunctionGroup;
}
/**
* Sets the value of the businessFunctionGroup property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setBusinessFunctionGroup(BigInteger value) {
this.businessFunctionGroup = value;
}
/**
* Gets the value of the scriptType property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getScriptType() {
return scriptType;
}
/**
* Sets the value of the scriptType property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setScriptType(String value) {
this.scriptType = value;
}
/**
* Gets the value of the validDevices property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getValidDevices() {
return validDevices;
}
/**
* Sets the value of the validDevices property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setValidDevices(BigInteger value) {
this.validDevices = value;
}
/**
* Gets the value of the priority property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getPriority() {
return priority;
}
/**
* Sets the value of the priority property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setPriority(BigInteger value) {
this.priority = value;
}
/**
* Gets the value of the autoRestageLimit property.
*
* @return
* possible object is
* {@link BigInteger }
*
*/
public BigInteger getAutoRestageLimit() {
return autoRestageLimit;
}
/**
* Sets the value of the autoRestageLimit property.
*
* @param value
* allowed object is
* {@link BigInteger }
*
*/
public void setAutoRestageLimit(BigInteger value) {
this.autoRestageLimit = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="scriptCommand" maxOccurs="unbounded">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="dataItems">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence maxOccurs="unbounded" minOccurs="0">
* <element name="dataItem" type="{}TagType"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="CLA" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="INS" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="P1" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="P2" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"scriptCommand"
})
public static class ScriptCommands {
@XmlElement(required = true)
protected List<ScriptType.ScriptCommands.ScriptCommand> scriptCommand;
/**
* Gets the value of the scriptCommand 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 scriptCommand property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getScriptCommand().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ScriptType.ScriptCommands.ScriptCommand }
*
*
*/
public List<ScriptType.ScriptCommands.ScriptCommand> getScriptCommand() {
if (scriptCommand == null) {
scriptCommand = new ArrayList<ScriptType.ScriptCommands.ScriptCommand>();
}
return this.scriptCommand;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="dataItems">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence maxOccurs="unbounded" minOccurs="0">
* <element name="dataItem" type="{}TagType"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* <attribute name="CLA" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="INS" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="P1" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="P2" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"dataItems"
})
public static class ScriptCommand {
@XmlElement(required = true)
protected ScriptType.ScriptCommands.ScriptCommand.DataItems dataItems;
@XmlAttribute(name = "CLA", required = true)
protected String cla;
@XmlAttribute(name = "INS", required = true)
protected String ins;
@XmlAttribute(name = "P1", required = true)
protected String p1;
@XmlAttribute(name = "P2", required = true)
protected String p2;
/**
* Gets the value of the dataItems property.
*
* @return
* possible object is
* {@link ScriptType.ScriptCommands.ScriptCommand.DataItems }
*
*/
public ScriptType.ScriptCommands.ScriptCommand.DataItems getDataItems() {
return dataItems;
}
/**
* Sets the value of the dataItems property.
*
* @param value
* allowed object is
* {@link ScriptType.ScriptCommands.ScriptCommand.DataItems }
*
*/
public void setDataItems(ScriptType.ScriptCommands.ScriptCommand.DataItems value) {
this.dataItems = value;
}
/**
* Gets the value of the cla property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCLA() {
return cla;
}
/**
* Sets the value of the cla property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCLA(String value) {
this.cla = value;
}
/**
* Gets the value of the ins property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getINS() {
return ins;
}
/**
* Sets the value of the ins property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setINS(String value) {
this.ins = value;
}
/**
* Gets the value of the p1 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getP1() {
return p1;
}
/**
* Sets the value of the p1 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setP1(String value) {
this.p1 = value;
}
/**
* Gets the value of the p2 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getP2() {
return p2;
}
/**
* Sets the value of the p2 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setP2(String value) {
this.p2 = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence maxOccurs="unbounded" minOccurs="0">
* <element name="dataItem" type="{}TagType"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"dataItem"
})
public static class DataItems {
protected List<TagType> dataItem;
/**
* Gets the value of the dataItem 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 dataItem property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDataItem().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link TagType }
*
*
*/
public List<TagType> getDataItem() {
if (dataItem == null) {
dataItem = new ArrayList<TagType>();
}
return this.dataItem;
}
}
}
}
/**
* <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="startDate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="endDate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class ValidPeriod {
@XmlAttribute(required = true)
protected String startDate;
@XmlAttribute(required = true)
protected String endDate;
/**
* Gets the value of the startDate property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getStartDate() {
return startDate;
}
/**
* Sets the value of the startDate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setStartDate(String value) {
this.startDate = value;
}
/**
* Gets the value of the endDate property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getEndDate() {
return endDate;
}
/**
* Sets the value of the endDate property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEndDate(String value) {
this.endDate = value;
}
}
}
| [
"wakkir.muzammil@aconite.net"
] | wakkir.muzammil@aconite.net |
a01bd9ff18a73deb5d8a39767d2d43a33bc5701e | 53189efbfed5423821a84f631da404d07a80e404 | /storage/app/Al-QuranIndonesia_com.andi.alquran.id_source_from_JADX/com/google/android/gms/tagmanager/ar.java | fe90815fd1af35923678ff772ec901ab82204ab4 | [
"MIT"
] | permissive | dwijpr/islam | 0c9b77028d34862b6d06858c5b0d6ffec91b5014 | 6077291a619ac2f5b30a77e284c0a7361e7c8ad4 | refs/heads/master | 2021-01-19T17:16:49.818251 | 2017-03-13T23:00:08 | 2017-03-13T23:00:08 | 82,430,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,004 | java | package com.google.android.gms.tagmanager;
import android.util.Log;
public class ar implements C2214o {
private int f7088a;
public ar() {
this.f7088a = 5;
}
public void m10207a(String str) {
if (this.f7088a <= 6) {
Log.e("GoogleTagManager", str);
}
}
public void m10208a(String str, Throwable th) {
if (this.f7088a <= 6) {
Log.e("GoogleTagManager", str, th);
}
}
public void m10209b(String str) {
if (this.f7088a <= 5) {
Log.w("GoogleTagManager", str);
}
}
public void m10210b(String str, Throwable th) {
if (this.f7088a <= 5) {
Log.w("GoogleTagManager", str, th);
}
}
public void m10211c(String str) {
if (this.f7088a <= 4) {
Log.i("GoogleTagManager", str);
}
}
public void m10212d(String str) {
if (this.f7088a <= 2) {
Log.v("GoogleTagManager", str);
}
}
}
| [
"dwijpr@gmail.com"
] | dwijpr@gmail.com |
ef6243a39507b804965ea53287690427c84ada0c | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/10/10_564ef2858cf8a41f0bf62af1c7dae6d83c526a6b/ViewApplication/10_564ef2858cf8a41f0bf62af1c7dae6d83c526a6b_ViewApplication_t.java | 08a50dbe89ab2088eda7a53dee72026f4f596c78 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 6,523 | java | package com.sun.identity.admin.model;
import com.sun.identity.admin.ManagedBeanResolver;
import com.sun.identity.admin.Resources;
import com.sun.identity.admin.dao.ViewApplicationTypeDao;
import com.sun.identity.entitlement.Application;
import com.sun.identity.entitlement.ApplicationManager;
import com.sun.identity.entitlement.EntitlementException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class ViewApplication implements Serializable {
private String name;
private ViewApplicationType viewApplicationType;
private List<Resource> resources = new ArrayList<Resource>();
private List<Action> actions = new ArrayList<Action>();
private List<ConditionType> conditionTypes = new ArrayList<ConditionType>();
private List<SubjectType> subjectTypes = new ArrayList<SubjectType>();
public ViewApplication(Application a) {
ManagedBeanResolver mbr = new ManagedBeanResolver();
name = a.getName();
// application type
Map<String, ViewApplicationType> entitlementApplicationTypeToViewApplicationTypeMap = (Map<String, ViewApplicationType>) mbr.resolve("entitlementApplicationTypeToViewApplicationTypeMap");
viewApplicationType = entitlementApplicationTypeToViewApplicationTypeMap.get(a.getApplicationType().getName());
// resources
for (String resourceString : a.getResources()) {
Resource r;
try {
r = (Resource) Class.forName(viewApplicationType.getResourceClassName()).newInstance();
} catch (ClassNotFoundException cnfe) {
throw new RuntimeException(cnfe);
} catch (InstantiationException ie) {
throw new RuntimeException(ie);
} catch (IllegalAccessException iae) {
throw new RuntimeException(iae);
}
r.setName(resourceString);
resources.add(r);
}
// actions
for (String actionName : a.getActions().keySet()) {
Boolean value = a.getActions().get(actionName);
BooleanAction ba = new BooleanAction();
ba.setName(actionName);
ba.setAllow(value.booleanValue());
actions.add(ba);
}
// conditions
ConditionTypeFactory ctf = (ConditionTypeFactory) mbr.resolve("conditionTypeFactory");
for (String viewConditionClassName : a.getConditions()) {
Class c;
try {
c = Class.forName(viewConditionClassName);
} catch (ClassNotFoundException cnfe) {
// TODO: log
continue;
}
ConditionType ct = ctf.getConditionType(c);
assert (ct != null);
conditionTypes.add(ct);
}
// subjects
SubjectFactory sf = (SubjectFactory) mbr.resolve("subjectFactory");
for (String viewSubjectClassName : a.getSubjects()) {
SubjectType st = sf.getSubjectType(viewSubjectClassName);
assert (st != null);
subjectTypes.add(st);
}
}
public List<SubjectContainer> getSubjectContainers() {
ManagedBeanResolver mbr = new ManagedBeanResolver();
SubjectFactory sf = (SubjectFactory) mbr.resolve("subjectFactory");
List<SubjectContainer> subjectContainers = new ArrayList<SubjectContainer>();
for (SubjectType st : subjectTypes) {
SubjectContainer sc = sf.getSubjectContainer(st);
if (sc != null && sc.isVisible()) {
subjectContainers.add(sc);
}
}
return subjectContainers;
}
public List<SubjectType> getExpressionSubjectTypes() {
List<SubjectType> ests = new ArrayList<SubjectType>();
for (SubjectType st: subjectTypes) {
if (st.isExpression()) {
ests.add(st);
}
}
return ests;
}
public List<ConditionType> getExpressionConditionTypes() {
List<ConditionType> ects = new ArrayList<ConditionType>();
for (ConditionType ct: conditionTypes) {
if (ct.isExpression()) {
ects.add(ct);
}
}
return ects;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
Resources r = new Resources();
String title = r.getString(this, "title." + name);
return title;
}
public ViewApplicationType getViewApplicationType() {
return viewApplicationType;
}
public void setViewApplicationType(ViewApplicationType viewApplicationType) {
this.viewApplicationType = viewApplicationType;
}
public List<Resource> getResources() {
return resources;
}
public void setResources(List<Resource> resources) {
this.resources = resources;
}
public List<Action> getActions() {
return actions;
}
public void setActions(List<Action> actions) {
this.actions = actions;
}
public Application toApplication(ViewApplicationTypeDao viewApplicationTypeDao) {
//
// this is really just modifies the applications.
//
// TODO: realm
Application app = ApplicationManager.getApplication("/", name);
// resources
Set<String> resourceStrings = new HashSet<String>();
for (Resource r : resources) {
resourceStrings.add(r.getName());
}
app.addResources(resourceStrings);
// actions
Map appActions = app.getActions();
for (Action action : actions) {
if (!appActions.containsKey(action.getName())) {
try {
app.addAction(action.getName(), (Boolean) action.getValue());
} catch (EntitlementException ex) {
//TODO
}
}
}
// conditions
//TODO
return app;
}
public List<ConditionType> getConditionTypes() {
return conditionTypes;
}
public void setConditionTypes(List<ConditionType> conditionTypes) {
this.conditionTypes = conditionTypes;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
8225dc1aa89913915ff9e5f2efaebd9fbc46c9d7 | b4f6337124ff5fd2e2cfd4fe475bdc7996559c97 | /TiboHulensEJB/src/java/entity/Person.java | 19c8e05ddf1bed59c472d85e948e1e259278be54 | [] | no_license | tiboke1992/EindWerkDistrAPPS | b4fbe21e42351a74328e83fffa0a0c6df4484b2d | 9e6902a1c693756d603c39cf91dfe52740b92ab0 | refs/heads/master | 2021-04-09T16:56:45.625826 | 2012-12-02T15:02:39 | 2012-12-02T15:02:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entity;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
*
* @author Tibo
*/
@Entity
public class Person implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String naam;
public String getNaam(){
return this.naam;
}
public void setNaam(String naam){
this.naam = naam;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Person)) {
return false;
}
Person other = (Person) object;
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Person[ id=" + id + " ]";
}
}
| [
"tibo_hulens@hotmail.com"
] | tibo_hulens@hotmail.com |
b02f4d47f119f225493c86623de84c2fedb40813 | faa3742bc6f3e5ecb3873ab4592feb281546d72f | /src/main/java/com/myproject/pageobjects/Homepage.java | 3ffb30f33ebf33a1cc4d8ccb509f05b11f6f77b9 | [] | no_license | devimuni/practice3 | d8def25e3b1c60b00b7f91674d7d8467033d71b6 | 85958e4799230f45db2bfdc6607dcfd9de886108 | refs/heads/master | 2022-12-26T12:12:26.647987 | 2020-10-13T06:24:34 | 2020-10-13T06:24:34 | 303,468,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package com.myproject.pageobjects;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import com.myproject.basepage.Basepage;
public class Homepage extends Basepage{
@FindBy(id="greetings")
private WebElement txtmsg;
@FindBy(id="logout")
private WebElement logoutbtn;
@FindBy(xpath = "//p[contains(text(),'Feel free')]")
private WebElement txtmsg2;
public Homepage()
{
super(driver);
PageFactory.initElements(driver, this);
}
public String getText()
{
String text = Basepage.getText(txtmsg);
return text;
}
public Loginpage clicklogout()
{
Basepage.click(logoutbtn);
return new Loginpage();
}
public String checkText()
{
String text2= Basepage.getText(txtmsg2);
return text2;
}
}
| [
"devi.muni@gmail.com"
] | devi.muni@gmail.com |
8f8b4105342a6324132db35e52be4264510de696 | 1cd6f9829ae7f5cddfd5cccdd706ebd30aa2f6ca | /src/main/java/com/huangxi/service/combine/impl/HeadLineShopCategoryCombineServiceImpl2.java | 190ea373db04309c9bbb92a7e5eb88061df3d5b6 | [] | no_license | zerotoone01/simple-framework | 34f4fbb703d775b73c29eaf7e140eeb869a24a07 | b84143aff2c054caed7b7d98343bc0c716ddd19e | refs/heads/master | 2023-01-30T03:40:06.254535 | 2020-12-14T17:24:36 | 2020-12-14T17:24:36 | 281,105,949 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 533 | java | package com.huangxi.service.combine.impl;
import com.huangxi.entity.dto.MainPageInfoDTO;
import com.huangxi.entity.dto.Result;
import com.huangxi.service.combine.HeadLineShopCategoryCombineService;
import org.simpleframework.core.annotation.Service;
/**
* ๆต่ฏๅคไธชๆฅๅฃๅฎ็ฐ๏ผๅจ่ทๅbeanๅฎไพๆถๅ็ๅผๅธธ
*/
@Service
public class HeadLineShopCategoryCombineServiceImpl2 implements HeadLineShopCategoryCombineService {
@Override
public Result<MainPageInfoDTO> getMainPageInfo() {
return null;
}
}
| [
"zerotoone8@163.com"
] | zerotoone8@163.com |
4daa179166420061d8238049dc4c3f09038bc23c | 6e08c5d4435482ddbd3c3b65dd9ee538248c8fb3 | /src/fr/uga/miashs/album/control/PictureAnnotationController.java | f9757764a4b6fb18a414a03d74f7bcce7871181a | [] | no_license | agnef/projet-jee | f36038a9581b8fec86806472b55b5961b0dc8924 | fd8901e6834a8d6857dba89ec0dc4c8e5468a6ba | refs/heads/master | 2021-01-11T22:13:29.600194 | 2017-01-17T11:53:23 | 2017-01-17T11:53:23 | 78,936,729 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 4,325 | java | package fr.uga.miashs.album.control;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.SessionScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import fr.uga.miashs.album.model.Picture;
import fr.uga.miashs.album.service.PictureAnnotationService;
import fr.uga.miashs.album.service.PictureService;
import fr.uga.miashs.album.service.ServiceException;
@Named
@SessionScoped
public class PictureAnnotationController implements Serializable {
// currentPicture, propriete, valeurPropriete : triplet rdf
private String currentPicture;
private String propriete;
private String valeurPropriete;
private String pictureUri;
private String requete;
@Inject
private PictureAnnotationService pictureAnnotationService;
//getters & setters
public String getCurrentPicture(){
System.out.println("get current picture = current picture : " + currentPicture);
return currentPicture;
}
public String getPictureUri() {
return pictureUri;
}
public void setPictureUri(String pictureUri) {
this.pictureUri = pictureUri;
}
public void setCurrentPicture(String picture){
this.currentPicture = picture;
System.out.println("set current picture = current picture " + picture);
}
public String getRequete() {
return requete;
}
public void setRequete(String requete) {
this.requete = requete;
}
public String getPropriete() {
return propriete;
}
public void setPropriete(String propriete) {
this.propriete = propriete;
System.out.println("set propriรฉtรฉ : " + propriete);
}
public String getValeurPropriete() {
return valeurPropriete;
}
public void setValeurPropriete(String valeurPropriete) {
this.valeurPropriete = valeurPropriete;
System.out.println("set valeur de la propriรฉtรฉ : " + valeurPropriete);
}
// queries
public List<String> getQueryPictureResult(){
System.out.println("requete : " + requete);
List<String> pictName = new ArrayList<String>();
List<Picture> pictures = pictureAnnotationService.queries(requete);
for(int i=0; i<pictures.size(); i++){
pictName.add(pictures.get(i).getFileName());
System.out.println(pictName.get(i));
}
return pictName;
}
public void insertOntology(){
System.out.println("premiere" + valeurPropriete);
if(propriete.equals("pictureDate")){
valeurPropriete = valeurPropriete + "T00:00:00";
}
System.out.println("modif" + valeurPropriete);
pictureAnnotationService.insertOntology(currentPicture, propriete, valeurPropriete);
}
public List<String> seeAnnotations(){
System.out.println("ANNOTATIONS : pictureannotationcontroller");
List<String> annotations = pictureAnnotationService.seeAnnotations(pictureUri);
List<String> displayAnnotations = new ArrayList<String>();
for (int i=0; i<annotations.size(); i++){
if (annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#hasInside"))
displayAnnotations.add("reprรฉsente : ");
else if (annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#inYear"))
displayAnnotations.add("en l'annรฉe : ");
else if(annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#isTakenBy"))
displayAnnotations.add("prise par : ");
else if(annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#isTakenIn"))
displayAnnotations.add("prise ร : ");
else if(annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#during"))
displayAnnotations.add("pendant : ");
else if(annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#pictureDate"))
displayAnnotations.add("prise le : ");
else if (!annotations.get(i).equals("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") &&
!annotations.get(i).equals("http://www.w3.org/2002/07/owl#Thing") &&
!annotations.get(i).equals("http://www.w3.org/2000/01/rdf-schema#Resource") )
displayAnnotations.add(annotations.get(i) + " ");
}
return displayAnnotations;
}
}
| [
"agnese.forlani@gmail.com"
] | agnese.forlani@gmail.com |
fc7dd26dae4399de42b669db2053a4296688ced0 | c8568b77ad88e925c09c292571ff3dca5c7574fc | /app/src/main/java/fi/tamk/jorix3/dreamcrusher/MainActivity.java | 95b78dc0a0890c198bed39c1642d432db572fe12 | [] | no_license | jorix3/DreamCrusher | 3aee39c7bd0ccb8905c4ce943b9dd36e1d0ce2b2 | 28584ed3cd547206398f87d8f6069d58f860e8f2 | refs/heads/master | 2021-09-05T19:18:48.393270 | 2018-01-30T13:51:19 | 2018-01-30T13:51:19 | 119,542,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,669 | java | package fi.tamk.jorix3.dreamcrusher;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
public class MainActivity extends AppCompatActivity {
private SortedSet<Integer> selectedNumbers;
private int threadSleepValue;
private boolean isLottoRunning = false;
private int lvl = 7;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MyDebug.loadMyDebug(this, "MainActivity");
selectedNumbers = new TreeSet<>();
BroadcastReceiver broadcastListener = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
MyDebug.loadMyDebug(context, "MainActivity:MyBroadCastListener");
Bundle bundle = intent.getExtras();
if (bundle != null) {
Set<String> keys = bundle.keySet();
resetButtonStyles();
for (String key : keys) {
if (key.equals("weeks")) {
TextView textView = findViewById(R.id.notifications);
String text = "Weeks passed: " + bundle.getInt(key);
textView.setText(text);
} else {
int value = bundle.getInt(key);
Button button = findViewById(getResources().
getIdentifier("B" + value, "id",
context.getPackageName()));
button.setBackgroundResource(android.R.drawable.btn_star_big_on);
}
MyDebug.print("onReceive",
"" + bundle.getInt(key), 4);
}
}
}
};
threadSleepValue = 510;
LocalBroadcastManager.getInstance(this).
registerReceiver(broadcastListener,
new IntentFilter("LottoService"));
resetButtonStyles();
}
public void sendBroadcast() {
String intentTag = "MainActivity";
LocalBroadcastManager manager =
LocalBroadcastManager.getInstance(this);
Intent intent = new Intent(intentTag);
intent.putExtra("speed", threadSleepValue);
manager.sendBroadcast(intent);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
MenuItem plus = menu.findItem(R.id.plus);
MenuItem minus = menu.findItem(R.id.minus);
plus.setEnabled(true);
minus.setEnabled(true);
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.mainmenu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
switch (item.getItemId()) {
case (R.id.plus):
Toast.makeText(this, "+", Toast.LENGTH_SHORT).show();
if (threadSleepValue > 10) {
threadSleepValue = threadSleepValue - 100;
sendBroadcast();
}
return true;
case (R.id.minus):
Toast.makeText(this, "-", Toast.LENGTH_SHORT).show();
if (threadSleepValue < 5000) {
threadSleepValue = threadSleepValue + 100;
sendBroadcast();
}
return true;
case (R.id.lvl7):
lvl = 7;
resetGame();
return true;
case (R.id.lvl6):
lvl = 6;
resetGame();
return true;
case (R.id.lvl5):
lvl = 5;
resetGame();
return true;
}
return false;
}
public void resetGame() {
Intent lottoIntent = new Intent(this, LottoService.class);
Button button = findViewById(R.id.lucky_button);
isLottoRunning = false;
selectedNumbers = new TreeSet<>();
threadSleepValue = 510;
stopService(lottoIntent);
button.setText("I Feel Lucky");
resetButtonStyles();
resetButtonTextColors();
}
public void resetButtonStyles() {
for (int i = 0; i < 39; i++) {
int value = i + 1;
Button button = findViewById(getResources().
getIdentifier("B" + value, "id",
this.getPackageName()));
button.setBackgroundResource(android.R.drawable.btn_default);
}
}
public void resetButtonTextColors() {
for (int i = 0; i < 39; i++) {
int value = i + 1;
Button button = findViewById(getResources().
getIdentifier("B" + value, "id",
this.getPackageName()));
button.setTextColor(Color.BLACK);
}
}
public void selectNumber(View v) {
Button button = (Button) v;
int value;
try {
value = Integer.parseInt(button.getText().toString());
} catch (NullPointerException | NumberFormatException e) {
e.printStackTrace();
MyDebug.print("selectNumber", "Error getting button number", 2);
return;
}
if (selectedNumbers.contains(value)) {
selectedNumbers.remove(value);
button.setTextColor(Color.BLACK);
MyDebug.print("selectNumber", "removed " + value, 2);
} else if (selectedNumbers.size() < lvl) {
selectedNumbers.add(value);
button.setTextColor(Color.rgb(0, 128, 0));
MyDebug.print("selectNumber", "added " + value, 2);
}
}
public void iFeelLucky(View v) {
for (int i : selectedNumbers) {
MyDebug.print("iFeelLucky", "current numbers: " + i, 2);
}
Intent lottoIntent = new Intent(this, LottoService.class);
Button button = findViewById(R.id.lucky_button);
if (!isLottoRunning && selectedNumbers.size() == lvl) {
int key = 0;
lottoIntent.putExtra("speed", threadSleepValue);
for (int number : selectedNumbers) {
lottoIntent.putExtra(String.valueOf(key), number);
key++;
}
startService(lottoIntent);
button.setText("I Give Up");
isLottoRunning = true;
} else {
stopService(lottoIntent);
button.setText("I Feel Lucky");
isLottoRunning = false;
}
}
}
| [
"jyri.virtaranta@cs.tamk.fi"
] | jyri.virtaranta@cs.tamk.fi |
47ce896932702522d6f4980f2f937df86d3fad5f | 5fd25a97ca8ac0b5f4e92d5babe52add1d643703 | /src/main/java/com/cloudinte/common/utils/MD5Utils.java | a7ffff5898083dce10b3db0a92a27bd56cbe6023 | [] | no_license | zjj-clode/xingzhengguanli2 | dc2e882956c37fd63cec9c6d5212a9f045362fe0 | c9f93d1d30eeef077444cc1806844d9d8f003d4a | refs/heads/master | 2022-12-23T05:12:28.631780 | 2019-12-31T07:34:10 | 2019-12-31T07:34:10 | 231,047,853 | 0 | 0 | null | 2022-12-16T09:57:23 | 2019-12-31T07:33:33 | JavaScript | UTF-8 | Java | false | false | 2,171 | java | package com.cloudinte.common.utils;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5Utils {
public static String getMd5(String pwd) {
try {
// ๅๅปบๅ ๅฏๅฏน่ฑก
MessageDigest digest = MessageDigest.getInstance("md5");
// ่ฐ็จๅ ๅฏๅฏน่ฑก็ๆนๆณ๏ผๅ ๅฏ็ๅจไฝๅทฒ็ปๅฎๆ
byte[] bs = digest.digest(pwd.getBytes());
// ๆฅไธๆฅ๏ผๆไปฌ่ฆๅฏนๅ ๅฏๅ็็ปๆ๏ผ่ฟ่กไผๅ๏ผๆ็
งmysql็ไผๅๆ่ทฏ่ตฐ
// mysql็ไผๅๆ่ทฏ๏ผ
// ็ฌฌไธๆญฅ๏ผๅฐๆฐๆฎๅ
จ้จ่ฝฌๆขๆๆญฃๆฐ๏ผ
String hexString = "";
for (byte b : bs) {
// ็ฌฌไธๆญฅ๏ผๅฐๆฐๆฎๅ
จ้จ่ฝฌๆขๆๆญฃๆฐ๏ผ
// ่งฃ้๏ผไธบไปไน้็จb&255
/*
* b:ๅฎๆฌๆฅๆฏไธไธชbyte็ฑปๅ็ๆฐๆฎ(1ไธชๅญ่) 255๏ผๆฏไธไธชint็ฑปๅ็ๆฐๆฎ(4ไธชๅญ่)
* byte็ฑปๅ็ๆฐๆฎไธint็ฑปๅ็ๆฐๆฎ่ฟ่ก่ฟ็ฎ๏ผไผ่ชๅจ็ฑปๅๆๅไธบint็ฑปๅ eg: b: 1001 1100(ๅๅงๆฐๆฎ)
* ่ฟ็ฎๆถ๏ผ b: 0000 0000 0000 0000 0000 0000 1001 1100 255: 0000
* 0000 0000 0000 0000 0000 1111 1111 ็ปๆ๏ผ0000 0000 0000 0000
* 0000 0000 1001 1100 ๆญคๆถ็tempๆฏไธไธชint็ฑปๅ็ๆดๆฐ
*/
int temp = b & 255;
// ็ฌฌไบๆญฅ๏ผๅฐๆๆ็ๆฐๆฎ่ฝฌๆขๆ16่ฟๅถ็ๅฝขๅผ
// ๆณจๆ๏ผ่ฝฌๆข็ๆถๅๆณจๆifๆญฃๆฐ>=0&&<16๏ผ้ฃไนๅฆๆไฝฟ็จInteger.toHexString()๏ผๅฏ่ฝไผ้ ๆ็ผบๅฐไฝๆฐ
// ๅ ๆญค๏ผ้่ฆๅฏนtemp่ฟ่กๅคๆญ
if (temp < 16 && temp >= 0) {
// ๆๅจ่กฅไธไธไธชโ0โ
hexString = hexString + "0" + Integer.toHexString(temp);
} else {
hexString = hexString + Integer.toHexString(temp);
}
}
return hexString;
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "";
}
}
| [
"2550997042@qq.com"
] | 2550997042@qq.com |
0f42505a911bc5732f24ad052deb16062ddd3706 | dd230495d8d29c3d1b463c7ab31d374d3c23b812 | /app/src/main/java/com/volantgoat/bluetoothchat/helper/SQLHelper.java | 12ee228c7cbb10e4ada2d64183affdda13c7524c | [] | no_license | LCoderFix/BluetoothChat | b799bcb30554d8a70ae0cb84dcb4522a9560899b | 11bfbad9d9d50be102d6bd27b00c46e00ceed2ae | refs/heads/master | 2022-11-06T08:55:17.235376 | 2020-06-16T07:51:11 | 2020-06-16T07:51:11 | 272,641,950 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,146 | java | package com.volantgoat.bluetoothchat.helper;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Create by dong
* Data:2019/12/11
*/
public class SQLHelper extends SQLiteOpenHelper {
public static final String DB_NAME = "blue_tooth_chat_db";
public static final String TABLE_NAME = "chat_table";
public static final String COLUMN_ID = "id";
public static final String COLUMN_NAME = "device_name";
public static final String COLUMN_TAG = "tag";
public static final String COLUMN_CONTENT = "content";
private static final String CREATE_TABLE = "create table " + TABLE_NAME +
"(" + COLUMN_ID + " varchar(40) , " + COLUMN_NAME + " varchar(20) ," + COLUMN_TAG + " int , " + COLUMN_CONTENT + " varchar(100)) ";
public SQLHelper(Context context) {
super(context, DB_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
//ๅๅปบ่กจ
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
| [
"507085831@qq.com"
] | 507085831@qq.com |
fbb57188b63499bea3c3c9f49fc816b59db60346 | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdas/applicationModule/src/test/java/applicationModulepackageJava14/Foo958Test.java | 1c7db78d167ac2238afe320267d305fe1ce65d80 | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package applicationModulepackageJava14;
import org.junit.Test;
public class Foo958Test {
@Test
public void testFoo0() {
new Foo958().foo0();
}
@Test
public void testFoo1() {
new Foo958().foo1();
}
@Test
public void testFoo2() {
new Foo958().foo2();
}
@Test
public void testFoo3() {
new Foo958().foo3();
}
@Test
public void testFoo4() {
new Foo958().foo4();
}
@Test
public void testFoo5() {
new Foo958().foo5();
}
}
| [
"nikita.e.kozlov@gmail.com"
] | nikita.e.kozlov@gmail.com |
53cdf509e1f9dce95ecfce0cfad52c20a00deb81 | d0e1ac9f7bdbcc580c38d059f1dbb6451b8478b5 | /test/relaytask/AuthenticationTest.java | 2a41b00845ba7859091d54d04220b39854f30aed | [] | no_license | small1pharoh/Reply-task | fd80d70821643f7ebff11e20933ccb1e5ba9692f | ba921a3f6987bc021791f5c80278587b56ea8119 | refs/heads/master | 2020-03-25T22:02:08.606558 | 2018-08-09T21:51:20 | 2018-08-09T21:51:20 | 144,202,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,441 | java | package relaytask;
import static org.junit.jupiter.api.Assertions.*;
import java.util.logging.FileHandler;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import userInterface.buttonOperation;
import userInterface.inputVerification;
class AuthenticationTest {
static Logger logger = Logger.getLogger("MyLog");
static FileHandler fh;
@BeforeAll
static void setUpBeforeClass() throws Exception {
try {
// This block configure the logger with handler and formatter
fh = new FileHandler("AuthenticationTest.log");
logger.addHandler(fh);
CustomRecordFormatter formatter = new CustomRecordFormatter();
fh.setFormatter(formatter);
} catch (SecurityException e) {
e.printStackTrace();
}
}
@AfterAll
static void tearDownAfterClass() throws Exception {
}
@BeforeEach
void setUp() throws Exception {
}
@AfterEach
void tearDown() throws Exception {
}
@Test
void test() {
inputVerification inpVer = new inputVerification();
buttonOperation butOp = new buttonOperation();
logger.info("###################################################");
logger.info("########### AuthenticationTest #################");
logger.info("###################################################");
logger.info("I will create a new user for test called testrobot");
String username = "testrobot";
String gender = "Male";
String age = "30";
String output = inpVer.registerButton(username, gender, age);
assertEquals(output,"1");
output = butOp.registerOperButton(username, gender, age);
assertEquals(output,"New user is added successfully");
logger.info("A new user is add successfully");
logger.info("test Pass");
logger.info("--------------------------------------------------------------------");
logger.info("I will try to login with the new user");
String input = "testrobot";
output = inpVer.loginButton(input);
assertEquals(output,"1");
output = butOp.loginOperButton(input);
assertEquals(output,butOp.getUserobj().getUsername()+" is login successfully");
logger.info("I can login with the testrobot");
logger.info("test Pass");
logger.info("--------------------------------------------------------------------");
logger.info("I will try to update the new user");
age = "50";
output = inpVer.updateuserinfoButtom(age);
assertEquals(output,"1");
output = butOp.updateuserinfo("" ,"",age);
assertEquals(output,"User information are updated successfully relogin with you new information");
logger.info("The user information is update successfully");
logger.info("test Pass");
logger.info("--------------------------------------------------------------------");
logger.info("I will try to re login with the new info");
input = "testrobot";
output = inpVer.loginButton(input);
assertEquals(output,"1");
output = butOp.loginOperButton(input);
assertEquals(output,butOp.getUserobj().getUsername()+" is login successfully");
logger.info("I can login with the testrobot");
logger.info("test Pass");
logger.info("--------------------------------------------------------------------");
logger.info("I will try to logout from my account");
input = "testrobot";
output = butOp.logoutOprButton();
assertEquals(output,"1");
logger.info("I can logout from my account");
logger.info("test Pass");
logger.info("--------------------------------------------------------------------");
logger.info("I will try to login and remove my account");
input = "testrobot";
output = inpVer.loginButton(input);
assertEquals(output,"1");
output = butOp.loginOperButton(input);
assertEquals(output,butOp.getUserobj().getUsername()+" is login successfully");
output = butOp.deregisterOperButton();
assertEquals(output,"User removed successfully");
logger.info("I can remove my account");
logger.info("test Pass");
logger.info("--------------------------------------------------------------------");
logger.info("--------------------------------------------------------------------");
}
}
| [
"amer0@DESKTOP-3TST333"
] | amer0@DESKTOP-3TST333 |
02dba73e8e38ad5cffd9e11fc25ea74561ac7437 | c2be2bdbe8c22911af7ef1742e13600e6057e94c | /hibernate-mapping-onetoone/src/main/java/com/dev/hibernate/mapping/onetoone/main/SharedPrimaryKeyMain.java | 10f16e01ffcd6ec30eec6c2eb1e99bac72aa849d | [] | no_license | devanandgv/spring | c67e138526c50b76c6c12049d3fbb321ca634c76 | 952a166bb685cb43f03006860166753a76533353 | refs/heads/master | 2020-03-08T22:22:06.012668 | 2018-08-03T12:52:34 | 2018-08-03T12:52:34 | 128,428,804 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,067 | java | package com.dev.hibernate.mapping.onetoone.main;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import com.dev.hibernate.mapping.onetoone.model.Student;
import com.dev.hibernate.mapping.onetoone.model.StudentDetails;
public class SharedPrimaryKeyMain {
public static void main(String[] args) {
SessionFactory sessionFactory = HibernateUtil.sessionFactory;
Session session = sessionFactory.openSession();
Student student = new Student();
student.setAge(14);
student.setFatherName("Ganesan");
student.setGender("Male");
student.setMotherName("Vembu");
student.setName("Rohan");
StudentDetails studentDetails = new StudentDetails();
studentDetails.setClassNo(9);
studentDetails.setMajorSubject("Science");
studentDetails.setRollNo(15);
studentDetails.setTeacherName("DavidRaj");
student.setStudentDetails(studentDetails);
studentDetails.setStudent(student);
session.beginTransaction();
session.save(studentDetails);
session.getTransaction().commit();
session.close();
HibernateUtil.shutdown();
}
}
| [
"devanandgv@gmail.com"
] | devanandgv@gmail.com |
53e7d9337a6355fe9332baf32d6349c66cb49913 | 7af9a46b984e2657bea3b40c418ecdaaaf290b85 | /app/src/main/java/com/udea/daniel/practicafinal/MainActivity.java | f7c80e9953a54881390d35dc7b8b8b89541e00c1 | [] | no_license | danielgarcia92/PracticaFinal | 6397501a67ce523dfd46c44f4b8aff9d54014958 | 370cb4c469fd77479c14d9f3a166616d7b922b65 | refs/heads/master | 2021-01-16T00:27:47.043847 | 2015-07-26T20:32:32 | 2015-07-26T20:32:32 | 39,740,914 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,129 | java | package com.udea.daniel.practicafinal;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"danielgarcia992@gmail.com"
] | danielgarcia992@gmail.com |
9c1488afac58799769128097512c6f8921ccc0c5 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/test/com/alibaba/json/bvt/serializer/stream/StreamWriterTest_writeValueString1.java | 47f543bf2695794654310acb8b0ab87e242c6e65 | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 744 | java | package com.alibaba.json.bvt.serializer.stream;
import SerializerFeature.BrowserCompatible;
import com.alibaba.fastjson.serializer.SerializeWriter;
import java.io.StringWriter;
import junit.framework.TestCase;
import org.junit.Assert;
public class StreamWriterTest_writeValueString1 extends TestCase {
public void test_0() throws Exception {
StringWriter out = new StringWriter();
SerializeWriter writer = new SerializeWriter(out, 10);
writer.config(BrowserCompatible, true);
Assert.assertEquals(10, writer.getBufferLength());
writer.writeString("abcde12345678\t");
writer.close();
String text = out.toString();
Assert.assertEquals("\"abcde12345678\\t\"", text);
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
2ea47ae83e3b45fc96d5d6ae2f4414438de052b8 | 7209ad8300f5b3911f56bb928c4da90e338d72f4 | /cool-meeting/src/com/zrgj/UI/Controller/check_roleController.java | 52cb813335457ad58088851c243902834e4bc254 | [] | no_license | bobli1128/CoolMeeting | a13b92e8eed840b0a67aad39b4bc913ab2069fd5 | 13e3e53afe8ffd6bc84ac5ab170c14467673bf5f | refs/heads/master | 2020-04-16T09:17:16.415240 | 2019-01-20T11:18:44 | 2019-01-20T11:18:44 | 165,458,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 724 | java | package com.zrgj.UI.Controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.zrgj.BLL.RoleService;
@WebServlet(value={"/roleManage/check.do"})
public class check_roleController extends HttpServlet {
private RoleService service=new RoleService();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.setAttribute("roles", service.getUncheckedRoles());
req.getRequestDispatcher("/roleManage/check_people.jsp").forward(req, resp);
}
}
| [
"lixb0851@gmail.com"
] | lixb0851@gmail.com |
2ba2914012a41d383e55bbbb60d355ecc5662374 | 5629da1eaa5a347262c80c9907eb9e36732e00e0 | /JAVA/TestingSystem_Assignment_07/src/com/vti/entity/Student2.java | 94e201c1be9529af917d6e3c100ec4bd64bae3d2 | [] | no_license | trungkienNUCE/Rocket_13 | ac38ec2df206ce7eb613a014202ec844a6ece143 | 17a7cc741b6594266c7699a2a07a00b903b0b25b | refs/heads/master | 2023-05-31T13:45:36.886971 | 2021-06-16T05:00:04 | 2021-06-16T05:00:04 | 360,833,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 470 | java | package com.vti.entity;
public class Student2 {
private final int id;
private String name;
public Student2(int id, String name) {
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
@Override
public String toString() {
return "Student{" + "name='" + getId() + '\'' + "name='" + name + '\'' + '}';
}
public final static void study() {
System.out.println("ฤang hแปc bร iโฆ");
}
}
| [
"kien1520562@nuce.edu.vn"
] | kien1520562@nuce.edu.vn |
d17b27423808ddda843bdcd9c3c18c5b45aeac88 | ead62c4cc5ca63cd5fa5e12f95b74d806f024107 | /src/PageObjects/SendReportMailer.java | 6381e650797bb43b5186f2b42e6fb8f26183d33d | [] | no_license | GlobalAutomationGrp/MyProject | debd7fe7f4094d3a48807e6d70bb3d30e896f631 | 8c1cc871dd969d991f3bd0bd6c9997386ee848bd | refs/heads/master | 2021-01-01T05:05:11.402060 | 2016-05-06T08:39:43 | 2016-05-06T08:39:43 | 58,191,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,655 | java | package PageObjects;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import javax.mail.BodyPart;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
public class SendReportMailer
{
public static void main(String args[])
{
//Properties props = System.getProperties();
Properties props = new Properties();
/* props.put("mail.smtp.host", "mail.lexmark.com");
props.put("mail.smtp.auth", "false");
props.put("mail.smtp.debug", "true");*/
/** SET MAIL PROPERTIES INTO SESSION */
// Session session = Session.getDefaultInstance(props);
// System.out.println("Start Mail sending");
//Message message = new MimeMessage(session);
/** SET SENDER NAME */
// message.setFrom(new InternetAddress(mailFrom
String host = "squeeze.dhcp.indiadev.lexmark.com";
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", host);
props.put("mail.smtp.user", "rob@lsptest.com");
props.put("mail.smtp.password", "nettest");
props.put("mail.smtp.port", "587");
props.put("mail.smtp.ssl.trust", host);
props.put("mail.smtp.auth", "true");
Session session = Session.getDefaultInstance(props);
MimeMessage message = new MimeMessage(session);
try {
//Set from address
message.setFrom(new InternetAddress("rob@lsptest.com"));
message.addRecipient(Message.RecipientType.TO, new InternetAddress("dthakker@lexmark.com"));
String subject="Test report ZIP file";
message.setSubject(subject);
message.setText("");
BodyPart objMessageBodyPart = new MimeBodyPart();
objMessageBodyPart.setText("Please Find The Attached Report File!");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(objMessageBodyPart);
objMessageBodyPart = new MimeBodyPart();
//Set path to the pdf report file
String filename = System.getProperty("user.dir")+"/XSLT_Reports/output.zip";
//Create data source to attach the file in mail
DataSource source = new FileDataSource(filename);
objMessageBodyPart.setDataHandler(new DataHandler(source));
objMessageBodyPart.setFileName(filename);
multipart.addBodyPart(objMessageBodyPart);
message.setContent(multipart);
Transport transport = session.getTransport("smtp");
transport.connect(host, "rob@lsptest.com", "nettest");
transport.sendMessage(message, message.getAllRecipients());
transport.close();
}
catch (AddressException ae) {
ae.printStackTrace();
}
catch (MessagingException me) {
me.printStackTrace();
}
}
}
| [
"dhairya_thakker25@yahoo.com"
] | dhairya_thakker25@yahoo.com |
40d777cc70ea9090d550af6497896786e1e71994 | b75855675310ecaeb39b035b746a37cf7bf40c5c | /src/GCTest/HellowGC1.java | 79a5c487cf5f871c04416c126eb1142526876c6c | [] | no_license | cwc972135903/ThreadMulti | 151431bd1d7fe24c2d2d8951ed5b497cb4bcf07d | 95c1b295f5dc83c6fa1a49df0256e0235721a1e4 | refs/heads/master | 2023-03-28T16:09:39.175261 | 2021-04-04T13:23:13 | 2021-04-04T13:23:13 | 348,916,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package GCTest;
/**
* <p>Title: xCRMS </p>
* Description: <br>
* Copyright: CorpRights xQuant.com<br>
* Company: xQuant.com<br>
*
* @author wenchao.chai
* @version 1.1.1.RELEASE
* @date 2020/3/28 13:17
*/
public class HellowGC1 {
public static void main(String ...args){
System.out.println("HelloGC");
}
}
| [
"wenchao.chai@xquant.com"
] | wenchao.chai@xquant.com |
4499e06bddec3a1ad09eea5a317c5964221df35b | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_3/src/j/c/h/Calc_1_3_9275.java | 0ca4bd69a26b8d581e828ca72fe0d8e64c3b964c | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 131 | java | package j.c.h;
public class Calc_1_3_9275 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
95b09dda59362e9a2a1b7b80dfc258640ae82e89 | 6bd94f2d729bae4a1fabaae613c727f24dcd19bf | /src/main/java/com/designpatterns/structuralpatterns/decorator/BurgerDecorator.java | ea992386ca938dff5bfc8e847bdce56ca0ae4246 | [] | no_license | MuhammadSobhy/DesignPatterns | 24c84ebbfa158a50b9c30795ab5cba7c2a77ec8e | ec3fd1af2e2fb395a3f44aee3e62cdbbac2050f6 | refs/heads/master | 2022-11-11T06:00:15.899993 | 2020-06-25T12:44:34 | 2020-06-25T12:44:34 | 272,435,811 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.designpatterns.structuralpatterns.decorator;
public class BurgerDecorator implements Burger{
private Burger burger;
public BurgerDecorator(Burger burger) {
super();
this.burger = burger;
}
@Override
public void prepare() {
this.burger.prepare();
}
}
| [
"muhammad.sobhy.ahmed@gmail.com"
] | muhammad.sobhy.ahmed@gmail.com |
dfc6b865cb522b05c8ad79e6c0d368ef3f0d4630 | af7b787325afeb7023147481718f66664c0dfb57 | /Day-11/DeadlockSolution1.java | f59c5c14627043813bc4073f7687443c2604522d | [] | no_license | radhikachanda/java-learning | e5e953bd53d0362165ae113504ad158fc10c8c29 | bb7735fd3f073c278f93fb27b83c2d4ae91d5557 | refs/heads/main | 2023-03-12T12:24:54.817166 | 2021-03-05T19:01:20 | 2021-03-05T19:01:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | public class DeadlockSolution1 {
public static Object Lock1 = new Object();
public static Object Lock2 = new Object();
public static void main(String args[]) {
ThreadDemo1 T1 = new ThreadDemo1();
ThreadDemo2 T2 = new ThreadDemo2();
T1.start();
T2.start();
}
private static class ThreadDemo1 extends Thread {
public void run() {
//there can be additional logic where no critical section code is there
synchronized (Lock1) {
System.out.println("Thread 1: Holding lock 1...");
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
System.out.println("Thread 1: Waiting for lock 2...");
synchronized (Lock2) {
System.out.println("Thread 1: Holding lock 1 & 2...");
}
}
//there can be additional logic where no critical section code is there
}
}
private static class ThreadDemo2 extends Thread {
public void run() {
synchronized (Lock1) {
System.out.println("Thread 2: Holding lock 1...");
try {
Thread.sleep(10);
} catch (InterruptedException e) {
}
System.out.println("Thread 2: Waiting for lock 2...");
synchronized (Lock2) {
System.out.println("Thread 2: Holding lock 1 & 2...");
}
}
}
}
} | [
"ayanghosh2015@gmail.com"
] | ayanghosh2015@gmail.com |
1fa3c393bf306e02daca797e91cefc2bd3b1f5b3 | 4ebed2b8e8b7b4156deadf597b1662170ccd6917 | /Spring-Boot/1-Boot-Core/src/main/java/com/cts/product/Application.java | 9c481f43086b79925d8e200a666493d67753968a | [] | no_license | tracksdata/sme-connectt | 3c6507eada3ae0a77151725e78c9acad69749b98 | 003e00d3dd7970956f2cd0f55221ab0f7d9f0f1b | refs/heads/master | 2023-06-01T23:30:51.964408 | 2021-06-15T04:59:21 | 2021-06-15T04:59:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 653 | java | package com.cts.product;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import com.cts.product.service.ProductService;
import com.cts.product.service.TestServiceImpl;
@SpringBootApplication // Auto Discovery
public class Application {
public static void main(String[] args) {
ApplicationContext ac = SpringApplication.run(Application.class, args);
TestServiceImpl ps1 = ac.getBean(TestServiceImpl.class);
//ProductService ps2 = ac.getBean(ProductService.class);
ps1.process();
//ps2.f1();
}
}
| [
"praveen@Praveens-MacBook-Pro.local"
] | praveen@Praveens-MacBook-Pro.local |
03de611153cc71a7c161bb0a72a31671d7291c76 | 9b27636b2781fede56805c6514cc5983f46741b9 | /src/test/java/com/faceye/test/feature/util/MathUtilsTestCase.java | d7d5e13100ddedb55ad98ff6ce95372b3dd7edf5 | [] | no_license | haipenge/faceye-boot-jpa | d05338e242c8eec92d57e2e1ae4d0b9f1295ee9d | 72b50137c49865a307abd659c8af80971bfeca81 | refs/heads/master | 2020-03-07T08:12:44.632397 | 2018-03-30T02:26:20 | 2018-03-30T02:26:20 | 127,371,075 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 408 | java | package com.faceye.test.feature.util;
import org.junit.Assert;
import org.junit.Test;
import com.faceye.feature.util.MathUtil;
import com.faceye.test.feature.service.BaseTestCase;
public class MathUtilsTestCase extends BaseTestCase {
@Test
public void testRand() throws Exception{
int rand =MathUtil.getRandInt(0, 10);
logger.debug(">>FaceYe --> rand is:"+rand);
Assert.assertTrue(rand>0);
}
}
| [
"haipenge@gmail.com"
] | haipenge@gmail.com |
233368287f3be4af7aab28891ef6b82aa8cbd758 | 8ed00ffe74f1cb78b7fb3c49d4059228a4e25950 | /Java/code/5/JLab0504B/src/Pet.java | eef53164ad4d5cbdfc67d394d12a3c57c5c8ed56 | [] | no_license | DeercoderCourse/Course-Project | 9bbeab3b80a6c82a6eb4f046971640632d42a5d8 | 507d8c05aa598d5230b0b413945e986feab3db4c | refs/heads/master | 2021-01-18T20:25:00.539992 | 2013-04-04T10:21:25 | 2013-04-04T10:21:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 127 | java |
public interface Pet {
public String getName();
public String move();
public String speak();
public String toString();
}
| [
"lllccc2009@gmail.com"
] | lllccc2009@gmail.com |
931cb2d3da6ede6dce0777867724f8886a28f544 | c88cd25ebd6cea7772a59b209f440ddf7411d655 | /src/com/yihen/jdb/business/UserImpl.java | 34829f2f631248c942109516f79f73c0ac67ff1c | [] | no_license | FrostySmile/JDB | c7494a39205c223074d4bde9c531fab865a9d7a9 | b75d5cc8e8572f949f33079513ffdbd47c92b1a9 | refs/heads/master | 2021-01-10T17:22:39.238764 | 2015-09-28T07:29:01 | 2015-09-28T07:29:01 | 43,285,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,381 | java | package com.yihen.jdb.business;
import com.google.gson.reflect.TypeToken;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.client.HttpRequest;
import com.yihen.jdb.bean.URLs;
import com.yihen.jdb.bean.ViewModel.Result;
import com.yihen.jdb.bean.ViewModel.UserViewModel;
import com.yihen.jdb.net.HttpUtilsExtension;
import com.yihen.jdb.tools.JsonConverter;
import java.io.IOException;
/**
* @author Yuanbin
* @ProjectName: jdb_app
* @Description:
* @date 15-2-15 ไธๅ10:55
*/
public class UserImpl implements IUserLab{
private HttpUtils httpUtils;
public UserImpl(){
httpUtils = new HttpUtils();
}
@Override
public UserViewModel login(String userName, String password) {
try {
String string = httpUtils.sendSync(HttpRequest.HttpMethod.GET, "http://192.168.1.121:8080/rest/customer/login.htm?loginName=" + userName + "&loginPwd=" + password).readString();
Result<UserViewModel> result = JsonConverter.deserialize(string, new TypeToken<Result<UserViewModel>>(){}.getType());
} catch (HttpException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
public boolean loginOut(String userName) {
return false;
}
}
| [
"ljd246437@163.com"
] | ljd246437@163.com |
a035c6711ea070a13c9325b43a2d013c9cf49a82 | 473b76b1043df2f09214f8c335d4359d3a8151e0 | /benchmark/bigclonebenchdata_partial/14007786.java | 38111f50c34134f4764a6201650bc3267ec097b7 | [] | no_license | whatafree/JCoffee | 08dc47f79f8369af32e755de01c52d9a8479d44c | fa7194635a5bd48259d325e5b0a190780a53c55f | refs/heads/master | 2022-11-16T01:58:04.254688 | 2020-07-13T20:11:17 | 2020-07-13T20:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,266 | java |
class c14007786 {
@Override
protected IStatus run(IProgressMonitor monitor) {
final int BUFFER_SIZE = 1024;
final int DISPLAY_BUFFER_SIZE = 8196;
File sourceFile = new File(_sourceFile);
File destFile = new File(_destFile);
if (sourceFile.exists()) {
try {
Log.getInstance(FileCopierJob.class).debug(String.format("Start copy of %s to %s", _sourceFile, _destFile));
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(destFile));
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(sourceFile));
monitor.beginTask(Messages.getString("FileCopierJob.MainTask") + " " + _sourceFile, (int) ((sourceFile.length() / DISPLAY_BUFFER_SIZE) + 4));
monitor.worked(1);
byte[] buffer = new byte[BUFFER_SIZE];
int stepRead = 0;
int read;
boolean copying = true;
while (copying) {
read = bis.read(buffer);
if (read > 0) {
bos.write(buffer, 0, read);
stepRead += read;
} else {
copying = false;
}
if (monitor.isCanceled()) {
bos.close();
bis.close();
deleteFile(_destFile);
return Status.CANCEL_STATUS;
}
if (stepRead >= DISPLAY_BUFFER_SIZE) {
monitor.worked(1);
stepRead = 0;
}
}
bos.flush();
bos.close();
bis.close();
monitor.worked(1);
} catch (Exception e) {
processError("Error while copying: " + e.getMessage());
}
Log.getInstance(FileCopierJob.class).debug("End of copy.");
return Status.OK_STATUS;
} else {
processError(Messages.getString("FileCopierJob.ErrorSourceDontExists") + sourceFile.getAbsolutePath());
return Status.CANCEL_STATUS;
}
}
}
| [
"piyush16066@iiitd.ac.in"
] | piyush16066@iiitd.ac.in |
d3f5ecd28f3ba13f26032e3ed45c3ea0e6bb3415 | 6c936d20cd8c526cb18d69c81eeaf826d7e02b30 | /MyConsole/src/test/java/com/jeff/intern/MyConsole/ReadDataTest.java | 875bdb03a2f2cc2647cb17cec595c19d6ef471b5 | [] | no_license | zyj177484/AddressBook2 | c0d3a65a6c94519d0057930818e4bce735ba8bf6 | 6aaeab43e01fb441d0a76fa09ad94edcd79593d7 | refs/heads/master | 2021-01-17T08:50:00.936391 | 2013-05-25T03:22:15 | 2013-05-25T03:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,533 | java | package com.jeff.intern.MyConsole;
import java.io.File;
import java.io.Reader;
import java.io.StringReader;
import net.sf.json.JSONObject;
import org.junit.* ;
import static org.junit.Assert.* ;
public class ReadDataTest {
private ReadData readData=new ReadData();
@Test
public void testBuildJsonObject() throws DataException
{
Reader reader=new StringReader("{\"lilei\":{\"age\":12}}");
JSONObject jsonObject=new JSONObject();
jsonObject.put("age", 12);
JSONObject jsonObject2=new JSONObject();
jsonObject2.put("lilei", jsonObject);
JSONObject jsonObject3=new JSONObject();
jsonObject3.put("root", jsonObject2);
JSONObject temp=ReadData.buildJsonObject(reader);
assertEquals(temp,jsonObject3);
}
@Test
public void testBuildData() throws Exception
{
File file = new File("newFile");
JSONObject jsonO1=new JSONObject();
JSONObject jsonO2=new JSONObject();
jsonO2.put("root", jsonO1);
assertEquals(ReadData.buildData(file),jsonO2);
file = new File("oldFile");
JSONObject jsonObject=new JSONObject();
jsonObject.put("age", 12);
JSONObject jsonObject2=new JSONObject();
jsonObject2.put("lilei", jsonObject);
JSONObject jsonObject3=new JSONObject();
jsonObject3.put("root", jsonObject2);
assertEquals(ReadData.buildData(file),jsonObject3);
}
}
| [
"hacklu.newborn@gmail.com"
] | hacklu.newborn@gmail.com |
6c1f9a5f07c93cb66cc62646f1a6b3cd1a9b4745 | 813c58dd28ee4959b628104233d2f30100259f95 | /src/test/java/test2/Goods.java | 023a402206e061b5e6bdc994dd9fff1328a3ed33 | [] | no_license | kunlun327/lianxi | ddb6192f0f348ad9e1e28bf7565812d1fcb16592 | daafc1bca8c2ec2792123bf42b28f3fe542e404d | refs/heads/master | 2022-12-10T12:05:55.330305 | 2020-09-16T12:08:02 | 2020-09-16T12:08:02 | 295,449,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,234 | java | package test2;
import java.util.Date;
public class Goods {
private String name;
private double price;
private String detail;
private Date creattime;
public Goods(String name, double price, String detail, Date creattime) {
this.name = name;
this.price = price;
this.detail = detail;
this.creattime = creattime;
}
public Goods() {
}
@Override
public String toString() {
return "Goods{" +
"name='" + name + '\'' +
", price=" + price +
", detail='" + detail + '\'' +
", creattime=" + creattime +
'}';
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
public Date getCreattime() {
return creattime;
}
public void setCreattime(Date creattime) {
this.creattime = creattime;
}
}
| [
"3478872602@qq.com"
] | 3478872602@qq.com |
07153097fbd30c1178c825169fe0902110b77b45 | bbc42646d24002abb5db8265415b1442efdd129c | /Java/JavaPatternsAndOther/DDD/infrastructure/src/main/java/dev/gaudnik/infrastructure/BeanConfiguration.java | e4726793859818fdf551a6b39a4926280cb9a669 | [] | no_license | wojciechGaudnik/Learning | 223a162ddddc59aa4cfe49471ce08ba25587cf1b | dfffd4ddd453edf7667fe94b0fb4367235579424 | refs/heads/master | 2023-03-09T02:21:47.975665 | 2023-01-22T16:09:51 | 2023-01-22T16:09:51 | 201,742,343 | 0 | 0 | null | 2023-03-01T05:35:15 | 2019-08-11T09:10:46 | C | UTF-8 | Java | false | false | 351 | java | package dev.gaudnik.infrastructure;
import dev.gaudnik.domain.OrderRepository;
import dev.gaudnik.domain.OrderService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
class BeanConfiguration {
@Bean
OrderService orderService(OrderRepository orderRepository) {
}
}
| [
"wojciech.gaudnik@gmail.com"
] | wojciech.gaudnik@gmail.com |
393a0e7be9bed6e29c5d7ed66c7b83e29e5650aa | 0ccccc208aa55273764aa593779e8fdc1ca7fa76 | /WeatherStationJava/CurrentConditionsDisplay.java | 0f37fb2173e407333a6dd33c8607a4a42cb18290 | [] | no_license | zuzhi/head-first-design-patterns | 295a2ebf2a194cc35db282b1eeb42ad5b698784a | f29c4cee5adaf03dfd3bf18b1030f482850afc6d | refs/heads/master | 2020-04-12T08:31:02.476027 | 2019-01-08T09:19:18 | 2019-01-08T09:19:18 | 162,387,063 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 955 | java | import java.util.Observable;
import java.util.Observer;
public class CurrentConditionsDisplay implements Observer, DisplayElement {
Observable observable;
private float temperature;
private float humidity;
private float pressure;
public CurrentConditionsDisplay(Observable observable) {
this.observable = observable;
observable.addObserver(this);
}
public void update(Observable obs, Object arg) {
if (obs instanceof WeatherData) {
WeatherData weatherData = (WeatherData)obs;
this.temperature = weatherData.getTemperature();
this.humidity = weatherData.getHumidity();
this.pressure = weatherData.getPressure();
display();
}
}
public void display() {
System.out.println("Current conditions: " + temperature
+ "F degrees, " + humidity + "% humidity and " + pressure
+ "in pressure.");
}
} | [
"476513451@qq.com"
] | 476513451@qq.com |
c08b4abcd68f767e62ffbc96a9cf2e7dcaef2788 | c1abc8d334a405a5536ab4fe2d1504c5ba0cd289 | /Back-End/BusReservationSystem/src/main/java/com/lti/dto/ForgotPassDto.java | b197e767d3bcf5e726ba735d5abf83685eda8313 | [] | no_license | akshatra/Bus-Management-System | 989efb58c51d7e613b8cf96a2259186d9a592fec | 34c89c2727c426d7d98c4f4da3da1defbeea8ee0 | refs/heads/master | 2023-01-20T16:25:39.162893 | 2020-12-03T07:55:33 | 2020-12-03T07:55:33 | 289,874,103 | 1 | 6 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.lti.dto;
public class ForgotPassDto {
private String email;
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
} | [
"akshatrabhatt@gmail.com"
] | akshatrabhatt@gmail.com |
87ef8d14c681dabe86d5737889167b6eed50f124 | 3801a73f30aad8da2c020d03deed2c46198266c4 | /jess/PrettyPrinter.java | 47f65642039e6b9bb321d544c8890829fdc542e7 | [] | no_license | rngwrldngnr/Facade | 6eada6681e2e7d5843ba7837a283efee4326e76c | 31a421a55a1f69294fdab6c0f075e89683160b80 | refs/heads/master | 2023-04-25T21:11:53.686955 | 2021-05-28T20:41:26 | 2021-05-28T20:41:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,158 | java | package jess;
import java.util.Iterator;
public class PrettyPrinter implements Visitor
{
private Visitable m_visitable;
private boolean m_inTestCE;
public Object visitDeffacts(final Deffacts deffacts) {
final List list = new List("deffacts", deffacts.getName());
if (deffacts.getDocstring() != null && deffacts.getDocstring().length() > 0) {
list.addQuoted(deffacts.getDocstring());
}
for (int i = 0; i < deffacts.getNFacts(); ++i) {
list.newLine();
list.add(deffacts.getFact(i));
}
return list.toString();
}
public Object visitDeftemplate(final Deftemplate deftemplate) {
final List list = new List("deftemplate", deftemplate.getName());
if (deftemplate.getParent() != null && deftemplate.getParent() != deftemplate) {
list.add("extends");
list.add(deftemplate.getParent().getName());
}
if (deftemplate.getDocstring() != null && deftemplate.getDocstring().length() > 0) {
list.addQuoted(deftemplate.getDocstring());
}
for (int i = 0; i < deftemplate.m_data.size(); i += 3) {
try {
final Value value = deftemplate.m_data.get(i);
final List list2 = new List((value.type() == 16384) ? "slot" : "multislot", value);
final Value value2 = deftemplate.m_data.get(i + 1);
if (!value2.equals(Funcall.NIL) && !value2.equals(Funcall.NILLIST)) {
list2.add(new List((value2.type() == 64) ? "default-dynamic" : "default", value2));
}
final Value value3 = deftemplate.m_data.get(i + 2);
if (value3.intValue(null) != -1) {
list2.add(new List("type", value3));
}
list.newLine();
list.add(list2);
}
catch (JessException ex) {
list.add(ex.toString());
break;
}
}
return list.toString();
}
public Object visitDefglobal(final Defglobal defglobal) {
final List list = new List("defglobal");
list.add("?" + defglobal.getName());
list.add("=");
list.add(defglobal.getInitializationValue());
return list.toString();
}
public Object visitDeffunction(final Deffunction deffunction) {
final List list = new List("deffunction", deffunction.getName());
final List list2 = new List();
final Iterator arguments = deffunction.getArguments();
while (arguments.hasNext()) {
final Deffunction.Argument argument = arguments.next();
list2.add(((argument.m_type == 8) ? "?" : "$?") + argument.m_name);
}
list.add(list2);
if (deffunction.getDocstring() != null && deffunction.getDocstring().length() > 0) {
list.addQuoted(deffunction.getDocstring());
}
final Iterator actions = deffunction.getActions();
while (actions.hasNext()) {
list.newLine();
list.add(actions.next());
}
return list.toString();
}
public Object visitDefrule(final Defrule defrule) {
final List list = new List("defrule");
list.add(defrule.getName());
list.indent(" ");
if (defrule.m_docstring != null && defrule.m_docstring.length() > 0) {
list.newLine();
list.addQuoted(defrule.m_docstring);
}
int n = 0;
final List list2 = new List("declare");
try {
if (defrule.m_salienceVal.type() != 4 || defrule.m_salienceVal.intValue(null) != 0) {
final List list3 = new List("salience");
list3.add(defrule.m_salienceVal);
list2.add(list3);
n = 1;
}
}
catch (JessException ex) {}
if (defrule.getAutoFocus()) {
if (n != 0) {
list2.indent(" ");
list2.newLine();
}
final List list4 = new List("auto-focus");
list4.add("TRUE");
list2.add(list4);
n = 1;
}
if (n != 0) {
list.newLine();
list.add(list2);
}
for (int i = 0; i < defrule.getGroupSize(); ++i) {
final LHSComponent lhsComponent = defrule.getLHSComponent(i);
list.newLine();
list.add(((Visitable)lhsComponent).accept(this));
}
list.newLine();
list.add("=>");
for (int j = 0; j < defrule.getNActions(); ++j) {
list.newLine();
list.add(defrule.getAction(j).toString());
}
return list.toString();
}
public Object visitGroup(final Group group) {
final List list = new List(group.getName());
for (int i = 0; i < group.getGroupSize(); ++i) {
list.add(((Visitable)group.getLHSComponent(i)).accept(this));
}
if (group.getBoundName() != null) {
return "?" + group.getBoundName() + " <- " + list.toString();
}
return list.toString();
}
public Object visitPattern(final Pattern pattern) {
final List list = new List(pattern.getName());
final Deftemplate deftemplate = pattern.getDeftemplate();
this.m_inTestCE = pattern.getName().equals("test");
try {
for (int i = 0; i < pattern.getNSlots(); ++i) {
if (pattern.getNTests(i) != 0) {
List list2;
if (deftemplate.getSlotName(i).equals("__data")) {
list2 = list;
}
else {
list2 = new List(deftemplate.getSlotName(i));
}
for (int j = -1; j <= pattern.getSlotLength(i); ++j) {
final StringBuffer sb = new StringBuffer();
for (int k = 0; k < pattern.getNTests(i); ++k) {
final Test1 test = pattern.getTest(i, k);
if (test.m_subIdx == j) {
if (sb.length() > 0) {
sb.append("&");
}
sb.append(test.accept(this));
}
}
if (sb.length() > 0) {
list2.add(sb);
}
}
if (!deftemplate.getSlotName(i).equals("__data")) {
list.add(list2);
}
}
}
}
catch (JessException ex) {
list.add(ex.getMessage());
}
if (pattern.getBoundName() != null) {
return "?" + pattern.getBoundName() + " <- " + list.toString();
}
return list.toString();
}
public Object visitTest1(final Test1 test1) {
final StringBuffer sb = new StringBuffer();
if (test1.m_test == 1) {
sb.append("~");
}
if (test1.m_slotValue.type() == 64 && !this.m_inTestCE) {
sb.append(":");
}
sb.append(test1.m_slotValue);
return sb.toString();
}
public Object visitDefquery(final Defquery defquery) {
final List list = new List("defquery");
list.add(defquery.getName());
list.indent(" ");
if (defquery.m_docstring != null && defquery.m_docstring.length() > 0) {
list.newLine();
list.addQuoted(defquery.m_docstring);
}
if (defquery.getNVariables() > 0 || defquery.getMaxBackgroundRules() > 0) {
list.newLine();
final List list2 = new List("declare");
if (defquery.getNVariables() > 0) {
final List list3 = new List("variables");
for (int i = 0; i < defquery.getNVariables(); ++i) {
list3.add(defquery.getQueryVariable(i));
}
list2.add(list3);
}
if (defquery.getMaxBackgroundRules() > 0) {
final List list4 = new List("max-background-rules");
list4.add(String.valueOf(defquery.getMaxBackgroundRules()));
list2.add(list4);
}
list.add(list2);
}
for (int j = 0; j < defquery.getGroupSize(); ++j) {
final LHSComponent lhsComponent = defquery.getLHSComponent(j);
if (lhsComponent.getName().indexOf("__query-trigger-") == -1) {
list.newLine();
list.add(((Visitable)lhsComponent).accept(this));
}
}
return list.toString();
}
public String toString() {
return (String)this.m_visitable.accept(this);
}
private final /* synthetic */ void this() {
this.m_inTestCE = false;
}
public PrettyPrinter(final Visitable visitable) {
this.this();
this.m_visitable = visitable;
}
}
| [
"videogamesm12@gmail.com"
] | videogamesm12@gmail.com |
433a06ba8e549487bfbd710bfe9d69967f6e1645 | 82b5d8b58b4ce2a80d18aa8b823c4d1e34026cb6 | /src/main/java/com/song/jeremy/mapstruct/ItemsMapStruct.java | 22d63a6828edcd343d852f7c1503bfbbc2d13fd9 | [] | no_license | songshengping/songshengping | e288914af41507d19e2d220839c042c3f19ffbfe | 263675235b5cc3f06bebf240de50828e0a4039c4 | refs/heads/master | 2023-02-10T03:24:35.859251 | 2021-01-10T12:58:59 | 2021-01-10T12:58:59 | 327,382,213 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,243 | java | package com.song.jeremy.mapstruct;
import com.song.jeremy.dbmodel.Items;
import com.song.jeremy.dbmodel.ItemsImg;
import com.song.jeremy.dbmodel.ItemsParam;
import com.song.jeremy.dbmodel.ItemsSpec;
import com.song.jeremy.response.ItemImgDTO;
import com.song.jeremy.response.ItemParamDTO;
import com.song.jeremy.response.ItemSpecDTO;
import com.song.jeremy.response.ItemsDTO;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* @Description TODO
* @Date 2021/1/7 23:28
* @Created by Jeremy
*/
@Mapper(nullValueCheckStrategy= NullValueCheckStrategy.ALWAYS)
public interface ItemsMapStruct {
ItemsMapStruct INSTANCE = Mappers.getMapper(ItemsMapStruct.class);
ItemsDTO toResItems(Items items);
List<ItemsDTO> toResItemsList(List<Items> itemsList);
ItemSpecDTO toResItemsSpec(ItemsSpec itemsSpec);
List<ItemSpecDTO> toResItemsSpecList(List<ItemsSpec> itemsSpecList);
ItemParamDTO toResItemsParam(ItemsParam itemsParam);
List<ItemParamDTO> toResItemsParamList(List<ItemParamDTO> itemsSpecList);
ItemImgDTO toResItemsImg(ItemsImg itemsImg);
List<ItemImgDTO> toResItemsImgList(List<ItemsImg> itemsSpecList);
}
| [
"="
] | = |
f2d6f680a56653248300afac08d9e6785f08e39b | edf7dc42337f0f644c5217afb9048acda2b22bea | /src/main/java/de/vs/monopoly/client/ClientInterface2.java | 29d17af108174ab937d22914802618c22c113d73 | [] | no_license | d-is/Monopoly | 8a92f3f8b1692da9c458d581c06b8c9c1f542b34 | 948c148db2c292bb8e1727262d3063e0cd6d594d | refs/heads/master | 2016-08-11T14:17:36.287152 | 2016-01-13T14:30:53 | 2016-01-13T14:30:53 | 44,614,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package de.vs.monopoly.client;
import de.vs.monopoly.model.Game;
import de.vs.monopoly.model.Roll;
import retrofit.Call;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.PUT;
import retrofit.http.Path;
public interface ClientInterface2 {
@GET("/dice")
Call<Roll> dice();
}
| [
"Danton@WIN-6TUP2KB8N50.localdomain"
] | Danton@WIN-6TUP2KB8N50.localdomain |
b4390de18af979f3ff1f2515de2eb14a77e8eaa4 | 9624c8ea680f3e3acc0c2f55265ee88575e08b21 | /cloudalibaba-config-nacos-client3377/src/main/java/com/kiss/controller/ConfigClientController.java | ca6e845af824853114f1791d6e4fdb25c59210ec | [] | no_license | kissn01/springcloud_01 | c887d31fb59d40c8707d09e455a2d991f4af63f9 | 1a65bb965ba77ad830cee8ac93f7b00a39964063 | refs/heads/master | 2022-12-17T18:06:31.846780 | 2020-09-23T12:34:57 | 2020-09-23T12:34:57 | 296,195,262 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 646 | java | package com.kiss.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName ConfigClientController
* @Description TODO
* @Author kiss
* @Date 2020/9/21 15:53
* @Version 1.0
*/
@RefreshScope
@RestController
public class ConfigClientController
{
@Value("${config.info}")
private String configInfo;
@GetMapping("/config/info")
public String getConfigInfo()
{
return configInfo;
}
}
| [
"tom_glb@qq.com"
] | tom_glb@qq.com |
a8c4d1039301ec3dba1f623e75cf0584a944c615 | d090eb9ad62dca3177f4125415d49faa1567351b | /Javaeclipse/collectionframework/src/com/ustglobal/collectionframework/list/TestA.java | de1081a67fc7680216d2fb00fb75d72d5ee7c7bb | [] | no_license | manasacidde/USTGlobal-16-Sep19-Ciddemanasa | 68bb8ac5f13c7fbf6e795178da7539f389ce4cba | 2a6989869ad77e1fd0df4d2bd0ef57b45f4ad86e | refs/heads/master | 2023-01-09T00:16:47.028810 | 2019-12-21T13:17:34 | 2019-12-21T13:17:34 | 215,541,004 | 0 | 0 | null | 2023-01-07T13:03:56 | 2019-10-16T12:19:12 | JavaScript | UTF-8 | Java | false | false | 287 | java | package com.ustglobal.collectionframework.list;
import java.util.ArrayList;
public class TestA {
public static void main(String[] args) {
ArrayList al = new ArrayList();
al.add(10);
al.add("manasa");
al.add(true);
for(Object o : al)
{
System.out.println(o);
}
}
}
| [
"ciddemanasa97@gmail.com"
] | ciddemanasa97@gmail.com |
65a3e796a0dfae517ca3272e207b7fb1664dd944 | 3d5e6745a6b46a0e0197430642fdbf0901ba6a20 | /demo/restful/src/main/java/com/yuruicai/test/resfull/service/serviceImpl/UserServiceImpl.java | e4a2eb6288d8c8b9c1d3a7ca4066532751de8945 | [] | no_license | yuruicai/demo-sptingboot | d43e064ea3b88b0e5f48251476fee532d186f416 | dfc8736f22fa84750fd93eeda62ece1d1f44b093 | refs/heads/master | 2022-08-09T08:35:33.653654 | 2019-11-02T15:15:33 | 2019-11-02T15:15:33 | 184,198,905 | 0 | 0 | null | 2022-06-21T02:09:36 | 2019-04-30T05:43:25 | JavaScript | UTF-8 | Java | false | false | 844 | java | package com.yuruicai.test.resfull.service.serviceImpl;
import com.yuruicai.test.resfull.dao.UserRepository;
import com.yuruicai.test.resfull.domin.User;
import com.yuruicai.test.resfull.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
public class UserServiceImpl implements UserService {
@Autowired
ApplicationEventPublisher applicationEventPublisher;
@Autowired
private UserRepository userRepository;
@Transactional
public Object selectUser(long userId){
User byName = userRepository.findById(userId);
applicationEventPublisher.publishEvent(byName);
return byName;
}
}
| [
"710347184@qq.com"
] | 710347184@qq.com |
f7111409a85feec49f4a8a954ee7b4a5f22c2b4f | af0ca82c213abfef2ab242f5efdbade572e7fd5f | /WebTvRebuild_KenLi/app/src/main/java/com/sobey/cloud/webtv/obj/ViewHolderBrokeTask.java | 6e23ae153135ed02c96a91b4649221aa998e27b4 | [] | no_license | i2863CookieZJ/KenLi | e7f7d1033c7e66ae01eee7f1c59c736a241a50bb | 38e7fc3c33eb5b27d63626e6640843072810611e | refs/heads/master | 2020-07-02T07:52:35.508729 | 2016-11-21T03:02:48 | 2016-11-21T03:02:48 | 74,317,209 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,046 | java | package com.sobey.cloud.webtv.obj;
import com.appsdk.advancedimageview.AdvancedImageView;
import com.dylan.uiparts.circularseekbar.CircularSeekBar;
import android.widget.Button;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class ViewHolderBrokeTask {
private TextView title;
private AdvancedImageView image;
private TextView time;
private ImageView videocountImage;
private TextView videocount;
private ImageView picturecountImage;
private TextView picturecount;
private RelativeLayout waitingLayout;
private RelativeLayout uploadingLayout;
private CircularSeekBar uploadingCircularSeekbar;
private Button actionBtn;
private LinearLayout contentLayout;
private HorizontalScrollView horizontalScrollView;
public TextView getTitle() {
return title;
}
public void setTitle(TextView title) {
this.title = title;
}
public AdvancedImageView getImage() {
return image;
}
public void setImage(AdvancedImageView image) {
this.image = image;
}
public TextView getTime() {
return time;
}
public void setTime(TextView time) {
this.time = time;
}
public ImageView getVideocountImage() {
return videocountImage;
}
public void setVideocountImage(ImageView videocountImage) {
this.videocountImage = videocountImage;
}
public TextView getVideocount() {
return videocount;
}
public void setVideocount(TextView videocount) {
this.videocount = videocount;
}
public ImageView getPicturecountImage() {
return picturecountImage;
}
public void setPicturecountImage(ImageView picturecountImage) {
this.picturecountImage = picturecountImage;
}
public TextView getPicturecount() {
return picturecount;
}
public void setPicturecount(TextView picturecount) {
this.picturecount = picturecount;
}
public RelativeLayout getWaitingLayout() {
return waitingLayout;
}
public void setWaitingLayout(RelativeLayout waitingLayout) {
this.waitingLayout = waitingLayout;
}
public RelativeLayout getUploadingLayout() {
return uploadingLayout;
}
public void setUploadingLayout(RelativeLayout uploadingLayout) {
this.uploadingLayout = uploadingLayout;
}
public CircularSeekBar getUploadingCircularSeekbar() {
return uploadingCircularSeekbar;
}
public void setUploadingCircularSeekbar(CircularSeekBar uploadingCircularSeekbar) {
this.uploadingCircularSeekbar = uploadingCircularSeekbar;
}
public Button getActionBtn() {
return actionBtn;
}
public void setActionBtn(Button actionBtn) {
this.actionBtn = actionBtn;
}
public HorizontalScrollView getHorizontalScrollView() {
return horizontalScrollView;
}
public void setHorizontalScrollView(HorizontalScrollView horizontalScrollView) {
this.horizontalScrollView = horizontalScrollView;
}
public LinearLayout getContentLayout() {
return contentLayout;
}
public void setContentLayout(LinearLayout contentLayout) {
this.contentLayout = contentLayout;
}
}
| [
"ljx524589715@sina.com"
] | ljx524589715@sina.com |
147c7b0d233331a91d2f73edca709b26c057e4f5 | 36d0740b47725d0d27b8ac6a2714ba030bfb9b78 | /src/de/diddiz/codegeneration/codetree/IfElse.java | 6e94958f6b16ae6ddcce762ee1db510b459d91bc | [
"MIT"
] | permissive | DiddiZ/CodeGeneration | 82cc850d443aeb4643b2bb5169caa28a0e86e10a | 92bb2ba2e11701c66ad3c08ea59d5279da3c22d4 | refs/heads/master | 2021-01-13T16:15:58.729946 | 2017-04-12T10:30:36 | 2017-04-12T10:30:36 | 81,147,832 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,026 | java | package de.diddiz.codegeneration.codetree;
import java.util.List;
import java.util.Set;
import de.diddiz.codegeneration.codetree.evaluation.EvaluationContext;
import de.diddiz.codegeneration.codetree.generator.Context;
import de.diddiz.codegeneration.codetree.generator.Generator;
import de.diddiz.codegeneration.exceptions.EvaluationException;
import de.diddiz.utils.Utils;
public class IfElse extends Statement
{
private final Expression condition;
private final Block ifBlock, elseBlock;
public IfElse(Expression condition, Block ifBlock) {
this(condition, ifBlock, null);
}
public IfElse(Expression condition, Block ifBlock, Block elseBlock) {
this.condition = condition;
this.ifBlock = ifBlock;
this.elseBlock = elseBlock;
}
@Override
public Integer eval(EvaluationContext context) throws EvaluationException {
if (condition.eval(context))
return ifBlock.eval(context);
return elseBlock != null ? elseBlock.eval(context) : null;
}
@Override
public Statement mutate(Set<CodeElement> mutated, Context context) {
if (mutated.contains(this)) // Mutate this
return Generator.generateStatement(context);
// Mutate children
return new IfElse(condition.mutate(mutated, context), ifBlock.mutate(mutated, context), elseBlock != null ? elseBlock.mutate(mutated, context) : null);
}
@Override
public boolean returns() {
return ifBlock.returns() && elseBlock != null && elseBlock.returns();
}
@Override
public String toCode() {
String ret = "if (" + condition.toCode() + ") {" + Utils.NEWLINE + ifBlock.toCode() + Utils.NEWLINE + "}";
if (elseBlock != null)
ret += " else {" + Utils.NEWLINE + elseBlock.toCode() + Utils.NEWLINE + "}";
return ret;
}
@Override
protected void gatherChildren(List<CodeElement> children) {
children.add(this);
children.add(condition);
condition.gatherChildren(children);
children.add(ifBlock);
ifBlock.gatherChildren(children);
if (elseBlock != null) {
children.add(elseBlock);
elseBlock.gatherChildren(children);
}
}
}
| [
"robbzkupper@web.de"
] | robbzkupper@web.de |
f9818e77162158d295afcd5f43fadb55cf471465 | 0b6a1811466d1c294355bcf902104a135abe667e | /src/flashcards/Main.java | d1b036cff141bc19460165ca2d390ea6499b3476 | [] | no_license | jslubowski/flashcards | 9873caec08508029628fcbcbe935531dbecb8076 | bab0657523cb842767650293095972ffa0a25142 | refs/heads/master | 2020-06-03T03:32:03.894999 | 2019-12-27T13:07:57 | 2019-12-27T13:07:57 | 191,419,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 135 | java | package flashcards;
public class Main {
public static void main(String[] args) {
System.out.print("Hello world!");
}
} | [
"jakubslubowski@gmail.com"
] | jakubslubowski@gmail.com |
05c85aeedd1f8c1e1e833ab26a6678264d97f442 | 3600ae0359126c9c804c508cacc1ddafb911fda6 | /FinanceApplication/src/shahi/Action/ReportFolder/EPM/beans/ChequeSearch.java | 793b7518ba5c5d5f13606c632d7e9fee55df29b4 | [] | no_license | vins667/FinanceApp | 30a4bc264915f9b61df8e4cf227a6e577297ae8e | c03b34f46f1d630aba60041516500ebb8442a8d2 | refs/heads/master | 2020-03-19T06:24:11.728711 | 2018-06-04T12:00:39 | 2018-06-04T12:00:39 | 136,016,264 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,173 | java | package shahi.Action.ReportFolder.EPM.beans;
public class ChequeSearch {
private String ckcono;
private String ckdivi;
private String ckyea4;
private String ckbkid;
private String ckchkn;
private String ckspyn;
private String cksunm;
private String ckpycu;
private String ckait1;
private String ckdtpr;
private String ckvser;
private String ckvono;
public ChequeSearch(){
}
public String getCkcono() {
return ckcono;
}
public void setCkcono(String ckcono) {
this.ckcono = ckcono;
}
public String getCkdivi() {
return ckdivi;
}
public void setCkdivi(String ckdivi) {
this.ckdivi = ckdivi;
}
public String getCkyea4() {
return ckyea4;
}
public void setCkyea4(String ckyea4) {
this.ckyea4 = ckyea4;
}
public String getCkbkid() {
return ckbkid;
}
public void setCkbkid(String ckbkid) {
this.ckbkid = ckbkid;
}
public String getCkchkn() {
return ckchkn;
}
public void setCkchkn(String ckchkn) {
this.ckchkn = ckchkn;
}
public String getCkspyn() {
return ckspyn;
}
public void setCkspyn(String ckspyn) {
this.ckspyn = ckspyn;
}
public String getCksunm() {
return cksunm;
}
public void setCksunm(String cksunm) {
this.cksunm = cksunm;
}
public String getCkpycu() {
return ckpycu;
}
public void setCkpycu(String ckpycu) {
this.ckpycu = ckpycu;
}
public String getCkait1() {
return ckait1;
}
public void setCkait1(String ckait1) {
this.ckait1 = ckait1;
}
public String getCkdtpr() {
return ckdtpr;
}
public void setCkdtpr(String ckdtpr) {
this.ckdtpr = ckdtpr;
}
public String getCkvser() {
return ckvser;
}
public void setCkvser(String ckvser) {
this.ckvser = ckvser;
}
public String getCkvono() {
return ckvono;
}
public void setCkvono(String ckvono) {
this.ckvono = ckvono;
}
@Override
public String toString() {
return "ChequeSearch [ckcono=" + ckcono + ", ckdivi=" + ckdivi + ", ckyea4=" + ckyea4 + ", ckbkid=" + ckbkid
+ ", ckchkn=" + ckchkn + ", ckspyn=" + ckspyn + ", cksunm=" + cksunm + ", ckpycu=" + ckpycu
+ ", ckait1=" + ckait1 + ", ckdtpr=" + ckdtpr + ", ckvser=" + ckvser + ", ckvono=" + ckvono + "]";
}
}
| [
"vins667@gmail.com"
] | vins667@gmail.com |
001b7882a394ab2e6a3dc0e8a6a964f1df062554 | 7bfcc5ef1a03f95108f4541ce8c69b90e62c72d7 | /src/main/java/com/cuimiao/demo/bean/Student.java | be0d78a6d7014f20f701a0523d45bf406672c8c6 | [] | no_license | bycuimiao/formzy | 4f878defbb7f325dcd39a859881776c7d8abfe59 | f31a6138cd4d65e71c15adcca25bd12708f822ac | refs/heads/master | 2020-03-16T06:48:43.401687 | 2018-05-08T06:18:29 | 2018-05-08T06:18:29 | 132,563,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 823 | java | /*
* Created by cuimiao on 2018/5/7.
*/
package com.cuimiao.demo.bean;
import javax.persistence.*;
/**
* @author cuimiao
* @version 0.0.1
* @Description:
* @since 0.0.1 2018-05-07
*/
@Entity
public class Student {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private Long age;
private String telephone;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getAge() {
return age;
}
public void setAge(Long age) {
this.age = age;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
} | [
"373013128@qq.com"
] | 373013128@qq.com |
37103c45c84efdf82092f1c3a500d669dcdf5296 | 56ea0ecdda41ae1fe952ca77f72866b87cbf578b | /src/org/volante/abm/serialization/CellRasterReader.java | 2f8a10f8e30f09faf1ed5a6953dda6c833df4a05 | [] | no_license | jamesdamillington/CRAFTY_Brazil | d9ea3a308ae77c24baceba2ece99ea5630f390ac | ad58f75b6ed044fed73d2eff7ad369babe07a794 | refs/heads/master | 2021-08-20T04:51:45.564103 | 2021-01-08T12:04:52 | 2021-01-08T12:04:52 | 241,864,383 | 1 | 1 | null | 2021-01-08T11:54:03 | 2020-02-20T11:13:01 | Java | UTF-8 | Java | false | false | 2,668 | java | /**
* This file is part of
*
* CRAFTY - Competition for Resources between Agent Functional TYpes
*
* Copyright (C) 2014 School of GeoScience, University of Edinburgh, Edinburgh, UK
*
* CRAFTY is free software: You can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* CRAFTY 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* School of Geoscience, University of Edinburgh, Edinburgh, UK
*/
package org.volante.abm.serialization;
import static java.lang.Double.isNaN;
import org.apache.log4j.Logger;
import org.simpleframework.xml.Attribute;
import org.volante.abm.data.Capital;
import org.volante.abm.data.Cell;
import org.volante.abm.data.ModelData;
import org.volante.abm.serialization.RegionLoader.CellInitialiser;
import com.moseph.gis.raster.Raster;
import com.moseph.modelutils.fastdata.DoubleMap;
/**
* Reads information from a csv file into the given region
*
* @author dmrust
*
*/
public class CellRasterReader implements CellInitialiser {
@Attribute(name = "file")
String rasterFile = "";
@Attribute(name = "capital")
String capitalName = "HUMAN";
Logger log = Logger.getLogger(getClass());
@Override
public void initialise(RegionLoader rl) throws Exception {
ModelData data = rl.modelData;
log.info("Loading raster for " + capitalName + " from " + rasterFile);
Raster raster = rl.persister.readRaster(rasterFile, rl.getRegion()
.getPersisterContextExtra());
Capital capital = data.capitals.forName(capitalName);
int cells = 0;
for (int x = 0; x < raster.getCols(); x++) {
for (int y = 0; y < raster.getRows(); y++) {
double val = raster.getValue(y, x);
int xPos = raster.colToX(x);
int yPos = raster.rowToY(y);
if (isNaN(val)) {
continue;
}
cells++;
if (cells % 10000 == 0) {
log.debug("Cell: " + cells);
Runtime r = Runtime.getRuntime();
log.debug(String.format("Mem: Total: %d, Free: %d, Used: %d\n",
r.totalMemory(), r.freeMemory(), r.totalMemory() - r.freeMemory()));
}
Cell cell = rl.getCell(xPos, yPos);
DoubleMap<Capital> adjusted = data.capitalMap();
cell.getBaseCapitals().copyInto(adjusted);
adjusted.putDouble(capital, val);
cell.setBaseCapitals(adjusted);
}
}
}
}
| [
"jamesdamillington@gmail.com"
] | jamesdamillington@gmail.com |
f9083e14aa1c2d35f7d6c59ada8a77ff301589bb | 553d92fd7b2af0398102400b123c1354336a0221 | /src/main/java/com/appdynamics/universalagent/adapter/RuntimeTypeAdapterFactory.java | 144b77800c310745d239ff00495ef9b196da8723 | [
"Apache-2.0"
] | permissive | Appdynamics/UniversalAgentGUIManager | aa81ff7e5d28bc50b7414e4d5a748d1ce50d4260 | 4033ad262a3cf70ea5c70b060fd6dd09e0be10cb | refs/heads/master | 2021-05-03T11:48:40.849019 | 2018-06-26T15:58:15 | 2018-06-26T15:58:15 | 120,486,384 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,845 | java | /*******************************************************************************
* Copyright 2018 AppDynamics LLC
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* 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.appdynamics.universalagent.adapter;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.internal.Streams;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
public final class RuntimeTypeAdapterFactory<T> implements TypeAdapterFactory {
private final Class<?> baseType;
private final RuntimeTypeAdapterPredicate predicate;
private final Map<String, Class<?>> labelToSubtype = new LinkedHashMap<String, Class<?>>();
private final Map<Class<?>, String> subtypeToLabel = new LinkedHashMap<Class<?>, String>();
private RuntimeTypeAdapterFactory(Class<?> baseType, RuntimeTypeAdapterPredicate predicate) {
if (predicate == null || baseType == null) {
throw new NullPointerException();
}
this.baseType = baseType;
this.predicate = predicate;
}
/**
* Creates a new runtime type adapter using for {@code baseType} using {@code
* typeFieldName} as the type field name. Type field names are case sensitive.
*/
public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType, RuntimeTypeAdapterPredicate predicate) {
return new RuntimeTypeAdapterFactory<T>(baseType, predicate);
}
/**
* Creates a new runtime type adapter for {@code baseType} using {@code "type"}
* as the type field name.
*/
public static <T> RuntimeTypeAdapterFactory<T> of(Class<T> baseType) {
return new RuntimeTypeAdapterFactory<T>(baseType, null);
}
/**
* Registers {@code type} identified by {@code label}. Labels are case
* sensitive.
*
* @throws IllegalArgumentException
* if either {@code type} or {@code label} have already been
* registered on this type adapter.
*/
public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type, String label) {
if (type == null || label == null) {
throw new NullPointerException();
}
if (subtypeToLabel.containsKey(type) || labelToSubtype.containsKey(label)) {
throw new IllegalArgumentException("types and labels must be unique");
}
labelToSubtype.put(label, type);
subtypeToLabel.put(type, label);
return this;
}
/**
* Registers {@code type} identified by its {@link Class#getSimpleName simple
* name}. Labels are case sensitive.
*
* @throws IllegalArgumentException
* if either {@code type} or its simple name have already been
* registered on this type adapter.
*/
public RuntimeTypeAdapterFactory<T> registerSubtype(Class<? extends T> type) {
return registerSubtype(type, type.getSimpleName());
}
public <R> TypeAdapter<R> create(Gson gson, TypeToken<R> type) {
if (type.getRawType() != baseType) {
return null;
}
final Map<String, TypeAdapter<?>> labelToDelegate = new LinkedHashMap<String, TypeAdapter<?>>();
final Map<Class<?>, TypeAdapter<?>> subtypeToDelegate = new LinkedHashMap<Class<?>, TypeAdapter<?>>();
for (Map.Entry<String, Class<?>> entry : labelToSubtype.entrySet()) {
TypeAdapter<?> delegate = gson.getDelegateAdapter(this, TypeToken.get(entry.getValue()));
labelToDelegate.put(entry.getKey(), delegate);
subtypeToDelegate.put(entry.getValue(), delegate);
}
return new TypeAdapter<R>() {
@Override
public R read(JsonReader in) throws IOException {
JsonElement jsonElement = Streams.parse(in);
String label = predicate.process(jsonElement);
@SuppressWarnings("unchecked") // registration requires that subtype extends T
TypeAdapter<R> delegate = (TypeAdapter<R>) labelToDelegate.get(label);
if (delegate == null) {
throw new JsonParseException("cannot deserialize " + baseType + " subtype named " + label
+ "; did you forget to register a subtype?");
}
return delegate.fromJsonTree(jsonElement);
}
@Override
public void write(JsonWriter out, R value) throws IOException { // Unimplemented as we don't use write.
/*
* Class<?> srcType = value.getClass(); String label =
* subtypeToLabel.get(srcType);
*
* @SuppressWarnings("unchecked") // registration requires that subtype extends
* T TypeAdapter<R> delegate = (TypeAdapter<R>) subtypeToDelegate.get(srcType);
* if (delegate == null) { throw new JsonParseException("cannot serialize " +
* srcType.getName() + "; did you forget to register a subtype?"); } JsonObject
* jsonObject = delegate.toJsonTree(value).getAsJsonObject(); if
* (jsonObject.has(typeFieldName)) { throw new
* JsonParseException("cannot serialize " + srcType.getName() +
* " because it already defines a field named " + typeFieldName); } JsonObject
* clone = new JsonObject(); clone.add(typeFieldName, new JsonPrimitive(label));
* for (Map.Entry<String, JsonElement> e : jsonObject.entrySet()) {
* clone.add(e.getKey(), e.getValue()); }
*/
Streams.write(null, out);
}
};
}
}
| [
"nikolaos.papageorgiou@appdynamics.com"
] | nikolaos.papageorgiou@appdynamics.com |
a8caa70e6dc6a3130e7cfcd4d225611f5d495f23 | 02394ab69e896af32b6cbcfd6a7bd18dd170bb00 | /src/HighLowGame.java | 5a19123de4b1ee95a0719ee49d681dd29146d214 | [] | no_license | NancyGuerrero04/Level-0 | b85c117d712ef90c0e69c60452aa7b9ab11ec03a | e62d9bea18c433f422e9a0e845b7fcff2aa51032 | refs/heads/master | 2021-01-17T11:15:03.495987 | 2016-05-12T02:00:59 | 2016-05-12T02:00:59 | 42,623,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,335 | java | import java.util.Random;
import javax.swing.JOptionPane;
// Copyright Wintriss Technical Schools 2013
public class HighLowGame {
public static void main(String[] args) {
// 3. Change this line to give you a random number between 1 - 100.
int random = new Random().nextInt(101);
boolean winner = false;
// 2. Print out the random variable above
System.out.println(random);
// 11. do the following 10 times
for (int i = 0; i < 11; i++) {
// 1. ask the user for a guess using a pop-up window, and save their response
String guess = JOptionPane.showInputDialog("Pick a number!");
// 4. convert the usersโ answer to an int (Integer.parseInt(string))
int nummy = Integer.parseInt(guess);
// 5. if the guess is correct
if (nummy==random){
JOptionPane.showMessageDialog(null, "Correct! You are a WINNER!");
winner = true;
break;
}
// 6. win
// 7. if the guess is high
if (nummy>random){
JOptionPane.showMessageDialog(null, "Too high.");
}
// 8. tell them it's too high
// 9. if the guess is low
else if (nummy<random){
JOptionPane.showMessageDialog(null, "Too low.");
}
// 10. tell them it's too low
// 12. tell them they lose
}
if (winner== false){
JOptionPane.showMessageDialog(null, "You lose, sorry :c");
}
}
}
| [
"league@Mac-mini-2.local"
] | league@Mac-mini-2.local |
08b837b2555ec308bf58e487db7f869b66a8167f | 94951222a643ed295579c535939d55670deb60ba | /team05_client/app/src/main/java/com/example/caroline/videorecording/SegmentVideos.java | 40f9dde6583ae50ce6d4bc020d393b4691f02858 | [] | no_license | liulanyi/team05_A0163111Y_A0174362E_A0174434E | 04e18eb60acef159fd2b37132b43d8de8626b331 | 047bfea8d16650c25156ff3945a91eae376a33c3 | refs/heads/master | 2021-05-07T01:55:10.827328 | 2017-11-15T11:48:30 | 2017-11-15T11:49:50 | 110,452,580 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,433 | java | package com.example.caroline.videorecording;
import android.util.Log;
import com.coremedia.iso.IsoFile;
import com.coremedia.iso.boxes.Container;
import com.googlecode.mp4parser.authoring.Movie;
import com.googlecode.mp4parser.authoring.Track;
import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
import com.googlecode.mp4parser.authoring.tracks.CroppedTrack;
import java.io.FileOutputStream;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
/**
* Created by caroline on 20/10/2017.
*/
public class SegmentVideos {
private double duration ;
private int numberOfSmallVideos;
public void segmentVideo(){
double startTime = 0 ;
double splitDuration = 3.0 ;
try {
// duration in seconds
duration = getDuration(Variables.getFilePath());
numberOfSmallVideos = (int) (duration / 3);
// Arraylist that will contains all the segments filepaths
ArrayList<String> listNameOf3sVideos = new ArrayList<String>();
// segmentation of the video
for (int num = 0; num < numberOfSmallVideos; num++) {
if (startTime == 0){
cutVideo3sec(startTime, startTime+splitDuration, num, listNameOf3sVideos);
startTime += splitDuration;
}
else {
cutVideo3sec(startTime+1, startTime+splitDuration, num, listNameOf3sVideos);
startTime += splitDuration;
}
}
// last part of the video, which duration is less than 3 sec
cutVideo3sec(startTime+1, duration, numberOfSmallVideos, listNameOf3sVideos);
Variables.setListFilePath(listNameOf3sVideos);
}catch (Exception e){
e.printStackTrace();
}
}
// getDuration method that returns the duration of the video in second
protected static double getDuration(String filename) {
try{
IsoFile isoFile = new IsoFile(filename);
double lengthInSeconds = (double)
isoFile.getMovieBox().getMovieHeaderBox().getDuration() / isoFile.getMovieBox().getMovieHeaderBox().getTimescale();
System.err.println(lengthInSeconds);
return lengthInSeconds;
}catch (Exception e){
e.printStackTrace();
return 0;
}
}
private static double correctTimeToSyncSample(Track track, double cutHere, boolean next) {
double[] timeOfSyncSamples = new double[track.getSyncSamples().length];
long currentSample = 0;
double currentTime = 0;
for (int i = 0; i < track.getSampleDurations().length; i++) {
long delta = track.getSampleDurations()[i];
if (Arrays.binarySearch(track.getSyncSamples(), currentSample + 1) >= 0) {
// samples always start with 1 but we start with zero therefore +1
timeOfSyncSamples[Arrays.binarySearch(track.getSyncSamples(), currentSample + 1)] = currentTime;
}
currentTime += (double) delta / (double) track.getTrackMetaData().getTimescale();
currentSample++;
}
double previous = 0;
for (double timeOfSyncSample : timeOfSyncSamples) {
if (timeOfSyncSample >= cutHere) {
if (next) {
return timeOfSyncSample;
} else {
return previous;
}
}
previous = timeOfSyncSample;
}
return timeOfSyncSamples[timeOfSyncSamples.length - 1];
}
private void cutVideo3sec (double startTime, double endTime, int i, ArrayList<String> listNameOf3sVideos){
try{
Movie movie = MovieCreator.build(Variables.getFilePath());
List<Track> tracks = movie.getTracks();
//System.out.println("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
//System.out.println(tracks);
movie.setTracks(new LinkedList<Track>());
//Movie movie1 = new Movie();
System.out.println("IIIIIIIIIII");
System.out.println(i);
boolean timeCorrected = false;
// Here we try to find a track that has sync samples. Since we can only start decoding
// at such a sample we SHOULD make sure that the start of the new fragment is exactly
// such a frame
for (Track track : tracks) {
if (track.getSyncSamples() != null && track.getSyncSamples().length > 0) {
if (timeCorrected) {
// This exception here could be a false positive in case we have multiple tracks
// with sync samples at exactly the same positions. E.g. a single movie containing
// multiple qualities of the same video (Microsoft Smooth Streaming file)
throw new RuntimeException("The startTime has already been corrected by another track with SyncSample. Not Supported.");
}
startTime = correctTimeToSyncSample(track, startTime, false);
endTime = correctTimeToSyncSample(track, endTime, true);
timeCorrected = true;
}
}
for (Track track : tracks) {
long currentSample = 0;
double currentTime = 0 ;
long startSample = 0;
long endSample = 0;
for (int j = 0; j < track.getSampleDurations().length; j++) {
long delta = track.getSampleDurations()[j];
if (currentTime <= startTime) {
// current sample is still before the new starttime
startSample = currentSample;
}
if (currentTime <= endTime) {
// current sample is after the new start time and still before the new endtime
endSample = currentSample;
} else {
// current sample is after the end of the cropped video
break;
}
currentTime += (double) delta / (double) track.getTrackMetaData().getTimescale();
currentSample++;
}
Log.i("DASH", "Start time = " + startTime + ", End time = " + endTime);
movie.addTrack(new CroppedTrack(track, startSample, endSample));
//movie.addTrack(new CroppedTrack(track, (long) startTime, (long) endTime));
}
Container out = new DefaultMp4Builder().build(movie);
String filename = Variables.getFilePathWithoutExt()+"_"+ String.valueOf(i+1)+".mp4";
FileOutputStream fos = new FileOutputStream(filename);
System.out.println("FFFFFFFFFFFFFFFF");
System.out.println(filename);
listNameOf3sVideos.add(filename);
FileChannel fc = fos.getChannel();
out.writeContainer(fc);
fc.close();
fos.close();
}catch (Exception e){
e.printStackTrace();
}
}
}
| [
"caroline.astolfi@telecom-paristech.fr"
] | caroline.astolfi@telecom-paristech.fr |
6eb06ab968db98e922c8a6f5349f7f8d65443676 | 0a8bbc5c88f7a362304d5a1547f9999249aec1ff | /thriftdemo/src/main/java/thrift/test/SomeUnion.java | 880bbb501df52b8cb4cbc47d305cdd5c1b37d6f1 | [] | no_license | yangjiugang/teamway | 697ea4296f92d7982166f5607b42b4ece6374a91 | 425cf8b1d0bc759a5f79c40cde700adbef39ba12 | refs/heads/master | 2021-10-20T21:46:13.327612 | 2018-07-30T08:10:01 | 2018-07-30T08:10:01 | 108,513,918 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | true | 21,621 | java | /**
* Autogenerated by Thrift Compiler (0.10.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package thrift.test;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
public class SomeUnion extends org.apache.thrift.TUnion<SomeUnion, SomeUnion._Fields> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SomeUnion");
private static final org.apache.thrift.protocol.TField MAP_THING_FIELD_DESC = new org.apache.thrift.protocol.TField("map_thing", org.apache.thrift.protocol.TType.MAP, (short)1);
private static final org.apache.thrift.protocol.TField STRING_THING_FIELD_DESC = new org.apache.thrift.protocol.TField("string_thing", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField I32_THING_FIELD_DESC = new org.apache.thrift.protocol.TField("i32_thing", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField XTRUCT_THING_FIELD_DESC = new org.apache.thrift.protocol.TField("xtruct_thing", org.apache.thrift.protocol.TType.STRUCT, (short)4);
private static final org.apache.thrift.protocol.TField INSANITY_THING_FIELD_DESC = new org.apache.thrift.protocol.TField("insanity_thing", org.apache.thrift.protocol.TType.STRUCT, (short)5);
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
MAP_THING((short)1, "map_thing"),
STRING_THING((short)2, "string_thing"),
I32_THING((short)3, "i32_thing"),
XTRUCT_THING((short)4, "xtruct_thing"),
INSANITY_THING((short)5, "insanity_thing");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
static {
for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // MAP_THING
return MAP_THING;
case 2: // STRING_THING
return STRING_THING;
case 3: // I32_THING
return I32_THING;
case 4: // XTRUCT_THING
return XTRUCT_THING;
case 5: // INSANITY_THING
return INSANITY_THING;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(java.lang.String name) {
return byName.get(name);
}
private final short _thriftId;
private final java.lang.String _fieldName;
_Fields(short thriftId, java.lang.String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public java.lang.String getFieldName() {
return _fieldName;
}
}
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.MAP_THING, new org.apache.thrift.meta_data.FieldMetaData("map_thing", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, Numberz.class),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64 , "UserId"))));
tmpMap.put(_Fields.STRING_THING, new org.apache.thrift.meta_data.FieldMetaData("string_thing", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.I32_THING, new org.apache.thrift.meta_data.FieldMetaData("i32_thing", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.XTRUCT_THING, new org.apache.thrift.meta_data.FieldMetaData("xtruct_thing", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Xtruct3.class)));
tmpMap.put(_Fields.INSANITY_THING, new org.apache.thrift.meta_data.FieldMetaData("insanity_thing", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Insanity.class)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(SomeUnion.class, metaDataMap);
}
public SomeUnion() {
super();
}
public SomeUnion(_Fields setField, java.lang.Object value) {
super(setField, value);
}
public SomeUnion(SomeUnion other) {
super(other);
}
public SomeUnion deepCopy() {
return new SomeUnion(this);
}
public static SomeUnion map_thing(java.util.Map<Numberz,java.lang.Long> value) {
SomeUnion x = new SomeUnion();
x.setMap_thing(value);
return x;
}
public static SomeUnion string_thing(java.lang.String value) {
SomeUnion x = new SomeUnion();
x.setString_thing(value);
return x;
}
public static SomeUnion i32_thing(int value) {
SomeUnion x = new SomeUnion();
x.setI32_thing(value);
return x;
}
public static SomeUnion xtruct_thing(Xtruct3 value) {
SomeUnion x = new SomeUnion();
x.setXtruct_thing(value);
return x;
}
public static SomeUnion insanity_thing(Insanity value) {
SomeUnion x = new SomeUnion();
x.setInsanity_thing(value);
return x;
}
@Override
protected void checkType(_Fields setField, java.lang.Object value) throws java.lang.ClassCastException {
switch (setField) {
case MAP_THING:
if (value instanceof java.util.Map) {
break;
}
throw new java.lang.ClassCastException("Was expecting value of type java.util.Map<Numberz,java.lang.Long> for field 'map_thing', but got " + value.getClass().getSimpleName());
case STRING_THING:
if (value instanceof java.lang.String) {
break;
}
throw new java.lang.ClassCastException("Was expecting value of type java.lang.String for field 'string_thing', but got " + value.getClass().getSimpleName());
case I32_THING:
if (value instanceof java.lang.Integer) {
break;
}
throw new java.lang.ClassCastException("Was expecting value of type java.lang.Integer for field 'i32_thing', but got " + value.getClass().getSimpleName());
case XTRUCT_THING:
if (value instanceof Xtruct3) {
break;
}
throw new java.lang.ClassCastException("Was expecting value of type Xtruct3 for field 'xtruct_thing', but got " + value.getClass().getSimpleName());
case INSANITY_THING:
if (value instanceof Insanity) {
break;
}
throw new java.lang.ClassCastException("Was expecting value of type Insanity for field 'insanity_thing', but got " + value.getClass().getSimpleName());
default:
throw new java.lang.IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected java.lang.Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(field.id);
if (setField != null) {
switch (setField) {
case MAP_THING:
if (field.type == MAP_THING_FIELD_DESC.type) {
java.util.Map<Numberz,java.lang.Long> map_thing;
{
org.apache.thrift.protocol.TMap _map88 = iprot.readMapBegin();
map_thing = new java.util.HashMap<Numberz,java.lang.Long>(2*_map88.size);
Numberz _key89;
long _val90;
for (int _i91 = 0; _i91 < _map88.size; ++_i91)
{
_key89 = thrift.test.Numberz.findByValue(iprot.readI32());
_val90 = iprot.readI64();
map_thing.put(_key89, _val90);
}
iprot.readMapEnd();
}
return map_thing;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case STRING_THING:
if (field.type == STRING_THING_FIELD_DESC.type) {
java.lang.String string_thing;
string_thing = iprot.readString();
return string_thing;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case I32_THING:
if (field.type == I32_THING_FIELD_DESC.type) {
java.lang.Integer i32_thing;
i32_thing = iprot.readI32();
return i32_thing;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case XTRUCT_THING:
if (field.type == XTRUCT_THING_FIELD_DESC.type) {
Xtruct3 xtruct_thing;
xtruct_thing = new Xtruct3();
xtruct_thing.read(iprot);
return xtruct_thing;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case INSANITY_THING:
if (field.type == INSANITY_THING_FIELD_DESC.type) {
Insanity insanity_thing;
insanity_thing = new Insanity();
insanity_thing.read(iprot);
return insanity_thing;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
default:
throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
}
@Override
protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
switch (setField_) {
case MAP_THING:
java.util.Map<Numberz,java.lang.Long> map_thing = (java.util.Map<Numberz,java.lang.Long>)value_;
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.I64, map_thing.size()));
for (java.util.Map.Entry<Numberz, java.lang.Long> _iter92 : map_thing.entrySet())
{
oprot.writeI32(_iter92.getKey().getValue());
oprot.writeI64(_iter92.getValue());
}
oprot.writeMapEnd();
}
return;
case STRING_THING:
java.lang.String string_thing = (java.lang.String)value_;
oprot.writeString(string_thing);
return;
case I32_THING:
java.lang.Integer i32_thing = (java.lang.Integer)value_;
oprot.writeI32(i32_thing);
return;
case XTRUCT_THING:
Xtruct3 xtruct_thing = (Xtruct3)value_;
xtruct_thing.write(oprot);
return;
case INSANITY_THING:
Insanity insanity_thing = (Insanity)value_;
insanity_thing.write(oprot);
return;
default:
throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_);
}
}
@Override
protected java.lang.Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(fieldID);
if (setField != null) {
switch (setField) {
case MAP_THING:
java.util.Map<Numberz,java.lang.Long> map_thing;
{
org.apache.thrift.protocol.TMap _map93 = iprot.readMapBegin();
map_thing = new java.util.HashMap<Numberz,java.lang.Long>(2*_map93.size);
Numberz _key94;
long _val95;
for (int _i96 = 0; _i96 < _map93.size; ++_i96)
{
_key94 = thrift.test.Numberz.findByValue(iprot.readI32());
_val95 = iprot.readI64();
map_thing.put(_key94, _val95);
}
iprot.readMapEnd();
}
return map_thing;
case STRING_THING:
java.lang.String string_thing;
string_thing = iprot.readString();
return string_thing;
case I32_THING:
java.lang.Integer i32_thing;
i32_thing = iprot.readI32();
return i32_thing;
case XTRUCT_THING:
Xtruct3 xtruct_thing;
xtruct_thing = new Xtruct3();
xtruct_thing.read(iprot);
return xtruct_thing;
case INSANITY_THING:
Insanity insanity_thing;
insanity_thing = new Insanity();
insanity_thing.read(iprot);
return insanity_thing;
default:
throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
throw new org.apache.thrift.protocol.TProtocolException("Couldn't find a field with field id " + fieldID);
}
}
@Override
protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
switch (setField_) {
case MAP_THING:
java.util.Map<Numberz,java.lang.Long> map_thing = (java.util.Map<Numberz,java.lang.Long>)value_;
{
oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.I32, org.apache.thrift.protocol.TType.I64, map_thing.size()));
for (java.util.Map.Entry<Numberz, java.lang.Long> _iter97 : map_thing.entrySet())
{
oprot.writeI32(_iter97.getKey().getValue());
oprot.writeI64(_iter97.getValue());
}
oprot.writeMapEnd();
}
return;
case STRING_THING:
java.lang.String string_thing = (java.lang.String)value_;
oprot.writeString(string_thing);
return;
case I32_THING:
java.lang.Integer i32_thing = (java.lang.Integer)value_;
oprot.writeI32(i32_thing);
return;
case XTRUCT_THING:
Xtruct3 xtruct_thing = (Xtruct3)value_;
xtruct_thing.write(oprot);
return;
case INSANITY_THING:
Insanity insanity_thing = (Insanity)value_;
insanity_thing.write(oprot);
return;
default:
throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_);
}
}
@Override
protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
switch (setField) {
case MAP_THING:
return MAP_THING_FIELD_DESC;
case STRING_THING:
return STRING_THING_FIELD_DESC;
case I32_THING:
return I32_THING_FIELD_DESC;
case XTRUCT_THING:
return XTRUCT_THING_FIELD_DESC;
case INSANITY_THING:
return INSANITY_THING_FIELD_DESC;
default:
throw new java.lang.IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected org.apache.thrift.protocol.TStruct getStructDesc() {
return STRUCT_DESC;
}
@Override
protected _Fields enumForId(short id) {
return _Fields.findByThriftIdOrThrow(id);
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public java.util.Map<Numberz,java.lang.Long> getMap_thing() {
if (getSetField() == _Fields.MAP_THING) {
return (java.util.Map<Numberz,java.lang.Long>)getFieldValue();
} else {
throw new java.lang.RuntimeException("Cannot get field 'map_thing' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setMap_thing(java.util.Map<Numberz,java.lang.Long> value) {
if (value == null) throw new java.lang.NullPointerException();
setField_ = _Fields.MAP_THING;
value_ = value;
}
public java.lang.String getString_thing() {
if (getSetField() == _Fields.STRING_THING) {
return (java.lang.String)getFieldValue();
} else {
throw new java.lang.RuntimeException("Cannot get field 'string_thing' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setString_thing(java.lang.String value) {
if (value == null) throw new java.lang.NullPointerException();
setField_ = _Fields.STRING_THING;
value_ = value;
}
public int getI32_thing() {
if (getSetField() == _Fields.I32_THING) {
return (java.lang.Integer)getFieldValue();
} else {
throw new java.lang.RuntimeException("Cannot get field 'i32_thing' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setI32_thing(int value) {
setField_ = _Fields.I32_THING;
value_ = value;
}
public Xtruct3 getXtruct_thing() {
if (getSetField() == _Fields.XTRUCT_THING) {
return (Xtruct3)getFieldValue();
} else {
throw new java.lang.RuntimeException("Cannot get field 'xtruct_thing' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setXtruct_thing(Xtruct3 value) {
if (value == null) throw new java.lang.NullPointerException();
setField_ = _Fields.XTRUCT_THING;
value_ = value;
}
public Insanity getInsanity_thing() {
if (getSetField() == _Fields.INSANITY_THING) {
return (Insanity)getFieldValue();
} else {
throw new java.lang.RuntimeException("Cannot get field 'insanity_thing' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setInsanity_thing(Insanity value) {
if (value == null) throw new java.lang.NullPointerException();
setField_ = _Fields.INSANITY_THING;
value_ = value;
}
public boolean isSetMap_thing() {
return setField_ == _Fields.MAP_THING;
}
public boolean isSetString_thing() {
return setField_ == _Fields.STRING_THING;
}
public boolean isSetI32_thing() {
return setField_ == _Fields.I32_THING;
}
public boolean isSetXtruct_thing() {
return setField_ == _Fields.XTRUCT_THING;
}
public boolean isSetInsanity_thing() {
return setField_ == _Fields.INSANITY_THING;
}
public boolean equals(java.lang.Object other) {
if (other instanceof SomeUnion) {
return equals((SomeUnion)other);
} else {
return false;
}
}
public boolean equals(SomeUnion other) {
return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
}
@Override
public int compareTo(SomeUnion other) {
int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
if (lastComparison == 0) {
return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
}
return lastComparison;
}
@Override
public int hashCode() {
java.util.List<java.lang.Object> list = new java.util.ArrayList<java.lang.Object>();
list.add(this.getClass().getName());
org.apache.thrift.TFieldIdEnum setField = getSetField();
if (setField != null) {
list.add(setField.getThriftFieldId());
java.lang.Object value = getFieldValue();
if (value instanceof org.apache.thrift.TEnum) {
list.add(((org.apache.thrift.TEnum)getFieldValue()).getValue());
} else {
list.add(value);
}
}
return list.hashCode();
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
}
| [
"gaven@DESKTOP-DUDNVRA"
] | gaven@DESKTOP-DUDNVRA |
286d47cf2886124fd72941fa78cb1d2cc786fde6 | cd557ccb3bb0e516e51f337479fc35f5f05d1a84 | /app/src/main/java/com/example/smartagriculture/Model/Important/ImportantPageStatus.java | f757f569fb352fb4e2b5ec27a929319f24597c4f | [] | no_license | xsj321/SmartNeighborhood | 2de33f77a4e509bd286e7026f808660e48b1d642 | d6be6f2a39f4a79291050b20e9f4c980318bb587 | refs/heads/master | 2023-04-21T07:28:11.146072 | 2020-06-08T17:16:37 | 2020-06-08T17:16:37 | 259,416,023 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | package com.example.smartagriculture.Model.Important;
import com.example.smartagriculture.Model.Cover.CoverDataListItem;
import java.util.ArrayList;
/**
* ็จๆฅไผ ้ImportantPage้กต้ข็ๆถๆฏ
*/
public class ImportantPageStatus {
private Boolean isWaring;
private ArrayList<ImportantDataListItem> dataList;
private ArrayList<CoverDataListItem> waringList;
public ImportantPageStatus(Boolean isWaring, ArrayList<ImportantDataListItem> dataList, ArrayList<CoverDataListItem> waringList) {
this.isWaring = isWaring;
this.dataList = dataList;
this.waringList = waringList;
}
public Boolean getWaring() {
return isWaring;
}
public ArrayList<ImportantDataListItem> getDataList() {
return dataList;
}
public ArrayList<CoverDataListItem> getWaringList() {
return waringList;
}
}
| [
"xsj321@outlook.com"
] | xsj321@outlook.com |
163f30b46a74e2557276780bf3f4afcd25112ab4 | dc37bfa92d000867b10d3c44cbbb8319123bd868 | /app/src/main/java/arvolear/zoomer/zoomer/global_gui/LoadingWheel.java | b778fdc10ca5a9333d9a4dcd4a54317e180901a2 | [] | no_license | Arvolear/Zoomer | 37f6969d6f90f04b78e71d8d0e58d401da27e4d1 | e7f444e8cc3a606f89ca1098cfb33567fc2c5f22 | refs/heads/master | 2023-01-28T19:34:15.600073 | 2020-12-04T17:29:23 | 2020-12-04T17:29:23 | 297,283,382 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,728 | java | package arvolear.zoomer.zoomer.global_gui;
import android.graphics.BlendMode;
import android.graphics.BlendModeColorFilter;
import android.graphics.PorterDuff;
import android.os.Build;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import androidx.appcompat.app.AppCompatActivity;
import arvolear.zoomer.zoomer.R;
public class LoadingWheel extends FrameLayout
{
private AppCompatActivity activity;
private int color;
private FrameLayout loadLayout;
private ProgressBar progressBar;
public LoadingWheel(AppCompatActivity activity, int color)
{
super(activity);
this.activity = activity;
this.loadLayout = activity.findViewById(R.id.loadLayout);
this.color = color;
init();
}
@SuppressWarnings("deprecation")
private void init()
{
FrameLayout.LayoutParams LP0 = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
LP0.gravity = Gravity.END;
progressBar = new ProgressBar(activity);
progressBar.setLayoutParams(LP0);
progressBar.setPadding(0, 0, 0, 20);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
{
progressBar.getIndeterminateDrawable().setColorFilter(new BlendModeColorFilter(color, BlendMode.MODULATE));
}
else
{
progressBar.getIndeterminateDrawable().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
}
progressBar.setIndeterminate(true);
addView(progressBar);
}
public void show()
{
loadLayout.addView(this);
}
public void hide()
{
loadLayout.removeView(this);
}
}
| [
"artem.ch31@gmail.com"
] | artem.ch31@gmail.com |
70551d0d8ca68b2e1d767bff664d9a70f927bf80 | 422b55940c5f2e47c2cb6a4042edfa1a163050ff | /MintLocker/app/src/main/java/com/bss/mintlocker/ui/fragments/OncePerMonth.java | 1761c367e98c27f507715093e29fed996341a573 | [] | no_license | garg-neha198814/MintLocker9Feb | 3fda6b935f73ac355abd81121da64c4b913c66df | a01675c7399f6ed853a8d3218b846758fcb9b847 | refs/heads/master | 2021-01-17T17:09:43.229538 | 2016-06-24T07:32:26 | 2016-06-24T07:32:26 | 61,865,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,202 | java | package com.bss.mintlocker.ui.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;
import com.bss.mintlocker.R;
import com.bss.mintlocker.adapter.OncePerMonthAdapter;
import com.bss.mintlocker.landing.LandingScreenActivity;
import com.bss.mintlocker.model.OncePerMonthModel;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
/**
* Created by bhawanisingh on 04/12/15.
*/
public class OncePerMonth extends Fragment implements View.OnClickListener {
public OncePerMonth() {
}
int monthMaxDays = 0;
GridView gridView;
List<OncePerMonthModel> rowItems;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_once_per_month, container, false);
LandingScreenActivity.mToolbarTitle.setText("Deposit");
gridView = (GridView) v.findViewById(R.id.once_per_month_gridview);
Calendar c = Calendar.getInstance();
monthMaxDays = c.getActualMaximum(Calendar.DAY_OF_MONTH);
int[] arrayVal = new int[monthMaxDays];
for (int j = 1; j <= monthMaxDays; j++) {
arrayVal[j - 1] = j;
}
System.out.println("Size>>" + arrayVal.length);
//setting dummy list
rowItems = new ArrayList<OncePerMonthModel>();
for (int i = 0; i < arrayVal.length; i++) {
OncePerMonthModel item = new OncePerMonthModel(arrayVal[i]);
rowItems.add(item);
}
System.out.println("Size11>>" + rowItems.size());
for (int i = 0; i < arrayVal.length; i++) {
System.out.println("value are >>" + arrayVal[i]);
}
//setting dummy adapter
OncePerMonthAdapter adapter = new OncePerMonthAdapter(getActivity(), rowItems);
gridView.setAdapter(adapter);
return v;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
}
}
}
| [
"nehamalout@gmail.com"
] | nehamalout@gmail.com |
9b9e416077ef559b26a1e726ef471151b669da63 | 976c08e4954a12f72cbe9f8beeb4778cd8427015 | /app/src/androidTest/java/async/shah/com/retrofittest/ExampleInstrumentedTest.java | 701c7b39718bca52f937a6176796686f3cc16c61 | [] | no_license | sics-shah/Retro | 46959c1cdbc42a6ce54726e9811aff0e1917f28e | 9d3af752304224f2eb0146780deb6de46a7122fe | refs/heads/master | 2020-12-02T06:40:31.139533 | 2017-07-24T07:40:19 | 2017-07-24T07:40:19 | 96,875,766 | 0 | 0 | null | 2017-07-24T07:40:19 | 2017-07-11T09:27:09 | Java | UTF-8 | Java | false | false | 784 | java | package async.shah.com.retrofittest;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("async.shah.com.retrofittest", appContext.getPackageName());
}
}
| [
"mushah@Shah-MacBook.local"
] | mushah@Shah-MacBook.local |
4cb3210e9f1993cb63c3c11bb5c7478b46742f9d | 6f8ecbc5505bf67c6e735e18704bddf2f3d3cab8 | /src/Aula22/Negocio/ProduzirBolaMorango.java | 1d470faa8fc421b3daa4ac9daee7f76730b7ad23 | [
"MIT"
] | permissive | ErikVergani/Java-POO | 570fef390a358c628526294b79a3cc3bfba40f18 | deec8ca646f60f2734ecda4dc235f07ef6e32354 | refs/heads/main | 2023-05-28T22:06:19.008472 | 2021-06-12T04:22:26 | 2021-06-12T04:22:26 | 362,958,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 864 | java | package Aula22.Negocio;
/**
* @author ErikVergani
* @date 07/05/2021
**/
public class ProduzirBolaMorango implements ProcessarItem {
MaquinaSorvete maquinaSorvete;
public ProduzirBolaMorango(MaquinaSorvete maquinaSorvete) {
this.maquinaSorvete = maquinaSorvete;
}
@Override
public void processarItem() {
if (maquinaSorvete.getMorango() >= 7 && maquinaSorvete.getEmulsificante() >= 15 && maquinaSorvete.getLeite() >= 35) {
maquinaSorvete.useMorango(7);
maquinaSorvete.useEmulsificante(15);
maquinaSorvete.useLeite(35);
maquinaSorvete.addNumBolasMorango(1);
System.out.println("1 bola de morango foi vendida!\n");
}else{
System.out.println("Nรฃo foi possivel vender a bola de morango pois algum ingrediente estรก faltando");
}
}
} | [
"efvergani@hotmail.com"
] | efvergani@hotmail.com |
c6d2f1a97bf9a2952e7ee4f2de5911bc3f0a2843 | c5455a16e6ffb0cfab03f46ea2cc69820c796bf4 | /src/org/OutlierCorrector/JMeterLogCorrector/MemoryBufferingOutputtingHandler.java | 69a8fad1a90613966a70074dcd1ffac7a9b86314 | [] | no_license | OutlierCorrector/OutlierCorrector | 6e79a73ec195d7cefa412eccf07c7fd7d6ad3ac0 | e0edf198f68820610a6becef65069b11d42f06aa | refs/heads/master | 2016-09-06T14:37:24.788334 | 2013-08-11T23:02:17 | 2013-08-11T23:02:17 | 12,043,885 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package org.OutlierCorrector.JMeterLogCorrector;
import java.io.IOException;
import java.util.*;
import org.OutlierCorrector.Request;
import org.OutlierCorrector.RequestHandler;
public class MemoryBufferingOutputtingHandler implements RequestHandler {
private final List<Request> log = (List<Request>) Collections.synchronizedCollection(new ArrayList<Request>());
public MemoryBufferingOutputtingHandler() throws IOException {
}
Request getRequestAtIndex(int index) {
return log.get(index);
}
public void handleRequest(final Request request) {
log.add(request);
}
@Override
public void flush() {
}
}
| [
"machmie2@illinois.edu"
] | machmie2@illinois.edu |
c698a460d193c72a78c0e99db4c140c0c00a4667 | a29b7ab365b3c9d65e679c638f0e0ef3fd654e05 | /02_Operator/src/com/kh/operator/D_Comparison.java | a5ccea023a80117d10b1e811ca556b63ffc55ad0 | [] | no_license | b-bok/BackUp | 6ee7af38e9590a1220a0221906c125daab635b7c | 1d78088b6ce2028f9a2a086bfe5ae15cd1f1d142 | refs/heads/master | 2022-11-19T10:01:17.989825 | 2020-07-16T12:36:24 | 2020-07-16T12:36:24 | 280,147,659 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,410 | java | package com.kh.operator;
public class D_Comparison {
/*
* * ๋น๊ต ์ฐ์ฐ์(๊ด๊ณ ์ฐ์ฐ์, ์ดํญ ์ฐ์ฐ์)
* - ๋ ๊ฐ์ ๋น๊ตํ๋ ์ฐ์ฐ์
* - ๋น๊ต ํ ๊ฐ์ด ์ฐธ์ด๋ฉด true, ๊ฑฐ์ง์ด๋ฉด false
* ์ฆ, ๋น๊ต์ฐ์ฐ์ ์ํํ ๊ฒฐ๊ณผ๊ฐ์ ๋
ผ๋ฆฌ๊ฐ
*
* a < b : a๊ฐ b๋ณด๋ค ์๋?
* a > b : a๊ฐ b๋ณด๋ค ํฌ๋?
* a <= b : a๊ฐ b๋ณด๋ค ์๊ฑฐ๋ ๊ฐ๋?
* a >= b : a๊ฐ b๋ณด๋ค ํฌ๊ฑฐ๋ ๊ฐ๋? (๊ธฐํธ ์์๋๋ก ์ฝ๊ธฐ)
*
* a == b : a์ b๊ฐ ๊ฐ๋?
* a != b : a์ b๊ฐ ๋ค๋ฅด๋? == !(a==b)
*
*
*/
public void method1() {
int a = 10;
int b = 25;
System.out.println("a == b : " + (a == b));
System.out.println("a <= b : " + (a <= b));
System.out.println("a > b : " + (a > b));
System.out.println("a != b : " + (a != b));
System.out.println("a == b : " + (a == b));
boolean result = (a >= b);
System.out.println("result : " + result);
// ์ฐ์ ์ฐ์ฐ + ๋น๊ต์ฐ์ฐ
// a๊ฐ ์ง์ ์
๋๊น?
System.out.println("a๊ฐ ์ง์ ์
๋๊น? : " + (a % 2 == 0));
System.out.println("b๋ ์ง์ ์ธ๊ฐ? : " + (b % 2 == 0));
System.out.println("a๊ฐ ํ์์ธ๊ฐ? : " + (a % 2 == 1));
System.out.println("b๊ฐ ํ์์ธ๊ฐ? : " + (b % 2 == 1));
System.out.println(a + b > 30);
// ๊ฐ % 2 == 0 -> ์ง์
// ๊ฐ % 2 == 1 -> ํ์
}
}
| [
"hooyuki123@gmail.com"
] | hooyuki123@gmail.com |
c7d6cae9cd2f4e799ab4e31af8348955c462db5b | 926fefb45918a4cb6aef0688084b45d8eac19700 | /javastone/src/main/java/com/hxr/javatone/concurrency/netty/official/worldclock/WorldClockServerInitializer.java | 837968d28aac7363f76c1453d9e261482d6c5404 | [] | no_license | hanxirui/for_java | 1534d19828b4e30056deb4340d5ce0b9fd819f1a | 14df7f9cb635da16a0ee283bf016dc77ad3cecec | refs/heads/master | 2022-12-25T02:06:30.568892 | 2019-09-06T06:45:36 | 2019-09-06T06:45:36 | 14,199,294 | 1 | 0 | null | 2022-12-16T06:29:53 | 2013-11-07T09:17:09 | JavaScript | UTF-8 | Java | false | false | 1,689 | java | /*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.hxr.javatone.concurrency.netty.official.worldclock;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.protobuf.ProtobufDecoder;
import io.netty.handler.codec.protobuf.ProtobufEncoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
public class WorldClockServerInitializer extends ChannelInitializer<SocketChannel> {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast("frameDecoder", new ProtobufVarint32FrameDecoder());
p.addLast("protobufDecoder", new ProtobufDecoder(WorldClockProtocol.Locations.getDefaultInstance()));
p.addLast("frameEncoder", new ProtobufVarint32LengthFieldPrepender());
p.addLast("protobufEncoder", new ProtobufEncoder());
p.addLast("handler", new WorldClockServerHandler());
}
}
| [
"han_xirui@163.com"
] | han_xirui@163.com |
7fd75a6e721d0e2c3f9661ca17e34e0ccf303e42 | 5e65c0cfff12b0dec5ab1494b69f188bfc2afb2c | /Project DVD/Source Code/ProgressiveOverload/src/com/example/progressiveoverload/SelectWorkout/SelectWorkoutsDetailFragment.java | 4fe10fb7a5c72291fc7357d463c12d253b96a648 | [] | no_license | TwoToneEddy/uniBackup | c2650fbd9ae82ae44e345b53edf6995cd176453a | 96415bfaecfd8398f9bed74664a5cbe389c4be28 | refs/heads/master | 2022-11-22T14:31:07.244100 | 2020-07-27T19:12:46 | 2020-07-27T19:12:46 | 282,992,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 618 | java | package com.example.progressiveoverload.SelectWorkout;
import com.example.progressiveoverload.R;
import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class SelectWorkoutsDetailFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = (ViewGroup)inflater.inflate(R.layout.fragment_select_workouts_detail,
container, false);
return view;
}
}
| [
"lee.hudson1384@yahoo.co.uk"
] | lee.hudson1384@yahoo.co.uk |
a6ceb15e37fbce5b9f916b8525a9b715470783c3 | 2cc353c63c5e005f2207b93fbba1909b12d64410 | /app/src/main/java/com/a6bytes/jack/adapter/NoteItemRecyclerViewAdapter.java | 6529f096107080757ba7ef51edca65304a94ce55 | [] | no_license | 106BYTES/jack-android | d551163b105f32bc7fae587ac624bb9290fa03b6 | b9f69df7b26d6276ec411e2bcacd0e674da0ba72 | refs/heads/master | 2021-01-19T15:23:07.522422 | 2017-08-27T15:27:37 | 2017-08-27T15:27:37 | 100,964,950 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,473 | java | package com.a6bytes.jack.adapter;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.a6bytes.jack.R;
import com.a6bytes.jack.ui.main.fragment.NoteItemFragment.OnListFragmentInteractionListener;
import java.util.List;
/**
* {@link RecyclerView.Adapter} that can display a {@link NoteListItem} and makes a call to the
* specified {@link OnListFragmentInteractionListener}.
* TODO: Replace the implementation with code for your data type.
*/
public class NoteItemRecyclerViewAdapter extends RecyclerView.Adapter<NoteItemRecyclerViewAdapter.ViewHolder> {
private final List<NoteListItem> mValues;
private final OnListFragmentInteractionListener mListener;
public NoteItemRecyclerViewAdapter(List<NoteListItem> items, OnListFragmentInteractionListener listener) {
mValues = items;
mListener = listener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.fragment_noteitem, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
holder.mItem = mValues.get(position);
holder.mSummaryView.setText(mValues.get(position).summary);
holder.mContentView.setText(mValues.get(position).title);
holder.mThumbnail.setImageDrawable(holder.mItem.thumbnail);
holder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (null != mListener) {
// Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that an item has been selected.
mListener.onListFragmentInteraction(holder.mItem);
}
}
});
}
@Override
public int getItemCount() {
return mValues.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final TextView mSummaryView;
public final TextView mContentView;
public NoteListItem mItem;
public final ImageView mThumbnail;
public ViewHolder(View view) {
super(view);
mView = view;
mSummaryView = (TextView) view.findViewById(R.id.summary);
mContentView = (TextView) view.findViewById(R.id.content);
mThumbnail = (ImageView) view.findViewById(R.id.imageView);
}
@Override
public String toString() {
return super.toString() + " '" + mContentView.getText() + "'";
}
}
public static class NoteListItem {
public int id;
public String title;
public String summary;
public int year, month, day;
public Drawable thumbnail;
public NoteListItem(int id, String title, String summary, int[] date, Drawable thumbnail) {
this.id = id;
this.title = title;
this.summary = summary;
this.year = date[0];
this.month = date[1];
this.day = date[2];
this.thumbnail = thumbnail;
}
}
}
| [
"akzm9999@gmail.com"
] | akzm9999@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.