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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0143983aadee7c388dd47e6e2d9fb5f68cf94ad8 | 6daf5277c88d4a9df9bec694c23f72e424838bae | /src/main/java/com/raphydaphy/rocksolid/tileentity/TileEntityElectricSmelter.java | af6a56fb71143ba66fbb78e30109286357c15dc3 | [
"MIT"
] | permissive | raphydaphy/RockSolid | ce2bdb04e454c422031c0934ca8104c989fb28c7 | d30a6944bf8b59ba8c9ecc3021e0afa23b20759a | refs/heads/master | 2021-06-17T16:01:44.934032 | 2017-10-14T02:25:53 | 2017-10-14T02:25:53 | 96,505,218 | 57 | 5 | null | 2017-07-25T04:01:25 | 2017-07-07T06:12:24 | Java | UTF-8 | Java | false | false | 4,575 | java | package com.raphydaphy.rocksolid.tileentity;
import java.util.Arrays;
import java.util.List;
import com.raphydaphy.rocksolid.api.energy.TileEntityPowered;
import com.raphydaphy.rocksolid.api.util.IBasicIO;
import com.raphydaphy.rocksolid.gui.inventory.ContainerInventory;
import de.ellpeck.rockbottom.api.RockBottomAPI;
import de.ellpeck.rockbottom.api.data.set.DataSet;
import de.ellpeck.rockbottom.api.item.ItemInstance;
import de.ellpeck.rockbottom.api.util.Direction;
import de.ellpeck.rockbottom.api.world.IWorld;
public class TileEntityElectricSmelter extends TileEntityPowered implements IBasicIO
{
public static final int INPUT = 0;
public static final int OUTPUT = 1;
public final ContainerInventory inventory;
protected int smeltTime;
protected int maxSmeltTime;
private int lastSmelt;
private int powerStored;
private boolean shouldSync;
public TileEntityElectricSmelter(final IWorld world, final int x, final int y)
{
super(world, x, y, 5000, 20);
this.inventory = new ContainerInventory(this, 3);
}
@Override
protected boolean needsSync()
{
return super.needsSync() || this.lastSmelt != this.smeltTime || this.shouldSync;
}
@Override
protected void onSync()
{
super.onSync();
this.lastSmelt = this.smeltTime;
this.shouldSync = false;
}
@Override
protected boolean tryTickAction()
{
boolean hasRecipeAndSpace = false;
final ItemInstance input = this.inventory.get(0);
if (input != null)
{
/*
final SmelterRecipe recipe = RockBottomAPI.getSmelterRecipe(input);
if (recipe != null)
{
final IUseInfo recipeIn = recipe.getInput();
if (input.getAmount() >= recipeIn.getAmount())
{
final ItemInstance recipeOut = recipe.getOutput();
final ItemInstance output = this.inventory.get(1);
if (output == null || (output.isEffectivelyEqual(recipeOut)
&& output.getAmount() + recipeOut.getAmount() <= output.getMaxAmount()))
{
hasRecipeAndSpace = true;
if (this.powerStored > 0)
{
if (RockBottomAPI.getNet().isClient() == false)
{
if (this.maxSmeltTime <= 0)
{
this.maxSmeltTime = recipe.getTime() / 5;
}
++this.smeltTime;
this.shouldSync = true;
}
if (this.smeltTime < this.maxSmeltTime)
{
return hasRecipeAndSpace;
}
if (RockBottomAPI.getNet().isClient() == false)
{
this.inventory.remove(0, recipeIn.getAmount());
if (output == null)
{
this.inventory.set(1, recipeOut.copy());
} else
{
this.inventory.add(1, recipeOut.getAmount());
}
shouldSync = true;
}
} else if (this.smeltTime > 0)
{
if (RockBottomAPI.getNet().isClient() == false)
{
this.smeltTime = Math.max(this.smeltTime - 2, 0);
this.shouldSync = true;
}
return hasRecipeAndSpace;
}
}
}
}
*/
}
if (RockBottomAPI.getNet().isClient() == false)
{
this.smeltTime = 0;
this.maxSmeltTime = 0;
this.shouldSync = true;
}
return hasRecipeAndSpace;
}
@Override
protected void onActiveChange(final boolean active)
{
this.world.causeLightUpdate(this.x, this.y);
}
public float getSmeltPercentage()
{
return (float) this.smeltTime / (float) this.maxSmeltTime;
}
@Override
public void save(final DataSet set, final boolean forSync)
{
super.save(set, forSync);
if (!forSync)
{
this.inventory.save(set);
}
set.addInt("smelt", this.smeltTime);
set.addInt("max_smelt", this.maxSmeltTime);
set.addBoolean("shouldSync", this.shouldSync);
}
@Override
public void load(final DataSet set, final boolean forSync)
{
super.load(set, forSync);
if (!forSync)
{
this.inventory.load(set);
}
this.smeltTime = set.getInt("smelt");
this.maxSmeltTime = set.getInt("max_smelt");
this.shouldSync = set.getBoolean("shouldSync");
}
@Override
public ContainerInventory getInventory()
{
return this.inventory;
}
@Override
public List<Integer> getInputSlots(ItemInstance input, Direction dir)
{
return Arrays.asList(0);
}
@Override
public List<Integer> getOutputSlots(Direction dir)
{
return Arrays.asList(1);
}
@Override
protected void setPower(int power)
{
this.powerStored = power;
}
@Override
protected int getPower()
{
return this.powerStored;
}
public boolean isActive()
{
return this.smeltTime > 0;
}
@Override
public boolean isValidInput(ItemInstance item)
{
//return RockBottomAPI.getSmelterRecipe(item) != null;
return false;
}
} | [
"raph.hennessy@gmail.com"
] | raph.hennessy@gmail.com |
bc09d0e756eb35e1e01f119f9414f4c7127f9d25 | 6a89edc9a8915abf7a65f9d867b880c04a93bf0a | /arcade/land_of_logic/sumUpNumbers.java | 97b93d0bc803553bd2fe1046a829281fec31544e | [] | no_license | ntnprdhmm/codefights | eb3e9a7261be45b71d1105472222b1b7d8dc55f2 | 543781db759e32f4857ef3769197c42d2b43f843 | refs/heads/master | 2022-09-16T05:01:34.531343 | 2018-05-18T19:41:42 | 2018-05-18T19:41:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | int sumUpNumbers(String s) {
Pattern p = Pattern.compile("([0-9]+)");
Matcher m = p.matcher(s);
int sum = 0;
while (m.find()) {
sum += Integer.parseInt(m.group(1));
}
return sum;
}
| [
"antoineprudhomme5@gmail.com"
] | antoineprudhomme5@gmail.com |
b6ce23020c7c4e17256697f411655b90fa9700fe | 2457ff04edf97110c4735bb6a17b9d40333ae353 | /app/src/main/java/ahmedG2797/popularmovies2/Models/MoviesResponse.java | 779796d4d96de901b1eba03846f2ed9111d9a9a5 | [] | no_license | AhmedG2797/Popular_Movies | 7c06a6aca0e179ae038d709768f2147ec45e8003 | 965be5f6fa6092bc6f8b00d8162c25a7e58f5196 | refs/heads/master | 2020-05-07T11:32:20.476841 | 2019-04-09T23:50:57 | 2019-04-09T23:50:57 | 180,465,704 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package ahmedG2797.popularmovies2.Models;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class MoviesResponse {
@SerializedName("results")
@Expose
private List<Movie> results = null;
public MoviesResponse() {
}
public List<Movie> getResults() {
return results;
}
public void setResults(List<Movie> results) {
this.results = results;
}
}
| [
"ahmedG2797@gmail.com"
] | ahmedG2797@gmail.com |
16fd8ac35e80628925feee661574fbc8fec89e68 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/spoon/learning/434/CtJavaDocTag.java | da8d741339682740c7025aa5efdc51505961db93 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,363 | java | /**
* Copyright (C) 2006-2018 INRIA and contributors
* Spoon - http://spoon.gforge.inria.fr/
*
* This software is governed by the CeCILL-C License under French law and
* abiding by the rules of distribution of free software. You can use, modify
* and/or redistribute the software under the terms of the CeCILL-C license as
* circulated by CEA, CNRS and INRIA at http://www.cecill.info.
*
* This program 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 CeCILL-C License for more details.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/
package spoon.reflect.code;
import spoon.reflect.declaration.CtElement;
import spoon.reflect.annotations.PropertyGetter;
import spoon.reflect.annotations.PropertySetter;
import static spoon.reflect.path.CtRole.COMMENT_CONTENT;
import static spoon.reflect.path.CtRole.JAVADOC_TAG_VALUE;
import static spoon.reflect.path.CtRole.DOCUMENTATION_TYPE;
/**
* This code element defines a javadoc tag
*
* Example:
* <code>
* @since name description
* </code>
*/
public interface CtJavaDocTag extends CtElement {
/**
* The tag prefix
*/
String JAVADOC_TAG_PREFIX = "@";
/**
* Define the possible type for a tag
*/
enum TagType {
AUTHOR,
DEPRECATED,
EXCEPTION ,
PARAM,
RETURN,
SEE,
SERIAL,
SERIAL_DATA,
SERIAL_FIELD,
SINCE,
THROWS,
VERSION,
UNKNOWN;
/**
* Return true if the tag can have a parameter
* @return true if the tag can have a parameter
*/
public boolean hasParam() {
return this == PARAM || this == THROWS;
}
/**
* Get the tag type associated to a name
* @param tagName the tag name
* @return the tag type
*/
public static TagType tagFromName(String tagName) {
for (TagType t : TagType.values()) {
if (t.name().toLowerCase().equals(tagName.toLowerCase())) {
return t;
}
}
return UNKNOWN;
}
@Override
public String toString() {
return JAVADOC_TAG_PREFIX + name().toLowerCase();
}
}
/**
* The type of the tag
* @return the type of the tag
*/
@PropertyGetter(role = DOCUMENTATION_TYPE)
TagType getType();
/**
* Define the type of the tag
* @param type the type name
*/
@PropertySetter(role = DOCUMENTATION_TYPE)
<E extends CtJavaDocTag> E setType(String type);
/**
* Define the type of the tag
* @param type the new type
*/
@PropertySetter(role = DOCUMENTATION_TYPE)
<E extends CtJavaDocTag> E setType(TagType type);
/**
* Get the content of the atg
* @return the content of the tag
*/
@PropertyGetter(role = COMMENT_CONTENT)
String getContent();
/**
* Define the content of the tag
* @param content the new content of the tag
*/
@PropertySetter(role = COMMENT_CONTENT)
<E extends CtJavaDocTag> E setContent(String content);
/**
* Get the parameter of the tag return null when none is specified (only for @param and @throws)
* @return the parameter
*/
@PropertyGetter(role = JAVADOC_TAG_VALUE)
String getParam();
/**
* Define a parameter
* @param param the parameter
*/
@PropertySetter(role = JAVADOC_TAG_VALUE)
<E extends CtJavaDocTag> E setParam(String param);
@Override
CtJavaDocTag clone();
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
253447f8ca7bc5f77fa1ef57c986182956747c13 | 481a2ccdbaad190d02015f2e99eebe41415b956c | /Core/SDK/org.emftext.sdk.codegen.resource.ui/src/org/emftext/sdk/codegen/resource/ui/generators/ui/QuickAssistAssistantGenerator.java | 6d5e808df7a1e3baf116fc1c0d57c51c54a7bd4b | [] | no_license | balazsgrill/EMFText | 2f3d5eb1ac9d794325b61a8bbea2e1d2c7d4b279 | cbbf0f472f5a4ab7222c7d9df9cb0962dac989da | refs/heads/master | 2020-12-30T18:38:38.790410 | 2013-04-24T10:03:32 | 2013-04-24T10:03:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,614 | java | /*******************************************************************************
* Copyright (c) 2006-2012
* Software Technology Group, Dresden University of Technology
* DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Software Technology Group - TU Dresden, Germany;
* DevBoost GmbH - Berlin, Germany
* - initial API and implementation
******************************************************************************/
package org.emftext.sdk.codegen.resource.ui.generators.ui;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.ABSTRACT_REUSABLE_INFORMATION_CONTROL_CREATOR;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.ANNOTATION;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.DEFAULT_INFORMATION_CONTROL;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.I_INFORMATION_CONTROL;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.I_INFORMATION_PRESENTER;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.I_QUICK_ASSIST_ASSISTANT;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.I_QUICK_ASSIST_INVOCATION_CONTEXT;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.QUICK_ASSIST_ASSISTANT;
import static org.emftext.sdk.codegen.resource.ui.IUIClassNameConstants.SHELL;
import org.emftext.sdk.codegen.composites.JavaComposite;
import org.emftext.sdk.codegen.parameters.ArtifactParameter;
import org.emftext.sdk.codegen.resource.GenerationContext;
import org.emftext.sdk.codegen.resource.ui.generators.UIJavaBaseGenerator;
public class QuickAssistAssistantGenerator extends UIJavaBaseGenerator<ArtifactParameter<GenerationContext>> {
public void generateJavaContents(JavaComposite sc) {
sc.add("package " + getResourcePackageName() + ";");
sc.addLineBreak();
sc.add("public class " + getResourceClassName() + " extends " + QUICK_ASSIST_ASSISTANT + " implements " + I_QUICK_ASSIST_ASSISTANT + " {");
sc.addLineBreak();
addConstructor(sc);
addCanAssistMethod(sc);
addCanFixMethod(sc);
sc.add("}");
}
private void addConstructor(JavaComposite sc) {
sc.add("public " + getResourceClassName() + "(" + iResourceProviderClassName + " resourceProvider, " + iAnnotationModelProviderClassName + " annotationModelProvider) {");
sc.add("setQuickAssistProcessor(new " + quickAssistProcessorClassName + "(resourceProvider, annotationModelProvider));");
sc.add("setInformationControlCreator(new " + ABSTRACT_REUSABLE_INFORMATION_CONTROL_CREATOR + "() {");
sc.add("public " + I_INFORMATION_CONTROL + " doCreateInformationControl(" + SHELL + " parent) {");
sc.add("return new " + DEFAULT_INFORMATION_CONTROL + "(parent, (" + I_INFORMATION_PRESENTER + ") null);");
sc.add("}");
sc.add("});");
sc.add("}");
sc.addLineBreak();
}
private void addCanAssistMethod(JavaComposite sc) {
sc.add("public boolean canAssist(" + I_QUICK_ASSIST_INVOCATION_CONTEXT + " invocationContext) {");
sc.add("return false;");
sc.add("}");
sc.addLineBreak();
}
private void addCanFixMethod(JavaComposite sc) {
sc.add("public boolean canFix(" + ANNOTATION + " annotation) {");
sc.add("return true;");
sc.add("}");
sc.addLineBreak();
}
}
| [
"jendrik.johannes@devboost.de"
] | jendrik.johannes@devboost.de |
aabce5904132f1fab61f6a5002633f0543e5a806 | d8464bc704b52cf38cf11b23fdbaf1fc6f184eb5 | /proj1b/OffByOne.java | efb34666a9d7b2ccf7d05219d636dbb7fa0ffdf1 | [] | no_license | zzehli/skeleton-sp19 | 43b2a7c28b0d683b2873be9b52494df8ab28245a | d66e72036c81711366d2f63d3d6be1f6ec16f7ff | refs/heads/master | 2022-11-30T12:15:43.565619 | 2020-08-17T22:51:34 | 2020-08-17T22:51:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 220 | java | public class OffByOne implements CharacterComparator {
@Override
public boolean equalChars(char x, char y) {
if (Math.abs(x-y)==1)
return true;
else
return false;
}
}
| [
"albertforus@gmail.com"
] | albertforus@gmail.com |
3672747dd8ee0062e45f5629257cfdc6d896df79 | e3c912687a56e48fc7c6db2e95b644183f40b8f0 | /src/main/java/iurii/job/interview/leetcode/FindKClosestElements.java | fa3aa0dbb119c1b268f72526c4540b45d7ec9e46 | [
"MIT"
] | permissive | dataronio/algorithms-1 | 00e11b0483eef96ab1b39bd39e00ab412d8e1e2c | ab3e08bd16203b077f4a600e31794d6d73303d68 | refs/heads/master | 2022-02-06T19:43:57.936282 | 2021-09-18T22:47:01 | 2021-09-18T22:47:01 | 158,045,329 | 0 | 0 | MIT | 2020-03-09T22:06:21 | 2018-11-18T03:07:59 | Java | UTF-8 | Java | false | false | 3,764 | java | package iurii.job.interview.leetcode;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.PriorityQueue;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* 658. Find K Closest Elements https://leetcode.com/problems/find-k-closest-elements/description/
*
* https://leetcode.com/articles/find-k-closest-elements/
*
* https://www.geeksforgeeks.org/find-k-closest-elements-given-value/
*
* Similar to {@link iurii.job.interview.amazon.KClosestPoints} but array already sorted
*
* Idea is similar in {@link FindSmallestLetterGreaterThanTarget}
*
* But in case already sorted array, no need to use PriorityQueue for sorting,
* just use two pointers
*
* Time complexity: O(log(N) + k) logarithmic for two pointers search
* Auxiliary space complexity: O(K) - two pointers + List to store k result elements
*/
public class FindKClosestElements {
/**
* For not sorted case Priority queue can be used
* Time complexity: O((N-k)*log(k))
* Auxiliary space complexity: O(k) - priority queue length
* ! Note in java default priority queue is unbounded.
* ! But bounded queue (only k elements) can be implemented or used from different libraries
*/
public List<Integer> findClosestElementsWithPriorityQueue(int[] arr, int k, int x) {
PriorityQueue<Pair> priorityQueue = new PriorityQueue<>();
for(int el : arr) {
Pair pair = new Pair(el);
pair.distance = Math.abs(el - x);
priorityQueue.add(pair);
}
return Stream.generate(priorityQueue::poll)
.limit(k).mapToInt(pair -> pair.value).sorted().boxed().collect(Collectors.toList());
}
public static class Pair implements Comparable<Pair> {
int value;
int distance;
Pair(int value) {
this.value = value;
}
@Override
public int compareTo(Pair o) {
int compare = Integer.compare(distance, o.distance);
return (compare == 0) ? Integer.compare(value, o.value) : compare;
}
}
/**
* For sorted array case two pointers with binary search can be used to find the window of k elements
*
* Time complexity: O(log(n) + k) - binary search + taking k found elements
* Auxiliary space complexity: O(k) - two pointers + list of k elements
*/
public List<Integer> findClosestElementsSortedWithTwoPointers(int[] arr, int k, int x) {
List<Integer> result = new ArrayList<>();
if (arr == null || arr.length == 0 || k <= 0) {
return result;
}
int low = 0;
int high = arr.length - k;
while (low < high) {
int middle = low + (high - low) / 2;
if (x - arr[middle] > arr[middle + k] - x) {
low = middle + 1;
} else {
high = middle;
}
}
for(int i = low; i < low + k; i++) {
result.add(arr[i]);
}
return result;
}
/**
* Solution with sorting with comparator and extracting first k values and sorting them
*
* Time complexity: O(n*log(n) + k*log(k)) sorting
* Auxiliary space complexity: O(1) in place sorting and k elements from list view
*
* Solution can be used for not sorted array as well
*/
public List<Integer> findClosestElementsWithSortingList(List<Integer> arr, int k, int x) {
if (arr == null || arr.size() == 0 || k <= 0) {
return new ArrayList<>();
}
arr.sort(Comparator.comparingInt(a -> Math.abs(a - x)));
arr = arr.subList(0, k);
Collections.sort(arr);
return arr;
}
}
| [
"ydzyuban@gmail.com"
] | ydzyuban@gmail.com |
9b34a104c9b3b4e3ada3465c41dc006e70bb7199 | c4b8672b656283287dda0f8562484b095f2a3243 | /src/test/java/com/eniacdevelopment/EniacHome/ConfigurationResourceTest.java | 08a079e1b85e4e4ad184a952da8aec904e58595b | [] | no_license | EniacHome/AlarmService | 3796f82d4c15044613b6ecea64d2606675b7d019 | 181499606ba1f401d99dca36042c6051fc24d24d | refs/heads/master | 2021-06-14T08:29:36.646001 | 2021-01-23T08:50:20 | 2021-01-23T08:50:20 | 69,351,392 | 0 | 0 | null | 2021-01-23T08:50:21 | 2016-09-27T11:50:57 | Java | UTF-8 | Java | false | false | 2,599 | java | package com.eniacdevelopment.EniacHome;
import com.eniacdevelopment.EniacHome.DataModel.Configuration.SerialConfiguration;
import org.glassfish.grizzly.http.server.HttpServer;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.GenericType;
import javax.ws.rs.core.Response;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class ConfigurationResourceTest {
private HttpServer server;
private WebTarget target;
@Before
public void setUp() throws Exception {
server = UnitTestShared.getServer();
target = UnitTestShared.getWebTarger();
}
@After
public void tearDown() throws Exception {
server.stop();
}
//NOTE these test are bullcrap, they test elastic!
@Test
public void setIt(){
SerialConfiguration config = new SerialConfiguration(){{
Id = "CONFIG";
Active = true;
BaudRate = 9600;
DataBits = 8;
Parity = 0;
StopBits = 1;
PortDescriptor = "COM3";
}};
Response response = target.path("configuration").path("serial").request().post(Entity.json(config));
}
@Test
public void updateIt(){
SerialConfiguration config = new SerialConfiguration(){{
Id = "CONFIG";
Active = true;
BaudRate = 9600;
DataBits = 9;
Parity = 1;
StopBits = 2;
PortDescriptor = "COM3";
}};
Response response = target.path("configuration").path("serial").request().put(Entity.json(config));
}
@Test
public void getIt() {
SerialConfiguration response = target.path("configuration").path("serial").path("CONFIG").request().get(SerialConfiguration.class);
assertEquals("COM3", response.PortDescriptor);
}
@Test
public void getActive(){
SerialConfiguration response = target.path("configuration").path("serial").path("active").request().get(SerialConfiguration.class);
assertEquals(true, response.Active);
}
@Test
public void getAll() {
Iterable<SerialConfiguration> response = target.path("configuration").path("serial").request().get(new GenericType<Iterable<SerialConfiguration>>(){});
assertTrue(response != null);
}
@Test
public void deleteIt(){
Response response = target.path("configuration").path("serial").path("CONFIG").request().delete();
}
}
| [
"larsgardien@live.nl"
] | larsgardien@live.nl |
dc3b612c2e59eeaba3295d99116f21a30154b034 | 12c636cbbf2f449cbda08fb5de59d4b9af5075b3 | /src/k_jdbc/JDBCUtil.java | 5d902c6b00c3c7962ab9782b44bfdc47bfd924ee | [] | no_license | Keun-Woo/2021-java-study | 6af8fe820e16d00edaf2ac36ef20333b603a9182 | 20bbed32ca3b6a9dd6539a500b8514dcd3abe90b | refs/heads/master | 2023-03-13T01:19:25.496117 | 2021-02-26T00:54:21 | 2021-02-26T00:54:21 | 339,029,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,711 | java | package k_jdbc;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import d_array.Array;
public class JDBCUtil {
private JDBCUtil(){
}
//인스턴스를 보관할 변수
private static JDBCUtil instance;
//인스턴스를 빌려주는 메서드
public static JDBCUtil getInstance(){
if(instance == null){
instance = new JDBCUtil();
}
return instance;
}
String url ="jdbc:oracle:thin:@localhost:1521:xe";
String user = "pc05";
String password = "java";
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
//여러줄조회- 파라미터o
public List<Map<String ,Object>> selectList(String sql, List<Object> param){
List<Map<String ,Object>> list = new ArrayList<>();
try {
con = DriverManager.getConnection(url, user, password);
ps = con.prepareStatement(sql);
for (int i = 0; i <param.size(); i++) {
ps.setObject(i+1, param.get(i));
}
rs = ps.executeQuery();
ResultSetMetaData metaData = rs.getMetaData();
int columnCount =metaData.getColumnCount();
while (rs.next()){
HashMap<String, Object> row = new HashMap<>();
for (int i = 1; i <= columnCount; i++) {
row.put(metaData.getColumnName(i),rs.getObject(i));
}
list.add(row);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(rs != null) try { rs.close(); } catch (Exception e) {}
if(ps != null) try { ps.close(); } catch (Exception e) {}
if(con != null) try { con.close(); } catch (Exception e) {}
}
return list;
}
//한줄조회-파라미터x Map<String, Object> selectOne(String sql)
public Map<String, Object> selectOne(String sql) {
Map<String, Object> map = null;
try {
con = DriverManager.getConnection(url, user, password);
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
ResultSetMetaData metaData = rs.getMetaData();
int columnCount =metaData.getColumnCount();
while (rs.next()){
map = new HashMap();
for (int i = 1; i <= columnCount; i++) {
map.put(metaData.getColumnName(i),rs.getObject(i));
}
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(rs != null) try { rs.close(); } catch (Exception e) {}
if(ps != null) try { ps.close(); } catch (Exception e) {}
if(con != null) try { con.close(); } catch (Exception e) {}
}
return map;
}
//한줄 조회-파라미터o Map<String, Object> selectOne(String sql, List<Object> param)
public Map<String, Object> selectOne(String sql, List<Object> param){
Map<String, Object> map = null;
try {
con = DriverManager.getConnection(url, user, password);
ps = con.prepareStatement(sql);
for (int i = 0; i <param.size(); i++) {
ps.setObject(i+1, param.get(i));
}
rs = ps.executeQuery();
ResultSetMetaData metaData = rs.getMetaData();
int columnCount =metaData.getColumnCount();
while (rs.next()){
map = new HashMap();
for (int i = 1; i <= columnCount; i++) {
map.put(metaData.getColumnName(i),rs.getObject(i));
}
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(rs != null) try { rs.close(); } catch (Exception e) {}
if(ps != null) try { ps.close(); } catch (Exception e) {}
if(con != null) try { con.close(); } catch (Exception e) {}
}
return map;
}
//여러줄조회-파라미터x
public List<Map<String ,Object>> selectList(String sql){
List<Map<String ,Object>> list = new ArrayList<>();
try {
con = DriverManager.getConnection(url, user, password);
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
ResultSetMetaData metaData = rs.getMetaData();
int columnCount =metaData.getColumnCount();
while (rs.next()){
HashMap<String, Object> row = new HashMap<>();
for (int i = 1; i <= columnCount; i++) {
row.put(metaData.getColumnName(i),rs.getObject(i));
}
list.add(row);
}
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(rs != null) try { rs.close(); } catch (Exception e) {}
if(ps != null) try { ps.close(); } catch (Exception e) {}
if(con != null) try { con.close(); } catch (Exception e) {}
}
return list;
}
//업데이트 -파라미터x
public int update(String sql){
int result = 0;
try {
con = DriverManager.getConnection(url, user, password);
ps = con.prepareStatement(sql);
result = ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(rs != null) try { rs.close(); } catch (Exception e) {}
if(ps != null) try { ps.close(); } catch (Exception e) {}
if(con != null) try { con.close(); } catch (Exception e) {}
}
return result;
}
//업데이트-파라미터o
public int update(String sql, List<Object> param){
int result = 0;
try {
con = DriverManager.getConnection(url, user, password);
ps = con.prepareStatement(sql);
for (int i = 0; i <param.size(); i++) {
ps.setObject(i+1, param.get(i));
}
result = ps.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(rs != null) try { rs.close(); } catch (Exception e) {}
if(ps != null) try { ps.close(); } catch (Exception e) {}
if(con != null) try { con.close(); } catch (Exception e) {}
}
return result;
}
}
| [
"rjsdnsla2244@naver.com"
] | rjsdnsla2244@naver.com |
8ea71b1c64302b76b9610f31f70b85149c01efa3 | 6a6c1b5360952ae0ed88a1bd7e00aee3a8e9bb15 | /AirportNav/app/src/main/java/com/example/caroline/airportnav/MainActivity.java | 1956d5a44439aa4fc7917b9df3d095fbf42f77ef | [] | no_license | Caroline-Rajah/AirportNavigator | a81cb63a64124567b4368f0418c0900520f87718 | ed2abe2b89e252d2a24da1c4a384426ad03c1acb | refs/heads/master | 2020-04-07T10:52:32.569782 | 2018-11-19T23:32:01 | 2018-11-19T23:32:01 | 158,303,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,920 | java | package com.example.caroline.airportnav;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import com.example.caroline.airportnav.utilities.NetworkUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.URL;
public class MainActivity extends AppCompatActivity {
private EditText flightNumber;
private TextView flightDetails;
private String number;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
flightNumber = (EditText) findViewById(R.id.flight_number);
flightDetails = (TextView) findViewById(R.id.flight_details);
flightNumber.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId==EditorInfo.IME_ACTION_DONE){
number = v.getText().toString();
getFlightDetails(number);
flightDetails.setVisibility(View.VISIBLE);
}
return false;
}
});
}
private void getFlightDetails(String number) {
URL timetableURL = NetworkUtils.buildUrlForTimeTable();
new FetchTimeTableTask().execute(timetableURL);
}
public class FetchTimeTableTask extends AsyncTask<URL, Void, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected String doInBackground(URL... params) {
URL searchUrl = params[0];
String githubSearchResults = null;
try {
githubSearchResults = NetworkUtils.getResponseFromHttpUrl(searchUrl);
} catch (IOException e) {
e.printStackTrace();
}
return githubSearchResults;
}
@Override
protected void onPostExecute(String timetableSearchResults) {
String flight_details = "";
if (timetableSearchResults != null && !timetableSearchResults.equals("")) {
try{
JSONArray timetable = new JSONArray(timetableSearchResults);
for(int i =0;i<timetable.length();i++){
Log.d("HEy!", "onPostExecute: timetable retrieves, our flight is"+number);
JSONObject table = timetable.getJSONObject(i);
JSONObject flight = table.getJSONObject("flight");
String flight_number = flight.getString("number");
Log.d("HEy2 !", "onPostExecute: flight retrieved"+flight_number);
if(flight_number.equals(number)){
Log.d("HEy 3!", "onPostExecute: flight matched");
JSONObject departure = table.getJSONObject("departure");
flight_details = "Terminal: "+departure.getString("terminal")+"\n Gate:"+departure.getString("gate")+"\n Time:"+departure.getString("scheduledTime");
break;
}else{
continue;
}
}
}catch(JSONException e){
e.printStackTrace();
}
flightDetails.setText(flight_details);
} else {
flightDetails.setText("Error fetching results");
}
}
}
}
| [
"caroline9005@gmail.com"
] | caroline9005@gmail.com |
56df065a354918be96d8721bd043580aa265ae6a | b210d1babb41aa4def402aac0f737c65ecca5a1c | /src/main/java/finbarre/service/serviceForUsers/ProductsDelivered.java | 3f0a646dbebb2a396fc5ba9ebd1d554d643094f2 | [
"Apache-2.0"
] | permissive | shadowrider-pl/barfitter | 312088f8b074e0c2eaa7bb987e93ad88e845b64c | d5d7edeaeaf8639103e8584ec8e6408bbccef7f0 | refs/heads/master | 2022-12-21T05:28:05.948234 | 2020-01-23T15:21:07 | 2020-01-23T15:21:07 | 234,149,784 | 0 | 0 | Apache-2.0 | 2022-12-16T04:41:12 | 2020-01-15T18:51:48 | TypeScript | UTF-8 | Java | false | false | 413 | java | package finbarre.service.serviceForUsers;
import java.util.List;
import finbarre.domain.ProductDelivered;
public class ProductsDelivered {
private List<ProductDelivered> productsDelivered;
public List<ProductDelivered> getProductsDelivered() {
return productsDelivered;
}
public void setProductsDelivered(List<ProductDelivered> productsDelivered) {
this.productsDelivered = productsDelivered;
}
}
| [
"shadowrider@wp.pl"
] | shadowrider@wp.pl |
c9995ccdccd939627f4913653d6cd9063bd7c9d2 | a01f8a4c89d0110d86b26ce652b20f02728bff2c | /example-of-jetty-project/src/main/java/pl/info/rkluszczynski/servlet/HelloServlet.java | 9e7b81dd177cc7affaf01bf60d0743b811d1fd5e | [
"MIT"
] | permissive | rkluszczynski/gradle-templates-project | 0d438884678c324c22bac3349b86e15f2793bc29 | 9322a1368993d0fd93db3f3da99230f79569e9f1 | refs/heads/master | 2021-04-12T05:10:27.322139 | 2015-05-25T22:15:14 | 2015-05-25T22:15:14 | 16,862,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package pl.info.rkluszczynski.servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Created by Rafal on 28.02.14.
*/
//@WebServlet(name = "helloServlet", urlPatterns = "/")
public class HelloServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.getOutputStream().write("Hello, Servlet!".getBytes());
}
}
| [
"klusi@icm.edu.pl"
] | klusi@icm.edu.pl |
4a6f818e74be07cd65e0ea71e86d7cc545802245 | 471a4479b5f0828fb3c454b33270ec85a014355e | /src/main/java/com/algaworks/comercial/controller/OportunidadeController.java | 5273b58f70fdbcb4374fcf53b0ebde4f857a5922 | [] | no_license | Ygormorais/SpringBackOfAngular | 4db8eccf6feff9e2a04af71e0bf1a3f0854fb573 | f603ab300dc1c601a3a114dee29dc797ce7ddc8e | refs/heads/master | 2020-06-19T16:51:28.520756 | 2019-04-09T18:53:25 | 2019-04-09T18:53:25 | 196,791,160 | 2 | 0 | null | 2019-07-14T03:54:03 | 2019-07-14T03:54:03 | null | ISO-8859-1 | Java | false | false | 3,368 | java | package com.algaworks.comercial.controller;
import java.util.List;
import java.util.Optional;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ResponseStatusException;
import com.algaworks.comercial.model.Oportunidade;
import com.algaworks.comercial.repository.OportunidadeRepository;
@CrossOrigin
@RestController
@RequestMapping("/oportunidades")
public class OportunidadeController {
@Autowired
private OportunidadeRepository oportunidades;
@GetMapping
public List<Oportunidade> listar() {
return oportunidades.findAll();
}
@GetMapping("/{id}")
public ResponseEntity<Oportunidade> buscar(@PathVariable Long id) {
Optional<Oportunidade> oportunidade = oportunidades.findById(id);
if(!oportunidade.isPresent()) {
return ResponseEntity.notFound().build();
}
return ResponseEntity.ok(oportunidade.get());
}
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public Oportunidade adicionar(@Valid @RequestBody Oportunidade oportunidade) {
Optional<Oportunidade> oportunidadeExistente = oportunidades
.findByDescricaoAndNomeProspectoAndValor(oportunidade.getDescricao(), oportunidade.getNomeProspecto(), oportunidade.getValor());
if(oportunidadeExistente.isPresent()) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
"Já existe uma oportunidade para este prospecto com a mesma descrição");
}else if(oportunidade.getValor() == null) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
"Você não inseriu o valor");
}
return oportunidades.save(oportunidade);
}
@DeleteMapping("/{id}")
@ResponseStatus(HttpStatus.OK)
public Oportunidade deletar(Oportunidade oportunidade) {
Optional<Oportunidade> oportunidadeExistente = oportunidades.findById(oportunidade.getId());
if(!oportunidadeExistente.isPresent()) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND,
"O registro não foi encontrado!");
}
oportunidades.delete(oportunidade);
return oportunidade;
}
@PutMapping("/{id}")
@ResponseStatus(HttpStatus.OK)
public Oportunidade atualizar(@RequestBody Oportunidade oportunidade) {
if(oportunidade.getId() == null) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
"Não foi passado o objeto para requisição!");
}else {
Optional<Oportunidade> oportunidadeExistente = oportunidades.findById(oportunidade.getId());
if(!oportunidadeExistente.isPresent()) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
"O registro não foi encontrado!");
}
}
return oportunidades.save(oportunidade);
}
} | [
"mateus.silva@datainfo.inf.br"
] | mateus.silva@datainfo.inf.br |
306b82e4b7f580aef59c72611b72a926ce4a621a | 7b73756ba240202ea92f8f0c5c51c8343c0efa5f | /classes5/com/facebook/stetho/inspector/network/DefaultResponseHandler.java | c53b720b8a218af8017aea6fa55e241a2019b5ec | [] | no_license | meeidol-luo/qooq | 588a4ca6d8ad579b28dec66ec8084399fb0991ef | e723920ac555e99d5325b1d4024552383713c28d | refs/heads/master | 2020-03-27T03:16:06.616300 | 2016-10-08T07:33:58 | 2016-10-08T07:33:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,624 | java | package com.facebook.stetho.inspector.network;
import java.io.IOException;
public class DefaultResponseHandler
implements ResponseHandler
{
private int mBytesRead = 0;
private int mDecodedBytesRead = -1;
private final NetworkEventReporter mEventReporter;
private final String mRequestId;
public DefaultResponseHandler(NetworkEventReporter paramNetworkEventReporter, String paramString)
{
this.mEventReporter = paramNetworkEventReporter;
this.mRequestId = paramString;
}
private void reportDataReceived()
{
NetworkEventReporter localNetworkEventReporter = this.mEventReporter;
String str = this.mRequestId;
int j = this.mBytesRead;
if (this.mDecodedBytesRead >= 0) {}
for (int i = this.mDecodedBytesRead;; i = this.mBytesRead)
{
localNetworkEventReporter.dataReceived(str, j, i);
return;
}
}
public void onEOF()
{
reportDataReceived();
this.mEventReporter.responseReadFinished(this.mRequestId);
}
public void onError(IOException paramIOException)
{
reportDataReceived();
this.mEventReporter.responseReadFailed(this.mRequestId, paramIOException.toString());
}
public void onRead(int paramInt)
{
this.mBytesRead += paramInt;
}
public void onReadDecoded(int paramInt)
{
if (this.mDecodedBytesRead == -1) {
this.mDecodedBytesRead = 0;
}
this.mDecodedBytesRead += paramInt;
}
}
/* Location: E:\apk\QQ_91\classes5-dex2jar.jar!\com\facebook\stetho\inspector\network\DefaultResponseHandler.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"1776098770@qq.com"
] | 1776098770@qq.com |
ee59f1120fa81579096cc7aec435bd598bff14a7 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/9/9_f1b56dbd7c1b1c8774f40d47f45c3054ed9f3d64/RubyObjectWrapper/9_f1b56dbd7c1b1c8774f40d47f45c3054ed9f3d64_RubyObjectWrapper_t.java | 202c2c47b4973d5e8b40753ecf454b5f0915caa0 | [] | 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 | 13,889 | java | /**
* Copyright (C) 2008 10gen Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ed.lang.ruby;
import java.lang.ref.WeakReference;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import org.jruby.*;
import org.jruby.internal.runtime.methods.JavaMethod;
import org.jruby.java.proxies.JavaProxy;
import org.jruby.javasupport.JavaUtil;
import org.jruby.parser.ReOptions;
import org.jruby.runtime.*;
import org.jruby.runtime.builtin.*;
import static org.jruby.runtime.Visibility.PUBLIC;
import ed.appserver.JSFileLibrary;
import ed.db.DBCursor;
import ed.db.ObjectId;
import ed.js.*;
import ed.js.engine.Scope;
import ed.js.engine.NativeBridge;
/**
* RubyObjectWrapper acts as a bridge between Ruby objects and Java objects.
*/
@SuppressWarnings("serial")
public abstract class RubyObjectWrapper extends RubyObject {
static final boolean DEBUG = Boolean.getBoolean("DEBUG.RB.WRAP");
static final boolean DEBUG_SEE_EXCEPTIONS = DEBUG || Boolean.getBoolean("DEBUG.RB.EXCEPTIONS");
static final boolean DEBUG_CREATE = DEBUG || Boolean.getBoolean("DEBUG.RB.CREATE");
static final boolean DEBUG_FCALL = DEBUG || Boolean.getBoolean("DEBUG.RB.FCALL");
static final Map<Ruby, Map<Object, WeakReference<IRubyObject>>> _wrappers = new WeakHashMap<Ruby, Map<Object, WeakReference<IRubyObject>>>();
protected final Scope _scope;
protected final Object _obj;
public static IRubyObject toRuby(Scope s, Ruby runtime, Object obj) {
return toRuby(s, runtime, obj, null, null, null);
}
public static IRubyObject toRuby(Scope s, Ruby runtime, Object obj, String name) {
return toRuby(s, runtime, obj, name, null, null);
}
public static IRubyObject toRuby(Scope s, Ruby runtime, Object obj, String name, IRubyObject container) {
return toRuby(s, runtime, obj, name, container, null);
}
/** Given a Java object (JSObject, Number, etc.), return a Ruby object. */
public static IRubyObject toRuby(Scope s, Ruby runtime, Object obj, String name, IRubyObject container, JSObject jsThis) {
if (obj == null)
return runtime.getNil();
if (obj instanceof IRubyObject)
return (IRubyObject)obj;
if (obj instanceof JSString)
return runtime.newString(obj.toString());
if (obj instanceof Boolean)
return ((Boolean)obj).booleanValue() ? runtime.getTrue() : runtime.getFalse();
IRubyObject wrapper = cachedWrapperFor(runtime, obj);
if (wrapper != null) {
if (wrapper instanceof RubyJSObjectWrapper)
((RubyJSObjectWrapper)wrapper).rebuild();
return wrapper;
}
if (obj instanceof JSFunctionWrapper && ((JSFunctionWrapper)obj).getProc().getRuntime() == runtime)
return ((JSFunctionWrapper)obj).getProc();
if (obj instanceof JSObjectWrapper && ((JSObjectWrapper)obj).getRubyObject().getRuntime() == runtime)
return ((JSObjectWrapper)obj).getRubyObject();
if (obj instanceof JSRegex) {
JSRegex regex = (JSRegex)obj;
String flags = regex.getFlags();
int intFlags = 0;
if (flags.indexOf('m') >= 0) intFlags |= ReOptions.RE_OPTION_MULTILINE;
if (flags.indexOf('i') >= 0) intFlags |= ReOptions.RE_OPTION_IGNORECASE;
return RubyRegexp.newRegexp(runtime, regex.getPattern(), intFlags);
}
else if (obj instanceof JSFunction) {
IRubyObject methodOwner = container == null ? runtime.getTopSelf() : container;
wrapper = createRubyMethod(s, runtime, (JSFunction)obj, name, methodOwner.getSingletonClass(), jsThis);
}
else if (obj instanceof JSArray)
wrapper = new RubyJSArrayWrapper(s, runtime, (JSArray)obj);
else if (obj instanceof DBCursor)
wrapper = new RubyDBCursorWrapper(s, runtime, (DBCursor)obj);
else if (obj instanceof BigDecimal)
wrapper = new RubyBigDecimal(runtime, (BigDecimal)obj);
else if (obj instanceof BigInteger)
wrapper = new RubyBignum(runtime, (BigInteger)obj);
else if (obj instanceof ObjectId)
wrapper = new RubyObjectIdWrapper(runtime, (ObjectId)obj);
else if (obj instanceof JSObject)
wrapper = new RubyJSObjectWrapper(s, runtime, (JSObject)obj);
else
wrapper = JavaUtil.convertJavaToUsableRubyObject(runtime, obj);
cacheWrapper(runtime, obj, wrapper);
return wrapper;
}
/**
* Note: does not return cached wrapper or cache the returned wrapper.
* Caller is responsible for doing so if desired. Sometimes it's not,
* which is why this method is separate from (and is called from)
* toRuby().
*/
public static IRubyObject createRubyMethod(Scope s, Ruby runtime, JSFunction func, String name, RubyModule attachTo, JSObject jsThis) {
if (func instanceof JSFileLibrary)
return new RubyJSFileLibraryWrapper(s, runtime, (JSFileLibrary)func, name, attachTo, jsThis);
else
return new RubyJSFunctionWrapper(s, runtime, func, name, attachTo, jsThis);
}
protected static synchronized IRubyObject cachedWrapperFor(Ruby runtime, Object obj) {
Map<Object, WeakReference<IRubyObject>> runtimeWrappers = _wrappers.get(runtime);
if (runtimeWrappers == null)
return null;
WeakReference<IRubyObject> ref = runtimeWrappers.get(obj);
return ref == null ? null : ref.get();
}
protected static synchronized void cacheWrapper(Ruby runtime, Object obj, IRubyObject wrapper) {
Map<Object, WeakReference<IRubyObject>> runtimeWrappers = _wrappers.get(runtime);
if (runtimeWrappers == null) {
runtimeWrappers = new WeakHashMap<Object, WeakReference<IRubyObject>>();
_wrappers.put(runtime, runtimeWrappers);
}
runtimeWrappers.put(obj, new WeakReference<IRubyObject>(wrapper));
}
/** Given a Ruby block, returns a JavaScript object. */
public static JSFunctionWrapper toJS(Scope scope, Ruby runtime, Block block) {
return new JSFunctionWrapper(scope, runtime, block);
}
/** Given a Ruby object, returns a JavaScript object. */
public static Object toJS(final Scope scope, IRubyObject r) {
if (r == null || r.isNil())
return null;
if (r instanceof JSObject)
return r;
if (r instanceof RubyBoolean)
return r.isTrue() ? Boolean.TRUE : Boolean.FALSE;
if (r instanceof RubyString)
return new JSString(((RubyString)r).toString());
if (r instanceof RubyObjectWrapper)
return ((RubyObjectWrapper)r)._obj;
if (r instanceof RubyBignum)
return JavaUtil.convertRubyToJava(r, BigInteger.class);
if (r instanceof RubyBigDecimal)
return ((RubyBigDecimal)r).getValue();
if (r instanceof RubyNumeric)
return JavaUtil.convertRubyToJava(r);
if (r instanceof RubyJSObjectWrapper)
return ((RubyJSObjectWrapper)r).getJSObject();
if (r instanceof RubyJSArrayWrapper)
return ((RubyJSArrayWrapper)r).getJSArray();
if (r instanceof RubyObjectIdWrapper)
return ((RubyObjectIdWrapper)r).getObjectId();
if (r instanceof RubyArray) {
RubyArray ra = (RubyArray)r;
int len = ra.getLength();
JSArray ja = new JSArray(len);
for (int i = 0; i < len; ++i)
ja.setInt(i, toJS(scope, ra.entry(i)));
return ja;
}
if (r instanceof RubyHash) {
RubyHash rh = (RubyHash)r;
final JSObjectBase jobj = new JSObjectBase();
rh.visitAll(new RubyHash.Visitor() {
public void visit(final IRubyObject key, final IRubyObject value) {
jobj.set(key.toString(), toJS(scope, value));
}
});
return jobj;
}
if (r instanceof RubyStruct) {
RubyStruct rs = (RubyStruct)r;
final JSObjectBase jobj = new JSObjectBase();
IRubyObject[] ja = rs.members().toJavaArray();
for (int i = 0; i < ja.length; ++i)
jobj.set(ja[i].toString(), toJS(scope, rs.get(i)));
return jobj;
}
if (r instanceof RubyProc || r instanceof RubyMethod) {
RubyProc p = (r instanceof RubyProc) ? (RubyProc)r : (RubyProc)((RubyMethod)r).to_proc(r.getRuntime().getCurrentContext(), Block.NULL_BLOCK);
Object o = new JSFunctionWrapper(scope, r.getRuntime(), p.getBlock());
cacheWrapper(r.getRuntime(), o, r);
return o;
}
if (r instanceof RubyRegexp) {
RubyRegexp regex = (RubyRegexp)r;
/* Ruby regex.to_s returns "(?i-mx:foobar)", where the first part
* contains the flags. Everything after the minus is a flag that
* is off. */
String options = regex.to_s().toString().substring(2);
options = options.substring(0, options.indexOf(':'));
if (options.indexOf('-') >= 0)
options = options.substring(0, options.indexOf('-'));
return new JSRegex(regex.source().toString(), options);
}
if (r instanceof RubyClass) {
Object o = new JSRubyClassWrapper(scope, (RubyClass)r);
cacheWrapper(r.getRuntime(), o, r);
return o;
}
if (r instanceof JavaProxy)
return ((JavaProxy)r).unwrap();
if (r instanceof RubyObject) {
Object o = new ed.lang.ruby.JSObjectWrapper(scope, (RubyObject)r);
cacheWrapper(r.getRuntime(), o, r);
return o;
}
return JavaUtil.convertRubyToJava(r); // punt
}
public static Object[] toJSFunctionArgs(Scope s, Ruby r, IRubyObject[] args, int offset, Block block) {
boolean haveBlock = block != null && block.isGiven();
Object[] jargs = new Object[args.length - offset + (haveBlock ? 1 : 0)];
for (int i = offset; i < args.length; ++i)
jargs[i-offset] = RubyObjectWrapper.toJS(s, args[i]);
if (haveBlock)
jargs[args.length-offset] = RubyObjectWrapper.toJS(s, r, block);
return jargs;
}
public static void addJavaPublicMethodWrappers(final Scope scope, RubyModule module, final JSObject jsobj, Set<String> namesToIgnore) {
for (final String name : NativeBridge.getPublicMethodNames(jsobj.getClass())) {
if (namesToIgnore.contains(name))
continue;
final JSFunction func = NativeBridge.getNativeFunc(jsobj, name);
module.addMethod(name, new JavaMethod(module, PUBLIC) {
public IRubyObject call(ThreadContext context, IRubyObject recv, RubyModule module, String name, IRubyObject[] args, Block block) {
Ruby runtime = context.getRuntime();
try {
return toRuby(scope, runtime, func.callAndSetThis(scope, jsobj, RubyObjectWrapper.toJSFunctionArgs(scope, runtime, args, 0, block)));
}
catch (Exception e) {
if (DEBUG_SEE_EXCEPTIONS) {
System.err.println("saw exception; going to raise Ruby error after printing the stack trace here");
e.printStackTrace();
}
recv.callMethod(context, "raise", new IRubyObject[] {runtime.newString(e.toString())}, Block.NULL_BLOCK);
return runtime.getNil(); // will never reach
}
}
});
}
}
public static boolean isCallableJSFunction(Object o) {
return (o instanceof JSFunction) && ((JSFunction)o).isCallable();
}
RubyObjectWrapper(Scope s, Ruby runtime, Object obj) {
super(runtime, runtime.getObject());
_scope = s;
_obj = obj;
if (RubyObjectWrapper.DEBUG_CREATE)
System.err.println("creating RubyObjectWrapper around " + (obj == null ? "null" : ("instance of " + obj.getClass().getName())));
}
public Object getObject() { return _obj; }
public IRubyObject toRuby(Object obj) { return toRuby(_scope, getRuntime(), obj); }
public IRubyObject toRuby(Object obj, String name) { return toRuby(_scope, getRuntime(), obj, name); }
public IRubyObject toRuby(Object obj, String name, RubyObjectWrapper container) { return toRuby(_scope, getRuntime(), obj, name, container); }
public JSFunctionWrapper toJS(Block block) { return toJS(_scope, getRuntime(), block); }
public Object toJS(IRubyObject r) { return toJS(_scope, r); }
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
aa84e9a90bda204df1d13ba0148becdfdbc73e79 | 9c68a07cd267144b89dff17443d751d9dabcb5cf | /YambaClient/src/main/java/com/twitter/university/android/yamba/client/TweetActivity.java | 5394bd619751846ab158143202fb1d0fb3392bb6 | [] | no_license | purpleFrog/YambaClient | 218759332e018111386a233c5a5f4d06fb2fe5f5 | 8bf8d18ec7a741527220d3968ed152a49e8e8e17 | refs/heads/master | 2021-01-14T13:44:23.581595 | 2013-11-07T18:11:35 | 2013-11-07T18:11:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 238 | java | package com.twitter.university.android.yamba.client;
public class TweetActivity extends YambaActivity {
public static final String TAG = "ACT_TWEET";
public TweetActivity() {
super(TAG, R.layout.activity_tweet);
}
}
| [
"bmeike@twitter.com"
] | bmeike@twitter.com |
2bec931be6096d1de81e9ef07212ca28a7e16f90 | f6904a4a7b4c17b6ec8af235d847cddbc776cfea | /src/ColumnTypeCluster.java | d287fade149b0b74302e5c8890122c3bebf534ef | [] | no_license | Summer2016TableReading/BigMechanismTableReading | 26e4f19965ec02d195b75037f84dbf538f73db22 | 634bb95e8066cb679f6affcff02e6cb68fe4838a | refs/heads/master | 2021-01-19T01:02:48.012558 | 2016-08-10T17:49:45 | 2016-08-10T17:49:45 | 62,905,136 | 0 | 1 | null | 2016-07-28T17:05:08 | 2016-07-08T17:17:34 | Java | UTF-8 | Java | false | false | 12,364 | java | import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Random;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import extract.ColumnData;
import extract.HTMLTable;
import extract.HTMLTableExtractor;
public class ColumnTypeCluster {
public static void main(String[] args){
File directory = new File("files");
HashMap<String, ArrayList<Double>> vectors = new HashMap<String, ArrayList<Double>>();
int num_tables = 0;
for (File f: directory.listFiles()){
if(f.getName().endsWith(".html")){
try {
Document table = Jsoup.parse(f, null);
ArrayList<String> tableEntries = getEntries(table);
if(tableEntries != null && tableEntries.size() > 0){
for (String entry: tableEntries){
if(entry.length() != 0 && entry.length() < 50){
vectors.put(entry, generateVec(entry, f));
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
num_tables++;
if(num_tables % 500 == 0){
System.out.println(num_tables + " tables processed...");
}
}
}
ArrayList<ArrayList<Double>> means = cluster(vectors, 100);
ArrayList<ArrayList<String>> clusters = buildClosest(vectors, means);
for(int i = 0; i < means.size(); i ++){
String[] words = getClosest(vectors ,means.get(i));
System.out.print("Type " + i + " (" + clusters.get(i).size() + "): ");
for(int j = 0; j < 10 && j < clusters.get(i).size(); j ++){
System.out.print(words[j] + "| ");
}
System.out.println();
}
System.out.println("Starting to cluster headers....");
HashMap<String, ArrayList<Double>> headerVectors = new HashMap<String, ArrayList<Double>>();
HashMap<String, Double> headerHits = new HashMap<String, Double>();
num_tables = 0;
for (File f: directory.listFiles()){
if(f.getName().endsWith(".html")){
HTMLTableExtractor hte = new HTMLTableExtractor();
Collection<HTMLTable> list = hte.parseHTML("files/" + f.getName());
if(list.size() != 0){
HTMLTable table = list.iterator().next();
ColumnData[] cols = table.getColumnData();
for(ColumnData col: cols){
if(col.getHeader() != null){
ArrayList<Double> vec = new ArrayList<Double>();
for(int i = 0; i < clusters.size(); i++){
vec.add(0.0);
}
double totalEntries = 0.0;
for(String s: col.getData()){
if(s != null){
int clusterNum = findCluster(s, clusters);
if (findCluster(s, clusters) != -1){
totalEntries++;
vec.set(clusterNum, vec.get(clusterNum) + 1.0);
}
}
}
if(totalEntries > 0){
for (int i = 0; i < clusters.size(); i++){
vec.set(i, vec.get(i)/totalEntries);
}
if(headerHits.containsKey(col.getHeader())){
double hits = headerHits.get(col.getHeader());
ArrayList<Double> prevVec = headerVectors.get(col.getHeader());
for(int i = 0; i < prevVec.size(); i++){
prevVec.set(i, (prevVec.get(i)*hits + vec.get(i))/(hits + 1));
}
headerHits.put(col.getHeader(),hits + 1);
} else {
headerHits.put(col.getHeader(), 1.0);
headerVectors.put(col.getHeader(), vec);
}
}
}
}
}
num_tables++;
if(num_tables % 500 == 0){
System.out.println(num_tables + " tables processed...");
}
}
}
ArrayList<ArrayList<Double>> headerMeans = cluster(headerVectors, 100);
ArrayList<ArrayList<String>> headerClusters = buildClosest(headerVectors, headerMeans);
for(int i = 0; i < headerMeans.size(); i ++){
String[] words = getClosest(headerVectors ,headerMeans.get(i));
System.out.print("Type " + i + " (" + headerClusters.get(i).size() + "): ");
for(int j = 0; j < 10 && j < headerClusters.get(i).size(); j ++){
System.out.print(words[j] + "| ");
}
System.out.println();
}
File output = new File("columnVectors");
try {
FileOutputStream fos = new FileOutputStream(output);
PrintWriter pw = new PrintWriter(fos);
int counter = 0;
pw.write("Data Types\n");
for (ArrayList<Double> arr: means){
pw.write(counter + ": ");
for (Double d: arr){
pw.write(d + " ");
}
counter++;
pw.write("\n");
}
counter = 0;
pw.write("Column Types\n");
for (ArrayList<Double> arr: headerMeans){
pw.write(counter + ": ");
for (Double d: arr){
pw.write(d + " ");
}
counter++;
pw.write("\n");
}
pw.close();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
private static int findCluster(String query, ArrayList<ArrayList<String>> clusters){
for (int i = 0; i < clusters.size() ;i++){
for(String s: clusters.get(i)){
if(query.equals(s)){
return i;
}
}
}
return -1;
}
//Entry Vector: {length, zeroes, digits, uppercase, lowercase, spaces,
// commas, periods, percentage, special, longest word, number of unique chars}
private static ArrayList<Double> generateVec (String entry, File f){
ArrayList<Double> vec = new ArrayList<Double>();
double longestWord = 0;
vec.add(Math.log(entry.length()) + 0.0);
for (int i = 0; i < 9; i++){
vec.add(0.0);
}
double wordLength = 0;
HashSet<Character> chars = new HashSet<Character>();
for (int i = 0; i < entry.length(); i++){
chars.add(entry.charAt(i));
wordLength++;
if(longestWord < wordLength){
longestWord = wordLength;
}
if(Character.isDigit(entry.charAt(i))){
if(entry.charAt(i) == '0'){
vec.set(1, vec.get(1)+ 1);
} else {
vec.set(2, vec.get(2)+ 1);
}
} else if (Character.isUpperCase(entry.charAt(i))){
vec.set(3, vec.get(3)+ 1);
} else if (Character.isLowerCase(entry.charAt(i))){
vec.set(4, vec.get(4)+ 1);
} else if (Character.isWhitespace(entry.charAt(i))){
wordLength = 0;
vec.set(5, vec.get(5)+ 1);
} else if (entry.charAt(i) == ','){
vec.set(6, vec.get(6)+ 1);
} else if (entry.charAt(i) == '.'){
vec.set(7, vec.get(7)+ 1);
} else if (entry.charAt(i) == '%'){
vec.set(8, vec.get(8)+ 1);
} else {
vec.set(9, vec.get(9)+ 1);
}
}
vec.add(longestWord);
vec.add(chars.size() + 0.0);
return vec;
}
private static ArrayList<String> getEntries(Document doc){
ArrayList<String> documentData = null;
Elements tables = doc.getElementsByTag("table");
if(tables.size() > 0){
Elements header = tables.get(0).getElementsByTag("tbody");
if(header.size() > 0){
Elements rows = header.get(0).getElementsByTag("tr");
for(int i = 1; i < rows.size(); i++){
Elements entries = rows.get(i).getElementsByTag("td");
documentData = separateEntries(entries);
}
}
}
return documentData;
}
private static ArrayList<String> separateEntries(Elements entries){
ArrayList<String> docData = new ArrayList<String>();
for (Element a: entries){
docData.add(a.text());
}
return docData;
}
private static ArrayList<ArrayList<Double>> cluster(HashMap<String,ArrayList<Double>> vectors, int topics){
Random r = new Random();
ArrayList<ArrayList<Double>> means = new ArrayList<ArrayList<Double>>();
ArrayList<ArrayList<Double>> vectorSet = new ArrayList<ArrayList<Double>>(vectors.values());
int size = vectorSet.size();
//Initialize Centroids
int randInd = r.nextInt(size);
ArrayList<Double> initMean = new ArrayList<Double>(vectorSet.get(randInd));
means.add(initMean);
//k-means++ implementation
for(int i = 1; i < topics; i++){
double totalProbability = 0.0;
HashMap<String,Double> distances = new HashMap<String,Double>();
Iterator<String> iter = vectors.keySet().iterator();
while(iter.hasNext()){
String word = iter.next();
double closest = calculateDistance(initMean, vectors.get(word));
for (int j = 1; j < means.size(); j++){
double distance = calculateDistance(means.get(j), vectors.get(word));
if (distance < closest){
closest = distance;
}
}
distances.put(word, closest*closest);
totalProbability += closest*closest;
}
double nextInd = r.nextDouble()*totalProbability;
iter = distances.keySet().iterator();
String nextCentroid = null;
while(nextInd > 0){
nextCentroid = iter.next();
nextInd -= distances.get(nextCentroid);
}
ArrayList<Double> addMean = new ArrayList<Double>(vectors.get(nextCentroid));
means.add(addMean);
}
int vectorSize = vectorSet.get(0).size();
int iterations = 0;
//Cluster
ArrayList<ArrayList<String>> closest = null;
while(iterations < 100){
closest = new ArrayList<ArrayList<String>>();
for (int i = 0; i < topics; i++){
closest.add(new ArrayList<String>());
}
Iterator<String> iter = vectors.keySet().iterator();
while(iter.hasNext()){
String word = iter.next();
ArrayList<Double> vec = vectors.get(word);
double distance = calculateDistance(vec,means.get(0));
int index = 0;
for (int i = 1; i < means.size(); i++){
double newDistance = calculateDistance(vec,means.get(i));
if (distance > newDistance){
distance = newDistance;
index = i;
}
}
closest.get(index).add(word);
}
for (int i = 0; i < topics; i++){
ArrayList<Double> mean = new ArrayList<Double>();
for (int j = 0; j < vectorSize; j++){
mean.add(0.0);
}
for (int j = 0; j < closest.get(i).size(); j++){
for (int k = 0; k < vectorSize; k++){
mean.set(k, mean.get(k) + vectors.get(closest.get(i).get(j)).get(k));
}
}
if(closest.get(i).size() != 0){
for (int j = 0; j < mean.size(); j++){
mean.set(j, mean.get(j)/closest.get(i).size());
}
} else {
mean = means.get(i);
}
means.set(i, mean);
}
iterations++;
if(iterations % 5 == 0){
System.out.println(iterations + " iterations done");
}
}
return means;
}
private static double calculateDistance(ArrayList<Double> a, ArrayList<Double> b){
double dist = 0;
for(int i = 0; i < a.size(); i++){
dist += (a.get(i) - b.get(i))*(a.get(i) - b.get(i));
}
return dist;
}
private static String[] getClosest(HashMap<String,ArrayList<Double>> vectors, ArrayList<Double> vec){
HashMap<String,Double> distances = new HashMap<String,Double>();
Iterator<String> iter = vectors.keySet().iterator();
while(iter.hasNext()){
String word = iter.next();
distances.put(word, calculateDistance(vec, vectors.get(word)));
}
String[] words = new String[vectors.keySet().size()];
iter = vectors.keySet().iterator();
for (int j = 0; j < words.length; j++){
words[j] = iter.next();
}
Arrays.sort(words, new Comparator<String>() {
public int compare(String a, String b) {
if (distances.get(a) > distances.get(b)){
return 1;
} else if (distances.get(a) < distances.get(b)){
return -1;
} else {
return 0;
}
}
});
return words;
}
private static ArrayList<ArrayList<String>> buildClosest(HashMap<String,ArrayList<Double>> vectors, ArrayList<ArrayList<Double>> means){
ArrayList<ArrayList<String>> closest = new ArrayList<ArrayList<String>>();
for (int i = 0; i < means.size(); i++){
closest.add(new ArrayList<String>());
}
Iterator<String> iter = vectors.keySet().iterator();
while (iter.hasNext()) {
String word = iter.next();
double distance = calculateDistance(vectors.get(word), means.get(0));
int index = 0;
for (int i = 1; i < means.size(); i++) {
double newDistance = calculateDistance(vectors.get(word), means.get(i));
if (distance > newDistance) {
distance = newDistance;
index = i;
}
}
closest.get(index).add(word);
}
return closest;
}
}
| [
"hsiaov@BKLTKM1.corp.leidos.com"
] | hsiaov@BKLTKM1.corp.leidos.com |
5a1e885fbfcfe08fe7561c9681fe1f79e4b1f74b | c4384c33dc0baa015800ff68bc1a516751746a82 | /talleres/taller11/codigo_estudiante/java/Test.java | 0fe904efa1d58c2a52fdfb16bfa41aaffe1bd2e5 | [] | no_license | mauriciotoro/ST0245-Eafit | 98a249b58f4f922d7f2bb7900348f121d184ee93 | 82fa0e076d7a614467254b20d41abfc10f5e5cab | refs/heads/master | 2022-07-23T11:02:31.947253 | 2022-07-11T10:33:46 | 2022-07-11T10:33:46 | 93,675,155 | 58 | 138 | null | 2020-03-24T20:21:48 | 2017-06-07T20:08:55 | Rich Text Format | UTF-8 | Java | false | false | 4,790 | java | import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Collections;
/**
* Prueba las implementaciones de DigraphAL y DigraphAM con el grafo del
* documento.
*
* Ejecute esta clase luego de completar las clases DigraphAL y DigraphAM para
* tener una idea de si su implementación está correcta.
*
* @author Camilo Paez, Simón Correa
*/
public class Test {
static final int SIZE = 12;
static HashSet<Pair<Integer, Integer>> edges;
static ArrayList<Pair<Integer, Integer>> caminos;
static int[] sinEntradas = { 0, 1, 3, 4, 5, 6, 7 };
public static void main(String[] args) {
edges = fillEdges();
DigraphAM gMatrix = new DigraphAM(SIZE);
fillGraph(gMatrix);
System.out.println("DigraphAM (Matriz de Adyacencia):");
System.out.println(" getWeight() -> " + convert(testWeight(gMatrix)));
System.out.println(" getSuccesors() -> " + convert(testSuccesors(gMatrix)));
DigraphAL gList = new DigraphAL(SIZE);
fillGraph(gList);
System.out.println("DigraphAL (Listas de Adyacencia):");
System.out.println(" getWeight() -> " + convert(testWeight(gList)));
System.out.println(" getSuccesors() -> " + convert(testSuccesors(gList)));
}
static HashSet<Pair<Integer, Integer>> fillEdges() {
HashSet<Pair<Integer, Integer>> edges = new HashSet<>();
edges.add(Pair.makePair(3, 8));
edges.add(Pair.makePair(3, 10));
edges.add(Pair.makePair(5, 11));
edges.add(Pair.makePair(7, 8));
edges.add(Pair.makePair(7, 11));
edges.add(Pair.makePair(8, 9));
edges.add(Pair.makePair(11, 2));
edges.add(Pair.makePair(11, 9));
edges.add(Pair.makePair(11, 10));
return edges;
}
static boolean fillGraph(Digraph g) {
if (edges == null || g == null)
return false;
for (Pair<Integer, Integer> p : edges)
g.addArc(p.first, p.second, 1);
return true;
}
static boolean testWeight(Digraph g) {
int w;
for (int i = 0; i < SIZE; ++i)
for (int j = 0; j < SIZE; ++j) {
w = g.getWeight(i, j);
if (edges.contains(Pair.makePair(i, j))) {
if (w != 1)
return false;
} else {
if (w != 0)
return false;
}
}
return true;
}
static boolean testSuccesors(Digraph g) {
ArrayList<Integer> sucesores;
for (int i = 0; i < 12; i++) {
sucesores = g.getSuccessors(i);
if (sucesores != null) Collections.sort(sucesores);
switch(i) {
case 3:
if (!sucesores.equals(new ArrayList<Integer>(Arrays.asList(8, 10))))
return false;
break;
case 5:
if (!sucesores.equals(new ArrayList<Integer>(Arrays.asList(11))))
return false;
break;
case 7:
if (!sucesores.equals(new ArrayList<Integer>(Arrays.asList(8, 11))))
return false;
break;
case 8:
if (!sucesores.equals(new ArrayList<Integer>(Arrays.asList(9))))
return false;
break;
case 11:
if (!sucesores.equals(new ArrayList<Integer>(Arrays.asList(2, 9, 10))))
return false;
break;
default:
if (sucesores != null)
return false;
break;
}
}
return true;
}
private static ArrayList<Pair<Integer, Integer>> fillCaminos() {
ArrayList<Pair<Integer, Integer>> caminos = new ArrayList<>();
caminos.add(Pair.makePair(7, 8));
caminos.add(Pair.makePair(7, 11));
caminos.add(Pair.makePair(7, 2));
caminos.add(Pair.makePair(7, 9));
caminos.add(Pair.makePair(7, 10));
caminos.add(Pair.makePair(3, 8));
caminos.add(Pair.makePair(3, 9));
caminos.add(Pair.makePair(3, 10));
caminos.add(Pair.makePair(8, 9));
caminos.add(Pair.makePair(11, 2));
caminos.add(Pair.makePair(11, 9));
caminos.add(Pair.makePair(11, 10));
caminos.add(Pair.makePair(5, 11));
caminos.add(Pair.makePair(5, 2));
caminos.add(Pair.makePair(5, 9));
caminos.add(Pair.makePair(5, 10));
return caminos;
}
static String convert(boolean b) {
return b ? "correcta" : "incorrecta";
}
}
| [
"mauriciotorob@gmail.com"
] | mauriciotorob@gmail.com |
f2e92f126c36c1ffb632461edd179ed4ffbc3b3a | 2a48d50c771f21ea16df27c13e73666b4ef63bc7 | /src/main/java/com/pavelkisliuk/fth/specifier/select/ClientGroupByConditionSelectSpecifier.java | 319f5dab801a38d297bfb4fc8e923cb6e9c6ab9d | [] | no_license | PavelKisliuk/FTH | 5d8225f758bda55865171b44b1829dd8ab453f7e | fbc2b3d643a299afa93620269d54a0e1a8c39da5 | refs/heads/alpha | 2022-11-20T09:10:24.145869 | 2020-02-25T08:40:25 | 2020-02-25T08:40:25 | 192,509,876 | 0 | 1 | null | 2022-11-16T12:24:52 | 2019-06-18T09:34:48 | Java | UTF-8 | Java | false | false | 5,437 | java | /* By Pavel Kisliuk, 24.07.2019
* This is class for education and nothing rights don't reserved.
*/
package com.pavelkisliuk.fth.specifier.select;
import com.pavelkisliuk.fth.exception.FthRepositoryException;
import com.pavelkisliuk.fth.model.FthRefreshCondition;
import com.pavelkisliuk.fth.specifier.FthSelectSpecifier;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
/**
* The {@code ClientGroupByConditionSelectSpecifier} class is {@code FthSelectSpecifier} realization
* for obtainment from ClientPersonalData, ClientPublicData table clientId, firstName, lastName,
* photoPath, exerciseRequest but only if data satisfy specified conditions.
* <p>
*
* @author Kisliuk Pavel Sergeevich
* @since 12.0
*/
public class ClientGroupByConditionSelectSpecifier implements FthSelectSpecifier {
/**
* The {@code SortConditionNameType} class is {@code enum} class for describing sort of data
* from database.
*/
public enum SortConditionNameType {
//sort data by name
NAME(" ORDER BY ClientPersonalData.lastName, ClientPersonalData.firstName"),
//sort data by surname
SURNAME(" ORDER BY ClientPersonalData.lastName, ClientPersonalData.firstName");
private String sortCondition;
SortConditionNameType(String sortCondition) {
this.sortCondition = sortCondition;
}
}
/**
* The {@code SortConditionNameType} class is {@code enum} class for describing conditions of data
* which can be selected from database.
*/
public enum SortConditionQualityType {
//return client's with expired season's
EXPIRED(" AND (ClientPublicData.expiredDay < " + new Date().getTime() +
" OR ClientPublicData.restVisitation = 0)"),
//return client's with actual season's
ACTUAL(" AND (ClientPublicData.expiredDay >= " + new Date().getTime() +
" AND (ClientPublicData.restVisitation > 0 OR ClientPublicData.restVisitation = -1))"),
//return client's who made request to exercise
REQUESTED(" AND ClientPublicData.exerciseRequest = true"),
//return all client's
EACH_AND_EVERY("");
private String chooseCondition;
SortConditionQualityType(String chooseCondition) {
this.chooseCondition = chooseCondition;
}
}
/**
* Select request to database.
*/
private static final String REQUEST = "SELECT " +
"ClientPersonalData.clientId, " +
"ClientPersonalData.firstName, " +
"ClientPersonalData.lastName, " +
"ClientPersonalData.photoPath, " +
"ClientPublicData.exerciseRequest " +
"FROM ClientPersonalData INNER JOIN ClientPublicData " +
"ON ClientPersonalData.clientId = ClientPublicData.clientId " +
"WHERE trainerId = ?";
/**
* Data for creation of request to database, which contain special condition's.
*/
private FthRefreshCondition refreshCondition;
/**
* Constructor for fields initialization.
* <p>
*
* @param refreshCondition for {@code refreshCondition} initialization.
*/
public ClientGroupByConditionSelectSpecifier(FthRefreshCondition refreshCondition) {
this.refreshCondition = refreshCondition;
}
/**
* Return factory for {@code FthPersonalData} creation.
* <p>
*
* @return factory for {@code FthPersonalData} creation.
*/
@Override
public CreatorClientPersonalData createFactory() {
return new CreatorClientPersonalData();
}
/**
* Paste metadata in {@param statement} and return it.
* <p>
*
* @param statement for pasting metadata into.
* @return {@param statement}.
*/
@Override
public PreparedStatement pasteMeta(PreparedStatement statement) throws FthRepositoryException {
try {
statement.setLong(1, refreshCondition.getTrainerId());
} catch (SQLException e) {
throw new FthRepositoryException(
"SQLException in ClientGroupByConditionSelectSpecifier -> pasteMeta(PreparedStatement).", e);
}
return statement;
}
/**
* Return {@code REQUEST}.
* <p>
*
* @return {@code REQUEST}.
*/
@Override
public String deriveSequelRequest() {
return improveRequest();
}
/**
* Add to {@code REQUEST} necessary additional element's.
* <p>
*
* @return improved request to database.
*/
private String improveRequest() {
StringBuilder request = new StringBuilder(REQUEST);
switch (SortConditionQualityType.valueOf(refreshCondition.getConditionQuality())) {
case EXPIRED:
request.append(SortConditionQualityType.EXPIRED.chooseCondition);
break;
case ACTUAL:
request.append(SortConditionQualityType.ACTUAL.chooseCondition);
break;
case REQUESTED:
request.append(SortConditionQualityType.REQUESTED.chooseCondition);
break;
case EACH_AND_EVERY:
break;
default:
throw new EnumConstantNotPresentException(SortConditionQualityType.class,
"Not correct enum element in SortConditionQualityType" +
"ClientGroupByConditionSelectSpecifier -> " +
"operateTransaction(List<TransactionDescriber>).");
}
switch (SortConditionNameType.valueOf(refreshCondition.getConditionName())) {
case NAME:
request.append(SortConditionNameType.NAME.sortCondition);
break;
case SURNAME:
request.append(SortConditionNameType.SURNAME.sortCondition);
break;
default:
throw new EnumConstantNotPresentException(SortConditionNameType.class,
"Not correct enum element in SortConditionNameType" +
"ClientGroupByConditionSelectSpecifier -> " +
"operateTransaction(List<TransactionDescriber>).");
}
return request.toString();
}
} | [
"pavelsergeevichkisliuk2015@mail.ru"
] | pavelsergeevichkisliuk2015@mail.ru |
b7adffb75911e1e7dd1fe283bdf908c7d0466baf | d22e2388a623dd0b5477382b6ce6a233510fd78c | /Web/HaiChat/src/main/java/net/web/haichat/push/service/UserService.java | 6675c4783df50488473cfcc75f513942c1ba1783 | [] | no_license | gaozewen/HaiChat | 581ddd35abcacdbafc8bf098c94253ed040d971c | ff07a9b6bdc11094a8a9476d40de671e88e7064c | refs/heads/master | 2020-04-12T10:36:18.416790 | 2018-12-27T13:35:03 | 2018-12-27T13:35:03 | 162,434,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,070 | java | package net.web.haichat.push.service;
import com.google.common.base.Strings;
import net.web.haichat.push.bean.api.base.ResponseModel;
import net.web.haichat.push.bean.api.user.UpdateInfoModel;
import net.web.haichat.push.bean.card.UserCard;
import net.web.haichat.push.bean.db.User;
import net.web.haichat.push.factory.UserFactory;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户信息处理的 Service
*/
@Path("/user")
public class UserService extends BaseService {
// 修改 用户自己 的 信息
@PUT
@Path("/updateInfo")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public ResponseModel<UserCard> update(UpdateInfoModel model) {
if (!UpdateInfoModel.check(model)) return ResponseModel.buildParameterError();
User user = getSelf(); // 获取 自己的 用户信息
user = model.updateToUser(user); // 更新用户信息
user = UserFactory.update(user); // 同步到数据库
return ResponseModel.buildOk(new UserCard(user, true)); // 自己肯定已经关注自己
}
// 拉取联系人
@GET
@Path("/contact")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public ResponseModel<List<UserCard>> contact() {
User self = getSelf();
// 通过数据库 获取 我的联系人
List<User> contacts = UserFactory.contacts(self);
List<UserCard> userCards = contacts.stream()
.map(user -> new UserCard(user, true)) // map 相当于转置操作
.collect(Collectors.toList());
return ResponseModel.buildOk(userCards);
}
// 关注
// 简化:关注操作其实是双方同时关注
@PUT // 修改使用 put
@Path("/follow/{followId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public ResponseModel<UserCard> follow(@PathParam("followId") String followId) {
if (Strings.isNullOrEmpty(followId)) return ResponseModel.buildParameterError();
User self = getSelf();
// 自己不能关注自己
if (self.getId().equals(followId)) return ResponseModel.buildParameterError();
// 将要关注的人
User target = UserFactory.findById(followId);
if (target == null) return ResponseModel.buildNotFoundUserError(null);
// 执行数据库 关注操作
target = UserFactory.follow(self, target, null); // 备注默认没有,右面可以扩展
// 关注失败,返回服务器异常
if (target == null) return ResponseModel.buildServiceError();
// TODO: 通知 target 我关注了他
// 返回 target 的 信息
return ResponseModel.buildOk(new UserCard(target, true));
}
// 获取 某个 用户的信息
@GET
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public ResponseModel<UserCard> getUserInfo(@PathParam("id") String userId) {
if (Strings.isNullOrEmpty(userId)) return ResponseModel.buildParameterError();
User self = getSelf();
// 若 id 是登录的用户,不必查询数据库
if (self.getId().equals(userId)) return ResponseModel.buildOk(new UserCard(self, true));
User target = UserFactory.findById(userId);
if (target == null) return ResponseModel.buildNotFoundUserError(null);
// 查询 self 是否已关注 target (有关注记录,则表示已关注)
boolean isFollow = UserFactory.getRelationship(self, target) != null;
// 返回 target 用户信息,并 返回 target 与 self 的关系
return ResponseModel.buildOk(new UserCard(target, isFollow));
}
// 模糊搜索用户
@GET
@Path("/search/{name:(.*)?}") // 名字为任意字符,可以为空
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public ResponseModel<List<UserCard>> search(
@DefaultValue("") @PathParam("name") String name) {
User self = getSelf();
// 得到 查询结果
List<User> searchUsers = UserFactory.search(name);
// 我 的 联系人 列表
List<User> contacts = UserFactory.contacts(self);
// 把查询到的用户 封装为 UserCard
List<UserCard> userCards = searchUsers.stream()
.map(curUser -> {
// 判断 我 是否关注 当前用户 (或) 当前用户就是我自己
boolean isFollow = curUser.getId().equals(self.getId())
|| contacts.stream().anyMatch(contact -> contact.getId().equals(curUser.getId()));
return new UserCard(curUser,isFollow);
})
.collect(Collectors.toList());
return ResponseModel.buildOk(userCards);
}
}
| [
"1440651163@qq.com"
] | 1440651163@qq.com |
f24fcb88f3e9631308364b266905958b89fe4b4a | dd5d65a8ba6050cce852099897c095c2f7bc2e78 | /src/main/java/springblack/identity/users/UserResetRequest.java | bcf7454487653c47232b877984b91d547e5b32de | [] | no_license | spring-black/identity | 2df773f8d754ba2ae872964c1c71a65d23ed862e | bff9b64f5398ddc592a8f2569f374ff6d36c5efa | refs/heads/master | 2020-09-15T19:12:26.643127 | 2019-11-23T09:31:36 | 2019-11-23T09:31:36 | 223,536,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 125 | java | package springblack.identity.users;
import lombok.Data;
@Data
public class UserResetRequest {
public String email;
}
| [
"matthew@matthewdavis.io"
] | matthew@matthewdavis.io |
f6579b14a6a614dbba28fef800a98664ad8252e2 | d14b4cdc36edcf163e41182b817263f0310c1eb3 | /app/src/main/java/com/yann/asmtest/MainActivity.java | 334d10806128f1afb00d4d9542b6532330ec03e3 | [] | no_license | yannqiu/AsmTest | cb1df9c38206e75ba10f3b8780f42af85e93cc12 | 6280e2fa2ee8203eb474428cbc724d9667608f02 | refs/heads/main | 2023-04-01T05:23:36.530769 | 2021-04-23T09:49:07 | 2021-04-23T09:49:07 | 360,835,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package com.yann.asmtest;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.test).setOnClickListener(view -> {
Intent intent = new Intent(this, SecondActivity.class);
startActivity(intent);
});
}
} | [
"qiuyang@qingting.fm"
] | qiuyang@qingting.fm |
33827edf350262a0181ce6dc44c8bbf8326e448d | 12f85e8eb46404b90713214446f32680616d5ef5 | /src/main/java/com/jichuangsi/mes/entity/PPDetourProducts.java | 50a895e4d6d07c5b9aa1a1f35aeb7806cec32336 | [] | no_license | jichuangsi/mes_backend | 63930839661da7ce0b23815472107d22aaa8fecd | 5bad5207380695d12ffa3c4afe55c089ad604ac2 | refs/heads/main | 2023-03-10T00:16:52.897013 | 2020-12-30T03:21:24 | 2020-12-30T03:21:24 | 317,448,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 795 | java | package com.jichuangsi.mes.entity;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
//改绕本班产物
@Entity
@Table(name = "pp_detourProducts")
public class PPDetourProducts {
@Id
@GeneratedValue(strategy =GenerationType.IDENTITY)
private Integer id;//产物ID
private Integer PPPId;//生产id
private Date createTime;//生产时间
private Integer bobbinId;//线轴规格id
private BigDecimal wireDiameterUm;//线径um
private BigDecimal lengthM;//长度m/轴
private BigDecimal grossWeight ;//毛重g
private BigDecimal netWeightg;//净重g
private Integer amount;//数量
private Integer totalLength;//总长度
private BigDecimal netWeightgSum;//总净重g
private Integer deleteNo;//删除否
}
| [
"1604532521@qq.com"
] | 1604532521@qq.com |
086a7085b64e0d97d5312d3034a473d5ca79383a | 75473a8ce7a1d904005d59f162401dad5ae70340 | /src/main/java/com/sacompany/bookstore/BookstoreApplication.java | e4037bd8ddc67bdc6c5794db97f9bc5107edcba0 | [] | no_license | sealexsandro/bookstore-API | 8d3c1081198b0636c40feafcea1d6b5ea0cc413b | 9f8eb702c56f8a5274b4f29a93b5bc33ce431c16 | refs/heads/main | 2023-03-30T12:14:19.146264 | 2021-03-30T16:46:05 | 2021-03-30T16:46:05 | 340,990,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | package com.sacompany.bookstore;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BookstoreApplication {
public static void main(String[] args) {
SpringApplication.run(BookstoreApplication.class, args);
}
}
| [
"sealexsandro@gmail.com"
] | sealexsandro@gmail.com |
f268560a2cad19d00ab8c30dc6d676e2030b3337 | 6fb5fc73b3752fd83d1f77611ebc752e4745ce76 | /app/src/main/java/com/appledroideirl/appuntomarcafreelancer/data/datasource/cloud/model/user/response/WsResponseAgregarDateAvailable.java | 2901d83370b54d0f04879333047e835469020a5e | [] | no_license | PierreCrow/RetoPractico | 99227aa4cf499233e982e29ac48514ca0c18a53e | 18ac623126fda2e5835ed3da7c693c917ba9a08d | refs/heads/master | 2023-03-14T05:31:19.824183 | 2021-03-03T18:35:34 | 2021-03-03T18:35:34 | 347,413,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 870 | java | package com.appledroideirl.appuntomarcafreelancer.data.datasource.cloud.model.user.response;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class WsResponseAgregarDateAvailable {
@SerializedName("entity")
@Expose
private int result;
@SerializedName("message")
@Expose
private String message = null;
@SerializedName("status")
@Expose
private int status;
public int getResult() {
return result;
}
public void setResult(int result) {
this.result = result;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
| [
"pierrecrow@gmail.com"
] | pierrecrow@gmail.com |
facb8dd8032cbc08603dba751e5cb04bd5aa0a43 | c5ce0a8e014f373a2c701e7084e7f7e40c428225 | /s80mybatis07/src/main/java/com/inter/Test3.java | 9c1d4f5c3bcb52bb7b1b4b697e6544ba060e5b86 | [] | no_license | mrhu0126/sunjob | 625ff3010ef4914250da3f5a237fa2616217248c | b7b5f8acb4955a462151ba73a2cf89632d72bc72 | refs/heads/master | 2022-06-25T12:45:42.465777 | 2020-10-18T08:54:11 | 2020-10-18T08:54:11 | 237,896,285 | 0 | 0 | null | 2022-06-21T02:44:05 | 2020-02-03T06:02:25 | Java | UTF-8 | Java | false | false | 247 | java | package com.inter;
import com.pojo.Dep;
import com.service.DepService;
public class Test3 {
public static void main(String[] args) {
DepService depService = new DepService();
depService.add(new Dep(5 , "国防部"));
}
}
| [
"463310143@qq.com"
] | 463310143@qq.com |
3dd5b323a31897b06e83ec0ab40c3b473fe498e7 | b5a05248b31bfbb4e4691985ab9e0557142db894 | /src/main/java/Test/Frame/Frame2.java | 3e4e4095246b997979b2fd8bbabc9f65be2abc61 | [] | no_license | kikukk/MyJavaSpace | a5bba057acabd33d6923e03827029ba9b4463778 | f3c17e4825e3097e45905aeacd591dfd59f0c9e0 | refs/heads/master | 2023-02-08T17:28:22.440916 | 2020-12-25T11:11:38 | 2020-12-25T11:11:38 | 320,456,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,034 | java | package Test.Frame;
import javax.swing.SwingUtilities;
import javax.swing.JPanel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.Random;
import java.util.Scanner;
import javax.swing.JFrame;
import javax.swing.JButton;
public class Frame2 extends JFrame implements ActionListener, WindowListener {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton jButton = null;
int cirnum = 0,r1 = 0,r2 = 0;
@Override
public void actionPerformed(ActionEvent arg0) {
this.setVisible(false);
}
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(0, 0, 105, 39));
jButton.setText("回到主窗体");
jButton.addActionListener(this);
}
return jButton;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// Frame2 thisClass = new Frame2();
// thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// thisClass.setVisible(true);
}
});
}
public Frame2(int counts,int low,int high) {
super();
cirnum = counts;
r1 = low;
r2 = high;
initialize();
}
private void initialize() {
this.setContentPane(getJContentPane());
this.addWindowListener(this);
//关闭操作
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
//设置窗体大小
this.setSize(1000, 1000);
//居中
this.setLocationRelativeTo(null);
//设置窗体标题
this.setTitle("随机圆");
//显示 设置大小
this.setVisible(true);
}
//画图对象
@Override
public void paint(Graphics g)
{
Random rand = new Random();
Scanner in = new Scanner(System.in);
//名称 横位置 纵位置
g.drawString("Circle ", 20, 20);
for (int i = 0; i < cirnum; i++)
{
//设置圆的随机生成时间
int seconds = rand.nextInt(2000);
// try {
// Thread.sleep((long) (seconds));
// }catch (InterruptedException ie) {
// Thread.currentThread().interrupt();
// }
//设置圆的随机生成位置
//圆心横向位置
int x0 =rand.nextInt(getSize().width + 1 - r2);
//圆心纵向位置
int y0 =rand.nextInt(getSize().height + 1 - r2);
//r将被赋值为一个 r1 和 r2 范围内的随机数
int r = rand.nextInt(r2 - r1 + 1) + r1;
//随机颜色
g.setColor(getRamdomColor());
//画圆
g.drawOval(x0 - r, y0 - r, r * 2, r * 2);
}
}
//随机颜色
Color getRamdomColor()
{
return new Color(
(int)(Math.random()*255),
(int)(Math.random()*255),
(int)(Math.random()*255)
);
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton(), null);
}
return jContentPane;
}
@Override
public void windowActivated(WindowEvent arg0) {
}
@Override
public void windowClosed(WindowEvent arg0) {
}
@Override
public void windowClosing(WindowEvent arg0) {
}
@Override
public void windowDeactivated(WindowEvent arg0) {
}
@Override
public void windowDeiconified(WindowEvent arg0) {
}
@Override
public void windowIconified(WindowEvent arg0) {
}
@Override
public void windowOpened(WindowEvent arg0) {
}
} | [
"45449473+JQ084@users.noreply.github.com"
] | 45449473+JQ084@users.noreply.github.com |
cf9558ee92d466044f016a8ac1489fb80e39134d | 391e3848100ef87ee37b86163132ada80b915d69 | /help-center-web/src/main/java/com/jd/help/customer/web/vo/FormVo.java | 961422c6fca240b38e994e935061deaed7711955 | [] | no_license | H6yV7Um/pop.hc.static | 5f12e7467bdea8ffff944d3e3b317626dff52b04 | 53cf081e4dff3e8a9d0317961ae861e4c3c839c9 | refs/heads/master | 2020-03-18T03:21:26.782646 | 2018-05-21T07:45:16 | 2018-05-21T07:45:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | package com.jd.help.customer.web.vo;
import com.jd.pop.form.api.open.dto.FormDTO;
import com.jd.pop.form.api.open.dto.FormElementDTO;
import java.io.Serializable;
import java.util.List;
/**
* Created by lipengfei5 on 2017/9/27.
*/
public class FormVo implements Serializable{
private Form form;
private List<FormElement> formElementList;
public Form getForm() {
return form;
}
public void setForm(Form form) {
this.form = form;
}
public List<FormElement> getFormElementList() {
return formElementList;
}
public void setFormElementList(List<FormElement> formElementList) {
this.formElementList = formElementList;
}
}
| [
"18234007040@163.com"
] | 18234007040@163.com |
aed7e995b004aaf3973da9b27242fb1463c8b048 | 34cb6bf1e1e53e3a910541fae2733c628f0cea09 | /News/app/src/test/java/com/example/shubham/news/utils/DateUtilsTest.java | 64a9f1a87bd8f6a708e258ab8d1d3082080fb513 | [] | no_license | shubhamagarwal3010/Android-Workshop | 373d41ab2c1fdd3c800e7d4d2b44c2a056ac741d | 2156d0392feab9e31863e8b3e4591e1a0dc19b18 | refs/heads/master | 2020-03-17T13:04:08.739062 | 2018-05-29T19:48:01 | 2018-05-29T19:48:01 | 133,615,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,451 | java | package com.example.shubham.news.utils;
import com.google.firebase.crash.FirebaseCrash;
import static org.junit.Assert.*;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Matchers;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.text.ParseException;
@RunWith(PowerMockRunner.class)
@PrepareForTest({FirebaseCrash.class})
public class DateUtilsTest {
String correctInputDate1 = "2016-07-25T09:56:27Z";
String correctOutputDate1 = "Mon, 25 Jul 2016 09:56";
String incorrectInputDate1 = "2016-07-25T09";
@Test
public void formatNewsApiDate_correctDate_outputsCorrectDate() {
String outputDate = DateUtils.formatNewsApiDate(correctInputDate1);
assertEquals(outputDate, correctOutputDate1);
}
@Test
public void formatNewsApiDate_nullInput_outputsCorrectDate() {
String outputDate = DateUtils.formatNewsApiDate(null);
assertEquals(outputDate, null);
}
@Test
public void formatNewsApiDate_incorrectInput_returnsSame() {
PowerMockito.mockStatic(FirebaseCrash.class);
String outputDate = DateUtils.formatNewsApiDate(incorrectInputDate1);
assertEquals(outputDate, incorrectInputDate1);
PowerMockito.verifyStatic();
FirebaseCrash.report(Matchers.isA(ParseException.class));
}
}
| [
"shubhamagarwal3010@gmail.com"
] | shubhamagarwal3010@gmail.com |
aa21058d4e7e945f9544f0d325685e5a8cf5dd28 | 9f8fe99b172f89a27d998415cf5ced89946eb89f | /CrackingTheCodingInterview/DataStructures/src/chapter1/Q1_5.java | d1a3beaa0a25826a7dee156ac3322ce0add4bdf5 | [] | no_license | trishae/coding-practices | b5061eb81699fc35b60c880c2aaaf14357927853 | 7118064c10a5903fe48b6842f4ede6674e773d22 | refs/heads/master | 2021-10-16T15:19:33.238730 | 2019-02-11T22:45:29 | 2019-02-11T22:45:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package chapter1;
public class Q1_5 {
public static void main(String[] args) {
String S = "aaaabbbbbbbbeejjseessss";
System.out.println(findCount(S));
}
public static String findCount(String originalString) {
String newString = "";
int count = 1;
// iterate through length of string
for (int i = 0; i < originalString.length()-1; i++) {
// print character if first letter
if (count == 1)
newString = newString + originalString.charAt(i);
// if character is repeated, start counting; else print number of repetitions and restart
if (originalString.charAt(i) == originalString.charAt(i+1)) {
count++;
} else if (originalString.charAt(i) != originalString.charAt(i+1)) {
newString = newString + Integer.toString(count);
count = 1;
}
// check if final character
if (i == originalString.length()-2)
newString = newString + Integer.toString(count);
}
return newString;
}
}
| [
"piechual@gmail.com"
] | piechual@gmail.com |
fd38c12b91bdd1efacd70cb82ef11e5e7a31ef24 | 29a64a75109de7956fa334523ecac01809ac6a42 | /src/main/java/fxlauncher/LibraryFile.java | ead29a7f012accd72e9b4a0d157ccad4a70dc264 | [
"Apache-2.0"
] | permissive | xexes/fxlauncher | 23319815ffa42db32de174135ac1a2d18e3a387c | f859cd689841b095895278671df2e29e2823b296 | refs/heads/master | 2021-01-17T20:45:47.763358 | 2016-02-15T06:09:24 | 2016-02-15T06:09:24 | 51,747,856 | 1 | 0 | null | 2016-02-15T10:23:19 | 2016-02-15T10:23:19 | null | UTF-8 | Java | false | false | 2,102 | java | package fxlauncher;
import javax.xml.bind.annotation.XmlAttribute;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.zip.Adler32;
public class LibraryFile {
@XmlAttribute
String file;
@XmlAttribute
Long checksum;
@XmlAttribute
Long size;
public boolean needsUpdate() {
Path path = Paths.get(file);
try {
return !Files.exists(path) || Files.size(path) != size || checksum(path) != checksum;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public LibraryFile() {
}
public LibraryFile(Path basepath, Path file) throws IOException {
this.file = basepath.relativize(file).toString();
this.size = Files.size(file);
this.checksum = checksum(file);
}
public URL toURL() {
try {
return Paths.get(file).toFile().toURI().toURL();
} catch (MalformedURLException whaat) {
throw new RuntimeException(whaat);
}
}
public static long checksum(Path path) throws IOException {
try (InputStream input = Files.newInputStream(path)) {
Adler32 checksum = new Adler32();
byte[] buf = new byte[16384];
int read;
while ((read = input.read(buf)) > -1)
checksum.update(buf, 0, read);
return checksum.getValue();
}
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LibraryFile that = (LibraryFile) o;
if (!file.equals(that.file)) return false;
if (!checksum.equals(that.checksum)) return false;
return size.equals(that.size);
}
public int hashCode() {
int result = file.hashCode();
result = 31 * result + checksum.hashCode();
result = 31 * result + size.hashCode();
return result;
}
}
| [
"es@syse.no"
] | es@syse.no |
b59cd208af57da17069781f472f6262e1dffe6cd | 02f8d68cd3327d1375d4a61d1a4941304fc5a76f | /Control statements/enhancedfor.java | 51cdec4bdb35c17e4db7047449ec7e48e9add6b8 | [] | no_license | PrasannaSM/Java | 991aa8af1b8e90a61c3fac7db369463bb5382ddb | b9d15a92c7cf14747a5eb1d0545606460c6518bc | refs/heads/master | 2021-01-20T09:14:57.793804 | 2017-05-05T05:38:46 | 2017-05-05T05:38:46 | 90,229,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 244 | java | import java.util.*;
class enhancedfor
{
public static void main(String args[])
{
String b[]=new String[5];
Scanner obj=new Scanner(System.in);
for(int i=0;i<5;i++)
b[i]=obj.nextLine();
for(String c:b)
System.out.println(c);
}
} | [
"prasanna9a9@gmail.com"
] | prasanna9a9@gmail.com |
f3d86c6137cb0a2b836ccb4d62dd90c0ec0aafe8 | 38a3a2e4a908fbaca7f80cce0677784f75856399 | /src/main/java/com/weblegit/urlshortner/ShortUrl.java | 8a159c3662051031fe7b93e653a5129ba288d5c1 | [
"Apache-2.0"
] | permissive | weblegit/urlshortner | adcbe81362f04d9be729a873b1fa7aeec2208d1e | 6475784c78f09bdc9d9e0a0fd47439d53482e4e6 | refs/heads/master | 2021-05-07T04:52:54.714047 | 2017-11-20T16:00:31 | 2017-11-20T16:00:31 | 111,338,900 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package com.weblegit.urlshortner;
import java.io.Serializable;
public class ShortUrl implements Serializable {
private static final long serialVersionUID = 3230219612676759605L;
public ShortUrl(String url, String shortCode) {
this.url = url;
this.shortCode = shortCode;
}
private String url;
private String shortCode;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getShortCode() {
return shortCode;
}
public void setShortCode(String shortCode) {
this.shortCode = shortCode;
}
}
| [
"sandeep@weblegit.com"
] | sandeep@weblegit.com |
f911c03b635a98923a25f4d85a5bae53dca7bed2 | 72eca1cb4a23183075db73bf56ed332183e25c35 | /src/service/MakeModel.java | e0db7d670219b7e5e1402e2c3ba0d783a38ea6d6 | [] | no_license | archwu/INFO5100-Jan2020-Project | 37979b001bec07de120d38ae1328cdea5d45dd1e | 4ad29d3cf7f4f67e2953117ff6e84ace94c0ac6b | refs/heads/master | 2021-05-18T04:11:45.437905 | 2020-04-24T22:13:24 | 2020-04-24T22:13:24 | 251,100,608 | 2 | 0 | null | 2020-04-24T22:29:10 | 2020-03-29T18:13:36 | Java | UTF-8 | Java | false | false | 780 | java | /*
Going to be obsolete, replaced by MakeModelVer2
*/
package service;
import java.util.ArrayList;
import java.util.Collection;
public class MakeModel {
String make;
Collection<String> models;
public MakeModel() {
}
public MakeModel(String make) {
this.make = make;
models = new ArrayList<>();
}
public MakeModel(String make, Collection<String> models) {
this.make = make;
this.models = models;
}
public String getMake() {
return make;
}
public void setMake(String make) {
this.make = make;
}
public Collection<String> getModels() {
return models;
}
public void setModels(Collection<String> models) {
this.models = models;
}
public void addModelToModels(String model) {
models.add(model);
}
}
| [
"archwu0817@gmail.com"
] | archwu0817@gmail.com |
166463b624d3fdfbf12f46c5c2d64adf3b6e952e | fd769723c373436618e3be6392cbdcbd4290d94c | /lib/src/us/kbase/cdmientityapi/FieldsTreeAttribute.java | 56f37e69e3f0ab67213b94ff9b8d0879aa76c415 | [
"MIT"
] | permissive | kbaseIncubator/trees2 | 20b239abebed1f1b52026ea9bea467365b7afee9 | f3eaf4f7f70ee5afa6fa77db839b7ce61a57c357 | refs/heads/master | 2020-12-07T17:11:08.301716 | 2016-08-25T23:39:07 | 2016-08-25T23:39:07 | 34,871,697 | 0 | 1 | null | 2016-08-25T23:39:07 | 2015-04-30T19:08:55 | HTML | UTF-8 | Java | false | false | 1,465 | java |
package us.kbase.cdmientityapi;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
* <p>Original spec-file type: fields_TreeAttribute</p>
*
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("com.googlecode.jsonschema2pojo")
@JsonPropertyOrder({
"id"
})
public class FieldsTreeAttribute {
@JsonProperty("id")
private String id;
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
@JsonProperty("id")
public String getId() {
return id;
}
@JsonProperty("id")
public void setId(String id) {
this.id = id;
}
public FieldsTreeAttribute withId(String id) {
this.id = id;
return this;
}
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
@JsonAnySetter
public void setAdditionalProperties(String name, Object value) {
this.additionalProperties.put(name, value);
}
@Override
public String toString() {
return ((((("FieldsTreeAttribute"+" [id=")+ id)+", additionalProperties=")+ additionalProperties)+"]");
}
}
| [
"mwsneddon@lbl.gov"
] | mwsneddon@lbl.gov |
c3db379c9a080e18bdbffeff9935fae2ceced911 | 0b85aeabc9849bda1a7185beee5931b994258d51 | /problems/src/main/java/problems/T1.java | 59896319be7d5a3c8509ac9b2f46c43e7c9c6a52 | [] | no_license | skylazart/crackingcodinginterview | b843f665fab661462437882f3e1ad3d260d5d12b | 2ecd7095f61d9f3efff5b8e8b66826056d2737f2 | refs/heads/master | 2020-01-23T21:47:37.855732 | 2017-03-11T14:46:13 | 2017-03-11T14:46:13 | 74,676,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | package problems;
/**
* Created by fsantos on 1/6/17.
*/
public class T1 {
public static IntSumPair findSum(int[] arr, int N) {
for (int i = 0; i < arr.length; i++) {
for (int j = i + 1; j < arr.length; j++) {
if (arr[i] + arr[j] == N)
return new IntSumPair(i, j);
}
}
return new IntSumPair(-1, -1);
}
private static class IntSumPair {
private int a;
private int b;
public IntSumPair(int a, int b) {
this.a = a;
this.b = b;
}
@Override
public String toString() {
return "[a: " + a + " b:" + b + "]";
}
}
public static void main(String[] args) {
System.out.println(findSum(new int[]{1, 2, 3, 4, -1}, 0));
}
}
| [
"skylazart@gmail.com"
] | skylazart@gmail.com |
66a44e83ec894da0293f89aeab5cee75d0104805 | 913a08bdea1fe5d81399b0c0c0040e8bb7815edf | /superwechat/src/cn/ucai/superwechat/ui/ContactListFragment.java | 8c372191bffee3173e42c069153d9aafb62a0f3f | [
"Apache-2.0"
] | permissive | Largeli/superwechat201610 | 5c989363052fe11a27e699eb7e885c423d509c85 | ebda869f59dd499d64fb632d91dc92f88923c4c7 | refs/heads/master | 2021-01-13T04:53:56.122596 | 2017-02-20T11:16:21 | 2017-02-20T11:16:21 | 81,162,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,103 | java | /**
* Copyright (C) 2016 Hyphenate Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ucai.superwechat.ui;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Intent;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Toast;
import com.hyphenate.chat.EMClient;
import com.hyphenate.easeui.domain.User;
import com.hyphenate.easeui.ui.EaseContactListFragment;
import com.hyphenate.util.EMLog;
import com.hyphenate.util.NetUtils;
import java.util.Hashtable;
import java.util.Map;
import cn.ucai.superwechat.Constant;
import cn.ucai.superwechat.R;
import cn.ucai.superwechat.SuperWeChatHelper;
import cn.ucai.superwechat.SuperWeChatHelper.DataSyncListener;
import cn.ucai.superwechat.db.InviteMessgeDao;
import cn.ucai.superwechat.db.UserDao;
import cn.ucai.superwechat.domain.Result;
import cn.ucai.superwechat.net.NetDao;
import cn.ucai.superwechat.net.OnCompleteListener;
import cn.ucai.superwechat.utils.MFGT;
import cn.ucai.superwechat.utils.ResultUtils;
import cn.ucai.superwechat.widget.ContactItemView;
/**
* contact list
*
*/
public class ContactListFragment extends EaseContactListFragment {
private static final String TAG = ContactListFragment.class.getSimpleName();
private ContactSyncListener contactSyncListener;
private BlackListSyncListener blackListSyncListener;
private ContactInfoSyncListener contactInfoSyncListener;
private View loadingView;
private ContactItemView applicationItem;
private InviteMessgeDao inviteMessgeDao;
@SuppressLint("InflateParams")
@Override
protected void initView() {
super.initView();
@SuppressLint("InflateParams") View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.em_contacts_header, null);
HeaderItemClickListener clickListener = new HeaderItemClickListener();
applicationItem = (ContactItemView) headerView.findViewById(R.id.application_item);
applicationItem.setOnClickListener(clickListener);
headerView.findViewById(R.id.group_item).setOnClickListener(clickListener);
listView.addHeaderView(headerView);
//add loading view
loadingView = LayoutInflater.from(getActivity()).inflate(R.layout.em_layout_loading_data, null);
contentContainer.addView(loadingView);
registerForContextMenu(listView);
hideTitleBar();
}
@Override
public void refresh() {
Map<String, User> m = SuperWeChatHelper.getInstance().getAppContactList();
if (m instanceof Hashtable<?, ?>) {
//noinspection unchecked
m = (Map<String, User>) ((Hashtable<String, User>)m).clone();
}
setContactsMap(m);
super.refresh();
if(inviteMessgeDao == null){
inviteMessgeDao = new InviteMessgeDao(getActivity());
}
if(inviteMessgeDao.getUnreadMessagesCount() > 0){
applicationItem.showUnreadMsgView();
}else{
applicationItem.hideUnreadMsgView();
}
}
@SuppressWarnings("unchecked")
@Override
protected void setUpView() {
titleBar.setRightImageResource(R.drawable.em_add);
titleBar.setRightLayoutClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// startActivity(new Intent(getActivity(), AddContactActivity.class));
NetUtils.hasDataConnection(getActivity());
}
});
//设置联系人数据
Map<String, User> m = SuperWeChatHelper.getInstance().getAppContactList();
if (m instanceof Hashtable<?, ?>) {
m = (Map<String, User>) ((Hashtable<String, User>)m).clone();
}
setContactsMap(m);
super.setUpView();
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
User user = (User)listView.getItemAtPosition(position);
if (user != null) {
// demo中直接进入聊天页面,实际一般是进入用户详情页
MFGT.gotoDetails(getActivity(),user);
}
}
});
// 进入添加好友页
titleBar.getRightLayout().setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(getActivity(), AddContactActivity.class));
}
});
contactSyncListener = new ContactSyncListener();
SuperWeChatHelper.getInstance().addSyncContactListener(contactSyncListener);
blackListSyncListener = new BlackListSyncListener();
SuperWeChatHelper.getInstance().addSyncBlackListListener(blackListSyncListener);
contactInfoSyncListener = new ContactInfoSyncListener();
SuperWeChatHelper.getInstance().getUserProfileManager().addSyncContactInfoListener(contactInfoSyncListener);
if (SuperWeChatHelper.getInstance().isContactsSyncedWithServer()) {
loadingView.setVisibility(View.GONE);
} else if (SuperWeChatHelper.getInstance().isSyncingContactsWithServer()) {
loadingView.setVisibility(View.VISIBLE);
}
}
@Override
public void onDestroy() {
super.onDestroy();
if (contactSyncListener != null) {
SuperWeChatHelper.getInstance().removeSyncContactListener(contactSyncListener);
contactSyncListener = null;
}
if(blackListSyncListener != null){
SuperWeChatHelper.getInstance().removeSyncBlackListListener(blackListSyncListener);
}
if(contactInfoSyncListener != null){
SuperWeChatHelper.getInstance().getUserProfileManager().removeSyncContactInfoListener(contactInfoSyncListener);
}
}
protected class HeaderItemClickListener implements OnClickListener{
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.application_item:
// 进入申请与通知页面
startActivity(new Intent(getActivity(), NewFriendsMsgActivity.class));
break;
case R.id.group_item:
// 进入群聊列表页面
startActivity(new Intent(getActivity(), GroupsActivity.class));
break;
default:
break;
}
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
toBeProcessUser = (User) listView.getItemAtPosition(((AdapterContextMenuInfo) menuInfo).position);
toBeProcessUsername = toBeProcessUser.getMUserName();
getActivity().getMenuInflater().inflate(R.menu.em_context_contact_list, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
if (item.getItemId() == R.id.delete_contact) {
try {
// delete contact
deleteContact(toBeProcessUser);
// remove invitation message
InviteMessgeDao dao = new InviteMessgeDao(getActivity());
dao.deleteMessage(toBeProcessUser.getMUserName());
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
return super.onContextItemSelected(item);
}
/**
* delete contact
*
* @param tobeDeleteUser
*/
public void deleteContact(final User tobeDeleteUser) {
String st1 = getResources().getString(R.string.deleting);
final String st2 = getResources().getString(R.string.Delete_failed);
final ProgressDialog pd = new ProgressDialog(getActivity());
pd.setMessage(st1);
pd.setCanceledOnTouchOutside(false);
pd.show();
NetDao.delteContact(getActivity(), EMClient.getInstance().getCurrentUser(), tobeDeleteUser.getMUserName(),
new OnCompleteListener<String>() {
@Override
public void onSuccess(String s) {
if (s != null) {
Result result = ResultUtils.getResultFromJson(s,User.class);
if (result != null &&result.isRetMsg()){
UserDao dao = new UserDao(getActivity());
SuperWeChatHelper.getInstance().getAppContactList().remove(tobeDeleteUser.getMUserName());
dao.deleteAppContact(tobeDeleteUser.getMUserName());
// getActivity().runOnUiThread(new Runnable() {
// public void run() {
// pd.dismiss();
// contactList.remove(tobeDeleteUser);
// contactListLayout.refresh();
//
// }
// });
getActivity().sendBroadcast(new Intent(Constant.ACTION_CONTACT_CHANAGED));
}
}
}
@Override
public void onError(String error) {
}
});
new Thread(new Runnable() {
public void run() {
try {
EMClient.getInstance().contactManager().deleteContact(tobeDeleteUser.getMUserName());
// remove user from memory and database
UserDao dao = new UserDao(getActivity());
dao.deleteContact(tobeDeleteUser.getMUserName());
SuperWeChatHelper.getInstance().getContactList().remove(tobeDeleteUser.getMUserName());
getActivity().runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
contactList.remove(tobeDeleteUser);
contactListLayout.refresh();
}
});
} catch (final Exception e) {
getActivity().runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(getActivity(), st2 + e.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
}
}).start();
}
class ContactSyncListener implements DataSyncListener{
@Override
public void onSyncComplete(final boolean success) {
EMLog.d(TAG, "on contact list sync success:" + success);
getActivity().runOnUiThread(new Runnable() {
public void run() {
getActivity().runOnUiThread(new Runnable(){
@Override
public void run() {
if(success){
loadingView.setVisibility(View.GONE);
refresh();
}else{
String s1 = getResources().getString(R.string.get_failed_please_check);
Toast.makeText(getActivity(), s1, Toast.LENGTH_LONG).show();
loadingView.setVisibility(View.GONE);
}
}
});
}
});
}
}
class BlackListSyncListener implements DataSyncListener{
@Override
public void onSyncComplete(boolean success) {
getActivity().runOnUiThread(new Runnable(){
@Override
public void run() {
refresh();
}
});
}
}
class ContactInfoSyncListener implements DataSyncListener{
@Override
public void onSyncComplete(final boolean success) {
EMLog.d(TAG, "on contactinfo list sync success:" + success);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
loadingView.setVisibility(View.GONE);
if(success){
refresh();
}
}
});
}
}
}
| [
"1020942021@qq.com"
] | 1020942021@qq.com |
14390959944d793a3a3d64ecc685c5771a3b92bf | f73710817eb68b14b6b5bfdb1cc88aff8fd1cb1c | /app/src/main/java/com/earnecash/android/home/HomeActivity.java | a20591154e00eb12c033815d331f6ed09541d005 | [
"Apache-2.0"
] | permissive | Goutam-Kumar/EarnECash | 53935a6772232a67eff4a9639beb1374dd4b885a | f2604cfa904a91463ac01ab49d35589dd7879b37 | refs/heads/master | 2020-07-28T07:36:04.260277 | 2019-09-18T16:36:05 | 2019-09-18T16:36:05 | 209,352,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,154 | java | package com.earnecash.android.home;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.earnecash.android.R;
import com.earnecash.android.apphelper.AppHelper;
import com.earnecash.android.login.LoginActivity;
import com.earnecash.android.login.model.UserData;
import com.google.gson.Gson;
public class HomeActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
@BindView(R.id.rcvItem)
RecyclerView rcvItem;
@BindView(R.id.navigation_view)
NavigationView navigationView;
@BindView(R.id.ic_menu)
ImageView icMenu;
@BindView(R.id.drawer)
DrawerLayout drawer;
TextView user;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
navigationView.setNavigationItemSelectedListener(this);
GridLayoutManager gridLayoutManager = new GridLayoutManager(HomeActivity.this, 3);
rcvItem.setLayoutManager(gridLayoutManager);
HomeAdapter homeAdapter = new HomeAdapter(HomeActivity.this);
rcvItem.setAdapter(homeAdapter);
View header=navigationView.getHeaderView(0);
user = (TextView) header.findViewById(R.id.user);
String strUser = AppHelper.getString(AppHelper.USER_PREF,AppHelper.USER_DATA);
UserData userData = new Gson().fromJson(strUser,UserData.class);
if (userData != null){
user.setText("Welcome "+ userData.getName());
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.drawer_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.logout) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
if (menuItem.getItemId() == R.id.logout) {
AppHelper.saveBoolean(AppHelper.USER_PREF, AppHelper.ISLOGIN, false);
startActivity(new Intent(HomeActivity.this, LoginActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}
return true;
}
@OnClick(R.id.ic_menu)
public void onClick() {
if (drawer.isDrawerOpen(Gravity.START)){
drawer.closeDrawer(Gravity.START);
}else {
drawer.openDrawer(Gravity.START);
}
}
}
| [
"goutam.k0711@gmail.com"
] | goutam.k0711@gmail.com |
b0006d8e7181887dcc63c54da55c224564054495 | 6e067d4a9e5b930ee06384b0a6029f2b62c22d44 | /1605104_1605111_1605112/nachos/userprog/UThread.java | 30eaa2c96c3f0dd9b36e31f16841ec40493724fb | [] | no_license | SifatIbna/Chronicles-of-Level-3-Term-2- | 3573b789eb14959d9f0317ea1fc085228e349d5c | 1a7df05097cee73dd49f781881c1eac7515c4748 | refs/heads/master | 2023-03-21T02:19:15.100557 | 2021-03-06T16:53:38 | 2021-03-06T16:53:38 | 345,112,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,723 | java | package nachos.userprog;
import nachos.machine.*;
import nachos.threads.*;
import nachos.userprog.*;
/**
* A UThread is KThread that can execute user program code inside a user
* process, in addition to Nachos kernel code.
*/
public class UThread extends KThread {
/**
* Allocate a new UThread.
*/
public UThread(UserProcess process) {
super();
setTarget(new Runnable() {
public void run() {
runProgram();
}
});
this.process = process;
}
private void runProgram() {
process.initRegisters();
process.restoreState();
Machine.processor().run();
Lib.assertNotReached();
}
/**
* Save state before giving up the processor to another thread.
*/
protected void saveState() {
process.saveState();
for (int i=0; i<Processor.numUserRegisters; i++)
userRegisters[i] = Machine.processor().readRegister(i);
super.saveState();
}
/**
* Restore state before receiving the processor again.
*/
protected void restoreState() {
super.restoreState();
for (int i=0; i<Processor.numUserRegisters; i++)
Machine.processor().writeRegister(i, userRegisters[i]);
process.restoreState();
}
/**
* Storage for the user register set.
*
* <p>
* A thread capable of running user code actually has <i>two</i> sets of
* CPU registers: one for its state while executing user code, and one for
* its state while executing kernel code. While this thread is not running,
* its user state is stored here.
*/
public int userRegisters[] = new int[Processor.numUserRegisters];
/**
* The process to which this thread belongs.
*/
public UserProcess process;
}
| [
"1605112@ugrad.cse.buet.ac.bd"
] | 1605112@ugrad.cse.buet.ac.bd |
2ff3190f2d5f96b4635e86e74e6b6a22d3dadec5 | c35500eea5b33131d911c05de69ec14184eda679 | /soa-client/src/main/java/org/ebayopensource/turmeric/runtime/common/binding/Deserializer.java | c0d3e2d3403185681e24ea2125c779aa9b01d2c8 | [
"Apache-2.0"
] | permissive | ramananandh/MyPublicRepo | 42b9fd2c1fce41fd0de9b828531aa4ada2c75185 | 686129c380f438f0858428cc19c2ebc7f5e6b13f | refs/heads/master | 2020-06-06T17:49:41.818826 | 2011-08-29T06:34:07 | 2011-08-29T06:34:07 | 1,922,268 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,137 | java | /*******************************************************************************
* Copyright (c) 2006-2010 eBay Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*******************************************************************************/
package org.ebayopensource.turmeric.runtime.common.binding;
import javax.xml.stream.XMLStreamReader;
import org.ebayopensource.turmeric.runtime.common.exceptions.ServiceException;
import org.ebayopensource.turmeric.runtime.common.pipeline.InboundMessage;
/**
* Deserializer is responsible for managing the process of unmarshalling
* encoded data of a particular encoding, for example, schema xml,
* name-value, or JSON, into a Java content tree. It can also provide
* data encoding validation.
*
* @author smalladi
* @author wdeng
*/
public interface Deserializer {
/**
* Initiate deserialization of the specified inbound message value.
* @param msg the inbound message
* @param clazz the bound (target) type
* @return an object of the specified bound type
* @throws ServiceException Exception when deserialization fails.
*/
public Object deserialize(InboundMessage msg, Class<?> clazz) throws ServiceException;
/**
* Initiate deserialization of the specified inbound message value.
* @param msg the inbound message
* @param clazz the bound (target) type
* @param reader the XMLStreamReader to read in the payload.
* @return an object of the specified bound type
* @throws ServiceException Exception when deserialization fails.
*/
public Object deserialize(InboundMessage msg, Class<?> clazz, XMLStreamReader reader) throws ServiceException;
/**
* @deprecated
*
* For custom deserializer. This method returns the Class object of
* the top level java type this deserializer creates.
*
* @return The Class object of
* the top level java type this deserializer creates.
*/
public Class getBoundType();
}
| [
"anav@ebay.com"
] | anav@ebay.com |
3af1bad6dc791c688016a88d18ab02116c17a546 | 29e184b262bb73e7301fca6b8069c873e910111c | /src/main/java/com/example/jaxb/fpml/recordkeeping/ClearingExceptionReason.java | 807d4d6ef031a2b19e0d31030dfb924084b8e6e2 | [] | no_license | oliversalmon/fpml | 6c0578d8b2460e3976033fa9aea4254341aba65b | cecf5321e750bbb88c14e9bd75ee341acdccc444 | refs/heads/master | 2020-04-03T17:41:00.682605 | 2018-10-30T20:58:56 | 2018-10-30T20:58:56 | 155,455,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,755 | java |
package com.example.jaxb.fpml.recordkeeping;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.NormalizedStringAdapter;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
/**
* The reason a trade is exempted from a clearing mandate.
*
* <p>Java class for ClearingExceptionReason complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ClearingExceptionReason">
* <simpleContent>
* <extension base="<http://www.fpml.org/FpML-5/recordkeeping>Scheme">
* <attribute name="clearingExceptionReasonScheme" type="{http://www.fpml.org/FpML-5/recordkeeping}NonEmptyURI" default="http://www.fpml.org/coding-scheme/clearing-exception-reason" />
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ClearingExceptionReason", namespace = "http://www.fpml.org/FpML-5/recordkeeping", propOrder = {
"value"
})
public class ClearingExceptionReason {
@XmlValue
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
protected String value;
@XmlAttribute(name = "clearingExceptionReasonScheme")
protected String clearingExceptionReasonScheme;
/**
* The base class for all types which define coding schemes that are allowed to be empty.
*
* @return
* possible object is
* {@link String }
*
*/
public String getValue() {
return value;
}
/**
* Sets the value of the value property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setValue(String value) {
this.value = value;
}
/**
* Gets the value of the clearingExceptionReasonScheme property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getClearingExceptionReasonScheme() {
if (clearingExceptionReasonScheme == null) {
return "http://www.fpml.org/coding-scheme/clearing-exception-reason";
} else {
return clearingExceptionReasonScheme;
}
}
/**
* Sets the value of the clearingExceptionReasonScheme property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setClearingExceptionReasonScheme(String value) {
this.clearingExceptionReasonScheme = value;
}
}
| [
"oliver.salmon@gmail.com"
] | oliver.salmon@gmail.com |
a6d17bc82b06ac03f7abc04a00d3274ca18de704 | 89949e866158d5fbeb61029f1b4307c6988e9df9 | /MainActivity.java | 9002613a9feaab00fb3c75eb92911cc8cba7ad3d | [] | no_license | krisha-eng/GeoQuiz | 4389ffda6ce99223e48be28cf006a06a315fa493 | 5fea961ceb7ba92bbae793d249b4d5d97faa2b32 | refs/heads/master | 2021-01-22T04:57:04.594339 | 2017-02-10T19:48:36 | 2017-02-10T19:48:36 | 81,600,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,985 | java | package com.example.android.geoquiz;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity
{
private Button TrueButton;
private Button FalseButton;
private TextView qtextview;
private int currentIndex=0;
// int score=0;
private Question[] qList = new Question[]
{ new Question(R.string.q1,true),
new Question(R.string.q2,false),
new Question(R.string.q3,false),
new Question(R.string.q4,true),
new Question(R.string.q5,true),
};
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
qtextview=(TextView) findViewById(R.id.textview1);
// int question=qList[currentIndex].getResId();
// qtextview.setText(question);
updateQues();
}
private void checkAnswer(boolean userPressedTrue)
{
boolean ansIsTrue = qList[currentIndex].isAns();
if(userPressedTrue==ansIsTrue)
{
Toast.makeText(this, "Correct!", Toast.LENGTH_SHORT).show();
// score++;
// TextView displayScore = (TextView) findViewById(
// R.id.scoretext);
// displayScore.setText(score);
}
else
{
Toast.makeText(this, "InCorrect!", Toast.LENGTH_SHORT).show();
// score--;
// TextView displayScore = (TextView) findViewById(
// R.id.scoretext);
// displayScore.setText(score);
}
}
private void updateQues()
{
int q = qList[currentIndex].getResId();
qtextview.setText(q);
}
public void true_button(View view)
{
checkAnswer(true);
// if(t1.setText(R.string.q1)
// {
// Toast.makeText(this, "Correct!", Toast.LENGTH_SHORT).show();
// }
// int question=qList[currentIndex].getResId();
// if(qList[currentIndex].isAns()==true)
// {
// Toast.makeText(this, "Correct!", Toast.LENGTH_SHORT).show();
// }
// else if(qList[currentIndex].isAns()==false)
// {
// Toast.makeText(this, "InCorrect!", Toast.LENGTH_SHORT).show();
// }
}
public void false_button(View view)
{
checkAnswer(false);
}
public void next_button(View view)
{
currentIndex=(currentIndex+1)%qList.length;
int question=qList[currentIndex].getResId();
qtextview.setText(question);
}
public void pre_button(View view)
{
currentIndex=Math.abs(currentIndex-1)%qList.length;
int question=qList[currentIndex].getResId();
qtextview.setText(question);
}
}
| [
"eng.krisha97@gmail.com"
] | eng.krisha97@gmail.com |
202a5de22dc982fdeca32bcb3266ad14738a7363 | 2e8f50c7802a9baad44a9b0a2d40d5605de77e9d | /src/main/java/org/example/library/Books.java | ad8ccbd8e36e41bf86b7a9c686b062a008c4e371 | [] | no_license | Sophia-Okito/Library | f1cb64edff692e90d0ab3dae425c4c0fe177011f | a534040b022f41289103015759731462c45c9805 | refs/heads/master | 2023-04-27T00:34:31.820092 | 2021-06-08T14:21:47 | 2021-06-08T14:21:47 | 357,633,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 688 | java | package org.example.library;
public class Books {
private String title;
private String ISBN;
private String publishingYear;
private int noOfCopy;
public Books(String title, String ISBN, String publishingYear, int noOfCopy) {
this.title = title;
this.ISBN = ISBN;
this.publishingYear = publishingYear;
this.noOfCopy = noOfCopy;
}
public void getBookInfo() {
}
public String getTitle() {
return title;
}
public String getISBN() {
return ISBN;
}
public String getPublishingYear() {
return publishingYear;
}
public int getNoOfCopy() {
return noOfCopy;
}
}
| [
"63434504+Sophia-Okito@users.noreply.github.com"
] | 63434504+Sophia-Okito@users.noreply.github.com |
4dfb7ece200b66587b169b0b9dba480b29ee38dc | 9b56c1a7ff68cec78d2d469242dc396fc9fd7b02 | /bin/platform/ext/platformservices/src/de/hybris/platform/servicelayer/event/events/MessageSendingEventListener.java | ee4dc1d2cc0f12f1b5baeded51f48bd531f6a9b5 | [] | no_license | noiz23/TourHy | e32f411786c140e08b977dbe89f912061f47ce7f | 8379099898362e7c697c6ef22ae988c85e41eae3 | refs/heads/master | 2020-04-11T08:14:00.193050 | 2019-01-03T10:15:13 | 2019-01-03T10:15:13 | 161,634,988 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,439 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with SAP.
*/
package de.hybris.platform.servicelayer.event.events;
import de.hybris.platform.servicelayer.event.impl.AbstractEventListener;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
/**
* Listener for the event of class {@link #eventClass}. After event is received {@link MessageSendingEventListener} will
* send it into {@link #channel}.
*/
public class MessageSendingEventListener extends AbstractEventListener<AbstractEvent>
{
private static final Logger LOG = Logger.getLogger(MessageSendingEventListener.class);
private Class<? extends AbstractEvent> eventClass;
private MessageChannel channel;
private Long timeout;
@Override
protected void onEvent(final AbstractEvent event)
{
if (event == null)
{
throw new IllegalArgumentException("Event is required, null given");
}
if (eventClass.isAssignableFrom(event.getClass()))
{
send(event);
}
else if (LOG.isDebugEnabled())
{
LOG.debug("Event has not been sent (reason: event class " + eventClass + " is not assignable from " + event.getClass());
}
}
protected void send(final AbstractEvent event)
{
final boolean sent;
final Message<AbstractEvent> payload = MessageBuilder.withPayload(event).build();
if (timeout == null)
{
sent = channel.send(payload);
}
else
{
sent = channel.send(payload, timeout.longValue());
}
if (!sent)
{
throw new MessageSendingException("Message of type " + event.getClass() + " could not be sent");
}
}
public void setTimeout(final Long timeout)
{
this.timeout = timeout;
}
@Required
public void setChannel(final MessageChannel channel)
{
this.channel = channel;
}
@Required
public void setEventClass(final Class<? extends AbstractEvent> eventClass)
{
this.eventClass = eventClass;
}
}
| [
"ruben.echeverri"
] | ruben.echeverri |
deea0d86af4b8ef1bb683f9537757281b2de06ff | a0199f2f5554c0e15d2301b195a10f1ade67db01 | /admin/admin-system/src/main/java/com/github/x19990416/mxpaas/admin/modules/security/config/bean/LoginProperties.java | b7a7a1ab5cc5517fe1c5281defd058d646976c50 | [
"Apache-2.0"
] | permissive | x19990416/MxPaaS | de5a81bf558103006ff4d78399a96d33f50bfcfc | a9ad8379d572c514fddb5e283f623946cdb9a088 | refs/heads/main | 2023-02-23T19:04:15.484000 | 2021-02-02T09:03:47 | 2021-02-02T09:03:47 | 333,691,363 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,030 | java | /*
* Copyright (c) 2020-2021 Guo Limin
*
* 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.github.x19990416.mxpaas.admin.modules.security.config.bean;
import com.github.x19990416.mxpaas.admin.common.exception.BadConfigurationException;
import com.wf.captcha.*;
import com.wf.captcha.base.Captcha;
import lombok.Data;
import org.apache.logging.log4j.util.Strings;
import java.awt.*;
import java.util.Objects;
/**
* 使用 EasyCaptcha {@see https://gitee.com/whvse/EasyCaptcha}
*/
@Data
public class LoginProperties {
/**
* 账号单用户 登录
*/
private boolean singleLogin = false;
private LoginCode loginCode;
/**
* 用户登录信息缓存
*/
private boolean cacheEnable;
public boolean isSingleLogin() {
return singleLogin;
}
public boolean isCacheEnable() {
return cacheEnable;
}
/**
* 获取验证码生产类
*
* @return /
*/
public Captcha getCaptcha() {
if (Objects.isNull(loginCode)) {
loginCode = new LoginCode();
if (Objects.isNull(loginCode.getCodeType())) {
loginCode.setCodeType(LoginCodeEnum.arithmetic);
}
}
return switchCaptcha(loginCode);
}
/**
* 依据配置信息生产验证码
*
* @param loginCode 验证码配置信息
* @return /
*/
private Captcha switchCaptcha(LoginCode loginCode) {
Captcha captcha;
synchronized (this) {
switch (loginCode.getCodeType()) {
case arithmetic:
// 算术类型
captcha = new ArithmeticCaptcha(loginCode.getWidth(), loginCode.getHeight());
// 几位数运算,默认是两位
captcha.setLen(loginCode.getLength());
break;
case chinese:
captcha = new ChineseCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case chinese_gif:
captcha = new ChineseGifCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case gif:
captcha = new GifCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case spec:
captcha = new SpecCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
default:
throw new BadConfigurationException("验证码配置信息错误!正确配置查看 LoginCodeEnum ");
}
}
if(Strings.isNotBlank(loginCode.getFontName())){
captcha.setFont(new Font(loginCode.getFontName(), Font.PLAIN, loginCode.getFontSize()));
}
return captcha;
}
}
| [
"starseeker.limin@gmail.com"
] | starseeker.limin@gmail.com |
f8279b2329003234dfb935faba917c911dad9d13 | 2fede1f55cf613fd3c5c60ba5b9345623f5abc2b | /src/test/java/jscover/json/JSONDataMergerTest.java | 39208e569b8b2494be08b586d5e6f5342d2a8f98 | [] | no_license | panghl/JSCover | 4e523c71f61658845b89c6a4d7bf5abbd8e37b08 | 2b232de41644db2261dba97c646f47a962b41812 | refs/heads/master | 2020-04-03T07:15:05.744572 | 2012-10-21T04:33:48 | 2012-10-21T04:33:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,737 | java | /**
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program 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 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
*/
package jscover.json;
import jscover.util.IoUtils;
import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.SortedMap;
import java.util.TreeMap;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertThat;
public class JSONDataMergerTest {
private JSONDataMerger jsonMerger = new JSONDataMerger();
@Test
public void shouldMergeData() {
String data1 = IoUtils.loadFromClassPath("/jscover/json/jscoverage-select-1.json");
String data2 = IoUtils.loadFromClassPath("/jscover/json/jscoverage-select-3.json");
String expected = IoUtils.loadFromClassPath("/jscover/json/jscoverage-select-1-3.json");
String merged = jsonMerger.toJSON(jsonMerger.mergeJSONCoverageData(data1, data2));
assertThat(merged, equalTo(expected));
}
@Test
public void shouldMergeDataWithDifferentFiles() {
String data1 = "{\"/test1.js\":{\"coverage\":[null,0,1],\"source\":[\"x++;\",\"y++;\",\"z++;\"]}}";
String data2 = "{\"/test2.js\":{\"coverage\":[null,0,1],\"source\":[\"x++;\",\"y++;\",\"z++;\"]}}";
String expected = "{\"/test1.js\":{\"coverage\":[null,0,1],\"source\":[\"x++;\",\"y++;\",\"z++;\"]},\"/test2.js\":{\"coverage\":[null,0,1],\"source\":[\"x++;\",\"y++;\",\"z++;\"]}}";
String merged = jsonMerger.toJSON(jsonMerger.mergeJSONCoverageData(data1, data2));
assertThat(merged, equalTo(expected));
}
@Test
public void shouldParseData() {
String data = "{\"/test.js\":{\"coverage\":[null,0,1],\"source\":[\"x++;\",\"y++;\",\"z++;\"]}}";
SortedMap<String, CoverageData> map = jsonMerger.jsonToMap(data);
assertThat(map.keySet().size(), equalTo(1));
assertThat(map.keySet().iterator().next(), equalTo("/test.js"));
assertThat(map.values().iterator().next().getCoverage().get(0), nullValue());
assertThat(map.values().iterator().next().getSource().get(0), equalTo("x++;"));
assertThat(map.values().iterator().next().getCoverage().get(1), equalTo(0));
assertThat(map.values().iterator().next().getSource().get(1), equalTo("y++;"));
assertThat(map.values().iterator().next().getCoverage().get(2), equalTo(1));
assertThat(map.values().iterator().next().getSource().get(2), equalTo("z++;"));
}
@Test(expected = RuntimeException.class)
public void shouldReThrowException() {
jsonMerger.jsonToMap("{\"/test.js\":{\"coverage\":\"}}");
}
@Test
public void shouldConvertMapToJSONString() {
String data = "{\"/test.js\":{\"coverage\":[null,0,1],\"source\":[\"x++;\",\"y++;\",\"z++;\"]}}";
SortedMap<String, CoverageData> map = jsonMerger.jsonToMap(data);
String jsonString = jsonMerger.toJSON(map);
assertThat(jsonString, equalTo(data));
}
@Test
public void shouldGenerateEmptyCoverageJSONString() {
List<Integer> lines = new ArrayList<Integer>(){{add(1);add(2);add(3);}};
List<String> sourceLines = new ArrayList<String>(){{add("x++;");add("y++;");add("z++;");}};
final ScriptLinesAndSource script = new ScriptLinesAndSource("/test.js", lines, sourceLines);
SortedMap<String, CoverageData> map = jsonMerger.createEmptyJSON(new ArrayList<ScriptLinesAndSource>(){{add(script);}});
assertThat(map.keySet().iterator().next(), equalTo("/test.js"));
assertThat(map.values().iterator().next().getCoverage().get(0), nullValue());
assertThat(map.values().iterator().next().getSource().get(0), equalTo("x++;"));
assertThat(map.values().iterator().next().getCoverage().get(1), equalTo(0));
assertThat(map.values().iterator().next().getSource().get(1), equalTo("y++;"));
assertThat(map.values().iterator().next().getCoverage().get(2), equalTo(0));
assertThat(map.values().iterator().next().getSource().get(2), equalTo("z++;"));
assertThat(map.values().iterator().next().getCoverage().get(3), equalTo(0));
}
@Test
public void shouldGenerateEmptyCoverageJSONStringWithComments() {
List<Integer> lines = new ArrayList<Integer>(){{add(1);add(3);}};
List<String> sourceLines = new ArrayList<String>(){{add("x++;");add("//Comment");add("z++;");}};
final ScriptLinesAndSource script = new ScriptLinesAndSource("/test.js", lines, sourceLines);
SortedMap<String, CoverageData> map = jsonMerger.createEmptyJSON(new ArrayList<ScriptLinesAndSource>(){{add(script);}});
assertThat(map.keySet().iterator().next(), equalTo("/test.js"));
assertThat(map.values().iterator().next().getCoverage().get(0), nullValue());
assertThat(map.values().iterator().next().getSource().get(0), equalTo("x++;"));
assertThat(map.values().iterator().next().getCoverage().get(1), equalTo(0));
assertThat(map.values().iterator().next().getSource().get(1), equalTo("//Comment"));
assertThat(map.values().iterator().next().getCoverage().get(2), nullValue());
assertThat(map.values().iterator().next().getSource().get(2), equalTo("z++;"));
assertThat(map.values().iterator().next().getCoverage().get(3), equalTo(0));
}
}
| [
"tntim96@gmail.com"
] | tntim96@gmail.com |
fed24fdd1706a58ce0b96109ba85a22fbb4bf1fe | 20761338ff9033ef69392d8113e4eae23749fcc7 | /Centro/gen/centrocommunity/org/BuildConfig.java | 0f6eb9683444de23389bbe1c97c078547011762f | [] | no_license | timurolifirenko/CentroRep | 9831a1f09277466f33bcba59ebd05f9b2e0128b4 | 99d93513aa39762cb420b5b4f9c2fa9aefdbaa76 | refs/heads/master | 2021-01-20T06:57:08.358573 | 2014-03-21T14:58:20 | 2014-03-21T14:58:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | /** Automatically generated file. DO NOT MODIFY */
package centrocommunity.org;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"timur.olifirenko@chestnutcorp.com"
] | timur.olifirenko@chestnutcorp.com |
e8f04807e84ce1c1238221125a2caaaf4d76589c | 80ead6932fc00f366908878306f07194f9f244f1 | /WS-JAX-SOAP-Server/src/main/java/fr/doranco/jaxws/EtudiantService.java | 115ca6d7a21566b9a12ec6a083888acbd56f8461 | [] | no_license | eantunez-cheung/DORANCO_JAVA | c3fa1721daf68fb88f8387cf8318d44e2d3e66c7 | be32776ff4afd194ec0910f75ca1cda68defa39c | refs/heads/master | 2023-06-15T06:51:34.037941 | 2021-07-07T08:45:11 | 2021-07-07T08:45:11 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,579 | java | package fr.doranco.jaxws;
import java.util.List;
import javax.jws.WebService;
import fr.doranco.entity.Etudiant;
import fr.doranco.jaxws.dao.EtudiantDao;
import fr.doranco.jaxws.dao.IEtudiantDao;
@WebService(endpointInterface = "fr.doranco.jaxws.EtudiantService",
serviceName = "EtudiantService",
portName = "EtudiantPort")
public class EtudiantService implements IEtudiantService {
IEtudiantDao etudiantDao = new EtudiantDao();
@Override
public Etudiant addEtudiant(Etudiant etudiant) throws Exception {
if (etudiant == null
|| etudiant.getNom() == null || etudiant.getNom().isEmpty()
|| etudiant.getPrenom() == null || etudiant.getPrenom().isEmpty()
|| etudiant.getSpecialite() == null || etudiant.getSpecialite().isEmpty()) {
throw new IllegalArgumentException("Les paramètres 'nom', 'prenom' et 'specialite' doivent être non nuls et non vides !");
}
if (etudiant.getAge() != null && etudiant.getAge() <= 0) {
throw new IllegalArgumentException("L'âge doit être positif !");
}
return etudiantDao.addEtudiant(etudiant);
}
@Override
public List<Etudiant> getEtudiants() throws Exception {
return etudiantDao.getEtudiants();
}
@Override
public Etudiant getEtudiantById(Integer id) throws Exception {
if (id == null || id <= 0) {
throw new IllegalArgumentException("L'id de l'étudiant à rechercher doit être positif");
}
Etudiant etudiant = etudiantDao.getEtudiantbyId(id);
if (etudiant == null) {
throw new Exception("l'étudiant avec l'id '" + id + "' n'existe pas !");
}
return etudiant;
}
}
| [
"antunezcheungesteban@hotmail.fr"
] | antunezcheungesteban@hotmail.fr |
8593f61774142709c154c8038da4275084c42639 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/luggage/bridge/c.java | d06e74a44849890faae898525d9d76a09167bb57 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 961 | java | package com.tencent.luggage.bridge;
import android.text.TextUtils;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.HashMap;
import org.json.JSONObject;
final class c
extends e
{
c(int paramInt, String paramString, JSONObject paramJSONObject, boolean paramBoolean)
{
super(b.eij);
AppMethodBeat.i(140315);
HashMap localHashMap = new HashMap();
localHashMap.put("callbackId", Integer.valueOf(paramInt));
if (!TextUtils.isEmpty(paramString)) {
localHashMap.put("error", paramString);
}
if (paramJSONObject != null) {
localHashMap.put("data", paramJSONObject);
}
localHashMap.put("keepCallback", Boolean.valueOf(paramBoolean));
i(localHashMap);
AppMethodBeat.o(140315);
}
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes.jar
* Qualified Name: com.tencent.luggage.bridge.c
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
6b4bac7ff6fcae3026cbf5db30b4407cb08cde9b | 57b12f1c48696c2ee29a8af456b891b85c78576b | /src/main/java/com/itrex/java/lab/HomeWork5/Main.java | a1fedb7f890296b69c0d5a43b8409c877cad5d1b | [] | no_license | OlgaDobrodey/ITRexLab | 6dc657c67cd22861a43996acadb0c3cc06480ae2 | 3961e70653742bf755ca7004dae912f138a10119 | refs/heads/master | 2023-08-01T01:07:38.380899 | 2021-09-23T10:14:28 | 2021-09-23T10:14:28 | 403,872,370 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package com.itrex.java.lab.HomeWork5;
public class Main {
public static void main(String[] args) throws InterruptedException {
for (int i = 1; i <= 50; i++) {
LandRover rover = new LandRover(i); //1 <= n <= 50
Thread threadA = new ThreadA(rover); //"Land" if i is divisible by 3 and not 5,
Thread threadB = new ThreadB(rover); //"Rover" if i is divisible by 5 and not 3
Thread threadC = new ThreadC(rover); //"LandRover" if i is divisible by 3 and 5,
Thread threadD = new ThreadD(rover); //i if i is not divisible by 3 or 5
threadA.start();
threadB.start();
threadC.start();
threadD.start();
threadA.join();
threadB.join();
threadC.join();
threadD.join();
}
}
}
| [
"olga.gurkovskaya@gmail.com"
] | olga.gurkovskaya@gmail.com |
8ceb7b5a16eb4d6d4f00233b1f3a7e3b5d875d96 | 97f34059353000a7358e3e8c9d4d7d4ccea614d7 | /mobile-android-gradle/LaunchActivity/src/main/java/org/exoplatform/ui/setting/ServerList.java | 1390ecf99605cbed610c19ed1b3829f2ea699503 | [] | no_license | phamtuanchip/first-class | 3e27b3c5daf397ddba3015a52dfe6347967c2dcd | 82cb9dc0b1111bace94fa091f743808c48f740e6 | refs/heads/master | 2020-03-28T05:26:36.121015 | 2017-02-09T07:38:12 | 2017-02-09T07:38:12 | 7,457,892 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,526 | java | package org.exoplatform.ui.setting;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.Toast;
import org.exoplatform.R;
import org.exoplatform.model.ServerObjInfo;
import org.exoplatform.singleton.AccountSetting;
import org.exoplatform.singleton.ServerSettingHelper;
import org.exoplatform.utils.ExoConstants;
import org.exoplatform.widget.ServerItemLayout;
import java.util.ArrayList;
/**
* Server list used in setting screen
*/
public class ServerList extends LinearLayout {
private Context mContext;
private AccountSetting mSetting;
private Handler mHandler = new Handler();
public ServerList(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
}
public ServerList(Context context) {
super(context);
mContext = context;
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mSetting = AccountSetting.getInstance();
setServerList();
}
/**
* Populate server list
* Run only in case of updating new list of server
*/
public void setServerList() {
removeAllViews();
ArrayList<ServerObjInfo> serverList = ServerSettingHelper.getInstance().getServerInfoList();
LayoutParams layoutParams =
new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0, 0, 0, -1);
ServerItemLayout serverItemLayout;
for (int i = 0; i < serverList.size(); i++) {
serverItemLayout = initServerItem(serverList.get(i), i);
addView(serverItemLayout, i, layoutParams);
}
}
/**
* Simply update the newly changed server instead of the whole list of servers
*
* @param operation
* @param serverIdx
*/
public void updateServerList(int operation, int serverIdx) {
if (operation ==-1 || serverIdx == -1) return;
ServerItemLayout serverItemLayout;
LayoutParams layoutParams =
new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0, 0, 0, -1);
ArrayList<ServerObjInfo> serverList = ServerSettingHelper.getInstance().getServerInfoList();
switch (operation) {
case ServerEditionActivity.SETTING_ADD:
serverItemLayout = initServerItem(serverList.get(serverIdx), serverIdx);
addView(serverItemLayout, serverIdx, layoutParams);
Animation addAnim = AnimationUtils.loadAnimation(mContext, R.anim.anim_right_to_left);
addAnim.setDuration(1000);
serverItemLayout.layout.startAnimation(addAnim);
break;
case ServerEditionActivity.SETTING_UPDATE:
serverItemLayout = initServerItem(serverList.get(serverIdx), serverIdx);
removeViewAt(serverIdx);
addView(serverItemLayout, serverIdx, layoutParams);
Animation updateAnim = new AlphaAnimation(0.4f, 1.0f);
updateAnim.setDuration(1000);
updateAnim.setFillAfter(true);
serverItemLayout.layout.startAnimation(updateAnim);
break;
case ServerEditionActivity.SETTING_DELETE:
final int _serverIdx = serverIdx;
serverItemLayout = (ServerItemLayout) getChildAt(serverIdx);
Animation deleteAnim = AnimationUtils.loadAnimation(mContext, R.anim.anim_right_to_left_reverse);
deleteAnim.setDuration(1000);
deleteAnim.setFillAfter(true);
serverItemLayout.layout.startAnimation(deleteAnim);
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
removeViewAt(_serverIdx);
}
}, deleteAnim.getDuration());
break;
}
}
/**
* Generate layout for a server item
*
* @param _serverObj
* @param serverIdx
* @return
*/
private ServerItemLayout initServerItem(ServerObjInfo _serverObj, int serverIdx) {
final ServerObjInfo serverObj = _serverObj;
ServerItemLayout serverItem = new ServerItemLayout(mContext);
serverItem.serverName.setText(serverObj.serverName);
serverItem.serverUrl.setText(serverObj.serverUrl);
if (Integer.valueOf(mSetting.getDomainIndex()) == serverIdx) {
serverItem.serverImageView.setVisibility(View.VISIBLE);
AlphaAnimation alpha = new AlphaAnimation(0.3F, 0.3F);
alpha.setDuration(0); // Make animation instant
alpha.setFillAfter(true); // Tell it to persist after the animation ends
serverItem.layout.startAnimation(alpha);
}
else
serverItem.serverImageView.setVisibility(View.INVISIBLE);
final int pos = serverIdx;
/* onclick server item */
serverItem.layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
int domainIndex = Integer.valueOf(mSetting.getDomainIndex());
if (domainIndex == pos) {
String strCannotEdit = mContext.getString(R.string.CannotEditServer);
Toast.makeText(mContext, strCannotEdit, Toast.LENGTH_SHORT).show();
return;
}
Intent next = new Intent(mContext, ServerEditionActivity.class);
next.putExtra(ExoConstants.SETTING_ADDING_SERVER, false);
next.putExtra(ExoConstants.EXO_SERVER_OBJ, serverObj);
mContext.startActivity(next);
}
});
return serverItem;
}
}
| [
"tuanp@exoplatform.com"
] | tuanp@exoplatform.com |
4c26115e70b310f6ba9cbd348498cdf8fcfdefb6 | 10cb29d2bdefe2adbd04c2340c9a66e414903013 | /cache/src/main/java/com/cache/db/utils/JsonUtils.java | 1f922a979e17adf0f47fed4ca48572e3e954c6e8 | [] | no_license | zhaokaizk/spring-boot | 87f8ba65de09be3c1b03b138b8a445e67a7a5a08 | 1b24d3895db24360c8c058f4eee41683638b896a | refs/heads/master | 2020-03-27T07:00:54.880317 | 2019-05-08T14:30:04 | 2019-05-08T14:30:04 | 146,156,334 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,816 | java | package com.cache.db.utils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.alibaba.fastjson.JSONObject;
public class JsonUtils {
/**
* 任意类型转换为json的String类型,规则:简单类型直接toString,其他的转换为json格式后toString(此方法的目的是:只往redis里存String格式,按照我们自己的格式转换其他地方提供的任意对象,做到公用)
* 此方法和toString方法返回结果是一样的,不要删除本方法,可以用来做参考
* @param obj
* @return
*/
public static String toString1(Object obj) {
if(obj == null){
return null;
}
String s = null;
if (obj instanceof String) {
s = obj.toString();
} else if (obj instanceof Number) {
s = String.valueOf(obj);
} else {
s = JSONObject.toJSONString(obj);
}
return s;
}
/**
* 把任意对转换成字符串格式,此方法和toString1方法转出来的结果是一样的
* @param obj
* @return
*/
public static String toString(Object obj) {
if(obj == null){
return null;
}
if(obj instanceof String){
return obj.toString();
}
return JSONObject.toJSONString(obj);
}
/**
* 把字符串转换成指定的类型,和toString方法成对出现,反转本类里的toString方法得到的字符串为指定类型
* 此方法和toObject方法返回结果是一样的,不要删除本方法,可以用来做参考
* @param str
* @param c
* @return
*/
public static <T extends Object> T toObject1(String str, Class<T> c) {
// c.forName("").newInstance();
if(str == null){
return null;
}
Object obj = null;
if (c.isAssignableFrom(String.class)) {
obj = str;
} else if (c.isAssignableFrom(Integer.class)) {
obj = Integer.parseInt(str);
} else if (c.isAssignableFrom(Float.class)) {
obj = Float.parseFloat(str);
} else if (c.isAssignableFrom(Double.class)) {
obj = Double.parseDouble(str);
} else if (c.isAssignableFrom(Long.class)) {
obj = Long.parseLong(str);
} else if (c.isAssignableFrom(Short.class)) {
obj = Short.parseShort(str);
} else if (c.isAssignableFrom(Byte.class)) {
obj = Byte.parseByte(str);
} else {
obj = JSONObject.parseObject(str, c);
}
return (T) obj;
}
/**
* 把json字符串转换成指定对象,和toObject1结果是一样的
* @param str
* @param c 必须要指定Class类型,否则简单的类型(string,int等)转成json对象会出问题,为了避免出错,如果不知道类型,直接讲str原样返回
* @return
*/
public static <T extends Object> T toObject(String str, Class<T> c) {
// c.forName("").newInstance();
if(str == null){
return null;
}
if(c == null){
return (T) str;
}
if(c.isAssignableFrom(String.class)){
return (T) str;
}
// if(c.isAssignableFrom(JSONObject.class)){
// return (T) JSONObject.parseObject(str);
// }
return JSONObject.parseObject(str, c);
}
/**
* json字符串转换成list
* @param key
* @param c
* @return
*/
public static <T extends Object> List<T> toList(String str,Class<T> c){
if(str == null){
return null;
}
return JSONObject.parseArray(str, c);
}
/**
* json字符串转换为map
* @param key
* @param mapKeyClass
* @param mapValueClass
* @return
*/
public static <V,T extends Object> Map<T, V> toMap(String str,Class<T> mapKeyClass,Class<V> mapValueClass){
if(str == null){
return null;
}
Map<T, V> map1 = new HashMap<>();
// JSONObject js = JSONObject.parseObject(str);
Map js = JSONObject.parseObject(str,Map.class);
Set<String> keySet = js.keySet();
for (String k : keySet) {
Object o = js.get(k);
map1.put(toObject(k, mapKeyClass), o==null?null:toObject(o.toString(), mapValueClass));
}
return map1;
}
}
| [
"824423389@qq.com"
] | 824423389@qq.com |
526d6dbf7d2efab0c2b8500ef214fc59dea6b859 | b24818a948152b06c7d85ac442e9b37cb6becbbc | /src/main/java/com/ash/experiments/performance/whitespace/Class1569.java | bc072439829e068d9907dfd018c476b34fbee020 | [] | no_license | ajorpheus/whitespace-perf-test | d0797b6aa3eea1435eaa1032612f0874537c58b8 | d2b695aa09c6066fbba0aceb230fa4e308670b32 | refs/heads/master | 2020-04-17T23:38:39.420657 | 2014-06-02T09:27:17 | 2014-06-02T09:27:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 41 | java | public class Class1569 {}
| [
"Ashutosh.Jindal@monitise.com"
] | Ashutosh.Jindal@monitise.com |
39d558450da45f5972d7df6f00172d4e8f3f6ca4 | bda52806b584b4c16224fccbc76dbb7fd1a274b5 | /airline-core/src/main/java/com/github/rvesse/airline/restrictions/common/AllowedValuesRestriction.java | e36e89ff10295c099520dd12585b67ddf8c5618f | [
"Apache-2.0"
] | permissive | lanwen/airline | cf0c3ce2d39a832138664d1daa88593dda2a9c37 | 1fae38f45efed3a6ad2b978d472b04c19fd68ff9 | refs/heads/master | 2021-05-04T07:26:23.053320 | 2016-09-20T10:32:01 | 2016-09-20T10:32:01 | 70,612,429 | 0 | 0 | null | 2016-10-11T16:19:50 | 2016-10-11T16:19:50 | null | UTF-8 | Java | false | false | 3,649 | java | /**
* Copyright (C) 2010-16 the original author or authors.
*
* 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.github.rvesse.airline.restrictions.common;
import java.util.LinkedHashSet;
import java.util.Set;
import com.github.rvesse.airline.DefaultTypeConverter;
import com.github.rvesse.airline.TypeConverter;
import com.github.rvesse.airline.model.ArgumentsMetadata;
import com.github.rvesse.airline.model.OptionMetadata;
import com.github.rvesse.airline.parser.ParseState;
import com.github.rvesse.airline.parser.errors.ParseArgumentsIllegalValueException;
import com.github.rvesse.airline.parser.errors.ParseInvalidRestrictionException;
import com.github.rvesse.airline.parser.errors.ParseOptionIllegalValueException;
import com.github.rvesse.airline.utils.AirlineUtils;
public class AllowedValuesRestriction extends AbstractAllowedValuesRestriction {
private Object currentState = null;
private Set<Object> allowedValues = null;
public AllowedValuesRestriction(String... rawValues) {
super(false);
this.rawValues.addAll(AirlineUtils.arrayToList(rawValues));
}
@Override
public <T> void postValidate(ParseState<T> state, OptionMetadata option, Object value) {
// Not enforced if no values specified
if (this.rawValues.isEmpty())
return;
Set<Object> allowedValues = createAllowedValues(state, option.getTitle(), option.getJavaType());
if (!allowedValues.contains(value)) {
throw new ParseOptionIllegalValueException(option.getTitle(), value, allowedValues);
}
}
protected synchronized <T> Set<Object> createAllowedValues(ParseState<T> state, String title, Class<?> type) {
// Re-use cached values if possible
if (currentState == state) {
return allowedValues;
}
// Convert values
Set<Object> actualValues = new LinkedHashSet<Object>();
TypeConverter converter = state.getParserConfiguration().getTypeConverter();
if (converter == null)
converter = new DefaultTypeConverter();
for (String rawValue : this.rawValues) {
try {
actualValues.add(converter.convert(title, type, rawValue));
} catch (Exception e) {
throw new ParseInvalidRestrictionException(e,
"Unable to parse raw value '%s' in order to apply allowed values restriction", rawValue);
}
}
// Cache for re-use
currentState = state;
this.allowedValues = actualValues;
return actualValues;
}
@Override
public <T> void postValidate(ParseState<T> state, ArgumentsMetadata arguments, Object value) {
// Not enforced if no values specified
if (this.rawValues.isEmpty())
return;
String title = getArgumentTitle(state, arguments);
Set<Object> allowedValues = createAllowedValues(state, title, arguments.getJavaType());
if (!allowedValues.contains(value)) {
throw new ParseArgumentsIllegalValueException(title, value, allowedValues);
}
}
}
| [
"rvesse@dotnetrdf.org"
] | rvesse@dotnetrdf.org |
87d90234b3c23a3c125f481882b0b446bd23d125 | 6210cb70e3ed20aef867a474d811644461b00b49 | /src/main/java/com/example/projectpfa/DTO/UserDataDTO.java | e7c89a69a85d0ccfb9f6b433b24d76bddcf80403 | [] | no_license | oumaymaabdesslem/Microservice-SpringBoot-Swagger-jwt | 3e0c98d6af1f5d4cc7617ef584abe68d6df63735 | b8e54ae614815e57d81848716eafe447dcaa8969 | refs/heads/main | 2022-12-21T02:48:02.339862 | 2020-10-05T12:34:15 | 2020-10-05T12:34:15 | 301,401,739 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 597 | java | package com.example.projectpfa.DTO;
import com.example.projectpfa.model.Role;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserDataDTO {
@ApiModelProperty(position = 0)
private String username;
@ApiModelProperty(position = 1)
private String email;
@ApiModelProperty(position = 2)
private String password;
@ApiModelProperty(position = 3)
List<Role> roles;
}
| [
"abdesslemoumayma@gmail.com"
] | abdesslemoumayma@gmail.com |
27d2f8fa79db0d45581a5218895e1853ed4eb336 | 2f132c3be8a61a1d2929ab4cc7e419aff88cb2d1 | /app/src/main/java/it/unimib/bicap/exception/CreazioneSomministratoreException.java | 2be5fbf2a6cc797287e5dd28a14675f859d07bdd | [] | no_license | Zetlark28/BICAP-Project | e0cd486ef070a4ee8e6c0d911969140af32ace4f | 1ebf8ea3d4c76d9529f37d6ba3df236ac643cb4f | refs/heads/master | 2022-12-29T06:51:01.351255 | 2020-10-20T22:07:09 | 2020-10-20T22:07:09 | 258,827,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 294 | java | package it.unimib.bicap.exception;
public class CreazioneSomministratoreException extends RuntimeException{
public static final RuntimeException CREAZIONE_SOMMINISTRATORE_VIEW_FAIL = new RuntimeException("Si è verificato un problema nella visualizzazione in CreazioneSomministratore");
}
| [
"a.cottarelli1@campus.unimib.it"
] | a.cottarelli1@campus.unimib.it |
7a42e6ac1f015e0d4ccbcefb03ac78f1ffecfb23 | a464211147d0fd47d2be533a5f0ced0da88f75f9 | /EvoSuiteTests/evosuite_4/evosuite-tests/org/mozilla/javascript/Parser_ESTest_scaffolding.java | 5eabb4309bd13e539abfd480abaf8840aee45326 | [
"MIT"
] | permissive | LASER-UMASS/Swami | 63016a6eccf89e4e74ca0ab775e2ef2817b83330 | 5bdba2b06ccfad9d469f8122c2d39c45ef5b125f | refs/heads/master | 2022-05-19T12:22:10.166574 | 2022-05-12T13:59:18 | 2022-05-12T13:59:18 | 170,765,693 | 11 | 5 | NOASSERTION | 2022-05-12T13:59:19 | 2019-02-14T22:16:01 | HTML | UTF-8 | Java | false | false | 23,566 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Thu Aug 02 04:37:57 GMT 2018
*/
package org.mozilla.javascript;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class Parser_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "org.mozilla.javascript.Parser";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("file.encoding", "UTF-8");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.io.tmpdir", "/tmp");
java.lang.System.setProperty("user.country", "US");
java.lang.System.setProperty("user.dir", "/home/mmotwani/rhino/buildGradle/libs/evosuite_4");
java.lang.System.setProperty("user.home", "/home/mmotwani");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "mmotwani");
java.lang.System.setProperty("user.timezone", "America/New_York");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(Parser_ESTest_scaffolding.class.getClassLoader() ,
"org.mozilla.javascript.ast.ObjectLiteral",
"org.mozilla.javascript.NativeBoolean",
"org.mozilla.javascript.ast.Assignment",
"org.mozilla.javascript.ast.ForLoop",
"org.mozilla.javascript.ast.ScriptNode",
"org.mozilla.javascript.DefaultErrorReporter",
"org.mozilla.javascript.ast.XmlString",
"org.mozilla.javascript.ExternalArrayData",
"org.mozilla.javascript.ast.GeneratorExpression",
"org.mozilla.javascript.DefiningClassLoader",
"org.mozilla.javascript.UniqueTag",
"org.mozilla.javascript.NativeError",
"org.mozilla.javascript.ast.ParenthesizedExpression",
"org.mozilla.javascript.typedarrays.NativeTypedArrayView",
"org.mozilla.javascript.ast.AstNode",
"org.mozilla.javascript.ast.ParseProblem$Type",
"org.mozilla.javascript.SlotMap",
"org.mozilla.javascript.NativeArray$2",
"org.mozilla.javascript.debug.Debugger",
"org.mozilla.javascript.Context$ClassShutterSetter",
"org.mozilla.classfile.ConstantPool",
"org.mozilla.javascript.Token",
"org.mozilla.javascript.RegExpProxy",
"org.mozilla.javascript.NativeWith",
"org.mozilla.javascript.NativeJSON",
"org.mozilla.javascript.NativeGenerator",
"org.mozilla.javascript.ast.InfixExpression",
"org.mozilla.javascript.ast.Loop",
"org.mozilla.javascript.ObjArray",
"org.mozilla.javascript.ast.XmlRef",
"org.mozilla.javascript.SymbolKey",
"org.mozilla.javascript.ES6Iterator",
"org.mozilla.javascript.EcmaError",
"org.mozilla.javascript.ast.RegExpLiteral",
"org.mozilla.javascript.NativeError$ProtoProps",
"org.mozilla.javascript.v8dtoa.DoubleConversion",
"org.mozilla.javascript.NativeJavaPackage",
"org.mozilla.javascript.NativeFunction",
"org.mozilla.javascript.IdFunctionCall",
"org.mozilla.javascript.NativeString",
"org.mozilla.javascript.typedarrays.NativeArrayBuffer",
"org.mozilla.javascript.NativeContinuation",
"org.mozilla.javascript.NativeCallSite",
"org.mozilla.javascript.Parser$ConditionData",
"org.mozilla.javascript.ast.ErrorCollector",
"org.mozilla.javascript.ast.Scope",
"org.mozilla.javascript.NativeMath",
"org.mozilla.javascript.Interpreter$CallFrame",
"org.mozilla.javascript.ast.DestructuringForm",
"org.mozilla.javascript.NativeJavaObject",
"org.mozilla.javascript.JavaScriptException",
"org.mozilla.javascript.Parser$PerFunctionVariables",
"org.mozilla.classfile.ClassFileWriter$ClassFileFormatException",
"org.mozilla.javascript.ContinuationPending",
"org.mozilla.javascript.FunctionObject",
"org.mozilla.javascript.ast.LabeledStatement",
"org.mozilla.javascript.InterfaceAdapter",
"org.mozilla.javascript.ScriptRuntime$DefaultMessageProvider",
"org.mozilla.javascript.ast.ArrayLiteral",
"org.mozilla.javascript.debug.DebuggableObject",
"org.mozilla.javascript.ast.BreakStatement",
"org.mozilla.javascript.NativeIterator$WrappedJavaIterator",
"org.mozilla.javascript.ObjToIntMap",
"org.mozilla.javascript.ast.Comment",
"org.mozilla.javascript.NativeArray$StringLikeComparator",
"org.mozilla.javascript.ClassShutter",
"org.mozilla.javascript.jdk15.VMBridge_jdk15",
"org.mozilla.javascript.ast.Symbol",
"org.mozilla.javascript.ast.Yield",
"org.mozilla.javascript.ImporterTopLevel",
"org.mozilla.javascript.jdk18.VMBridge_jdk18",
"org.mozilla.javascript.ClassCache",
"org.mozilla.javascript.Icode",
"org.mozilla.javascript.ast.CatchClause",
"org.mozilla.javascript.ast.XmlMemberGet",
"org.mozilla.javascript.typedarrays.NativeUint16Array",
"org.mozilla.javascript.LazilyLoadedCtor",
"org.mozilla.javascript.JavaAdapter",
"org.mozilla.javascript.ast.ArrayComprehensionLoop",
"org.mozilla.javascript.Scriptable",
"org.mozilla.javascript.ast.AstNode$PositionComparator",
"org.mozilla.javascript.ast.SwitchCase",
"org.mozilla.javascript.EmbeddedSlotMap$1",
"org.mozilla.javascript.ast.Block",
"org.mozilla.javascript.ast.VariableInitializer",
"org.mozilla.javascript.ast.VariableDeclaration",
"org.mozilla.javascript.WrappedException",
"org.mozilla.javascript.ast.ThrowStatement",
"org.mozilla.javascript.ScriptableObject$GetterSlot",
"org.mozilla.javascript.InterpreterData",
"org.mozilla.javascript.NativeCall",
"org.mozilla.javascript.ast.ForInLoop",
"org.mozilla.javascript.Node$PropListItem",
"org.mozilla.javascript.xml.XMLLib",
"org.mozilla.javascript.TokenStream",
"org.mozilla.javascript.Parser$ParserException",
"org.mozilla.javascript.ast.XmlDotQuery",
"org.mozilla.javascript.IdFunctionObjectES6",
"org.mozilla.javascript.NativeGenerator$GeneratorClosedException",
"org.mozilla.javascript.NativeNumber",
"org.mozilla.javascript.json.JsonParser$ParseException",
"org.mozilla.javascript.ObjToIntMap$Iterator",
"org.mozilla.javascript.ast.DoLoop",
"org.mozilla.javascript.ScriptableObject",
"org.mozilla.javascript.NativeGlobal",
"org.mozilla.javascript.ast.ParseProblem",
"org.mozilla.javascript.ast.AstRoot",
"org.mozilla.javascript.ast.NodeVisitor",
"org.mozilla.javascript.Interpreter",
"org.mozilla.javascript.ContextListener",
"org.mozilla.javascript.SymbolScriptable",
"org.mozilla.javascript.ScriptStackElement",
"org.mozilla.javascript.ast.WhileLoop",
"org.mozilla.javascript.NativeDate",
"org.mozilla.javascript.ast.EmptyStatement",
"org.mozilla.javascript.StackStyle",
"org.mozilla.javascript.NativeSymbol",
"org.mozilla.javascript.ScriptableObject$SlotAccess",
"org.mozilla.javascript.Node",
"org.mozilla.javascript.ast.PropertyGet",
"org.mozilla.javascript.ast.XmlPropRef",
"org.mozilla.javascript.Undefined$1",
"org.mozilla.javascript.ContextFactory$Listener",
"org.mozilla.javascript.IdScriptableObject$PrototypeValues",
"org.mozilla.javascript.ContextFactory",
"org.mozilla.javascript.ast.GeneratorExpressionLoop",
"org.mozilla.javascript.GeneratedClassLoader",
"org.mozilla.javascript.Script",
"org.mozilla.javascript.ScriptRuntime$MessageProvider",
"org.mozilla.javascript.typedarrays.NativeFloat64Array",
"org.mozilla.javascript.ThreadSafeSlotMapContainer",
"org.mozilla.javascript.EmbeddedSlotMap",
"org.mozilla.javascript.Undefined",
"org.mozilla.javascript.ast.ObjectProperty",
"org.mozilla.javascript.Wrapper",
"org.mozilla.javascript.ScriptRuntime$NoSuchMethodShim",
"org.mozilla.javascript.BaseFunction",
"org.mozilla.javascript.ast.SwitchStatement",
"org.mozilla.javascript.ast.LetNode",
"org.mozilla.classfile.ClassFileWriter$MHandle",
"org.mozilla.javascript.ScriptRuntime",
"org.mozilla.javascript.InterpretedFunction",
"org.mozilla.javascript.Ref",
"org.mozilla.javascript.Callable",
"org.mozilla.javascript.NativeJSON$StringifyState",
"org.mozilla.javascript.ast.ConditionalExpression",
"org.mozilla.javascript.ast.IdeErrorReporter",
"org.mozilla.javascript.NativeObject",
"org.mozilla.javascript.ContextFactory$1",
"org.mozilla.classfile.ExceptionTableEntry",
"org.mozilla.javascript.IdFunctionObject",
"org.mozilla.javascript.Function",
"org.mozilla.javascript.optimizer.OptFunctionNode",
"org.mozilla.javascript.Context",
"org.mozilla.javascript.EvaluatorException",
"org.mozilla.javascript.NativeJavaClass",
"org.mozilla.javascript.UintMap",
"org.mozilla.javascript.ScriptableObject$KeyComparator",
"org.mozilla.javascript.ContextFactory$GlobalSetter",
"org.mozilla.javascript.ast.WithStatement",
"org.mozilla.javascript.Node$NodeIterator",
"org.mozilla.javascript.debug.DebugFrame",
"org.mozilla.javascript.NativeStringIterator",
"org.mozilla.javascript.Evaluator",
"org.mozilla.javascript.ast.FunctionNode",
"org.mozilla.javascript.TopLevel$NativeErrors",
"org.mozilla.javascript.SlotMapContainer",
"org.mozilla.javascript.Symbol",
"org.mozilla.javascript.Kit",
"org.mozilla.javascript.ast.NewExpression",
"org.mozilla.javascript.Token$CommentType",
"org.mozilla.javascript.ScriptableObject$Slot",
"org.mozilla.javascript.RhinoException",
"org.mozilla.javascript.typedarrays.NativeUint8ClampedArray",
"org.mozilla.javascript.ast.ContinueStatement",
"org.mozilla.javascript.ast.NumberLiteral",
"org.mozilla.javascript.ast.XmlFragment",
"org.mozilla.javascript.debug.DebuggableScript",
"org.mozilla.javascript.ast.FunctionNode$Form",
"org.mozilla.javascript.ast.StringLiteral",
"org.mozilla.javascript.ast.ExpressionStatement",
"org.mozilla.javascript.Synchronizer",
"org.mozilla.javascript.IdScriptableObject",
"org.mozilla.javascript.NativeArray",
"org.mozilla.javascript.optimizer.Codegen",
"org.mozilla.javascript.ast.Label",
"org.mozilla.javascript.ast.XmlExpression",
"org.mozilla.javascript.VMBridge",
"org.mozilla.javascript.ast.FunctionCall",
"org.mozilla.javascript.ScriptRuntime$1",
"org.mozilla.javascript.ast.TryStatement",
"org.mozilla.classfile.ClassFileWriter",
"org.mozilla.javascript.NativeArrayIterator",
"org.mozilla.javascript.ast.Jump",
"org.mozilla.javascript.ast.UnaryExpression",
"org.mozilla.javascript.ast.IfStatement",
"org.mozilla.javascript.ast.ReturnStatement",
"org.mozilla.javascript.TopLevel",
"org.mozilla.javascript.Parser",
"org.mozilla.javascript.NativeIterator$StopIteration",
"org.mozilla.javascript.MemberBox",
"org.mozilla.javascript.ast.ErrorNode",
"org.mozilla.javascript.ast.ArrayComprehension",
"org.mozilla.javascript.ast.XmlLiteral",
"org.mozilla.javascript.Interpreter$GeneratorState",
"org.mozilla.javascript.Delegator",
"org.mozilla.javascript.ScriptRuntime$IdEnumeration",
"org.mozilla.javascript.NativeJavaMethod",
"org.mozilla.javascript.ast.Name",
"org.mozilla.javascript.ast.EmptyExpression",
"org.mozilla.javascript.typedarrays.NativeUint32Array",
"org.mozilla.javascript.xml.XMLLib$Factory",
"org.mozilla.javascript.NativeScript",
"org.mozilla.javascript.SecurityController",
"org.mozilla.javascript.ast.XmlElemRef",
"org.mozilla.javascript.ConstProperties",
"org.mozilla.javascript.TopLevel$Builtins",
"org.mozilla.javascript.NativeArray$ElementComparator",
"org.mozilla.javascript.WrapFactory",
"org.mozilla.javascript.NativeIterator",
"org.mozilla.javascript.ErrorReporter",
"org.mozilla.javascript.ast.AstNode$DebugPrintVisitor",
"org.mozilla.javascript.CompilerEnvirons",
"org.mozilla.javascript.typedarrays.NativeArrayBufferView",
"org.mozilla.javascript.ast.KeywordLiteral",
"org.mozilla.javascript.ContextAction",
"org.mozilla.javascript.xml.XMLLib$Factory$1",
"org.mozilla.javascript.ast.ElementGet"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(Parser_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"org.mozilla.javascript.Parser",
"org.mozilla.javascript.Parser$ParserException",
"org.mozilla.javascript.Parser$PerFunctionVariables",
"org.mozilla.javascript.Parser$ConditionData",
"org.mozilla.javascript.Kit",
"org.mozilla.javascript.optimizer.Codegen",
"org.mozilla.javascript.Icode",
"org.mozilla.javascript.Interpreter",
"org.mozilla.javascript.Context",
"org.mozilla.javascript.ContextFactory",
"org.mozilla.javascript.ScriptableObject$KeyComparator",
"org.mozilla.javascript.ScriptableObject",
"org.mozilla.javascript.ScriptRuntime$DefaultMessageProvider",
"org.mozilla.javascript.ScriptRuntime",
"org.mozilla.javascript.Token$CommentType",
"org.mozilla.javascript.jdk15.VMBridge_jdk15",
"org.mozilla.javascript.jdk18.VMBridge_jdk18",
"org.mozilla.javascript.VMBridge",
"org.mozilla.javascript.CompilerEnvirons",
"org.mozilla.javascript.DefaultErrorReporter",
"org.mozilla.javascript.Node",
"org.mozilla.javascript.ast.AstNode",
"org.mozilla.javascript.ast.Name",
"org.mozilla.javascript.ast.Jump",
"org.mozilla.javascript.ast.Scope",
"org.mozilla.javascript.ast.ScriptNode",
"org.mozilla.javascript.ast.FunctionNode",
"org.mozilla.javascript.ast.FunctionNode$Form",
"org.mozilla.javascript.ast.ArrayLiteral",
"org.mozilla.javascript.StackStyle",
"org.mozilla.javascript.RhinoException",
"org.mozilla.javascript.JavaScriptException",
"org.mozilla.javascript.ast.ObjectLiteral",
"org.mozilla.javascript.EvaluatorException",
"org.mozilla.javascript.ast.ErrorCollector",
"org.mozilla.javascript.ast.ArrayComprehension",
"org.mozilla.javascript.TokenStream",
"org.mozilla.javascript.ObjToIntMap",
"org.mozilla.javascript.ast.AstRoot",
"org.mozilla.javascript.ast.ExpressionStatement",
"org.mozilla.javascript.ast.GeneratorExpression",
"org.mozilla.javascript.ast.CatchClause",
"org.mozilla.javascript.ast.FunctionCall",
"org.mozilla.javascript.ast.EmptyStatement",
"org.mozilla.javascript.EcmaError",
"org.mozilla.javascript.ast.Label",
"org.mozilla.javascript.ast.NewExpression",
"org.mozilla.javascript.IdScriptableObject",
"org.mozilla.javascript.NativeArray$StringLikeComparator",
"org.mozilla.javascript.NativeArray$ElementComparator",
"org.mozilla.javascript.NativeArray",
"org.mozilla.javascript.SlotMapContainer",
"org.mozilla.javascript.EmbeddedSlotMap",
"org.mozilla.javascript.ast.InfixExpression",
"org.mozilla.javascript.ast.PropertyGet",
"org.mozilla.javascript.ast.LabeledStatement",
"org.mozilla.javascript.ast.XmlRef",
"org.mozilla.javascript.ast.XmlPropRef",
"org.mozilla.javascript.ast.NumberLiteral",
"org.mozilla.javascript.ast.BreakStatement",
"org.mozilla.javascript.NativeArray$2",
"org.mozilla.javascript.UniqueTag",
"org.mozilla.javascript.Scriptable",
"org.mozilla.javascript.Undefined$1",
"org.mozilla.javascript.Undefined",
"org.mozilla.javascript.ast.EmptyExpression",
"org.mozilla.javascript.ast.ObjectProperty",
"org.mozilla.javascript.ast.ErrorNode",
"org.mozilla.javascript.ast.ParseProblem",
"org.mozilla.javascript.ast.ParseProblem$Type",
"org.mozilla.javascript.Node$PropListItem",
"org.mozilla.javascript.ast.Loop",
"org.mozilla.javascript.ast.DoLoop",
"org.mozilla.javascript.ast.ForInLoop",
"org.mozilla.javascript.ast.ArrayComprehensionLoop",
"org.mozilla.javascript.ast.XmlMemberGet",
"org.mozilla.javascript.ast.Block",
"org.mozilla.javascript.typedarrays.NativeArrayBuffer",
"org.mozilla.javascript.SymbolKey",
"org.mozilla.javascript.ast.SwitchStatement",
"org.mozilla.javascript.typedarrays.NativeArrayBufferView",
"org.mozilla.javascript.typedarrays.NativeTypedArrayView",
"org.mozilla.javascript.typedarrays.NativeUint16Array",
"org.mozilla.javascript.BaseFunction",
"org.mozilla.javascript.IdFunctionObject",
"org.mozilla.javascript.Node$NodeIterator",
"org.mozilla.javascript.SecurityController",
"org.mozilla.javascript.ast.GeneratorExpressionLoop",
"org.mozilla.javascript.ast.WithStatement",
"org.mozilla.javascript.ast.Comment",
"org.mozilla.javascript.ast.SwitchCase",
"org.mozilla.javascript.ast.UnaryExpression",
"org.mozilla.javascript.NativeJavaMethod",
"org.mozilla.javascript.ast.RegExpLiteral",
"org.mozilla.javascript.ast.Yield",
"org.mozilla.javascript.ast.Assignment",
"org.mozilla.javascript.ast.ThrowStatement",
"org.mozilla.javascript.ast.ElementGet",
"org.mozilla.javascript.ast.ForLoop",
"org.mozilla.javascript.ast.ConditionalExpression",
"org.mozilla.javascript.ast.KeywordLiteral",
"org.mozilla.javascript.ast.IfStatement",
"org.mozilla.javascript.ast.XmlElemRef",
"org.mozilla.javascript.ast.ContinueStatement",
"org.mozilla.javascript.ast.WhileLoop",
"org.mozilla.javascript.ClassCache",
"org.mozilla.javascript.TopLevel$Builtins",
"org.mozilla.javascript.TopLevel",
"org.mozilla.javascript.IdScriptableObject$PrototypeValues",
"org.mozilla.javascript.ScriptableObject$SlotAccess",
"org.mozilla.javascript.ScriptableObject$Slot",
"org.mozilla.javascript.EmbeddedSlotMap$1",
"org.mozilla.javascript.NativeObject",
"org.mozilla.javascript.NativeError",
"org.mozilla.javascript.NativeError$ProtoProps",
"org.mozilla.javascript.MemberBox",
"org.mozilla.javascript.ScriptableObject$GetterSlot",
"org.mozilla.javascript.NativeCallSite",
"org.mozilla.javascript.NativeGlobal",
"org.mozilla.javascript.v8dtoa.DoubleConversion",
"org.mozilla.javascript.TopLevel$NativeErrors",
"org.mozilla.javascript.NativeString",
"org.mozilla.javascript.NativeBoolean",
"org.mozilla.javascript.NativeNumber",
"org.mozilla.javascript.NativeDate",
"org.mozilla.javascript.NativeMath",
"org.mozilla.javascript.NativeJSON",
"org.mozilla.javascript.NativeWith",
"org.mozilla.javascript.NativeCall",
"org.mozilla.javascript.NativeScript",
"org.mozilla.javascript.NativeIterator",
"org.mozilla.javascript.NativeGenerator",
"org.mozilla.javascript.NativeIterator$StopIteration",
"org.mozilla.javascript.ES6Iterator",
"org.mozilla.javascript.NativeArrayIterator",
"org.mozilla.javascript.NativeStringIterator",
"org.mozilla.javascript.xml.XMLLib$Factory",
"org.mozilla.javascript.xml.XMLLib$Factory$1",
"org.mozilla.javascript.LazilyLoadedCtor",
"org.mozilla.javascript.ast.AstNode$DebugPrintVisitor",
"org.mozilla.javascript.Token",
"org.mozilla.javascript.WrapFactory",
"org.mozilla.javascript.ContextFactory$1",
"org.mozilla.javascript.DefiningClassLoader",
"org.mozilla.javascript.ContinuationPending",
"org.mozilla.javascript.ast.VariableDeclaration",
"org.mozilla.javascript.ast.StringLiteral",
"org.mozilla.javascript.ast.Symbol",
"org.mozilla.javascript.typedarrays.NativeFloat64Array",
"org.mozilla.javascript.NativeFunction",
"org.mozilla.javascript.InterpretedFunction",
"org.mozilla.javascript.ast.XmlFragment",
"org.mozilla.javascript.ast.XmlExpression",
"org.mozilla.javascript.ast.ReturnStatement",
"org.mozilla.javascript.typedarrays.NativeUint32Array",
"org.mozilla.javascript.Delegator",
"org.mozilla.javascript.Synchronizer",
"org.mozilla.javascript.WrappedException",
"org.mozilla.javascript.ast.XmlLiteral",
"org.mozilla.javascript.ast.XmlString",
"org.mozilla.javascript.ast.LetNode",
"org.mozilla.javascript.ast.AstNode$PositionComparator",
"org.mozilla.javascript.typedarrays.NativeUint8ClampedArray",
"org.mozilla.javascript.ast.ParenthesizedExpression"
);
}
}
| [
"mmotwani@cs.umass.edu"
] | mmotwani@cs.umass.edu |
4db5b8ca859038cfa010e8ce9a619cfd0a204241 | 4f037a4d7e167c67ede1dc0b3255497fd034c91e | /common/src/main/java/org/devocative/demeter/iservice/persistor/IPersistorService.java | 1110d9faedd9aaa99c0b6c6b4851088cab69b3d7 | [
"Apache-2.0"
] | permissive | mbizhani/Demeter | 1fb8294255f11c92e0cf4fa7db2cce27d79ab4da | a1ba0ff2d72101d0fa03bf0c4ea0a6f8a520aee2 | refs/heads/master | 2020-04-04T06:08:41.287994 | 2019-03-27T21:26:01 | 2019-03-27T21:26:01 | 48,447,563 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,287 | java | package org.devocative.demeter.iservice.persistor;
import org.devocative.demeter.iservice.IApplicationLifecycle;
import org.devocative.demeter.iservice.IRequestLifecycle;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
public interface IPersistorService extends IApplicationLifecycle, IRequestLifecycle {
void setInitData(List<Class> entities, String prefix);
void startTrx();
void startTrx(boolean forceNew);
void assertActiveTrx();
void commitOrRollback();
void rollback();
void endSession();
void saveOrUpdate(Object obj);
Serializable save(Object obj);
void update(Object obj);
Object updateFields(Object obj, String... fields);
void persist(Object obj);
<T> T merge(T obj);
<T> T get(Class<T> entity, Serializable id);
<T> T load(Class<T> entity, Serializable id, ELockMode lockMode);
void delete(Class entity, Serializable id);
void delete(Object obj);
<T> List<T> list(Class<T> entity);
<T> List<T> list(String simpleQuery);
void refresh(Object entity);
void executeUpdate(String simpleQuery);
IQueryBuilder createQueryBuilder();
void generateSchemaDiff();
void executeScript(String script, String delimiter);
Connection createSqlConnection() throws SQLException;
}
| [
"mbizhani@gmail.com"
] | mbizhani@gmail.com |
fcf3efd3e0f25c7f74ac1dcddeb0f16d3f569f29 | 4ee20015ad08afa094b23bd3c75cdec1e19c77e6 | /dev/infrared2/web-gwt/src/main/java/net/sf/infrared2/gwt/client/view/facade/ApplicationViewFacade.java | 7f4e318ec36b055f834a9bfffd2c96b38bc28c8a | [] | no_license | anyframejava/anyframe-monitoring | 5b2953c7839f6f643e265cefe9cfd0ec8ec1d535 | 07590d5d321fd6e4a6d6f1f61ca2b011f4bc3fcf | refs/heads/master | 2021-01-17T18:31:53.009247 | 2016-11-07T01:36:20 | 2016-11-07T01:36:20 | 71,343,725 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,254 | java | /*
* Copyright 2002-2008 the original author or authors.
*
* 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 net.sf.infrared2.gwt.client.view.facade;
import net.sf.infrared2.gwt.client.AbstractResizeListener;
import net.sf.infrared2.gwt.client.Constants;
import net.sf.infrared2.gwt.client.Engine;
import net.sf.infrared2.gwt.client.WindowResizeManagerFactory;
import net.sf.infrared2.gwt.client.callback.CacheAsyncCallback;
import net.sf.infrared2.gwt.client.i18n.ApplicationMessages;
import net.sf.infrared2.gwt.client.stack.StackPanelHolder;
import net.sf.infrared2.gwt.client.to.NavigatorEntryTO;
import net.sf.infrared2.gwt.client.to.application.ApplicationViewTO;
import net.sf.infrared2.gwt.client.to.other.OtherViewTO;
import net.sf.infrared2.gwt.client.to.sql.SqlViewTO;
import net.sf.infrared2.gwt.client.users.session.UserSessionBean;
import net.sf.infrared2.gwt.client.view.facade.layer.DefaultViewImpl;
import net.sf.infrared2.gwt.client.view.facade.layer.SQLLayerViewImpl;
import net.sf.infrared2.gwt.client.view.facade.layer.application.AbstractApplicationLayer;
import net.sf.infrared2.gwt.client.view.facade.layer.lastinv.LastInvocationViewImpl;
import net.sf.infrared2.gwt.client.view.facade.layer.other.OtherLayerViewImpl;
import net.sf.infrared2.gwt.client.view.header.HeaderPanel;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowResizeListener;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.gwtext.client.core.Ext;
import com.gwtext.client.core.Margins;
import com.gwtext.client.core.RegionPosition;
import com.gwtext.client.widgets.HTMLPanel;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.PanelListenerAdapter;
import com.gwtext.client.widgets.layout.BorderLayout;
import com.gwtext.client.widgets.layout.BorderLayoutData;
import com.gwtext.client.widgets.layout.CardLayout;
/**
* <b>ApplicationViewFacade</b>
* <p>
* Main point for managing application layout and views. Enable/disable
* interaction with user for center frame and etc.
*/
public class ApplicationViewFacade {
/** Single instance of ApplicationViewFacade. */
private static final ApplicationViewFacade facade = new ApplicationViewFacade();
/** Text for load indicator */
private static final String LOAD_TEXT = ApplicationMessages.MESSAGES.loadingMask();
/** Main border layout panel */
private final Panel layout;
/** Center panel of content */
private Panel centerPanel;
/**
* Default Constructor. Creates empty main border layout of the application.
*/
private ApplicationViewFacade() {
layout = createBorderLayout();
}
/**
* Clean center panel content and loads default view.
*/
public static void cleanAll() {
createDefaultView();
}
/**
* Returns instance of the center panel.
*
* @return instance of the center panel.
*/
public static Panel getCenterPanel() {
return facade.centerPanel;
}
/**
* Creates default view.
*/
public static void createDefaultView() {
DefaultViewImpl.createView();
}
/**
* Returns the main panel of the whole application.
*
* @return the main panel of the whole application.
*/
public static Panel getApplicationLayout() {
return facade.layout;
}
/**
* Mask all size of client's window (disable all user interaction with
* interface).
* @param text, text to be shown
*/
public static void maskAll(String text) {
if (text==null || "".equals(text)) facade.layout.getEl().mask();
else facade.layout.getEl().mask(text);
// Hack for IE. IE doesn't resize mask element.
if (Ext.isIE()) {
Window.addWindowResizeListener(maskResizeListener);
}
}
/**
* Discards the masking of size client's window .
*/
public static void unmaskAll() {
facade.layout.getEl().unmask();
unMaskCenter();
// Hack for IE. IE doesn't resize mask element.
if (Ext.isIE()) {
Window.removeWindowResizeListener(maskResizeListener);
}
}
/**
* Mask center panel (disable all user interaction with center panel
* elements).
*/
public static void maskCenter() {
facade.centerPanel.getEl().mask(LOAD_TEXT);
// Hack for IE. IE doesn't resize mask element.
if (Ext.isIE()) {
Window.addWindowResizeListener(maskResizeListener);
}
}
/**
* Discards the masking of the center panel.
*/
public static void unMaskCenter() {
facade.centerPanel.getEl().unmask();
// Hack for IE. IE doesn't resize mask element.
if (Ext.isIE()) {
Window.removeWindowResizeListener(maskResizeListener);
}
}
/**
* @deprecated
* Check if center currently masked now.
*
* @return true if masked.
*/
public static boolean isMaskedCenter() {
return facade.centerPanel.getEl().isMasked();
}
/**
* @deprecated
* Removes all components from center panel.
*/
public static void cleanCenterPanel() {
facade.centerPanel.removeAll(true);
}
/**
* Adds new panel to the center panel.
*
* @param newPanel - panel, have to be added.
*/
public static void addCenterPanel(Panel newPanel) {
facade.showScreen(newPanel);
facade.centerPanel.doLayout();
unmaskAll();
}
/**
* Process the action of selection some entry from navigation panel.
*/
public static void processStack(final NavigatorEntryTO navigatorEntryTO) {
// maskCenter();
if (navigatorEntryTO.isRoot()) {
Engine.getClient().getApplicationData(UserSessionBean.getApplConfigBeanInstance(),
navigatorEntryTO,
ApplicationMessages.MESSAGES.otherOperationsGraphic(), getAppDataCallback());
} else if (navigatorEntryTO.isSQL()) {
Engine.getClient().getSqlViewData(UserSessionBean.getApplConfigBeanInstance(),
navigatorEntryTO, getSqlDataCallback());
} else if (Constants.MODULE_LAST_INV.equals(navigatorEntryTO.getModuleType())) {
Engine.getClient().getOtherViewData(UserSessionBean.getApplConfigBeanInstance(),
navigatorEntryTO,
ApplicationMessages.MESSAGES.otherOperationsGraphic(),
getLastInvDataCallback());
} else {
Engine.getClient().getOtherViewData(UserSessionBean.getApplConfigBeanInstance(),
navigatorEntryTO,
ApplicationMessages.MESSAGES.otherOperationsGraphic(),
getOtherDataCallback());
}
}
/**
* Method showScreen ...
*
* @param panel of type Panel
*/
public void showScreen(Panel panel) {
String panelID = panel.getId();
CardLayout cardLayout = (CardLayout) centerPanel.getLayout();
if (centerPanel.getComponent(panelID) == null){
centerPanel.add(panel);
}
cardLayout.setActiveItem(panelID);
}
/**
* Builds empty main application layout based on BorderLayout
*
* @return application Layout.
*/
private Panel createBorderLayout() {
Panel borderPanel = new Panel();
borderPanel.setLayout(new BorderLayout());
Panel northPanel = HeaderPanel.getInstance();
northPanel.setAutoHeight(true);
// northPanel.setAutoEl(autoEl)
// northPanel.setBufferResize(bufferResize)
// northPanel.setFloating(floating)
borderPanel.add(northPanel, new BorderLayoutData(RegionPosition.NORTH));
HTMLPanel southPanel = new HTMLPanel();
southPanel.setId("footer");
southPanel.setBaseCls("footer");
southPanel.setHtml(ApplicationMessages.MESSAGES.footerContentLabel());
BorderLayoutData southData = new BorderLayoutData(RegionPosition.SOUTH);
southData.setMargins(new Margins(0, 0, 0, 0));
borderPanel.add(southPanel, southData);
final BorderLayoutData westData = new BorderLayoutData(RegionPosition.WEST);
westData.setSplit(true);
westData.setMinSize(200);
westData.setMinWidth(200);
westData.setMaxSize(350);
Panel westPanel = StackPanelHolder.getInstance();
westPanel.setWidth(200);
borderPanel.add(westPanel, westData);
final BorderLayoutData centerData = new BorderLayoutData(RegionPosition.CENTER);
centerData.setMinSize(250);
centerData.setMinWidth(250);
centerData.setMinHeight(250);
centerPanel = new Panel();
centerPanel.setBorder(false);
centerPanel.setBodyBorder(false);
centerPanel.setAutoDestroy(false);
centerPanel.addListener(new PanelListenerAdapter() {
// it fires when splitter is moved (splitter between center panel
// and navigator)
public void onBodyResize(Panel panel, String width, String height) {
WindowResizeManagerFactory.getResizeManager(
WindowResizeManagerFactory.GRIDS_MANAGER).fireResize();
}
});
// final FitLayout fitLayout = new FitLayout();
centerPanel.setLayout(new CardLayout());
borderPanel.add(centerPanel, centerData);
return borderPanel;
}
/**
* This is special resize listener for IE, because IE does not correctly
* resize masking element.
*/
private static WindowResizeListener maskResizeListener = new AbstractResizeListener() {
public void resize(int w, int h) {
try {
if (ApplicationViewFacade.getApplicationLayout().getEl() != null
&& ApplicationViewFacade.getApplicationLayout().getEl().isMasked()) {
ApplicationViewFacade.unmaskAll();
ApplicationViewFacade.maskAll(LOAD_TEXT);
} else if (ApplicationViewFacade.getCenterPanel().getEl() != null
&& ApplicationViewFacade.getCenterPanel().getEl().isMasked()) {
ApplicationViewFacade.unMaskCenter();
ApplicationViewFacade.maskCenter();
}
} catch (Exception e) {
GWT.log("Mask resize listener failed. ", e);
}
}
};
/**
* Callback for Application view.
*/
// private static AsyncCallback appDataCallback = new CacheAsyncCallback() {
//
// public void atSuccess(Object result) {
// AbstractApplicationLayer.buildView((ApplicationViewTO) result);
// }
//
// public void doFailure(Throwable caught) {
//
// }
//
// };
/**
* Callback for Application view.
*/
private static AsyncCallback getAppDataCallback(){
return new CacheAsyncCallback() {
public void atSuccess(Object result) {
AbstractApplicationLayer.buildView((ApplicationViewTO) result);
}
public void doFailure(Throwable caught) {
}
};
}
/**
* Callback for Other view.
*/
// private static AsyncCallback otherDataCallback = new CacheAsyncCallback() {
//
// public void atSuccess(Object result) {
//
// OtherLayerViewImpl.buildView((OtherViewTO) result);
//
// }
//
// public void doFailure(Throwable caught) {
//
// }
// };
/**
* Callback for Other view.
*/
private static AsyncCallback getOtherDataCallback(){
return new CacheAsyncCallback() {
public void atSuccess(Object result) {
OtherLayerViewImpl.buildView((OtherViewTO) result);
}
public void doFailure(Throwable caught) {
}
};
}
/**
* Callback for Other view of last invocations module
*/
// private static AsyncCallback lastInvDataCallback = new CacheAsyncCallback() {
//
// public void atSuccess(Object result) {
// LastInvocationViewImpl.buildView((OtherViewTO) result);
//
// }
//
// public void doFailure(Throwable caught) {
//
// }
// };
/**
* Callback for Other view of last invocations module
*/
private static AsyncCallback getLastInvDataCallback(){
return new CacheAsyncCallback() {
public void atSuccess(Object result) {
LastInvocationViewImpl.buildView((OtherViewTO) result);
}
public void doFailure(Throwable caught) {
}
};
}
/**
* Callback for SQL view.
*/
// private static AsyncCallback sqlDataCallback = new CacheAsyncCallback() {
//
// public void atSuccess(Object result) {
// SQLLayerViewImpl.getInstance().createView((SqlViewTO) result);
// }
//
// public void doFailure(Throwable caught) {
// ApplicationViewFacade.unMaskCenter();
// }
// };
/**
* Callback for SQL view.
*/
private static AsyncCallback getSqlDataCallback(){
return new CacheAsyncCallback() {
public void atSuccess(Object result) {
SQLLayerViewImpl.getInstance().createView((SqlViewTO) result);
}
public void doFailure(Throwable caught) {
ApplicationViewFacade.unMaskCenter();
}
};
}
}
| [
"anyframe@samsung.com"
] | anyframe@samsung.com |
a20fb8df1cf96af09022fa4414e30b0b373d37b6 | f17bad2309c127ce592510b8c7ef959fd7701da3 | /Location Management/src/main/java/com/rohit/location/LocationwebApplication.java | df815aff5fbf61ba7e375304ca78b4f2fa75b12e | [] | no_license | rk-javahub/SpringBoot-Data-REST-and-WEB-CRUD | c7b227f1c1ad8cc4dd8e4986512c75a9703375d8 | cbd70a9b2e70cb6a46cfc4fd1ed4f7edf6a19455 | refs/heads/master | 2022-11-24T18:38:58.885717 | 2020-07-25T09:40:02 | 2020-07-25T09:40:02 | 282,391,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.rohit.location;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class LocationwebApplication {
public static void main(String[] args) {
SpringApplication.run(LocationwebApplication.class, args);
}
}
| [
"kumbharrohit13@gmail.com"
] | kumbharrohit13@gmail.com |
14049984c5e9007ceba8b84eda61fa7822899224 | 5dbd2111af923e283be263f0f0ebf919f6e23e16 | /app/src/main/java/com/example/finalapp_axel_kaleb/FragmentoCita.java | a87ab5ff1f56fe9ed7047ccc71389ed655f75e4b | [] | no_license | Kal28Diaz/AdministracionVentasCarros | c99230090d13e6d0c4689e3d685b0d21332734c5 | 35e6e22cb2e931e529a77ced9a5b91ec0297c41a | refs/heads/master | 2023-06-15T23:48:51.676664 | 2021-07-13T20:19:47 | 2021-07-13T20:19:47 | 385,723,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,254 | java | package com.example.finalapp_axel_kaleb;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TimePicker;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.UUID;
public class FragmentoCita extends Fragment {
private static final String PARAMETRO_CITA = "parametrocitaid";
private Cita mCita;
private EditText mTitulo;
private Button mBotonVolver, mBotonFecha, mBotonHora;
private UUID mCitaID;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCitaID = (UUID) getArguments().getSerializable(PARAMETRO_CITA);
mCita = AlmacenamientoCitas.ObtenerAlmacenamientoCitas(getActivity()).ObtenerCita(mCitaID);
setHasOptionsMenu(true);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.cita, container, false);
//Wiring Up
mTitulo = v.findViewById(R.id.titulo_cita_xd);
mBotonFecha = v.findViewById(R.id.boton_fecha_cita);
mBotonHora = v.findViewById(R.id.boton_hora_cita);
mBotonVolver = v.findViewById(R.id.boton_volver_6);
//Default
mTitulo.setText(mCita.getTitulo());
if(mCita.getFecha() != null){
mBotonFecha.setText(mCita.getFecha());
}
if(mCita.getHora() != null){
mBotonHora.setText(mCita.getHora());
}
//Actualizacion de la info del Edit Text del titulo de la cita
mTitulo.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
mCita.setTitulo(s.toString());
}
@Override
public void afterTextChanged(Editable s) {
}
});
//Actualizacion de la info del boton de la Fecha de la cita
mBotonFecha.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Calendar calendario = Calendar.getInstance();
int yy = calendario.get(Calendar.YEAR);
int mm = calendario.get(Calendar.MONTH);
int dd = calendario.get(Calendar.DAY_OF_MONTH);
DatePickerDialog datePicker = new DatePickerDialog(getActivity(), new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, year);
c.set(Calendar.MONTH, month);
c.set(Calendar.DAY_OF_MONTH, dayOfMonth);
String mFecha = DateFormat.getDateInstance().format(c.getTime());
mBotonFecha.setText("Fecha de la cita: " + mFecha);
mCita.setFecha(mBotonFecha.getText().toString());
}
}, yy, mm, dd);
datePicker.show();
}
});
//Actualizacion de la info del Boton de la Hora de la cita
mBotonHora.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Calendar calendario = Calendar.getInstance();
int hh = calendario.get(Calendar.HOUR_OF_DAY);
int mm = calendario.get(Calendar.MINUTE);
TimePickerDialog timePicker = new TimePickerDialog(getActivity(), new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, hourOfDay);
c.set(Calendar.MONTH, minute);
if(hourOfDay<10){
if(minute<10){
mBotonHora.setText("Hora de la cita: 0" + hourOfDay + ":0" + minute);
}
else{
mBotonHora.setText("Hora de la cita: 0" + hourOfDay + ":" + minute);
}
}
else{
if(minute<10){
mBotonHora.setText("Hora de la cita: " + hourOfDay + ":0" + minute);
}
else{
mBotonHora.setText("Hora de la cita: " + hourOfDay + ":" + minute);
}
}
mCita.setHora(mBotonHora.getText().toString());
}
}, hh, mm, android.text.format.DateFormat.is24HourFormat(getActivity()));
timePicker.show();
}
});
mBotonVolver.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = ActividadListaCitas.newIntentCita(getActivity(), UUID.fromString(mCita.getmIDTramite()));
startActivity(intent);
}
});
return v;
}
@Override
public void onPause() {
super.onPause();
AlmacenamientoCitas.ObtenerAlmacenamientoCitas(getActivity()).ActualizarCita(mCita);
}
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.menu_fragmento_cita, menu);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch(item.getItemId()){
case R.id.eliminar_cita:
Cita cita = mCita;
AlmacenamientoCitas.ObtenerAlmacenamientoCitas(getActivity()).EliminarCita(cita);
getActivity().onBackPressed();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
public static FragmentoCita newInstance (UUID citaID){
Bundle arguments = new Bundle();
arguments.putSerializable(PARAMETRO_CITA, citaID);
FragmentoCita fragmentoCita = new FragmentoCita();
fragmentoCita.setArguments(arguments);
return fragmentoCita;
}
}
| [
"80556790+Kal28Diaz@users.noreply.github.com"
] | 80556790+Kal28Diaz@users.noreply.github.com |
2ab5c1585846efe9177092c9b7d94b021237a2b3 | 15d038d7904d0859bd6fe884cd02276a7bf6aab5 | /2017-april/4.strategy-pattern/src/com/alg/dp/project3/solution1/Test.java | b14511373f0923232c6609c165381c8598196ac0 | [] | no_license | DharmendraPrajapati/design-patterns | e9246b672d56d73fa915e7d5e35a4deed50760cc | 3e2bc6b7ad5ac46884d40b7938c09484be2ee12f | refs/heads/master | 2022-02-15T21:17:36.971028 | 2019-09-15T03:57:38 | 2019-09-15T03:57:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package com.alg.dp.project3.solution1;
public class Test {
public static void main(String[] args) {
int[] in = {10, 6, 7, 8, 3};
Sorter sorter = new Sorter(in);
sorter.sort("bubble_sort");
sorter.sort("merge_sort");
}
}
| [
"info@algorithmica.co.in"
] | info@algorithmica.co.in |
af51c5b8b0f073229180c318c6973ff5422e72d5 | 5ead078bf1ee8d1777e6c92d0876cd2b486455f5 | /trolol/src/trolol/collection.java | 4be06ba8960fe3946aa509e6e796c3ad7fb22dbb | [] | no_license | cykamancer/workspace | 6781de7dd0d4275753d137d27138881170824889 | a8fad17f035011552232b07ad17e8573ce291404 | refs/heads/master | 2016-09-05T09:45:17.077119 | 2014-03-10T01:49:50 | 2014-03-10T01:49:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 46 | java | package trolol;
public class collection {
}
| [
"danny.zhou@utoronto.ca"
] | danny.zhou@utoronto.ca |
426cf32c3dc84e5f6cc2c21d62ee96de81f156ed | 85dd05d0b1d345e6bae281942cc288bc4422a602 | /src/main/java/com/aaron/section_seckill/service/TakeService.java | 5960170fbed5f90424f552f172e80e488d43a71b | [] | no_license | uncleAaron/section_seckill | 624afc2a06e0db84901e533ff21f274bc06f706d | fe01cee4beb33f8242187baccf8f08d81265703d | refs/heads/master | 2020-03-28T15:16:32.004615 | 2018-09-13T03:23:44 | 2018-09-13T03:23:44 | 148,574,502 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | package com.aaron.section_seckill.service;
import com.aaron.section_seckill.entity.Takes;
import com.aaron.section_seckill.exception.TakeException;
/**
* <p>
* for section_manage
* </p>
*
* @author AaronHuang
* @since 2018/9/7
*/
public interface TakeService {
public boolean takeSection(Takes takes) throws TakeException;
/**
* 选课结束状态,从mysql获取并使用redis暂存选课状态信息,key为switch,value为true false
* @return
*/
public boolean getTakeStatus();
public boolean saveOrSetTakeStatus(boolean status);
int checkSuccess(String stuid, String secid);
}
| [
"uncleaaron@foxmail.com"
] | uncleaaron@foxmail.com |
22a623edd6cbc9bfda9eebbd3523bf771696222b | f1a705b3af0fee41b44cd66ce453e5d76051d215 | /app/src/main/java/com/lh/imbilibili/view/adapter/categoryfragment/PartionChildRecyclerViewAdapter.java | e72b0b9a07088dc6027c41e5f870ffcc66792f4e | [] | no_license | 1757526725/IMBiliBili-1 | 68383ffa7e1f812f4c679cbf74e6053a1edd8c19 | b255903c190d23603ca49df639f2f6561677c086 | refs/heads/master | 2020-09-27T10:38:30.103950 | 2016-10-19T16:00:27 | 2016-10-19T16:00:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,063 | java | package com.lh.imbilibili.view.adapter.categoryfragment;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
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.bumptech.glide.Glide;
import com.lh.imbilibili.R;
import com.lh.imbilibili.model.PartionHome;
import com.lh.imbilibili.model.PartionVideo;
import com.lh.imbilibili.utils.StringUtils;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by liuhui on 2016/10/1.
*/
public class PartionChildRecyclerViewAdapter extends RecyclerView.Adapter {
private static final int TYPE_HOT_HEAD = 1;
private static final int TYPE_HOT_ITEM = 2;
private static final int TYPE_NEW_HEAD = 3;
private static final int TYPE_NEW_ITEM = 4;
private PartionHome mPartionHomeData;
private List<PartionVideo> mNewVideos;
private OnVideoItemClickListener mOnVideoItemClickListener;
private Context mContext;
private List<Integer> mTypeList;
public PartionChildRecyclerViewAdapter(Context context) {
mContext = context;
mTypeList = new ArrayList<>();
}
public void setOnVideoItemClickListener(OnVideoItemClickListener listener) {
mOnVideoItemClickListener = listener;
}
public void addNewVideos(List<PartionVideo> newVideos) {
if (newVideos == null) {
return;
}
if (mNewVideos == null) {
mNewVideos = newVideos;
} else {
mNewVideos.addAll(newVideos);
}
}
public void setPartionHomeData(PartionHome partionHomeData) {
mPartionHomeData = partionHomeData;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
RecyclerView.ViewHolder viewHolder = null;
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
switch (viewType) {
case TYPE_HOT_HEAD:
case TYPE_NEW_HEAD:
viewHolder = new HeadHolder(new TextView(parent.getContext()));
break;
case TYPE_HOT_ITEM:
case TYPE_NEW_ITEM:
viewHolder = new VideoHolder(inflater.inflate(R.layout.video_list_item, parent, false));
break;
}
return viewHolder;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
int type = getItemViewType(position);
if (type == TYPE_HOT_HEAD) {
HeadHolder headHolder = (HeadHolder) holder;
headHolder.mHeadName.setText("最热视频");
} else if (type == TYPE_HOT_ITEM) {
VideoHolder videoHolder = (VideoHolder) holder;
int realPosition = position - mTypeList.indexOf(TYPE_HOT_ITEM);
PartionVideo video = mPartionHomeData.getRecommend().get(realPosition);
Glide.with(mContext).load(video.getCover()).asBitmap().into(videoHolder.mIvCover);
videoHolder.mTvTitle.setText(video.getTitle());
videoHolder.mTvAuthor.setText(video.getName());
videoHolder.mTvInfoViews.setText(StringUtils.formateNumber(video.getPlay()));
videoHolder.mTvInfoDanmakus.setText(StringUtils.formateNumber(video.getDanmaku()));
videoHolder.mTvPayBadge.setVisibility(View.GONE);
videoHolder.mAid = video.getParam();
} else if (type == TYPE_NEW_HEAD) {
HeadHolder headHolder = (HeadHolder) holder;
headHolder.mHeadName.setText("最新视频");
} else if (type == TYPE_NEW_ITEM) {
VideoHolder videoHolder = (VideoHolder) holder;
int realPosition = position - mTypeList.indexOf(TYPE_NEW_ITEM);
PartionVideo video = mNewVideos.get(realPosition);
Glide.with(mContext).load(video.getCover()).asBitmap().into(videoHolder.mIvCover);
videoHolder.mTvTitle.setText(video.getTitle());
videoHolder.mTvAuthor.setText(video.getName());
videoHolder.mTvInfoViews.setText(StringUtils.formateNumber(video.getPlay()));
videoHolder.mTvInfoDanmakus.setText(StringUtils.formateNumber(video.getDanmaku()));
videoHolder.mTvPayBadge.setVisibility(View.GONE);
videoHolder.mAid = video.getParam();
}
}
@Override
public int getItemCount() {
mTypeList.clear();
if (mPartionHomeData != null && mPartionHomeData.getRecommend() != null && mPartionHomeData.getRecommend().size() > 0) {
mTypeList.add(TYPE_HOT_HEAD);
for (int i = 0; i < mPartionHomeData.getRecommend().size(); i++) {
mTypeList.add(TYPE_HOT_ITEM);
}
}
if (mNewVideos != null && mNewVideos.size() > 0) {
mTypeList.add(TYPE_NEW_HEAD);
for (int i = 0; i < mNewVideos.size(); i++) {
mTypeList.add(TYPE_NEW_ITEM);
}
}
return mTypeList.size();
}
@Override
public int getItemViewType(int position) {
return mTypeList.get(position);
}
private class HeadHolder extends RecyclerView.ViewHolder {
private TextView mHeadName;
HeadHolder(View itemView) {
super(itemView);
mHeadName = (TextView) itemView;
}
}
@SuppressWarnings("WeakerAccess")
class VideoHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
@BindView(R.id.cover)
ImageView mIvCover;
@BindView(R.id.pay_badge)
TextView mTvPayBadge;
@BindView(R.id.title)
TextView mTvTitle;
@BindView(R.id.author)
TextView mTvAuthor;
@BindView(R.id.info_views)
TextView mTvInfoViews;
@BindView(R.id.info_danmakus)
TextView mTvInfoDanmakus;
@BindView(R.id.text2)
TextView mTvSecond;
private String mAid;
VideoHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
int tintColor = ContextCompat.getColor(mContext, R.color.gray_dark);
Drawable drawableCompat = DrawableCompat.wrap(mTvInfoViews.getCompoundDrawables()[0]);
DrawableCompat.setTint(drawableCompat, tintColor);
drawableCompat = DrawableCompat.wrap(mTvInfoDanmakus.getCompoundDrawables()[0]);
DrawableCompat.setTint(drawableCompat, tintColor);
itemView.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (mOnVideoItemClickListener != null) {
mOnVideoItemClickListener.onVideoClick(mAid);
}
}
}
public interface OnVideoItemClickListener {
void onVideoClick(String aid);
}
}
| [
"1585086582@qq.com"
] | 1585086582@qq.com |
6e3ca5848c6834e5d3de0a29a1c47718a28c17b6 | 4eb5d7824e8787a46d00c42b19b306a67561c418 | /src/main/java/com/appstude/SecurityFilter.java | d8d040cacb9fad828ef043f748e7a8a447adbc8d | [] | no_license | issemgane/SpringBoot | bf1c905c2e7bdf9bcdd367efd42f03a0457aa33b | 58a57895b9a5fe611c28aa47f4e158f20e8885a2 | refs/heads/master | 2020-12-13T22:37:35.236644 | 2017-06-26T15:17:05 | 2017-06-26T15:17:05 | 95,457,820 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,017 | java | package com.appstude;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled=true)
public class SecurityFilter extends WebSecurityConfigurerAdapter {
@Autowired
DataSource dataSource;
@Autowired
public void globalConfig(AuthenticationManagerBuilder auth) throws Exception{
// auth.inMemoryAuthentication().withUser("admin").password("123").roles("PROF", "ADMIN");
// auth.inMemoryAuthentication().withUser("ana").password("123").roles("PROF");
auth.jdbcAuthentication()
.dataSource(dataSource)
.usersByUsernameQuery("select username as principal, password as credentials , true from user where username = ?")
.authoritiesByUsernameQuery("select user_username as principal, roles_name as role from users_roles where user_username = ?")
.rolePrefix("ROLE_");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/css/**","/fonts/**","/js/**","/images/**").permitAll()
.anyRequest()
.authenticated()
.and()
.formLogin()
.loginPage("/login") //go to Login
.permitAll() //autoriser le formulaire
.defaultSuccessUrl("/index.html")
.and()
.logout()
.invalidateHttpSession(true)
.logoutUrl("/logout")
.permitAll();
//.failureUrl("/error");
}
}
| [
"ali.issemgane@gmail.com"
] | ali.issemgane@gmail.com |
75ad24384bd1287e5436a8fe86289545b0601b54 | 2cba37654565ee5174f03b0bd0ef20e8ade897de | /src/automationFramework/ExcelReader.java | b81e58440d8045dd7817201de3284ee12e6433dd | [] | no_license | imskgaurav/SunloverConsumer | a21d3844ea82f23847612636e18abbf967709e81 | 315d1bf4e861f98d0334702501e953c70c90726f | refs/heads/master | 2023-06-13T04:57:57.176304 | 2021-06-22T18:10:48 | 2021-06-22T18:10:48 | 379,359,290 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,261 | java | package automationFramework;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ExcelReader {
public static class ExcelUtils {
private static XSSFSheet ExcelWSheet;
private static XSSFWorkbook ExcelWBook;
private static XSSFCell Cell;
private static XSSFRow Row;
// This method is to set the File path and to open the Excel file, Pass
// Excel Path and Sheetname as Arguments to this method
/**
* @param Path
* @param SheetName
* @throws Exception
*/
public void setExcelFile(String Path, String SheetName) throws Exception {
try {
// Open the Excel file
FileInputStream ExcelFile = new FileInputStream(Path);
// Access the required test data sheet
ExcelWBook = new XSSFWorkbook(ExcelFile);
ExcelWSheet = ExcelWBook.getSheet(SheetName);
} catch (Exception e) {
throw (e);
}
}
// This method is to read the test data from the Excel cell, in this we
// are passing parameters as Row num and Col num
public String getCellData(int RowNum, int ColNum) throws Exception {
try {
Cell = ExcelWSheet.getRow(RowNum).getCell(ColNum);
String CellData = Cell.getStringCellValue();
return CellData;
} catch (Exception e) {
return "";
}
}
// This method is to write in the Excel cell, Row num and Col num are
// the parameters
public void setCellData(String Result, int RowNum, int ColNum) throws Exception {
try {
Row = ExcelWSheet.getRow(RowNum);
Cell = Row.getCell(ColNum, org.apache.poi.ss.usermodel.Row.RETURN_BLANK_AS_NULL);
if (Cell == null) {
Cell = Row.createCell(ColNum);
Cell.setCellValue(Result);
} else {
Cell.setCellValue(Result);
}
// Constant variables Test Data path and Test Data file name
FileOutputStream fileOut = new FileOutputStream(
EnvConfiguration.Path_TestData + EnvConfiguration.File_TestData);
ExcelWBook.write(fileOut);
fileOut.flush();
fileOut.close();
} catch (Exception e) {
throw (e);
}
}
}
}
| [
"shashikant.gaurav@gmail.com"
] | shashikant.gaurav@gmail.com |
bc2ba3e5419c6d18157bf7bbb1db2210549e0e17 | df7da4ededb021563d11528d5da711adb54198e9 | /lib/src/com/qinxiaoyu/lib/transmit/net/udp/EXAMPLE/NioServer.java | 08ad32540bf787b50350270e43e97a5065fa3797 | [] | no_license | XiaoYuQin/privateLib | b9cd5a334178f95dc95562384d2bd56360bee634 | 5cd0d86080a42155fc3f8052cfb217237561af03 | refs/heads/master | 2016-08-12T09:37:00.075227 | 2016-04-26T01:30:58 | 2016-04-26T01:30:58 | 54,254,025 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,221 | java | package com.qinxiaoyu.lib.transmit.net.udp.EXAMPLE;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.Iterator;
public class NioServer {
private static final int TIMEOUT = 4000; // 超时 (毫秒)
private static final int CAPACITY = 255;
public static void main(String[] args) throws IOException {
args = new String[1];
args[0] = "4451";
Selector sel = Selector.open(); // 创建选择器,可以处理多路通道。
DatagramChannel channel = DatagramChannel.open();
channel.configureBlocking(false);
channel.socket().bind(new InetSocketAddress(8300)); // 通道关联的socket绑定地址
channel.register(sel, SelectionKey.OP_READ, new ClientData());
while (true) { // 持续运行,接收和返回数据
if (sel.select(TIMEOUT) == 0) {
System.out.println("No I/O needs to be processed");
continue;
}
Iterator<SelectionKey> iter = sel.selectedKeys().iterator(); // 获取可操作的选择键集合
while (iter.hasNext()) {
SelectionKey key = iter.next(); // 键为位掩码
if (key.isReadable()) { // 客户端有数据发送过来
handleRead(key);
}
if (key.isValid() && key.isWritable()) { // 通道正常,且客户端需要响应
handleWrite(key);
}
iter.remove(); // 从集合中移除选择键
}
}
}
private static void handleRead(SelectionKey key) throws IOException {
DatagramChannel channel = (DatagramChannel) key.channel();
ClientData clntDat = (ClientData) key.attachment();
clntDat.buffer.clear();
clntDat.clientAddress = channel.receive(clntDat.buffer); // 获取客户端的地址,用以发送响应
if (clntDat.clientAddress != null) { // 接收到数据
key.interestOps(SelectionKey.OP_WRITE); // 关注客户端读取响应
System.out.println("关注客户端读取响应");
}
}
private static void handleWrite(SelectionKey key) throws IOException {
DatagramChannel channel = (DatagramChannel) key.channel();
ClientData clntDat = (ClientData) key.attachment();
clntDat.buffer.flip(); // 从起始位置开始发送
int bytesSent = channel.send(clntDat.buffer, clntDat.clientAddress);
if (bytesSent != 0) {
key.interestOps(SelectionKey.OP_READ); // 关注客户端发送数据
System.out.println("关注客户端发送数据");
}
}
public static class ClientData {
public SocketAddress clientAddress;
public ByteBuffer buffer = ByteBuffer.allocate(CAPACITY);
}
}
| [
"qinxiaoyu@163.com"
] | qinxiaoyu@163.com |
3056d8502911197cb63782de626377dc86cbe837 | 6b14c59fba946f80f261fcd83ac2ceba67bbecd2 | /xill-processor/src/main/java/nl/xillio/xill/plugins/file/constructs/IsLinkConstruct.java | 3a7d391784536aa956966b7c88b23d4610bfeffc | [
"Apache-2.0"
] | permissive | xillio/xill-platform | 30c7fcef5f0508a6875e60b9ac4ff00512fc61ab | d6315b96b9d0ce9b92f91f611042eb2a2dd9a6ff | refs/heads/master | 2022-09-15T09:38:24.601818 | 2022-08-03T14:37:29 | 2022-08-03T14:37:29 | 123,340,493 | 4 | 3 | Apache-2.0 | 2022-09-08T01:07:07 | 2018-02-28T20:46:52 | JavaScript | UTF-8 | Java | false | false | 1,062 | java | /**
* Copyright (C) 2014 Xillio (support@xillio.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.xillio.xill.plugins.file.constructs;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
/**
* Tests whether a file is a symbolic link.
*
* @author Paul van der Zandt, Xillio
* @author Thomas biesaart
*/
public class IsLinkConstruct extends AbstractFlagConstruct {
@Override
protected Boolean process(Path path) throws IOException {
return Files.isSymbolicLink(path);
}
}
| [
"thomas.biesaart@outlook.com"
] | thomas.biesaart@outlook.com |
a8b410ad64399912f69703e9cd5a9407dbfd3b81 | b744ff53a507c28f0a45ec6208a576f1095b54dc | /src/main/java/demooject/Artist.java | 7273dc9023495dca282f97a93f496413b25b092f | [] | no_license | jorwen/me.jiawei.study | 856c6d3f0a7d1a41ba5addbd281381dee4798611 | 0cd6d5d4e27913fd199efd16386006670e82ab8f | refs/heads/master | 2021-12-29T07:18:18.167286 | 2021-09-24T02:24:35 | 2021-09-24T02:24:35 | 76,777,248 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 717 | java | package demooject;
import java.util.List;
/**
* 创作应约的个人或团队
*/
public class Artist {
private String name;//艺术家名字
private List<Artist> members;//乐队成员,可为空
private String origin;//来自
public List<Artist> getMembers() {
return members;
}
public void setMembers(List<Artist> members) {
this.members = members;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
}
| [
"jiawei.fjw@alibaba-inc.com"
] | jiawei.fjw@alibaba-inc.com |
69ed667e11848081d47046bf6cde45d521c2f070 | 1675deac00133ced6ffb7bf9fb07723be23cd270 | /app/src/main/java/com/janesbrain/cartracker/dialogs/ManualSaveDialog.java | 9b140bd252462888bb04e3b7f242a46930fcf56a | [] | no_license | lykkefisk/AppProject | b8d024868044502b3611dc8ec9fb2c3c22c574e3 | caa8d987c84971248f9bb04b09699fa7aee322ad | refs/heads/master | 2020-03-13T13:31:51.539161 | 2018-05-03T11:09:19 | 2018-05-03T11:09:19 | 131,140,615 | 0 | 3 | null | 2018-05-03T10:47:19 | 2018-04-26T10:39:20 | Java | UTF-8 | Java | false | false | 2,039 | java | package com.janesbrain.cartracker.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Context;
import android.os.Bundle;
import android.service.autofill.FillEventHistory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.janesbrain.cartracker.R;
// http://stacktips.com/tutorials/android/android-dialog-fragment-example
// https://developer.android.com/guide/topics/ui/dialogs
public class ManualSaveDialog extends DialogFragment {
private String typedAddress = "";
public String GetTypedAddess(){
return typedAddress;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle b) {
final View root = inflater.inflate(R.layout.manual_address, null);
Button ok = root.findViewById(R.id.saveManualButton);
// TODO set up the rest of the views
// i have no idea wwhih view is which id
// took me 20 minutes to find the and correct the two buttons
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(v.getContext(),
"NOT DOING ANYTHING\r\nPRESS CANCEL", Toast.LENGTH_LONG).show();
// EditText txt = root.findViewById(R.id.addressEditText);
// typedAddress = txt.getText().toString();
// TODO ... fix the ids in all the layouts
// the id's are cross referenced.. BAD PUPPY!
}
});
Button cancel = root.findViewById(R.id.cancelManualButton);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getDialog().dismiss();
}
});
return root;
}
}
| [
"jkrisager@gmail.com"
] | jkrisager@gmail.com |
646b73df5f813c2db391524c6d1299c9a081325d | 7f20b1bddf9f48108a43a9922433b141fac66a6d | /core3/impl/tags/impl-parent-3.0.0-alpha8/layout-cytoscape-impl/src/main/java/csapps/layout/algorithms/graphPartition/ISOMLayout.java | 25f5cbd3b7e0d8b3968b3502fdfb03a69957770b | [] | no_license | ahdahddl/cytoscape | bf783d44cddda313a5b3563ea746b07f38173022 | a3df8f63dba4ec49942027c91ecac6efa920c195 | refs/heads/master | 2020-06-26T16:48:19.791722 | 2013-08-28T04:08:31 | 2013-08-28T04:08:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,054 | java | /*
* This is based on the ISOMLayout from the JUNG project.
*/
package csapps.layout.algorithms.graphPartition;
import java.util.Set;
import org.cytoscape.model.CyNode;
import org.cytoscape.view.layout.AbstractLayoutAlgorithm;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.View;
import org.cytoscape.work.TaskIterator;
import org.cytoscape.work.undo.UndoSupport;
public class ISOMLayout extends AbstractLayoutAlgorithm {
/**
* Creates a new ISOMLayout object.
*/
public ISOMLayout(UndoSupport undo) {
super("isom", "Inverted Self-Organizing Map Layout", undo);
}
public TaskIterator createTaskIterator(CyNetworkView networkView, Object context, Set<View<CyNode>> nodesToLayOut,String attrName) {
return new TaskIterator(new ISOMLayoutTask(getName(), networkView, nodesToLayOut, (ISOMLayoutContext) context, attrName, undoSupport));
}
@Override
public Object createLayoutContext() {
return new ISOMLayoutContext();
}
@Override
public boolean getSupportsSelectedOnly() {
return true;
}
}
| [
"mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5"
] | mes@0ecc0d97-ab19-0410-9704-bfe1a75892f5 |
1b709a102e1a03b9bc9b82f9137bb8953b6e2129 | d324feff4d9032d8c487791b26b314e87ebd86d0 | /src/main/java/cn/com/study/springbootMyties/entity/UserEntity.java | f9f09bdef700a74fd043c15be6f6289f7a6d965b | [] | no_license | mixintu/springBoot-Mybties | d2cac870af534f2cc1ca8c4287f1896a75b0c3be | 989c7050d8c64a7d054d2628f6dbf9c78726b9d9 | refs/heads/master | 2022-09-15T06:37:15.569454 | 2020-05-31T09:34:49 | 2020-05-31T09:34:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 784 | java | package cn.com.study.springbootMyties.entity;
public class UserEntity {
protected Integer id ;
protected String magicId ;
protected String firstName ;
protected String lastName ;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getMagicId() {
return magicId;
}
public void setMagicId(String magicId) {
this.magicId = magicId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
| [
"1372554219@qq.com"
] | 1372554219@qq.com |
b5b802febb304e89f887f315a7f905cbd9ea948c | 3cb7c937898964ec82f9d8feb50eec6fab4f35ab | /MPC/src/autonomous/nav/Controls.java | 017c9e0d1c8f18a78a4bb3955144b6047878b66f | [] | no_license | kdjosk/AutonomousCarSim | daabf9593984c3fa1892fbba711a3e34bb056bc3 | 660835e0a4675219936b72d6df5ad7e974187752 | refs/heads/master | 2020-09-07T12:58:05.200899 | 2020-04-27T21:29:06 | 2020-04-27T21:29:06 | 220,787,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,000 | java | package autonomous.nav;
import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
import java.io.Serializable;
public class Controls implements Serializable {
double delta;
double velocity;
double acceleration;
Vector2D[] predictedPath;
Vector2D[] polynomialFit;
public Controls(double delta, double velocity, double acceleration, Vector2D[] predictedPath, Vector2D[] polynomialFit) {
this.delta = delta;
this.velocity = velocity;
this.acceleration = acceleration;
this.predictedPath = predictedPath.clone();
this.polynomialFit = polynomialFit.clone();
}
public double getDelta() {
return delta;
}
public double getAcceleration() {
return acceleration;
}
public double getVelocity() {
return velocity;
}
public Vector2D[] getPolynomialFit() {
return polynomialFit;
}
public Vector2D[] getPredictedPath() {
return predictedPath;
}
}
| [
"krzysztof.josk@gmail.com"
] | krzysztof.josk@gmail.com |
6668d5620be73fe6d2c6f0e07647a89b4d8c410d | d939455f557cd9eda2619fd812025d8e19b083e3 | /Java/src/com/longluo/leetcode/math/Problem479_largestPalindromeProduct.java | 709748cf6bd7e6c5b437335b0bc024b781722f72 | [
"MIT"
] | permissive | longluo/leetcode | 61d445bd4fbae13b99ea24e9ef465bb700022866 | 5a171f223c03cfdddb18488fd4bc5910039e21c4 | refs/heads/master | 2023-08-17T05:03:25.433075 | 2023-07-30T04:01:16 | 2023-07-30T04:01:16 | 58,620,185 | 58 | 20 | MIT | 2023-05-25T19:00:48 | 2016-05-12T07:52:04 | Java | UTF-8 | Java | false | false | 2,996 | java | package com.longluo.leetcode.math;
/**
* 479. 最大回文数乘积
* <p>
* 给定一个整数 n ,返回 可表示为两个 n 位整数乘积的 最大回文整数 。因为答案可能非常大,所以返回它对 1337 取余 。
* <p>
* 示例 1:
* 输入:n = 2
* 输出:987
* 解释:99 x 91 = 9009, 9009 % 1337 = 987
* <p>
* 示例 2:
* 输入: n = 1
* 输出: 9
* <p>
* 提示:
* 1 <= n <= 8
* <p>
* https://leetcode-cn.com/problems/largest-palindrome-product/
*/
public class Problem479_largestPalindromeProduct {
// TimeOut
public static int largestPalindrome(int n) {
if (n == 1) {
return 9;
}
int MOD = 1337;
int ans = 0;
int max = (int) (Math.pow(10, n) - 1);
int min = (int) (Math.pow(10, n - 1) - 1);
for (long i = (long) max * max; i >= 1; i--) {
if (isPalindrome(i)) {
for (int j = max; j >= min; j--) {
if (i % j == 0 && i / j >= min && i / j <= max) {
return (int) (i % MOD);
}
}
}
}
return ans;
}
public static boolean isPalindrome(long x) {
if (x < 0 || (x != 0 && x % 10 == 0)) {
return false;
}
long revisited = 0;
while (x > revisited) {
revisited = revisited * 10 + x % 10;
x /= 10;
}
return x == revisited || x == revisited / 10;
}
public static boolean checkPalindrome(long num) {
String numStr = String.valueOf(num);
int left = 0;
int right = numStr.length() - 1;
while (left < right) {
if (numStr.charAt(left) != numStr.charAt(right)) {
return false;
}
left++;
right--;
}
return true;
}
// Math time: O(10^2n) space: O(1)
public static int largestPalindrome_best(int n) {
if (n == 1) {
return 9;
}
int ans = 0;
int max = (int) Math.pow(10, n) - 1;
for (int i = max; ans == 0; i--) {
long num = i;
for (int j = i; j > 0; j /= 10) {
num = 10 * num + j % 10;
}
for (long x = max; x * x >= num; x--) {
if (num % x == 0) {
ans = (int) (num % 1337);
break;
}
}
}
return ans;
}
public static void main(String[] args) {
System.out.println("9 ?= " + largestPalindrome(1));
System.out.println("987 ?= " + largestPalindrome(2));
System.out.println("123 ?= " + largestPalindrome(3));
System.out.println("677 ?= " + largestPalindrome(5));
System.out.println("1218 ?= " + largestPalindrome(6));
System.out.println("987 ?= " + largestPalindrome_best(2));
System.out.println("123 ?= " + largestPalindrome_best(3));
}
}
| [
"calmbody@163.com"
] | calmbody@163.com |
2ace2168336d09c7659e4dcdd1abb9f71f556e2f | 077b08b7daa5e70fcb918a9f6df3c5b20c8386c9 | /sample/src/main/java/com/mrengineer13/floating/sample/DemoActivity.java | 8837827e49165645d724c307f2fe5ae5bec7f69e | [
"Apache-2.0"
] | permissive | jayrambhia/FloatingLabelLayout | dd35a1072bd01e519565154cb7925489642d8837 | aaa3f5c0360b37fc1ddeb0eaac388cbc34ea510b | refs/heads/master | 2021-01-23T22:19:43.202439 | 2015-03-12T12:18:43 | 2015-03-12T12:18:43 | 32,075,117 | 3 | 1 | null | 2015-03-12T12:13:38 | 2015-03-12T12:13:37 | Java | UTF-8 | Java | false | false | 1,795 | java | package com.mrengineer13.floating.sample;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import com.mrengineer13.fll.FloatingLabelEditText;
public class DemoActivity extends Activity {
public static final String FLL_KEY = "FLL";
public static final String STATE_KEY = "State";
public static final int MAX_FLLS = 10;
private LinearLayout mContainer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
mContainer = (LinearLayout) findViewById(R.id.ll_flls);
for (int i = 0; i < MAX_FLLS; i++){
FloatingLabelEditText floatingLabelEditText = new FloatingLabelEditText(DemoActivity.this);
floatingLabelEditText.setTag(FLL_KEY + i);
floatingLabelEditText.setHint(String.format("Message %d hint", i));
mContainer.addView(floatingLabelEditText);
}
}
@Override
public void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
for (int i = 0; i < MAX_FLLS; i++){
FloatingLabelEditText floatingLabelEditText = (FloatingLabelEditText) mContainer.findViewWithTag(FLL_KEY+i);
outState.putBundle(STATE_KEY + i, (Bundle) floatingLabelEditText.onSaveInstanceState());
}
}
@Override
public void onRestoreInstanceState(Bundle saveState){
super.onRestoreInstanceState(saveState);
for (int i = 0; i < MAX_FLLS; i++){
FloatingLabelEditText floatingLabelEditText = (FloatingLabelEditText) mContainer.findViewWithTag(FLL_KEY +i);
floatingLabelEditText.onRestoreInstanceState(saveState.getBundle(STATE_KEY + i));
}
}
}
| [
"MrEngineer13@users.noreply.github.com"
] | MrEngineer13@users.noreply.github.com |
09f0a71beecc4552309747655f65cf59bd878f53 | c8b1c0f8a7f597ec57c1f1d587f7c669fc20793a | /chapter-09/springboot-demo/src/main/java/com/example/demo/controller/SwaggerController.java | 6f4d6289f83580c438684f85a87ee3524caf7ef3 | [] | no_license | hapier/Spring-Boot | 9f2f1f1eab0e6595a10cc8d842cd453058c2d660 | 148995dc278283eb54b3ebf73bf6d11e462dffe0 | refs/heads/master | 2021-04-06T18:04:15.842027 | 2018-03-31T07:56:37 | 2018-03-31T07:56:37 | 124,621,584 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package com.example.demo.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping(value = "/swagger")
public class SwaggerController {
@RequestMapping("/test")
public String hello() {
return "hello,swagger!";
}
}
| [
"13667203681@163.com"
] | 13667203681@163.com |
7673ee8f492740edf69354d0e1d9cf4d6381cc5f | 1f3dbabf61ccfaf140eebabb03fb539af21852aa | /src/main/java/com/xl/algo/Square.java | bc32db837590473f1ebd176b3b37c52a133a1312 | [] | no_license | allen1128/algorithm | bfe1f25a9ff76200582b9ffea7e68805e539047c | 52d2eda0d15c8b76b27e43820925d00afce3658a | refs/heads/master | 2022-12-20T00:28:07.166605 | 2019-10-06T17:30:45 | 2019-10-06T17:30:45 | 103,569,643 | 0 | 0 | null | 2020-10-13T16:19:39 | 2017-09-14T18:51:37 | Java | UTF-8 | Java | false | false | 1,095 | java | package com.xl.algo;
public class Square {
public double mySqrt(double v) {
//watch point: add the check for edge cases.
if (v == 1.0) {
return 1;
}
if (v < 0) {
throw new IllegalArgumentException();
}
if (v == 0) {
return 0;
}
if (v < 1) {
return helper(v, 1, v);
} else {
return helper(1, v, v);
}
}
private double helper(double lower, double upper, double target) {
double precision = 0.000001;
double value = lower/ 2 + upper/ 2;
double temp = value * value;
//watch point: math.abs
if (Math.abs(temp - target) < precision) {
return value;
} else if (temp > target){
return helper(lower, value, target);
} else {
return helper(value, upper, target);
}
}
public static void main(String[] args){
Square square = new Square();
while (true) {
System.out.println(square.mySqrt(4));
}
}
}
| [
"as_allen1128@hotmail.com"
] | as_allen1128@hotmail.com |
55af87047d6ac9d7e1951f7a3161548716d71832 | 17ae2bb28ece11ce87db4bd5e804a481b613a9d3 | /src/main/java/com/beam/repository/PersistenceAuditEventRepository.java | 11f5e93fb1020b4bb7e3c6bd8773e81a95993a7a | [] | no_license | waqaskamran/beam | d32e60c026ef1424a5d8554a45485b45acd2f8df | bac9b59214d53a7f23d9418914fc5d27c3d0082d | refs/heads/master | 2022-02-24T10:05:57.265814 | 2017-11-14T12:11:26 | 2017-11-14T12:11:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 956 | java | package com.beam.repository;
import com.beam.domain.PersistentAuditEvent;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import java.time.Instant;
import java.util.List;
/**
* Spring Data JPA repository for the PersistentAuditEvent entity.
*/
public interface PersistenceAuditEventRepository extends JpaRepository<PersistentAuditEvent, Long> {
List<PersistentAuditEvent> findByPrincipal(String principal);
List<PersistentAuditEvent> findByAuditEventDateAfter(Instant after);
List<PersistentAuditEvent> findByPrincipalAndAuditEventDateAfter(String principal, Instant after);
List<PersistentAuditEvent> findByPrincipalAndAuditEventDateAfterAndAuditEventType(String principle, Instant after, String type);
Page<PersistentAuditEvent> findAllByAuditEventDateBetween(Instant fromDate, Instant toDate, Pageable pageable);
}
| [
"waqasrana11@gmail.com"
] | waqasrana11@gmail.com |
0a3fa8298acfe3abdb78b9ea426032f4b72514af | 2a787189a4df0b8308e2c822367ebe70414a16a8 | /src/default1/TestStream8.java | af4ce3bf4002b9fb8c581add8dcb755e69d17b92 | [] | no_license | xibeija/j2se | 4a70c908af91de5feb97b63a0702a73d7aa08698 | 670293d6160e655b3586f0f3cf89969a96186e88 | refs/heads/master | 2020-05-14T05:08:50.172306 | 2019-08-15T15:49:11 | 2019-08-15T15:49:11 | 181,700,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,435 | java | package default1;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class TestStream8 {
public static void removeComments(File javaFile) {
StringBuffer sb = new StringBuffer();
//读取内容
try (FileReader fr = new FileReader(javaFile); BufferedReader br = new BufferedReader(fr);) {
while (true) {
String line = br.readLine();
if (null == line)
break;
//如果不是以//开头,就保存在StringBuffer中
if (!line.trim().startsWith("//"))
sb.append(line).append("\r\n");
}
} catch (IOException e) {
e.printStackTrace();
}
try (
FileWriter fw = new FileWriter(javaFile);
PrintWriter pw = new PrintWriter(fw);
) {
//写出内容
pw.write(sb.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
File javaFile = new File("E:\\project\\j2se\\src\\character\\MyStringBuffer2.java");
System.out.println(javaFile.exists());
System.out.println(javaFile.length());
removeComments(javaFile);
}
}
| [
"xibeijia@xibeijia-PC"
] | xibeijia@xibeijia-PC |
e59d2ac3f5189a5ebd105ac399e022d0efbd3f15 | 9a6ea6087367965359d644665b8d244982d1b8b6 | /src/main/java/X/AnonymousClass3YU.java | 14d74b8cf4d55e5f1512c50297358b08dac07365 | [] | no_license | technocode/com.wa_2.21.2 | a3dd842758ff54f207f1640531374d3da132b1d2 | 3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9 | refs/heads/master | 2023-02-12T11:20:28.666116 | 2021-01-14T10:22:21 | 2021-01-14T10:22:21 | 329,578,591 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 948 | java | package X;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.search.verification.client.R;
/* renamed from: X.3YU reason: invalid class name */
public class AnonymousClass3YU extends AbstractC69443Hb {
public Button A00;
public ImageView A01;
public LinearLayout A02;
public TextView A03;
public TextView A04;
public AnonymousClass3YU(View view) {
super(view);
this.A01 = (ImageView) AnonymousClass0Q7.A0D(view, R.id.payout_bank_icon);
this.A04 = (TextView) AnonymousClass0Q7.A0D(view, R.id.payout_bank_name);
this.A03 = (TextView) AnonymousClass0Q7.A0D(view, R.id.payout_bank_status);
this.A02 = (LinearLayout) AnonymousClass0Q7.A0D(view, R.id.warning_container);
this.A00 = (Button) AnonymousClass0Q7.A0D(view, R.id.cta_button);
}
}
| [
"madeinborneo@gmail.com"
] | madeinborneo@gmail.com |
3f9bcb8347eb4243beefa1b5354979d7c405dccb | 6664f36207ec7cd62170f4a59d992617791ec9ec | /ToDoList7/src/edu/cmu/cs/webapp/todolist7/model/ItemDAO.java | ad547323bc2a6a24235e594e523003bab356f88e | [] | no_license | NingzhiWu/ToDoList7 | 00d2091ed030e7f6558079aee3ba61cf794fe023 | 3e473b3fa7ebb91a072bf1f90031ccb83bf24239 | refs/heads/master | 2021-01-01T05:41:20.064764 | 2013-01-20T16:13:54 | 2013-01-20T16:13:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,686 | java | package edu.cmu.cs.webapp.todolist7.model;
import java.util.Comparator;
import org.genericdao.ConnectionPool;
import org.genericdao.DAOException;
import org.genericdao.GenericDAO;
import org.genericdao.MatchArg;
import org.genericdao.RollbackException;
import org.genericdao.Transaction;
import edu.cmu.cs.webapp.todolist7.databean.ItemBean;
public class ItemDAO extends GenericDAO<ItemBean> {
public ItemDAO(ConnectionPool cp, String tableName) throws DAOException {
super(ItemBean.class, tableName, cp);
}
public void addToTop(ItemBean item) throws RollbackException {
try {
Transaction.begin();
// Get item at top of list
ItemBean[] a = match(MatchArg.min("position"));
ItemBean topBean;
if (a.length == 0) {
topBean = null;
} else {
topBean = a[0];
}
int newPos;
if (topBean == null) {
// List is empty...just add it with position = 1
newPos = 1;
} else {
// Create the new item with position one less than the top bean's position
newPos = topBean.getPosition() - 1;
}
item.setPosition(newPos);
// Create a new ItemBean in the database with the next id number
createAutoIncrement(item);
Transaction.commit();
} finally {
if (Transaction.isActive()) Transaction.rollback();
}
}
public void addToBottom(ItemBean item) throws RollbackException {
try {
Transaction.begin();
// Get item at bottom of list
ItemBean[] a = match(MatchArg.max("position"));
ItemBean bottomBean;
if (a.length == 0) {
bottomBean = null;
} else {
bottomBean = a[0];
}
int newPos;
if (bottomBean == null) {
// List is empty...just add it with position = 1
newPos = 1;
} else {
// Create the new item with position one more than the bottom bean's position
newPos = bottomBean.getPosition() + 1;
}
item.setPosition(newPos);
// Create a new ItemBean in the database with the next id number
createAutoIncrement(item);
Transaction.commit();
} finally {
if (Transaction.isActive()) Transaction.rollback();
}
}
public ItemBean[] getItems() throws RollbackException {
// Calls GenericDAO's match() method.
// This no match constraint arguments, match returns all the Item beans
ItemBean[] items = match();
// Sort the list in position order
java.util.Arrays.sort(items, new Comparator<ItemBean>() {
public int compare(ItemBean item1, ItemBean item2) {
return item1.getPosition() - item2.getPosition();
}
});
return items;
}
}
| [
"wuningzhi@gmail.com"
] | wuningzhi@gmail.com |
c481396f943446d77d6929729a323c81eeea1c22 | 3dc66521683a5c70945215fd775f80ab47c9c0fe | /src/main/java/service/FriendService.java | 2212cfad69dc91acd9814892e5b8f335d6d5a839 | [] | no_license | Askar-Itstep/MyWebPage | 55253258c9dcd7a77ffb73b5836fcbffc7fdf91e | 46a337db23824c1a4dbc1c27a0470d64d8d387ee | refs/heads/master | 2022-07-12T06:54:21.082760 | 2020-03-22T05:37:41 | 2020-03-22T05:37:41 | 245,173,771 | 0 | 0 | null | 2022-06-21T02:55:30 | 2020-03-05T13:43:13 | Java | UTF-8 | Java | false | false | 3,916 | java | package service;
import dao.FriendsRelationsDao;
import dao.PersonDao;
import exception.DaoException;
import jdbc.JdbcDaoFactory;
import model.Friend;
import model.FriendRelation;
import model.Person;
import org.apache.log4j.Logger;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class FriendService {
private static FriendsRelationsDao friendsRelationsDao = (FriendsRelationsDao) JdbcDaoFactory.getInstance().getDao(FriendsRelationsDao.class);
private static PersonDao personDao = (PersonDao) JdbcDaoFactory.getInstance().getDao(PersonDao.class);
private final Logger LOGGER = Logger.getLogger(FriendService.class);
private static Set<Friend> friends = new HashSet<>();
//persId - парам. в AuthServ.
public static Set<Friend> findMyFriends(int persId){ //найти друзей актора+прописать все сообщения
// List<Person> persons = null;
List<FriendRelation> myOutRelations = null; //исходящие транзакц. актора
List<FriendRelation> myIncomeRelations=null; //входящие
try {
myOutRelations = friendsRelationsDao.findByIdPers(persId); //исходящие транзакц. актора-4
myIncomeRelations = friendsRelationsDao.findByIdFriend(persId); //1
//a) - работа с исходящ. сообщ.
// данн. метод пока использ. выборку по отношениям, а в перпект. сначала выбрать всех друзей по флагу (которого еще нет)задаваемого кнопкой
for (FriendRelation relation: myOutRelations
) {
// System.out.println("FServ: friend_id="+relation.getFriendId()); //2, 4, 2, 1-id pers для участн. сообщ.
Person person = personDao.findAll().get(relation.getFriendId()-1); //вытащить персонажей с такими id
//созд. списка друзей актора с id == persId по OUT-отношениям
//если список друзей еще не содержит кандидата и это не актор - созд. друга
if( relation.getFriendId() != persId) {
Friend friend = new Friend(person);
friend.setId((long) relation.getFriendId());
friends.add(friend);
}
//взять OUT-сообщение из текущего отношения и добав. в мои сообщ. для определенного друга
friends.stream().filter(fr -> (fr.getId()==relation.getFriendId())).forEach(fr->fr.putMessages(relation.getMessage(), ""));
}
//b) - работа со входящ. сообщ.
for (FriendRelation relation: myIncomeRelations
) {
friends.stream().filter(fr -> (fr.getId()==relation.getPersonId())).forEach(fr->fr.putMessages("", relation.getMessage()));
}
} catch (DaoException e) {
e.printStackTrace();
}
return friends;
}
//найти кандидатов в друзья - т.е. все остальные
public static List<Person> findCandidats(int persId){
List<Person> candidats = null;
List<Person> people = null;
try {
people = personDao.findAll();
} catch (DaoException e) {
e.printStackTrace();
}
//кандидат в друзья - это не сам персонаж, не друг и не админ
candidats = people.stream().filter(p->(p.getId() != persId && !friends.contains(p)&& p.getRoleId() != 1)).collect(Collectors.toList());
return candidats;
}
}
| [
"Аскар@DESKTOP-Q5Q26T1"
] | Аскар@DESKTOP-Q5Q26T1 |
65197ddae927a08286b37d799cf10ae55f2c1d3c | 8e28be5cc8af1fd494ae44174b0a1e7692d2673f | /SsrlJavaLib/src/ssrl/datasource/spring/DataSourceExternalPassword.java | a396e15bb06a2b94a4780438f14192aafdb37b36 | [] | no_license | xiaochun-yang/19-ID | e10a17964aa7291deed991b453bc2ab565140b88 | e446b1fa8bdbcbe4ae13aca439cc807faaae74ac | refs/heads/master | 2021-05-26T07:46:29.105890 | 2019-01-08T20:34:28 | 2019-01-08T20:34:28 | 127,952,810 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,190 | java | /*
* Copyright 2001
* by
* The Board of Trustees of the
* Leland Stanford Junior University
* All rights reserved.
*
*
* Disclaimer Notice
*
* The items furnished herewith were developed under the sponsorship
* of the U.S. Government. Neither the U.S., nor the U.S. D.O.E., nor the
* Leland Stanford Junior University, nor their employees, makes any war-
* ranty, express or implied, or assumes any liability or responsibility
* for accuracy, completeness or usefulness of any information, apparatus,
* product or process disclosed, or represents that its use will not in-
* fringe privately-owned rights. Mention of any product, its manufactur-
* er, or suppliers shall not, nor is it intended to, imply approval, dis-
* approval, or fitness for any particular use. The U.S. and the Univer-
* sity at all times retain the right to use and disseminate the furnished
* items for any purpose whatsoever. Notice 91 02 01
*
* Work supported by the U.S. Department of Energy under contract
* DE-AC03-76SF00515; and the National Institutes of Health, National
* Center for Research Resources, grant 2P41RR01209.
*
*
* Permission Notice
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTA-
* BILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
* EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Created on May 22, 2005
*/
package ssrl.datasource.spring;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.BeanCreationException;
import java.io.*;
/**
* @author scottm
*
* TODO Set the data source set via getter/setter instead of inheritance
*/
public class DataSourceExternalPassword extends BasicDataSource {
protected final Log logger = LogFactory.getLog(getClass());
public void setPassword(String password) {
throw new BeanCreationException("Must set password via 'passwordFile' property.");
}
public void setPasswordFile(String filenames) {
password = "";
String filenameArray[] = filenames.split(",");
for (int i=0;i <filenameArray.length;i++) {
String filename=filenameArray[i];
extractPasswordFromFile(filename);
if (password!="") {
logger.info("extracted a password from: "+ filename);
super.setPassword( password );
return;
}
}
throw new BeanCreationException("Could not get password from list of password files.");
}
public void setZeroDateTimeBehavior( String value) {
addConnectionProperty("zeroDateTimeBehavior",value);
}
private void extractPasswordFromFile(String filename) {
// get the database password
BufferedReader in;
try {
in = new BufferedReader(new FileReader(filename));
String pwdLine = in.readLine();
if (pwdLine != null) password = pwdLine;
in.close();
} catch (Exception e) {
logger.warn("Could not open file: "+ filename);
}
}
}
| [
"root@dkong.(none)"
] | root@dkong.(none) |
af9ae6c11b28484f2fb73978a657bc09a86320fd | c15b74e50f249df767047dcb2564faf6b8166c51 | /src/main/java/com/xwy/three/LRU/LRUCache.java | e0e85e25e6d027aabfbe31b06adb396c7fac8c61 | [] | no_license | never123450/thread | 09c469e97ea1e81d1fdec96bd0784808982540ca | d5727a1643de3a10130166b3b396bac0d294ca63 | refs/heads/master | 2022-07-22T20:06:05.124971 | 2022-07-21T02:33:41 | 2022-07-21T02:33:41 | 204,009,094 | 0 | 0 | null | 2022-07-11T21:09:34 | 2019-08-23T13:57:56 | Java | UTF-8 | Java | false | false | 2,630 | java | package com.xwy.three.LRU;
import java.util.HashMap;
import java.util.Map;
public class LRUCache<k, v> {
//容量
private int capacity;
//当前有多少节点的统计
private int count;
//缓存节点
private Map<k, Node<k, v>> nodeMap;
private Node<k, v> head;
private Node<k, v> tail;
public LRUCache(int capacity) {
if (capacity < 1) {
throw new IllegalArgumentException(String.valueOf(capacity));
}
this.capacity = capacity;
this.nodeMap = new HashMap<>();
//初始化头节点和尾节点,利用哨兵模式减少判断头结点和尾节点为空的代码
Node headNode = new Node(null, null);
Node tailNode = new Node(null, null);
headNode.next = tailNode;
tailNode.pre = headNode;
this.head = headNode;
this.tail = tailNode;
}
public void put(k key, v value) {
Node<k, v> node = nodeMap.get(key);
if (node == null) {
if (count >= capacity) {
//先移除一个节点
removeNode();
}
node = new Node<>(key, value);
//添加节点
addNode(node);
} else {
//移动节点到头节点
moveNodeToHead(node);
}
}
public Node<k, v> get(k key) {
Node<k, v> node = nodeMap.get(key);
if (node != null) {
moveNodeToHead(node);
}
return node;
}
private void removeNode() {
Node node = tail.pre;
//从链表里面移除
removeFromList(node);
nodeMap.remove(node.key);
count--;
}
private void removeFromList(Node<k, v> node) {
Node pre = node.pre;
Node next = node.next;
pre.next = next;
next.pre = pre;
node.next = null;
node.pre = null;
}
private void addNode(Node<k, v> node) {
//添加节点到头部
addToHead(node);
nodeMap.put(node.key, node);
count++;
}
private void addToHead(Node<k, v> node) {
Node next = head.next;
next.pre = node;
node.next = next;
node.pre = head;
head.next = node;
}
public void moveNodeToHead(Node<k, v> node) {
//从链表里面移除
removeFromList(node);
//添加节点到头部
addToHead(node);
}
class Node<k, v> {
k key;
v value;
Node pre;
Node next;
public Node(k key, v value) {
this.key = key;
this.value = value;
}
}
} | [
"845619585@qq.com"
] | 845619585@qq.com |
4d6c9a8dabffb22049c7a86ae4391c9a1fe66538 | 68c5dd1fdcf8bdba6e9feca64757fc06cf26780a | /app/src/main/java/codebros/areyouat/com/lifeline/LoginActivity.java | b13d3c33c08ad1da491259a2396a794f2646e5d3 | [] | no_license | bios1337/Lifeline | 256a93bec3ebd1dccb096c19b147ef4d81a8c4f0 | 7deec75d38c5573af0f78c7366d88aac2925aa6b | refs/heads/master | 2021-09-02T14:29:33.767500 | 2018-01-03T07:08:29 | 2018-01-03T07:08:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | package codebros.areyouat.com.lifeline;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class LoginActivity extends AppCompatActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
public void openHospitalActivity(View view) {
Intent intent = new Intent(this, HospitalActivity.class);
startActivity(intent);
}
}
| [
"k.maaz82@gmail.com"
] | k.maaz82@gmail.com |
67e31b664a61e8d6218cdbb18f3987af271d1a5c | 4f65debf80b5eb8da1421a489694ec03ead8da71 | /src/test/java/cn/edu/nudt/secant/jdriver/CUTDriverCodeBuilderTest.java | 8dbb6a6ee15f293be39cdd34b074c10e251c4fa5 | [
"MIT"
] | permissive | qorost/jdriver | 1be1d7ebc1afed5d8c5cb13307c0c01a7462d14b | 9b398e24bcc47294bd213428c97f3b3b799b53a0 | refs/heads/master | 2020-03-27T08:26:59.673906 | 2018-09-03T13:42:49 | 2018-09-03T13:42:49 | 146,255,499 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,900 | java | package cn.edu.nudt.secant.jdriver;
import org.junit.Test;
import static org.junit.Assert.*;
public class CUTDriverCodeBuilderTest {
//@Test
public void testCommons() {
String[] args = new String[]{"-i","./tests/commons-imaging-1.0-SNAPSHOT.jar", "-m", "c"};
JDriver.parseArgs(args);
JDriver.process();
}
//@Test
public void testATest() {
boolean simple = false;
String cls = "org/apache/commons/imaging/color/ColorXyz.class";
String jarname = "./tests/commons-imaging-1.0-SNAPSHOT.jar";
cls = "org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.class";
String outputdir = "./tests/method_output/";
if(true) {
jarname = "./tests/a.jar";
cls = "AClass.class";
}
String[] args = new String[]{"-i", jarname ,"-o",outputdir};
//make type table
JDriver.parseArgs(args);
JDriver.preprocess();
CUTDriverCodeBuilder.buildClass(cls);
}
@Test
public void testSingleMethod() {
boolean simple = false;
String cls = "org/apache/commons/imaging/color/ColorXyz.class";
cls = "org/apache/commons/imaging/formats/jpeg/JpegImageParser";
String methodname = "getBufferedImage";
String outputdir = "./tests/output/method_output/";
String[] args = new String[]{"-i","./tests/commons-imaging-1.0-SNAPSHOT.jar", "-class",cls, "-method",
methodname, "-o", outputdir};
//cls = "./tests/output/org/apache/commons/imaging/common/ImageBuilderc.class";
if(simple) {
args = new String[]{"-i", "./tests/a.jar", "-class","AClass.class","-method","foo","-o",outputdir};
cls = "AClass";
methodname = "foo";
}
JDriver.parseArgs(args);
JDriver.preprocess();
JDriver.processMethod();
}
} | [
"huang@mbp.com"
] | huang@mbp.com |
c4a020b46339d5d0a61fd9b24f5cd060e17f3225 | 9df342b8b7ecd2a9a39a585b6b84f9c19ee1506b | /src/com/sun/corba/se/spi/activation/_ActivatorImplBase.java | a391e941ff722e3ea15395fd7fd6d9ce9083ee9b | [] | no_license | WangXinW/jdk1.8-src | 2abbf6771ec7d69eca457c635ca665c6c26980b9 | 112ff6c8844a205c158743afa0e94fc6ebd3d386 | refs/heads/master | 2020-07-28T20:46:53.809525 | 2019-10-09T03:47:20 | 2019-10-09T03:47:20 | 209,532,127 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,676 | java | package com.sun.corba.se.spi.activation;
/**
* com/sun/corba/se/spi/activation/_ActivatorImplBase.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/workspace/8-2-build-windows-amd64-cygwin/jdk8u31/2394/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl
* Wednesday, December 17, 2014 9:02:20 PM PST
*/
public abstract class _ActivatorImplBase extends org.omg.CORBA.portable.ObjectImpl
implements com.sun.corba.se.spi.activation.Activator, org.omg.CORBA.portable.InvokeHandler
{
// Constructors
public _ActivatorImplBase ()
{
}
private static java.util.Hashtable _methods = new java.util.Hashtable ();
static
{
_methods.put ("active", new java.lang.Integer (0));
_methods.put ("registerEndpoints", new java.lang.Integer (1));
_methods.put ("getActiveServers", new java.lang.Integer (2));
_methods.put ("activate", new java.lang.Integer (3));
_methods.put ("shutdown", new java.lang.Integer (4));
_methods.put ("install", new java.lang.Integer (5));
_methods.put ("getORBNames", new java.lang.Integer (6));
_methods.put ("uninstall", new java.lang.Integer (7));
}
public org.omg.CORBA.portable.OutputStream _invoke (String $method,
org.omg.CORBA.portable.InputStream in,
org.omg.CORBA.portable.ResponseHandler $rh)
{
org.omg.CORBA.portable.OutputStream out = null;
java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
if (__method == null)
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
switch (__method.intValue ())
{
// A new ORB started server registers itself with the Activator
case 0: // activation/Activator/active
{
try {
int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in);
com.sun.corba.se.spi.activation.Server serverObj = com.sun.corba.se.spi.activation.ServerHelper.read (in);
this.active (serverId, serverObj);
out = $rh.createReply();
} catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex);
}
break;
}
// Install a particular kind of endpoint
case 1: // activation/Activator/registerEndpoints
{
try {
int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in);
String orbId = com.sun.corba.se.spi.activation.ORBidHelper.read (in);
com.sun.corba.se.spi.activation.EndPointInfo endPointInfo[] = com.sun.corba.se.spi.activation.EndpointInfoListHelper.read (in);
this.registerEndpoints (serverId, orbId, endPointInfo);
out = $rh.createReply();
} catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.NoSuchEndPoint $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.NoSuchEndPointHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.ORBAlreadyRegistered $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ORBAlreadyRegisteredHelper.write (out, $ex);
}
break;
}
// list active servers
case 2: // activation/Activator/getActiveServers
{
int $result[] = null;
$result = this.getActiveServers ();
out = $rh.createReply();
com.sun.corba.se.spi.activation.ServerIdsHelper.write (out, $result);
break;
}
// If the server is not running, start it up.
case 3: // activation/Activator/activate
{
try {
int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in);
this.activate (serverId);
out = $rh.createReply();
} catch (com.sun.corba.se.spi.activation.ServerAlreadyActive $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerAlreadyActiveHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.ServerHeldDown $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (out, $ex);
}
break;
}
// If the server is running, shut it down
case 4: // activation/Activator/shutdown
{
try {
int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in);
this.shutdown (serverId);
out = $rh.createReply();
} catch (com.sun.corba.se.spi.activation.ServerNotActive $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerNotActiveHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex);
}
break;
}
// currently running, this method will activate it.
case 5: // activation/Activator/install
{
try {
int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in);
this.install (serverId);
out = $rh.createReply();
} catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.ServerHeldDown $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.ServerAlreadyInstalled $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerAlreadyInstalledHelper.write (out, $ex);
}
break;
}
// list all registered ORBs for a server
case 6: // activation/Activator/getORBNames
{
try {
int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in);
String $result[] = null;
$result = this.getORBNames (serverId);
out = $rh.createReply();
com.sun.corba.se.spi.activation.ORBidListHelper.write (out, $result);
} catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex);
}
break;
}
// After this hook completes, the server may still be running.
case 7: // activation/Activator/uninstall
{
try {
int serverId = com.sun.corba.se.spi.activation.ServerIdHelper.read (in);
this.uninstall (serverId);
out = $rh.createReply();
} catch (com.sun.corba.se.spi.activation.ServerNotRegistered $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerNotRegisteredHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.ServerHeldDown $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (out, $ex);
} catch (com.sun.corba.se.spi.activation.ServerAlreadyUninstalled $ex) {
out = $rh.createExceptionReply ();
com.sun.corba.se.spi.activation.ServerAlreadyUninstalledHelper.write (out, $ex);
}
break;
}
default:
throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
}
return out;
} // _invoke
// Type-specific CORBA::Object operations
private static String[] __ids = {
"IDL:activation/Activator:1.0"};
public String[] _ids ()
{
return (String[])__ids.clone ();
}
} // class _ActivatorImplBase
| [
"2763041366@qq.com"
] | 2763041366@qq.com |
f832932576fee8dff93e58bd0f4e4d5cf1253dd2 | 0f9e3b5a061f343065483bdd031a5dc8c8fb09af | /org.xpect.xtext.lib/src/org/xpect/xtext/lib/setup/generic/File.java | 1b0263019a7645e92091ee7d5c552aa930d2307f | [] | no_license | joergreichert/Xpect | ed1296af1d155ecc983cf5a5d28276b7e20241fe | fde2c38359ec59f3415cad7d6e83d6efa66c22f5 | refs/heads/master | 2021-01-16T21:13:04.910708 | 2013-08-23T15:40:04 | 2013-08-23T15:40:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 909 | java | package org.xpect.xtext.lib.setup.generic;
import java.io.IOException;
import java.io.InputStream;
import org.eclipse.emf.common.util.URI;
import org.xpect.setup.IXpectRunnerSetup.IFileSetupContext;
public class File extends GenericResource {
private String from;
public File() {
super();
}
public File(String name) {
super(name);
}
public InputStream getContents(IFileSetupContext ctx) throws IOException {
URI source = ctx.resolve(getFrom() == null ? getName() : getFrom());
return ctx.getXpectFile().eResource().getResourceSet().getURIConverter().createInputStream(source);
}
public String getFrom() {
return from;
}
public String getLocalName(IFileSetupContext ctx) {
return getName() == null ? from : getName();
}
public URI getResolvedURI(IFileSetupContext ctx) {
return ctx.resolve(getLocalName(ctx));
}
public void setFrom(String from) {
this.from = from;
}
}
| [
"moritz.eysholdt@itemis.de"
] | moritz.eysholdt@itemis.de |
0a2dda5f71fc639404f1706de802e100a839c3e5 | d170d5f7d26bf2dfae6dc3f9be50c561765ad75c | /service/src/main/java/com/tracholar/recommend/feature/dag/DepNodeMap.java | e640257744ce77abe67b2a5895456d7b1c9d9782 | [] | no_license | langjiangit/recsys-proj | 8485a5d828937eeb2db2476acc626d3571ce6782 | 3730bdcb3ab885ea7578c37f55fb7d9af5a271c9 | refs/heads/master | 2023-04-20T01:58:51.136219 | 2021-05-16T07:43:14 | 2021-05-16T07:43:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 467 | java | package com.tracholar.recommend.feature.dag;
import com.tracholar.recommend.feature.Feature;
import org.apache.commons.lang3.SerializationUtils;
import java.util.HashMap;
public class DepNodeMap extends HashMap<String, Feature> {
/**
* 重写get方法,防止在node内部修改了传入的参数
* @param key
* @return
*/
@Override
public Feature get(Object key) {
return SerializationUtils.clone(super.get(key));
}
}
| [
"zuoyuan@meituan.com"
] | zuoyuan@meituan.com |
10237b58c5c838e0b070afb90fd5cb5dfeb6a37e | 1085771b9e0cfc2cc92a4aebed3ae63a0eec73e6 | /com/syntax/class01/TaskTestNG.java | dc83f42781a7c6c655a042db0670fccb1f1956f8 | [] | no_license | Indira117/TestNG | c5d0babb6282796ee310df73d501346cf25ecb53 | fd366575d3dcffcc1dc5cc5feef4bb8b085ccde2 | refs/heads/main | 2023-02-03T02:21:44.173897 | 2020-12-23T03:12:58 | 2020-12-23T03:12:58 | 323,788,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.syntax.class01;
import org.testng.annotations.Test;
public class TaskTestNG {
@Test
public void name(){
System.out.println("Indira");
}
@Test
public void surname(){
System.out.println("Zhanabayeva");
}
@Test
public void batch(){
System.out.println("Batch 8");
}
}
| [
"indirazhana@gmail.com"
] | indirazhana@gmail.com |
e1df41198e52f89e4f12f520ec9fadc79f4104d2 | bd0b3c97c144a1406c108b185399b2b46bf96a73 | /app/src/main/java/com/example/alejo/practica2/MainActivity.java | b82883c7c6fd10c0d30b00777da73ffb71174714 | [] | no_license | alejoaj22/Practica2 | 04708c810bb75a44403003b59d1d62e0c8fcf441 | 29a0e8268671aded9859d2aa3ec3aaab35bbd258 | refs/heads/master | 2021-07-13T18:33:40.043771 | 2017-10-17T02:58:49 | 2017-10-17T02:58:49 | 104,959,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,101 | java | package com.example.alejo.practica2;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.annotation.NonNull;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.facebook.login.LoginManager;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.common.api.Status;
public class MainActivity extends AppCompatActivity{
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mDrawerToggle;
String correo="",contraseña="";
String correoR, contraseñaR,nombreR;
String fotoR="";
int main=2222;
int oplog;
GoogleApiClient mGoogleApiClient;
Toolbar appbar;
SharedPreferences prefs;
SharedPreferences.Editor editor;
FragmentManager fm;
FragmentTransaction ft;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Bundle extras = getIntent().getExtras();
correoR = extras.getString("correo");
//Log.d("correo del main",correoR);
contraseñaR = extras.getString("contraseña");
fotoR = extras.getString("foto");
nombreR = extras.getString("nombre");
//Log.d("correo del main",correoR);
//Log.d("contraseña del main",contraseñaR);
prefs = getSharedPreferences("Mis preferencias",MODE_PRIVATE);
fm = getSupportFragmentManager();
ft = fm.beginTransaction();
String hola = prefs.getString("hola","");
// Toast.makeText(getApplicationContext(),"Dure mas "+hola,Toast.LENGTH_LONG).show();
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.build();
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
Toast.makeText(getApplicationContext(),"Error en login",Toast.LENGTH_SHORT).show();
}
} /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu,menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
Intent intent = new Intent();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
switch (id){
case R.id.mMiPerfil:
prefs = getSharedPreferences("Mis preferencias",MODE_PRIVATE);
editor = prefs.edit();
editor.putString("correo",correoR);
editor.putString("contraseña",contraseñaR);
editor.putString("foto",fotoR);
editor.putString("nombre",nombreR);
editor.commit();
intent = new Intent(MainActivity.this,PerfilActivity.class);
intent.putExtra("correo", correoR);
intent.putExtra("contraseña", contraseñaR);
intent.putExtra("foto",fotoR);
intent.putExtra("nombre",nombreR);
startActivity(intent);
//PerfilFragment fragment = new PerfilFragment();
//ft = fm.beginTransaction();
//ft.replace(R.id.frame,fragment).commit();
//ft.replace(R.id.frame,fragment);
break;
case R.id.mCerrar:
prefs = getSharedPreferences("Mis preferencias",MODE_PRIVATE);
editor = prefs.edit();
editor.putInt("oplog",oplog);
editor.commit();
///////////////////////////////cerrar sesión de google
Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
new ResultCallback<Status>() {
@Override
public void onResult(Status status) {
// ...
}
});
////////////////////////////////////////////////
LoginManager.getInstance().logOut(); //Cierra sesión en facebook
intent = new Intent(MainActivity.this,LoguinActivity.class);
intent.putExtra("correomain", correoR);
intent.putExtra("contraseñamain", contraseñaR);
intent.putExtra("main", main);
intent.putExtra("nombremain", nombreR);
startActivity(intent);
finish();
break;
}
return super.onOptionsItemSelected(item);
}
public void Cambio(View view) {
Intent intent;
intent = new Intent(MainActivity.this,NavigationActivity.class);
startActivity(intent);
}
public void Cambiotap(View view) {
Intent intent;
intent = new Intent(MainActivity.this,TabeActivity.class);
startActivity(intent);
}
public void CambioBotton(View view) {
prefs = getSharedPreferences("Mis preferencias",MODE_PRIVATE);
editor = prefs.edit();
editor.putString("correo",correoR);
editor.putString("contraseña",contraseñaR);
editor.putString("foto",fotoR);
editor.putString("nombre",nombreR);
editor.commit();
//intent = new Intent(MainActivity.this,PerfilActivity.class);
//intent.putExtra("correo", correoR);
//intent.putExtra("contraseña", contraseñaR);
//intent.putExtra("foto",fotoR);
//intent.putExtra("nombre",nombreR);
//startActivity(intent);
Intent intent;
intent = new Intent(MainActivity.this,BottonNaviActvity.class);
startActivity(intent);
}
}
| [
"alejoaj22@gmail.com"
] | alejoaj22@gmail.com |
289e59b14bfa0362528f20570016fc24d00d92f7 | 8a2490d958b239a2fead91fc5c4c3b771052325c | /src/main/java/kr/pe/timeorder/controller/FileController.java | d46e402f89ee0be3a6cdd2fda87581c0ad3fca6b | [] | no_license | KIM-DONGJU/timeorder | 5fff80076df81600c2fada4bcb11dcf0766a3d16 | 836bde3abe15f3b68fbcd8320802223f0404d0c6 | refs/heads/master | 2022-12-12T01:24:59.763368 | 2020-09-15T00:11:22 | 2020-09-15T00:11:22 | 292,709,292 | 0 | 0 | null | 2020-09-15T00:11:24 | 2020-09-04T00:26:43 | Java | UTF-8 | Java | false | false | 4,451 | java | package kr.pe.timeorder.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import kr.pe.timeorder.exception.NotFoundException;
import kr.pe.timeorder.model.Item;
import kr.pe.timeorder.model.Review;
import kr.pe.timeorder.model.Store;
import kr.pe.timeorder.model.UploadFile;
import kr.pe.timeorder.repository.ItemRepository;
import kr.pe.timeorder.repository.MemberRepository;
import kr.pe.timeorder.repository.ReviewRepository;
import kr.pe.timeorder.repository.StoreRepository;
import kr.pe.timeorder.repository.UploadFileRepository;
import kr.pe.timeorder.service.FileStorageService;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@RestController
public class FileController {
@Autowired
private UploadFileRepository fRepository;
@Autowired
private MemberRepository mRepository;
@Autowired
private StoreRepository sRepository;
@Autowired
private ItemRepository iRepository;
@Autowired
private ReviewRepository rRepository;
@Autowired
private FileStorageService fileService;
@PostMapping("/upload/item/{id}")
public ResponseEntity<UploadFile> uploadItemFile(@PathVariable long id, @RequestParam("file") MultipartFile file) {
log.info("upload item file");
UploadFile uploadFile = null;
HttpStatus status = null;
try {
String fileName = fileService.storeFile(file);
String fileUri = ServletUriComponentsBuilder.fromCurrentContextPath().path("/img/")
.path(fileName).toUriString();
uploadFile = UploadFile.builder().fileName(fileName).fileUri(fileUri)
.fileType(file.getContentType()).fileSize(file.getSize()).build();
Item item = iRepository.findById(id).orElseThrow(() -> new NotFoundException());
uploadFile.setItem(item);
fRepository.save(uploadFile);
status = HttpStatus.ACCEPTED;
} catch (RuntimeException e) {
log.error("uploadMemberFile error", e);
status = HttpStatus.INTERNAL_SERVER_ERROR;
}
return new ResponseEntity<UploadFile>(uploadFile, status);
}
@PostMapping("/upload/review/{id}")
public ResponseEntity<UploadFile> uploadReviewFile(@PathVariable long id,
@RequestParam("file") MultipartFile file) {
UploadFile uploadFile = null;
HttpStatus status = null;
try {
String fileName = fileService.storeFile(file);
String fileUri = ServletUriComponentsBuilder.fromCurrentContextPath().path("/img/")
.path(fileName).toUriString();
uploadFile = UploadFile.builder().fileName(fileName).fileUri(fileUri)
.fileType(file.getContentType()).fileSize(file.getSize()).build();
Review review = rRepository.findById(id).orElseThrow(() -> new NotFoundException());
uploadFile.setReview(review);
fRepository.save(uploadFile);
status = HttpStatus.ACCEPTED;
} catch (RuntimeException e) {
log.error("uploadMemberFile error", e);
status = HttpStatus.INTERNAL_SERVER_ERROR;
}
return new ResponseEntity<UploadFile>(uploadFile, status);
}
@PostMapping("/upload/store/{id}")
public ResponseEntity<List<UploadFile>> uploadStoreFile(@PathVariable long id,
@RequestParam("file") MultipartFile file) {
UploadFile uploadFile = null;
HttpStatus status = null;
List<UploadFile> list = new ArrayList();
String fileName = null;
String fileUri = null;
try {
Store store = sRepository.findById(id).orElseThrow(() -> new NotFoundException());
fileName = fileService.storeFile(file);
fileUri = ServletUriComponentsBuilder.fromCurrentContextPath().path("/img/")
.path(fileName).toUriString();
uploadFile = UploadFile.builder().fileName(fileName).fileUri(fileUri)
.fileType(file.getContentType()).fileSize(file.getSize()).build();
uploadFile.setStore(store);
fRepository.save(uploadFile);
list.add(uploadFile);
status = HttpStatus.ACCEPTED;
} catch (RuntimeException e) {
log.error("uploadMemberFile error", e);
status = HttpStatus.INTERNAL_SERVER_ERROR;
}
return new ResponseEntity<List<UploadFile>>(list, status);
}
}
| [
"skokk33@gmail.com"
] | skokk33@gmail.com |
eb9119003a287e72a531c0dc78d3f4100e546249 | e5f1da74c727e8744372ba8290f546b9b71e56be | /src/main/java/cz/jirutka/rsql/mongodb/morphia/MorphiaRSQLImpl.java | 40de297c5499f215f91839cad2599f6fd7a91f65 | [
"MIT"
] | permissive | jirutka/rsql-mongodb-morphia | 181b4a1d871901b6521016945177c21858727a3a | eb01d464bdb004517e736739f9c60178c9031c70 | refs/heads/master | 2023-08-13T22:37:11.273906 | 2014-07-12T13:17:00 | 2014-07-12T13:17:00 | 17,941,113 | 0 | 2 | null | 2016-03-27T18:15:57 | 2014-03-20T12:08:37 | Java | UTF-8 | Java | false | false | 3,057 | java | /*
* The MIT License
*
* Copyright 2013-2014 Czech Technical University in Prague.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package cz.jirutka.rsql.mongodb.morphia;
import cz.jirutka.rsql.parser.RSQLParser;
import cz.jirutka.rsql.parser.RSQLParserException;
import cz.jirutka.rsql.parser.ast.Node;
import lombok.Getter;
import lombok.Setter;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.DatastoreImpl;
import org.mongodb.morphia.mapping.Mapper;
import org.mongodb.morphia.query.Criteria;
import org.mongodb.morphia.query.Query;
public class MorphiaRSQLImpl implements MorphiaRSQL {
@Getter
private final Datastore datastore;
@Getter @Setter
private StringConverter converter = new DefaultStringConverter();
@Getter @Setter
private RSQLParser rsqlParser = new RSQLParser(MongoRSQLOperators.mongoOperators());
// lazy initialized
private Mapper mapper;
public MorphiaRSQLImpl(Datastore datastore) {
this.datastore = datastore;
}
public Criteria createCriteria(String rsql, Class<?> entityClass) {
Node rootNode = parse(rsql);
MorphiaRSQLVisitor visitor = new MorphiaRSQLVisitor(entityClass, getMapper(), converter);
return rootNode.accept(visitor);
}
public <T> Query<T> createQuery(String rsql, Class<T> entityClass) {
Query<T> query = datastore.createQuery(entityClass);
query.and(createCriteria(rsql, entityClass));
return query;
}
protected Node parse(String rsql) {
try {
return rsqlParser.parse(rsql);
} catch (RSQLParserException ex) {
throw new RSQLException(ex);
}
}
private Mapper getMapper() {
if (mapper == null) {
if (! (datastore instanceof DatastoreImpl)) {
throw new IllegalStateException("datastore is not instance of DatastoreImpl");
}
mapper = ((DatastoreImpl) datastore).getMapper();
}
return mapper;
}
}
| [
"jakub@jirutka.cz"
] | jakub@jirutka.cz |
7670499cb4e03c92b6e6a888e72ea322b2a06669 | 32b72e1dc8b6ee1be2e80bb70a03a021c83db550 | /ast_results/maks_MGit/app/src/main/java/me/sheimi/sgit/repo/tasks/repo/StatusTask.java | cb52840548bee264dffa3da967fc3b6029eb93e0 | [] | no_license | cmFodWx5YWRhdjEyMTA5/smell-and-machine-learning | d90c41a17e88fcd99d543124eeb6e93f9133cb4a | 0564143d92f8024ff5fa6b659c2baebf827582b1 | refs/heads/master | 2020-07-13T13:53:40.297493 | 2019-01-11T11:51:18 | 2019-01-11T11:51:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,809 | java | // isComment
package me.sheimi.sgit.repo.tasks.repo;
import java.util.Set;
import me.sheimi.sgit.database.models.Repo;
import me.sheimi.sgit.exception.StopTaskException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.errors.NoWorkTreeException;
public class isClassOrIsInterface extends RepoOpTask {
public interface isClassOrIsInterface {
public void isMethod(String isParameter);
}
private GetStatusCallback isVariable;
private StringBuffer isVariable = new StringBuffer();
public isConstructor(Repo isParameter, GetStatusCallback isParameter) {
super(isNameExpr);
isNameExpr = isNameExpr;
}
@Override
protected Boolean isMethod(Void... isParameter) {
return isMethod();
}
protected void isMethod(Boolean isParameter) {
super.isMethod(isNameExpr);
if (isNameExpr != null && isNameExpr) {
isNameExpr.isMethod(isNameExpr.isMethod());
}
}
public void isMethod() {
isMethod();
}
private boolean isMethod() {
try {
org.eclipse.jgit.api.Status isVariable = isNameExpr.isMethod().isMethod().isMethod();
isMethod(isNameExpr);
} catch (NoWorkTreeException isParameter) {
isMethod(isNameExpr);
return true;
} catch (GitAPIException isParameter) {
isMethod(isNameExpr);
return true;
} catch (StopTaskException isParameter) {
return true;
} catch (Throwable isParameter) {
isMethod(isNameExpr);
return true;
}
return true;
}
private void isMethod(org.eclipse.jgit.api.Status isParameter) {
if (!isNameExpr.isMethod() && isNameExpr.isMethod()) {
isNameExpr.isMethod("isStringConstant");
return;
}
// isComment
isMethod("isStringConstant", isNameExpr.isMethod());
isMethod("isStringConstant", isNameExpr.isMethod());
isMethod("isStringConstant", isNameExpr.isMethod());
isMethod("isStringConstant", isNameExpr.isMethod());
isMethod("isStringConstant", isNameExpr.isMethod());
isMethod("isStringConstant", isNameExpr.isMethod());
isMethod("isStringConstant", isNameExpr.isMethod());
}
private void isMethod(String isParameter, Set<String> isParameter) {
if (isNameExpr.isMethod())
return;
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod("isStringConstant");
for (String isVariable : isNameExpr) {
isNameExpr.isMethod('isStringConstant');
isNameExpr.isMethod(isNameExpr);
isNameExpr.isMethod('isStringConstant');
}
isNameExpr.isMethod("isStringConstant");
}
}
| [
"matheus@melsolucoes.net"
] | matheus@melsolucoes.net |
fb69d4797edd8da095cbfd16438aaf07ce1288d8 | c169efcc2493e84711ebcd9b7bd8951caec33d60 | /src/main/java/org/codility/lessons/lesson7/Brackets.java | ecee99303068940645ca80ac2e91889390c3b1b0 | [] | no_license | kosanake/Codility | e45a4d34264bd4ace8a4f42c8c9f3cc05bf153dc | c5f1d596ac557deed1d702dfadc763c0a73e570d | refs/heads/master | 2021-02-18T22:48:16.129249 | 2020-03-08T12:10:40 | 2020-03-08T12:10:40 | 245,247,492 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 937 | java | package org.codility.lessons.lesson7;
import java.util.*;
public class Brackets {
public int solution(String S) {
Set<Character> braces = new HashSet<>();
braces.add('(');
braces.add('{');
braces.add('[');
Map<Character, Character> revertBraces = new HashMap<>();
revertBraces.put(')', '(');
revertBraces.put('}', '{');
revertBraces.put(']', '[');
Deque<Character> deque = new ArrayDeque<>(S.length());
for (int i = 0; i < S.length(); i++) {
Character c = S.charAt(i);
if (braces.contains(c)) {
deque.push(c);
} else {
if (deque.isEmpty())
return 0;
if (!revertBraces.get(c).equals(deque.pop()))
return 0;
}
}
if (deque.isEmpty())
return 1;
else
return 0;
}
}
| [
"asdanilov@gmail.com"
] | asdanilov@gmail.com |
8760a48418ed3700ec13d929200280a8932a80ea | 4fd9d73987b8b4552dc8eb9f615d0660bca54f4f | /exam/src/edu/fju/exam/VendingMachine.java | c48f4595fd7f50a9088ebef269227246b7c8f069 | [] | no_license | felix19990617/workspace | 93a7c0033d43d253a9c212fbf7929a7f86e4c62e | 376510e62fd6e17c45bb0d7d4a478ee123e830f0 | refs/heads/master | 2021-03-24T14:06:32.140364 | 2018-01-16T07:33:24 | 2018-01-16T07:33:24 | 117,636,933 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 70 | java | package edu.fju.exam;
public class VendingMachine {
}
| [
"felix3157538@gmail.com"
] | felix3157538@gmail.com |
ba1a89e981e0a2d9e6adf08afdeb970a515429be | 468415d7994958fe882225690c34f715688ee2c3 | /app/src/main/java/com/example/raksheet/majorproject/Storage/Storage.java | b5ee6ef2d491b50c3f2f4d0f043d83d4e9331792 | [] | no_license | raksheetbhat/distributed-public-computing | 6db68b8f15d5fa9bfe6e707c81fe4b0434313f5d | 9545518652413abe7130a15462c11cec1b5890d7 | refs/heads/master | 2022-02-24T22:07:42.162333 | 2019-09-17T16:21:41 | 2019-09-17T16:21:41 | 119,380,407 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.example.raksheet.majorproject.Storage;
/**
* Created by Raksheet on 12-04-2017.
*/
public class Storage {
int StorageID;
int userID;
String filename;
int fragmentCount;
int minFragment;
public int getStorageID() {
return StorageID;
}
public void setStorageID(int storageID) {
StorageID = storageID;
}
public int getUserID() {
return userID;
}
public void setUserID(int userID) {
this.userID = userID;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public int getFragmentCount() {
return fragmentCount;
}
public void setFragmentCount(int fragmentCount) {
this.fragmentCount = fragmentCount;
}
public int getMinFragment() {
return minFragment;
}
public void setMinFragment(int minFragment) {
this.minFragment = minFragment;
}
}
| [
"raksheet.bhat@gmail.com"
] | raksheet.bhat@gmail.com |
331b3385a5ca6e0a66bbcd864d42529b9e04db85 | 2fd300d0df545ba7d1d5cb824a3eebd8744c69d3 | /src/main/java/pl/siekiera/contactbook/service/contact/ContactService.java | f307757a58dede693b34b9b04c1ae22fe166756f | [] | no_license | siekiera-a/Contact-Book | a586eb12c373e3fabdce7fa99efe831c4856c555 | 2e097e5a0dee633a6e5d845aa8ba1e9fb2447462 | refs/heads/master | 2023-06-02T10:31:58.926504 | 2021-06-27T20:58:19 | 2021-06-27T20:58:19 | 378,648,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 672 | java | package pl.siekiera.contactbook.service.contact;
import pl.siekiera.contactbook.dto.request.ContactRequest;
import pl.siekiera.contactbook.dto.response.SuccessResponse;
import pl.siekiera.contactbook.entity.User;
import pl.siekiera.contactbook.model.ContactModel;
import java.util.List;
public interface ContactService {
boolean add(User user, String name, String email, String phone);
List<ContactModel> getContacts(User user);
SuccessResponse deleteContact(User user, Long contactId);
SuccessResponse updateContact(User user, Long id, String name, String email, String phone);
int importContacts(User user, List<ContactRequest> contacts);
}
| [
"siekiera.a31@gmail.com"
] | siekiera.a31@gmail.com |
cd9b7fcbcfc0ee51a9d2f04ecd7553253894f6bf | 4fd736858d11b6c31c4c66e39f1495f6014043e5 | /core/src/main/java/net/hasor/web/valid/ValidItem.java | eace282b48889a5021af9a914f22fe639a2c0a29 | [
"Apache-2.0"
] | permissive | 147549561/hasor | 0f031ae4d4d7b4551a37abed80a92cf997f22bfb | f446d3995acbb58122926d143d7a23edae357d5f | refs/heads/master | 2021-01-25T11:02:39.054793 | 2017-06-09T12:33:21 | 2017-06-09T12:33:21 | 93,906,481 | 1 | 0 | null | 2017-06-10T00:35:22 | 2017-06-10T00:35:22 | null | UTF-8 | Java | false | false | 1,606 | java | /*
* Copyright 2008-2009 the original author or authors.
*
* 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 net.hasor.web.valid;
import java.util.ArrayList;
/**
* 一个item下的验证信息
* @version : 2014年8月27日
* @author 赵永春(zyc@hasor.net)
*/
class ValidItem extends ArrayList<Message> {
private String key;
//
public ValidItem(String key) {
this.key = key;
}
public ValidItem(String key, String error) {
this(key);
this.addError(error);
}
public ValidItem(String key, Message error) {
this(key);
this.add(error);
}
//
public String getKey() {
return key;
}
//
public boolean isValid() {
return this.isEmpty();
}
//
public String firstError() {
if (this.isEmpty()) {
return null;
}
return get(size() - 1).getMessage();
}
//
public void addError(String validString) {
this.add(new Message(validString));
}
//
public String toString() {
return this.firstError();
}
} | [
"zyc@hasor.net"
] | zyc@hasor.net |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.