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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
923798f5f8d6770af8e9e05d6b86b518f757b18c | 2c61777baa5f00d835fdc8619f9d37e179fa899b | /2_day/PrimeNum.java | 106b5bf7ba0952f4c1923cb46fc56320e91d0cb6 | [] | no_license | aditya6700/Java | 1f6e561cf308d81c4a422d290d8bbb296a35d008 | f86053e305a37d5f2d863025b22eac938aa1680c | refs/heads/master | 2023-06-29T05:13:49.577603 | 2021-07-22T09:48:49 | 2021-07-22T09:48:49 | 386,605,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 813 | java | class PrimeNum{
static boolean isPrime(int n){
if (n <= 1)
return false;
// Check if number is 2
else if (n == 2)
return true;
// Check if n is a multiple of 2
else if (n % 2 == 0)
return false;
// If not, then just check the odds
for (int i = 3; i <= Math.sqrt(n); i += 2)
{
if (n % i == 0)
return false;
}
return true;
}
public static void main(String args[]){
for (int n = 0; n <= 50; n++) {
boolean flag = isPrime(n);
if (flag) {
continue;
}
System.out.println(n);
}
}
}
5min call vachindi
| [
"dsaiaditya@gmail.com"
] | dsaiaditya@gmail.com |
c1ba0cd63260c5f41de9b2d9923a0cad560ea0a3 | 13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3 | /crash-reproduction-ws/results/XWIKI-12798-88-15-Single_Objective_GGA-WeightedSum/com/xpn/xwiki/internal/template/DefaultTemplateManager_ESTest_scaffolding.java | 2f504e1045a1bc1c6205d27ac661d8f3e5b3fc74 | [
"MIT",
"CC-BY-4.0"
] | permissive | STAMP-project/Botsing-basic-block-coverage-application | 6c1095c6be945adc0be2b63bbec44f0014972793 | 80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da | refs/heads/master | 2022-07-28T23:05:55.253779 | 2022-04-20T13:54:11 | 2022-04-20T13:54:11 | 285,771,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Wed Apr 01 00:06:14 UTC 2020
*/
package com.xpn.xwiki.internal.template;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
@EvoSuiteClassExclude
public class DefaultTemplateManager_ESTest_scaffolding {
// Empty scaffolding for empty test suite
}
| [
"pouria.derakhshanfar@gmail.com"
] | pouria.derakhshanfar@gmail.com |
de06fecf4a44775fd472c8fc6d36c244b04c484b | c25b41142727c954f60690946a83a0c921a6a83c | /src/mvc/modelo/dao/idaos/LineaAereaDAO.java | 528d97123814eba9c90fd535399fc9cbe3067583 | [] | no_license | xMatiasMedina/TPFinal_ProgramacionAvanzada | bab0248d9487548971207fae0db6f28381546762 | 802067f668928da69dddcc979e1f76650de30ef9 | refs/heads/master | 2023-01-23T19:36:22.353991 | 2020-11-04T18:51:15 | 2020-11-04T18:51:15 | 258,043,852 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 375 | java | package mvc.modelo.dao.idaos;
import mvc.modelo.dominio.LineaAerea;
public interface LineaAereaDAO {
public boolean registrarLAerea(LineaAerea lineaAerea);
public void modificarLAerea(LineaAerea lineaAerea);
public LineaAerea obtenerLAerea(String nombre);
public LineaAerea obtenerLAerea(int id);
public boolean eliminarLAerea(LineaAerea lineaAerea);
}
| [
"matias14medina@gmail.com"
] | matias14medina@gmail.com |
832c359c0d3698406c10dc84e2b298e9973009e3 | 95c49f466673952b465e19a5ee3ae6eff76bee00 | /src/main/java/com/zhihu/android/app/mixtape/model/RefreshListError.java | a44423651201f0843ca72ff37ae2841569d7631f | [] | no_license | Phantoms007/zhihuAPK | 58889c399ae56b16a9160a5f48b807e02c87797e | dcdbd103436a187f9c8b4be8f71bdf7813b6d201 | refs/heads/main | 2023-01-24T01:34:18.716323 | 2020-11-25T17:14:55 | 2020-11-25T17:14:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | package com.zhihu.android.app.mixtape.model;
import kotlin.Metadata;
import kotlin.p2243e.p2245b.C32569u;
@Metadata
/* compiled from: KmVideoPlayerError.kt */
public final class RefreshListError extends ListDataError {
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public RefreshListError(Throwable th) {
super(th);
C32569u.m150519b(th, "throwable");
}
}
| [
"seasonpplp@qq.com"
] | seasonpplp@qq.com |
a4e87a108dc0df4047955a0759f4aa376b61ae28 | af2c14d696ebea94d15fce0d934682997782fde7 | /src/main/java/sm/sustord/bean/DetailsCoursePojo.java | 85ddd071d32f13c3eb244721fd8a57eb69f4b4ec | [] | no_license | shafinmahmud/sustord | 9e962c78a711602ffa755a8b8e37ee5d071db734 | 2150840918c299a90705a2d99a57f71f0dd4b098 | refs/heads/master | 2021-01-21T04:55:00.828407 | 2016-07-04T23:03:44 | 2016-07-04T23:03:44 | 31,964,077 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,053 | java | /*
*/
package sm.sustord.bean;
/**
*
* @author SHAFIN
*/
public class DetailsCoursePojo extends CoursePojo{
private String courseDescription;
private String courseReferences;
/**
* @return the courseDescription
*/
public String getCourseDescription() {
return courseDescription;
}
/**
* @param courseDescription the courseDescription to set
*/
public void setCourseDescription(String courseDescription) {
this.courseDescription = courseDescription;
}
/**
* @return the courseReferences
*/
public String getCourseReferences() {
return courseReferences;
}
/**
* @param courseReferences the courseReferences to set
*/
public void setCourseReferences(String courseReferences) {
this.courseReferences = courseReferences;
}
@Override
public String toString() {
return "DetailsCoursePojo{" + "courseDescription=" + courseDescription + ", courseReferences=" + courseReferences + '}';
}
}
| [
"shafin.mahmud@gmail.com"
] | shafin.mahmud@gmail.com |
892e677e1ceeff0736c13eb2a5cc96945fd8b458 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/jdbi/learning/1950/ParsedSql.java | 446cc49feca1379263a69d82e256a38d2fe95d70 | [] | 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 | 4,936 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jdbi.v3.core.statement;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* The SQL and parameters parsed from an SQL statement.
*/
public class ParsedSql {
static final String POSITIONAL_PARAM = "?";
private final String sql;
private final ParsedParameters parameters;
private ParsedSql(String sql, ParsedParameters parameters) {
this.sql = sql;
this.parameters = parameters;
}
/**
* @return an SQL string suitable for use with a JDBC
* {@link java.sql.PreparedStatement}.
*/
public String getSql() {
return sql;
}
/**
* @return the set of parameters parsed from the input SQL string.
*/
public ParsedParameters getParameters() {
return parameters;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ParsedSql that = (ParsedSql) o;
return Objects.equals(sql, that.sql)
&& Objects.equals(parameters, that.parameters);
}
@Override
public int hashCode() {
return Objects.hash(sql, parameters);
}
@Override
public String toString() {
return "ParsedSql{"
+ "sql='" + sql + '\''
+ ", parameters=" + parameters
+ '}';
}
/**
* A static factory of {@link ParsedSql} instances. The statement
* may contain only positional parameters
* (the {@value #POSITIONAL_PARAM} character). If your SQL
* code contains named parameters (for example variables preceded
* by a colon) then you have to replace them with positional
* parameters and specify the mapping in the
* {@link ParsedParameters}. You cannot mix named and positional
* parameters in one SQL statement.
*
* @param sql the SQL code containing only positional parameters
* @param parameters the ordered list of named parameters, or positional parameters
* @return New {@link ParsedSql} instance
* @see ParsedParameters#positional(int)
* @see ParsedParameters#named(List)
*/
public static ParsedSql of(String sql, ParsedParameters parameters) {
return new ParsedSql(sql, parameters);
}
/**
* @return a new ParsedSql builder.
*/
public static Builder builder() {
return new Builder();
}
/**
* Fluent builder for ParsedSql instances.
*/
public static class Builder {
private Builder() {}
private final StringBuilder sql = new StringBuilder();
private boolean positional = false;
private boolean named = false;
private final List<String> parameterNames = new ArrayList<>();
/**
* Appends the given SQL fragment to the SQL string.
*
* @param sqlFragment the SQL fragment
* @return this
*/
public Builder append(String sqlFragment) {
sql.append(sqlFragment);
return this;
}
/**
* Records a positional parameters, and appends a <code>?</code> to the
* SQL string.
*
* @return this
*/
public Builder appendPositionalParameter() {
positional = true;
parameterNames.add(POSITIONAL_PARAM);
return append(POSITIONAL_PARAM);
}
/**
* Records a named parameter with the given name, and appends a
* <code>?</code> to the SQL string.
*
* @param name the parameter name.
* @return this
*/
public Builder appendNamedParameter(String name) {
named = true;
parameterNames.add(name);
return append(POSITIONAL_PARAM);
}
/**
* @return the finalized {@link ParsedSql} object.
*/
public ParsedSql build() {
if (positional && named) {
throw new UnableToExecuteStatementException(
"Cannot mix named and positional parameters in a SQL statement: " + parameterNames);
}
ParsedParameters parameters = new ParsedParameters(positional, parameterNames);
return new ParsedSql(sql.toString(), parameters);
}
}
}
| [
"bloriot97@gmail.com"
] | bloriot97@gmail.com |
47ae9426aff237dc8c6c31507d61d61668caf78b | 6fd76d7c395144afed9ee26f382ded9bd764226a | /src/PostingTreeTest.java | 2c51ebf327a19472b310703a20c520db9202c15d | [] | no_license | bhong0423/social-network-posting-tree | a6640c2a33305cfc1b5caa1176f60b187550a761 | fb2a570d688f97c5e1a3119d6dc65e7dc75ff5bd | refs/heads/master | 2020-05-04T19:17:41.530678 | 2019-04-03T23:37:54 | 2019-04-03T23:37:54 | 179,386,098 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,708 | java | import static org.junit.Assert.*;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static common.JUnitUtil.*;
import java.util.Arrays;
import java.util.List;
import java.util.function.Function;
import org.junit.BeforeClass;
import org.junit.Test;
public class PostingTreeTest {
private static Network n;
private static Person[] people;
private static Person personA;
private static Person personB;
private static Person personC;
private static Person personD;
private static Person personE;
private static Person personF;
private static Person personG;
private static Person personH;
private static Person personI;
private static Person personJ;
private static Person personK;
private static Person personL;
@BeforeClass
public static void setup() {
n= new Network();
people= new Person[]{new Person("A", n, 0),
new Person("B", n, 0), new Person("C", n, 0),
new Person("D", n, 0), new Person("E", n, 0), new Person("F", n, 0),
new Person("G", n, 0), new Person("H", n, 0), new Person("I", n, 0),
new Person("J", n, 0), new Person("K", n, 0), new Person("L", n, 0)
};
personA= people[0];
personB= people[1];
personC= people[2];
personD= people[3];
personE= people[4];
personF= people[5];
personG= people[6];
personH= people[7];
personI= people[8];
personJ= people[9];
personK= people[10];
personL= people[11];
}
@Test
public void testBuiltInGetters() {
PostingTree st= new PostingTree(personB);
assertEquals("B", toStringBrief(st));
}
/** Create a PostingTree with structure A[B[D E F[G[H[I]]]] C]
* Doesn't rely on method add(..) of PostingTree. */
private PostingTree makeTree1() {
PostingTree dt = new PostingTree(personA); // A
dt.insert(personB, personA); // A, B
dt.insert(personC, personA); // A, C
dt.insert(personD, personB); // B, D
dt.insert(personE, personB); // B, E
dt.insert(personF, personB); // B, F
dt.insert(personG, personF); // F, G
dt.insert(personH, personG); // G, H
dt.insert(personI, personH); // H, I
return new PostingTree(dt);
}
@Test
public void testMakeTree1() {
PostingTree dt= makeTree1();
assertEquals("A[B[D E F[G[H[I]]]] C]", toStringBrief(dt));
}
@Test
public void testgetSharedAncestor() {
PostingTree st= makeTree1();
// A.testSharedAncestorOf(A, A) is A
assertEquals(personA, st.getSharedAncestor(personA, personA));
// A.testSharedAncestorOf(A, B) is B
assertEquals(personA, st.getSharedAncestor(personA, personB));
// A.testSharedAncestorOf(E, B) is E
assertEquals(personE, st.getSharedAncestor(personE, personE));
// A.testSharedAncestorOf(D, I) is B
assertEquals(personB, st.getSharedAncestor(personD, personI));
// A.testSharedAncestorOf(I, D) is B
assertEquals(personB, st.getSharedAncestor(personI, personD));
}
@Test
public void test1Insert() {
PostingTree st= new PostingTree(personB);
assertThrows(IllegalArgumentException.class, () -> {
st.insert(null, personB);
});
assertThrows(IllegalArgumentException.class, () -> {
st.insert(personC, null);
});
//Test add to root
PostingTree dt2= st.insert(personC, personB);
assertEquals("B[C]", toStringBrief(st)); // test tree
assertEquals(people[2], dt2.getRoot()); // test return value
assertThrows(IllegalArgumentException.class, () -> {
st.insert(personC, personB);
});
assertThrows(IllegalArgumentException.class, () -> {
st.insert(personD, personE);
});
//Test add to non-root
PostingTree dt3= st.insert(personD, personC);
assertEquals("B[C[D]]", toStringBrief(st)); // test tree
assertEquals(people[3], dt3.getRoot()); // test return value
//Test add second child
PostingTree dt0= st.insert(personA, personC);
assertEquals("B[C[A D]]", toStringBrief(st)); // test tree
assertEquals(personA, dt0.getRoot()); // test return value
//Test add child to child's child
PostingTree dt6= st.insert(personG, personA);
assertEquals("B[C[A[G] D]]", toStringBrief(st)); // test tree
assertEquals(personG, dt6.getRoot()); // test return value
//Test add to child's tree
PostingTree dt7= st.insert(personH, personG);
assertEquals("B[C[A[G[H]] D]]", toStringBrief(st)); // test tree
assertEquals(people[7], dt7.getRoot()); // test return value
}
@Test
public void test2Size() {
PostingTree st= new PostingTree(personB);
assertEquals(1, st.size());
PostingTree dt2= st.insert(personC, personB);
assertEquals(2, st.size());
PostingTree dt3 = st.insert(personD, personB);
assertEquals(3, st.size());
PostingTree dt4 = st.insert(personE, personC);
assertEquals(4, st.size());
}
@Test
public void test3Depth() {
PostingTree st= new PostingTree(personB);
PostingTree dt2= st.insert(personC, personB);
assertEquals(0, st.depth(personB));
assertEquals(1, st.depth(personC));
PostingTree dt3 = st.insert(personD, personC);
assertEquals(2, st.depth(personD));
assertEquals(-1, st.depth(personE));
}
@Test
public void test4WidthAtDepth() {
PostingTree st= new PostingTree(personA);
assertEquals(1, st.widthAtDepth(0));
PostingTree dt2= st.insert(personB, personA);
PostingTree dt3 = st.insert(personC, personA);
assertEquals(2, st.widthAtDepth(1));
PostingTree dt4 = st.insert(personD, personB);
PostingTree dt5 = st.insert(personE, personC);
PostingTree dt6 = st.insert(personF, personC);
assertEquals(3, st.widthAtDepth(2));
PostingTree dt7 = st.insert(personG, personF);
assertEquals(1, st.widthAtDepth(3));
assertEquals(1, dt3.widthAtDepth(0));
assertEquals(2, dt3.widthAtDepth(1));
assertThrows(IllegalArgumentException.class, () -> {
st.widthAtDepth(-1);
});
}
@Test
public void test5getPostingRoute() {
PostingTree st= new PostingTree(personA);
PostingTree dt2= st.insert(personB, personA);
PostingTree dt3 = st.insert(personC, personA);
PostingTree dt4 = st.insert(personD, personB);
PostingTree dt5 = st.insert(personE, personC);
PostingTree dt6 = st.insert(personF, personC);
PostingTree dt7 = st.insert(personG, personF);
List route1 = st.getPostingRoute(personE);
List route2 = st.getPostingRoute(personA);
List route3 = st.getPostingRoute(personH);
List route4 = dt2.getPostingRoute(personC);
List route5 = dt2.getPostingRoute(personD);
assertEquals("[A, C, E]", getNames(route1));
assertEquals("[A]", getNames(route2));
assertEquals(null, route3);
assertEquals(null, route4);
assertEquals("[B, D]", getNames(route5));
}
/** Return the names of Persons in sp, separated by ", " and delimited by [ ].
* Precondition: No name is the empty string. */
private String getNames(List<Person> sp) {
String res= "[";
for (Person p : sp) {
if (res.length() > 1) res= res + ", ";
res= res + p.getName();
}
return res + "]";
}
//@Test
public void test6getSharedAncestor() {
PostingTree st= new PostingTree(personA);
PostingTree dt2= st.insert(personB, personA);
PostingTree dt3 = st.insert(personC, personA);
PostingTree dt4 = st.insert(personD, personB);
PostingTree dt5 = st.insert(personE, personC);
PostingTree dt6 = st.insert(personF, personC);
PostingTree dt7 = st.insert(personG, personD);
Person p1= st.getSharedAncestor(personB, personA);
Person p2= st.getSharedAncestor(personB, personB);
Person p3= st.getSharedAncestor(personB, personC);
Person p4= st.getSharedAncestor(personA, personC);
Person p5= st.getSharedAncestor(personE, personF);
Person p6= st.getSharedAncestor(personG, personF);
Person p7= dt2.getSharedAncestor(personB, personE);
Person p8= dt2.getSharedAncestor(personB, personA);
Person p9= dt2.getSharedAncestor(personD, personF);
Person p10= st.getSharedAncestor(personD, personH);
Person p11= st.getSharedAncestor(null, personC);
assertEquals(personA, p1);
assertEquals(personB, p2);
assertEquals(personA, p3);
assertEquals(personA, p4);
assertEquals(personC, p5);
assertEquals(personA, p6);
assertEquals(null, p7);
assertEquals(null, p8);
assertEquals(null, p9);
assertEquals(null, p10);
assertEquals(null, p11);
}
@Test
public void test7equals() {
PostingTree tree1= new PostingTree(personB);
PostingTree tree2= new PostingTree(personB);
assertEquals(true, tree1.equals(tree2));
assertEquals(false, tree1.equals(1));
}
/** Return a representation of this tree. This representation is:
* (1) the name of the Person at the root, followed by
* (2) the representations of the children (in alphabetical
* order of the children's names).
* There are two cases concerning the children.
*
* No children? Their representation is the empty string.
* Children? Their representation is the representation of each child, with
* a blank between adjacent ones and delimited by "[" and "]".
* Examples:
* One-node tree: "A"
* root A with children B, C, D: "A[B C D]"
* root A with children B, C, D and B has a child F: "A[B[F] C D]"
*/
public static String toStringBrief(PostingTree t) {
String res= t.getRoot().getName();
Object[] childs= t.getChildren().toArray();
if (childs.length == 0) return res;
res= res + "[";
selectionSort1(childs);
for (int k= 0; k < childs.length; k= k+1) {
if (k > 0) res= res + " ";
res= res + toStringBrief(((PostingTree)childs[k]));
}
return res + "]";
}
/** Sort b --put its elements in ascending order.
* Sort on the name of the Person at the root of each SharingTree
* Throw a cast-class exception if b's elements are not SharingTrees */
public static void selectionSort1(Object[] b) {
int j= 0;
// {inv P: b[0..j-1] is sorted and b[0..j-1] <= b[j..]}
// 0---------------j--------------- b.length
// inv : b | sorted, <= | >= |
// --------------------------------
while (j != b.length) {
// Put into p the index of smallest element in b[j..]
int p= j;
for (int i= j+1; i != b.length; i++) {
String bi= ((PostingTree)b[i]).getRoot().getName();
String bp= ((PostingTree)b[p]).getRoot().getName();
if (bi.compareTo(bp) < 0) {
p= i;
}
}
// Swap b[j] and b[p]
Object t= b[j]; b[j]= b[p]; b[p]= t;
j= j+1;
}
}
}
| [
"Brandon@MacBook-Pro.local"
] | Brandon@MacBook-Pro.local |
8b8e5a7664eba59a23ec431829fb1ec14c14917d | 6b881f28821b3247b8c98291de5b71f7c198e41f | /app/src/main/java/com/example/mycounsille/RecentlyChat.java | 2d87cc2ccd51d3c1341beb4cb9f09b33546e02c8 | [] | no_license | Clarisse-3924/RFTCLeaveapp | f41a5eb66587429bedd4ace68d758c62842eb3f9 | 640dd3ad6eea134a784d9c305c00ceec4d8c2809 | refs/heads/master | 2023-07-09T15:27:42.862206 | 2021-08-11T07:17:18 | 2021-08-11T07:17:18 | 385,663,540 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,068 | java | package com.example.mycounsille;
public class RecentlyChat {
private String uidSender; // uid the sender to know whether you sent it or someone else
private String uidRecentlyChat; //uid who is talking to get avt
private String nameRecentlychat;
private String content;
private String type;
private String lastMessageTime;
private boolean seen; // get status to view message or not
public RecentlyChat(){
}
public RecentlyChat(String uidSender, String uidRecentlyChat, String nameRecentlychat, String content,
String type, String lastMessageTime, boolean seen) {
this.uidSender = uidSender;
this.uidRecentlyChat = uidRecentlyChat;
this.nameRecentlychat = nameRecentlychat;
this.content = content;
this.type = type;
this.lastMessageTime = lastMessageTime;
this.seen = seen;
}
public String getUidSender() {
return uidSender;
}
public void setUidSender(String uidSender) {
this.uidSender = uidSender;
}
public String getUidRecentlyChat() {
return uidRecentlyChat;
}
public void setUidRecentlyChat(String uidRecentlyChat) {
this.uidRecentlyChat = uidRecentlyChat;
}
public String getNameRecentlychat() {
return nameRecentlychat;
}
public void setNameRecentlychat(String nameRecentlychat) {
this.nameRecentlychat = nameRecentlychat;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getLastMessageTime() {
return lastMessageTime;
}
public void setLastMessageTime(String lastMessageTime) {
this.lastMessageTime = lastMessageTime;
}
public boolean isSeen() {
return seen;
}
public void setSeen(boolean seen) {
this.seen = seen;
}
}
| [
"cuwizeyimana3924@gmail.com"
] | cuwizeyimana3924@gmail.com |
c6ca30702c768db9727e46e9482190bcd8e8be3f | 049e9c68be4eca1d039d140f59adc416ccae1759 | /src/main/java/com/mycompany/domain/AuthenticationCode.java | 82b761ad4a2814d2cede18558fbf1aa4a81052be | [] | no_license | jsjg73/ReSkillUpProject | 422272347fbd31a6f5cb50b8a9c940781dbea65c | fed9940969c3792872d25eae433aff1c67ba5ebc | refs/heads/master | 2023-03-29T13:30:47.304292 | 2021-02-15T10:29:10 | 2021-02-15T10:29:10 | 356,762,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package com.mycompany.domain;
import java.util.ArrayList;
public class AuthenticationCode {
private static AuthenticationCode auth_code = null;
private static ArrayList<Integer> code_list = null;
private AuthenticationCode(){}
public static AuthenticationCode getInstance() {
if(auth_code == null) {
auth_code = new AuthenticationCode();
code_list = new ArrayList<>();
code_list.add(1234);
}
return auth_code;
}
public boolean check(int code) {
return code_list.contains(code);
}
}
| [
"ckstn123@cnu.ac.kr"
] | ckstn123@cnu.ac.kr |
2db5235a115b9c4bb3beb51ad495f4f15b5c038f | eff8849708d639b369138395e43d28d43f1655da | /src/model/ObjCidade.java | 229413b635034132039fa7724f83be77eb957dc8 | [] | no_license | LuizIbarra68/Mercado_m171 | 557fbaa305f011def0b960cb194b0d32c0514033 | e5100be3d6a521c9cf4151a923af4492c3a4d6e2 | refs/heads/master | 2020-03-23T20:00:33.114977 | 2018-07-31T14:33:02 | 2018-07-31T14:33:02 | 142,015,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package model;
public class ObjCidade {
private int codigo;
private String nome;
public ObjCidade() {
}
public ObjCidade(int codigo, String nome) {
this.codigo = codigo;
this.nome = nome;
}
@Override
public String toString() {
return nome; //To change body of generated methods, choose Tools | Templates.
}
public int getCodigo() {
return this.codigo;
}
public void setCodigo(int codigo) {
this.codigo = codigo;
}
public String getNome() {
return this.nome;
}
public void setNome(String nome) {
this.nome = nome;
}
}
| [
"181700008@LAB30813.senacinformatica.br"
] | 181700008@LAB30813.senacinformatica.br |
3828bef0f4a34180b5347a5427bc7c8f55b73dd0 | fde14be5ffc2637ba925ee420c068779a00e5ef4 | /app/src/main/java/id/sch/smktelkom_mlg/learn/intent1/MainActivity.java | 3e557b0be2f819a9d96ea9168aa85da3a77fa2bb | [] | no_license | nabilrizqi21/Intent1 | a4b2e0c6dd2ba275ad665203951f6f865adfa803 | b16ee5aa0c66822bb34e79c0eebb2b244c07b593 | refs/heads/master | 2021-01-11T02:51:49.016840 | 2016-10-18T01:12:18 | 2016-10-18T01:12:18 | 70,890,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | package id.sch.smktelkom_mlg.learn.intent1;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.buttonHitung).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
findViewById(R.id.buttonHitung).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(MainActivity.this, HasilActivity.class));
}
});
}
}
| [
"mohammad_rizqi_24rpl@student.smktelkom-mlg.sch.id"
] | mohammad_rizqi_24rpl@student.smktelkom-mlg.sch.id |
4e933bec86a647308a6a6a9daf078869dd489204 | ed5159d056e98d6715357d0d14a9b3f20b764f89 | /test/irvine/oeis/a117/A117475Test.java | dba53ec4679950d8ce5a505bb4e8be4991a523de | [] | no_license | flywind2/joeis | c5753169cf562939b04dd246f8a2958e97f74558 | e5efd6971a0062ac99f4fae21a7c78c9f9e74fea | refs/heads/master | 2020-09-13T18:34:35.080552 | 2019-11-19T05:40:55 | 2019-11-19T05:40:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package irvine.oeis.a117;
import irvine.oeis.AbstractSequenceTest;
/**
* Tests the corresponding class.
* @author Sean A. Irvine
*/
public class A117475Test extends AbstractSequenceTest {
}
| [
"sairvin@gmail.com"
] | sairvin@gmail.com |
3c803df9d84fc788fea3057f9b8333c5b7963005 | b34654bd96750be62556ed368ef4db1043521ff2 | /cloud_vm_service/branches/cockpit_trunk/src/java/main/com/topcoder/direct/services/view/dto/cloudvm/VMAvailabilityZone.java | fe0ba2c11889569b02048d3096313ad5cc6aa480 | [] | no_license | topcoder-platform/tcs-cronos | 81fed1e4f19ef60cdc5e5632084695d67275c415 | c4ad087bb56bdaa19f9890e6580fcc5a3121b6c6 | refs/heads/master | 2023-08-03T22:21:52.216762 | 2019-03-19T08:53:31 | 2019-03-19T08:53:31 | 89,589,444 | 0 | 1 | null | 2019-03-19T08:53:32 | 2017-04-27T11:19:01 | null | UTF-8 | Java | false | false | 1,114 | java | /*
* Copyright (C) 2010 TopCoder Inc., All Rights Reserved.
*/
package com.topcoder.direct.services.view.dto.cloudvm;
/**
* This class represents the VM availability zone.
*
* Thread-safety: Mutable and not thread-safe.
*
* @author Standlove, TCSDEVELOPER
* @version 1.0
*/
public class VMAvailabilityZone extends AbstractIdEntity {
/**
* The serial version uid.
*/
private static final long serialVersionUID = 9438501481250834L;
/**
* Represents the availability zone name. It has getter & setter. It can be any value.
*/
private String name;
/**
* Empty constructor.
*/
public VMAvailabilityZone() {
}
/**
* Getter for the namesake instance variable. Simply return the namesake instance variable.
*
* @return field value
*/
public String getName() {
return name;
}
/**
* Setter for the namesake instance variable. Simply set the value to the namesake instance variable.
*
* @param name value to set
*/
public void setName(String name) {
this.name = name;
}
}
| [
"mashannon168@fb370eea-3af6-4597-97f7-f7400a59c12a"
] | mashannon168@fb370eea-3af6-4597-97f7-f7400a59c12a |
86bbb53e1ce7b5bfa7700e284ceda20975ab9eb0 | 7a486133550c4dd55ff115c03ecfb0c8b707c13b | /Exercici_Lletres/src/LletresExtra/LletresFase3Interactiu.java | 2e0909a56481483eb80158aea6b0a3e3bdf1e1b5 | [] | no_license | Alejandro-CP/LletresRepetides | 5412ff2217f346b35b67d265cd46726a87817e13 | f84f99a2e63e96700d06b765675cc94110d60e1e | refs/heads/master | 2020-04-12T03:39:32.494840 | 2018-12-19T10:48:20 | 2018-12-19T10:48:20 | 162,273,263 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 1,821 | java | package LletresExtra;
import java.util.*;
public class LletresFase3Interactiu {
//static ArrayList<Character> nameList = new ArrayList<>(Arrays.asList('A', 'l', 'e', 'j', 'a', 'n', 'd', 'r', 'o'));
static Scanner in = new Scanner(System.in);
static ArrayList<Character> word = new ArrayList<>();
public static void main(String[] args) {
getWord(word);
printWord(word);
printCapcelera();
printQuantitatLletres(comptaLletres(word));
}
public static void printWord(ArrayList<Character> word) {
System.out.print("La paraula \"");
for(int i = 0; i < word.size(); i++) {
System.out.printf("%c", word.get(i));
}
System.out.printf("\" conté: \n\n");
}
public static void printCapcelera() {
System.out.printf("Lletra\tQuantitat\n");
System.out.printf("------\t---------\n");
}
public static HashMap<Character, Integer> comptaLletres(ArrayList<Character> word) {
HashMap<Character, Integer> mapaLletres = new HashMap<>();
for(int i = 0; i < word.size(); i++) {
if (mapaLletres.containsKey(Character.toUpperCase(word.get(i)))){
int j = mapaLletres.get(Character.toUpperCase(word.get(i)));
j ++;
mapaLletres.put(Character.toUpperCase(word.get(i)), j);
}else {
mapaLletres.put(Character.toUpperCase(word.get(i)), 1);
}
}
return mapaLletres;
}
@SuppressWarnings("rawtypes")
public static void printQuantitatLletres(HashMap<Character, Integer> llistaQ) {
Set lletres = llistaQ.entrySet();
Iterator iter = lletres.iterator();
while(iter.hasNext()) {
Map.Entry mentry = (Map.Entry)iter.next();
System.out.printf("%c\t%d\n", mentry.getKey(), mentry.getValue());
}
}
public static void getWord(ArrayList<Character> word){
System.out.println("Introdueix una paraula: ");
for(char c : in.nextLine().toCharArray()) {
word.add(c);
}
}
}
| [
"alex_calle@hotmail.com"
] | alex_calle@hotmail.com |
ccbe350b019b71ad9e14fafa0ccc0336ae43deab | 639636146960666ea396c8644b09957844126f03 | /SQLiteViewer.java | af97af966bb65f7096b16f00fcbdb95942251cb1 | [] | no_license | stasiey/Sqlite---viewer | 76c3d9d41d9cccaaa32a8c229c42c07a07ec748e | 72328f2dd7ac333c6cc4d2490010c92dfe0e126e | refs/heads/main | 2023-07-24T12:45:21.209858 | 2021-08-28T16:11:46 | 2021-08-28T16:11:46 | 400,836,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,834 | java | package viewer;
import org.sqlite.SQLiteDataSource;
import javax.swing.*;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.sql.*;
import java.util.ArrayList;
public class SQLiteViewer extends JFrame {
public SQLiteViewer() {
super("SQLite Viewer");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(700, 900);
setLayout(null);
setResizable(false);
setLocationRelativeTo(null);
x();
setVisible(true);
}
private void x(){
JTextField FileNameTextField = new JTextField();
FileNameTextField.setName("FileNameTextField");
FileNameTextField.setBounds(10,10,580,20);
JButton OpenFileButton = new JButton("Open");
OpenFileButton.setName("OpenFileButton");
OpenFileButton.setBounds(600,10,70,20);
OpenFileButton.setBackground(Color.RED);
JComboBox<String> TablesComboBox = new JComboBox<>();
TablesComboBox.setName("TablesComboBox");
TablesComboBox.setBounds(10,50,650,20);
JTextArea QueryTextArea = new JTextArea();
QueryTextArea.setName("QueryTextArea");
QueryTextArea.setBounds(10,90,550,80);
JButton ExecuteQueryButton = new JButton("Execute");
ExecuteQueryButton.setName("ExecuteQueryButton");
ExecuteQueryButton.setBounds(570,90,90,30);
myTableModel myTableModel = new myTableModel();
JTable Table = new JTable(myTableModel);
Table.setName("Table");
JScrollPane sp = new JScrollPane(Table);
sp.setBounds(10, 180 , 660,200);
add(FileNameTextField);
add(OpenFileButton);
add(TablesComboBox);
add(QueryTextArea);
add(ExecuteQueryButton);
add(sp);
QueryTextArea.setEnabled(false);
ExecuteQueryButton.setEnabled(false);
OpenFileButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
TablesComboBox.removeAllItems();
if (new File(FileNameTextField.getText()).isFile()) {
ArrayList<String> s = Database.forTableComboBox(FileNameTextField.getText());
Database.forTableComboBox(FileNameTextField.getText()).forEach(TablesComboBox::addItem);
if (s.size() == 0){
QueryTextArea.setEnabled(false);
ExecuteQueryButton.setEnabled(false);
}
if (TablesComboBox.getItemCount() != 0){
QueryTextArea.setEnabled(true);
ExecuteQueryButton.setEnabled(true);
}
} else {
JOptionPane.showMessageDialog(new Frame(), "ERROR MESSAGE");
}
}
});
TablesComboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
QueryTextArea.setEnabled(false);
ExecuteQueryButton.setEnabled(false);
String query = "SELECT * FROM %s;";
QueryTextArea.setText(String.format(query,TablesComboBox.getSelectedItem()));
}
});
ExecuteQueryButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
QueryTextArea.setEnabled(false);
ExecuteQueryButton.setEnabled(false);
String error = Database.forTableTable(FileNameTextField.getText(),QueryTextArea.getText(),myTableModel);
if (error != null) {
JOptionPane.showMessageDialog(new Frame(), "ERROR MESSAGE");
} else {
QueryTextArea.setEnabled(true);
ExecuteQueryButton.setEnabled(true);
}
}
});
}
}
class myTableModel extends AbstractTableModel{
String[] cols = new String[0];
private ArrayList<Object[]> data = new ArrayList<>(0);
@Override
public int getRowCount() {
return data.size();
}
@Override
public int getColumnCount() {
return cols.length;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return data.get(rowIndex)[columnIndex];
}
@Override
public String getColumnName(int columnIndex) {
return cols[columnIndex];
}
public void setTableData(String[] cols, ArrayList<Object[]> data) {
this.cols = cols;
this.data = data;
fireTableStructureChanged();
fireTableDataChanged();
}
}
| [
"87606677+stasiey@users.noreply.github.com"
] | 87606677+stasiey@users.noreply.github.com |
dc0b1467d9dd52f14b24907b8929d923c783a24f | 9fc75a5c1faddf58d15b80736495a0c411d18920 | /src/main/java/com/ilku1297/Main.java | 909fc245ba166ac10e2bdad3e4ca4a76fd9f33cf | [] | no_license | GamesIS/molpid | a987e94cb1368a7f1e89fdf876dc6afc564d4be9 | e3905702e8d33ec8d66971af01d3043dd511df79 | refs/heads/master | 2020-04-21T03:39:55.378387 | 2019-04-09T13:58:18 | 2019-04-09T13:58:18 | 169,290,396 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,009 | java | package com.ilku1297;
import com.github.sarxos.webcam.Webcam;
import com.github.sarxos.webcam.WebcamPanel;
import com.github.sarxos.webcam.WebcamResolution;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.embed.swing.SwingFXUtils;
import javafx.embed.swing.SwingNode;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.image.WritableImage;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import org.opencv.core.Mat;
import org.opencv.imgcodecs.Imgcodecs;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
public class Main extends Application {
public static final int WEB_CAM_WIDTH = 640;//Можно поставить 640
public static final int WEB_CAM_HEIGHT = 480;//Можно поставить 480
public static final int TIME_UPDATE = 35;// Плавно при 20
Mat matrix = null;
//private Webcam webcam; //webcam from sarxos libary
public static final ImageView mainImage = new ImageView();
private Webcam webcam = Webcam.getDefault();
private WebcamPanel webcamPanel = new WebcamPanel(webcam, false);
@Override
public void start(Stage stage) throws IOException {
//webcam.setViewSize(new Dimension(1920,1080));
Dimension frameSize = new Dimension(WEB_CAM_WIDTH, WEB_CAM_HEIGHT);
webcam.setCustomViewSizes(new Dimension[] { frameSize });
webcam.setViewSize(frameSize);
//final SwingNode swingNode = new SwingNode();
//createSwingContent(swingNode);
//StackPane pane = new StackPane();
//pane.getChildren().add(swingNode);
//stage.setTitle("Swing in JavaFX");
//stage.setScene(new Scene(pane, 1024, 576));
//stage.show();
mainImage.setFitWidth(WEB_CAM_WIDTH);
mainImage.setFitHeight(WEB_CAM_HEIGHT);
//mainImage.setImage(bufToFXImage(DBHandler.loadPhoto("E:/OpenCV/chap22/sanpshot.jpg")));
Label secondLabel = new Label("I'm a Label on new Window");
StackPane secondaryLayout = new StackPane();
//secondaryLayout.getChildren().add(secondLabel);
secondaryLayout.getChildren().add(mainImage);
Scene secondScene = new Scene(secondaryLayout, WEB_CAM_WIDTH, WEB_CAM_HEIGHT);
Stage newWindow = new Stage();
newWindow.setTitle("Second Stage");
newWindow.setScene(secondScene);
newWindow.setX(stage.getX() + 200);
newWindow.setY(stage.getY() + 100);
newWindow.show();
webcam.open();
cycle();
}
private void createSwingContent(final SwingNode swingNode) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
swingNode.setContent(webcamPanel);
webcamPanel.start();
}
});
}
private void cycle() {
new Thread(() -> {
while (true){
try {
Thread.sleep(TIME_UPDATE);
System.out.println(webcam.getFPS());
} catch (InterruptedException e) {
e.printStackTrace();
}
WritableImage writableImage = bufToFXImage(webcam.getImage());
Platform.runLater(() -> mainImage.setImage(writableImage));
}
}).start();
}
public static WritableImage bufToFXImage(BufferedImage bufferedImage){
return SwingFXUtils.toFXImage(bufferedImage, null);
}
public void saveImage() {
// Saving the Image
String file = "E:/OpenCV/chap22/sanpshot.jpg";
// Instantiating the imgcodecs class
Imgcodecs imageCodecs = new Imgcodecs();
// Saving it again
imageCodecs.imwrite(file, matrix);
}
public static void main(String args[]) {
launch(args);
}
} | [
"IlyaK1997@gmail.com"
] | IlyaK1997@gmail.com |
34e80747363f7553e495a046604b8beb584c1d66 | c8dce5ccc254a44a6a9bb5ad47b73e40cbb726fb | /src/main/java/com/js/v4/framework/aop/aspect/MyAdvice.java | 0779dd43e93fce6976ebb56fb385558841f2dd14 | [] | no_license | flymainstream/mySpring | 3a3b7a01cbc10616bda7bcf556faa88bf68ffd90 | f8279cd58f049fc81608d56eb656fa64764b5a2d | refs/heads/main | 2023-02-22T03:14:43.189921 | 2021-01-27T13:07:50 | 2021-01-27T13:07:50 | 319,678,174 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 938 | java | package com.js.v4.framework.aop.aspect;
import java.lang.reflect.Method;
/**
* @author 刘锦涛
* @title: MyAdvice
* @projectName spring
* @date 2021/1/4
* @dateTime 18:46
* @description: TODO
*/
public class MyAdvice {
private Object aspect;
private Method adviceMethod;
private String aspectAfterThrowingName;
public MyAdvice(Object aspect, Method adviceMethod, String aspectAfterThrowingName) {
this.aspect = aspect;
this.adviceMethod = adviceMethod;
this.aspectAfterThrowingName = aspectAfterThrowingName;
}
public MyAdvice(Object aspect, Method adviceMethod) {
this.aspect = aspect;
this.adviceMethod = adviceMethod;
}
public String getAspectAfterThrowingName() {
return aspectAfterThrowingName;
}
public Object getAspect() {
return aspect;
}
public Method getAdviceMethod() {
return adviceMethod;
}
}
| [
"myseeyouletplease@outlook.com"
] | myseeyouletplease@outlook.com |
3a09e2613392204248278d6b526296690a9a4950 | 53c09d50b6dcdef6b67924f4ccc7c1d429fa56d8 | /src/queryworkload/generator/DateMappedIntegerGenerator.java | cbafb4fc124bc8f574a555ef9043c0765f1d86c5 | [] | no_license | kimdhamilton/query-workload | 338489c1a9496ecd61c4482c63b74f196e77df51 | 32a112888ce21bad259fe3eff6faf2202236a532 | refs/heads/master | 2016-09-10T19:53:35.660950 | 2014-02-25T03:36:54 | 2014-02-25T03:36:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,457 | java | package queryworkload.generator;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import com.yahoo.ycsb.generator.IntegerGenerator;
public class DateMappedIntegerGenerator extends MappedIntegerGenerator {
private static final String DATE_FORMAT_STRING = "yyyy-MM-dd";
private final Date startDate;
public DateMappedIntegerGenerator(IntegerGenerator intGenerator, String startDateString) throws ParseException {
super(intGenerator);
SimpleDateFormat parserSDF = new SimpleDateFormat(DATE_FORMAT_STRING);
startDate = parserSDF.parse(startDateString);
}
@Override
public String map(int nextInt) {
SimpleDateFormat parserSDF = new SimpleDateFormat(DATE_FORMAT_STRING);
String lastMappedInt = mapDate(parserSDF, startDate, nextInt);
this.setLastMappedInt(lastMappedInt);
return lastMappedInt;
}
public static String mapNoSideEffects(String sd, int nextInt) throws ParseException {
SimpleDateFormat parserSDF = new SimpleDateFormat(DATE_FORMAT_STRING);
Date tempStartDate = parserSDF.parse(sd);
return mapDate(parserSDF, tempStartDate, nextInt);
}
private static String mapDate(SimpleDateFormat parserSDF, Date baseDate, int daysToAdd) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(baseDate);
calendar.add(Calendar.DATE, daysToAdd);
String lastMappedInt = parserSDF.format(calendar.getTime());
return lastMappedInt;
}
}
| [
"kimdhamilton@gmail.com"
] | kimdhamilton@gmail.com |
f0466811ae73cd4fdc8ac8dcfbc89fc7d1bb3888 | 62b5f0ff1ff1af44d0bcf953ebdd3cc9e1a07f0e | /xmlintelledit/xmltext/src/main/java/eclassxmlschemacommon_2_0Simplified/TargetValues.java | 05851ad0dda80f7849346e6eceef5f54a751f173 | [
"MIT"
] | permissive | patrickneubauer/XMLIntellEdit | 5014a2fa426116e42c7f4b318d636c3a48720059 | 5e4a0ad59b7e9446e7f79dcb32e09971c2193118 | refs/heads/master | 2021-01-12T01:56:56.595551 | 2018-11-10T00:35:14 | 2018-11-10T00:35:14 | 78,438,535 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,658 | java | /**
*/
package eclassxmlschemacommon_2_0Simplified;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Target Values</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link eclassxmlschemacommon_2_0Simplified.TargetValues#getTargetValue <em>Target Value</em>}</li>
* </ul>
*
* @see eclassxmlschemacommon_2_0Simplified.Eclassxmlschemacommon_2_0SimplifiedPackage#getTargetValues()
* @model
* @generated
*/
public interface TargetValues extends EObject {
/**
* Returns the value of the '<em><b>Target Value</b></em>' containment reference.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Target Value</em>' containment reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Target Value</em>' containment reference.
* @see #setTargetValue(VALUEREF)
* @see eclassxmlschemacommon_2_0Simplified.Eclassxmlschemacommon_2_0SimplifiedPackage#getTargetValues_TargetValue()
* @model containment="true" required="true"
* @generated
*/
VALUEREF getTargetValue();
/**
* Sets the value of the '{@link eclassxmlschemacommon_2_0Simplified.TargetValues#getTargetValue <em>Target Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Target Value</em>' containment reference.
* @see #getTargetValue()
* @generated
*/
void setTargetValue(VALUEREF value);
} // TargetValues
| [
"neubauer@big.tuwien.ac.at"
] | neubauer@big.tuwien.ac.at |
dc589551567dcd5b7c60641855a823034f8e664f | ec293518b9b0f25a437c98a592b1b4a781e044be | /app/src/test/java/com/wustor/aidl/ExampleUnitTest.java | c14fe7553489594e41ca2ab20678581e9c9afddb | [] | no_license | magic-coder/Binder | 1b7779073592f40cb2ca6ce8780360e043b0589a | bff417915c4304f6d70bc05020cf7463b21d06f4 | refs/heads/master | 2020-09-07T04:49:18.111918 | 2017-11-26T09:56:43 | 2017-11-26T09:56:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 393 | java | package com.wustor.aidl;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"15527283152@163.com"
] | 15527283152@163.com |
3f71153fd19dcd06477add152e2a1a7093ebf75f | 9b07afded750bd3ddb080c60c525ca9f7ada6ee1 | /src/main/java/com/lin/missyou/service/GridCategoryService.java | b6de0d9bd846c008314cf5bd19f919874e59e8bc | [] | no_license | xuejiqiuli69/missyou | 51ddc944dcd7930da4562cf3c3f3331ed00d2068 | 5f091c4159451f49acc4279923656f3f0e1d41e4 | refs/heads/master | 2021-08-07T12:58:35.737286 | 2020-06-09T16:28:17 | 2020-06-09T16:28:17 | 252,487,926 | 0 | 0 | null | 2021-06-04T02:41:33 | 2020-04-02T15:04:35 | Java | UTF-8 | Java | false | false | 562 | java | /**
* @作者 leokkzhang
* @创建时间 2020/4/6 20:14
*/
package com.lin.missyou.service;
import com.lin.missyou.model.GridCategory;
import com.lin.missyou.repository.GridCategoryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class GridCategoryService {
@Autowired
private GridCategoryRepository gridCategoryRepository;
public List<GridCategory> getGridCategoryList(){
return gridCategoryRepository.findAll();
}
}
| [
"zk_nju@163.com"
] | zk_nju@163.com |
c2560cb315397e11bb190d88e0dcb90ecac76583 | c0499e9b19b928a83b7a60f64ac31f80314e85ae | /src/main/java/hiring/model/Employer.java | 06e952aa2739a5f1ccb98991a5b19c589d4dbd46 | [] | no_license | KirillAndreevich/server | bed10ebcc720876b9e935af2c3471c0bbd92a2b4 | d9b9effbba24122db399e1b27264c358ae8236c5 | refs/heads/master | 2020-07-31T00:09:56.914374 | 2019-09-23T17:31:26 | 2019-09-23T17:31:26 | 210,411,231 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,352 | java | package hiring.model;
import java.io.Serializable;
import java.util.Objects;
public class Employer extends User implements Serializable {
private String company;
private String address;
private String firstName;
private String lastName;
private String patronymic;
//private Map<String, Integer> vacancy;
public Employer(String login, String password, String email, String company, String address, String firstName, String lastName, String patronymic) {
this(login, password, email, company, address, firstName, lastName);
this.patronymic = patronymic;
}
public Employer(String login, String password, String email, String company, String address, String firstName, String lastName) {
super(login, password, email, true);
this.company = company;
this.address = address;
this.firstName = firstName;
this.lastName = lastName;
}
public String getAddress() {
return address;
}
public String getCompany() {
return company;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getPatronymic() {
return patronymic;
}
public void setAddress(String address) {
this.address = address;
}
public void setCompany(String company) {
this.company = company;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setPatronymic(String patronymic) {
this.patronymic = patronymic;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Employer employer = (Employer) o;
return Objects.equals(company, employer.company) &&
Objects.equals(address, employer.address) &&
Objects.equals(firstName, employer.firstName) &&
Objects.equals(lastName, employer.lastName) &&
Objects.equals(patronymic, employer.patronymic);
}
@Override
public int hashCode() {
return Objects.hash(company, address, firstName, lastName, patronymic);
}
}
| [
"kirillandreevichklimov@yandex.ru"
] | kirillandreevichklimov@yandex.ru |
04723bb470c57bbb454db1f7fc18c8813b934ea2 | 4b20ae1903bda9f93a766a1d6085a19b3bfff235 | /ExZoneLib/src/main/java/com/exzone/lib/util/XmlUtils.java | d92651ef2425176c73cf675f2fa40cb36663a864 | [] | no_license | lhhxsm/ExZone | 043f84d5d3164480d9ea517a1f4bcad1772b669b | 06246f2d29019c756d0ce7d4323e2bc9dafaa00b | refs/heads/master | 2021-01-17T21:00:21.769921 | 2017-10-26T14:24:40 | 2017-10-26T14:24:40 | 61,946,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package com.exzone.lib.util;
import android.content.res.XmlResourceParser;
import android.support.v4.util.ArrayMap;
/**
* 作者:lhh
* 描述:
* 时间:2017/3/26.
*/
public class XmlUtils {
public static ArrayMap<String, ArrayMap<String, String>> parseNodes(
XmlResourceParser xmlResourceParser) throws Exception {
if (xmlResourceParser == null) {
return null;
}
ArrayMap<String, ArrayMap<String, String>> map = null;
ArrayMap<String, String> nodeMap = null;
int root = xmlResourceParser.getEventType();
while (root != XmlResourceParser.END_DOCUMENT) {
switch (root) {
case XmlResourceParser.START_DOCUMENT:
map = new ArrayMap<>();
break;
case XmlResourceParser.START_TAG:
if ("index".equals(xmlResourceParser.getName())) {
String nodeName = xmlResourceParser.getAttributeValue(0);
nodeMap = new ArrayMap<>();
if (map != null) {
map.put(nodeName, nodeMap);
}
} else if ("node".equals(xmlResourceParser.getName())) {
String node = xmlResourceParser.getAttributeValue(0);
String nodeName = xmlResourceParser.nextText();
if (nodeMap != null) {
nodeMap.put(node, nodeName);
}
}
break;
case XmlResourceParser.END_TAG:
if ("index".equals(xmlResourceParser.getName())) {
nodeMap = null;
}
break;
}
root = xmlResourceParser.next();
}
return map;
}
}
| [
"lhhxsm@gmail.com"
] | lhhxsm@gmail.com |
334a6eab2cb9a59ee10dcf1012416d541c56140a | 8c20817abfe33b2e7cfab3ed4c0281ae9c7188ac | /workspace2/readFile/src/ReadFile.java | 4f810001c87bcd439e9cdc36b3f6cd8eccf70f07 | [] | no_license | liujinyuann/test | 4007f17c87847ae680b48de00dad178921b98f1b | 36b2f0b53377221aabf7404827508bb262550112 | refs/heads/master | 2022-12-12T07:46:56.875146 | 2019-06-26T07:42:50 | 2019-06-26T07:42:50 | 170,825,288 | 2 | 0 | null | 2022-12-07T22:20:43 | 2019-02-15T08:03:19 | JavaScript | UTF-8 | Java | false | false | 12,526 | java | import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class ReadFile {
static LinkedHashMap<String, ArrayList<String>> mapStrArr = new LinkedHashMap<String, ArrayList<String>>();
static ArrayList<String> strIncludecArray = new ArrayList<String>();
static String strTopNm;
private static JFrame jf_1; // フレーム
private static JLabel jl_1; // ラベル
private static JLabel jl_title; // タイトルラベル
private static JLabel jl_date; // システム日付
private static JLabel jl_inFolder; // 入力フォルダラベル
private static JLabel jl_outFile; // 出力ファイルラベル
private static JTextField jt_inFolder; // 入力フォルダ
private static JTextField jt_outFile; // 出力ファイル
private static JButton jb_start; // テスト開始ボタンー
private static JButton jb_clear; // クリアボタンー
private static JButton jb_inFolder; // 入力フォルダ選択ボタンー
private static JButton jb_outFile; // 出力ファイル選択ボタンー
public static void main(String[] args) {
jl_1 = new JLabel();
Font font = new Font("MS Pゴシック", Font.PLAIN, 20); // フォントの設定
Font titleFont = new Font("MS ゴシック", Font.BOLD, 22); // フォントの設定
jf_1 = new JFrame("ファイルを読み込み");
jf_1.setSize(600, 300);
jl_title = new JLabel("ファイルを読み込み");
jl_title.setHorizontalAlignment(JTextField.CENTER);
jl_title.setBounds(0, 10, 600, 30);
jl_title.setFont(titleFont);
jl_1.add(jl_title);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
jl_date = new JLabel(format.format(new Date()));
jl_date.setHorizontalAlignment(JTextField.CENTER);
jl_date.setBounds(480, 10, 100, 15);
jl_date.setFont(font);
jl_1.add(jl_date);
jl_inFolder = new JLabel("入力フォルダ:");
jl_inFolder.setHorizontalAlignment(JTextField.RIGHT);
jl_inFolder.setBounds(25, 50, 160, 30);
jl_inFolder.setFont(font);
jl_1.add(jl_inFolder);
jt_inFolder = new JTextField("");
jt_inFolder.setBounds(200, 50, 260, 30);
jt_inFolder.setFont(font);
// jt_inFolder.setEditable(false);
jt_inFolder.setBackground(Color.WHITE);
jl_1.add(jt_inFolder);
jb_inFolder = new JButton("選択");
jb_inFolder.setBounds(470, 50, 75, 30);
jb_inFolder.setFont(font);
jl_1.add(jb_inFolder);
jl_outFile = new JLabel("出力ファイル:");
jl_outFile.setHorizontalAlignment(JTextField.RIGHT);
jl_outFile.setBounds(25, 90, 160, 30);
jl_outFile.setFont(font);
jl_1.add(jl_outFile);
jt_outFile = new JTextField("D:\\C言語ヘッダー一覧.xlsx");
jt_outFile.setBounds(200, 90, 260, 30);
jt_outFile.setFont(font);
// jt_outFile.setEditable(false);
jt_outFile.setBackground(Color.WHITE);
jl_1.add(jt_outFile);
jb_outFile = new JButton("選択");
jb_outFile.setBounds(470, 90, 75, 30);
jb_outFile.setFont(font);
jl_1.add(jb_outFile);
jb_start = new JButton("読み込み開始");
jb_start.setBounds(120, 150, 160, 40);
jb_start.setFont(font);
jl_1.add(jb_start);
jb_clear = new JButton("クリア");
jb_clear.setBounds(320, 150, 160, 40);
jb_clear.setFont(font);
jl_1.add(jb_clear);
jf_1.add(jl_1);
jf_1.setVisible(true);
jf_1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf_1.setResizable(false);
jf_1.setLocation(400, 200);
// 読み込み開始ボタンーを押下
ActionListener jb_start_ls = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
mapStrArr = new LinkedHashMap<String, ArrayList<String>>();
strIncludecArray = new ArrayList<String>();
String strPath = jt_inFolder.getText();
try {
getFile(strPath, 0);
strTopNm = strPath.substring(strPath.lastIndexOf("\\") + 1, strPath.length());
writeExcel(mapStrArr);
JOptionPane.showMessageDialog(null, "Excleファイル出力しました。", "information", JOptionPane.PLAIN_MESSAGE);
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "Excleファイル出力失敗。", "information", JOptionPane.PLAIN_MESSAGE);
// TODO 自動生成された catch ブロック
e.printStackTrace();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Excleファイル出力失敗。", "information", JOptionPane.PLAIN_MESSAGE);
// TODO 自動生成された catch ブロック
e.printStackTrace();
}
}
};
// クリアボタンーを押下
ActionListener jb_clear_ls = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
jt_inFolder.setText(""); // 入力フォルダ
jt_outFile.setText(""); // 出力ファイル
}
};
JFileChooser jfcInFolder = new JFileChooser();
// 入力フォルダの選択ボタンーを押下
ActionListener jb_inFolder_ls = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
// 分割の場合
jfcInFolder.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int intRetNum = jfcInFolder.showDialog(new JLabel(), "選択");
// 選択ボタンーを押下の場合
if (intRetNum == 0) {
// ファイルを取得する
File file = jfcInFolder.getSelectedFile();
if (file != null) {
jt_inFolder.setText(file.getAbsolutePath());
jfcInFolder.setCurrentDirectory(jfcInFolder.getSelectedFile());
}
}
}
};
JFileChooser jfcOutfile = new JFileChooser();
// 出力ファイルの選択ボタンーを押下
ActionListener jb_outFile_ls = new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
jfcOutfile.setFileSelectionMode(JFileChooser.FILES_ONLY);
int intRetNum = jfcOutfile.showDialog(new JLabel(), "選択");
// 選択ボタンーを押下の場合
if (intRetNum == 0) {
// ファイルを取得する
File file = jfcOutfile.getSelectedFile();
if (file != null) {
jt_outFile.setText(file.getAbsolutePath());
jfcOutfile.setCurrentDirectory(jfcOutfile.getSelectedFile());
}
}
}
};
// リスナーを追加する
jb_start.addActionListener(jb_start_ls);
jb_clear.addActionListener(jb_clear_ls);
jb_inFolder.addActionListener(jb_inFolder_ls);
jb_outFile.addActionListener(jb_outFile_ls);
}
private static void getFile(String path, int deep) throws IOException {
File file = new File(path);
File[] array = file.listFiles();
File redFile;
InputStreamReader inputReader;
BufferedReader bf;
ArrayList<String> strArray = new ArrayList<String>();
for (int i = 0; i < array.length; i++) {
if (array[i].isFile()) {
if (array[i].getName().contains(".h") || array[i].getName().contains(".c")
|| array[i].getName().contains(".pc")) {
redFile = new File(array[i].getPath());
inputReader = new InputStreamReader(new FileInputStream(redFile), "Shift-JIS");
bf = new BufferedReader(inputReader);
strArray = new ArrayList<String>();
String str;
while ((str = bf.readLine()) != null) {
if (str.contains("#include") && str.startsWith("#include")) {
str = str.replace("#include", "").trim();
if (str.startsWith("<")) {
str = str.substring(str.indexOf("<"), str.indexOf(">") + 1);
} else if (str.startsWith("\"")) {
str = str.substring(str.indexOf("\""), str.lastIndexOf("\"") + 1);
}
strArray.add(str);
if (!strIncludecArray.contains(str) && !str.startsWith("\"")) {
strIncludecArray.add(str);
}
System.out.println(str);
}
}
bf.close();
inputReader.close();
if (strArray.size() > 0) {
mapStrArr.put(array[i].getPath(), strArray);
}
}
} else if (array[i].isDirectory()) {
getFile(array[i].getPath(), deep + 1);
}
}
}
public static void writeExcel(Map<String, ArrayList<String>> mapStrArray) throws Exception {
// ファイルにデータを書き込むバイトストリーム
FileOutputStream fileOut = null;
// Excelファイル
File exlFile = null;
// 座標X
int intWriteX = 0;
// 座標Y
int intWriteY = 0;
// ワークブック
Workbook workbook = null;
// シート
Sheet sheet = null;
// 行
Row row = null;
Cell cell;
ArrayList<String> strArray;
String strKey;
String strPath;
String[] strSplit;
String strShitNamebk = "";
workbook = new XSSFWorkbook();
CellStyle titleStyle = workbook.createCellStyle();
titleStyle.setAlignment(HorizontalAlignment.CENTER);
titleStyle.setBorderTop(BorderStyle.THIN);
titleStyle.setBorderBottom(BorderStyle.THIN);
titleStyle.setBorderLeft(BorderStyle.THIN);
titleStyle.setBorderRight(BorderStyle.THIN);
titleStyle.setFillForegroundColor((short) 22);
titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setBorderTop(BorderStyle.THIN);
cellStyle.setBorderBottom(BorderStyle.THIN);
cellStyle.setBorderLeft(BorderStyle.THIN);
cellStyle.setBorderRight(BorderStyle.THIN);
sheet = workbook.createSheet("ヘッダー一覧");
row = sheet.createRow(1);
cell = row.createCell(1);
cell.setCellValue("No.");
cell.setCellStyle(titleStyle);
cell = row.createCell(2);
cell.setCellValue("分類");
cell.setCellStyle(titleStyle);
cell = row.createCell(3);
cell.setCellValue("ヘッダー名");
cell.setCellStyle(titleStyle);
cell = row.createCell(4);
cell.setCellValue("備考");
cell.setCellStyle(titleStyle);
for (int i = 0; i < strIncludecArray.size(); i++) {
// 行を作る
row = sheet.createRow(i + 2);
cell = row.createCell(1);
cell.setCellValue(i + 1);
cell.setCellStyle(cellStyle);
cell = row.createCell(2);
cell.setCellStyle(cellStyle);
cell = row.createCell(3);
cell.setCellValue(strIncludecArray.get(i));
cell.setCellStyle(cellStyle);
cell = row.createCell(4);
cell.setCellStyle(cellStyle);
}
sheet.autoSizeColumn(3, true);
Object[] keys = mapStrArray.keySet().toArray();
for (int i = 0; i < mapStrArray.size(); i++) {
strKey = keys[i].toString();
strPath = strKey.substring(strKey.indexOf(strTopNm), strKey.length());
strPath = strPath.replace("\\", ":");
strSplit = strPath.split(":");
if (!strShitNamebk.equals(strSplit[1])) {
strShitNamebk = strSplit[1];
sheet = workbook.createSheet(strShitNamebk);
intWriteY = 0;
}
for (int k = 1; k < strSplit.length; k++) {
if (strSplit[1].equals(strSplit[k]) && intWriteY > 0) {
continue;
}
intWriteX = k-1;
// 行を作る
row = sheet.createRow(intWriteY);
cell = row.createCell(intWriteX);
cell.setCellValue(strSplit[k]);
intWriteY++;
}
strArray = mapStrArray.get(strKey);
intWriteX = intWriteX + 1;
for (int j = 0; j < strArray.size(); j++) {
// 行を作る
row = sheet.createRow(intWriteY);
cell = row.createCell(intWriteX);
cell.setCellValue(strArray.get(j));
intWriteY++;
}
}
exlFile = new File(jt_outFile.getText());
try {
fileOut = new FileOutputStream(exlFile);
// Excelファイル書き込む
workbook.write(fileOut);
workbook.close();
System.out.println("----Excleファイル出力しました------");
} catch (Exception e) {
// TODO 自動生成された catch ブロック
e.printStackTrace();
} finally {
if (fileOut != null) {
try {
fileOut.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
| [
"942952542@qq.com"
] | 942952542@qq.com |
357302e79e01088c80b326e68623dca531ef74e1 | 1a4801174077631c98c498232f996e252bfba37d | /api/src/test/java/org/openmrs/module/uitestframework/dao/UitestframeworkDaoTest.java | ca947f6c719ce897dd0c1a60fc26e33c5bcec0a6 | [] | no_license | samuelmale/openmrs-module-uitestframework | fa0711c55ce10bdf2159264df5212415a0a09313 | 6278af6552c04336404fef49e2d649c68c512864 | refs/heads/master | 2021-09-01T13:28:13.694620 | 2017-12-26T20:31:43 | 2017-12-26T20:31:43 | 115,493,191 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,118 | java | /**
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
*
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/
package org.openmrs.module.uitestframework.api.dao;
import org.junit.Test;
import org.junit.Ignore;
import org.openmrs.api.UserService;
import org.openmrs.api.context.Context;
import org.openmrs.module.uitestframework.Item;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
/**
* It is an integration test (extends BaseModuleContextSensitiveTest), which verifies DAO methods
* against the in-memory H2 database. The database is initially loaded with data from
* standardTestDataset.xml in openmrs-api. All test methods are executed in transactions, which are
* rolled back by the end of each test method.
*/
public class UitestframeworkDaoTest extends BaseModuleContextSensitiveTest {
@Autowired
UitestframeworkDao dao;
@Autowired
UserService userService;
@Test
@Ignore("Unignore if you want to make the Item class persistable, see also Item and liquibase.xml")
public void saveItem_shouldSaveAllPropertiesInDb() {
//Given
Item item = new Item();
item.setDescription("some description");
item.setOwner(userService.getUser(1));
//When
dao.saveItem(item);
//Let's clean up the cache to be sure getItemByUuid fetches from DB and not from cache
Context.flushSession();
Context.clearSession();
//Then
Item savedItem = dao.getItemByUuid(item.getUuid());
assertThat(savedItem, hasProperty("uuid", is(item.getUuid())));
assertThat(savedItem, hasProperty("owner", is(item.getOwner())));
assertThat(savedItem, hasProperty("description", is(item.getDescription())));
}
}
| [
"samuelsmalek@gmail.com"
] | samuelsmalek@gmail.com |
44703114887aa23fdee8397cdf1ac410ab983ee6 | 02a3c30e092113651999a296d7d8682d92494581 | /src/layer/subsampling/MeanPooling2DLayer.java | 7fa7866d74bdf7feab93e06f527cc7e064306d72 | [] | no_license | DiegoEPaez/deepnets | ec2a3f1e72d8b1bf371401e860e6beac8644b871 | 6eb9ff1e04246827092e1f6d383ae370783d2793 | refs/heads/master | 2020-07-24T09:49:54.377356 | 2019-09-11T19:33:46 | 2019-09-11T19:33:46 | 207,886,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,224 | java | package layer.subsampling;
import layer.Layer;
import org.apache.log4j.Logger;
import tensor.DoubleTensor;
/**
* Applies mean pooling to a given tensor. The mean pooling is done by getting
* the mean of every pW x pH rectangle and moving sW or sH units to next rectangle.
* @author diego_paez
*/
public class MeanPooling2DLayer extends Layer{
/**
* Logger of log4j.
*/
private static final Logger LOG = Logger.getLogger(MeanPooling2DLayer.class);
/**
* Number of channels every channel contains a set of inputs of 2 dimensions.
* For instance there could be 3 channels corresponding to red, green and
* blue colors.
*/
protected int nC;
/**
* Width of given input. For example could be number of pixels in an image.
*/
protected int iW;
/**
* Height of given input. For example could be number of pixels in an image.
*/
protected int iH;
/**
* Pooling width, i.e., number of individual inputs that will be averaged.
*/
protected int pW;
/**
* Pooling height, i.e., number of individual inputs that will be averaged.
*/
protected int pH;
/**
* Width stride, that is the number of inputs to move in width to next rectangle
* that will be pooled. Typically sW = pW.
*/
protected int sW;
/**
* Height stride, that is the number of inputs to move in width to next rectangle
* that will be pooled. Typically sH = pH.
*/
protected int sH;
/**
* Output height after mean pooling. Derived from iH, pH and sH.
*/
protected int oH;
/**
* Output width after mean pooling. Derived from iH, pH and sH.
*/
protected int oW;
/**
* Create new mean pooling layer assumes stride height = pH, and stride
* width = pW.
* @param pH Pooling height.
* @param pW Pooling width.
*/
public MeanPooling2DLayer(int pH, int pW) {
this.pH = pH;
this.pW = pW;
this.sH = pH;
this.sW = pW;
}
/**
* Create new mean pooling layer with given inputs.
* @param pH Pooling height.
* @param pW Pooling width.
* @param sH Stride height.
* @param sW Stride width.
*/
public MeanPooling2DLayer(int pH, int pW, int sH, int sW) {
this.pH = pH;
this.pW = pW;
this.sH = sH;
this.sW = sW;
}
/**
* Set the dimensions of inputs not counting examples.
* @param inputs Dimensions of inputs, e.g., 2,4,5. Assumes first 2 dimensions
* are the input width and input height. If given a 3rd number assumes this
* is the number of channels, else number of channels is set to 1.
*/
@Override
public void setDimsOfInputsWOE(int... inputs) {
if(inputs.length != 3 && inputs.length != 2){
LOG.error("Expected 3 or 2 inputs: channel(o), input width, input height");
return;
}
iW = inputs[0];
iH = inputs[1];
if((iW - Math.max(pW, sW)) % sW != 0){
LOG.error("The specified pooling width and stride does not allow to subsample correctly");
return;
}
if((iH - Math.max(pH, sH)) % sH != 0){
LOG.error("The specified pooling height and stride does not allow to subsample correctly");
return;
}
oW = (iW - Math.max(pW,sW)) / sW + 1;
oH = (iH - Math.max(pH,sH)) / sH + 1;
if(inputs.length == 2){
nI = new int[]{iW,iH,1};
nC = 1;
} else{
nI = inputs;
nC = inputs[2];
}
}
/**
* Return the dimension of output without examples.
* @return Output Width, Output Height and number of channels.
*/
@Override
public int[] getDimsOfOutputsWOE() {
return new int[]{oW,oH,nC};
}
/**
* Create output and grad tensors, with input and output dimension + number
* of examples.
* @param numExamples Number of examples.
*/
@Override
public void initSpaceInMemory(int numExamples){
if(output == null){
output = new DoubleTensor(oW, oH, nC, numExamples);
output.setPosToLast();
grad = new DoubleTensor(iW, iH, nC, numExamples);
grad.setPosToLast();
} else{ // if tensors already exists just resize.
output.resize(oW, oH, nC, numExamples);
output.setPos(oW * oH * nC * numExamples);
grad.resize(iW, iH, nC, numExamples);
grad.setPos(iW * iH * nC * numExamples);
}
}
/**
* Forward propagate by pooling in 2D. Pooling in 2D entails obtaining the mean
* for every example, every channel and every rectangle of height pH and
* width pW. Then move to next rectangle by stride width and height specified.
* @param input Input Tensor.
* @param isTest Whether test or training data (not used).
* @return DoubleTensor result of forward propagation.
*/
@Override
public DoubleTensor fProp(DoubleTensor input, boolean isTest) {
this.input = input;
if(input.dims.length == 3){
int[] ndims = new int[4];
ndims[0] = input.dims[0];
ndims[1] = input.dims[1];
ndims[2] = 1;
ndims[3] = input.dims[2];
input.dims = ndims;
}
// pool2D
return pool2D(
input, sW, sH,
output, nC, oW, oH,
pW, pH, input.lastDim());
}
/**
* Backpropagate the MeanPooling layer by calculating the derivative of the
* loss function with respect to inputs. Since the derivative of the input
* with respect to output = 1 / p2 (where p2 = pW * pH) by applying the chain
* rule: add chaingrad_kl / p2 to every grad_ij (grad = output chaingrad)
* such that output_kl = input_ij /p2 + ...
* @param chainGrad Loss function with respect to outputs of meanpooling layer.
* @return Loss function with respect to inputs of Meanpooling layer.
*/
@Override
public DoubleTensor bProp(DoubleTensor chainGrad) {
// unpool2D
return unpool2D(
chainGrad, sW, sH,
grad, nC, oW, oH,
pW, pH, input.lastDim());
}
/**
* Pool 2D: for every example, every channel and every rectangle of height
* pH and width pW obtain mean, then move by sW and sH.
* @param in DoubleTensor which to pool.
* @param sW Stride width.
* @param sH Stride height.
* @param out Output DoubleTensor result of pooling.
* @param nC Number of channels.
* @param oW Output width.
* @param oH Output height.
* @param pW Pooling width.
* @param pH Pooling height.
* @param examples Number of examples.
* @return Output tensor (same as out).
*/
private DoubleTensor pool2D(
DoubleTensor in, int sW, int sH,
DoubleTensor out, int nC, int oW, int oH,
int pW, int pH, int examples
){
int[] indInput;
int iIn, iO = 0;
// iW,iH,c,e
indInput = new int[4];
// oW,oH,c,e
int p2 = pW * pH;
// for every example
for(int e = 0; e < examples; e++){
indInput[3] = e;
// for every channel
for(int c = 0; c < nC; c++){
indInput[2] = c;
for(int i = 0; i < oH; i++){
for(int j = 0; j < oW; j++){
// initialize to zero this value of output to accumulate
out.setQuick(iO, 0.0);
for(int k = 0; k < pH; k++){
indInput[1] = i * sH + k;
for(int l = 0; l < pW; l++){
indInput[0] = j * sW + l;
iIn = DoubleTensor.indicesToNum(indInput, in.dims);
// accumulate in output
out.setQuick(iO,
out.getQuick(iO) + in.getQuick(iIn));
}
}
// Obtain mean after summing all entries.
out.setQuick(iO, out.getQuick(iO) / p2);
iO++;
}
}
}
}
return out;
}
/**
* Add chaingrad_kl / p2 to every grad_ij such that output_kl = input_ij /p2 + ...
* @param chainGrad Incoming chaingrad.
* @param sW Stride width.
* @param sH Stride height.
* @param grad Result chaingrad.
* @param nC Number of channels.
* @param oW Output width.
* @param oH Output height.
* @param pW Pooling width.
* @param pH Pooling height.
* @param examples Number of examples.
* @return Result chaingrad.
*/
private DoubleTensor unpool2D(
DoubleTensor chainGrad, int sW, int sH,
DoubleTensor grad, int nC, int oW, int oH,
int pW, int pH, int examples
){
int[] indGrad;
int iCG = 0, iG;
// oW,oH,c,e
// iW,iH,c,e
indGrad = new int[4];
double p2 = pW * pH;
// for every example
for(int e = 0; e < examples; e++){
indGrad[3] = e;
// for every channel
for(int c = 0; c < nC; c++){
indGrad[2] = c;
for(int i = 0; i < oH; i++){
for(int j = 0; j < oW; j++){
for(int k = 0; k < pH; k++){
indGrad[1] = i * sH + k;
for(int l = 0; l < pW; l++){
indGrad[0] = j * sW + l;
iG = DoubleTensor.indicesToNum(indGrad, grad.dims);
//output.put(i,j,act);
grad.setQuick(iG, chainGrad.getQuick(iCG) / p2);
}
}
iCG++;
}
}
}
}
return grad;
}
} | [
"diegoe.paez@live.com.mx"
] | diegoe.paez@live.com.mx |
87f72d712b52aa1075694afe843e6649751b1d52 | f512045ae897d3b88b5d95616fd7b95182d04b91 | /src/main/java/com/main/javaindepth/StopThread.java | 5ff90b45107deeda22ebc2fe06c0c8556fd3eef1 | [] | no_license | newbieGITter/java-coding-exercises | 523f40b7f3e397da3b04c2842a0ebe7d6ee73090 | 5893960713d758c60942b144308a501240d653e0 | refs/heads/master | 2021-07-09T13:18:30.767777 | 2020-10-19T08:47:29 | 2020-10-19T08:47:29 | 205,090,834 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package com.main.javaindepth;
import java.util.concurrent.TimeUnit;
public class StopThread {
private static volatile boolean stop;
public static void main(String[] args) throws InterruptedException {
new Thread(() -> {
while(!stop) {
System.out.println("In while");
}
}).start();
TimeUnit.MILLISECONDS.sleep(10);
stop = true;
System.out.println("End of program");
}
}
| [
"saa.kulkarni@gmail.com"
] | saa.kulkarni@gmail.com |
856a8e2221e9bb1e0389f7a2fb12e5c3d194e9fa | 349386f221b301eb4f9958fa3b9b9a8ac9785e02 | /src/main/java/com/qidao/qidao/dynamic/complaint/service/impl/ComplaintServiceImpl.java | 439c2de9b275b83f2039f164f89adcc069f29698 | [
"MIT"
] | permissive | tzbgithub/keqidao | 3c02a21a9f9158037e60f73c963067c270e7ab0f | fb54cddac4105f5d25b62cdc67c791eae16b3aae | refs/heads/master | 2023-04-05T02:53:31.513477 | 2021-05-10T05:06:00 | 2021-05-10T05:06:00 | 365,922,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,261 | java | package com.qidao.qidao.dynamic.complaint.service.impl;
import java.util.List;
import com.qidao.common.utils.security.ShiroUtils;
import com.qidao.project.system.user.domain.User;
import com.qidao.qidao.member.member.mapper.TMemberMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.qidao.qidao.dynamic.complaint. mapper.ComplaintMapper;
import com.qidao.qidao.dynamic.complaint. domain.Complaint;
import com.qidao.qidao.dynamic.complaint. service.IComplaintService;
import com.qidao.common.utils.text.Convert;
import com.qidao.framework.util.SnowflakeIdWorker53;
import javax.annotation.Resource;
/**
* 动态投诉Service业务层处理
*
* @author autuan
* @date 2021-01-19
*/
@Service
@Slf4j
public class ComplaintServiceImpl implements IComplaintService {
@Resource
private ComplaintMapper complaintMapper;
@Resource
private SnowflakeIdWorker53 snowflakeIdWorker;
@Resource
private TMemberMapper TMemberMapper;
/**
* 查询动态投诉
*
* @param id 动态投诉ID
* @return 动态投诉
*/
@Override
public Complaint selectComplaintById(Long id) {
log.info("ComplaintServiceImpl -> selectComplaintById -> start -> id : {}", id);
log.info("ComplaintServiceImpl -> selectComplaintById -> end");
return complaintMapper.selectComplaintById(id);
}
/**
* 查询动态投诉列表
*
* @param complaint 动态投诉
* @return 动态投诉
*/
@Override
public List<Complaint> selectComplaintList(Complaint complaint) {
log.info("ComplaintServiceImpl -> selectComplaintList -> start -> complaint : {}", complaint);
log.info("ComplaintServiceImpl -> selectComplaintList -> end");
return complaintMapper.selectComplaintList(complaint);
}
/**
* 新增动态投诉
*
* @param complaint 动态投诉
* @return 结果
*/
@Override
public int insertComplaint(Complaint complaint) {
log.info("ComplaintServiceImpl -> insertComplaint -> start -> complaint : {}", complaint);
complaint.setId(snowflakeIdWorker.nextId());
complaint.setCreateBy(String.valueOf(ShiroUtils.getUserId()));
log.info("ComplaintServiceImpl -> insertComplaint -> end");
return complaintMapper.insertComplaint(complaint);
}
/**
* 修改动态投诉
*
* @param complaint 动态投诉
* @return 结果
*/
@Override
public int updateComplaint(Complaint complaint) {
log.info("ComplaintServiceImpl -> updateComplaint -> start -> complaint : {}", complaint);
complaint.setUpdateBy(String.valueOf(ShiroUtils.getUserId()));
User sysUser = ShiroUtils.getSysUser();
complaint.setReplyUserId(sysUser.getUserId());
complaint.setReplyUserName(sysUser.getUserName());
log.info("ComplaintServiceImpl -> updateComplaint -> end");
return complaintMapper.updateComplaint(complaint);
}
/**
* 删除动态投诉对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteComplaintByIds(String ids) {
log.info("ComplaintServiceImpl -> deleteComplaintByIds -> start -> ids : {}", ids);
log.info("ComplaintServiceImpl -> deleteComplaintByIds -> end");
return complaintMapper.deleteComplaintByIds(Convert.toStrArray(ids));
}
/**
* 删除动态投诉信息
*
* @param id 动态投诉ID
* @return 结果
*/
@Override
public int deleteComplaintById(Long id) {
log.info("ComplaintServiceImpl -> deleteComplaintById -> start -> id : {}", id);
log.info("ComplaintServiceImpl -> deleteComplaintById -> end");
return complaintMapper.deleteComplaintById(id);
}
/**
* 逻辑删除动态投诉对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int logicDelByIds(String ids) {
log.info("ComplaintServiceImpl -> logicDelByIds -> start -> ids : {}", ids);
log.info("ComplaintServiceImpl -> logicDelByIds -> end");
return complaintMapper.logicDelByIds(Convert.toStrArray(ids));
}
}
| [
"564858834@qq.com"
] | 564858834@qq.com |
5667743e62637105927b1c144531bffcf4080b9f | 9b7c6691deb34642820e19e56482bf3f516a3824 | /android/app/src/main/java/com/amnesiareact/MainActivity.java | caeb6b4cf616c37a46b097e4c4515c98a60672d7 | [
"MIT"
] | permissive | kurtschlueter/AmnesiaReact | bda5ac65bc61e62ba0705e7579c4f461014c4d57 | 47c4d3c329f5c892053abb2b1a4ba0053c7af394 | refs/heads/master | 2021-01-01T03:34:04.595783 | 2016-04-30T23:08:27 | 2016-04-30T23:08:27 | 57,454,206 | 0 | 0 | null | 2016-05-11T21:03:23 | 2016-04-30T17:34:48 | JavaScript | UTF-8 | Java | false | false | 1,038 | java | package com.amnesiareact;
import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import java.util.Arrays;
import java.util.List;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "AmnesiaReact";
}
/**
* Returns whether dev mode should be enabled.
* This enables e.g. the dev menu.
*/
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
/**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
}
}
| [
"kurtbschlueter@gmail.com"
] | kurtbschlueter@gmail.com |
6dc8d268ff21fe3633bf25faa18d48807d4e2f6e | 35265d2687e22e3d467d0484152cd574ae60aec4 | /game-controller/src/main/java/org/scrum/psd/battleship/controller/Test.java | a830ad0a06a51d1df7d5284829ee080b8cbd418d | [] | no_license | hanskoetjing/battleship-java | d58ffeec4862d863c2b13d7ad97cb167030e1949 | c567f44579c050780301c809e28872793c9c1a26 | refs/heads/master | 2020-07-30T13:11:17.418138 | 2019-09-24T08:05:45 | 2019-09-24T08:05:45 | 210,245,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 235 | java | package org.scrum.psd.battleship.controller;
import org.scrum.psd.battleship.controller.dto.Letter;
public class Test {
public static void main(String[] args) {
System.out.println(Letter.isOnPlayingBoard("A"));
}
}
| [
"faridzif@xl.co.id"
] | faridzif@xl.co.id |
10833dcb1b6bc5775bf10265a713a039c0c6e134 | c9b392ee4128e1f73c64cab9d548f16eec64a8c8 | /Unit8/src/Java2DTest3.java | 3cb0c0a5e83d2ba4fe666eb8fb9a0d1e567b26c2 | [] | no_license | AlwaysHugry/Javalearn | 7655ff557586458a0f5ab4c04813477a80db51dd | d2af598843aefd2689844ac3d6a7a6d639b0dc02 | refs/heads/master | 2021-03-12T00:48:11.472342 | 2020-09-15T00:12:51 | 2020-09-15T00:12:51 | 246,574,587 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,254 | java | package src;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.BufferedImage;
import javax.swing.*;
public class Java2DTest3 extends JFrame{
/**
*指定绘图颜色与填充图案
*/
private static final long serialVersionUID = 1L;
public Java2DTest3()
{
super("setPaint: GradientPaint TexturePaint");
setSize(400,200);
setVisible(true);
}
public void paint(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
g2d.setPaint(new GradientPaint(5,40,Color.red,5,60,Color.blue,true));
g2d.fill(new Ellipse2D.Double(5,40,65,110));
BufferedImage bi = new BufferedImage(5,5,BufferedImage.TYPE_INT_RGB);
Graphics2D big = bi.createGraphics();
big.setColor(Color.blue);
big.fillRect(0, 0, 5, 5);
big.setColor(Color.yellow);
big.fillOval(0, 0, 5, 5);
Rectangle r = new Rectangle(0,0,5,5);
TexturePaint tp = new TexturePaint(bi,r);
g2d.setPaint(tp);
g2d.fill(new RoundRectangle2D.Double(155,40,75,110,50,50));
}
public static void main(String[] args)
{
Java2DTest3 win = new Java2DTest3();
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
} | [
"2724539542@qq.com"
] | 2724539542@qq.com |
6bb45a52f83cfd1e922f0e5527cb21da7b6e7679 | 1113aa17b5623eab592b2defb662e753bf90360a | /cohort/week08/GA/Algorithm.java | 207a1627433c4899875019143eccb76d2c12a738 | [
"MIT"
] | permissive | jamestiotio/esc | c29afe40929639e58db7f0dc0482815a812c075c | 971d9018e389b5ac374438792a417c74541898e2 | refs/heads/main | 2023-01-24T09:44:49.500887 | 2021-05-16T10:31:27 | 2021-05-16T10:31:27 | 336,866,653 | 0 | 0 | MIT | 2021-11-04T15:56:21 | 2021-02-07T19:04:35 | Java | UTF-8 | Java | false | false | 2,976 | java | import java.util.Random;
public class Algorithm {
/* GA parameters */
private static final double uniformRate = 0.5;
private static final double mutationRate = 0.015;
private static final int tournamentSize = 5;
private static final boolean elitism = true;
/* Public methods */
// Evolve a population
public static Population evolvePopulation(Population pop) {
Population newPopulation = new Population(pop.size(), false);
// Keep our best individual
if (elitism) {
newPopulation.saveIndividual(0, pop.getFittest());
}
// Crossover population
int elitismOffset;
if (elitism) {
elitismOffset = 1;
} else {
elitismOffset = 0;
}
// Loop over the population size and create new individuals with
// crossover
for (int i = elitismOffset; i < pop.size(); i++) {
Individual indiv1 = tournamentSelection(pop);
Individual indiv2 = tournamentSelection(pop);
Individual newIndiv = crossover(indiv1, indiv2);
newPopulation.saveIndividual(i, newIndiv);
}
// Mutate population (as number of mutations increases beyond crossover occurrences, it
// tends towards random-based testing)
for (int i = elitismOffset; i < newPopulation.size(); i++) {
mutate(newPopulation.getIndividual(i));
}
return newPopulation;
}
// Crossover individuals
private static Individual crossover(Individual indiv1, Individual indiv2) {
Individual newSol = new Individual();
// Loop through genes
for (int i = 0; i < indiv1.size(); i++) {
// Crossover
if (Math.random() <= uniformRate) {
newSol.setGene(i, indiv1.getGene(i));
} else {
newSol.setGene(i, indiv2.getGene(i));
}
}
return newSol;
}
// Mutate an individual
private static void mutate(Individual indiv) {
// Loop through genes
for (int i = 0; i < indiv.size(); i++) {
if (Math.random() <= mutationRate) {
// Create random gene
Random r = new Random();
char c = (char) (r.nextInt(95) + 32);
indiv.setGene(i, c);
}
}
}
// Select individuals for crossover
private static Individual tournamentSelection(Population pop) {
// Create a tournament population
Population tournament = new Population(tournamentSize, false);
// For each place in the tournament get a random individual
for (int i = 0; i < tournamentSize; i++) {
int randomId = (int) (Math.random() * pop.size());
tournament.saveIndividual(i, pop.getIndividual(randomId));
}
// Get the fittest
Individual fittest = tournament.getFittest();
return fittest;
}
}
| [
"jamestiotio@gmail.com"
] | jamestiotio@gmail.com |
93be61df0a50cffb0be9c215cc60717e99cf8eb3 | 4b1b92c368d292c7ddb986ea7e7ee52dfb4692c5 | /DialogExample/app/src/androidTest/java/sg/edu/rp/c346/dialogexample/ExampleInstrumentedTest.java | af72938d575fc350d0cc880f543c392c2ac1c235 | [] | no_license | 16046544/DemoDatabaseCRUD | cda5d553c1b2ad33e302e8906499d03ee948bcab | 2f5146f566ed652b2d561cff89766c72b641e685 | refs/heads/master | 2020-03-17T14:33:18.901341 | 2018-05-16T14:21:06 | 2018-05-16T14:21:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package sg.edu.rp.c346.dialogexample;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("sg.edu.rp.c346.dialogexample", appContext.getPackageName());
}
}
| [
"16046544@myrp.edu.sg"
] | 16046544@myrp.edu.sg |
d9c842d716a5f64465b42459d5f176014162f48f | 62cc1c3734036de579432ad28be37a6fd9d7b1ce | /app/src/main/java/com/alberto/tfg/tormantos/utils/Strings.java | ecb837b068eda494b6977408175d14b71b02934e | [] | no_license | afuentecruz/Tormantos | c4da8c86dc6062840be4431e28f7148e29f9e7c6 | 8a6c1e80ea74603d21ef933a257223435d4624e3 | refs/heads/master | 2020-03-16T16:33:03.074182 | 2018-07-17T17:48:42 | 2018-07-17T17:48:42 | 132,791,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,078 | java | package com.alberto.tfg.tormantos.utils;
/**
* Common class with all the strings used across the project
* in order to recognise the event data and context.
*/
public class Strings {
/**
* Apps package name keys
*/
// Communications
public static final String PACKAGE_GMAIL = "com.google.android.gm";
public static final String PACKAGE_SMS = "com.google.android.apps.messaging";
public static final String PACKAGE_DIALER = "com.google.android.dialer";
// Messaging
public static final String PACKAGE_WHATSAPP = "com.whatsapp";
public static final String PACKAGE_TELEGRAM = "org.telegram.messenger";
// Web browsing
public static final String PACKAGE_FIREFOX = "org.mozilla.firefox";
public static final String PACKAGE_CHROME = "com.android.chrome";
// Social
public static final String PACKAGE_FACEBOOK = "com.facebook.katana";
// General
public static final String PACKAGE_KEYBOARD = "com.google.android.inputmethod.latin";
public static final String PACKAGE_SHORTCUT = "is.shortcut";
public static final String PACKAGE_TORMANTOS = "com.alberto.tfg.tormantos";
/**
* Android softkeyboard keys
*/ //Mostrando teclado español (España) (QWERTY (Ñ))
public static final String KEY_KEYBOARD_SHOW_MSG = "Mostrando teclado español (España) (QWERTY (Ñ))";
public static final String KEY_KEYBOARD_HIDE_MSG = "El teclado español (España) (QWERTY (Ñ)) está oculto";
public static final String KEY_KEYBOARD_WRITTE_MSG = "Escribir mensaje";
public static final String KEY_KEYBOARD_ALTERNATIVES_REJECTED = "Se han rechazado las alternativas";
public static final String KEY_KEYBOARD_ALTERNATIVES_AVAILABLE = "Hay alternativas disponibles";
public static final String KEY_KEYBOARD_SHOW_SYMBOLS = "Mostrando Teclado de símbolos";
/**
* WhatsApp keys
*/
public static final String KEY_WHATSAPP = "WhatsApp";
/**
* Dial keys
*/
public static final String KEY_DIAL_END = "Finalizar llamada";
public static final String KEY_DIAL_QUICK_CONTACT = "Contacto rápido de ";
public static final String KEY_DIAL_CALL_TO = "Llamar a ";
/**
* Gmail Keys
*/
public static final String KEY_GMAIL_SENDED = "Enviando mensaje…";
/**
* Sms keys
*/
public static final String KEY_SMS_CONTACT_ADDED = "ya se ha añadido, ahora estás editándolo";
/**
* Firefox keys
*/
public static final String KEY_FIREFOX_SEARCH = "Término de búsqueda o dirección";
/**
* Sms UI class
*/
public static final String CLASS_SMS_CONVERSATION = "com.google.android.apps.messaging.ui.conversation.ConversationActivity";
/**
* Whatsapp UI class
*/
public static final String CLASS_HOMEACTIVITY = "com.whatsapp.HomeActivity";
/**
* System values
*/
public static final String CLASS_NOTIFICATION = "android.app.Notification";
public static final String SERVICE_LOCATION = "service.location";
/**
* General android ui elements
*/
public static final String WIDGET_FRAME = "android.widget.FrameLayout";
public static final String WIDGET_RELATIVE_LAYOUT = "android.widget.RelativeLayout";
public static final String WIDGET_IMAGEBUTTON = "android.widget.ImageButton";
public static final String WIDGET_AUTOCOMPLETE = "android.widget.MultiAutoCompleteTextView";
public static final String WIDGET_SPINNER = "android.widget.Spinner";
public static final String WIDGET_EDITTEXT = "android.widget.EditText";
public static final String WIDGET_TOAST = "android.widget.Toast$TN";
public static final String WIDGET_VIEW_VIEW = "android.view.View";
public static final String WIDGET_LINEAR_LAYOUT = "android.widget.LinearLayout";
public static final String VIEW_VIEWGROUP = "android.view.ViewGroup";
public static final String WIDGET_IMAGEVIEW = "android.widget.ImageView";
public static final String WIDGET_QUICKCONTACTBADGE = "android.widget.QuickContactBadge";
}
| [
"afuente@gloin.es"
] | afuente@gloin.es |
3e87ed65a941c13f792fcd9f0f16949d398aaa0a | 3a090e932c04608be10e74cd4a8ceb453c1100df | /spring/core/src/main/java/org/wso2/spring/ws/axis2/SpringObjectSupplier.java | f02d43ab1c83576684461b7c349045eb983e3785 | [
"Apache-2.0"
] | permissive | calders/wsf | 2b21daf1861cac6b071c489f652a4376cf55189f | d238b2a5d2b4bd13c03d8484d9c435e6cf5840d8 | refs/heads/master | 2021-01-18T08:46:55.449156 | 2015-02-10T22:24:08 | 2015-02-10T22:24:08 | 30,302,832 | 3 | 3 | null | 2016-01-08T12:56:18 | 2015-02-04T14:33:24 | C | UTF-8 | Java | false | false | 1,380 | java | /*
* Copyright 2005-2008 WSO2, Inc. (http://wso2.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 org.wso2.spring.ws.axis2;
import org.apache.axis2.AxisFault;
import org.apache.axis2.ServiceObjectSupplier;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
/**
* Spring Object Supplier acts as the Service Object Supplier
* within Axis2 for WSF/Spring
*/
public class SpringObjectSupplier implements ServiceObjectSupplier {
public Object getServiceObject(AxisService axisService) throws AxisFault {
Parameter springPOJOParam = axisService.getParameter(SpringAxisConstants.SPRING_POJO);
Object springPOJO = springPOJOParam.getValue();
if (springPOJO == null) {
throw new AxisFault("Spring Bean does not exist");
}
return springPOJOParam.getValue();
}
}
| [
"tharindu@a5903396-d722-0410-b921-86c7d4935375"
] | tharindu@a5903396-d722-0410-b921-86c7d4935375 |
1f1cf8b5c79cddeef231da2edb581046bf3a9796 | 76a30a862c69dae47bb17dc88b329a80285b9a60 | /transformer/src/main/java/com/wuyi/transformer/transformer/Processor.java | 52548566562e9a6db2af9aee3626db24ed211ed7 | [] | no_license | runInFuture/transformer | c1d8ea0da1477319284db599246814c85a19c32f | 3f0e35f75841e103aa3757d1a1acda108d2d6b45 | refs/heads/master | 2021-01-26T21:01:14.966449 | 2020-02-25T04:18:24 | 2020-02-25T04:18:24 | 243,464,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,579 | java | package com.wuyi.transformer.transformer;
import com.wuyi.transformer.Util;
import com.wuyi.transformer.annotation.Layout;
import com.wuyi.transformer.log.AdapterLogger;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.ProcessingEnvironment;
import javax.annotation.processing.RoundEnvironment;
import javax.lang.model.element.TypeElement;
/**
* This processor analyze
*/
public class Processor extends AbstractProcessor {
private final List<Class<? extends Annotation>> supportAnnotations = new ArrayList<>();
{
supportAnnotations.add(Layout.class);
}
private AdapterLogger adapterLogger;
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
super.init(processingEnv);
adapterLogger = new AdapterLogger(processingEnv.getMessager());
}
@Override
public boolean process(Set<? extends TypeElement> set, RoundEnvironment roundEnvironment) {
String token = Util.randomToken();
adapterLogger.info(token + " process begin...");
adapterLogger.info(token + " process end...");
return false;
}
@Override
public Set<String> getSupportedAnnotationTypes() {
Set<String> supports = new HashSet<>();
for (Class<? extends Annotation> clazz : supportAnnotations) {
supports.add(clazz.getCanonicalName());
}
return supports;
}
}
| [
"onedaygotosky@gmail.com"
] | onedaygotosky@gmail.com |
f6269cd68a709649475eb4c577e4ac54e742cc43 | 6499720f62e9e142045ea6274d59c778c4e66b7f | /app/src/main/java/com/freak/mvvmhttpmanager/bean/LoginEntity.java | 89acaa2ce885d477f796e5fa45dbb6ac5735a49d | [] | no_license | freakcsh/MVVMHttpManager | 6a87b5c3c5c48d46c534b4a1f94968561da2c519 | 5a8c36e414ffcf3ff3afad9a24ef46ef51110606 | refs/heads/master | 2020-05-23T14:26:33.601333 | 2020-04-17T08:13:26 | 2020-04-17T08:13:26 | 186,802,997 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 20,218 | java | package com.freak.mvvmhttpmanager.bean;
import java.util.List;
/**
* Created by Administrator on 2019/3/16.
*/
public class LoginEntity {
/**
* loginType : 1
* code : 200
* account : {"id":1794699363,"userName":"1_13790994100","type":1,"status":0,"whitelistAuthority":0,"createTime":1552619990230,"salt":"[B@32f340ee","tokenVersion":0,"ban":0,"baoyueVersion":0,"donateVersion":0,"vipType":0,"viptypeVersion":0,"anonimousUser":false}
* profile : {"djStatus":0,"expertTags":null,"experts":{},"avatarImgId":109951163250233890,"backgroundImgId":109951162868126480,"backgroundUrl":"http://p1.music.126.net/_f8R60U9mZ42sSNvdPn2sQ==/109951162868126486.jpg","avatarImgIdStr":"109951163250233892","backgroundImgIdStr":"109951162868126486","userId":1794699363,"accountStatus":0,"vipType":0,"gender":0,"province":110000,"nickname":"freak_csh","userType":0,"mutual":false,"remarkName":null,"authStatus":0,"defaultAvatar":true,"avatarUrl":"http://p1.music.126.net/ma8NC_MpYqC-dK_L81FWXQ==/109951163250233892.jpg","birthday":-2209017600000,"city":110101,"detailDescription":"","followed":false,"description":"","signature":"","authority":0,"avatarImgId_str":"109951163250233892","followeds":0,"follows":3,"eventCount":0,"playlistCount":1,"playlistBeSubscribedCount":0}
* bindings : [{"tokenJsonStr":"{\"countrycode\":\"\",\"cellphone\":\"13790994100\",\"hasPassword\":true}","expired":false,"userId":1794699363,"url":"","expiresIn":2147483647,"refreshTime":1552708437,"id":6825653043,"type":1}]
*/
private int loginType;
private int code;
private String msg;
private AccountBean account;
private ProfileBean profile;
private List<BindingsBean> bindings;
public int getLoginType() {
return loginType;
}
public void setLoginType(int loginType) {
this.loginType = loginType;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public AccountBean getAccount() {
return account;
}
public void setAccount(AccountBean account) {
this.account = account;
}
public ProfileBean getProfile() {
return profile;
}
public void setProfile(ProfileBean profile) {
this.profile = profile;
}
public List<BindingsBean> getBindings() {
return bindings;
}
public void setBindings(List<BindingsBean> bindings) {
this.bindings = bindings;
}
public static class AccountBean {
/**
* id : 1794699363
* userName : 1_13790994100
* type : 1
* status : 0
* whitelistAuthority : 0
* createTime : 1552619990230
* salt : [B@32f340ee
* tokenVersion : 0
* ban : 0
* baoyueVersion : 0
* donateVersion : 0
* vipType : 0
* viptypeVersion : 0
* anonimousUser : false
*/
private int id;
private String userName;
private int type;
private int status;
private int whitelistAuthority;
private long createTime;
private String salt;
private int tokenVersion;
private int ban;
private int baoyueVersion;
private int donateVersion;
private int vipType;
private int viptypeVersion;
private boolean anonimousUser;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getWhitelistAuthority() {
return whitelistAuthority;
}
public void setWhitelistAuthority(int whitelistAuthority) {
this.whitelistAuthority = whitelistAuthority;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public int getTokenVersion() {
return tokenVersion;
}
public void setTokenVersion(int tokenVersion) {
this.tokenVersion = tokenVersion;
}
public int getBan() {
return ban;
}
public void setBan(int ban) {
this.ban = ban;
}
public int getBaoyueVersion() {
return baoyueVersion;
}
public void setBaoyueVersion(int baoyueVersion) {
this.baoyueVersion = baoyueVersion;
}
public int getDonateVersion() {
return donateVersion;
}
public void setDonateVersion(int donateVersion) {
this.donateVersion = donateVersion;
}
public int getVipType() {
return vipType;
}
public void setVipType(int vipType) {
this.vipType = vipType;
}
public int getViptypeVersion() {
return viptypeVersion;
}
public void setViptypeVersion(int viptypeVersion) {
this.viptypeVersion = viptypeVersion;
}
public boolean isAnonimousUser() {
return anonimousUser;
}
public void setAnonimousUser(boolean anonimousUser) {
this.anonimousUser = anonimousUser;
}
@Override
public String toString() {
return "AccountBean{" +
"id=" + id +
", userName='" + userName + '\'' +
", type=" + type +
", status=" + status +
", whitelistAuthority=" + whitelistAuthority +
", createTime=" + createTime +
", salt='" + salt + '\'' +
", tokenVersion=" + tokenVersion +
", ban=" + ban +
", baoyueVersion=" + baoyueVersion +
", donateVersion=" + donateVersion +
", vipType=" + vipType +
", viptypeVersion=" + viptypeVersion +
", anonimousUser=" + anonimousUser +
'}';
}
}
public static class ProfileBean {
/**
* djStatus : 0
* expertTags : null
* experts : {}
* avatarImgId : 109951163250233890
* backgroundImgId : 109951162868126480
* backgroundUrl : http://p1.music.126.net/_f8R60U9mZ42sSNvdPn2sQ==/109951162868126486.jpg
* avatarImgIdStr : 109951163250233892
* backgroundImgIdStr : 109951162868126486
* userId : 1794699363
* accountStatus : 0
* vipType : 0
* gender : 0
* province : 110000
* nickname : freak_csh
* userType : 0
* mutual : false
* remarkName : null
* authStatus : 0
* defaultAvatar : true
* avatarUrl : http://p1.music.126.net/ma8NC_MpYqC-dK_L81FWXQ==/109951163250233892.jpg
* birthday : -2209017600000
* city : 110101
* detailDescription :
* followed : false
* description :
* signature :
* authority : 0
* avatarImgId_str : 109951163250233892
* followeds : 0
* follows : 3
* eventCount : 0
* playlistCount : 1
* playlistBeSubscribedCount : 0
*/
private int djStatus;
private Object expertTags;
private ExpertsBean experts;
private long avatarImgId;
private long backgroundImgId;
private String backgroundUrl;
private String avatarImgIdStr;
private String backgroundImgIdStr;
private int userId;
private int accountStatus;
private int vipType;
private int gender;
private int province;
private String nickname;
private int userType;
private boolean mutual;
private Object remarkName;
private int authStatus;
private boolean defaultAvatar;
private String avatarUrl;
private long birthday;
private int city;
private String detailDescription;
private boolean followed;
private String description;
private String signature;
private int authority;
private String avatarImgId_str;
private int followeds;
private int follows;
private int eventCount;
private int playlistCount;
private int playlistBeSubscribedCount;
public int getDjStatus() {
return djStatus;
}
public void setDjStatus(int djStatus) {
this.djStatus = djStatus;
}
public Object getExpertTags() {
return expertTags;
}
public void setExpertTags(Object expertTags) {
this.expertTags = expertTags;
}
public ExpertsBean getExperts() {
return experts;
}
public void setExperts(ExpertsBean experts) {
this.experts = experts;
}
public long getAvatarImgId() {
return avatarImgId;
}
public void setAvatarImgId(long avatarImgId) {
this.avatarImgId = avatarImgId;
}
public long getBackgroundImgId() {
return backgroundImgId;
}
public void setBackgroundImgId(long backgroundImgId) {
this.backgroundImgId = backgroundImgId;
}
public String getBackgroundUrl() {
return backgroundUrl;
}
public void setBackgroundUrl(String backgroundUrl) {
this.backgroundUrl = backgroundUrl;
}
public String getAvatarImgIdStr() {
return avatarImgIdStr;
}
public void setAvatarImgIdStr(String avatarImgIdStr) {
this.avatarImgIdStr = avatarImgIdStr;
}
public String getBackgroundImgIdStr() {
return backgroundImgIdStr;
}
public void setBackgroundImgIdStr(String backgroundImgIdStr) {
this.backgroundImgIdStr = backgroundImgIdStr;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public int getAccountStatus() {
return accountStatus;
}
public void setAccountStatus(int accountStatus) {
this.accountStatus = accountStatus;
}
public int getVipType() {
return vipType;
}
public void setVipType(int vipType) {
this.vipType = vipType;
}
public int getGender() {
return gender;
}
public void setGender(int gender) {
this.gender = gender;
}
public int getProvince() {
return province;
}
public void setProvince(int province) {
this.province = province;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public int getUserType() {
return userType;
}
public void setUserType(int userType) {
this.userType = userType;
}
public boolean isMutual() {
return mutual;
}
public void setMutual(boolean mutual) {
this.mutual = mutual;
}
public Object getRemarkName() {
return remarkName;
}
public void setRemarkName(Object remarkName) {
this.remarkName = remarkName;
}
public int getAuthStatus() {
return authStatus;
}
public void setAuthStatus(int authStatus) {
this.authStatus = authStatus;
}
public boolean isDefaultAvatar() {
return defaultAvatar;
}
public void setDefaultAvatar(boolean defaultAvatar) {
this.defaultAvatar = defaultAvatar;
}
public String getAvatarUrl() {
return avatarUrl;
}
public void setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
}
public long getBirthday() {
return birthday;
}
public void setBirthday(long birthday) {
this.birthday = birthday;
}
public int getCity() {
return city;
}
public void setCity(int city) {
this.city = city;
}
public String getDetailDescription() {
return detailDescription;
}
public void setDetailDescription(String detailDescription) {
this.detailDescription = detailDescription;
}
public boolean isFollowed() {
return followed;
}
public void setFollowed(boolean followed) {
this.followed = followed;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getSignature() {
return signature;
}
public void setSignature(String signature) {
this.signature = signature;
}
public int getAuthority() {
return authority;
}
public void setAuthority(int authority) {
this.authority = authority;
}
public String getAvatarImgId_str() {
return avatarImgId_str;
}
public void setAvatarImgId_str(String avatarImgId_str) {
this.avatarImgId_str = avatarImgId_str;
}
public int getFolloweds() {
return followeds;
}
public void setFolloweds(int followeds) {
this.followeds = followeds;
}
public int getFollows() {
return follows;
}
public void setFollows(int follows) {
this.follows = follows;
}
public int getEventCount() {
return eventCount;
}
public void setEventCount(int eventCount) {
this.eventCount = eventCount;
}
public int getPlaylistCount() {
return playlistCount;
}
public void setPlaylistCount(int playlistCount) {
this.playlistCount = playlistCount;
}
public int getPlaylistBeSubscribedCount() {
return playlistBeSubscribedCount;
}
public void setPlaylistBeSubscribedCount(int playlistBeSubscribedCount) {
this.playlistBeSubscribedCount = playlistBeSubscribedCount;
}
public static class ExpertsBean {
}
@Override
public String toString() {
return "ProfileBean{" +
"djStatus=" + djStatus +
", expertTags=" + expertTags +
", experts=" + experts +
", avatarImgId=" + avatarImgId +
", backgroundImgId=" + backgroundImgId +
", backgroundUrl='" + backgroundUrl + '\'' +
", avatarImgIdStr='" + avatarImgIdStr + '\'' +
", backgroundImgIdStr='" + backgroundImgIdStr + '\'' +
", userId=" + userId +
", accountStatus=" + accountStatus +
", vipType=" + vipType +
", gender=" + gender +
", province=" + province +
", nickname='" + nickname + '\'' +
", userType=" + userType +
", mutual=" + mutual +
", remarkName=" + remarkName +
", authStatus=" + authStatus +
", defaultAvatar=" + defaultAvatar +
", avatarUrl='" + avatarUrl + '\'' +
", birthday=" + birthday +
", city=" + city +
", detailDescription='" + detailDescription + '\'' +
", followed=" + followed +
", description='" + description + '\'' +
", signature='" + signature + '\'' +
", authority=" + authority +
", avatarImgId_str='" + avatarImgId_str + '\'' +
", followeds=" + followeds +
", follows=" + follows +
", eventCount=" + eventCount +
", playlistCount=" + playlistCount +
", playlistBeSubscribedCount=" + playlistBeSubscribedCount +
'}';
}
}
public static class BindingsBean {
/**
* tokenJsonStr : {"countrycode":"","cellphone":"13790994100","hasPassword":true}
* expired : false
* userId : 1794699363
* url :
* expiresIn : 2147483647
* refreshTime : 1552708437
* id : 6825653043
* type : 1
*/
private String tokenJsonStr;
private boolean expired;
private int userId;
private String url;
private int expiresIn;
private int refreshTime;
private long id;
private int type;
public String getTokenJsonStr() {
return tokenJsonStr;
}
public void setTokenJsonStr(String tokenJsonStr) {
this.tokenJsonStr = tokenJsonStr;
}
public boolean isExpired() {
return expired;
}
public void setExpired(boolean expired) {
this.expired = expired;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public int getExpiresIn() {
return expiresIn;
}
public void setExpiresIn(int expiresIn) {
this.expiresIn = expiresIn;
}
public int getRefreshTime() {
return refreshTime;
}
public void setRefreshTime(int refreshTime) {
this.refreshTime = refreshTime;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
@Override
public String toString() {
return "BindingsBean{" +
"tokenJsonStr='" + tokenJsonStr + '\'' +
", expired=" + expired +
", userId=" + userId +
", url='" + url + '\'' +
", expiresIn=" + expiresIn +
", refreshTime=" + refreshTime +
", id=" + id +
", type=" + type +
'}';
}
}
@Override
public String toString() {
return "LoginEntity{" +
"loginType=" + loginType +
", code=" + code +
", msg='" + msg + '\'' +
", account=" + account +
", profile=" + profile +
", bindings=" + bindings +
'}';
}
}
| [
"740997937@qq.com"
] | 740997937@qq.com |
6fcfece94f6c5e986e60f49885eef8013634c07b | 7ed7b40cb544b9a969c14d6dd39fd9eaae1c3760 | /src/cn/edu/zafu/activity/MainActivity.java | 0814e274af3ce1798f619e5eba36c20ed495642c | [] | no_license | chinarefers/ZXing | 919bbcd45b0c4a67d304ac7408318c678e5ed9fd | 3b1d1747b7680dd9f8c5d2cc07bbfb20d2353a2a | refs/heads/master | 2021-01-13T03:03:58.063837 | 2015-04-30T11:43:41 | 2015-04-30T11:43:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,259 | java | package cn.edu.zafu.activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import cn.edu.zafu.library.android.BeepManager;
import cn.edu.zafu.library.android.CaptureActivity;
import cn.edu.zafu.zxingtest.R;
public class MainActivity extends Activity {
private static final int REQUEST_CODE_SCAN = 0x0000;
private static final String DECODED_CONTENT_KEY = "codedContent";
private Button scanner;
private TextView result;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
}
private void initView() {
result = (TextView) findViewById(R.id.result);
scanner = (Button) findViewById(R.id.scan);
scanner.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(MainActivity.this,
CaptureActivity.class);
startActivityForResult(intent, REQUEST_CODE_SCAN);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// 扫描二维码/条码回传
if (requestCode == REQUEST_CODE_SCAN && resultCode == RESULT_OK) {
if (data != null) {
String content = data.getStringExtra(DECODED_CONTENT_KEY);
if (content.contains("uuid")) {
int uuidIndex = content.indexOf("uuid=");
int uuidEnd = content.indexOf("&", uuidIndex);
String uuid = content.substring(uuidIndex + 5, uuidEnd);
int majorIndex = content.indexOf("major=", uuidEnd);
int majorEnd = content.indexOf("&", majorIndex);
String major = content.substring(majorIndex + 6, majorEnd);
int minorIndex = content.indexOf("minor=", majorEnd);
int minorEnd = content.length();
String minor = content.substring(minorIndex + 6, minorEnd);
result.setText("解码结果: \n" + " uuid = " + uuid
+ "\n major = " + major + "\n minor = " + minor);
} else {
result.setText("解码结果: \n未能识别出ibeacon模块,请重新扫描!");
}
}
}
}
}
| [
"513163535@qq.com"
] | 513163535@qq.com |
5a419059e4abf4e9731b493012bfaadb6d41bfc1 | 9c93ab009d4c482a9df282e7731f556281d33d90 | /spring-cloud-stream/src/main/java/com/ley/springcloud/stream/rabbit/StreamRabbitReceiverApplication.java | 56a490ec5fdab403c3613be3c8baefaa3de8d7b9 | [
"Apache-2.0"
] | permissive | crazyblitz/spring-cloud-learn | 64a13e74f5a31efaa677907e37dbd8cfa4e6c848 | 4ccf9c39d7577fa0ca8ebc472141a7f414518874 | refs/heads/master | 2023-07-19T23:52:40.739544 | 2019-05-29T08:51:08 | 2019-05-29T08:51:08 | 189,145,973 | 1 | 0 | Apache-2.0 | 2023-07-18T20:52:04 | 2019-05-29T03:43:45 | Java | UTF-8 | Java | false | false | 804 | java | package com.ley.springcloud.stream.rabbit;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
/**
* @see org.springframework.cloud.stream.binder.rabbit.properties.RabbitBinderConfigurationProperties
* @see org.springframework.cloud.stream.config.BindingProperties
* @see org.springframework.cloud.stream.binder.ConsumerProperties
* @see org.springframework.cloud.stream.binder.ProducerProperties
**/
@SpringBootApplication
@ComponentScan("com.ley.springcloud.stream.rabbit.group.consumer")
public class StreamRabbitReceiverApplication {
public static void main(String[] args) {
SpringApplication.run(StreamRabbitReceiverApplication.class, args);
}
}
| [
"liuenyuan1996@163.com"
] | liuenyuan1996@163.com |
9ff0a552aeda51a48f76fbba526a9cb00cef625c | f8951dd354c4131b802b5b5cf64edb71833fcbcf | /CalculadoraIMC/app/build/generated/source/buildConfig/debug/com/ifsc/calculadoraimc/BuildConfig.java | fa692f07b33506b2df696ad1d772325141bee172 | [] | no_license | rayanaprata/uc-desenvolvimento-para-dispositivos-moveis | 4c9e1ad067707d92c4b2dbda3f0de78e70e98d96 | 57ac6138631479b748674774e36403841317388a | refs/heads/main | 2023-08-04T18:16:47.142620 | 2021-09-10T02:42:14 | 2021-09-10T02:42:14 | 382,963,271 | 1 | 1 | null | 2021-09-09T01:51:32 | 2021-07-04T22:54:52 | Java | UTF-8 | Java | false | false | 411 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.ifsc.calculadoraimc;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.ifsc.calculadoraimc";
public static final String BUILD_TYPE = "debug";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"50561896+rayanaprata@users.noreply.github.com"
] | 50561896+rayanaprata@users.noreply.github.com |
37e8aa256044b3741870a14a7876fa7f8ebd999d | 29af183671956e1097aae84181bfd84f8573f17a | /app2/src/main/java/shbd/app2/activity/Observer.java | 48ee9c82a078c4b862432c6f395104abe769ccf2 | [] | no_license | yaoyoucai/CustomRxjava | dd0aeca4a1103ac1be47e3ccc5e2e63ee3fffdea | 437081baac8788c5fad8f55fd43f2e96718d278e | refs/heads/master | 2021-01-18T03:38:37.195674 | 2017-03-27T09:05:00 | 2017-03-27T09:05:00 | 85,801,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package shbd.app2.activity;
/**
* 项目名称:CustomRxjava
* 类描述:
* 创建人:yh
* 创建时间:2017/3/23 13:28
* 修改人:yh
* 修改时间:2017/3/23 13:28
* 修改备注:
*/
public interface Observer<T> {
void update(T t);
}
| [
"2511022042@qq.com"
] | 2511022042@qq.com |
9c708ca56e9c5c2a7e69d4cb52c24f12276eeb91 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/test/com/github/pedrovgs/problem78/AutoBoxingTrickTest.java | 9b2c8c5f3ce897bbb3071d9e686786d9e400745a | [] | no_license | STAMP-project/dspot-experiments | f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5 | 121487e65cdce6988081b67f21bbc6731354a47f | refs/heads/master | 2023-02-07T14:40:12.919811 | 2019-11-06T07:17:09 | 2019-11-06T07:17:09 | 75,710,758 | 14 | 19 | null | 2023-01-26T23:57:41 | 2016-12-06T08:27:42 | null | UTF-8 | Java | false | false | 1,191 | java | /**
* Copyright (C) 2014 Pedro Vicente G?mez S?nchez.
*
* 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.pedrovgs.problem78;
import org.junit.Assert;
import org.junit.Test;
/**
* Before to read this test read AutoBoxingTrick class, this is a really funny Java trick.
*
* @author Pedro Vicente G?mez S?nchez.
*/
public class AutoBoxingTrickTest {
private AutoBoxingTrick autoBoxingTrick;
@Test
public void shouldReturnFalseButReturnsTrue() {
Assert.assertTrue(autoBoxingTrick.compare(1, 1));
}
@Test
public void shouldReturnFalseAndReturnsFalse() {
Assert.assertFalse(autoBoxingTrick.compare(1000, 1000));
}
}
| [
"benjamin.danglot@inria.fr"
] | benjamin.danglot@inria.fr |
72cfdddbec997eebf7ea72cdb2c78a7be1a12501 | 849b3c3967361ad6273412a684ce40bde6a2c6da | /jacrt-store-back/src/main/java/io/lkr/jacrtstoreback/dto/out/ProductListOutDTO.java | 5848619b1aed298dda9173158aa461fd98195ba3 | [
"Apache-2.0"
] | permissive | Lkr233/lkr0224 | c220395c86fa8cf11437c869389abefe3087f0d4 | 977313c60b41e56986e1724e59ffce2a540a1337 | refs/heads/master | 2022-07-01T03:27:49.558234 | 2020-03-10T09:56:36 | 2020-03-10T09:56:36 | 242,663,684 | 0 | 0 | Apache-2.0 | 2022-06-17T02:57:40 | 2020-02-24T06:32:22 | JavaScript | UTF-8 | Java | false | false | 1,450 | java | package io.lkr.jacrtstoreback.dto.out;
public class ProductListOutDTO {
private Integer productId;
private String productCode;
private String productName;
private String productAbstract;
private Double price;
private Double discount;
private String mainPicUrl;
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getProductCode() {
return productCode;
}
public void setProductCode(String productCode) {
this.productCode = productCode;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductAbstract() {
return productAbstract;
}
public void setProductAbstract(String productAbstract) {
this.productAbstract = productAbstract;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
public String getMainPicUrl() {
return mainPicUrl;
}
public void setMainPicUrl(String mainPicUrl) {
this.mainPicUrl = mainPicUrl;
}
}
| [
"3601113109@qq.com"
] | 3601113109@qq.com |
77b5edb7345a6b06127d636a6c183e9ef73ccb6b | 97fd02f71b45aa235f917e79dd68b61c62b56c1c | /src/main/java/com/tencentcloudapi/ivld/v20210903/models/UpdateCustomCategoryRequest.java | 30c61d3edc33c5520be7c208713cf3088d75cbc7 | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-java | 7df922f7c5826732e35edeab3320035e0cdfba05 | 09fa672d75e5ca33319a23fcd8b9ca3d2afab1ec | refs/heads/master | 2023-09-04T10:51:57.854153 | 2023-09-01T03:21:09 | 2023-09-01T03:21:09 | 129,837,505 | 537 | 317 | Apache-2.0 | 2023-09-13T02:42:03 | 2018-04-17T02:58:16 | Java | UTF-8 | Java | false | false | 3,507 | java | /*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.ivld.v20210903.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class UpdateCustomCategoryRequest extends AbstractModel{
/**
* 自定义人物类型Id
*/
@SerializedName("CategoryId")
@Expose
private String CategoryId;
/**
* 一级自定义人物类型
*/
@SerializedName("L1Category")
@Expose
private String L1Category;
/**
* 二级自定义人物类型
*/
@SerializedName("L2Category")
@Expose
private String L2Category;
/**
* Get 自定义人物类型Id
* @return CategoryId 自定义人物类型Id
*/
public String getCategoryId() {
return this.CategoryId;
}
/**
* Set 自定义人物类型Id
* @param CategoryId 自定义人物类型Id
*/
public void setCategoryId(String CategoryId) {
this.CategoryId = CategoryId;
}
/**
* Get 一级自定义人物类型
* @return L1Category 一级自定义人物类型
*/
public String getL1Category() {
return this.L1Category;
}
/**
* Set 一级自定义人物类型
* @param L1Category 一级自定义人物类型
*/
public void setL1Category(String L1Category) {
this.L1Category = L1Category;
}
/**
* Get 二级自定义人物类型
* @return L2Category 二级自定义人物类型
*/
public String getL2Category() {
return this.L2Category;
}
/**
* Set 二级自定义人物类型
* @param L2Category 二级自定义人物类型
*/
public void setL2Category(String L2Category) {
this.L2Category = L2Category;
}
public UpdateCustomCategoryRequest() {
}
/**
* NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy,
* and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy.
*/
public UpdateCustomCategoryRequest(UpdateCustomCategoryRequest source) {
if (source.CategoryId != null) {
this.CategoryId = new String(source.CategoryId);
}
if (source.L1Category != null) {
this.L1Category = new String(source.L1Category);
}
if (source.L2Category != null) {
this.L2Category = new String(source.L2Category);
}
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "CategoryId", this.CategoryId);
this.setParamSimple(map, prefix + "L1Category", this.L1Category);
this.setParamSimple(map, prefix + "L2Category", this.L2Category);
}
}
| [
"tencentcloudapi@tencent.com"
] | tencentcloudapi@tencent.com |
81cd8d404d62a65bad76311ded54b3b05fa2a2c0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/12/12_7c296d7be94e20b9b9b4b167a34481223b9b808e/Level/12_7c296d7be94e20b9b9b4b167a34481223b9b808e_Level_s.java | e8b2fd174c50846741fdaceda80759cecc167e2c | [] | 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 | 2,539 | java | package me.bevilacqua.ld48.Level;
import me.bevilacqua.ld48.Play;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Music;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.tiled.TiledMap;
public class Level {
private String mapPath;
private String Name;
private int height;
private int width;
private String musicPath;
private Music music;
private int timer;
private int elapsedTime;
public TiledMap map; //I know i shouldn't do this sorry Java gods have mercy
public boolean preMode = true; //I know i shouldn't do this sorry Java gods have mercy
private Image diary;
private String diaryPath;
private int diaryDELAY = 6000;
private int diaryElapsedTime;
public Level(String mapPath , String Name , String musicPath , int timer , String diaryPath) throws SlickException {
this.mapPath = mapPath;
this.Name = Name;
this.musicPath = musicPath;
this.timer = timer;
this.diaryPath = diaryPath;
this.init();
}
private void init() throws SlickException {
map = new TiledMap(mapPath);
music = new Music(musicPath);
diary = new Image(diaryPath);
height = map.getHeight();
width = map.getWidth();
System.out.println("Loading map Name: " + Name + " Width: " + width + " Height: " + height);
}
public void render(int x , int y , int startX , int startY , Graphics g) {
if(preMode) {
diary.draw();
} else {
if(music.playing() == false) music.loop();
map.render(0, 0 , startX + x , startY + y , 100 , 100);
g.drawString(" " + (float)((timer - elapsedTime) / 1000), 350 , 25);
}
}
public void failLevel() {
music.stop();
}
public void update(int Delta) {
if(preMode) {
if(diaryElapsedTime > diaryDELAY) {
preMode = false;
diaryElapsedTime = 0;
} else diaryElapsedTime += Delta;
} else {
if(elapsedTime > timer) {
Play.lf = true;
}
elapsedTime += Delta;
}
}
public String getName() {
return Name;
}
public String getMapPath() {
return this.mapPath;
}
public String getSoundPath() {
return this.musicPath;
}
public int getTimer() {
return this.timer;
}
public int getHeight() {
return height;
}
public int getWidth() {
return width;
}
public void endMusic() {
music.fade(1000, 0, true);
}
public void setElapsedTime(int i) {
this.elapsedTime = i;
}
public String getDiaryPath() {
return this.diaryPath;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
c0439d2d95b1a81bc40973a4e700ca7c59657151 | 76c0b5eaf94f958b047f73a700e2469c4630c5bb | /src/ds/set/UVA11136.java | 37d23afde0773e2ac2829547c0766614793c8df7 | [] | no_license | felipe-dossantos-dev/uva-online-judge | 4c693f33c9d3b7fa4b10eff23a76ddd828305149 | 3532a02aa65896a9b0f578b669ac8af570d6180d | refs/heads/master | 2022-05-01T08:29:54.939829 | 2017-06-18T20:04:44 | 2017-06-18T20:04:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,932 | java | package ds.set;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Locale;
import java.util.TreeMap;
public class UVA11136 {
public static void main(String[] args) throws IOException {
Locale.setDefault(Locale.US);
BufferedReader entrada = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter saida = new BufferedWriter(new OutputStreamWriter(System.out));
String linha = entrada.readLine();
int qtdLinhas = Integer.parseInt(linha);
while (qtdLinhas != 0) {
TreeMap<Long, Integer> urna = new TreeMap<>();
long total = 0;
for (int i = 0; i < qtdLinhas; i++) {
linha = entrada.readLine();
String vet[] = linha.split("\\s+");
int qtdContas = Integer.parseInt(vet[0]);
for (int j = 1; j <= qtdContas; j++) {
long cont = Long.parseLong(vet[j]);
if (urna.containsKey(cont)) {
urna.put(cont, urna.get(cont) + 1);
} else {
urna.put(cont, 1);
}
}
long menor = urna.firstKey();
long maior = urna.lastKey();
retirar(urna, maior);
retirar(urna, menor);
total += maior - menor;
}
saida.write(total + "\n");
linha = entrada.readLine();
qtdLinhas = Integer.parseInt(linha);
}
saida.flush();
}
public static void retirar(TreeMap<Long, Integer> urna, Long chave) {
int quantidade = urna.get(chave);
if (quantidade == 1) {
urna.remove(chave);
} else {
urna.put(chave, urna.get(chave) - 1);
}
}
}
| [
"santos.flip@gmail.com"
] | santos.flip@gmail.com |
e7895f8e339e1a54c9258acd90050b817ae7c052 | 6a95484a8989e92db07325c7acd77868cb0ac3bc | /modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201406/cm/MediaServiceInterfaceuploadResponse.java | 70dfccb14396412dd0edd10891613ab9071bcb54 | [
"Apache-2.0"
] | permissive | popovsh6/googleads-java-lib | 776687dd86db0ce785b9d56555fe83571db9570a | d3cabb6fb0621c2920e3725a95622ea934117daf | refs/heads/master | 2020-04-05T23:21:57.987610 | 2015-03-12T19:59:29 | 2015-03-12T19:59:29 | 33,672,406 | 1 | 0 | null | 2015-04-09T14:06:00 | 2015-04-09T14:06:00 | null | UTF-8 | Java | false | false | 1,919 | java |
package com.google.api.ads.adwords.jaxws.v201406.cm;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for uploadResponse element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="uploadResponse">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="rval" type="{https://adwords.google.com/api/adwords/cm/v201406}Media" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"rval"
})
@XmlRootElement(name = "uploadResponse")
public class MediaServiceInterfaceuploadResponse {
protected List<Media> rval;
/**
* Gets the value of the rval property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the rval property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getRval().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Media }
*
*
*/
public List<Media> getRval() {
if (rval == null) {
rval = new ArrayList<Media>();
}
return this.rval;
}
}
| [
"jradcliff@google.com"
] | jradcliff@google.com |
96d28c045f0c3b2217e5fc1ddb9b757fbda16666 | 6725d5b06c9567f00f8f77e2f5067a6a430c8af9 | /RetailApp/src/retailapp/Main.java | 2f807b58b103d88ecd82eb24306d649f64246b13 | [] | no_license | prashgec/RetailApp_1.0 | 0bacfa348edb53ae55f471d8935d9ea223498dcc | ffc758415088ec5f61f3f3453a40e6111a3353dc | refs/heads/master | 2021-01-25T03:49:49.177547 | 2013-10-10T19:51:31 | 2013-10-10T19:51:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,079 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package retailapp;
import com.reatil.VO.Customer;
import com.reatil.sessionfactory.SessionFactoryUtil;
import com.retail.view.LoginFrame;
import java.util.Date;
import org.hibernate.Session;
import org.hibernate.Transaction;
/**
*
* @author sushil
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Session session=null;
// Transaction transaction=null;
// session=SessionFactoryUtil.getSessionFactory().openSession();
// transaction=session.beginTransaction();
// Customer customer = new Customer();
// customer.setCustomerName("Sushil");
// customer.setDateOfBirth(new Date());
// customer.setUserName("Sushil");
// customer.setPassword("Tilak");
// customer.setContactNo("7738088331");
// System.out.println(customer.getCustomerName());
// session.save(customer);
// transaction.commit();
new LoginFrame().setVisible(true);
}
}
| [
"prash.gec@gmail.com"
] | prash.gec@gmail.com |
bba0536897d107165ddef42c654eb544c3d017cd | b9529369ea89106be07b8e6fe4b6064fa17ade47 | /src/main/java/com/flip/demo/wallet/WalletApplication.java | 2dff5632a60b582823a71a5f58144fad4d5d6492 | [] | no_license | arunabh123/e-wallet | 3baef07ff1833d1acc89c951959b924445d7cae7 | 1900bcbcc8748231724e8a8b39eafff903d207f4 | refs/heads/main | 2023-08-14T19:04:14.738221 | 2021-09-27T08:16:52 | 2021-09-27T08:16:52 | 410,798,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package com.flip.demo.wallet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class WalletApplication {
public static void main(String[] args) {
SpringApplication.run(WalletApplication.class, args);
}
}
| [
"arunabh.nandi@naukri.com"
] | arunabh.nandi@naukri.com |
7b678516fb5a2584467b668370c24e9837c5508f | fe1372df6948b5a23a3f1708662c458c2a0249d0 | /portal-cloud-dao/src/main/java/com/sstc/hmis/notification/dbaccess/dao/PermsTNoticeAccountMapper.java | 0f6cb04afb6f7dc5bd14c39f559a104643de7a61 | [] | no_license | gaoshiyi/ss | aa543eb36fe37f6e693e4f7aecb330d23f6ab0c8 | baa401a3040da1230006ed45fd94ef9f0e3325e0 | refs/heads/master | 2020-03-29T01:07:31.083733 | 2018-09-19T06:32:36 | 2018-09-19T06:32:36 | 149,372,353 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,560 | java | package com.sstc.hmis.notification.dbaccess.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.sstc.hmis.notification.dbaccess.data.PermsTNoticeAccount;
import com.sstc.hmis.notification.dbaccess.data.PermsTNoticeAccountExample;
@Mapper
public interface PermsTNoticeAccountMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int countByExample(PermsTNoticeAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int deleteByExample(PermsTNoticeAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int deleteByPrimaryKey(String clId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int insert(PermsTNoticeAccount record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int insertSelective(PermsTNoticeAccount record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
List<PermsTNoticeAccount> selectByExample(PermsTNoticeAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
PermsTNoticeAccount selectByPrimaryKey(String clId);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int updateByExampleSelective(@Param("record") PermsTNoticeAccount record, @Param("example") PermsTNoticeAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int updateByExample(@Param("record") PermsTNoticeAccount record, @Param("example") PermsTNoticeAccountExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int updateByPrimaryKeySelective(PermsTNoticeAccount record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table perms.perms_t_notice_account
*
* @mbggenerated Wed May 09 16:17:03 CST 2018
*/
int updateByPrimaryKey(PermsTNoticeAccount record);
} | [
"2547428066@qq.com"
] | 2547428066@qq.com |
2388eba678cf956c962c4da6648ad95219e9da8b | 3add8c172a78b42996ca45aef0bd6dffce8cc67c | /src/main/java/com/ulanm/moneytransfer/dao/UserDAO.java | 5e8226b80ec96163d5e5647b81de5243d13c1b7d | [] | no_license | ulan-mukhamedyanov/money-transfer-app | a7f672d2c765d9670ecf37e20ee20eb72cf96a0d | 4991abd33570363ed19f377129a0546efd7de739 | refs/heads/master | 2022-02-20T06:36:56.579595 | 2019-07-29T04:46:30 | 2019-07-29T04:46:30 | 199,280,869 | 0 | 0 | null | 2022-02-11T00:25:04 | 2019-07-28T11:50:27 | Java | UTF-8 | Java | false | false | 140 | java | package com.ulanm.moneytransfer.dao;
import com.ulanm.moneytransfer.model.impl.User;
public interface UserDAO extends GenericDAO<User> {}
| [
"ulan_mukhamedyanov@epam.com"
] | ulan_mukhamedyanov@epam.com |
0c27593d759a00cdf4eaf0507a658370c6cf8b3a | 2bc700d5ae5bcb6ae76d2b0f2dcfc2db6e1bcb1f | /src/main/java/Model/Customer.java | d3c07393f2c2d85661566d7efad2ef2c05a5ee37 | [] | no_license | allenjhan/alarmsystem | fe01bd3b638fc977073dbd447a9623b532056e50 | 7098776637076315c918ec6c56e61f6fc4fe98f2 | refs/heads/master | 2021-06-30T12:00:07.610808 | 2017-09-20T03:55:18 | 2017-09-20T03:55:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,077 | java | package Model;
/**
* Created by ahan on 6/2/17.
*/
public class Customer {
protected String id;
protected String name;
protected String address;
protected String emergencyNumber1;
protected String emergencyNumber2;
protected String customerID;
protected String effectiveDate;
protected UsernameAndPassword account;
public Customer(String id, String name, String address, String emergencyNumber1, String emergencyNumber2,
String customerID, String effectiveDate){
this.id = id;
this.name = name;
this.address = address;
this.emergencyNumber1 = emergencyNumber1;
this.emergencyNumber2 = emergencyNumber2;
this.account = new UsernameAndPassword();
setCustomerID(customerID);
account.setUsername(customerID);
this.effectiveDate = effectiveDate;
}
/**
* Getter for the contract ID of the customer
* @return the contract ID
*/
public String getId() {
return id;
}
/**
* Setter for the contract ID of the customer
* @param id the contract ID
*/
public void setId(String id) {
this.id = id;
}
/**
* Getter for the name of the customer
* @return name of customer
*/
public String getName() {
return name;
}
/**
* Setter for the name of the customer
* @param name name of customer
*/
public void setName(String name) {
this.name = name;
}
/**
* Getter for address of customer
* @return address of customer
*/
public String getAddress() {
return address;
}
/**
* Setter for address of customer
* @param address address of customer
*/
public void setAddress(String address) {
this.address = address;
}
/**
* Getter of emergency number 1.
* @return emergency number 1
*/
public String getEmergencyNumber1() {
return emergencyNumber1;
}
/**
* Setter of emergency number 1
* @param emergencyNumber1 emergency number 1
*/
public void setEmergencyNumber1(String emergencyNumber1) {
this.emergencyNumber1 = emergencyNumber1;
}
/**
* Getter of emergency number 2
* @return emergency number 2
*/
public String getEmergencyNumber2() {
return emergencyNumber2;
}
/**
* Setter of emergency number 2
* @param emergencyNumber2 emergency number 2
*/
public void setEmergencyNumber2(String emergencyNumber2) {
this.emergencyNumber2 = emergencyNumber2;
}
/**
* Getter of customer ID, used as login username.
* @return customer ID
*/
public String getCustomerID() {
return customerID;
}
/**
* Setter of customer ID, used as login username
* @param customerID customerID
* @return true if set was successful, false otherwise
*/
public boolean setCustomerID(String customerID) {
if (UsernameAndPassword.isValidUsernameOrPassword(customerID)) {
this.customerID = customerID;
account.setUsername(customerID);
return true;
}else
return false;
}
/**
* Getter of the effective date of service
* @return effective date of service
*/
public String getEffectiveDate() {
return effectiveDate;
}
/**
* Setter of the effective date of service
* @param effectiveDate effective date of service
*/
public void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
/**
* Getter of account, containing username and password
* @return account, which holds username and password
*/
public UsernameAndPassword getAccount() {
return account;
}
/**
* Setter of account, containing username and password
* @param account holds the username and password
*/
public void setAccount(UsernameAndPassword account) {
this.account = account;
}
}
| [
"santorinilysias@gmail.com"
] | santorinilysias@gmail.com |
f17585ddf13bdadb70cae1803ca48d5626260247 | b469e1be07580d32dd1e73797ae89256d41b8cb1 | /.idea/src/com/domain/lesson11Collections/enums/Main.java | 38c5db17788752d69b16d8da1e2589a7669ad5cc | [] | no_license | ArtemKhavaev/JavaCore | 4862ac9284a4dbd55de9119080e4958d9c2e24d6 | 1619746a854604df97453823261bec897e740e85 | refs/heads/master | 2021-01-03T04:59:07.521629 | 2020-02-14T15:01:34 | 2020-02-14T15:01:34 | 239,932,168 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | package com.domain.lesson11Collections.enums;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
User user = new User ();
user.setLogin("qwe");
user.setPwd("123");
user.setRole (Role.ADMIN);
System.out.println(Role.valueOf("ADMIN"));
System.out.println(Arrays.toString(Role.values()));
Operations operation = Operations.MULTI;
System.out.println(operation.action(2, 3));
Operations operation1 = Operations.SUM;
System.out.println(operation1.action(2, 9));
System.out.println(Priority.HIGH.getCode());
System.out.println(Priority.LOW.getCode());
}
}
enum Role{
USER, ADMIN;
}
enum Operations{
SUM {
public int action(int a, int b){
return a + b;
}
},
MULTI{
public int action(int a, int b){
return a * b;
}
};
abstract public int action (int a, int b);
}
enum Priority{
HIGH(9), MIDDLE(6), LOW(3);
private int code;
Priority (int code){
this.code = code;
}
public int getCode() {
return this.code;
}
} | [
"artemkhavaev@gmail.com"
] | artemkhavaev@gmail.com |
00df531e44a1927be0da951b73e968963c5f368b | 24f32d4b6fdb5dce23965e6a9696b0d000e0a337 | /webapp-gatewayapi/.svn/pristine/9e/9e9edd1de5d7967f3a718ddf4fbe8fad9a934707.svn-base | 452c9916d9187dcc81fd5f1e61d4fe52c80115b9 | [
"Apache-2.0"
] | permissive | deleidos/digitaledge-platform | 98f03a6c6402ba4d1ec57ebcec36e335b544f691 | 1eafdb92f6a205936ab4e08ef62be6bb0b9c9ec9 | refs/heads/master | 2020-04-12T06:36:08.811127 | 2016-11-17T15:25:13 | 2016-11-17T15:25:13 | 37,742,975 | 4 | 4 | Apache-2.0 | 2018-04-19T20:03:21 | 2015-06-19T19:57:30 | HTML | UTF-8 | Java | false | false | 16,570 | /**
* Apache License
* Version 2.0, January 2004
* http://www.apache.org/licenses/
*
* TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
*
* 1. Definitions.
*
* "License" shall mean the terms and conditions for use, reproduction,
* and distribution as defined by Sections 1 through 9 of this document.
*
* "Licensor" shall mean the copyright owner or entity authorized by
* the copyright owner that is granting the License.
*
* "Legal Entity" shall mean the union of the acting entity and all
* other entities that control, are controlled by, or are under common
* control with that entity. For the purposes of this definition,
* "control" means (i) the power, direct or indirect, to cause the
* direction or management of such entity, whether by contract or
* otherwise, or (ii) ownership of fifty percent (50%) or more of the
* outstanding shares, or (iii) beneficial ownership of such entity.
*
* "You" (or "Your") shall mean an individual or Legal Entity
* exercising permissions granted by this License.
*
* "Source" form shall mean the preferred form for making modifications,
* including but not limited to software source code, documentation
* source, and configuration files.
*
* "Object" form shall mean any form resulting from mechanical
* transformation or translation of a Source form, including but
* not limited to compiled object code, generated documentation,
* and conversions to other media types.
*
* "Work" shall mean the work of authorship, whether in Source or
* Object form, made available under the License, as indicated by a
* copyright notice that is included in or attached to the work
* (an example is provided in the Appendix below).
*
* "Derivative Works" shall mean any work, whether in Source or Object
* form, that is based on (or derived from) the Work and for which the
* editorial revisions, annotations, elaborations, or other modifications
* represent, as a whole, an original work of authorship. For the purposes
* of this License, Derivative Works shall not include works that remain
* separable from, or merely link (or bind by name) to the interfaces of,
* the Work and Derivative Works thereof.
*
* "Contribution" shall mean any work of authorship, including
* the original version of the Work and any modifications or additions
* to that Work or Derivative Works thereof, that is intentionally
* submitted to Licensor for inclusion in the Work by the copyright owner
* or by an individual or Legal Entity authorized to submit on behalf of
* the copyright owner. For the purposes of this definition, "submitted"
* means any form of electronic, verbal, or written communication sent
* to the Licensor or its representatives, including but not limited to
* communication on electronic mailing lists, source code control systems,
* and issue tracking systems that are managed by, or on behalf of, the
* Licensor for the purpose of discussing and improving the Work, but
* excluding communication that is conspicuously marked or otherwise
* designated in writing by the copyright owner as "Not a Contribution."
*
* "Contributor" shall mean Licensor and any individual or Legal Entity
* on behalf of whom a Contribution has been received by Licensor and
* subsequently incorporated within the Work.
*
* 2. Grant of Copyright License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* copyright license to reproduce, prepare Derivative Works of,
* publicly display, publicly perform, sublicense, and distribute the
* Work and such Derivative Works in Source or Object form.
*
* 3. Grant of Patent License. Subject to the terms and conditions of
* this License, each Contributor hereby grants to You a perpetual,
* worldwide, non-exclusive, no-charge, royalty-free, irrevocable
* (except as stated in this section) patent license to make, have made,
* use, offer to sell, sell, import, and otherwise transfer the Work,
* where such license applies only to those patent claims licensable
* by such Contributor that are necessarily infringed by their
* Contribution(s) alone or by combination of their Contribution(s)
* with the Work to which such Contribution(s) was submitted. If You
* institute patent litigation against any entity (including a
* cross-claim or counterclaim in a lawsuit) alleging that the Work
* or a Contribution incorporated within the Work constitutes direct
* or contributory patent infringement, then any patent licenses
* granted to You under this License for that Work shall terminate
* as of the date such litigation is filed.
*
* 4. Redistribution. You may reproduce and distribute copies of the
* Work or Derivative Works thereof in any medium, with or without
* modifications, and in Source or Object form, provided that You
* meet the following conditions:
*
* (a) You must give any other recipients of the Work or
* Derivative Works a copy of this License; and
*
* (b) You must cause any modified files to carry prominent notices
* stating that You changed the files; and
*
* (c) You must retain, in the Source form of any Derivative Works
* that You distribute, all copyright, patent, trademark, and
* attribution notices from the Source form of the Work,
* excluding those notices that do not pertain to any part of
* the Derivative Works; and
*
* (d) If the Work includes a "NOTICE" text file as part of its
* distribution, then any Derivative Works that You distribute must
* include a readable copy of the attribution notices contained
* within such NOTICE file, excluding those notices that do not
* pertain to any part of the Derivative Works, in at least one
* of the following places: within a NOTICE text file distributed
* as part of the Derivative Works; within the Source form or
* documentation, if provided along with the Derivative Works; or,
* within a display generated by the Derivative Works, if and
* wherever such third-party notices normally appear. The contents
* of the NOTICE file are for informational purposes only and
* do not modify the License. You may add Your own attribution
* notices within Derivative Works that You distribute, alongside
* or as an addendum to the NOTICE text from the Work, provided
* that such additional attribution notices cannot be construed
* as modifying the License.
*
* You may add Your own copyright statement to Your modifications and
* may provide additional or different license terms and conditions
* for use, reproduction, or distribution of Your modifications, or
* for any such Derivative Works as a whole, provided Your use,
* reproduction, and distribution of the Work otherwise complies with
* the conditions stated in this License.
*
* 5. Submission of Contributions. Unless You explicitly state otherwise,
* any Contribution intentionally submitted for inclusion in the Work
* by You to the Licensor shall be under the terms and conditions of
* this License, without any additional terms or conditions.
* Notwithstanding the above, nothing herein shall supersede or modify
* the terms of any separate license agreement you may have executed
* with Licensor regarding such Contributions.
*
* 6. Trademarks. This License does not grant permission to use the trade
* names, trademarks, service marks, or product names of the Licensor,
* except as required for reasonable and customary use in describing the
* origin of the Work and reproducing the content of the NOTICE file.
*
* 7. Disclaimer of Warranty. Unless required by applicable law or
* agreed to in writing, Licensor provides the Work (and each
* Contributor provides its Contributions) on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied, including, without limitation, any warranties or conditions
* of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
* PARTICULAR PURPOSE. You are solely responsible for determining the
* appropriateness of using or redistributing the Work and assume any
* risks associated with Your exercise of permissions under this License.
*
* 8. Limitation of Liability. In no event and under no legal theory,
* whether in tort (including negligence), contract, or otherwise,
* unless required by applicable law (such as deliberate and grossly
* negligent acts) or agreed to in writing, shall any Contributor be
* liable to You for damages, including any direct, indirect, special,
* incidental, or consequential damages of any character arising as a
* result of this License or out of the use or inability to use the
* Work (including but not limited to damages for loss of goodwill,
* work stoppage, computer failure or malfunction, or any and all
* other commercial damages or losses), even if such Contributor
* has been advised of the possibility of such damages.
*
* 9. Accepting Warranty or Additional Liability. While redistributing
* the Work or Derivative Works thereof, You may choose to offer,
* and charge a fee for, acceptance of support, warranty, indemnity,
* or other liability obligations and/or rights consistent with this
* License. However, in accepting such obligations, You may act only
* on Your own behalf and on Your sole responsibility, not on behalf
* of any other Contributor, and only if You agree to indemnify,
* defend, and hold each Contributor harmless for any liability
* incurred by, or claims asserted against, such Contributor by reason
* of your accepting any such warranty or additional liability.
*
* END OF TERMS AND CONDITIONS
*
* APPENDIX: How to apply the Apache License to your work.
*
* To apply the Apache License to your work, attach the following
* boilerplate notice, with the fields enclosed by brackets "{}"
* replaced with your own identifying information. (Don't include
* the brackets!) The text should be enclosed in the appropriate
* comment syntax for the file format. We also recommend that a
* file or class name and description of purpose be included on the
* same "printed page" as the copyright notice for easier
* identification within third-party archives.
*
* Copyright {yyyy} {name of copyright owner}
*
* 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.deleidos.rtws.webapp.gatewayapi.client;
import com.deleidos.rtws.commons.cloud.platform.ServiceInterface;
import com.deleidos.rtws.commons.cloud.util.InterfaceConfig;
import com.deleidos.rtws.commons.jersey.config.JerseyClientConfig;
import com.sun.jersey.api.client.Client;
public final class RestClientManager {
private static Client REST_CLIENT_INSTANCE;
private static ServiceInterface SERVICE_INTERFACE_INSTANCE;
private static CloudEnvironmentServiceClient CLOUD_ENV_SERVICE_CLIENT_INSTANCE;
private static DnsApiRestClient DNS_API_REST_CLIENT_INSTANCE;
private static InstanceServiceClient INSTANCE_SERVICE_CLIENT_INSTANCE;
private static RepositoryApiRestClient REPOSITORY_API_REST_CLIENT_INSTANCE;
private static SecurityGroupServiceClient SECURITY_GROUP_SERVICE_CLIENT_INSTANCE;
private static SecurityGroupsServiceClient SECURITY_GROUPS_SERVICE_CLIENT_INSTANCE;
private static SystemServiceClient SYSTEM_SERVICE_CLIENT_INSTANCE;
private static SystemsServiceClient SYSTEMS_SERVICE_CLIENT_INSTANCE;
private static TenantApiRestClient TENANT_API_REST_CLIENT_INSTANCE;
private static VirtualPrivateCloudClient VPC_CLIENT_INSTANCE;
private static ScheduleApiLocalhostClient SCHEDULE_API_CLIENT_INSTANCE;
private RestClientManager() {
// Not instantiable
}
public static synchronized Client getRestClient() {
if (REST_CLIENT_INSTANCE == null) {
REST_CLIENT_INSTANCE = Client.create(JerseyClientConfig.getInstance().getInternalConfig());
}
return REST_CLIENT_INSTANCE;
}
public static synchronized ServiceInterface getServiceInterface() {
if (SERVICE_INTERFACE_INSTANCE == null) {
SERVICE_INTERFACE_INSTANCE = InterfaceConfig.getInstance().getServiceInterface();
}
return SERVICE_INTERFACE_INSTANCE;
}
public static synchronized CloudEnvironmentServiceClient getCloudEnvironmentServiceClient() {
if (CLOUD_ENV_SERVICE_CLIENT_INSTANCE == null) {
CLOUD_ENV_SERVICE_CLIENT_INSTANCE = new CloudEnvironmentServiceClient();
}
return CLOUD_ENV_SERVICE_CLIENT_INSTANCE;
}
public static synchronized DnsApiRestClient getDnsApiRestClient() {
if (DNS_API_REST_CLIENT_INSTANCE == null) {
DNS_API_REST_CLIENT_INSTANCE = new DnsApiRestClient();
}
return DNS_API_REST_CLIENT_INSTANCE;
}
public static synchronized ScheduleApiLocalhostClient getScheduleApiRestClient(){
if (SCHEDULE_API_CLIENT_INSTANCE == null){
SCHEDULE_API_CLIENT_INSTANCE = new ScheduleApiLocalhostClient();
}
return SCHEDULE_API_CLIENT_INSTANCE;
}
public static synchronized InstanceServiceClient getInstanceServiceClient() {
if (INSTANCE_SERVICE_CLIENT_INSTANCE == null) {
INSTANCE_SERVICE_CLIENT_INSTANCE = new InstanceServiceClient();
}
return INSTANCE_SERVICE_CLIENT_INSTANCE;
}
public static synchronized RepositoryApiRestClient getRespositoryApiRestClient() {
if (REPOSITORY_API_REST_CLIENT_INSTANCE == null) {
REPOSITORY_API_REST_CLIENT_INSTANCE = new RepositoryApiRestClient();
}
return REPOSITORY_API_REST_CLIENT_INSTANCE;
}
public static synchronized SecurityGroupServiceClient getSecurityGroupServiceClient() {
if (SECURITY_GROUP_SERVICE_CLIENT_INSTANCE == null) {
SECURITY_GROUP_SERVICE_CLIENT_INSTANCE = new SecurityGroupServiceClient();
}
return SECURITY_GROUP_SERVICE_CLIENT_INSTANCE;
}
public static synchronized SecurityGroupsServiceClient getSecurityGroupsServiceClient() {
if (SECURITY_GROUPS_SERVICE_CLIENT_INSTANCE == null) {
SECURITY_GROUPS_SERVICE_CLIENT_INSTANCE = new SecurityGroupsServiceClient();
}
return SECURITY_GROUPS_SERVICE_CLIENT_INSTANCE;
}
public static synchronized SystemServiceClient getSystemServiceClient() {
if (SYSTEM_SERVICE_CLIENT_INSTANCE == null) {
SYSTEM_SERVICE_CLIENT_INSTANCE = new SystemServiceClient();
}
return SYSTEM_SERVICE_CLIENT_INSTANCE;
}
public static synchronized SystemsServiceClient getSystemsServiceClient() {
if (SYSTEMS_SERVICE_CLIENT_INSTANCE == null) {
SYSTEMS_SERVICE_CLIENT_INSTANCE = new SystemsServiceClient();
}
return SYSTEMS_SERVICE_CLIENT_INSTANCE;
}
public static synchronized TenantApiRestClient getTenantApiRestClient() {
if (TENANT_API_REST_CLIENT_INSTANCE == null) {
TENANT_API_REST_CLIENT_INSTANCE = new TenantApiRestClient();
}
return TENANT_API_REST_CLIENT_INSTANCE;
}
public static synchronized VirtualPrivateCloudClient getVirtualPrivateCloudClient () {
if (VPC_CLIENT_INSTANCE == null) {
VPC_CLIENT_INSTANCE = new VirtualPrivateCloudClient();
}
return VPC_CLIENT_INSTANCE;
}
} | [
"loomisn@leidos.com"
] | loomisn@leidos.com | |
8d1301e54188a5d0ff4d46b798a617f24eaa6613 | 7a43d503c0af1e18eb8ec1bce435f16a55df93b5 | /bouncycastle-example/src/main/java/com/github/knives/java/security/RandomKeyElGamalExample.java | ee1d75a54ddbfce5f813c6e3ea146e6d0b4b908e | [
"Apache-2.0"
] | permissive | srikanthqa/knives | 257858d29676c9863a92b8588e179e49b48f8b8c | d8c7678f5d510b5a9889f7874824ad0a56ed1d31 | refs/heads/master | 2020-04-16T06:26:29.974268 | 2015-07-03T03:49:28 | 2015-07-03T03:49:28 | 40,258,015 | 0 | 1 | null | 2015-08-05T17:06:09 | 2015-08-05T17:06:08 | null | UTF-8 | Java | false | false | 1,262 | java | package com.github.knives.java.security;
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.SecureRandom;
import javax.crypto.Cipher;
/**
* El Gamal example with random key generation.
*/
public class RandomKeyElGamalExample {
public static void main(String[] args) throws Exception {
byte[] input = new byte[] { (byte) 0xbe, (byte) 0xef };
Cipher cipher = Cipher.getInstance("ElGamal/None/NoPadding", "BC");
SecureRandom random = Utils.createFixedRandom();
// create the keys
KeyPairGenerator generator = KeyPairGenerator.getInstance("ElGamal",
"BC");
generator.initialize(256, random);
KeyPair pair = generator.generateKeyPair();
Key pubKey = pair.getPublic();
Key privKey = pair.getPrivate();
System.out.println("input : " + Utils.toHex(input));
// encryption step
cipher.init(Cipher.ENCRYPT_MODE, pubKey, random);
byte[] cipherText = cipher.doFinal(input);
System.out.println("cipher: " + Utils.toHex(cipherText));
// decryption step
cipher.init(Cipher.DECRYPT_MODE, privKey);
byte[] plainText = cipher.doFinal(cipherText);
System.out.println("plain : " + Utils.toHex(plainText));
}
}
| [
"khaing211@gmail.com"
] | khaing211@gmail.com |
002cdb92ec1c9916685b6a6604af45eedb390d57 | c5f91017d0743005fb885d03c306eee4d5ef5fb0 | /Assignment4/src/StdDraw.java | 41ace5f41f872aca79a96e0a96d1836669d94ccf | [] | no_license | ExtremeViscent/CS102A_Works | 7023ec77215b3d5224b26b73a1b34c32851ecfab | 19b5f391b4b334b4909c7e7161e89edf5e6a98c4 | refs/heads/master | 2020-04-05T07:11:25.733436 | 2018-12-11T06:03:16 | 2018-12-11T06:03:16 | 156,666,272 | 0 | 1 | null | null | null | null | BIG5 | Java | false | false | 73,759 | java | /******************************************************************************
* Compilation: javac StdDraw.java
* Execution: java StdDraw
* Dependencies: none
*
* Standard drawing library. This class provides a basic capability for
* creating drawings with your programs. It uses a simple graphics model that
* allows you to create drawings consisting of points, lines, and curves
* in a window on your computer and to save the drawings to a file.
*
* Todo
* ----
* - Add support for gradient fill, etc.
* - Fix setCanvasSize() so that it can only be called once.
* - On some systems, drawing a line (or other shape) that extends way
* beyond canvas (e.g., to infinity) dimensions does not get drawn.
*
* Remarks
* -------
* - don't use AffineTransform for rescaling since it inverts
* images and strings
*
******************************************************************************/
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.FileDialog;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.geom.Arc2D;
import java.awt.geom.Ellipse2D;
import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.awt.image.DirectColorModel;
import java.awt.image.WritableRaster;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.LinkedList;
import java.util.TreeSet;
import java.util.NoSuchElementException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;
/**
* The {@code StdDraw} class provides a basic capability for
* creating drawings with your programs. It uses a simple graphics model that
* allows you to create drawings consisting of points, lines, squares,
* circles, and other geometric shapes in a window on your computer and
* to save the drawings to a file. Standard drawing also includes
* facilities for text, color, pictures, and animation, along with
* user interaction via the keyboard and mouse.
* <p>
* <b>Getting started.</b>
* To use standard drawing, you must have {@code StdDraw.class} in your
* Java classpath. If you used our autoinstaller, you should be all set.
* Otherwise, download
* <a href = "https://introcs.cs.princeton.edu/java/stdlib/StdDraw.java">StdDraw.java</a>
* and put a copy in your working directory.
* <p>
* Now, type the following short program into your editor:
* <pre>
* public class TestStdDraw {
* public static void main(String[] args) {
* StdDraw.setPenRadius(0.05);
* StdDraw.setPenColor(StdDraw.BLUE);
* StdDraw.point(0.5, 0.5);
* StdDraw.setPenColor(StdDraw.MAGENTA);
* StdDraw.line(0.2, 0.2, 0.8, 0.2);
* }
* }
* </pre>
* If you compile and execute the program, you should see a window
* appear with a thick magenta line and a blue point.
* This program illustrates the two main types of methods in standard
* drawing〞methods that draw geometric shapes and methods that
* control drawing parameters.
* The methods {@code StdDraw.line()} and {@code StdDraw.point()}
* draw lines and points; the methods {@code StdDraw.setPenRadius()}
* and {@code StdDraw.setPenColor()} control the line thickness and color.
* <p>
* <b>Points and lines.</b>
* You can draw points and line segments with the following methods:
* <ul>
* <li> {@link #point(double x, double y)}
* <li> {@link #line(double x1, double y1, double x2, double y2)}
* </ul>
* <p>
* The <em>x</em>- and <em>y</em>-coordinates must be in the drawing area
* (between 0 and 1 and by default) or the points and lines will not be visible.
* <p>
* <b>Squares, circles, rectangles, and ellipses.</b>
* You can draw squares, circles, rectangles, and ellipses using
* the following methods:
* <ul>
* <li> {@link #circle(double x, double y, double radius)}
* <li> {@link #ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis)}
* <li> {@link #square(double x, double y, double radius)}
* <li> {@link #rectangle(double x, double y, double halfWidth, double halfHeight)}
* </ul>
* <p>
* All of these methods take as arguments the location and size of the shape.
* The location is always specified by the <em>x</em>- and <em>y</em>-coordinates
* of its <em>center</em>.
* The size of a circle is specified by its radius and the size of an ellipse is
* specified by the lengths of its semi-major and semi-minor axes.
* The size of a square or rectangle is specified by its half-width or half-height.
* The convention for drawing squares and rectangles is parallel to those for
* drawing circles and ellipses, but may be unexpected to the uninitiated.
* <p>
* The methods above trace outlines of the given shapes. The following methods
* draw filled versions:
* <ul>
* <li> {@link #filledCircle(double x, double y, double radius)}
* <li> {@link #filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis)}
* <li> {@link #filledSquare(double x, double y, double radius)}
* <li> {@link #filledRectangle(double x, double y, double halfWidth, double halfHeight)}
* </ul>
* <p>
* <b>Circular arcs.</b>
* You can draw circular arcs with the following method:
* <ul>
* <li> {@link #arc(double x, double y, double radius, double angle1, double angle2)}
* </ul>
* <p>
* The arc is from the circle centered at (<em>x</em>, <em>y</em>) of the specified radius.
* The arc extends from angle1 to angle2. By convention, the angles are
* <em>polar</em> (counterclockwise angle from the <em>x</em>-axis)
* and represented in degrees. For example, {@code StdDraw.arc(0.0, 0.0, 1.0, 0, 90)}
* draws the arc of the unit circle from 3 o'clock (0 degrees) to 12 o'clock (90 degrees).
* <p>
* <b>Polygons.</b>
* You can draw polygons with the following methods:
* <ul>
* <li> {@link #polygon(double[] x, double[] y)}
* <li> {@link #filledPolygon(double[] x, double[] y)}
* </ul>
* <p>
* The points in the polygon are ({@code x[i]}, {@code y[i]}).
* For example, the following code fragment draws a filled diamond
* with vertices (0.1, 0.2), (0.2, 0.3), (0.3, 0.2), and (0.2, 0.1):
* <pre>
* double[] x = { 0.1, 0.2, 0.3, 0.2 };
* double[] y = { 0.2, 0.3, 0.2, 0.1 };
* StdDraw.filledPolygon(x, y);
* </pre>
* <p>
* <b>Pen size.</b>
* The pen is circular, so that when you set the pen radius to <em>r</em>
* and draw a point, you get a circle of radius <em>r</em>. Also, lines are
* of thickness 2<em>r</em> and have rounded ends. The default pen radius
* is 0.005 and is not affected by coordinate scaling. This default pen
* radius is about 1/200 the width of the default canvas, so that if
* you draw 100 points equally spaced along a horizontal or vertical line,
* you will be able to see individual circles, but if you draw 200 such
* points, the result will look like a line.
* <ul>
* <li> {@link #setPenRadius(double radius)}
* </ul>
* <p>
* For example, {@code StdDraw.setPenRadius(0.025)} makes
* the thickness of the lines and the size of the points to be five times
* the 0.005 default.
* To draw points with the minimum possible radius (one pixel on typical
* displays), set the pen radius to 0.0.
* <p>
* <b>Pen color.</b>
* All geometric shapes (such as points, lines, and circles) are drawn using
* the current pen color. By default, it is black.
* You can change the pen color with the following methods:
* <ul>
* <li> {@link #setPenColor(int red, int green, int blue)}
* <li> {@link #setPenColor(Color color)}
* </ul>
* <p>
* The first method allows you to specify colors using the RGB color system.
* This <a href = "http://johndyer.name/lab/colorpicker/">color picker</a>
* is a convenient way to find a desired color.
* The second method allows you to specify colors using the
* {@link Color} data type that is discussed in Chapter 3. Until then,
* you can use this method with one of these predefined colors in standard drawing:
* {@link #BLACK}, {@link #BLUE}, {@link #CYAN}, {@link #DARK_GRAY}, {@link #GRAY},
* {@link #GREEN}, {@link #LIGHT_GRAY}, {@link #MAGENTA}, {@link #ORANGE},
* {@link #PINK}, {@link #RED}, {@link #WHITE}, {@link #YELLOW},
* {@link #BOOK_BLUE}, {@link #BOOK_LIGHT_BLUE}, {@link #BOOK_RED}, and
* {@link #PRINCETON_ORANGE}.
* For example, {@code StdDraw.setPenColor(StdDraw.MAGENTA)} sets the
* pen color to magenta.
* <p>
* <b>Canvas size.</b>
* By default, all drawing takes places in a 512-by-512 canvas.
* The canvas does not include the window title or window border.
* You can change the size of the canvas with the following method:
* <ul>
* <li> {@link #setCanvasSize(int width, int height)}
* </ul>
* <p>
* This sets the canvas size to be <em>width</em>-by-<em>height</em> pixels.
* It also erases the current drawing and resets the coordinate system,
* pen radius, pen color, and font back to their default values.
* Ordinarly, this method is called once, at the very beginning of a program.
* For example, {@code StdDraw.setCanvasSize(800, 800)}
* sets the canvas size to be 800-by-800 pixels.
* <p>
* <b>Canvas scale and coordinate system.</b>
* By default, all drawing takes places in the unit square, with (0, 0) at
* lower left and (1, 1) at upper right. You can change the default
* coordinate system with the following methods:
* <ul>
* <li> {@link #setXscale(double xmin, double xmax)}
* <li> {@link #setYscale(double ymin, double ymax)}
* <li> {@link #setScale(double min, double max)}
* </ul>
* <p>
* The arguments are the coordinates of the minimum and maximum
* <em>x</em>- or <em>y</em>-coordinates that will appear in the canvas.
* For example, if you wish to use the default coordinate system but
* leave a small margin, you can call {@code StdDraw.setScale(-.05, 1.05)}.
* <p>
* These methods change the coordinate system for subsequent drawing
* commands; they do not affect previous drawings.
* These methods do not change the canvas size; so, if the <em>x</em>-
* and <em>y</em>-scales are different, squares will become rectangles
* and circles will become ellipsoidal.
* <p>
* <b>Text.</b>
* You can use the following methods to annotate your drawings with text:
* <ul>
* <li> {@link #text(double x, double y, String text)}
* <li> {@link #text(double x, double y, String text, double degrees)}
* <li> {@link #textLeft(double x, double y, String text)}
* <li> {@link #textRight(double x, double y, String text)}
* </ul>
* <p>
* The first two methods write the specified text in the current font,
* centered at (<em>x</em>, <em>y</em>).
* The second method allows you to rotate the text.
* The last two methods either left- or right-align the text at (<em>x</em>, <em>y</em>).
* <p>
* The default font is a Sans Serif font with point size 16.
* You can use the following method to change the font:
* <ul>
* <li> {@link #setFont(Font font)}
* </ul>
* <p>
* You use the {@link Font} data type to specify the font. This allows you to
* choose the face, size, and style of the font. For example, the following
* code fragment sets the font to Arial Bold, 60 point.
* <pre>
* Font font = new Font("Arial", Font.BOLD, 60);
* StdDraw.setFont(font);
* StdDraw.text(0.5, 0.5, "Hello, World");
* </pre>
* <p>
* <b>Images.</b>
* You can use the following methods to add images to your drawings:
* <ul>
* <li> {@link #picture(double x, double y, String filename)}
* <li> {@link #picture(double x, double y, String filename, double degrees)}
* <li> {@link #picture(double x, double y, String filename, double scaledWidth, double scaledHeight)}
* <li> {@link #picture(double x, double y, String filename, double scaledWidth, double scaledHeight, double degrees)}
* </ul>
* <p>
* These methods draw the specified image, centered at (<em>x</em>, <em>y</em>).
* The supported image formats are JPEG, PNG, and GIF.
* The image will display at its native size, independent of the coordinate system.
* Optionally, you can rotate the image a specified number of degrees counterclockwise
* or rescale it to fit snugly inside a width-by-height bounding box.
* <p>
* <b>Saving to a file.</b>
* You save your image to a file using the <em>File _ Save</em> menu option.
* You can also save a file programatically using the following method:
* <ul>
* <li> {@link #save(String filename)}
* </ul>
* <p>
* The supported image formats are JPEG and PNG. The filename must have either the
* extension .jpg or .png.
* We recommend using PNG for drawing that consist solely of geometric shapes and JPEG
* for drawings that contains pictures.
* <p>
* <b>Clearing the canvas.</b>
* To clear the entire drawing canvas, you can use the following methods:
* <ul>
* <li> {@link #clear()}
* <li> {@link #clear(Color color)}
* </ul>
* <p>
* The first method clears the canvas to white; the second method
* allows you to specify a color of your choice. For example,
* {@code StdDraw.clear(StdDraw.LIGHT_GRAY)} clears the canvas to a shade
* of gray.
* <p>
* <b>Computer animations and double buffering.</b>
* Double buffering is one of the most powerful features of standard drawing,
* enabling computer animations.
* The following methods control the way in which objects are drawn:
* <ul>
* <li> {@link #enableDoubleBuffering()}
* <li> {@link #disableDoubleBuffering()}
* <li> {@link #show()}
* <li> {@link #pause(int t)}
* </ul>
* <p>
* By default, double buffering is disabled, which means that as soon as you
* call a drawing
* method〞such as {@code point()} or {@code line()}〞the
* results appear on the screen.
* <p>
* When double buffering is enabled by calling {@link #enableDoubleBuffering()},
* all drawing takes place on the <em>offscreen canvas</em>. The offscreen canvas
* is not displayed. Only when you call
* {@link #show()} does your drawing get copied from the offscreen canvas to
* the onscreen canvas, where it is displayed in the standard drawing window. You
* can think of double buffering as collecting all of the lines, points, shapes,
* and text that you tell it to draw, and then drawing them all
* <em>simultaneously</em>, upon request.
* <p>
* The most important use of double buffering is to produce computer
* animations, creating the illusion of motion by rapidly
* displaying static drawings. To produce an animation, repeat
* the following four steps:
* <ul>
* <li> Clear the offscreen canvas.
* <li> Draw objects on the offscreen canvas.
* <li> Copy the offscreen canvas to the onscreen canvas.
* <li> Wait for a short while.
* </ul>
* <p>
* The {@link #clear()}, {@link #show()}, and {@link #pause(int t)} methods
* support the first, third, and fourth of these steps, respectively.
* <p>
* For example, this code fragment animates two balls moving in a circle.
* <pre>
* StdDraw.setScale(-2, +2);
* StdDraw.enableDoubleBuffering();
*
* for (double t = 0.0; true; t += 0.02) {
* double x = Math.sin(t);
* double y = Math.cos(t);
* StdDraw.clear();
* StdDraw.filledCircle(x, y, 0.05);
* StdDraw.filledCircle(-x, -y, 0.05);
* StdDraw.show();
* StdDraw.pause(20);
* }
* </pre>
* <p>
* <b>Keyboard and mouse inputs.</b>
* Standard drawing has very basic support for keyboard and mouse input.
* It is much less powerful than most user interface libraries provide, but also much simpler.
* You can use the following methods to intercept mouse events:
* <ul>
* <li> {@link #isMousePressed()}
* <li> {@link #mouseX()}
* <li> {@link #mouseY()}
* </ul>
* <p>
* The first method tells you whether a mouse button is currently being pressed.
* The last two methods tells you the <em>x</em>- and <em>y</em>-coordinates of the mouse's
* current position, using the same coordinate system as the canvas (the unit square, by default).
* You should use these methods in an animation loop that waits a short while before trying
* to poll the mouse for its current state.
* You can use the following methods to intercept keyboard events:
* <ul>
* <li> {@link #hasNextKeyTyped()}
* <li> {@link #nextKeyTyped()}
* <li> {@link #isKeyPressed(int keycode)}
* </ul>
* <p>
* If the user types lots of keys, they will be saved in a list until you process them.
* The first method tells you whether the user has typed a key (that your program has
* not yet processed).
* The second method returns the next key that the user typed (that your program has
* not yet processed) and removes it from the list of saved keystrokes.
* The third method tells you whether a key is currently being pressed.
* <p>
* <b>Accessing control parameters.</b>
* You can use the following methods to access the current pen color, pen radius,
* and font:
* <ul>
* <li> {@link #getPenColor()}
* <li> {@link #getPenRadius()}
* <li> {@link #getFont()}
* </ul>
* <p>
* These methods are useful when you want to temporarily change a
* control parameter and reset it back to its original value.
* <p>
* <b>Corner cases.</b>
* To avoid clutter, the API doesn't explicitly refer to arguments that are
* null, infinity, or NaN.
* <ul>
* <li> Any method that is passed a {@code null} argument will throw an
* {@link IllegalArgumentException}.
* <li> Except as noted in the APIs, drawing an object outside (or partly outside)
* the canvas is permitted〞however, only the part of the object that
* appears inside the canvas will be visible.
* <li> Except as noted in the APIs, all methods accept {@link Double#NaN},
* {@link Double#POSITIVE_INFINITY}, and {@link Double#NEGATIVE_INFINITY}
* as arugments. An object drawn with an <em>x</em>- or <em>y</em>-coordinate
* that is NaN will behave as if it is outside the canvas, and will not be visible.
* <li> Due to floating-point issues, an object drawn with an <em>x</em>- or
* <em>y</em>-coordinate that is way outside the canvas (such as the line segment
* from (0.5, 每∞) to (0.5, ∞) may not be visible even in the
* part of the canvas where it should be.
* </ul>
* <p>
* <b>Performance tricks.</b>
* Standard drawing is capable of drawing large amounts of data.
* Here are a few tricks and tips:
* <ul>
* <li> Use <em>double buffering</em> for static drawing with a large
* number of objects.
* That is, call {@link #enableDoubleBuffering()} before
* the sequence of drawing commands and call {@link #show()} afterwards.
* Incrementally displaying a complex drawing while it is being
* created can be intolerably inefficient on many computer systems.
* <li> When drawing computer animations, call {@code show()}
* only once per frame, not after drawing each individual object.
* <li> If you call {@code picture()} multiple times with the same filename,
* Java will cache the image, so you do not incur the cost of reading
* from a file each time.
* </ul>
* <p>
* <b>Known bugs and issues.</b>
* <ul>
* <li> The {@code picture()} methods may not draw the portion of the image that is
* inside the canvas if the center point (<em>x</em>, <em>y</em>) is outside the
* canvas.
* This bug appears only on some systems.
* <li> Some methods may not draw the portion of the geometric object that is inside the
* canvas if the <em>x</em>- or <em>y</em>-coordinates are infinite.
* This bug appears only on some systems.
* </ul>
* <p>
* <b>Reference.</b>
* For additional documentation,
* see <a href="https://introcs.cs.princeton.edu/15inout">Section 1.5</a> of
* <em>Computer Science: An Interdisciplinary Approach</em>
* by Robert Sedgewick and Kevin Wayne.
*
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public final class StdDraw implements ActionListener, MouseListener, MouseMotionListener, KeyListener {
/**
* The color black.
*/
public static final Color BLACK = Color.BLACK;
/**
* The color blue.
*/
public static final Color BLUE = Color.BLUE;
/**
* The color cyan.
*/
public static final Color CYAN = Color.CYAN;
/**
* The color dark gray.
*/
public static final Color DARK_GRAY = Color.DARK_GRAY;
/**
* The color gray.
*/
public static final Color GRAY = Color.GRAY;
/**
* The color green.
*/
public static final Color GREEN = Color.GREEN;
/**
* The color light gray.
*/
public static final Color LIGHT_GRAY = Color.LIGHT_GRAY;
/**
* The color magenta.
*/
public static final Color MAGENTA = Color.MAGENTA;
/**
* The color orange.
*/
public static final Color ORANGE = Color.ORANGE;
/**
* The color pink.
*/
public static final Color PINK = Color.PINK;
/**
* The color red.
*/
public static final Color RED = Color.RED;
/**
* The color white.
*/
public static final Color WHITE = Color.WHITE;
/**
* The color yellow.
*/
public static final Color YELLOW = Color.YELLOW;
/**
* Shade of blue used in <em>Introduction to Programming in Java</em>.
* It is Pantone 300U. The RGB values are approximately (9, 90, 166).
*/
public static final Color BOOK_BLUE = new Color(9, 90, 166);
/**
* Shade of light blue used in <em>Introduction to Programming in Java</em>.
* The RGB values are approximately (103, 198, 243).
*/
public static final Color BOOK_LIGHT_BLUE = new Color(103, 198, 243);
/**
* Shade of red used in <em>Algorithms, 4th edition</em>.
* It is Pantone 1805U. The RGB values are approximately (150, 35, 31).
*/
public static final Color BOOK_RED = new Color(150, 35, 31);
/**
* Shade of orange used in Princeton University's identity.
* It is PMS 158. The RGB values are approximately (245, 128, 37).
*/
public static final Color PRINCETON_ORANGE = new Color(245, 128, 37);
// default colors
private static final Color DEFAULT_PEN_COLOR = BLACK;
private static final Color DEFAULT_CLEAR_COLOR = WHITE;
// current pen color
private static Color penColor;
// default canvas size is DEFAULT_SIZE-by-DEFAULT_SIZE
private static final int DEFAULT_SIZE = 512;
private static int width = DEFAULT_SIZE;
private static int height = DEFAULT_SIZE;
// default pen radius
private static final double DEFAULT_PEN_RADIUS = 0.002;
// current pen radius
private static double penRadius;
// show we draw immediately or wait until next show?
private static boolean defer = false;
// boundary of drawing canvas, 0% border
// private static final double BORDER = 0.05;
private static final double BORDER = 0.00;
private static final double DEFAULT_XMIN = 0.0;
private static final double DEFAULT_XMAX = 1.0;
private static final double DEFAULT_YMIN = 0.0;
private static final double DEFAULT_YMAX = 1.0;
private static double xmin, ymin, xmax, ymax;
// for synchronization
private static Object mouseLock = new Object();
private static Object keyLock = new Object();
// default font
private static final Font DEFAULT_FONT = new Font("SansSerif", Font.PLAIN, 16);
// current font
private static Font font;
// double buffered graphics
private static BufferedImage offscreenImage, onscreenImage;
private static Graphics2D offscreen, onscreen;
// singleton for callbacks: avoids generation of extra .class files
private static StdDraw std = new StdDraw();
// the frame for drawing to the screen
private static JFrame frame;
// mouse state
private static boolean isMousePressed = false;
private static double mouseX = 0;
private static double mouseY = 0;
// queue of typed key characters
private static LinkedList<Character> keysTyped = new LinkedList<Character>();
// set of key codes currently pressed down
private static TreeSet<Integer> keysDown = new TreeSet<Integer>();
// singleton pattern: client can't instantiate
private StdDraw() { }
// static initializer
static {
init();
}
/**
* Sets the canvas (drawing area) to be 512-by-512 pixels.
* This also erases the current drawing and resets the coordinate system,
* pen radius, pen color, and font back to their default values.
* Ordinarly, this method is called once, at the very beginning
* of a program.
*/
public static void setCanvasSize() {
setCanvasSize(DEFAULT_SIZE, DEFAULT_SIZE);
}
/**
* Sets the canvas (drawing area) to be <em>width</em>-by-<em>height</em> pixels.
* This also erases the current drawing and resets the coordinate system,
* pen radius, pen color, and font back to their default values.
* Ordinarly, this method is called once, at the very beginning
* of a program.
*
* @param canvasWidth the width as a number of pixels
* @param canvasHeight the height as a number of pixels
* @throws IllegalArgumentException unless both {@code canvasWidth} and
* {@code canvasHeight} are positive
*/
public static void setCanvasSize(int canvasWidth, int canvasHeight) {
if (canvasWidth <= 0 || canvasHeight <= 0)
throw new IllegalArgumentException("width and height must be positive");
width = canvasWidth;
height = canvasHeight;
init();
}
// init
private static void init() {
if (frame != null) frame.setVisible(false);
frame = new JFrame();
offscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
onscreenImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
offscreen = offscreenImage.createGraphics();
onscreen = onscreenImage.createGraphics();
setXscale();
setYscale();
offscreen.setColor(DEFAULT_CLEAR_COLOR);
offscreen.fillRect(0, 0, width, height);
setPenColor();
setPenRadius();
setFont();
clear();
// add antialiasing
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
hints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
offscreen.addRenderingHints(hints);
// frame stuff
ImageIcon icon = new ImageIcon(onscreenImage);
JLabel draw = new JLabel(icon);
draw.addMouseListener(std);
draw.addMouseMotionListener(std);
frame.setContentPane(draw);
frame.addKeyListener(std); // JLabel cannot get keyboard focus
frame.setResizable(false);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // closes all windows
// frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // closes only current window
frame.setTitle("Standard Draw");
frame.setJMenuBar(createMenuBar());
frame.pack();
frame.requestFocusInWindow();
frame.setVisible(true);
}
// create the menu bar (changed to private)
private static JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("File");
menuBar.add(menu);
JMenuItem menuItem1 = new JMenuItem(" Save... ");
menuItem1.addActionListener(std);
menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
menu.add(menuItem1);
return menuBar;
}
/***************************************************************************
* User and screen coordinate systems.
***************************************************************************/
/**
* Sets the <em>x</em>-scale to be the default (between 0.0 and 1.0).
*/
public static void setXscale() {
setXscale(DEFAULT_XMIN, DEFAULT_XMAX);
}
/**
* Sets the <em>y</em>-scale to be the default (between 0.0 and 1.0).
*/
public static void setYscale() {
setYscale(DEFAULT_YMIN, DEFAULT_YMAX);
}
/**
* Sets the <em>x</em>-scale and <em>y</em>-scale to be the default
* (between 0.0 and 1.0).
*/
public static void setScale() {
setXscale();
setYscale();
}
/**
* Sets the <em>x</em>-scale to the specified range.
*
* @param min the minimum value of the <em>x</em>-scale
* @param max the maximum value of the <em>x</em>-scale
* @throws IllegalArgumentException if {@code (max == min)}
*/
public static void setXscale(double min, double max) {
double size = max - min;
if (size == 0.0) throw new IllegalArgumentException("the min and max are the same");
synchronized (mouseLock) {
xmin = min - BORDER * size;
xmax = max + BORDER * size;
}
}
/**
* Sets the <em>y</em>-scale to the specified range.
*
* @param min the minimum value of the <em>y</em>-scale
* @param max the maximum value of the <em>y</em>-scale
* @throws IllegalArgumentException if {@code (max == min)}
*/
public static void setYscale(double min, double max) {
double size = max - min;
if (size == 0.0) throw new IllegalArgumentException("the min and max are the same");
synchronized (mouseLock) {
ymin = min - BORDER * size;
ymax = max + BORDER * size;
}
}
/**
* Sets both the <em>x</em>-scale and <em>y</em>-scale to the (same) specified range.
*
* @param min the minimum value of the <em>x</em>- and <em>y</em>-scales
* @param max the maximum value of the <em>x</em>- and <em>y</em>-scales
* @throws IllegalArgumentException if {@code (max == min)}
*/
public static void setScale(double min, double max) {
double size = max - min;
if (size == 0.0) throw new IllegalArgumentException("the min and max are the same");
synchronized (mouseLock) {
xmin = min - BORDER * size;
xmax = max + BORDER * size;
ymin = min - BORDER * size;
ymax = max + BORDER * size;
}
}
// helper functions that scale from user coordinates to screen coordinates and back
private static double scaleX(double x) { return width * (x - xmin) / (xmax - xmin); }
private static double scaleY(double y) { return height * (ymax - y) / (ymax - ymin); }
private static double factorX(double w) { return w * width / Math.abs(xmax - xmin); }
private static double factorY(double h) { return h * height / Math.abs(ymax - ymin); }
private static double userX(double x) { return xmin + x * (xmax - xmin) / width; }
private static double userY(double y) { return ymax - y * (ymax - ymin) / height; }
/**
* Clears the screen to the default color (white).
*/
public static void clear() {
clear(DEFAULT_CLEAR_COLOR);
}
/**
* Clears the screen to the specified color.
*
* @param color the color to make the background
*/
public static void clear(Color color) {
offscreen.setColor(color);
offscreen.fillRect(0, 0, width, height);
offscreen.setColor(penColor);
draw();
}
/**
* Returns the current pen radius.
*
* @return the current value of the pen radius
*/
public static double getPenRadius() {
return penRadius;
}
/**
* Sets the pen size to the default size (0.002).
* The pen is circular, so that lines have rounded ends, and when you set the
* pen radius and draw a point, you get a circle of the specified radius.
* The pen radius is not affected by coordinate scaling.
*/
public static void setPenRadius() {
setPenRadius(DEFAULT_PEN_RADIUS);
}
/**
* Sets the radius of the pen to the specified size.
* The pen is circular, so that lines have rounded ends, and when you set the
* pen radius and draw a point, you get a circle of the specified radius.
* The pen radius is not affected by coordinate scaling.
*
* @param radius the radius of the pen
* @throws IllegalArgumentException if {@code radius} is negative
*/
public static void setPenRadius(double radius) {
if (!(radius >= 0)) throw new IllegalArgumentException("pen radius must be nonnegative");
penRadius = radius;
float scaledPenRadius = (float) (radius * DEFAULT_SIZE);
BasicStroke stroke = new BasicStroke(scaledPenRadius, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
// BasicStroke stroke = new BasicStroke(scaledPenRadius);
offscreen.setStroke(stroke);
}
/**
* Returns the current pen color.
*
* @return the current pen color
*/
public static Color getPenColor() {
return penColor;
}
/**
* Set the pen color to the default color (black).
*/
public static void setPenColor() {
setPenColor(DEFAULT_PEN_COLOR);
}
/**
* Sets the pen color to the specified color.
* <p>
* The predefined pen colors are
* {@code StdDraw.BLACK}, {@code StdDraw.BLUE}, {@code StdDraw.CYAN},
* {@code StdDraw.DARK_GRAY}, {@code StdDraw.GRAY}, {@code StdDraw.GREEN},
* {@code StdDraw.LIGHT_GRAY}, {@code StdDraw.MAGENTA}, {@code StdDraw.ORANGE},
* {@code StdDraw.PINK}, {@code StdDraw.RED}, {@code StdDraw.WHITE}, and
* {@code StdDraw.YELLOW}.
*
* @param color the color to make the pen
*/
public static void setPenColor(Color color) {
if (color == null) throw new IllegalArgumentException();
penColor = color;
offscreen.setColor(penColor);
}
/**
* Sets the pen color to the specified RGB color.
*
* @param red the amount of red (between 0 and 255)
* @param green the amount of green (between 0 and 255)
* @param blue the amount of blue (between 0 and 255)
* @throws IllegalArgumentException if {@code red}, {@code green},
* or {@code blue} is outside its prescribed range
*/
public static void setPenColor(int red, int green, int blue) {
if (red < 0 || red >= 256) throw new IllegalArgumentException("amount of red must be between 0 and 255");
if (green < 0 || green >= 256) throw new IllegalArgumentException("amount of green must be between 0 and 255");
if (blue < 0 || blue >= 256) throw new IllegalArgumentException("amount of blue must be between 0 and 255");
setPenColor(new Color(red, green, blue));
}
/**
* Returns the current font.
*
* @return the current font
*/
public static Font getFont() {
return font;
}
/**
* Sets the font to the default font (sans serif, 16 point).
*/
public static void setFont() {
setFont(DEFAULT_FONT);
}
/**
* Sets the font to the specified value.
*
* @param font the font
*/
public static void setFont(Font font) {
if (font == null) throw new IllegalArgumentException();
StdDraw.font = font;
}
/***************************************************************************
* Drawing geometric shapes.
***************************************************************************/
/**
* Draws a line segment between (<em>x</em><sub>0</sub>, <em>y</em><sub>0</sub>) and
* (<em>x</em><sub>1</sub>, <em>y</em><sub>1</sub>).
*
* @param x0 the <em>x</em>-coordinate of one endpoint
* @param y0 the <em>y</em>-coordinate of one endpoint
* @param x1 the <em>x</em>-coordinate of the other endpoint
* @param y1 the <em>y</em>-coordinate of the other endpoint
*/
public static void line(double x0, double y0, double x1, double y1) {
offscreen.draw(new Line2D.Double(scaleX(x0), scaleY(y0), scaleX(x1), scaleY(y1)));
draw();
}
/**
* Draws one pixel at (<em>x</em>, <em>y</em>).
* This method is private because pixels depend on the display.
* To achieve the same effect, set the pen radius to 0 and call {@code point()}.
*
* @param x the <em>x</em>-coordinate of the pixel
* @param y the <em>y</em>-coordinate of the pixel
*/
private static void pixel(double x, double y) {
offscreen.fillRect((int) Math.round(scaleX(x)), (int) Math.round(scaleY(y)), 1, 1);
}
/**
* Draws a point centered at (<em>x</em>, <em>y</em>).
* The point is a filled circle whose radius is equal to the pen radius.
* To draw a single-pixel point, first set the pen radius to 0.
*
* @param x the <em>x</em>-coordinate of the point
* @param y the <em>y</em>-coordinate of the point
*/
public static void point(double x, double y) {
double xs = scaleX(x);
double ys = scaleY(y);
double r = penRadius;
float scaledPenRadius = (float) (r * DEFAULT_SIZE);
// double ws = factorX(2*r);
// double hs = factorY(2*r);
// if (ws <= 1 && hs <= 1) pixel(x, y);
if (scaledPenRadius <= 1) pixel(x, y);
else offscreen.fill(new Ellipse2D.Double(xs - scaledPenRadius/2, ys - scaledPenRadius/2,
scaledPenRadius, scaledPenRadius));
draw();
}
/**
* Draws a circle of the specified radius, centered at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the center of the circle
* @param y the <em>y</em>-coordinate of the center of the circle
* @param radius the radius of the circle
* @throws IllegalArgumentException if {@code radius} is negative
*/
public static void circle(double x, double y, double radius) {
if (!(radius >= 0)) throw new IllegalArgumentException("radius must be nonnegative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*radius);
double hs = factorY(2*radius);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.draw(new Ellipse2D.Double(xs - ws/2, ys - hs/2, ws, hs));
draw();
}
/**
* Draws a filled circle of the specified radius, centered at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the center of the circle
* @param y the <em>y</em>-coordinate of the center of the circle
* @param radius the radius of the circle
* @throws IllegalArgumentException if {@code radius} is negative
*/
public static void filledCircle(double x, double y, double radius) {
if (!(radius >= 0)) throw new IllegalArgumentException("radius must be nonnegative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*radius);
double hs = factorY(2*radius);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.fill(new Ellipse2D.Double(xs - ws/2, ys - hs/2, ws, hs));
draw();
}
/**
* Draws an ellipse with the specified semimajor and semiminor axes,
* centered at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the center of the ellipse
* @param y the <em>y</em>-coordinate of the center of the ellipse
* @param semiMajorAxis is the semimajor axis of the ellipse
* @param semiMinorAxis is the semiminor axis of the ellipse
* @throws IllegalArgumentException if either {@code semiMajorAxis}
* or {@code semiMinorAxis} is negative
*/
public static void ellipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (!(semiMajorAxis >= 0)) throw new IllegalArgumentException("ellipse semimajor axis must be nonnegative");
if (!(semiMinorAxis >= 0)) throw new IllegalArgumentException("ellipse semiminor axis must be nonnegative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*semiMajorAxis);
double hs = factorY(2*semiMinorAxis);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.draw(new Ellipse2D.Double(xs - ws/2, ys - hs/2, ws, hs));
draw();
}
/**
* Draws an ellipse with the specified semimajor and semiminor axes,
* centered at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the center of the ellipse
* @param y the <em>y</em>-coordinate of the center of the ellipse
* @param semiMajorAxis is the semimajor axis of the ellipse
* @param semiMinorAxis is the semiminor axis of the ellipse
* @throws IllegalArgumentException if either {@code semiMajorAxis}
* or {@code semiMinorAxis} is negative
*/
public static void filledEllipse(double x, double y, double semiMajorAxis, double semiMinorAxis) {
if (!(semiMajorAxis >= 0)) throw new IllegalArgumentException("ellipse semimajor axis must be nonnegative");
if (!(semiMinorAxis >= 0)) throw new IllegalArgumentException("ellipse semiminor axis must be nonnegative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*semiMajorAxis);
double hs = factorY(2*semiMinorAxis);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.fill(new Ellipse2D.Double(xs - ws/2, ys - hs/2, ws, hs));
draw();
}
/**
* Draws a circular arc of the specified radius,
* centered at (<em>x</em>, <em>y</em>), from angle1 to angle2 (in degrees).
*
* @param x the <em>x</em>-coordinate of the center of the circle
* @param y the <em>y</em>-coordinate of the center of the circle
* @param radius the radius of the circle
* @param angle1 the starting angle. 0 would mean an arc beginning at 3 o'clock.
* @param angle2 the angle at the end of the arc. For example, if
* you want a 90 degree arc, then angle2 should be angle1 + 90.
* @throws IllegalArgumentException if {@code radius} is negative
*/
public static void arc(double x, double y, double radius, double angle1, double angle2) {
if (radius < 0) throw new IllegalArgumentException("arc radius must be nonnegative");
while (angle2 < angle1) angle2 += 360;
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*radius);
double hs = factorY(2*radius);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.draw(new Arc2D.Double(xs - ws/2, ys - hs/2, ws, hs, angle1, angle2 - angle1, Arc2D.OPEN));
draw();
}
/**
* Draws a square of side length 2r, centered at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the center of the square
* @param y the <em>y</em>-coordinate of the center of the square
* @param halfLength one half the length of any side of the square
* @throws IllegalArgumentException if {@code halfLength} is negative
*/
public static void square(double x, double y, double halfLength) {
if (!(halfLength >= 0)) throw new IllegalArgumentException("half length must be nonnegative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*halfLength);
double hs = factorY(2*halfLength);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.draw(new Rectangle2D.Double(xs - ws/2, ys - hs/2, ws, hs));
draw();
}
/**
* Draws a filled square of the specified size, centered at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the center of the square
* @param y the <em>y</em>-coordinate of the center of the square
* @param halfLength one half the length of any side of the square
* @throws IllegalArgumentException if {@code halfLength} is negative
*/
public static void filledSquare(double x, double y, double halfLength) {
if (!(halfLength >= 0)) throw new IllegalArgumentException("half length must be nonnegative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*halfLength);
double hs = factorY(2*halfLength);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.fill(new Rectangle2D.Double(xs - ws/2, ys - hs/2, ws, hs));
draw();
}
/**
* Draws a rectangle of the specified size, centered at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the center of the rectangle
* @param y the <em>y</em>-coordinate of the center of the rectangle
* @param halfWidth one half the width of the rectangle
* @param halfHeight one half the height of the rectangle
* @throws IllegalArgumentException if either {@code halfWidth} or {@code halfHeight} is negative
*/
public static void rectangle(double x, double y, double halfWidth, double halfHeight) {
if (!(halfWidth >= 0)) throw new IllegalArgumentException("half width must be nonnegative");
if (!(halfHeight >= 0)) throw new IllegalArgumentException("half height must be nonnegative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*halfWidth);
double hs = factorY(2*halfHeight);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.draw(new Rectangle2D.Double(xs - ws/2, ys - hs/2, ws, hs));
draw();
}
/**
* Draws a filled rectangle of the specified size, centered at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the center of the rectangle
* @param y the <em>y</em>-coordinate of the center of the rectangle
* @param halfWidth one half the width of the rectangle
* @param halfHeight one half the height of the rectangle
* @throws IllegalArgumentException if either {@code halfWidth} or {@code halfHeight} is negative
*/
public static void filledRectangle(double x, double y, double halfWidth, double halfHeight) {
if (!(halfWidth >= 0)) throw new IllegalArgumentException("half width must be nonnegative");
if (!(halfHeight >= 0)) throw new IllegalArgumentException("half height must be nonnegative");
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(2*halfWidth);
double hs = factorY(2*halfHeight);
if (ws <= 1 && hs <= 1) pixel(x, y);
else offscreen.fill(new Rectangle2D.Double(xs - ws/2, ys - hs/2, ws, hs));
draw();
}
/**
* Draws a polygon with the vertices
* (<em>x</em><sub>0</sub>, <em>y</em><sub>0</sub>),
* (<em>x</em><sub>1</sub>, <em>y</em><sub>1</sub>), ...,
* (<em>x</em><sub><em>n</em>每1</sub>, <em>y</em><sub><em>n</em>每1</sub>).
*
* @param x an array of all the <em>x</em>-coordinates of the polygon
* @param y an array of all the <em>y</em>-coordinates of the polygon
* @throws IllegalArgumentException unless {@code x[]} and {@code y[]}
* are of the same length
*/
public static void polygon(double[] x, double[] y) {
if (x == null) throw new IllegalArgumentException("x-coordinate array is null");
if (y == null) throw new IllegalArgumentException("y-coordinate array is null");
int n1 = x.length;
int n2 = y.length;
if (n1 != n2) throw new IllegalArgumentException("arrays must be of the same length");
int n = n1;
if (n == 0) return;
GeneralPath path = new GeneralPath();
path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0]));
for (int i = 0; i < n; i++)
path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i]));
path.closePath();
offscreen.draw(path);
draw();
}
/**
* Draws a polygon with the vertices
* (<em>x</em><sub>0</sub>, <em>y</em><sub>0</sub>),
* (<em>x</em><sub>1</sub>, <em>y</em><sub>1</sub>), ...,
* (<em>x</em><sub><em>n</em>每1</sub>, <em>y</em><sub><em>n</em>每1</sub>).
*
* @param x an array of all the <em>x</em>-coordinates of the polygon
* @param y an array of all the <em>y</em>-coordinates of the polygon
* @throws IllegalArgumentException unless {@code x[]} and {@code y[]}
* are of the same length
*/
public static void filledPolygon(double[] x, double[] y) {
if (x == null) throw new IllegalArgumentException("x-coordinate array is null");
if (y == null) throw new IllegalArgumentException("y-coordinate array is null");
int n1 = x.length;
int n2 = y.length;
if (n1 != n2) throw new IllegalArgumentException("arrays must be of the same length");
int n = n1;
if (n == 0) return;
GeneralPath path = new GeneralPath();
path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0]));
for (int i = 0; i < n; i++)
path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i]));
path.closePath();
offscreen.fill(path);
draw();
}
/***************************************************************************
* Drawing images.
***************************************************************************/
// get an image from the given filename
private static Image getImage(String filename) {
if (filename == null) throw new IllegalArgumentException();
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
icon = new ImageIcon(url);
}
catch (MalformedURLException e) {
/* not a url */
}
}
// in case file is inside a .jar (classpath relative to StdDraw)
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
URL url = StdDraw.class.getResource(filename);
if (url != null)
icon = new ImageIcon(url);
}
// in case file is inside a .jar (classpath relative to root of jar)
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
URL url = StdDraw.class.getResource("/" + filename);
if (url == null) throw new IllegalArgumentException("image " + filename + " not found");
icon = new ImageIcon(url);
}
return icon.getImage();
}
/***************************************************************************
* [Summer 2016] Should we update to use ImageIO instead of ImageIcon()?
* Seems to have some issues loading images on some systems
* and slows things down on other systems.
* especially if you don't call ImageIO.setUseCache(false)
* One advantage is that it returns a BufferedImage.
***************************************************************************/
/*
private static BufferedImage getImage(String filename) {
if (filename == null) throw new IllegalArgumentException();
// from a file or URL
try {
URL url = new URL(filename);
BufferedImage image = ImageIO.read(url);
return image;
}
catch (IOException e) {
// ignore
}
// in case file is inside a .jar (classpath relative to StdDraw)
try {
URL url = StdDraw.class.getResource(filename);
BufferedImage image = ImageIO.read(url);
return image;
}
catch (IOException e) {
// ignore
}
// in case file is inside a .jar (classpath relative to root of jar)
try {
URL url = StdDraw.class.getResource("/" + filename);
BufferedImage image = ImageIO.read(url);
return image;
}
catch (IOException e) {
// ignore
}
throw new IllegalArgumentException("image " + filename + " not found");
}
*/
/**
* Draws the specified image centered at (<em>x</em>, <em>y</em>).
* The supported image formats are JPEG, PNG, and GIF.
* As an optimization, the picture is cached, so there is no performance
* penalty for redrawing the same image multiple times (e.g., in an animation).
* However, if you change the picture file after drawing it, subsequent
* calls will draw the original picture.
*
* @param x the center <em>x</em>-coordinate of the image
* @param y the center <em>y</em>-coordinate of the image
* @param filename the name of the image/picture, e.g., "ball.gif"
* @throws IllegalArgumentException if the image filename is invalid
*/
public static void picture(double x, double y, String filename) {
// BufferedImage image = getImage(filename);
Image image = getImage(filename);
double xs = scaleX(x);
double ys = scaleY(y);
// int ws = image.getWidth(); // can call only if image is a BufferedImage
// int hs = image.getHeight();
int ws = image.getWidth(null);
int hs = image.getHeight(null);
if (ws < 0 || hs < 0) throw new IllegalArgumentException("image " + filename + " is corrupt");
offscreen.drawImage(image, (int) Math.round(xs - ws/2.0), (int) Math.round(ys - hs/2.0), null);
draw();
}
/**
* Draws the specified image centered at (<em>x</em>, <em>y</em>),
* rotated given number of degrees.
* The supported image formats are JPEG, PNG, and GIF.
*
* @param x the center <em>x</em>-coordinate of the image
* @param y the center <em>y</em>-coordinate of the image
* @param filename the name of the image/picture, e.g., "ball.gif"
* @param degrees is the number of degrees to rotate counterclockwise
* @throws IllegalArgumentException if the image filename is invalid
*/
public static void picture(double x, double y, String filename, double degrees) {
// BufferedImage image = getImage(filename);
Image image = getImage(filename);
double xs = scaleX(x);
double ys = scaleY(y);
// int ws = image.getWidth(); // can call only if image is a BufferedImage
// int hs = image.getHeight();
int ws = image.getWidth(null);
int hs = image.getHeight(null);
if (ws < 0 || hs < 0) throw new IllegalArgumentException("image " + filename + " is corrupt");
offscreen.rotate(Math.toRadians(-degrees), xs, ys);
offscreen.drawImage(image, (int) Math.round(xs - ws/2.0), (int) Math.round(ys - hs/2.0), null);
offscreen.rotate(Math.toRadians(+degrees), xs, ys);
draw();
}
/**
* Draws the specified image centered at (<em>x</em>, <em>y</em>),
* rescaled to the specified bounding box.
* The supported image formats are JPEG, PNG, and GIF.
*
* @param x the center <em>x</em>-coordinate of the image
* @param y the center <em>y</em>-coordinate of the image
* @param filename the name of the image/picture, e.g., "ball.gif"
* @param scaledWidth the width of the scaled image (in screen coordinates)
* @param scaledHeight the height of the scaled image (in screen coordinates)
* @throws IllegalArgumentException if either {@code scaledWidth}
* or {@code scaledHeight} is negative
* @throws IllegalArgumentException if the image filename is invalid
*/
public static void picture(double x, double y, String filename, double scaledWidth, double scaledHeight) {
Image image = getImage(filename);
if (scaledWidth < 0) throw new IllegalArgumentException("width is negative: " + scaledWidth);
if (scaledHeight < 0) throw new IllegalArgumentException("height is negative: " + scaledHeight);
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(scaledWidth);
double hs = factorY(scaledHeight);
if (ws < 0 || hs < 0) throw new IllegalArgumentException("image " + filename + " is corrupt");
if (ws <= 1 && hs <= 1) pixel(x, y);
else {
offscreen.drawImage(image, (int) Math.round(xs - ws/2.0),
(int) Math.round(ys - hs/2.0),
(int) Math.round(ws),
(int) Math.round(hs), null);
}
draw();
}
/**
* Draws the specified image centered at (<em>x</em>, <em>y</em>), rotated
* given number of degrees, and rescaled to the specified bounding box.
* The supported image formats are JPEG, PNG, and GIF.
*
* @param x the center <em>x</em>-coordinate of the image
* @param y the center <em>y</em>-coordinate of the image
* @param filename the name of the image/picture, e.g., "ball.gif"
* @param scaledWidth the width of the scaled image (in screen coordinates)
* @param scaledHeight the height of the scaled image (in screen coordinates)
* @param degrees is the number of degrees to rotate counterclockwise
* @throws IllegalArgumentException if either {@code scaledWidth}
* or {@code scaledHeight} is negative
* @throws IllegalArgumentException if the image filename is invalid
*/
public static void picture(double x, double y, String filename, double scaledWidth, double scaledHeight, double degrees) {
if (scaledWidth < 0) throw new IllegalArgumentException("width is negative: " + scaledWidth);
if (scaledHeight < 0) throw new IllegalArgumentException("height is negative: " + scaledHeight);
Image image = getImage(filename);
double xs = scaleX(x);
double ys = scaleY(y);
double ws = factorX(scaledWidth);
double hs = factorY(scaledHeight);
if (ws < 0 || hs < 0) throw new IllegalArgumentException("image " + filename + " is corrupt");
if (ws <= 1 && hs <= 1) pixel(x, y);
offscreen.rotate(Math.toRadians(-degrees), xs, ys);
offscreen.drawImage(image, (int) Math.round(xs - ws/2.0),
(int) Math.round(ys - hs/2.0),
(int) Math.round(ws),
(int) Math.round(hs), null);
offscreen.rotate(Math.toRadians(+degrees), xs, ys);
draw();
}
/***************************************************************************
* Drawing text.
***************************************************************************/
/**
* Write the given text string in the current font, centered at (<em>x</em>, <em>y</em>).
*
* @param x the center <em>x</em>-coordinate of the text
* @param y the center <em>y</em>-coordinate of the text
* @param text the text to write
*/
public static void text(double x, double y, String text) {
if (text == null) throw new IllegalArgumentException();
offscreen.setFont(font);
FontMetrics metrics = offscreen.getFontMetrics();
double xs = scaleX(x);
double ys = scaleY(y);
int ws = metrics.stringWidth(text);
int hs = metrics.getDescent();
offscreen.drawString(text, (float) (xs - ws/2.0), (float) (ys + hs));
draw();
}
/**
* Write the given text string in the current font, centered at (<em>x</em>, <em>y</em>) and
* rotated by the specified number of degrees.
* @param x the center <em>x</em>-coordinate of the text
* @param y the center <em>y</em>-coordinate of the text
* @param text the text to write
* @param degrees is the number of degrees to rotate counterclockwise
*/
public static void text(double x, double y, String text, double degrees) {
if (text == null) throw new IllegalArgumentException();
double xs = scaleX(x);
double ys = scaleY(y);
offscreen.rotate(Math.toRadians(-degrees), xs, ys);
text(x, y, text);
offscreen.rotate(Math.toRadians(+degrees), xs, ys);
}
/**
* Write the given text string in the current font, left-aligned at (<em>x</em>, <em>y</em>).
* @param x the <em>x</em>-coordinate of the text
* @param y the <em>y</em>-coordinate of the text
* @param text the text
*/
public static void textLeft(double x, double y, String text) {
if (text == null) throw new IllegalArgumentException();
offscreen.setFont(font);
FontMetrics metrics = offscreen.getFontMetrics();
double xs = scaleX(x);
double ys = scaleY(y);
int hs = metrics.getDescent();
offscreen.drawString(text, (float) xs, (float) (ys + hs));
draw();
}
/**
* Write the given text string in the current font, right-aligned at (<em>x</em>, <em>y</em>).
*
* @param x the <em>x</em>-coordinate of the text
* @param y the <em>y</em>-coordinate of the text
* @param text the text to write
*/
public static void textRight(double x, double y, String text) {
if (text == null) throw new IllegalArgumentException();
offscreen.setFont(font);
FontMetrics metrics = offscreen.getFontMetrics();
double xs = scaleX(x);
double ys = scaleY(y);
int ws = metrics.stringWidth(text);
int hs = metrics.getDescent();
offscreen.drawString(text, (float) (xs - ws), (float) (ys + hs));
draw();
}
/**
* Copies the offscreen buffer to the onscreen buffer, pauses for t milliseconds
* and enables double buffering.
* @param t number of milliseconds
* @deprecated replaced by {@link #enableDoubleBuffering()}, {@link #show()}, and {@link #pause(int t)}
*/
@Deprecated
public static void show(int t) {
show();
pause(t);
enableDoubleBuffering();
}
/**
* Pause for t milliseconds. This method is intended to support computer animations.
* @param t number of milliseconds
*/
public static void pause(int t) {
try {
Thread.sleep(t);
}
catch (InterruptedException e) {
System.out.println("Error sleeping");
}
}
/**
* Copies offscreen buffer to onscreen buffer. There is no reason to call
* this method unless double buffering is enabled.
*/
public static void show() {
onscreen.drawImage(offscreenImage, 0, 0, null);
frame.repaint();
}
// draw onscreen if defer is false
private static void draw() {
if (!defer) show();
}
/**
* Enable double buffering. All subsequent calls to
* drawing methods such as {@code line()}, {@code circle()},
* and {@code square()} will be deffered until the next call
* to show(). Useful for animations.
*/
public static void enableDoubleBuffering() {
defer = true;
}
/**
* Disable double buffering. All subsequent calls to
* drawing methods such as {@code line()}, {@code circle()},
* and {@code square()} will be displayed on screen when called.
* This is the default.
*/
public static void disableDoubleBuffering() {
defer = false;
}
/***************************************************************************
* Save drawing to a file.
***************************************************************************/
/**
* Saves the drawing to using the specified filename.
* The supported image formats are JPEG and PNG;
* the filename suffix must be {@code .jpg} or {@code .png}.
*
* @param filename the name of the file with one of the required suffixes
*/
public static void save(String filename) {
if (filename == null) throw new IllegalArgumentException();
File file = new File(filename);
String suffix = filename.substring(filename.lastIndexOf('.') + 1);
// png files
if ("png".equalsIgnoreCase(suffix)) {
try {
ImageIO.write(onscreenImage, suffix, file);
}
catch (IOException e) {
e.printStackTrace();
}
}
// need to change from ARGB to RGB for JPEG
// reference: http://archives.java.sun.com/cgi-bin/wa?A2=ind0404&L=java2d-interest&D=0&P=2727
else if ("jpg".equalsIgnoreCase(suffix)) {
WritableRaster raster = onscreenImage.getRaster();
WritableRaster newRaster;
newRaster = raster.createWritableChild(0, 0, width, height, 0, 0, new int[] {0, 1, 2});
DirectColorModel cm = (DirectColorModel) onscreenImage.getColorModel();
DirectColorModel newCM = new DirectColorModel(cm.getPixelSize(),
cm.getRedMask(),
cm.getGreenMask(),
cm.getBlueMask());
BufferedImage rgbBuffer = new BufferedImage(newCM, newRaster, false, null);
try {
ImageIO.write(rgbBuffer, suffix, file);
}
catch (IOException e) {
e.printStackTrace();
}
}
else {
System.out.println("Invalid image file type: " + suffix);
}
}
/**
* This method cannot be called directly.
*/
@Override
public void actionPerformed(ActionEvent e) {
FileDialog chooser = new FileDialog(StdDraw.frame, "Use a .png or .jpg extension", FileDialog.SAVE);
chooser.setVisible(true);
String filename = chooser.getFile();
if (filename != null) {
StdDraw.save(chooser.getDirectory() + File.separator + chooser.getFile());
}
}
/***************************************************************************
* Mouse interactions.
***************************************************************************/
/**
* Returns true if the mouse is being pressed.
*
* @return {@code true} if the mouse is being pressed; {@code false} otherwise
*/
public static boolean isMousePressed() {
synchronized (mouseLock) {
return isMousePressed;
}
}
/**
* Returns true if the mouse is being pressed.
*
* @return {@code true} if the mouse is being pressed; {@code false} otherwise
* @deprecated replaced by {@link #isMousePressed()}
*/
@Deprecated
public static boolean mousePressed() {
synchronized (mouseLock) {
return isMousePressed;
}
}
/**
* Returns the <em>x</em>-coordinate of the mouse.
*
* @return the <em>x</em>-coordinate of the mouse
*/
public static double mouseX() {
synchronized (mouseLock) {
return mouseX;
}
}
/**
* Returns the <em>y</em>-coordinate of the mouse.
*
* @return <em>y</em>-coordinate of the mouse
*/
public static double mouseY() {
synchronized (mouseLock) {
return mouseY;
}
}
/**
* This method cannot be called directly.
*/
@Override
public void mouseClicked(MouseEvent e) {
// this body is intentionally left empty
}
/**
* This method cannot be called directly.
*/
@Override
public void mouseEntered(MouseEvent e) {
// this body is intentionally left empty
}
/**
* This method cannot be called directly.
*/
@Override
public void mouseExited(MouseEvent e) {
// this body is intentionally left empty
}
/**
* This method cannot be called directly.
*/
@Override
public void mousePressed(MouseEvent e) {
synchronized (mouseLock) {
mouseX = StdDraw.userX(e.getX());
mouseY = StdDraw.userY(e.getY());
isMousePressed = true;
}
}
/**
* This method cannot be called directly.
*/
@Override
public void mouseReleased(MouseEvent e) {
synchronized (mouseLock) {
isMousePressed = false;
}
}
/**
* This method cannot be called directly.
*/
@Override
public void mouseDragged(MouseEvent e) {
synchronized (mouseLock) {
mouseX = StdDraw.userX(e.getX());
mouseY = StdDraw.userY(e.getY());
}
}
/**
* This method cannot be called directly.
*/
@Override
public void mouseMoved(MouseEvent e) {
synchronized (mouseLock) {
mouseX = StdDraw.userX(e.getX());
mouseY = StdDraw.userY(e.getY());
}
}
/***************************************************************************
* Keyboard interactions.
***************************************************************************/
/**
* Returns true if the user has typed a key (that has not yet been processed).
*
* @return {@code true} if the user has typed a key (that has not yet been processed
* by {@link #nextKeyTyped()}; {@code false} otherwise
*/
public static boolean hasNextKeyTyped() {
synchronized (keyLock) {
return !keysTyped.isEmpty();
}
}
/**
* Returns the next key that was typed by the user (that your program has not already processed).
* This method should be preceded by a call to {@link #hasNextKeyTyped()} to ensure
* that there is a next key to process.
* This method returns a Unicode character corresponding to the key
* typed (such as {@code 'a'} or {@code 'A'}).
* It cannot identify action keys (such as F1 and arrow keys)
* or modifier keys (such as control).
*
* @return the next key typed by the user (that your program has not already processed).
* @throws NoSuchElementException if there is no remaining key
*/
public static char nextKeyTyped() {
synchronized (keyLock) {
if (keysTyped.isEmpty()) {
throw new NoSuchElementException("your program has already processed all keystrokes");
}
return keysTyped.remove(keysTyped.size() - 1);
// return keysTyped.removeLast();
}
}
/**
* Returns true if the given key is being pressed.
* <p>
* This method takes the keycode (corresponding to a physical key)
* as an argument. It can handle action keys
* (such as F1 and arrow keys) and modifier keys (such as shift and control).
* See {@link KeyEvent} for a description of key codes.
*
* @param keycode the key to check if it is being pressed
* @return {@code true} if {@code keycode} is currently being pressed;
* {@code false} otherwise
*/
public static boolean isKeyPressed(int keycode) {
synchronized (keyLock) {
return keysDown.contains(keycode);
}
}
/**
* This method cannot be called directly.
*/
@Override
public void keyTyped(KeyEvent e) {
synchronized (keyLock) {
keysTyped.addFirst(e.getKeyChar());
}
}
/**
* This method cannot be called directly.
*/
@Override
public void keyPressed(KeyEvent e) {
synchronized (keyLock) {
keysDown.add(e.getKeyCode());
}
}
/**
* This method cannot be called directly.
*/
@Override
public void keyReleased(KeyEvent e) {
synchronized (keyLock) {
keysDown.remove(e.getKeyCode());
}
}
/**
* Test client.
*
* @param args the command-line arguments
*/
public static void main(String[] args) {
StdDraw.square(0.2, 0.8, 0.1);
StdDraw.filledSquare(0.8, 0.8, 0.2);
StdDraw.circle(0.8, 0.2, 0.2);
StdDraw.setPenColor(StdDraw.BOOK_RED);
StdDraw.setPenRadius(0.02);
StdDraw.arc(0.8, 0.2, 0.1, 200, 45);
// draw a blue diamond
StdDraw.setPenRadius();
StdDraw.setPenColor(StdDraw.BOOK_BLUE);
double[] x = { 0.1, 0.2, 0.3, 0.2 };
double[] y = { 0.2, 0.3, 0.2, 0.1 };
StdDraw.filledPolygon(x, y);
// text
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.text(0.2, 0.5, "black text");
StdDraw.setPenColor(StdDraw.WHITE);
StdDraw.text(0.8, 0.8, "white text");
}
}
| [
"zhangyiqi55732@sina.com"
] | zhangyiqi55732@sina.com |
72202328f80f4306303ed34d6627882191208e3e | 1d68c9ea4f7297e8fc7cfee984c634ff66a718d6 | /hospital/src/main/java/com/hampcode/business/impl/MedicalConsultationBusiness.java | dc373370502038f6dd8b2136fa1416f08e67daf2 | [] | no_license | VictorFernadez/Clase-03 | a08df55c97e1a29b42fdb32ad008df398c48be96 | 99ef3981cfa172425fb62b844b554403c9895847 | refs/heads/master | 2020-07-30T01:05:50.571305 | 2019-09-21T17:39:01 | 2019-09-21T17:39:01 | 210,029,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | package com.hampcode.business.impl;
import java.io.Serializable;
import java.util.List;
import java.util.Optional;
import javax.inject.Named;
import com.hampcode.business.IMedicalConsultationBusiness;
import com.hampcode.dto.MedicalConsultationExamsDto;
import com.hampcode.model.entity.MedicalConsultation;
@Named
public class MedicalConsultationBusiness implements IMedicalConsultationBusiness, Serializable {
private static final long serialVersionUID = 1L;
@Override
public Long insert(MedicalConsultation entity) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public Long update(MedicalConsultation entity) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public List<MedicalConsultation> getAll() throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public Optional<MedicalConsultation> getOne(MedicalConsultation entity) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public MedicalConsultation saveMedicalConsultation(MedicalConsultationExamsDto mcDto) {
// TODO Auto-generated method stub
return null;
}
}
| [
"hmendo81@gmail.com"
] | hmendo81@gmail.com |
923cb6ff101e729adf8d1a7682ba7ad3be820ff3 | a9829af0ea35da14b61b83615d157a3a7e879284 | /practice/src/day3/exam13.java | 691c06744c59ff732552591efaefda9f9565afb0 | [] | no_license | Hyunkee/JAVA-DB | c257e6915676fd0bd5147fb46bceb5e062bb8c85 | d17b8857cb7146d23dec884b3080f7321437cb7a | refs/heads/master | 2022-12-22T05:31:10.034709 | 2019-09-26T07:18:07 | 2019-09-26T07:18:07 | 178,324,388 | 0 | 0 | null | 2022-12-16T00:57:23 | 2019-03-29T03:17:58 | JavaScript | UTF-8 | Java | false | false | 709 | java | package day3;
public class exam13 {
public static void main(String[] args) {
// *
// ***
// *****
// *******
// *********
// ***********
// *********
// *******
// *****
// ***
// * 모양으로 만들기
int i, num;
for(i=1;i<=6;i++){
for(num=5;num>=i;num--){
System.out.print(" ");
}
for(num=1;num<=(i+i)-1;num++){ //2*i-1
System.out.print("*");
}
System.out.println();
}
for(i=1;i<=6;i++){
for(num=1;num<=i;num++){
System.out.print(" ");
}
for(num=9;num>=(i+i)-1;num--){
System.out.print("*");
}
System.out.println();
}
}
}
| [
"khk2909@daum.net"
] | khk2909@daum.net |
db0f45a61de21ac0f5baf16aa315011e9fbc85ae | 87d8668b8a1aa2ed3c26ab53dc7502724953d2d1 | /Examples/src/Order.java | 86bcfe1768e9f63d1c5a2c93807beb20c9ec30c6 | [] | no_license | Rameshgoneppanavar/Workspace | 16a1fe8a9baaad7ca856c26abdaeb4d4f0dcee4e | dac84dd807a9feb3af279614a8b70805dc9066a8 | refs/heads/master | 2020-04-07T15:56:16.827910 | 2019-11-04T11:50:24 | 2019-11-04T11:50:24 | 158,508,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java |
class A {
A() {
System.out.println("Class-A : Costrcutor");
}
static {
System.out.println("Class-A : Static Block");
}
{
System.out.println("Class-A : Instance Block");
}
}
public class Order extends A {
Order() {
System.out.println("Order : Costrcutor");
}
static {
System.out.println("Order : Static Block");
}
{
System.out.println("Order : Instance Block");
}
public static void main(String[] args) {
A ob = new A(); //only A Class
System.out.println("A========Completed");
Order o1 = new Order(); //Order class Contains A Class DataMembers
System.out.println("Order1 =========== Completed");
Order o2 = new Order(); //Order class Contains A Class DataMembers
System.out.println("Order2 =========== Completed");
}
} | [
"Ramesh@example.com"
] | Ramesh@example.com |
6767474168885f6c4ac05cc77c3504a08bfe4a20 | 8637c1d88e339dbdd16059e778676f253f48f57c | /src/main/java/com/github/elizabetht/model/StudentLogin.java | d4fe8c511d8a4fd76b662c703866c31c6605e038 | [] | no_license | anjulaw/Spring_Maven_Example | 8591599fc4972ce0c6a2aa4bee288434f35596b5 | a850d01c21806e465ff7ae5b28bd07c014b6d6a5 | refs/heads/master | 2020-12-25T13:33:26.097216 | 2016-07-05T12:23:31 | 2016-07-05T12:23:31 | 62,634,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package com.github.elizabetht.model;
import org.hibernate.validator.constraints.NotEmpty;
import javax.persistence.Column;
import javax.validation.constraints.Size;
/**
* Created by anjulaw on 7/5/2016.
*/
public class StudentLogin {
@NotEmpty
@Size(min=4, max=20)
private String userName;
@NotEmpty
@Size(min=4, max=8)
@Column(name = "LKK")
private String password;
public String getPassword() {
return password;
}
public String getUserName() {
return userName;
}
public void setPassword(String password) {
this.password = password;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
| [
"waaanjula@gmail.com"
] | waaanjula@gmail.com |
05956ba0ce7b338ebde5ef313d36647961c38402 | 6dee4fea074d2b9f066572e84b4fee6ceef6814e | /src/main/java/br/com/rafaelmattos/StarWarsAPI/config/SwaggerConfig.java | 501a287f61e18b44c07d916b13170284b0fb2d04 | [] | no_license | rafaelmattosrj/Simulado | 44676a7e024e3a8424460965d7d6bfb88d82c900 | c6c05bf6ebe70135fa41def73df66e8f71489838 | refs/heads/master | 2023-08-23T19:38:08.787631 | 2021-09-03T23:54:12 | 2021-09-03T23:54:12 | 401,383,347 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,988 | java | package br.com.rafaelmattos.StarWarsAPI.config;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMethod;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.builders.ResponseMessageBuilder;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.Header;
import springfox.documentation.service.ResponseMessage;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
private final ResponseMessage m201 = customMessage1();
private final ResponseMessage m204put = simpleMessage(204, "Update ok");
private final ResponseMessage m204del = simpleMessage(204, "Deletion ok");
private final ResponseMessage m403 = simpleMessage(403, "Not authorized");
private final ResponseMessage m404 = simpleMessage(404, "Not found");
private final ResponseMessage m422 = simpleMessage(422, "Validation error");
private final ResponseMessage m500 = simpleMessage(500, "Unexpected error");
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.useDefaultResponseMessages(false)
.globalResponseMessage(RequestMethod.GET, Arrays.asList(m403, m404, m500))
.globalResponseMessage(RequestMethod.POST, Arrays.asList(m201, m403, m422, m500))
.globalResponseMessage(RequestMethod.PUT, Arrays.asList(m204put, m403, m404, m422, m500))
.globalResponseMessage(RequestMethod.DELETE, Arrays.asList(m204del, m403, m404, m500))
.select()
.apis(RequestHandlerSelectors
.basePackage("br.com.rafaelmattos.StarWarsAPI.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfo("Star Wars Planets API",
"Project related to starwars.",
"version 1.0.0",
"",
new Contact("Rafael Mattos",
"https://www.linkedin.com/in/rafael-mattos-moreira-414948197",
"rafaelrj@live.com"),
"Restricted use for B2W.",
"",
Collections.emptyList()
);
}
private ResponseMessage simpleMessage(int code, String msg) {
return new ResponseMessageBuilder().code(code).message(msg).build();
}
private ResponseMessage customMessage1() {
Map<String, Header> map = new HashMap<>();
map.put("location", new Header("location", "New resource URI", new ModelRef("string")));
return new ResponseMessageBuilder()
.code(201)
.message("Resource created.")
.headersWithDescription(map)
.build();
}
}
| [
"rafaelrj@live.com"
] | rafaelrj@live.com |
67383a67f50c220507dc63fc84ef09240d272e58 | 2094d5c387f1f4a4bd4627fbe922eb84f77474f8 | /src/java/edu/asknsoluciones/entity/Cliente.java | a76f5e01376649f75457c6a371c6ac175b47941a | [] | no_license | BolkinBermudez/askn | e14eee37fdafcdcd94546e4889deb7e1155cf9b3 | 035717b72ca40b7d78d0d956274dda22a9bf42c9 | refs/heads/master | 2023-01-29T14:19:01.920397 | 2020-12-09T00:33:12 | 2020-12-09T00:33:12 | 317,397,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,033 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.asknsoluciones.entity;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author Bolkin B
*/
@Entity
@Table(name = "cliente", catalog = "asknsoluciones2020", schema = "")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c")})
public class Cliente implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "idCliente")
private Integer idCliente;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "nombres")
private String nombres;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 45)
@Column(name = "apellidos")
private String apellidos;
@Basic(optional = false)
@NotNull
@Column(name = "numDocumento")
private long numDocumento;
@Size(max = 45)
@Column(name = "correo")
private String correo;
@Basic(optional = false)
@NotNull
@Size(min = 1, max = 40)
@Column(name = "direccion")
private String direccion;
@Basic(optional = false)
@NotNull
@Column(name = "telefono")
private long telefono;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idCliente", fetch = FetchType.LAZY)
private Collection<Venta> ventaCollection;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idCliente", fetch = FetchType.LAZY)
private Collection<Ordenservisio> ordenservisioCollection;
@JoinColumn(name = "idTipoDoc", referencedColumnName = "idTipoDoc")
@ManyToOne(optional = false, fetch = FetchType.LAZY)
private Tipodocumento idTipoDoc;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "idCliente", fetch = FetchType.LAZY)
private Collection<Cotizacion> cotizacionCollection;
public Cliente() {
}
public Cliente(Integer idCliente) {
this.idCliente = idCliente;
}
public Cliente(Integer idCliente, String nombres, String apellidos, long numDocumento, String direccion, long telefono) {
this.idCliente = idCliente;
this.nombres = nombres;
this.apellidos = apellidos;
this.numDocumento = numDocumento;
this.direccion = direccion;
this.telefono = telefono;
}
public Integer getIdCliente() {
return idCliente;
}
public void setIdCliente(Integer idCliente) {
this.idCliente = idCliente;
}
public String getNombres() {
return nombres;
}
public void setNombres(String nombres) {
this.nombres = nombres;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public long getNumDocumento() {
return numDocumento;
}
public void setNumDocumento(long numDocumento) {
this.numDocumento = numDocumento;
}
public String getCorreo() {
return correo;
}
public void setCorreo(String correo) {
this.correo = correo;
}
public String getDireccion() {
return direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
public long getTelefono() {
return telefono;
}
public void setTelefono(long telefono) {
this.telefono = telefono;
}
@XmlTransient
public Collection<Venta> getVentaCollection() {
return ventaCollection;
}
public void setVentaCollection(Collection<Venta> ventaCollection) {
this.ventaCollection = ventaCollection;
}
@XmlTransient
public Collection<Ordenservisio> getOrdenservisioCollection() {
return ordenservisioCollection;
}
public void setOrdenservisioCollection(Collection<Ordenservisio> ordenservisioCollection) {
this.ordenservisioCollection = ordenservisioCollection;
}
public Tipodocumento getIdTipoDoc() {
return idTipoDoc;
}
public void setIdTipoDoc(Tipodocumento idTipoDoc) {
this.idTipoDoc = idTipoDoc;
}
@XmlTransient
public Collection<Cotizacion> getCotizacionCollection() {
return cotizacionCollection;
}
public void setCotizacionCollection(Collection<Cotizacion> cotizacionCollection) {
this.cotizacionCollection = cotizacionCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (idCliente != null ? idCliente.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Cliente)) {
return false;
}
Cliente other = (Cliente) object;
if ((this.idCliente == null && other.idCliente != null) || (this.idCliente != null && !this.idCliente.equals(other.idCliente))) {
return false;
}
return true;
}
@Override
public String toString() {
return "edu.asknsoluciones.entity.Cliente[ idCliente=" + idCliente + " ]";
}
}
| [
"Bolkin B@Bolkin"
] | Bolkin B@Bolkin |
d8b07ce16f2f8a9787389d2ed34b94021a0770ed | cf5a395584878e30c133a3880551be53dc067226 | /inventory-service/src/test/java/com/sample/microservice/inventoryservice/InventoryServiceApplicationTests.java | eed989692d5b0d77d6334cbbb3a1acef2fc1d227 | [] | no_license | jahirsaiyed/ecommerce | aca2435a054398ffbc5fe89fd57d5422e52b0f02 | 1e84c0a85118734a9ea27f35f9799e1bc0f9870a | refs/heads/master | 2020-11-25T12:12:10.111789 | 2019-12-17T16:19:30 | 2019-12-17T16:19:30 | 228,652,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 242 | java | package com.sample.microservice.inventoryservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class InventoryServiceApplicationTests {
@Test
void contextLoads() {
}
}
| [
"jahiruddin.saiyed@emaratech.ae"
] | jahiruddin.saiyed@emaratech.ae |
04c130a6afb1d982add9612e42ac1936eb7b5cda | 7b733d7be68f0fa4df79359b57e814f5253fc72d | /system/Testing/src/com/percussion/testing/PSConfigHelperTestCase.java | 27c85ce983e9b9689db95e7db93e38619e0af6f5 | [
"LicenseRef-scancode-dco-1.1",
"Apache-2.0",
"OFL-1.1",
"LGPL-2.0-or-later"
] | permissive | percussion/percussioncms | 318ac0ef62dce12eb96acf65fc658775d15d95ad | c8527de53c626097d589dc28dba4a4b5d6e4dd2b | refs/heads/development | 2023-08-31T14:34:09.593627 | 2023-08-31T14:04:23 | 2023-08-31T14:04:23 | 331,373,975 | 18 | 6 | Apache-2.0 | 2023-09-14T21:29:25 | 2021-01-20T17:03:38 | Java | UTF-8 | Java | false | false | 4,013 | java | /*
* Copyright 1999-2023 Percussion Software, Inc.
*
* 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.percussion.testing;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.Properties;
import junit.framework.TestCase;
/**
* The utility class to provide various properties for all the unit tests.
* It is essentially a config props factory that uses a classloader to fetch
* a appropriate properties file based on the given CONN_TYPE_XX.
* Prop. file names correspond to the CONN_TYPE_XX, ie: conn_rxserver.properties.
*/
public class PSConfigHelperTestCase implements
IPSUnitTestConfigHelper
{
/**
* Default constructor.
*/
public PSConfigHelperTestCase()
{
}
/**
* Simply call super(String).
*
* @param arg0 the name of the TestCase.
*/
public PSConfigHelperTestCase(String arg0)
{
}
// Implements IPSClientBasedJunitTest.getRxConnectionProps()
public static Properties getConnectionProps(int type) throws IOException
{
switch (type)
{
case CONN_TYPE_RXSERVER:
return getPropertiesWithSystemOverrides("conn_rxserver.properties");
case CONN_TYPE_TOMCAT:
return getPropertiesWithSystemOverrides("conn_tomcat.properties");
case CONN_TYPE_SQL:
return getPropertiesWithSystemOverrides("conn_sql.properties");
case CONN_TYPE_ORA:
return getPropertiesWithSystemOverrides("conn_ora.properties");
default:
{
//undefined connection type
throw new IllegalArgumentException("invalid conn type: " + type);
}
}
}
/**
* Loads properties from the classpath and overrides values from system properties.
* This is useful when running tests from CI server's like Jenkins or from
* Eclipse launch configurations. Assumes that properties are overridden using a
* <filename>.<propertyname> notation.
*
* @param fileName
*
* @return
* @throws IOException
*/
private static Properties getPropertiesWithSystemOverrides(String fileName) throws IOException{
Properties props = loadFromFile(fileName);
Properties system = System.getProperties();
//Loop through the properties and search for overrides.
Enumeration<?> e = props.propertyNames();
while(e.hasMoreElements()){
String key = (String)e.nextElement();
String val = system.getProperty(fileName.concat(".").concat(key));
if(val!=null){
//Override the value with the System provided one.
props.setProperty(key, val);
}
}
return props;
}
/**
* Loads a props file using this class's class loader.
* @param fileName name of the props file to load, never <code>null</code>.
* @return props never <code>null</code>.
* @throws IOException
*/
private static Properties loadFromFile(String fileName) throws IOException
{
InputStream in = PSConfigHelperTestCase.class.getResourceAsStream(fileName);
try
{
Properties props = new Properties();
props.load( in );
return props;
}
finally
{
if (in != null)
try
{
in.close();
} catch (IOException e)
{
}
}
}
}
| [
"nate.chadwick@gmail.com"
] | nate.chadwick@gmail.com |
517180ead201391abd45c15ffdae61a8b463b951 | cf1fae137589c258bcc788af9d2f250b2a71ec77 | /SampleBasicWidget/app/src/main/java/com/example/tacademy/samplebasicwidget/MainActivity.java | 9467f2d9b47fc43451052e2c2a4435f9603aa9ec | [] | no_license | pese2912/AndroidAppExample | 2bf3b97372759d1e859d42a9673b17237c56cccd | b0947043987b54bdb0f4be8d92ccabf58b705dc4 | refs/heads/master | 2021-01-21T13:33:54.430904 | 2016-05-12T05:18:25 | 2016-05-12T05:18:25 | 54,903,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,594 | java | package com.example.tacademy.samplebasicwidget;
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.CompoundButton;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
CheckBox checkBox;
EditText pass;
RadioGroup group;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView textView =(TextView)findViewById(R.id.test_text);
textView.setSelected(true);
checkBox = (CheckBox)findViewById(R.id.check);
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isForced) return;
Toast.makeText(MainActivity.this, "isChecked : " + isChecked , Toast.LENGTH_SHORT).show();
}
});
group = (RadioGroup)findViewById(R.id.group_sex);
group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.radio_m :
case R.id.radio_f :
break;
}
}
});
pass = (EditText)findViewById(R.id.pass);
final EditText email = (EditText)findViewById(R.id.email);
pass.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if(actionId == EditorInfo.IME_ACTION_SEND){
String addr = email.getText().toString();
Toast.makeText(MainActivity.this,"서버전송",Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
});
pass.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) {
String text = s.toString();
if (text.length() < 4) {
pass.setTextColor(Color.RED);
} else {
pass.setTextColor(Color.BLACK);
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
boolean isForced = false;
public void onMyButtonClick(View view) {
Toast.makeText(this, "My Button Click", Toast.LENGTH_SHORT).show();
isForced = true;
checkBox.setChecked(!checkBox.isChecked());
isForced = false;
int id = group.getCheckedRadioButtonId();
switch (id) {
case R.id.radio_f :
group.check(R.id.radio_m);
break;
case R.id.radio_m :
group.check(R.id.radio_f);
break;
}
}
}
| [
"pese2912@naver.com"
] | pese2912@naver.com |
2a1afd7da51d34debe774e43bd389131710bb7f5 | 9abdf4a7f0fe3497a8e7bad10db6629d39493846 | /src/main/java/com/zgp/pider/chapter1/MapStudy.java | 98eea26b9ac79e5941e64bd8712b0f4e322732e6 | [] | no_license | 674236876/spider | f42032df7814fb613fbdfe418e44c41da8cdcd78 | 9a9fa1cb3eb24a3ebfb87bed250bce834a273721 | refs/heads/master | 2022-09-15T06:35:08.855776 | 2019-11-05T09:50:33 | 2019-11-05T09:50:33 | 219,709,561 | 0 | 0 | null | 2022-09-01T23:15:05 | 2019-11-05T09:44:16 | Java | UTF-8 | Java | false | false | 1,320 | java | package com.zgp.pider.chapter1;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
* @author zhugp
* @description TODO
* @date 2019/11/5 17:34
*/
public class MapStudy {
public static void main(String args[]){
//Map的创建
Map<String, Integer> map = new HashMap<String, Integer>();
//值的添加,这里假设是爬虫中的产品id以及每个产品id对应的销售量
map.put("jd1515", 100);
map.put("jd1516", 300);
map.put("jd1515", 100);
map.put("jd1517", 200);
map.put("jd1518", 100);
//第一种方法遍历
for (String key : map.keySet()) {
Integer value = map.get(key);
System.out.println("Key = " + key + ", Value = " + value);
}
//第二种方法遍历
Iterator<Map.Entry<String, Integer>> entries = map.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String, Integer> entry = entries.next();
System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}
//第三种方法遍历
for (Map.Entry<String, Integer> entry : map.entrySet()) {
System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());
}
}
}
| [
"674236876@qq.com"
] | 674236876@qq.com |
fd55cf0fe803b28644ae29a6e73e9a88aa8e7cb6 | 3411898dfb36f48db8ae5116eb156713b006892c | /DJEmporium[J.Chuang]/DJGUI.java | 55286eab7f66aee448fad4b979662b669eb9f65a | [] | no_license | hiddensanctum/Code-Fellows-Application | 0618598708ae2cf9a10955f74fe96c70557eb2b0 | f00468cc97be64469258b126096d744941d7ec16 | refs/heads/master | 2021-01-23T17:30:40.038824 | 2013-07-24T11:13:55 | 2013-07-24T11:13:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,275 | java | /*
* James Chuang
* Turner 1
* DJ GUI
*/
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
public class DJGUI implements ActionListener{
private JFrame frame; //the frame of the store
private DJInventory inv; //stores the inventory of the CDs
//tab components
private JTabbedPane djPanel; //the tab panel
private JPanel invenPanel; //the inventory panel
private JPanel addPanel; //the add panel
private JPanel sellPanel; //the sell panel
private JTextField skuText; //the sku text
private JTextField priceText; //the price text
private JTextField artistText; //the artist text
private JTextField quantityText; //the quantity text
private JTextField albumText; //the album text
private JButton add; //the add button
private JButton sell; //the sell button
private JTextField sellText; //the sellText field
private JList sellList; //the sell list
private JLabel invD; //the inventory display
private String disDefault; //the default inventory display
//Menu components
private JMenuItem jmiOpen; //the open button
private JMenuItem jmiClose; //the close button
private JMenuItem jmiSave; //the save button
private JMenuItem jmiExit; //the exit button
private JMenuBar jmb; //the menu bar
public DJGUI(){
//initializes all the panels and frames
frame = new JFrame();
inv = new DJInventory();
frame.setTitle("DJStore --- No File Loaded");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(800,500);
//-------------------tabs component declarations--------------------//
djPanel = new JTabbedPane();
invenPanel = new JPanel();
addPanel = new JPanel();
sellPanel = new JPanel();
//addPanel declarations
skuText=new JTextField(11);
priceText=new JTextField(11);
artistText=new JTextField(10);
quantityText=new JTextField(9);
albumText=new JTextField(9);
add=new JButton("Add");
JPanel skuP = new JPanel();
skuP.add(new JLabel("Sku"));
skuP.add(skuText);
JPanel priceP = new JPanel();
priceP.add(new JLabel("Price"));
priceP.add(priceText);
JPanel artistP = new JPanel();
artistP.add(new JLabel("Artist"));
artistP.add(artistText);
JPanel quantityP = new JPanel();
quantityP.add(new JLabel("Quantity"));
quantityP.add(quantityText);
JPanel albumP = new JPanel();
albumP.add(new JLabel("Album"));
albumP.add(albumText);
JPanel addP = new JPanel();
addP.add(add);
addPanel.setLayout(new GridLayout(3,2));
addPanel.add(skuP);
addPanel.add(priceP);
addPanel.add(artistP);
addPanel.add(quantityP);
addPanel.add(albumP);
addPanel.add(addP);
//inventory panel declarations
invD = new JLabel();
disDefault = "<html><table width = \"380\" align = left><tr><td>Sku</td><td>Artist</td><td>Album</td><td>Quantity</td><td>Price</td></tr>";
invD.setText(disDefault);
invenPanel.add(invD);
//sell panel declarations
JPanel sellP = new JPanel();
JPanel quant = new JPanel();
JPanel listP = new JPanel();
sellList = new JList();
sellText = new JTextField(5);
sell = new JButton("Sell");
JScrollPane listS = new JScrollPane(sellList);
sellP.setLayout(new FlowLayout(FlowLayout.CENTER,70,20));
sellP.add(new JLabel("Quantity:"));
quant.add(sell);
sellP.add(sellText);
sellP.add(quant);
listP.setLayout(new BorderLayout());
listP.add(listS,BorderLayout.CENTER);
listP.add(new JLabel(" "),BorderLayout.NORTH);
listP.add(new JLabel(" "),BorderLayout.WEST);
listP.add(new JLabel(" "),BorderLayout.EAST);
listP.add(new JLabel(" "),BorderLayout.SOUTH);
sellPanel.setLayout(new GridLayout(1,2));
sellPanel.add(listP);
sellPanel.add(sellP);
//add tabs
djPanel.add("Inventory", invenPanel);
djPanel.add("Add Record", addPanel);
djPanel.add("Sell Record", sellPanel);
//-------------------End tabs component declarations----------------//
//-----------------------Menu component declarations---------------//
jmb = new JMenuBar();
// jmb typically contains JMenu objects
// JMenu objects may contain MenuItem objects or other JMenu objects
JMenu jmFile = new JMenu("File");
jmiOpen = new JMenuItem("Open");
jmiSave = new JMenuItem("Save");
jmiClose = new JMenuItem("Close");
jmiExit = new JMenuItem("Exit");
// add File items to JMenu
jmFile.add(jmiOpen);
jmFile.add(jmiClose);
jmFile.add(jmiSave);
jmFile.add(jmiExit);
jmb.add(jmFile);
//-------------------End Menu component declarations----------------//
//sets the layout for the panels and frames
frame.setLayout(new BorderLayout());
frame.setJMenuBar(jmb);
frame.add(djPanel, BorderLayout.CENTER);
frame.add(new JLabel(new ImageIcon("a1.jpg")), BorderLayout.WEST);
JPanel title = new JPanel();
title.add(new JLabel("<html>DJ Emporium<br><br></html>",10));
frame.add(title, BorderLayout.NORTH);
frame.add(new JLabel(new ImageIcon("a3.jpg")), BorderLayout.SOUTH);
frame.add(new JLabel(new ImageIcon("a6.jpg")), BorderLayout.EAST);
frame.setVisible(true);
//button declaration
add.addActionListener(this);
jmiOpen.addActionListener(this);
jmiClose.addActionListener(this);
jmiExit.addActionListener(this);
jmiSave.addActionListener(this);
sell.addActionListener(this);
}
//defines what happens when certain button were pressed
public void actionPerformed(ActionEvent ae){
//stores the button pressed
String currentPressed= ae.getActionCommand();
//add button control
if(currentPressed.equals("Add")){
if(artistText.getText().equals("") || albumText.getText().equals(""))
JOptionPane.showMessageDialog(null, "Cannot Add CD", "ERROR", JOptionPane.ERROR_MESSAGE);
else{
try{
CDs c = new CDs(Integer.parseInt(skuText.getText()),artistText.getText(), albumText.getText(), Integer.parseInt(quantityText.getText()), Double.parseDouble(priceText.getText()));
inv.addCD(c);
JOptionPane.showMessageDialog(null, "CD added succesfully", "Added", JOptionPane.PLAIN_MESSAGE);
skuText.setText("");
artistText.setText("");
albumText.setText("");
quantityText.setText("");
priceText.setText("");
//show that the file has not been saved
if(frame.getTitle().indexOf('*') == -1)
frame.setTitle("*"+frame.getTitle());
}catch(NumberFormatException e){
JOptionPane.showMessageDialog(null, "Cannot Add CD", "ERROR", JOptionPane.ERROR_MESSAGE);
}
update();
}
}
//open button control
if(ae.getActionCommand().equals("Open")){
inv.getFile();
frame.setTitle("DJStore --- " + inv.getFileName());
update();
}
//sell button control
if(ae.getActionCommand().equals("Sell")){
inv.sellCD(sellList.getSelectedIndex(),(Integer.parseInt(sellText.getText())));
update();
}
//save button control
if(ae.getActionCommand().equals("Save")){
inv.saveFile();
}
//close button control
if(ae.getActionCommand().equals("Close")){
if(frame.getTitle().indexOf('*') != -1){
String message = "Do you want to save?";
String title = "WARNING";
int answer = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION);
if (answer == JOptionPane.YES_OPTION)
inv.saveFile();
}
invD.setText("");
inv = new DJInventory();
frame.setTitle("DJStore --- No File Loaded");
}
//exit button control
if(ae.getActionCommand().equals("Exit")){
if(frame.getTitle().indexOf('*') != -1){
String message = "Do you want to save?";
String title = "WARNING";
int answer = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION);
if (answer == JOptionPane.YES_OPTION)
inv.saveFile();
}
System.exit(0);
}
}//end actionPerformed
//Updates the different inventories
private void update(){
invD.setText(disDefault+inv+"</table></html>");
sellList.setListData(inv.getList());
}//end update
public static void main(String[] args) {
DJGUI t = new DJGUI();
}
}
| [
"hiddensanctum@server.fake"
] | hiddensanctum@server.fake |
c7e9fbcef415f45d8362674dec9e4131da70e379 | 0af148954db86780892f8405c68826e47361a451 | /SelectDetailRoom.java | 4e85ebda6f46f36f1750fbe76ad2bd74ad4aeff6 | [] | no_license | kantanasoft/midterm-se | ff6c0ab9bbafe867f040f88df8d5b611e9dd2ff2 | f75171bf5ba4d3edf8d8c8a416c03239dcc95bc2 | refs/heads/master | 2020-04-29T02:08:04.378642 | 2019-03-16T08:59:06 | 2019-03-16T08:59:06 | 175,753,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,008 | java | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class SelectDetailRoom {
public String selectOptionRoom(){
String resultOptionRoom = new String();
try{
System.out.println("--- Option Room ---");
System.out.println(" A.) Smoking");
System.out.println(" B.) No smoking");
System.out.println(" C.) Big bed ");
System.out.println(" D.) Pair bed ");
System.out.println("Select Option Room : ");
BufferedReader bufferRead = new BufferedReader(new InputStreamReader(System.in));
String typeRoom = bufferRead.readLine();
if(typeRoom.equals("A")){
resultOptionRoom = "SMOKING";
}
else if(typeRoom.equals("B")){
resultOptionRoom = "NO_SMOKING";
}
else if(typeRoom.equals("C")){
resultOptionRoom = "BIG_BED";
}
else if(typeRoom.equals("D")){
resultOptionRoom = "PAIR_BED";
}
}catch(Exception e){
System.out.println("Error : " + e);
}
return resultOptionRoom;
}
}
| [
"kantaponses@gosoft.co.th"
] | kantaponses@gosoft.co.th |
3a951697ae83d3951d737c30aedfd49eccfe6309 | 8ac76ffac0a8ba2026c2fbf96206147a99e041c7 | /Practico 8/src/ejercicio11/criterio/CriterioAnd.java | 917b0af9c98c6ab5b60bbcb56eed366ba9976275 | [] | no_license | fdcrespi/programacion2 | eedb3f28e72b2d20dd133aa421f97bf5e54ddf35 | 874c90521b47ecb74ea9cdb7137323fce35ccad0 | refs/heads/master | 2023-05-10T16:13:52.406123 | 2021-06-10T21:51:58 | 2021-06-10T21:51:58 | 358,041,184 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package ejercicio11.criterio;
import ejercicio11.Seguro;
public class CriterioAnd implements Criterio{
Criterio criterio1;
Criterio criterio2;
public CriterioAnd(Criterio criterio1, Criterio criterio2) {
this.criterio1 = criterio1;
this.criterio2 = criterio2;
}
@Override
public boolean cumple(Seguro seguro) {
return criterio1.cumple(seguro) && criterio2.cumple(seguro);
}
}
| [
"fdcrespi@gmail.com"
] | fdcrespi@gmail.com |
4e6531c53207bd4973ea98c0e2be6c9e91e862e9 | ef9e0388e879d6574a219dc11053bf2ff4aecc56 | /app/src/main/java/com/app/newuidashboardadmin/services/VolleyClient.java | b18b84b3e69284b9bc8948eb034c2f3267522dae | [] | no_license | SuperMerger786/MevofitAdminApp | b2aede655054396a102014969d5643db1dfe85cd | 435b60e1a69333bcb086ff16b7ced04ce0c2e516 | refs/heads/master | 2023-02-24T23:36:05.649080 | 2021-02-01T05:39:22 | 2021-02-01T05:39:22 | 311,245,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,713 | java | package com.app.newuidashboardadmin.services;
import android.content.Context;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.NetworkResponse;
import com.android.volley.Request.Method;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.app.newuidashboardadmin.AppController;
import com.app.newuidashboardadmin.IResponseUpdater;
import com.app.newuidashboardadmin.MyLogger;
import org.json.JSONObject;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public class VolleyClient {
private String TAG = "Mevo_Urgent";
IResponseUpdater responseUpdater = null;
Context activity;
String finalUrl;
public VolleyClient(Context activity, IResponseUpdater responseUpdater) {
this.activity = activity;
this.responseUpdater = responseUpdater;
}
public void cancelRequest() {
if (reqeustJsonPost != null) {
reqeustJsonPost.cancel();
}
}
JsonObjectRequest reqeustJsonPost;
public void makeRequest(String url, final String jsonRequestParam,
final String requestTag) {
// try {
try {
finalUrl = new URL(url).toURI().toString();
// finalUrl = url;
} catch (Exception e1) {
MyLogger.println("admin>>>>>0volleyclient=Exception=" + e1.getMessage());
}
JSONObject jsonObj = null;
try {
jsonObj = new JSONObject(jsonRequestParam);
MyLogger.println("admin>>>>>1volleyclient Inside Request Param for " + requestTag
+ " jsonObj : =" + jsonObj + "=== ==== " + url);
} catch (Exception e) {
MyLogger.println("admin>>>>>2Volley Client exception 1=" + e.getMessage());
}
reqeustJsonPost = new JsonObjectRequest(
Method.POST, finalUrl, jsonObj,
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
MyLogger.println("admin>>>>>4volleyclient Inside on response==" + response);
if (reqeustJsonPost != null && reqeustJsonPost.isCanceled()) {
return;
}
try {
responseUpdater.onServerResponseSuccess(requestTag, response.toString());
} catch (Exception e) {
MyLogger.println("admin>>>>>5volleyclient<<<<<response 2 = " + e.getMessage() + "========" + requestTag);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
// Log.e(TAG,"response "+error.toString());
responseUpdater.onServerResponseError(requestTag,
error.getMessage());
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json");
return headers;
}
@Override
protected Response<JSONObject> parseNetworkResponse(NetworkResponse response) {
return super.parseNetworkResponse(response);
}
};
// reqeustJsonPost.setRetryPolicy(new DefaultRetryPolicy(30000, 0, 1f));
reqeustJsonPost.setShouldCache(false);
new Thread(new Runnable() {
@Override
public void run() {
reqeustJsonPost.setRetryPolicy(new DefaultRetryPolicy((int) TimeUnit.SECONDS
.toMillis(60), DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
AppController.getInstance().addToRequestQueue(reqeustJsonPost, requestTag);
}
}).start();
/* } catch (Exception e) {
MyLogger.println("admin>>>>>6Volley>>>>>>exceprtion>>" + e.toString());
}*/
}
private JSONObject JSONObject(String jsonRequestParam) {
// TODO Auto-generated method stub
return null;
}
}
| [
"er.yashkumar121@gmail.com"
] | er.yashkumar121@gmail.com |
c6b6210bf7c0c6f5f127bf51e0f96c6828f0cc44 | a002199d768d89b4372ff7263c854f60a5ce4bde | /app/src/test/java/com/tm/example/scrollerdemo/ExampleUnitTest.java | 7275aee1debb12f45534c275a0ff91edeb3db440 | [] | no_license | tianmeng0111/ScrollerDemo | 6bf98cbfefd3ac66a16a60c05c0aff6945e30eda | c6054468472a51db7c948e814b4b28a9d2da8b40 | refs/heads/master | 2020-04-05T23:14:46.354089 | 2016-07-11T05:40:37 | 2016-07-11T05:40:37 | 63,039,424 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.tm.example.scrollerdemo;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"tianmeng0111@163.com"
] | tianmeng0111@163.com |
ad21123dd98cdc3ec084b87d449e1d4f16b2c552 | 20785600c3b8800f69fa8e8fb94598162477762a | /src/first/SearchMatrix.java | 9eacd118c2bdcf855364d69ddbd7842f8b0813b5 | [] | no_license | YuanyiYang/myLeetcode | a79279f1b8ec6846ca1a891ad626eba73a242e74 | ed4d7a3136637d807ab3d19fe53a0853ddb39490 | refs/heads/master | 2021-01-17T05:55:54.254027 | 2015-03-16T19:57:04 | 2015-03-16T19:57:04 | 24,426,334 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,414 | java | package first;
public class SearchMatrix {
public static boolean searchMatrix(int[][] matrix, int target) {
if (matrix == null || matrix.length == 0 || matrix[0].length == 0)
return false;
if (target < matrix[0][0])
return false;
int row = search(matrix, target);
int i = 0;
int j = matrix[row].length - 1;
while (i <= j) {
int mid = (i + j) / 2;
if (matrix[row][mid] == target) {
return true;
} else if (matrix[row][mid] < target) {
i = mid + 1;
} else {
j = mid - 1;
}
}
return false;
}
public static int search(int[][] matrix, int target) {
int i = 0;
int j = matrix.length - 1;
while (i <= j) {
int mid = (i + j) / 2;
if (matrix[mid][0] == target) {
return mid;
} else if (matrix[mid][0] > target) {
j = mid - 1;
} else {
i = mid + 1;
}
}
return (i + j) / 2;
}
public static boolean oneDArray(int[][] matrix, int target){
int rows = matrix.length;
int columns = matrix[0].length;
int begin = 0;
int end = rows * columns - 1;
while(begin<=end){
int mid = (begin+end)/2;
if(matrix[mid/columns][mid%columns]==target){
return true;
}else if(matrix[mid/columns][mid%columns]>target){
end = mid - 1;
}else{
begin = mid+1;
}
}
return false;
}
}
| [
"yuanyi.yang.8848@gmail.com"
] | yuanyi.yang.8848@gmail.com |
743cdb293354342caa0f92b6e0328c1298b8c7de | 17bc53758e639e33f2d602114cfc432b797686a6 | /src/main/java/com/miw/utils/RedisSerilizationUtils.java | 82c290f3d6152069f841ef0a42bae76fed218c00 | [] | no_license | leyi1002/miw-web | e6a141d94e2d3f2bef16e7c733d5c4ca5891139e | fb87c4b5452b8b3c7d15f1c1360dce16342faa9a | refs/heads/master | 2021-01-23T11:33:19.033104 | 2018-01-04T11:08:59 | 2018-01-04T11:08:59 | 93,147,972 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 158 | java | package com.miw.utils;
/**
* Created by J lai on 2017/6/28 0028.
*/
public class RedisSerilizationUtils<T> {
// public static List<T> deserialize()
}
| [
"leyi1002@163.com"
] | leyi1002@163.com |
40f5d2082cb6e451de9553a3965ffdcf1a792fcc | 6ceada0d6310f41ebd2387eed1413975f611ab55 | /icy/canvas/CanvasLayerListener.java | 20517a6eaef9780f1fbd84ca4fba920cb79f8b00 | [] | no_license | zeb/Icy-Kernel | 441484a5f862e50cf4992b5a06f35447cd748eda | d2b296e043c77da31d27b8f0242d007b3e5e17e2 | refs/heads/master | 2021-01-16T22:46:48.889696 | 2013-03-18T13:30:43 | 2013-03-18T13:30:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 231 | java | /**
*
*/
package icy.canvas;
import java.util.EventListener;
/**
* @author Stephane
*/
public interface CanvasLayerListener extends EventListener
{
public void canvasLayerChanged(CanvasLayerEvent event);
}
| [
"stephane.dallongeville@pasteur.fr"
] | stephane.dallongeville@pasteur.fr |
e9ea01de91893afab16923313b9265ba3deb467c | 7485ce316e4ac1ed9ac4d8e6c75ce0d7e464702b | /family-spring-data-mongodb/src/main/java/org/family/spring/data/mongodb/bean/DepartmentBean.java | f2b7444cd62b479bd4217e8dfbc7feaeca003cc9 | [] | no_license | wuziliang18/family-spring-data | c6ffdc70092e59a85ba3f6cdd3ff29fbcd602283 | d59c3801e488185608baeb29f9f5972db71bfa54 | refs/heads/master | 2020-04-06T04:22:26.711814 | 2014-07-16T02:57:33 | 2014-07-16T02:57:33 | 19,969,268 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 537 | java | package org.family.spring.data.mongodb.bean;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection="department")
public class DepartmentBean {
@Id
private String id;
private String departmentName;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
}
| [
"wuziliang@dayima.com"
] | wuziliang@dayima.com |
2a6b23a35c436399afef84df9f4a11721e6ea973 | aa9fd0b9b699a4736742406816b71768d43922fd | /src/main/java/com/blade/watcher/EnvironmentWatcher.java | 0ceb55b6f43883c13ab65767c22e803829af63db | [
"Apache-2.0"
] | permissive | HongzhuLiu/blade | fbec278ddcf13b1abc3e465ab89bb483eea446e4 | e190099ac8186f856330b39a89145421a835cd6a | refs/heads/master | 2021-09-09T22:44:30.860981 | 2018-03-20T03:46:35 | 2018-03-20T03:46:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,534 | java | package com.blade.watcher;
import com.blade.Environment;
import com.blade.event.EventType;
import com.blade.mvc.Const;
import com.blade.mvc.WebContext;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.nio.file.*;
/**
* Environment watcher
*
* @author biezhi
* @date 2017/12/24
*/
@Slf4j
public class EnvironmentWatcher implements Runnable {
@Override
public void run() {
final Path path = Paths.get(Const.CLASSPATH);
try (WatchService watchService = FileSystems.getDefault().newWatchService()) {
path.register(watchService, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE);
// start an infinite loop
while (true) {
final WatchKey key = watchService.take();
for (WatchEvent<?> watchEvent : key.pollEvents()) {
final WatchEvent.Kind<?> kind = watchEvent.kind();
if (kind == StandardWatchEventKinds.OVERFLOW) {
continue;
}
// get the filename for the event
final WatchEvent<Path> watchEventPath = (WatchEvent<Path>) watchEvent;
final String filename = watchEventPath.context().toString();
// print it out
if (log.isDebugEnabled()) {
log.debug("⬢ {} -> {}", kind, filename);
}
if (kind == StandardWatchEventKinds.ENTRY_DELETE &&
filename.startsWith(".app") && filename.endsWith(".properties.swp")) {
// reload env
log.info("⬢ Reload environment");
Environment environment = Environment.of("classpath:" + filename.substring(1, filename.length() - 4));
WebContext.blade().environment(environment);
// notify
WebContext.blade().eventManager().fireEvent(EventType.ENVIRONMENT_CHANGED, environment);
}
}
// reset the keyf
boolean valid = key.reset();
// exit loop if the key is not valid (if the directory was
// deleted, for
if (!valid) {
break;
}
}
} catch (IOException | InterruptedException ex) {
log.error("Environment watch error", ex);
}
}
}
| [
"biezhi.me@gmail.com"
] | biezhi.me@gmail.com |
473f9c477f6be38a84ddb4d698ba1cdd713473c1 | 5ed4ac6c652a6facb6b4162b6595b00245b868c5 | /app/src/main/java/ru/sigmadigital/taxipro/fragments/dialogs/DialogNavigator.java | 4124e54a16e646da7d41d36a23aa39d71b159aae | [] | no_license | ann134/taxipro | 1e8bcb0809258113063a0fa5940482dfd6db51e4 | d3d8bbb847b99e02a8dbad32f9249db557c6ebfc | refs/heads/master | 2020-08-30T08:02:34.917093 | 2019-10-29T15:02:50 | 2019-10-29T15:02:50 | 211,227,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,161 | java | package ru.sigmadigital.taxipro.fragments.dialogs;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import java.io.Serializable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.DialogFragment;
import ru.sigmadigital.taxipro.R;
public class DialogNavigator extends DialogFragment implements View.OnClickListener {
private NavigatorDialogListener listener;
public static DialogNavigator newInstance(NavigatorDialogListener listener) {
Bundle args = new Bundle();
args.putSerializable("listener", listener);
DialogNavigator fragment = new DialogNavigator();
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
if (getArguments().containsKey("listener")) {
listener = (NavigatorDialogListener) getArguments().getSerializable("listener");
}
}
if (savedInstanceState != null) {
if (savedInstanceState.containsKey("listener")) {
listener = (NavigatorDialogListener) savedInstanceState.getSerializable("listener");
}
}
}
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
@SuppressLint("InflateParams") View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_navigator, null);
view.findViewById(R.id.standart).setOnClickListener(this);
view.findViewById(R.id.gis).setOnClickListener(this);
view.findViewById(R.id.yandex).setOnClickListener(this);
view.findViewById(R.id.cansel).setOnClickListener(this);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setView(view);
Dialog dialog = builder.create();
if (dialog.getWindow() != null)
dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
return dialog;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.standart: {
if (listener != null) {
listener.onNavigatorSelected(0);
}
dismiss();
break;
}
case R.id.gis: {
if (listener != null) {
listener.onNavigatorSelected(1);
}
dismiss();
break;
}
case R.id.yandex: {
if (listener != null) {
listener.onNavigatorSelected(2);
}
dismiss();
break;
}
case R.id.cansel: {
dismiss();
break;
}
}
}
public interface NavigatorDialogListener extends Serializable {
void onNavigatorSelected(int status);
}
} | [
"nightryuu@mail.ru"
] | nightryuu@mail.ru |
baa25801868f77ee215f5fe6d9b3c04c48ebc4ff | e57ecef43a12a86a7c4f3033527e7fd2ce259d08 | /app/src/main/java/com/morestudio/littledot/doctor/wizards/impl/BgOpen.java | 7bc58e94b0d43cb2e7b07811a24294a491af7e98 | [] | no_license | clopex/testApp | d941c5ae87371abf4189f0e52f7f66186f5af2e6 | 61a67b40210f1e930cca6a8fd634ec7711af098f | refs/heads/master | 2021-01-17T21:16:23.384818 | 2017-03-03T12:15:16 | 2017-03-03T12:15:16 | 84,170,288 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,484 | java | /**
* Copyright (C) 2010-2012 Regis Montoya (aka r3gis - www.r3gis.fr)
* This file is part of CSipSimple.
*
* CSipSimple is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* If you own a pjsip commercial license you can also redistribute it
* and/or modify it under the terms of the GNU Lesser General Public License
* as an android library.
*
* CSipSimple 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 CSipSimple. If not, see <http://www.gnu.org/licenses/>.
*/
package com.morestudio.littledot.doctor.wizards.impl;
import com.morestudio.littledot.doctor.api.SipConfigManager;
import com.morestudio.littledot.doctor.utils.PreferencesWrapper;
public class BgOpen extends SimpleImplementation {
@Override
protected String getDomain() {
return "sip.bgopen.net";
}
@Override
protected String getDefaultName() {
return "BGOPEN.NET";
}
@Override
public void setDefaultParams(PreferencesWrapper prefs) {
super.setDefaultParams(prefs);
// G.729, G723.1, GSM, iLBC
prefs.setCodecPriority("PCMU/8000/1", SipConfigManager.CODEC_WB,"200");
prefs.setCodecPriority("PCMA/8000/1", SipConfigManager.CODEC_WB,"0");
prefs.setCodecPriority("G722/16000/1", SipConfigManager.CODEC_WB,"0");
prefs.setCodecPriority("G729/8000/1", SipConfigManager.CODEC_WB,"0");
prefs.setCodecPriority("iLBC/8000/1", SipConfigManager.CODEC_WB,"210");
prefs.setCodecPriority("speex/8000/1", SipConfigManager.CODEC_WB,"0");
prefs.setCodecPriority("speex/16000/1", SipConfigManager.CODEC_WB,"0");
prefs.setCodecPriority("speex/32000/1", SipConfigManager.CODEC_WB,"0");
prefs.setCodecPriority("GSM/8000/1", SipConfigManager.CODEC_WB, "205");
prefs.setCodecPriority("SILK/8000/1", SipConfigManager.CODEC_WB, "0");
prefs.setCodecPriority("SILK/12000/1", SipConfigManager.CODEC_WB, "0");
prefs.setCodecPriority("SILK/16000/1", SipConfigManager.CODEC_WB, "0");
prefs.setCodecPriority("SILK/24000/1", SipConfigManager.CODEC_WB, "0");
prefs.setCodecPriority("G726-16/8000/1", SipConfigManager.CODEC_WB, "0");
prefs.setCodecPriority("G726-24/8000/1", SipConfigManager.CODEC_WB, "0");
prefs.setCodecPriority("G726-32/8000/1", SipConfigManager.CODEC_WB, "0");
prefs.setCodecPriority("G726-40/8000/1", SipConfigManager.CODEC_WB, "0");
prefs.setCodecPriority("opus/48000/1", SipConfigManager.CODEC_WB, "0");
// G.729, G723.1, GSM, iLBC
prefs.setCodecPriority("PCMU/8000/1", SipConfigManager.CODEC_NB,"200");
prefs.setCodecPriority("PCMA/8000/1", SipConfigManager.CODEC_NB,"0");
prefs.setCodecPriority("G722/16000/1", SipConfigManager.CODEC_NB,"0");
prefs.setCodecPriority("G729/8000/1", SipConfigManager.CODEC_NB,"0");
prefs.setCodecPriority("iLBC/8000/1", SipConfigManager.CODEC_NB,"210");
prefs.setCodecPriority("speex/8000/1", SipConfigManager.CODEC_NB,"0");
prefs.setCodecPriority("speex/16000/1", SipConfigManager.CODEC_NB,"0");
prefs.setCodecPriority("speex/32000/1", SipConfigManager.CODEC_NB,"0");
prefs.setCodecPriority("GSM/8000/1", SipConfigManager.CODEC_NB, "205");
prefs.setCodecPriority("SILK/8000/1", SipConfigManager.CODEC_NB, "0");
prefs.setCodecPriority("SILK/12000/1", SipConfigManager.CODEC_NB, "0");
prefs.setCodecPriority("SILK/16000/1", SipConfigManager.CODEC_NB, "0");
prefs.setCodecPriority("SILK/24000/1", SipConfigManager.CODEC_NB, "0");
prefs.setCodecPriority("G726-16/8000/1", SipConfigManager.CODEC_NB, "0");
prefs.setCodecPriority("G726-24/8000/1", SipConfigManager.CODEC_NB, "0");
prefs.setCodecPriority("G726-32/8000/1", SipConfigManager.CODEC_NB, "0");
prefs.setCodecPriority("G726-40/8000/1", SipConfigManager.CODEC_NB, "0");
prefs.setCodecPriority("opus/48000/1", SipConfigManager.CODEC_NB, "0");
}
@Override
public boolean needRestart() {
return true;
}
}
| [
"hrvojegor@gmail.com"
] | hrvojegor@gmail.com |
5037e1100de62b55dd0fed7f57a36137b11c0d30 | 67b2c66113cebd72385361b55f6684d2c8466f1d | /app/src/main/java/com/honeywell/wholesale/ui/search/GlobalSearchListAdapter.java | f729012a1b628d2d9b212c00c97f2a483538deef | [] | no_license | dengjiaping/WholeHybrid | a12312511863cd53ee6eb854da0f61a9766403dd | 3ef19523691345b52dd5fb09e26c85d76088693f | refs/heads/master | 2021-05-06T06:03:10.643330 | 2017-12-10T05:11:18 | 2017-12-10T05:11:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,436 | java | package com.honeywell.wholesale.ui.search;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.honeywell.wholesale.R;
import com.honeywell.wholesale.framework.model.Customer;
import com.honeywell.wholesale.framework.model.Inventory;
import com.honeywell.wholesale.framework.model.Supplier;
import com.honeywell.wholesale.ui.base.BaseTextView;
import java.util.ArrayList;
/**
* Created by xiaofei on 1/11/17.
*
*/
public class GlobalSearchListAdapter extends BaseAdapter{
private Context context;
private ArrayList<GlobalSearchResultItem> arrayList;
public GlobalSearchListAdapter(Context context, ArrayList<GlobalSearchResultItem> arrayList) {
this.arrayList = arrayList;
this.context = context;
}
@Override
public int getCount() {
return arrayList.size();
}
@Override
public Object getItem(int position) {
return arrayList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
GlobalSearchResultItem item = arrayList.get(position);
GlobalSearchResultItem.GlobalSearchResultType type = item.getType();
if (type == GlobalSearchResultItem.GlobalSearchResultType.SEARCH_RESULT_SECTION){
convertView = LayoutInflater.from(context).inflate(R.layout.item_global_search_section, parent, false);
String section = item.getSection();
BaseTextView baseTextView = (BaseTextView) convertView.findViewById(R.id.search_result_section);
if (section != null){
baseTextView.setText(section);
}
}
if (type == GlobalSearchResultItem.GlobalSearchResultType.SEARCH_RESULT_INVENTORY){
convertView = LayoutInflater.from(context).inflate(R.layout.item_global_search_inventory, parent, false);
Inventory inventory = item.getInventory();
ImageView productImage = (ImageView)convertView.findViewById(R.id.search_result_inventory_imageView);
BaseTextView productNameTextView = (BaseTextView) convertView.findViewById(R.id.search_result_productName_textView);
BaseTextView productPriceTextView = (BaseTextView) convertView.findViewById(R.id.search_result_productPrice_textView);
BaseTextView productCodeTextView = (BaseTextView) convertView.findViewById(R.id.search_result_productCode_textView);
BaseTextView productStockTextView = (BaseTextView) convertView.findViewById(R.id.search_result_productStock_textView);
productNameTextView.setText(inventory.getProductName());
String price = context.getString(R.string.global_search_product_price) + inventory.getStandardPrice();
productPriceTextView.setText(price);
String productCode = context.getString(R.string.global_search_product_code)+ " " + inventory.getProductCode();
productCodeTextView.setText(productCode);
String stockNumber = context.getString(R.string.global_search_product_stock) + inventory.getQuantity();
productStockTextView.setText(stockNumber);
Glide
.with(context)
.load(inventory.getPicSrc())
.placeholder(R.drawable.icon_search_inventory)
.error(R.drawable.icon_search_inventory)
.priority(Priority.LOW)
.into(productImage);
}
if (type == GlobalSearchResultItem.GlobalSearchResultType.SEARCH_RESULT_CUSTOMER){
convertView = LayoutInflater.from(context).inflate(R.layout.item_global_search_customer, parent, false);
Customer customer = item.getCustomer();
ImageView imageView = (ImageView)convertView.findViewById(R.id.search_result_customer_imageView);
BaseTextView customerName = (BaseTextView)convertView.findViewById(R.id.search_result_customerName_imageView);
BaseTextView customerTele = (BaseTextView)convertView.findViewById(R.id.search_result_tele_textView);
Glide
.with(context)
.load("")
.placeholder(R.drawable.left_menu_icon_customers)
.error(R.drawable.left_menu_icon_customers)
.priority(Priority.LOW)
.into(imageView);
customerName.setText(customer.getCustomerName());
customerTele.setText(customer.getContactPhone());
}
if (type == GlobalSearchResultItem.GlobalSearchResultType.SEARCH_RESULT_VENDOR){
convertView = LayoutInflater.from(context).inflate(R.layout.item_global_search_supplier, parent, false);
Supplier supplier = item.getSupplier();
ImageView imageView = (ImageView)convertView.findViewById(R.id.search_result_supplier_imageView);
BaseTextView supplierName = (BaseTextView)convertView.findViewById(R.id.search_result_supplierName_textView);
BaseTextView supplierTele = (BaseTextView)convertView.findViewById(R.id.search_result_supplier_tele_textView);
supplierName.setText(supplier.getSupplierName());
supplierTele.setText(supplier.getContactPhone());
Glide
.with(context)
.load("")
.placeholder(R.drawable.left_menu_icon_outlets)
.error(R.drawable.left_menu_icon_outlets)
.priority(Priority.LOW)
.into(imageView);
}
if (type == GlobalSearchResultItem.GlobalSearchResultType.SEARCH_RESULT_MORE){
convertView = LayoutInflater.from(context).inflate(R.layout.item_global_search_more, parent, false);
BaseTextView moreTextView = (BaseTextView) convertView.findViewById(R.id.search_result_more);
String section = item.getSection();
moreTextView.setText(section);
}
return convertView;
}
public void setAdapteData(ArrayList<GlobalSearchResultItem> arrayList){
this.arrayList = arrayList;
notifyDataSetChanged();
}
}
| [
"jin.qian@honeywell.com"
] | jin.qian@honeywell.com |
c7a0e8bdca42e064999145343f8f044a5ff4675f | 9498bd612bd5ae55146f132930ea58b1ca27450b | /2014/fall/cs46a/midterm/practice/practice1_student/code/2_replace/StringUtility2.java | b367b5697ab4c427cb7d4690e43dbc786152845f | [] | no_license | scotmatson/sjsu | 01d895662cf52c3876f23d0391080c15cd194bb3 | a8b55bf9429b06a5e5cb3287f7083e2173ec9134 | refs/heads/master | 2021-05-01T02:54:48.932325 | 2016-08-22T22:01:57 | 2016-08-22T22:01:57 | 31,382,456 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java |
public class StringUtility2
{
/**
* Replaces s with $ and i with 1.
* @param word the string to alter
* @return a new String with the replacements made
*/
public String getReplacement (String word)
{
word = word.replace("s", "$");
word = word.replace("i", "1");
return word;
}
}
| [
"sjpmatson@gmail.com"
] | sjpmatson@gmail.com |
bff9889459f2d39b4300ab65485ae7b4a6d69171 | da29adc498be9a13fda501a141882d43c9449bd7 | /main/java/com/introtoandroid/mynewapplicationtotesting/DynamicFragmActivity.java | 30eec0bca2f6e99efefa94a545ed0846cda6df51 | [] | no_license | HelAsia/MyNewApplicationToTesting | e3ee2177edfabdd40a1902c9413ba12de5395d44 | cbd97f1430e4cdc3e8173c444c3210a622fd28bd | refs/heads/master | 2020-03-10T03:10:29.497364 | 2018-05-22T21:53:14 | 2018-05-22T21:53:14 | 129,156,903 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 939 | java | package com.introtoandroid.mynewapplicationtotesting;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class DynamicFragmActivity extends Activity implements
OverviewFragment.OverviewFragmentActivityListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dynamic_fragm);
}
@Override
public void onItemSelected(String msg) {
DetailFragment fragment = (DetailFragment) getFragmentManager()
.findFragmentById(R.id.detailFragment);
if(fragment != null && fragment.isInLayout()) {
fragment.setText(msg);
}else {
Intent intent = new Intent(getApplicationContext(),
DetailActivity.class);
intent.putExtra("msg",msg);
startActivity(intent);
}
}
}
| [
"asiaheluszka1993@gmail.com"
] | asiaheluszka1993@gmail.com |
284a4f3d5a28e98202d4c0ea2fd5b0b03f701810 | 971f2812c4621cc0095869373f958ba222f9d844 | /src/main/java/pageswithcucpomimplementation/HomePage.java | e8c12a57752fe05da016d09362c9bc565cfd7e70 | [] | no_license | venkyramamoorthy/SeleniumTestLeaf | 0b5dfa8ac4ca2b3ef94030f2990a042e267d8191 | 795fdde0851a9c0d9bd14b390d9549cf3b10313a | refs/heads/master | 2020-03-26T02:16:19.164566 | 2018-08-12T05:01:48 | 2018-08-12T05:01:48 | 144,403,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 570 | java | package pageswithcucpomimplementation;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import cucumber.api.java.en.When;
import wdMethods.SeMethods;
public class HomePage extends SeMethods {
public HomePage()
{
PageFactory.initElements(driver, this);
}
@FindBy(linkText="CRM/SFA")
WebElement crmsfalink;
@When("click CRMSFA link")
public MyHomePages crmsfalink()
{
click(crmsfalink);
//driver.findElementByLinkText("CRM/SFA").click();
return new MyHomePages();
}
}
| [
"Venkatesh Raja@Venky"
] | Venkatesh Raja@Venky |
799273546e64dff52e2fc46ef41958eadf84bd96 | 1450d469bb8a990fd03adbad0ce7bf168471efd0 | /src/componentes/TextFieldNumeros.java | 68fe7cca2bc32c46758e11f7c3baa0d63221c994 | [] | no_license | GonzaloBeloso/ClaseCorreo | 114355a31e91ca00927d7d9a98ea747d084c4c20 | b0d1794b81d4b26aa489d85a3bc0a505749cc8ad | refs/heads/master | 2020-09-07T15:31:23.330591 | 2019-11-10T17:57:06 | 2019-11-10T17:57:06 | 220,828,118 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,031 | java | package componentes;
import javax.swing.*;
import java.awt.event.*;
public class TextFieldNumeros extends JTextField
implements KeyListener, FocusListener {
String hint;
public TextFieldNumeros(String text, int columns) {
super(text, columns);
this.hint = text;
this.addFocusListener(this);
this.addKeyListener(this);
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if (Character.isDigit(e.getKeyChar())){
System.out.println("es digito");
}else {
System.out.println("no es digito");
}
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void focusGained(FocusEvent e) {
if (this.getText().equals(hint)){
this.setText("");
}
}
@Override
public void focusLost(FocusEvent e) {
if (this.getText().length() == 0) {
this.setText(hint);
}
}
} | [
"gonzalobelosocuesta@gmail.com"
] | gonzalobelosocuesta@gmail.com |
339ba4d9277a35f6f190418b669ca492e441668d | ff1b01a0acdf9f5dd2cebebeb2690e76548ed5a5 | /app/src/main/java/com/tianjin/beichentiyu/presenter/contract/CompetitionInfoContract.java | 4fe7b82aa2c4ca7b7c0a484007682b3f7e37cff5 | [] | no_license | RusselCK/HongQiaoTiYu | 03bb789d8f7332628219ea60215aa8fcd628b1a9 | ab9a4298647ee056047bf84ab342b99a2f2f35bb | refs/heads/master | 2023-07-12T13:01:14.216522 | 2021-08-19T16:52:54 | 2021-08-19T16:52:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package com.tianjin.beichentiyu.presenter.contract;
import com.heitong.frame.base.presenter.impl.IPresenter;
import com.heitong.frame.base.presenter.impl.IView;
import com.tianjin.beichentiyu.bean.ArtileMsgBean;
public class CompetitionInfoContract {
public interface View extends IView {
/**
* 添加数据
* @param bean
*/
void addData(ArtileMsgBean bean);
}
public interface Presenter extends IPresenter {
void loadArtileMsg(String aId);
}
}
| [
"413767955@qq.com"
] | 413767955@qq.com |
1c121e619f2cb3bedf9842d85085de7047ed2185 | 53b71b2f540e35631d54050b13412e6c714eb91a | /src/main/java/pl/springproject/twitter_app/domain/CustomUserDetails.java | 80bd15be8b4a8799c84b44780a14d62ac2767148 | [] | no_license | ven2day/TwitterApp | 34197fa562c8a84b05c33d357e502380e6ac2acc | c27af059000a33ceaf574e0973aefaa0dd8dedc0 | refs/heads/master | 2021-10-02T18:02:59.323856 | 2018-11-29T23:21:14 | 2018-11-29T23:21:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,239 | java | package pl.springproject.twitter_app.domain;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
import java.util.stream.Collectors;
public class CustomUserDetails extends User implements UserDetails {
public CustomUserDetails(final User user) {
super(user);
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return getRoles()
.stream()
.map(role -> new SimpleGrantedAuthority("ROLE_" + role))
.collect(Collectors.toList());
}
@Override
public String getPassword() {
return super.getPassword();
}
@Override
public String getUsername() {
return super.getUsername();
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
| [
"michal.lipski2@gmail.com"
] | michal.lipski2@gmail.com |
9bf60102dc351eff5f73b4eedf9da122046e7589 | e6a51d7f7a7a20a406a09aad980fb2ffbb7709f4 | /dist/game/data/scripts/handlers/admincommandhandlers/AdminSkill.java | 5980104951aadd818a82015b2ce2345279a8ea43 | [] | no_license | cucky/l2j_datapack_custom | c1dee98d34cf2f09260253f7e1d5b0234a1cb3b7 | 423a6b648d53bb4f6a4d40e517da1bf07a52ef12 | refs/heads/master | 2021-01-19T17:23:01.871185 | 2017-03-05T09:46:07 | 2017-03-05T09:46:07 | 82,452,576 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,572 | java | /*
* Copyright (C) 2004-2015 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J DataPack 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, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.impl.ClassListData;
import com.l2jserver.gameserver.data.xml.impl.SkillTreesData;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
import com.l2jserver.gameserver.model.L2Clan;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2SkillLearn;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
import com.l2jserver.gameserver.network.serverpackets.PledgeSkillList;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.util.StringUtil;
/**
* This class handles following admin commands:
* <ul>
* <li>show_skills</li>
* <li>remove_skills</li>
* <li>skill_list</li>
* <li>skill_index</li>
* <li>add_skill</li>
* <li>remove_skill</li>
* <li>get_skills</li>
* <li>reset_skills</li>
* <li>give_all_skills</li>
* <li>give_all_skills_fs</li>
* <li>admin_give_all_clan_skills</li>
* <li>remove_all_skills</li>
* <li>add_clan_skills</li>
* <li>admin_setskill</li>
* </ul>
* @version 2012/02/26 Small fixes by Zoey76 05/03/2011
*/
public class AdminSkill implements IAdminCommandHandler
{
private static Logger _log = Logger.getLogger(AdminSkill.class.getName());
private static final String[] ADMIN_COMMANDS =
{
"admin_show_skills",
"admin_remove_skills",
"admin_skill_list",
"admin_skill_index",
"admin_add_skill",
"admin_remove_skill",
"admin_get_skills",
"admin_reset_skills",
"admin_give_all_skills",
"admin_give_all_skills_fs",
"admin_give_clan_skills",
"admin_give_all_clan_skills",
"admin_remove_all_skills",
"admin_add_clan_skill",
"admin_setskill"
};
private static Skill[] adminSkills;
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_show_skills"))
{
showMainPage(activeChar);
}
else if (command.startsWith("admin_remove_skills"))
{
try
{
String val = command.substring(20);
removeSkillsPage(activeChar, Integer.parseInt(val));
}
catch (StringIndexOutOfBoundsException e)
{
}
}
else if (command.startsWith("admin_skill_list"))
{
AdminHtml.showAdminHtml(activeChar, "skills.htm");
}
else if (command.startsWith("admin_skill_index"))
{
try
{
String val = command.substring(18);
AdminHtml.showAdminHtml(activeChar, "skills/" + val + ".htm");
}
catch (StringIndexOutOfBoundsException e)
{
}
}
else if (command.startsWith("admin_add_skill"))
{
try
{
String val = command.substring(15);
adminAddSkill(activeChar, val);
}
catch (Exception e)
{
activeChar.sendMessage("Usage: //add_skill <skill_id> <level>");
}
}
else if (command.startsWith("admin_remove_skill"))
{
try
{
String id = command.substring(19);
int idval = Integer.parseInt(id);
adminRemoveSkill(activeChar, idval);
}
catch (Exception e)
{
activeChar.sendMessage("Usage: //remove_skill <skill_id>");
}
}
else if (command.equals("admin_get_skills"))
{
adminGetSkills(activeChar);
}
else if (command.equals("admin_reset_skills"))
{
adminResetSkills(activeChar);
}
else if (command.equals("admin_give_all_skills"))
{
adminGiveAllSkills(activeChar, false);
}
else if (command.equals("admin_give_all_skills_fs"))
{
adminGiveAllSkills(activeChar, true);
}
else if (command.equals("admin_give_clan_skills"))
{
adminGiveClanSkills(activeChar, false);
}
else if (command.equals("admin_give_all_clan_skills"))
{
adminGiveClanSkills(activeChar, true);
}
else if (command.equals("admin_remove_all_skills"))
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
return false;
}
final L2PcInstance player = target.getActingPlayer();
for (Skill skill : player.getAllSkills())
{
player.removeSkill(skill);
}
activeChar.sendMessage("You have removed all skills from " + player.getName() + ".");
player.sendMessage("Admin removed all skills from you.");
player.sendSkillList();
player.broadcastUserInfo();
}
else if (command.startsWith("admin_add_clan_skill"))
{
try
{
String[] val = command.split(" ");
adminAddClanSkill(activeChar, Integer.parseInt(val[1]), Integer.parseInt(val[2]));
}
catch (Exception e)
{
activeChar.sendMessage("Usage: //add_clan_skill <skill_id> <level>");
}
}
else if (command.startsWith("admin_setskill"))
{
String[] split = command.split(" ");
int id = Integer.parseInt(split[1]);
int lvl = Integer.parseInt(split[2]);
Skill skill = SkillData.getInstance().getSkill(id, lvl);
activeChar.addSkill(skill);
activeChar.sendSkillList();
activeChar.sendMessage("You added yourself skill " + skill.getName() + "(" + id + ") level " + lvl);
}
return true;
}
/**
* This function will give all the skills that the target can learn at his/her level
* @param activeChar the active char
* @param includedByFs if {@code true} Forgotten Scroll skills will be delivered.
*/
private void adminGiveAllSkills(L2PcInstance activeChar, boolean includedByFs)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
return;
}
final L2PcInstance player = target.getActingPlayer();
// Notify player and admin
activeChar.sendMessage("You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
player.sendSkillList();
}
/**
* This function will give all the skills that the target's clan can learn at it's level.<br>
* If the target is not the clan leader, a system message will be sent to the Game Master.
* @param activeChar the active char, probably a Game Master.
* @param includeSquad if Squad skills is included
*/
private void adminGiveClanSkills(L2PcInstance activeChar, boolean includeSquad)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
return;
}
final L2PcInstance player = target.getActingPlayer();
final L2Clan clan = player.getClan();
if (clan == null)
{
activeChar.sendPacket(SystemMessageId.TARGET_MUST_BE_IN_CLAN);
return;
}
if (!player.isClanLeader())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_IS_NOT_A_CLAN_LEADER);
sm.addString(player.getName());
activeChar.sendPacket(sm);
}
final Map<Integer, L2SkillLearn> skills = SkillTreesData.getInstance().getMaxPledgeSkills(clan, includeSquad);
for (L2SkillLearn s : skills.values())
{
clan.addNewSkill(SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()));
}
// Notify target and active char
clan.broadcastToOnlineMembers(new PledgeSkillList(clan));
for (L2PcInstance member : clan.getOnlineMembers(0))
{
member.sendSkillList();
}
activeChar.sendMessage("You gave " + skills.size() + " skills to " + player.getName() + "'s clan " + clan.getName() + ".");
player.sendMessage("Your clan received " + skills.size() + " skills.");
}
/**
* TODO: Externalize HTML
* @param activeChar the active Game Master.
* @param page
*/
private void removeSkillsPage(L2PcInstance activeChar, int page)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
return;
}
final L2PcInstance player = target.getActingPlayer();
final Skill[] skills = player.getAllSkills().toArray(new Skill[player.getAllSkills().size()]);
int maxSkillsPerPage = 10;
int maxPages = skills.length / maxSkillsPerPage;
if (skills.length > (maxSkillsPerPage * maxPages))
{
maxPages++;
}
if (page > maxPages)
{
page = maxPages;
}
int skillsStart = maxSkillsPerPage * page;
int skillsEnd = skills.length;
if ((skillsEnd - skillsStart) > maxSkillsPerPage)
{
skillsEnd = skillsStart + maxSkillsPerPage;
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
final StringBuilder replyMSG = StringUtil.startAppend(500 + (maxPages * 50) + (((skillsEnd - skillsStart) + 1) * 50), "<html><body>" + "<table width=260><tr>" + "<td width=40><button value=\"Main\" action=\"bypass -h admin_admin\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "<td width=180><center>Character Selection Menu</center></td>" + "<td width=40><button value=\"Back\" action=\"bypass -h admin_show_skills\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>" + "</tr></table>" + "<br><br>" + "<center>Editing <font color=\"LEVEL\">", player.getName(), "</font></center>" + "<br><table width=270><tr><td>Lv: ", String.valueOf(player.getLevel()), " ", ClassListData.getInstance().getClass(player.getClassId()).getClientCode(), "</td></tr></table>" + "<br><table width=270><tr><td>Note: Dont forget that modifying players skills can</td></tr>" + "<tr><td>ruin the game...</td></tr></table>" + "<br><center>Click on the skill you wish to remove:</center>" + "<br>" + "<center><table width=270><tr>");
for (int x = 0; x < maxPages; x++)
{
int pagenr = x + 1;
StringUtil.append(replyMSG, "<td><a action=\"bypass -h admin_remove_skills ", String.valueOf(x), "\">Page ", String.valueOf(pagenr), "</a></td>");
}
replyMSG.append("</tr></table></center>" + "<br><table width=270>" + "<tr><td width=80>Name:</td><td width=60>Level:</td><td width=40>Id:</td></tr>");
for (int i = skillsStart; i < skillsEnd; i++)
{
StringUtil.append(replyMSG, "<tr><td width=80><a action=\"bypass -h admin_remove_skill ", String.valueOf(skills[i].getId()), "\">", skills[i].getName(), "</a></td><td width=60>", String.valueOf(skills[i].getLevel()), "</td><td width=40>", String.valueOf(skills[i].getId()), "</td></tr>");
}
replyMSG.append("</table>" + "<br><center><table>" + "Remove skill by ID :" + "<tr><td>Id: </td>" + "<td><edit var=\"id_to_remove\" width=110></td></tr>" + "</table></center>" + "<center><button value=\"Remove skill\" action=\"bypass -h admin_remove_skill $id_to_remove\" width=110 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>" + "<br><center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center>" + "</body></html>");
adminReply.setHtml(replyMSG.toString());
activeChar.sendPacket(adminReply);
}
/**
* @param activeChar the active Game Master.
*/
private void showMainPage(L2PcInstance activeChar)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
return;
}
final L2PcInstance player = target.getActingPlayer();
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/charskills.htm");
adminReply.replace("%name%", player.getName());
adminReply.replace("%level%", String.valueOf(player.getLevel()));
adminReply.replace("%class%", ClassListData.getInstance().getClass(player.getClassId()).getClientCode());
activeChar.sendPacket(adminReply);
}
/**
* @param activeChar the active Game Master.
*/
private void adminGetSkills(L2PcInstance activeChar)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
return;
}
final L2PcInstance player = target.getActingPlayer();
if (player.getName().equals(activeChar.getName()))
{
player.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF);
}
else
{
Skill[] skills = player.getAllSkills().toArray(new Skill[player.getAllSkills().size()]);
adminSkills = activeChar.getAllSkills().toArray(new Skill[activeChar.getAllSkills().size()]);
for (Skill skill : adminSkills)
{
activeChar.removeSkill(skill);
}
for (Skill skill : skills)
{
activeChar.addSkill(skill, true);
}
activeChar.sendMessage("You now have all the skills of " + player.getName() + ".");
activeChar.sendSkillList();
}
showMainPage(activeChar);
}
/**
* @param activeChar the active Game Master.
*/
private void adminResetSkills(L2PcInstance activeChar)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
return;
}
final L2PcInstance player = target.getActingPlayer();
if (adminSkills == null)
{
activeChar.sendMessage("You must get the skills of someone in order to do this.");
}
else
{
Skill[] skills = player.getAllSkills().toArray(new Skill[player.getAllSkills().size()]);
for (Skill skill : skills)
{
player.removeSkill(skill);
}
for (Skill skill : activeChar.getAllSkills())
{
player.addSkill(skill, true);
}
for (Skill skill : skills)
{
activeChar.removeSkill(skill);
}
for (Skill skill : adminSkills)
{
activeChar.addSkill(skill, true);
}
player.sendMessage("[GM]" + activeChar.getName() + " updated your skills.");
activeChar.sendMessage("You now have all your skills back.");
adminSkills = null;
activeChar.sendSkillList();
player.sendSkillList();
}
showMainPage(activeChar);
}
/**
* @param activeChar the active Game Master.
* @param val
*/
private void adminAddSkill(L2PcInstance activeChar, String val)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
showMainPage(activeChar);
return;
}
final L2PcInstance player = target.getActingPlayer();
final StringTokenizer st = new StringTokenizer(val);
if (st.countTokens() != 2)
{
showMainPage(activeChar);
}
else
{
Skill skill = null;
try
{
String id = st.nextToken();
String level = st.nextToken();
int idval = Integer.parseInt(id);
int levelval = Integer.parseInt(level);
skill = SkillData.getInstance().getSkill(idval, levelval);
}
catch (Exception e)
{
_log.log(Level.WARNING, "", e);
}
if (skill != null)
{
String name = skill.getName();
// Player's info.
player.sendMessage("Admin gave you the skill " + name + ".");
player.addSkill(skill, true);
player.sendSkillList();
// Admin info.
activeChar.sendMessage("You gave the skill " + name + " to " + player.getName() + ".");
if (Config.DEBUG)
{
_log.fine("[GM]" + activeChar.getName() + " gave skill " + name + " to " + player.getName() + ".");
}
activeChar.sendSkillList();
}
else
{
activeChar.sendMessage("Error: there is no such skill.");
}
showMainPage(activeChar); // Back to start
}
}
/**
* @param activeChar the active Game Master.
* @param idval
*/
private void adminRemoveSkill(L2PcInstance activeChar, int idval)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
return;
}
final L2PcInstance player = target.getActingPlayer();
Skill skill = SkillData.getInstance().getSkill(idval, player.getSkillLevel(idval));
if (skill != null)
{
String skillname = skill.getName();
player.sendMessage("Admin removed the skill " + skillname + " from your skills list.");
player.removeSkill(skill);
// Admin information
activeChar.sendMessage("You removed the skill " + skillname + " from " + player.getName() + ".");
if (Config.DEBUG)
{
_log.fine("[GM]" + activeChar.getName() + " removed skill " + skillname + " from " + player.getName() + ".");
}
activeChar.sendSkillList();
}
else
{
activeChar.sendMessage("Error: there is no such skill.");
}
removeSkillsPage(activeChar, 0); // Back to previous page
}
/**
* @param activeChar the active Game Master.
* @param id
* @param level
*/
private void adminAddClanSkill(L2PcInstance activeChar, int id, int level)
{
final L2Object target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
showMainPage(activeChar);
return;
}
final L2PcInstance player = target.getActingPlayer();
if (!player.isClanLeader())
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_IS_NOT_A_CLAN_LEADER);
sm.addString(player.getName());
activeChar.sendPacket(sm);
showMainPage(activeChar);
return;
}
if ((id < 370) || (id > 391) || (level < 1) || (level > 3))
{
activeChar.sendMessage("Usage: //add_clan_skill <skill_id> <level>");
showMainPage(activeChar);
return;
}
final Skill skill = SkillData.getInstance().getSkill(id, level);
if (skill == null)
{
activeChar.sendMessage("Error: there is no such skill.");
return;
}
String skillname = skill.getName();
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.CLAN_SKILL_S1_ADDED);
sm.addSkillName(skill);
player.sendPacket(sm);
final L2Clan clan = player.getClan();
clan.broadcastToOnlineMembers(sm);
clan.addNewSkill(skill);
activeChar.sendMessage("You gave the Clan Skill: " + skillname + " to the clan " + clan.getName() + ".");
clan.broadcastToOnlineMembers(new PledgeSkillList(clan));
for (L2PcInstance member : clan.getOnlineMembers(0))
{
member.sendSkillList();
}
showMainPage(activeChar);
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
}
| [
"Michal@Michal"
] | Michal@Michal |
1f87fe8dc944f3a173ee9a29c6a9102844268231 | ae9d955f2c6ce16587c16893f8cace985d32d8c9 | /pdf4j/src/main/java/com/office/pdf4j/core/RowMapper.java | 01abacf7b8a7ab66b025f21fa93811fee8bf370e | [
"Apache-2.0"
] | permissive | qq359130530/office4j | c9c941014b0e8e588db9e161b1dfa9a43d9c607e | 5cc6acd6d7f0ef1988938ea3c74bfdf54731ffb0 | refs/heads/master | 2022-06-12T23:51:30.652311 | 2022-05-26T02:19:24 | 2022-05-26T02:19:24 | 140,806,010 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 307 | java | package com.office.pdf4j.core;
/**
* 行映射器
*
* @since 2018年7月2日
* @author 赵凡
* @version 1.0
*
*/
public interface RowMapper<T> {
/**
* 行映射
*
* @param rowObject
* rows中的实体对象
* @return 处理结果
*/
public String[] map(T rowObject);
}
| [
"zhaofan@mucang.cn"
] | zhaofan@mucang.cn |
6553709d7d64158e5eea109ee502a6d3a8f474b2 | 345e7859f89f42871d1171805002ed36c91da82a | /src/main/java/pl/wiktor/learning/api/dto/response/event/EventView.java | 40d5bc979d4c85d4a20d03fdf166ac3ae7ca0f8b | [] | no_license | metelskiwiktor/learning | d044ded3cb69c7945a02688f42e16a31856b2844 | 33ccabde1a69265b9d78f96e091b93213db01dd0 | refs/heads/master | 2022-12-19T18:11:07.168105 | 2020-09-04T07:56:18 | 2020-09-04T07:56:18 | 292,763,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package pl.wiktor.learning.api.dto.response.event;
import pl.wiktor.learning.api.dto.response.document.LightDocumentView;
import pl.wiktor.learning.domain.event.Type;
import java.time.LocalDateTime;
import java.util.List;
public class EventView {
private String id;
private LocalDateTime plannedAt;
private List<LightDocumentView> documents;
private Type type;
public EventView(String id, LocalDateTime plannedAt, List<LightDocumentView> documents, Type type) {
this.id = id;
this.plannedAt = plannedAt;
this.documents = documents;
this.type = type;
}
public String getId() {
return id;
}
public LocalDateTime getPlannedAt() {
return plannedAt;
}
public List<LightDocumentView> getDocuments() {
return documents;
}
public Type getType() {
return type;
}
}
| [
"metelski.wiktor@gmail.com"
] | metelski.wiktor@gmail.com |
d279b33d9071a9f03afde89a4a6f052a5f756521 | 22c562451c70418c0103c0f4492f0f33db26551f | /microservice-user/src/main/java/com/cn/lucky/morning/user/service/api/AccountServiceImpl.java | 2159a056847a256e39dc7b20468ad26c90ca55b5 | [
"Apache-2.0"
] | permissive | luckymorning/SpringBootNacosSeataDubboDemoProject | 8de5c493e387a78a0977bf20cb14a6f55a453d75 | 2e64c2e3fb109e7262bb3afb5e9d437f98033dce | refs/heads/main | 2023-08-25T07:08:10.951651 | 2021-10-20T15:24:02 | 2021-10-20T15:24:02 | 419,379,354 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 977 | java | package com.cn.lucky.morning.user.service.api;
import com.cn.lucky.morning.user.api.AccountService;
import com.cn.lucky.morning.user.entity.TblAccount;
import com.cn.lucky.morning.user.service.ITblAccountService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@DubboService
@Service
public class AccountServiceImpl implements AccountService {
@Autowired
private ITblAccountService tblAccountService;
@Override
public void debit(String userId, int money) {
TblAccount account = tblAccountService.getById(userId);
if (account == null) {
throw new RuntimeException("用户不存在");
}
account.setMoney(account.getMoney() - money);
if (account.getMoney() < 0) {
throw new RuntimeException("用户余额不足");
}
tblAccountService.updateById(account);
}
}
| [
"lucky_morning@163.com"
] | lucky_morning@163.com |
fd5a823d60acae7a60bbe2f3647923c7732969b1 | 33d6261fb8d118a965434deb9f588d601ccfe61e | /palo-gwt-widgets/src/com/tensegrity/palo/gwt/widgets/client/util/BorderSize.java | 305b520fc12eff94e8694467039e30a26810955a | [] | no_license | svn2github/SpagoBI-V4x | 8980656ec888782ea2ffb5a06ffa60b5c91849ee | b6cb536106644e446de2d974837ff909bfa73b58 | refs/heads/master | 2020-05-28T02:52:31.002963 | 2015-01-16T11:17:54 | 2015-01-16T11:17:54 | 10,394,712 | 3 | 6 | null | null | null | null | UTF-8 | Java | false | false | 1,638 | java | /*
*
* @file BorderSize.java
*
* Copyright (C) 2006-2009 Tensegrity Software GmbH
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as published
* by the Free Software Foundation at http://www.gnu.org/copyleft/gpl.html.
*
* 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., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*
* If you are developing and distributing open source applications under the
* GPL License, then you are free to use JPalo Modules under the GPL License. For OEMs,
* ISVs, and VARs who distribute JPalo Modules with their products, and do not license
* and distribute their source code under the GPL, Tensegrity provides a flexible
* OEM Commercial License.
*
* @author Philipp Bouillon <Philipp.Bouillon@tensegrity-software.com>
*
* @version $Id: BorderSize.java,v 1.2 2009/12/17 16:14:15 PhilippBouillon Exp $
*
*/
package com.tensegrity.palo.gwt.widgets.client.util;
public class BorderSize {
public int left;
public int right;
public int top;
public int bottom;
public BorderSize(int left, int right, int top, int bottom) {
this.left = left;
this.right = right;
this.top = top;
this.bottom = bottom;
}
}
| [
"franceschini@99afaf0d-6903-0410-885a-c66a8bbb5f81"
] | franceschini@99afaf0d-6903-0410-885a-c66a8bbb5f81 |
aa0b42377a8dbf14ef7d8df7a7c20c7c236f45bb | ce79acc880d5f484b20e7eaef6f20795599079af | /web-service/sellnbye/src/main/java/com/paf/n3ag6/services/AddToCardService.java | 64134671adba663b52ff48eeb1bcd0459629c239 | [] | no_license | yasas1996/PAF-online | 32135aaab36a5673e2182e5e62be7fdb9b93bfa1 | 5e439ec3b1fba34a4ed2e0ddb087566223a09620 | refs/heads/master | 2022-07-12T04:39:35.381859 | 2019-05-25T17:15:39 | 2019-05-25T17:15:39 | 188,592,876 | 0 | 0 | null | 2022-06-21T01:10:20 | 2019-05-25T17:10:54 | HTML | UTF-8 | Java | false | false | 2,450 | java | package com.paf.n3ag6.services;
import java.awt.PageAttributes.MediaType;
import java.util.ArrayList;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import com.paf.n3ag6.dao.AddToCardDao;
import com.paf.n3ag6.dao.ItemDao;
import com.paf.n3ag6.models.AddToCard;
import com.paf.n3ag6.models.Item;
@Path("/card")
public class AddToCardService {
@GET
@Path("/getItemList")
@Produces(MediaType.APPLICATION_JSON)
public ArrayList<Item> GetItemList() {
ItemDao itemDao = new ItemDao();
try {
ArrayList<Item> itemList = new ArrayList<Item>();
itemList = itemDao.getAllItems();
return itemList;
} finally {
itemDao.dispose();
}
}
@GET
@Path("/getAllCardItems/{userId}")
@Produces(MediaType.APPLICATION_JSON)
public ArrayList<Item> GetAllCardItems(@PathParam("userId") int userId) {
AddToCardDao addTocardDao=new AddToCardDao();
ItemDao itemDao = new ItemDao();
try {
ArrayList<Item> itemList = new ArrayList<Item>();
itemList = addTocardDao.getAllCardItems(userId);
return itemList;
} finally {
itemDao.dispose();
}
}
@POST
@Path("/add/{item_id}/{user_id}/{quantity}")
@Produces(MediaType.APPLICATION_JSON)
public Response AddItemToCard(@PathParam("item_id") int item_id, @PathParam("user_id") int user_id,@PathParam("quantity") int quantity) {
AddToCardDao addTocardDao=new AddToCardDao();
ItemDao itemDao=new ItemDao();
Item item=itemDao.getItem(item_id);
AddToCard addToCard=new AddToCard();
addToCard.setItem_id(item_id);
addToCard.setQuantity(quantity);
addToCard.setUserId(user_id);
addToCard.setTotal_price(0);
if(addTocardDao.addItemToCard(addToCard)) {
return Response.status(200).entity("Added successfully").build();
}
else {
return Response.status(404).entity("Failure to add in card").build();
}
}
@DELETE
@Path("/removeItemFromCard/{item_id}/{user_id}")
@Produces(MediaType.APPLICATION_JSON)
public Response RemoveItemFromCard(@PathParam("item_id") int item_id, @PathParam("user_id") int user_id) {
AddToCardDao addTocard=new AddToCardDao();
if(addTocard.removeItemFromCard(item_id, user_id)) {
return Response.status(200).entity("Remove successfully").build();
}
else {
return Response.status(404).entity("Item Id / user not available in add to card").build();
}
}
}
| [
"sandeepabanuka@gmail.com"
] | sandeepabanuka@gmail.com |
32f522b8a90e032ea9d85994cc7b7aa53045a71d | 6240737a2cf5a7720a0f44e477910d961af4eb3c | /src/main/java/ru/mail/polis/kvstorage/MyService.java | 3f837c284376146896f29069301ee4ce05cb52cb | [
"Apache-2.0"
] | permissive | PavelKushnar/2018-highload-kv | 1fafc66e8d271aed3b69518b4eb11842f9538f19 | 30722e05627dee299f81a82f99850663cc676767 | refs/heads/master | 2020-04-20T11:32:04.970631 | 2019-02-04T20:12:38 | 2019-02-04T20:12:38 | 168,819,094 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,200 | java | package ru.mail.polis.kvstorage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import one.nio.http.HttpClient;
import one.nio.http.HttpServer;
import one.nio.http.HttpServerConfig;
import one.nio.http.HttpSession;
import one.nio.http.Path;
import one.nio.http.Request;
import one.nio.http.Response;
import one.nio.net.ConnectionString;
import ru.mail.polis.KVDao;
import ru.mail.polis.KVService;
public class MyService extends HttpServer implements KVService{
public final static String STATUS_ENDPOINT = "/v0/status";
public final static String STORAGE_ENDPOINT = "/v0/entity";
public final static String ID_PARAMETER = "id=";
public final static String REPLICAS_PARAMETER = "replicas=";
public final static String QUERY_FROM_REPLICA = "from-replica";
public final static String UPDATED_VALUE_HEADER = "updated: ";
public final int STATUS_SUCCESS_GET = 200;
public final int STATUS_SUCCESS_PUT = 201;
public final int STATUS_SUCCESS_DELETE = 202;
public final int STATUS_NOT_FOUND = 404;
private final Set<String> topology;
private final List<String> topologyList;
private final Map<String, HttpClient> clients;
private final MyDAO dao;
private final String myHost;
public MyService(HttpServerConfig config, KVDao dao, Set<String> topology) throws IOException{
super(config);
this.topology = topology;
this.topologyList = new ArrayList<>(topology);
this.dao = (MyDAO)dao;
myHost = "http://localhost:" + config.acceptors[0].port;
clients = new HashMap<>();
for (String host : topology){
if (!host.equals(myHost)){
clients.put(host, new HttpClient(new ConnectionString(host)));
}
}
}
@Path(MyService.STATUS_ENDPOINT)
public Response statusEndpoint(Request request){
return Response.ok(Response.EMPTY);
}
@Path(MyService.STORAGE_ENDPOINT)
public Response storageEndpoint(Request request){
try {
switch (request.getMethod()){
case Request.METHOD_GET:
return handleGet(request);
case Request.METHOD_PUT:
return handlePut(request);
case Request.METHOD_DELETE:
return handleDelete(request);
}
} catch (IllegalArgumentException e){
return createBadRequestResponse();
}
return createInternalErrorResponse();
}
@Override
public void handleDefault(Request request, HttpSession session) throws IOException {
session.sendResponse(createBadRequestResponse());
}
private Response handleGet(Request request) throws IllegalArgumentException{
byte[] key = getKey(request);
if (fromReplica(request)){
Response response;
try{
response = new Response(Response.OK, dao.get(key));
} catch (NoSuchElementException e) {
response = createNotFoundResponse();
} catch (IOException e) {
e.printStackTrace();
response = createInternalErrorResponse();
}
long time = dao.getTime(key);
if (time > 0) {
response.addHeader(UPDATED_VALUE_HEADER + time);
}
return response;
} else{
AckFrom ackFrom = new AckFrom(request);
TopologyStrategy.GetTopologyStrategy strategy = new TopologyStrategy.GetTopologyStrategy(ackFrom.ack, ackFrom.from);
for (String host : getHostsForKey(key, ackFrom.from)){
if (host.equals(myHost)) {
try {
strategy.addValue(dao.getTime(key), dao.get(key));
strategy.addSuccess();
} catch (NoSuchElementException e) {
long time = dao.getTime(key);
if (time > 0){
strategy.addDeleted();
} else {
strategy.addNotFound();
}
} catch (IOException e) {
e.printStackTrace();
}
} else{
try {
Response response = clients.get(host).get(request.getURI(), QUERY_FROM_REPLICA);
String timeStr = response.getHeader(UPDATED_VALUE_HEADER);
Long time = null;
if (timeStr != null) {
time = Long.parseLong(timeStr);
}
if (response.getStatus() == STATUS_SUCCESS_GET){
strategy.addSuccess();
strategy.addValue(Long.parseLong(response.getHeader(UPDATED_VALUE_HEADER)), response.getBody());
} else if (response.getStatus() == STATUS_NOT_FOUND){
if (time != null) {
strategy.addDeleted();
} else {
strategy.addNotFound();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return strategy.getResponse();
}
}
private Response handlePut(Request request) throws IllegalArgumentException{
byte[] key = getKey(request);
byte[] value = request.getBody();
if (fromReplica(request)){
Response response;
try {
dao.upsert(key, value);
response = createSuccessPutResponse();
} catch (IOException e){
e.printStackTrace();
response = createInternalErrorResponse();
}
return response;
} else{
AckFrom ackFrom = new AckFrom(request);
TopologyStrategy.PutTopologyStrategy strategy = new TopologyStrategy.PutTopologyStrategy(ackFrom.ack, ackFrom.from);
for (String host : getHostsForKey(key, ackFrom.from)){
if (host.equals(myHost)){
try {
dao.upsert(key, value);
strategy.addSuccess();
} catch (IOException e){
e.printStackTrace();
}
} else{
try {
Response response = clients.get(host).put(request.getURI(), value, QUERY_FROM_REPLICA);
if (response.getStatus() == STATUS_SUCCESS_PUT){
strategy.addSuccess();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return strategy.getResponse();
}
}
private Response handleDelete(Request request) throws IllegalArgumentException{
byte[] key = getKey(request);
if (fromReplica(request)){
Response response;
try {
dao.remove(key);
response = createSuccessDeleteResponse();
} catch (IOException e){
e.printStackTrace();
response = createInternalErrorResponse();
}
return response;
} else{
AckFrom ackFrom = new AckFrom(request);
TopologyStrategy.DeleteTopologyStrategy strategy = new TopologyStrategy.DeleteTopologyStrategy(ackFrom.ack, ackFrom.from);
for (String host : getHostsForKey(key, ackFrom.from)){
if (host.equals(myHost)){
try {
dao.remove(key);
strategy.addSuccess();
} catch (IOException e) {
e.printStackTrace();
}
} else{
try {
Response response = clients.get(host).delete(request.getURI(), QUERY_FROM_REPLICA);
if (response.getStatus() == STATUS_SUCCESS_DELETE){
strategy.addSuccess();
}
} catch (Exception e){
e.printStackTrace();
}
}
}
return strategy.getResponse();
}
}
private byte[] getKey(Request request) throws IllegalArgumentException{
String id = request.getParameter(ID_PARAMETER);
if (id == null || id.isEmpty()){
throw new IllegalArgumentException();
}
return id.getBytes();
}
private List<String> getHostsForKey(byte[] key, int from){
int hash = 0;
for (byte k : key){
hash += k;
}
int index = Math.abs(hash);
int hostsCount = topologyList.size();
List<String> hosts = new ArrayList<>(from);
for (int i = index + from; i > index; i--){
hosts.add(topologyList.get(i % hostsCount));
}
return hosts;
}
private boolean fromReplica(Request request){
return request.getHeader(QUERY_FROM_REPLICA) != null;
}
private class AckFrom{
final int ack;
final int from;
public AckFrom(Request request) throws IllegalArgumentException{
String replicas = request.getParameter(REPLICAS_PARAMETER);
if (replicas == null){
int size = topology.size();
this.ack = size / 2 + 1;
this.from = size;
} else {
try {
String[] split = replicas.split("/");
int ack = Integer.parseInt(split[0]);
int from = Integer.parseInt(split[1]);
if (ack < 1 || ack > from){
throw new Exception();
}
this.ack = ack;
this.from = from;
} catch (Exception e){
throw new IllegalArgumentException();
}
}
}
}
public static Response createNotEnoughReplicaResponse(){
return new Response(Response.GATEWAY_TIMEOUT, Response.EMPTY);
}
public static Response createSuccessPutResponse(){
return new Response(Response.CREATED, Response.EMPTY);
}
public static Response createSuccessDeleteResponse(){
return new Response(Response.ACCEPTED, Response.EMPTY);
}
public static Response createBadRequestResponse(){
return new Response(Response.BAD_REQUEST, Response.EMPTY);
}
public static Response createNotFoundResponse(){
return new Response(Response.NOT_FOUND, Response.EMPTY);
}
public static Response createInternalErrorResponse(){
return new Response(Response.INTERNAL_ERROR, Response.EMPTY);
}
}
| [
"bratko1081@gmail.com"
] | bratko1081@gmail.com |
90739a926a7a7051ac154dcd244ef0e643e82122 | a10264bfcd738242f4806d4687549a647907f4bd | /bbs_server/src/main/java/com/jmu/server/mapper/ArticleExtMapper.java | 4a129a6a3d7279d08093baad0e2d7d8b709d7f6a | [] | no_license | zjmu/community_forum | dd63bc17954575d9b60df63f55eef25b21cb92f2 | d92e9f5a98b5369eb168a7be49bf20ea172dbed9 | refs/heads/master | 2023-03-07T18:57:35.333397 | 2020-05-10T08:52:15 | 2020-05-10T08:52:15 | 262,746,436 | 0 | 0 | null | 2023-02-22T08:28:28 | 2020-05-10T08:48:55 | Java | UTF-8 | Java | false | false | 757 | java | package com.jmu.server.mapper;
import org.apache.ibatis.annotations.Param;
import com.jmu.server.entity.ArticleExt;
import java.util.List;
public interface ArticleExtMapper {
int deleteByPrimaryKey(Long id);
int insert(ArticleExt record);
int insertSelective(ArticleExt record);
ArticleExt selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(ArticleExt record);
int updateByPrimaryKey(ArticleExt record);
int insertBatch(@Param("articleExts") List<ArticleExt> articleExts);
/**
* 通过article_id修改
*
* @param
* @return
* @author zhoujinmu (jinmu.zhou@ucarinc.com)
* @date 2020/1/13 16:12
* @since 1.0
*/
int updateByArticleIdSelective(ArticleExt record);
} | [
"870855698@qq.com"
] | 870855698@qq.com |
5674f95e8479c7bd3b3b4e1df88187c0d7c6241a | 1f58d05db1ef3f18671b2215631ccdc62f576eb3 | /kanon-common/src/main/java/com/github/kanon/common/xss/XssHttpServletRequestWrapper.java | 041a56c704d0c0a47f62149adc8b5c447913b066 | [] | no_license | 434713950/kanon | 6c44aa5040aaad48ce9f44a01f8a00b69dccbd6d | 74e390cc264ffe510c2faaf52f6d6b7540f5e87c | refs/heads/master | 2020-03-27T10:20:40.030756 | 2018-12-20T08:54:56 | 2018-12-20T08:54:56 | 146,413,213 | 7 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,005 | java | package com.github.kanon.common.xss;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import javax.servlet.ReadListener;
import javax.servlet.ServletInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* @Author: peng_cheng
* @Description: xss请求包装器
*/
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
/**
* 没被包装过的HttpServletRequest(特殊场景,需要自己过滤)
*/
HttpServletRequest orgRequest;
/**
* html过滤
*/
private final static HtmlFilter HTML_FILTER = new HtmlFilter();
public XssHttpServletRequestWrapper(HttpServletRequest request) {
super(request);
orgRequest = request;
}
@Override
public ServletInputStream getInputStream() throws IOException {
//非json类型,直接返回
if (!MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(super.getHeader(HttpHeaders.CONTENT_TYPE))) {
return super.getInputStream();
}
//为空,直接返回
String json = IOUtils.toString(super.getInputStream(), "utf-8");
if (StringUtils.isBlank(json)) {
return super.getInputStream();
}
//xss过滤
json = xssEncode(json);
final ByteArrayInputStream bis = new ByteArrayInputStream(json.getBytes("utf-8"));
return new ServletInputStream() {
@Override
public boolean isFinished() {
return true;
}
@Override
public boolean isReady() {
return true;
}
@Override
public void setReadListener(ReadListener readListener) {
}
@Override
public int read() {
return bis.read();
}
};
}
@Override
public String getParameter(String name) {
String value = super.getParameter(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return value;
}
@Override
public String[] getParameterValues(String name) {
String[] parameters = super.getParameterValues(name);
if (parameters == null || parameters.length == 0) {
return null;
}
for (int i = 0; i < parameters.length; i++) {
parameters[i] = xssEncode(parameters[i]);
}
return parameters;
}
@Override
public Map<String, String[]> getParameterMap() {
Map<String, String[]> map = new LinkedHashMap<>();
Map<String, String[]> parameters = super.getParameterMap();
for (String key : parameters.keySet()) {
String[] values = parameters.get(key);
for (int i = 0; i < values.length; i++) {
values[i] = xssEncode(values[i]);
}
map.put(key, values);
}
return map;
}
@Override
public String getHeader(String name) {
String value = super.getHeader(xssEncode(name));
if (StringUtils.isNotBlank(value)) {
value = xssEncode(value);
}
return value;
}
private String xssEncode(String input) {
return HTML_FILTER.filter(input);
}
/**
* 获取最原始的request
*/
public HttpServletRequest getOrgRequest() {
return orgRequest;
}
/**
* 获取最原始的request
*/
public static HttpServletRequest getOrgRequest(HttpServletRequest request) {
if (request instanceof XssHttpServletRequestWrapper) {
return ((XssHttpServletRequestWrapper) request).getOrgRequest();
}
return request;
}
}
| [
"434713950@qq.com"
] | 434713950@qq.com |
ca372a3bb090ee6f88baa889af3c16f90894d71c | 9a041a411792da5e7d741fe35cfad28d3fe51a23 | /no.ntnu.assignmentsystem.editor/src/no/ntnu/assignmentsystem/editor/TestHandler.java | 9c6cecc277fd125ab80da218f4b3ae65553b3231 | [
"MIT"
] | permissive | chrrasmussen/NTNU-Master-Project | f4eee0e1ea2e9767a8388799874f30f5f84a490f | e3d9bdeb1686fb3f3d748a5824766a14255c2b2d | refs/heads/master | 2020-04-08T12:29:17.585240 | 2014-09-08T19:43:39 | 2014-09-08T19:43:39 | 23,229,154 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,207 | java | package no.ntnu.assignmentsystem.editor;
import no.ntnu.assignmentsystem.editor.akka.AkkaCompletionRequestor;
import no.ntnu.assignmentsystem.editor.jdt.WorkspaceManager;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
public class TestHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
System.out.println("Testing system");
WorkspaceManager projectManager = new WorkspaceManager("PluginProject");
String packageName = "stateandbehavior";
String fileName = "Main.java";
String sourceCode = "package stateandbehavior;\n" +
"public class Main {\n" +
" public static void main(String[] args) {\n" +
" System.out.println(\"Hello, World3!\");\n" +
" }\n" +
"}\n";
try {
projectManager.updateSourceCode(packageName, fileName, sourceCode);
projectManager.codeCompletion(packageName, fileName, 110, new AkkaCompletionRequestor(null)); // Code completes after: System.out.
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
| [
"christian.rasmussen@me.com"
] | christian.rasmussen@me.com |
fbc3bed728065cc2d2fab874ca546036ef4548d7 | 63f6da9f11ba1e3c3b8996b4389e89bcae08cdfd | /src/main/java/com/baijiazm/tjblog/mapper/CommentMapper.java | 882ace549061a75adeb9ebc438afe47adf546602 | [] | no_license | BaiJiazm/TJBlog | 8f0bb126980dd6187fa612efbc8fd3ceca0e15c9 | af5e742ffec54bc7ac0b509ec4d85acbee5d83f2 | refs/heads/master | 2021-05-02T10:39:48.884656 | 2018-06-25T13:47:54 | 2018-06-25T13:47:54 | 120,760,734 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,332 | java | package com.baijiazm.tjblog.mapper;
import com.baijiazm.tjblog.model.entity.CommentEntity;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import java.util.List;
//CREATE TABLE `t_comment` (
// `id` int(10) unsigned NOT NULL AUTO_INCREMENT ,
// `content_id` int(10) unsigned DEFAULT '0' ,
// `created` int(10) unsigned DEFAULT '0' ,
// `author` varchar(200) DEFAULT NULL ,
// `author_id` int(10) unsigned DEFAULT '0' ,
// `owner_id` int(10) unsigned DEFAULT '0' ,
// `mail` varchar(200) DEFAULT NULL ,
// `url` varchar(200) DEFAULT NULL ,
// `ip` varchar(64) DEFAULT NULL ,
// `agent` varchar(200) DEFAULT NULL ,
// `content` text ,
// `type` varchar(16) DEFAULT 'comment' ,
// `status` varchar(16) DEFAULT 'approved' ,
// `parent` int(10) unsigned DEFAULT '0',
// PRIMARY KEY (`id`),
// KEY `content_id` (`content_id`),
// KEY `created` (`created`)
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@Component
public interface CommentMapper {
String selectCommentsOrderByCreatedDesc = "select * from t_comment " +
" order by created desc limit #{limit} offset #{begin}";
@Select(selectCommentsOrderByCreatedDesc)
@Results(value = {
@Result(property = "contentId", column = "content_id"),
@Result(property = "authorId", column = "author_id"),
@Result(property = "ownerId", column = "owner_id"),
})
List<CommentEntity> selectCommentsOrderByCreatedDesc(@Param("begin") int begin,
@Param("limit") int limit);
String countByOwnerId = "select count(*) from t_comment where owner_id=#{ownerId} ";
@Select(countByOwnerId)
Long countByOwnerId(int ownerId);
String selectByUidOrderById = "select * from t_comment where owner_id=#{uid} order by id desc";
@Select(selectByUidOrderById)
@Results(value = {
@Result(property = "contentId", column = "content_id"),
@Result(property = "authorId", column = "author_id"),
@Result(property = "ownerId", column = "owner_id"),
})
List<CommentEntity> selectByUidOrderById(@Param("uid") String uid);
String selectApprovedByCidOrderById = "select * from t_comment where content_id=#{contentId} " +
" and status='approved' order by id desc";
@Select(selectApprovedByCidOrderById)
@Results(value = {
@Result(property = "contentId", column = "content_id"),
@Result(property = "authorId", column = "author_id"),
@Result(property = "ownerId", column = "owner_id"),
})
List<CommentEntity> selectApprovedByCidOrderById(@Param("contentId") String contentId);
String selectByPrimaryKey = "select * from t_comment where id=#{id}";
@Select(selectByPrimaryKey)
@Results(value = {
@Result(property = "contentId", column = "content_id"),
@Result(property = "authorId", column = "author_id"),
@Result(property = "ownerId", column = "owner_id"),
})
CommentEntity selectByPrimaryKey(@Param("id") Integer id);
String deleteByPrimaryKey = "delete from t_comment where id=#{id}";
@Delete(deleteByPrimaryKey)
void deleteByPrimaryKey(@Param("id") Integer id);
String insertOneComment = " insert into `t_comment` (`id`,`content_id`, `created`,`author` ," +
" `author_id`,`owner_id`,`mail` ,`url`," +
" `ip`,`agent` ,`content`,`type`,`status` ,`parent`) " +
" values( " +
" #{comment.id}, #{comment.contentId}, #{comment.created}, #{comment.author}, " +
" #{comment.authorId}, #{comment.ownerId}, #{comment.mail}, #{comment.url}, " +
" #{comment.ip}, #{comment.agent}, #{comment.content}, #{comment.type}, " +
" #{comment.status}, #{comment.parent} )";
@Insert(insertOneComment)
@Options(useGeneratedKeys = true, keyProperty = "comment.id")
void insertOneComment(@Param("comment") CommentEntity comment);
String updateStatus = "update t_comment set `status`=#{comment.status} " +
" where id=#{comment.id}";
@Update(updateStatus)
int updateStatus(@Param("comment") CommentEntity comment);
}
| [
"1481977509@qq.com"
] | 1481977509@qq.com |
07255b3033477e939f3df06b772bceb4623fc1ca | 628cf6fc211841dbb3f22e30e8b96562886c3724 | /tmp/org/eclipse/emf/ecore/xml/type/impl/AnyTypeImpl.java | 35a28b20ed2d788424108329f412cabb19c626e3 | [] | no_license | DylanYu/smatrt | ef4c54bf187762bc22407ea4d6e2e6c879072949 | c85baa4255d2e6792c1ed9b1e7e184860cdac9ad | refs/heads/master | 2016-09-06T04:46:19.998706 | 2013-07-20T10:03:29 | 2013-07-20T10:03:29 | 33,805,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,505 | java | /**
* <copyright>
*
* Copyright (c) 2003-2006 IBM Corporation and others.
* 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:
* IBM - Initial API and implementation
*
* </copyright>
*
* $Id: AnyTypeImpl.java,v 1.9 2007/02/20 17:40:49 emerks Exp $
*/
package org.eclipse.emf.ecore.xml.type.impl;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.EObjectImpl;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.ecore.xml.type.AnyType;
import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Any Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getMixed <em>Mixed</em>}</li>
* <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getAny <em>Any</em>}</li>
* <li>{@link org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl#getAnyAttribute <em>Any Attribute</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AnyTypeImpl extends EObjectImpl implements AnyType
{
/**
* The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMixed()
* @generated
* @ordered
*/
protected FeatureMap mixed;
/**
* The cached value of the '{@link #getAnyAttribute() <em>Any Attribute</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAnyAttribute()
* @generated
* @ordered
*/
protected FeatureMap anyAttribute;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AnyTypeImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XMLTypePackage.Literals.ANY_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FeatureMap getMixed()
{
if (mixed == null)
{
mixed = new BasicFeatureMap(this, XMLTypePackage.ANY_TYPE__MIXED);
}
return mixed;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FeatureMap getAny()
{
return (FeatureMap)getMixed().<FeatureMap.Entry>list(XMLTypePackage.Literals.ANY_TYPE__ANY);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FeatureMap getAnyAttribute()
{
if (anyAttribute == null)
{
anyAttribute = new BasicFeatureMap(this, XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE);
}
return anyAttribute;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XMLTypePackage.ANY_TYPE__MIXED:
return ((InternalEList<?>)getMixed()).basicRemove(otherEnd, msgs);
case XMLTypePackage.ANY_TYPE__ANY:
return ((InternalEList<?>)getAny()).basicRemove(otherEnd, msgs);
case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
return ((InternalEList<?>)getAnyAttribute()).basicRemove(otherEnd, msgs);
}
return eDynamicInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case XMLTypePackage.ANY_TYPE__MIXED:
if (coreType) return getMixed();
return ((FeatureMap.Internal)getMixed()).getWrapper();
case XMLTypePackage.ANY_TYPE__ANY:
if (coreType) return getAny();
return ((FeatureMap.Internal)getAny()).getWrapper();
case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
if (coreType) return getAnyAttribute();
return ((FeatureMap.Internal)getAnyAttribute()).getWrapper();
}
return eDynamicGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case XMLTypePackage.ANY_TYPE__MIXED:
((FeatureMap.Internal)getMixed()).set(newValue);
return;
case XMLTypePackage.ANY_TYPE__ANY:
((FeatureMap.Internal)getAny()).set(newValue);
return;
case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
((FeatureMap.Internal)getAnyAttribute()).set(newValue);
return;
}
eDynamicSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XMLTypePackage.ANY_TYPE__MIXED:
getMixed().clear();
return;
case XMLTypePackage.ANY_TYPE__ANY:
getAny().clear();
return;
case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
getAnyAttribute().clear();
return;
}
eDynamicUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XMLTypePackage.ANY_TYPE__MIXED:
return mixed != null && !mixed.isEmpty();
case XMLTypePackage.ANY_TYPE__ANY:
return !getAny().isEmpty();
case XMLTypePackage.ANY_TYPE__ANY_ATTRIBUTE:
return anyAttribute != null && !anyAttribute.isEmpty();
}
return eDynamicIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (mixed: ");
result.append(mixed);
result.append(", anyAttribute: ");
result.append(anyAttribute);
result.append(')');
return result.toString();
}
} //AnyTypeImpl
| [
"fafeysong@fb895ce6-3987-11de-a15a-d1801d6fabe8"
] | fafeysong@fb895ce6-3987-11de-a15a-d1801d6fabe8 |
dd473a94cebf60da2afee201383d1e9a20fed8d5 | f9145d97a88875859b9b2ddb166f8d7a68497272 | /app/src/main/java/ru/ianasimonenko/fragmentproject/Product34Activity.java | 358466a3f52cab07779ad5adc03ff6a47e3e46b6 | [] | no_license | iaanas/NPMartFourWeek | a828761fba20c1b69df1c6b03355fbf3c8290582 | 4dc86867c531b1430c64fd5552cbe2b157ab23b6 | refs/heads/master | 2020-05-01T10:43:59.852419 | 2019-03-24T13:35:32 | 2019-03-24T13:35:32 | 177,426,998 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,385 | java | package ru.ianasimonenko.fragmentproject;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import android.support.v7.widget.Toolbar;
import com.squareup.picasso.Picasso;
import java.util.Objects;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import ru.ianasimonenko.fragmentproject.Products.GenProducts;
import ru.ianasimonenko.fragmentproject.Products.Interface.ProductsClient;
import ru.ianasimonenko.fragmentproject.Products.Model24.Prod24Gen;
public class Product34Activity extends AppCompatActivity {
// private ListView listView;
// private View parentView;
// private List<GenProducts> prod34List;
// private ProdAdapter adapter;
// private ImageView image34;
private TextView name34;
private TextView price34;
private TextView grams34;
private TextView callories34;
private TextView description34;
private final Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl("https://naparah.olegb.ru/")
.addConverterFactory(GsonConverterFactory.create());
private final Retrofit retrofit = builder.build();
private final ProductsClient prod34 = retrofit.create(ProductsClient.class);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_prod_test);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Objects.requireNonNull(getSupportActionBar()).setHomeAsUpIndicator(R.drawable.ic_arrow_back_black_24dp);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
Button button = findViewById(R.id.btnToBusket);
button.setOnClickListener(v -> prodOnServer());
//Parsing JSON
Call<GenProducts> call = prod34.get24JSON();
call.enqueue(new Callback<GenProducts>() {
@Override
public void onResponse(@NonNull Call<GenProducts> call, @NonNull Response<GenProducts> response) {
if(response.isSuccessful()) {
Toast.makeText(Product34Activity.this, "Продукт успешно получен с сервера " + Objects.requireNonNull(response.body()).getDish().getName(),
Toast.LENGTH_SHORT).show();
Picasso.with(Product34Activity.this).load(String.valueOf(response.body().getDish().getImages().get(0))).placeholder(R.mipmap.ic_launcher).error(R.mipmap.ic_launcher).into(
(ImageView) findViewById(R.id.product_image));
// image34.setImageURI(Uri.parse(String.valueOf(response.body().getDish().getImages())));
name34 = findViewById(R.id.product_name);
name34.setText(response.body().getDish().getName());
price34 = findViewById(R.id.product_price);
String price = String.valueOf(response.body().getDish().getPrice()) + " p.";
price34.setText(price);
//
grams34 = findViewById(R.id.product_grams);
String grams = String.valueOf(response.body().getDish().getGrams()) + " гр.";
grams34.setText(grams);
//
callories34 = findViewById(R.id.product_calories);
String callories = String.valueOf(response.body().getDish().getCalories()) + " ккал";
callories34.setText(callories);
//
description34 = findViewById(R.id.product_description);
description34.setText(response.body().getDish().getDescription());
// prod34List = (List<GenProducts>) response.body().getDish();
//
// adapter = new ProdAdapter(Product34Activity.this, prod34List);
// listView.setAdapter(adapter);
}
}
@Override
public void onFailure(@NonNull Call<GenProducts> call, @NonNull Throwable t) {
}
});
}
private void prodOnServer() {
Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl("https://naparah.olegb.ru/")
.addConverterFactory(GsonConverterFactory.create());
Retrofit retrofit = builder.build();
ProductsClient userClient = retrofit.create(ProductsClient.class);
LoginActivity activity = new LoginActivity();
String accessToken = activity.getMyTokenFromLogin();
Call<Prod24Gen> call = userClient.prodToBusket(accessToken, null,97, null,"add");
call.enqueue(new Callback<Prod24Gen>() {
@Override
public void onResponse(@NonNull Call<Prod24Gen> call, @NonNull Response<Prod24Gen> response) {
if (response.isSuccessful()) {
Toast.makeText(Product34Activity.this, "ПРОДУКТ ДОБАВЛЕН В КОРЗИНУ НА СЕРВЕРЕ", Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(Product34Activity.this, "ПРОДУКТ НЕ ДОБАВЛЕН В КОРЗИНУ НА СЕРВЕРЕ", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(@NonNull Call<Prod24Gen> call, @NonNull Throwable t) {
Toast.makeText(Product34Activity.this, "ОШИБКА",
Toast.LENGTH_LONG).show();
}
});
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
// if(id == R.id.action_settings) return true;
if(id == R.id.action_cart) {
Intent intent = new Intent(Product34Activity.this, InBasketOrdersActivity.class);
startActivity(intent);
}
if(id == R.id.action_signout) {
Toast.makeText(Product34Activity.this, "Create Text",
Toast.LENGTH_LONG).show();
}
return super.onOptionsItemSelected(item);
}
}
| [
"iana.simonenko2@gmail.com"
] | iana.simonenko2@gmail.com |
0083f551f51b7b24919d524aaea6baeed66fd786 | d00af6c547e629983ff777abe35fc9c36b3b2371 | /jboss-all/testsuite/src/main/org/jboss/test/testbean/interfaces/BMTStatelessHome.java | e2a0f741de15098d6d60807687941166b489ecd3 | [] | no_license | aosm/JBoss | e4afad3e0d6a50685a55a45209e99e7a92f974ea | 75a042bd25dd995392f3dbc05ddf4bbf9bdc8cd7 | refs/heads/master | 2023-07-08T21:50:23.795023 | 2013-03-20T07:43:51 | 2013-03-20T07:43:51 | 8,898,416 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 248 | java | package org.jboss.test.testbean.interfaces;
import javax.ejb.*;
import java.rmi.*;
public interface BMTStatelessHome extends EJBHome {
public BMTStateless create() throws java.rmi.RemoteException, javax.ejb.CreateException;
}
| [
"rasmus@dll.nu"
] | rasmus@dll.nu |
ca02d478c2c4d428e5fded83bccf0bf1980164a9 | a1b4906a54ba81c24da4483f02110645e3807a30 | /Week 6 - HTML/LuckySevensWeb/src/main/java/com/sg/luckysevensweb/LuckySevensServlet.java | c0dc8fa1dfae27333f59597b8abc27c508a5b06e | [] | no_license | mdrozdz17/personalwork | 3b4177fa6d3a4a29ee9314f6ed033863e077aa0b | 49d12e6262349e0b0b663f1d5485609564c05f53 | refs/heads/master | 2020-06-10T14:04:11.866899 | 2016-12-08T16:10:45 | 2016-12-08T16:10:45 | 75,952,257 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,117 | java | package com.sg.luckysevensweb;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;
import java.util.Random;
import java.util.Scanner;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author apprentice
*/
@WebServlet(urlPatterns = {"/LuckySevensServlet"})
public class LuckySevensServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code>
* methods.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
RequestDispatcher rd = request.getRequestDispatcher("index.jsp");
rd.forward(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
DecimalFormat d = new DecimalFormat("'$'0.00");
String myInput = request.getParameter("myInput");
int die1; // declare dice1
int die2; // declare dice2
double money; // How much $ was won or lost
double mostMoneyHeld; // Most money held by the player at one point in time
int rollCountMax = 0; // Roll Count Max when user had the most money
int rollCountTotal = 0; // Total number of rolls when depletion was hit
money = Double.parseDouble(myInput);
mostMoneyHeld = money;
while (money > 0) {
rollCountTotal++;
Random rGen = new Random();
die1 = rGen.nextInt(6) + 1;
die2 = rGen.nextInt(6) + 1;
if (die1 + die2 == 7) {
money += 4; // win $4
} else {
money -= 1; // lose $1
}
if (money > mostMoneyHeld) {
mostMoneyHeld = money;
rollCountMax = rollCountTotal;
}
}
String broke = "You were broke after " + rollCountTotal + " rolls";
String quit = "You should have quit after " + rollCountMax
+ " rolls when you had " + d.format(mostMoneyHeld) + ".";
request.setAttribute("broke", broke);
request.setAttribute("quit", quit);
RequestDispatcher rd = request.getRequestDispatcher("response.jsp");
rd.forward(request,response);
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
*
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"Matthew.Drozdz@LibertyMutual.com"
] | Matthew.Drozdz@LibertyMutual.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.