blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
listlengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8d0b5f8f312e2efd2e777ea9cf466a5c40bda525 | 662f33fb68aafd080a97cb2b78ad7d560daae53e | /spring-test/src/test/java/org/springframework/test/context/junit4/annotation/DefaultConfigClassesBaseTests.java | c0541504739f1a2d74f42d5ff645bbeea214bb7e | [
"Apache-2.0"
]
| permissive | 1392517138/springSCode | d416c89b5da4272771bde8aef608e2ceb333937f | b0ecdd958753d493f90db3a4b69c1ed7b2a7b036 | refs/heads/master | 2022-12-19T04:10:53.294600 | 2020-09-24T06:54:45 | 2020-09-24T06:54:45 | 284,914,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,198 | java | /*
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.test.context.junit4.annotation;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
import org.springframework.tests.sample.beans.Employee;
import static org.junit.Assert.*;
/**
* Integration tests that verify support for configuration classes in
* the Spring TestContext Framework.
*
* <p>Configuration will be loaded from {@link DefaultConfigClassesBaseTests.ContextConfiguration}.
*
* @author Sam Brannen
* @see DefaultLoaderDefaultConfigClassesBaseTests
* @since 3.1
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
public class DefaultConfigClassesBaseTests {
@Autowired
protected Employee employee;
@Test
public void verifyEmployeeSetFromBaseContextConfig() {
assertNotNull("The employee field should have been autowired.", this.employee);
assertEquals("John Smith", this.employee.getName());
}
@Configuration
static class ContextConfiguration {
@Bean
public Employee employee() {
Employee employee = new Employee();
employee.setName("John Smith");
employee.setAge(42);
employee.setCompany("Acme Widgets, Inc.");
return employee;
}
}
}
| [
"[email protected]"
]
| |
7f5ffad937bbc7a83b001f5c565ecd98eaa4481d | a86f16aaa10d4aaf87249b32ee4513d353e8adfe | /goal-explorer/src/android/goal/explorer/analysis/value/factory/ReturnFlowFunctionFactory.java | 96448ac8c8ab7d8835c6f6a898c616dc66c29bba | [
"MIT"
]
| permissive | BWLuo/GoalExplorer | d0457b7b2e41347aa60c5fd3ebde12161eb9fa6d | 96f4382b1951c8aae3a1ee94f2b5f74221c470a8 | refs/heads/master | 2022-11-06T10:12:39.244879 | 2020-05-12T15:40:26 | 2020-05-12T15:40:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,651 | java | /*
* Copyright (C) 2015 The Pennsylvania State University and the University of Wisconsin
* Systems and Internet Infrastructure Security Laboratory
*
* Author: Damien Octeau
*
* 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 android.goal.explorer.analysis.value.factory;
import android.goal.explorer.analysis.value.AnalysisParameters;
import android.goal.explorer.analysis.value.PropagationModel;
import heros.FlowFunction;
import heros.flowfunc.KillAll;
import org.pmw.tinylog.Logger;
import soot.SootMethod;
import soot.Unit;
import soot.Value;
import soot.jimple.*;
import java.util.*;
/**
* A factory for return flow functions. Return flow functions indicate how symbols (variables) are
* propagation through method return statements.
*/
public class ReturnFlowFunctionFactory {
/**
* Returns a return flow function.
*
* @param callSite A call statement.
* @param callee The called method.
* @param exitStmt The exit statement for the method.
* @param retSite The statement to which the method returns.
* @param zeroValue The zero value, which represents the absence of a data flow fact.
* @return A return flow function.
*/
public FlowFunction<Value> getReturnFlowFunction(final Unit callSite, SootMethod callee,
Unit exitStmt, Unit retSite, final Value zeroValue) {
Stmt stmt = (Stmt) callSite;
Logger.debug("Stmt: " + stmt);
if (SootMethod.staticInitializerName.equals(callee.getName())) {
// Static initializer: return everything that was created inside the method.
return new FlowFunction<Value>() {
@Override
public Set<Value> computeTargets(Value source) {
Logger.debug("source: " + source);
if (callSite instanceof AssignStmt) {
AssignStmt assignStmt = (AssignStmt) callSite;
Value right = assignStmt.getRightOp();
Logger.debug("right: " + right);
if (right instanceof StaticFieldRef && right.toString().equals(source.toString())) {
Set<Value> result = new HashSet<>();
result.add(source);
result.add(assignStmt.getLeftOp());
Logger.debug("Returning " + result);
return result;
}
} else if (source instanceof FieldRef) {
Logger.debug("Returning " + source);
return Collections.singleton(source);
}
Logger.debug("Returning empty set");
return Collections.emptySet();
}
};
}
String declaringClass = callee.getDeclaringClass().getName();
if (PropagationModel.v().getArgumentsForGenMethod(stmt.getInvokeExpr()) != null
|| PropagationModel.v().getArgumentsForCopyConstructor(stmt.getInvokeExpr().getMethodRef()) != null
|| !AnalysisParameters.v().isAnalysisClass(declaringClass)) {
return KillAll.v();
}
if (exitStmt instanceof ReturnStmt || exitStmt instanceof ReturnVoidStmt
|| exitStmt instanceof ThrowStmt) {
final List<Value> paramLocals = new ArrayList<Value>();
for (int i = 0; i < callee.getParameterCount(); ++i) {
paramLocals.add(callee.getActiveBody().getParameterLocal(i));
}
if (callSite instanceof InvokeStmt) {
InvokeStmt invokeStmt = (InvokeStmt) callSite;
Logger.debug("Invoke Stmt: " + invokeStmt);
final InvokeExpr invokeExpr = invokeStmt.getInvokeExpr();
return new FlowFunction<Value>() {
@Override
public Set<Value> computeTargets(Value source) {
Logger.debug("Invoke expr: " + invokeExpr + "\nSource: " + source);
for (int i = 0; i < paramLocals.size(); ++i) {
if (paramLocals.get(i).equivTo(source)) {
return Collections.singleton(invokeExpr.getArg(i));
}
}
if (source instanceof FieldRef) {
Logger.debug("Detected and returning field ref");
return Collections.singleton(source);
}
Logger.debug("Returning empty set");
return Collections.emptySet();
}
};
} else if (callSite instanceof DefinitionStmt && !(exitStmt instanceof ThrowStmt)
&& !(exitStmt instanceof ReturnVoidStmt)) {
// The condition !(exitStmt instanceof ReturnVoidStmt) is due to the fact that Soot
// automatically creates call graph edges between calls to <android.os.Handler: boolean
// postDelayed(java.lang.Runnable,long)> (and similar methods) and the argument Runnable's
// run() method. So even though we have a DefinitionStmt, we may still have a callee with a
// void return statement. It has no influence on the objects we are interested in, since the
// return value of the post* functions is a boolean.
Logger.debug("Stmt: " + callSite);
DefinitionStmt defnStmt = (DefinitionStmt) callSite;
final Value leftOp = defnStmt.getLeftOp();
ReturnStmt returnStmt = (ReturnStmt) exitStmt;
final Value retLocal = returnStmt.getOp();
final InvokeExpr invokeExpr = (InvokeExpr) defnStmt.getRightOp();
return new FlowFunction<Value>() {
@Override
public Set<Value> computeTargets(Value source) {
Logger.debug("source: " + source);
if (source.equivTo(retLocal)) {
Logger.debug("Returning " + Collections.singleton(leftOp));
return Collections.singleton(leftOp);
}
for (int i = 0; i < paramLocals.size(); ++i) {
if (paramLocals.get(i).equivTo(source)) {
Logger.debug("Returning " + Collections.singleton(invokeExpr.getArg(i)));
return Collections.singleton(invokeExpr.getArg(i));
}
}
if (source instanceof FieldRef) {
return Collections.singleton(source);
}
Logger.debug("Returning " + Collections.emptySet());
return Collections.emptySet();
}
};
}
}
return KillAll.v();
}
}
| [
"[email protected]"
]
| |
7536e25ab92c7a15d19cb5e245c7f040e840ec67 | 16809d10f1b835f8da032eca17d7ac20814b4a47 | /MainProject/gen/game/section_16/BuildConfig.java | f7f249fceb3970490276a971aeb41d063e6ae9b7 | []
| no_license | CS307-Section-16/Section-16 | 869169f62c46578762c559946dad482b25806b1e | 8d57df90c7b703ce1fcee527806caa0c0c869862 | refs/heads/master | 2016-09-06T09:00:45.811809 | 2014-05-01T01:36:09 | 2014-05-01T01:36:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | /** Automatically generated file. DO NOT MODIFY */
package game.section_16;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"[email protected]"
]
| |
f4f47d92c27b3f79355733dffa9ec1be6f97d394 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/Codec-16/org.apache.commons.codec.binary.Base32/BBC-F0-opt-40/tests/30/org/apache/commons/codec/binary/Base32_ESTest.java | d24000d4a0d78cd5f4060ac574da5b88aa4d3874 | [
"CC-BY-4.0",
"MIT"
]
| permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 15,417 | java | /*
* This file was automatically generated by EvoSuite
* Sun Oct 24 02:50:15 GMT 2021
*/
package org.apache.commons.codec.binary;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.apache.commons.codec.binary.Base32;
import org.apache.commons.codec.binary.BaseNCodec;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class Base32_ESTest extends Base32_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
byte[] byteArray0 = new byte[7];
byteArray0[1] = (byte)91;
Base32 base32_0 = new Base32(23, byteArray0, false);
assertEquals(64, BaseNCodec.PEM_CHUNK_SIZE);
}
@Test(timeout = 4000)
public void test01() throws Throwable {
byte[] byteArray0 = new byte[11];
byteArray0[3] = (byte) (-86);
Base32 base32_0 = new Base32((byte) (-86));
String string0 = base32_0.encodeAsString(byteArray0);
assertEquals("AAAABKQAAAAAAAAAAA\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD", string0);
}
@Test(timeout = 4000)
public void test02() throws Throwable {
Base32 base32_0 = new Base32();
byte[] byteArray0 = new byte[9];
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
base32_0.encode(byteArray0, (int) (byte)0, 0, baseNCodec_Context0);
assertEquals(76, BaseNCodec.MIME_CHUNK_SIZE);
}
@Test(timeout = 4000)
public void test03() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32((byte)3, byteArray0);
byte[] byteArray1 = base32_0.decode("U63AAAAAAAAAA===");
assertArrayEquals(new byte[] {(byte) (-89), (byte) (-74), (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0}, byteArray1);
assertEquals(8, byteArray1.length);
}
@Test(timeout = 4000)
public void test04() throws Throwable {
byte[] byteArray0 = new byte[9];
byteArray0[8] = (byte)81;
Base32 base32_0 = new Base32((-1936), byteArray0, false);
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
baseNCodec_Context0.modulus = (int) (byte) (-48);
// Undeclared exception!
try {
base32_0.decode(byteArray0, 8, (int) (byte)10, baseNCodec_Context0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// 9
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test05() throws Throwable {
Base32 base32_0 = new Base32(true, (byte)0);
byte[] byteArray0 = new byte[9];
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
base32_0.decode(byteArray0, (-1242), (int) (byte)0, baseNCodec_Context0);
assertEquals(64, BaseNCodec.PEM_CHUNK_SIZE);
}
@Test(timeout = 4000)
public void test06() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32(0, byteArray0, false, (byte) (-15));
assertEquals(76, BaseNCodec.MIME_CHUNK_SIZE);
}
@Test(timeout = 4000)
public void test07() throws Throwable {
Base32 base32_0 = new Base32(true, (byte)101);
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
byte[] byteArray0 = base32_0.ensureBufferSize(112, baseNCodec_Context0);
base32_0.encodeAsString(byteArray0);
// Undeclared exception!
base32_0.encode(byteArray0, 62, 2543, baseNCodec_Context0);
}
@Test(timeout = 4000)
public void test08() throws Throwable {
byte[] byteArray0 = new byte[9];
Base32 base32_0 = new Base32((-1134), byteArray0, true);
// Undeclared exception!
try {
base32_0.encode(byteArray0, (int) (byte) (-7), (int) (byte)87, (BaseNCodec.Context) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test09() throws Throwable {
byte[] byteArray0 = new byte[1];
Base32 base32_0 = new Base32(1436, byteArray0);
// Undeclared exception!
try {
base32_0.decode(byteArray0, (-2120), 2134, (BaseNCodec.Context) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test10() throws Throwable {
byte[] byteArray0 = new byte[1];
Base32 base32_0 = new Base32((-305), byteArray0, false);
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
// Undeclared exception!
try {
base32_0.decode(byteArray0, (int) (byte)0, 8181, baseNCodec_Context0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// 1
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test11() throws Throwable {
byte[] byteArray0 = new byte[4];
Base32 base32_0 = null;
try {
base32_0 = new Base32(797, byteArray0, true, (byte)0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// lineSeparator must not contain Base32 characters: [\u0000\u0000\u0000\u0000]
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test12() throws Throwable {
byte[] byteArray0 = new byte[7];
byteArray0[2] = (byte)52;
Base32 base32_0 = null;
try {
base32_0 = new Base32(23, byteArray0, false);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// lineSeparator must not contain Base32 characters: [\u0000\u00004\u0000\u0000\u0000\u0000]
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test13() throws Throwable {
byte[] byteArray0 = new byte[2];
Base32 base32_0 = new Base32(90, byteArray0);
boolean boolean0 = base32_0.isInAlphabet("org.apache.commons.codec.Charsets");
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test14() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32((byte)3, byteArray0);
boolean boolean0 = base32_0.isInAlphabet((byte)3);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test15() throws Throwable {
Base32 base32_0 = new Base32((byte) (-15));
boolean boolean0 = base32_0.isInAlphabet((byte) (-15));
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test16() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32(9, byteArray0);
boolean boolean0 = base32_0.isInAlphabet((byte)67);
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test17() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32(8, byteArray0, false);
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
// Undeclared exception!
try {
base32_0.encode(byteArray0, (int) (byte)0, (int) (byte)122, baseNCodec_Context0);
fail("Expecting exception: ArrayIndexOutOfBoundsException");
} catch(ArrayIndexOutOfBoundsException e) {
//
// 8
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test18() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32(240, byteArray0);
String string0 = base32_0.encodeAsString(byteArray0);
assertEquals("AAAAAAAAAAAAA===\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", string0);
}
@Test(timeout = 4000)
public void test19() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32();
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
baseNCodec_Context0.modulus = (-1041);
// Undeclared exception!
try {
base32_0.encode(byteArray0, (-1854), (-1854), baseNCodec_Context0);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// Impossible modulus -1041
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test20() throws Throwable {
byte[] byteArray0 = new byte[4];
Base32 base32_0 = new Base32((byte)0, byteArray0, true);
String string0 = base32_0.encodeToString(byteArray0);
assertEquals("0000000=", string0);
}
@Test(timeout = 4000)
public void test21() throws Throwable {
Base32 base32_0 = new Base32(true, (byte)101);
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
byte[] byteArray0 = base32_0.ensureBufferSize(112, baseNCodec_Context0);
base32_0.encodeAsString(byteArray0);
// Undeclared exception!
base32_0.decode(byteArray0, 9, 1930, baseNCodec_Context0);
}
@Test(timeout = 4000)
public void test22() throws Throwable {
byte[] byteArray0 = new byte[1];
Base32 base32_0 = new Base32(1436, byteArray0);
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
base32_0.encode(byteArray0, (-2849), (-1250), baseNCodec_Context0);
assertEquals(76, BaseNCodec.MIME_CHUNK_SIZE);
}
@Test(timeout = 4000)
public void test23() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32((byte)3, byteArray0);
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
base32_0.encode(byteArray0, (int) (byte) (-89), (int) (byte) (-74), baseNCodec_Context0);
base32_0.encode(byteArray0, 64, 1569, baseNCodec_Context0);
assertEquals(8, byteArray0.length);
}
@Test(timeout = 4000)
public void test24() throws Throwable {
Base32 base32_0 = new Base32();
byte[] byteArray0 = new byte[4];
BaseNCodec.Context baseNCodec_Context0 = new BaseNCodec.Context();
baseNCodec_Context0.modulus = 11;
// Undeclared exception!
try {
base32_0.decode(byteArray0, (int) (byte) (-45), (int) (byte) (-95), baseNCodec_Context0);
fail("Expecting exception: IllegalStateException");
} catch(IllegalStateException e) {
//
// Impossible modulus 11
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test25() throws Throwable {
Base32 base32_0 = new Base32((byte) (-46));
Object object0 = base32_0.decode((Object) "H~#QxG;W7;]q/u>btI|");
assertNotNull(object0);
}
@Test(timeout = 4000)
public void test26() throws Throwable {
byte[] byteArray0 = new byte[8];
Base32 base32_0 = new Base32(9, byteArray0);
Object object0 = base32_0.decode((Object) "org.apache.commons.codec.binary.BaseNCodec");
Object object1 = base32_0.encode(object0);
assertNotSame(object1, object0);
}
@Test(timeout = 4000)
public void test27() throws Throwable {
byte[] byteArray0 = new byte[1];
Base32 base32_0 = new Base32(1436, byteArray0);
Object object0 = base32_0.decode((Object) "AA======\u0000");
assertNotSame(byteArray0, object0);
}
@Test(timeout = 4000)
public void test28() throws Throwable {
Base32 base32_0 = new Base32(false);
Object object0 = base32_0.decode((Object) "lineSeparator must not contain Base32 characters: [");
assertNotNull(object0);
}
@Test(timeout = 4000)
public void test29() throws Throwable {
Base32 base32_0 = new Base32((byte) (-15));
byte[] byteArray0 = base32_0.decode("AAAAAAAAAAAAA\uFFFD\uFFFD\uFFFD");
assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0}, byteArray0);
assertEquals(8, byteArray0.length);
}
@Test(timeout = 4000)
public void test30() throws Throwable {
byte[] byteArray0 = new byte[4];
Base32 base32_0 = new Base32((byte)0, byteArray0, true);
byte[] byteArray1 = base32_0.decode("0000000=");
assertArrayEquals(new byte[] {(byte)0, (byte)0, (byte)0, (byte)0}, byteArray1);
assertEquals(4, byteArray1.length);
}
@Test(timeout = 4000)
public void test31() throws Throwable {
Base32 base32_0 = null;
try {
base32_0 = new Base32(true, (byte)32);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// pad must not be in alphabet or whitespace
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test32() throws Throwable {
Base32 base32_0 = null;
try {
base32_0 = new Base32((byte)83);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// pad must not be in alphabet or whitespace
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test33() throws Throwable {
byte[] byteArray0 = new byte[8];
byteArray0[1] = (byte)73;
Base32 base32_0 = null;
try {
base32_0 = new Base32(1100, byteArray0);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// lineSeparator must not contain Base32 characters: [\u0000I\u0000\u0000\u0000\u0000\u0000\u0000]
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test34() throws Throwable {
Base32 base32_0 = null;
try {
base32_0 = new Base32(65, (byte[]) null);
fail("Expecting exception: IllegalArgumentException");
} catch(IllegalArgumentException e) {
//
// lineLength 65 > 0, but lineSeparator is null
//
verifyException("org.apache.commons.codec.binary.Base32", e);
}
}
@Test(timeout = 4000)
public void test35() throws Throwable {
Base32 base32_0 = new Base32(true);
byte[] byteArray0 = base32_0.decode("AAAAAAAAAAAAAAAAAAAAAAAA");
assertEquals(15, byteArray0.length);
}
@Test(timeout = 4000)
public void test36() throws Throwable {
Base32 base32_0 = new Base32(8);
assertEquals(64, BaseNCodec.PEM_CHUNK_SIZE);
}
}
| [
"[email protected]"
]
| |
f0ef17f72e40cb1823dbe4f4c853bba5cc2296e3 | f1b918933b6ff23c460c0a94d406202413ca2d20 | /P3_Ingenieria_Software/src/salidaTardia.java | 935bb62efa909adb3579f53eaacf4420f24a6ca4 | []
| no_license | jopelle/Practica3_Ingenieria_Software | 24cd1771d39e620bc256aa15463bc2e31ce888d9 | 60ea4d54953a6ec7a11b7c333f2d0841ccec96bf | refs/heads/master | 2021-08-19T20:32:21.211380 | 2020-05-20T21:44:31 | 2020-05-20T21:44:31 | 184,725,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java |
public class salidaTardia extends extrasDecorator {
public salidaTardia(Alojamiento a) {
this.alojamiento=a;
}
public int coste() {
return this.alojamiento.coste()+100;
}
public String getDescripcion() {
return this.alojamiento.getDescripcion()+", salida tardia";
}
}
| [
"[email protected]"
]
| |
e19b8f7f6353c2c70baa1630cfb0ed654f4216f8 | 671c3d2c9da0451908703b23c7691d8de3528106 | /WP6/robust-stream-data-model-gibbs-sampler/src/main/java/pl/swmind/robust/stream/gibbs/dto/Message.java | 58d318152092252270946978be633ef6b5dbca68 | [
"Apache-2.0"
]
| permissive | robust-project/platform | 0ee4d163a57f4cae8ef8b760aa04dcac5e2e6254 | 020d98b4277e897892d5c02fb0a1cce7125e6c76 | refs/heads/master | 2021-01-01T05:50:09.636856 | 2013-12-10T14:01:50 | 2013-12-10T14:01:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,769 | java | package pl.swmind.robust.stream.gibbs.dto;
import pl.swmind.robust.streaming.model.RobustStreamMessage;
import javax.persistence.*;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
@Entity
@Table(name="robust_scn_messages_view")
public class Message extends RobustStreamMessage {
private String messageuri;
private String threaduri;
private String messagetitle;
private String contributor;
private String creationdate;
private MessagePoint messagepoint;
private Thread thread;
private Timestamp timestamp;
public Message() {
}
public Message(String messageuri, String threaduri, String messagetitle, String contributor, String creationdate, Timestamp timestamp) {
this.messageuri = messageuri;
this.threaduri = threaduri;
this.messagetitle = messagetitle;
this.contributor = contributor;
this.creationdate = creationdate;
this.timestamp = timestamp;
}
@Id
@Column(name="messageuri", length = 255, nullable = false)
public String getMessageuri() {
return messageuri;
}
public void setMessageuri(String messageuri) {
this.messageuri = messageuri;
}
@Column(name="threaduri", length = 255, nullable = false)
public String getThreaduri() {
return threaduri;
}
public void setThreaduri(String threaduri) {
this.threaduri = threaduri;
}
@Column(name="messagetitle", length = 255, nullable = false)
public String getMessagetitle() {
return messagetitle;
}
public void setMessagetitle(String messagetitle) {
this.messagetitle = messagetitle;
}
@Column(name="contributor")
public String getContributor() {
return contributor;
}
public void setContributor(String contributor) {
this.contributor = contributor;
}
@Column(name="creationdate", length = 255, nullable = false)
public String getCreationdate() {
return creationdate;
}
public void setCreationdate(String creationdate) {
this.creationdate = creationdate;
}
@OneToOne
@PrimaryKeyJoinColumn
public MessagePoint getMessagepoint() {
return messagepoint;
}
public void setMessagepoint(MessagePoint messagepoint) {
this.messagepoint = messagepoint;
}
@OneToOne
@JoinColumn(name = "threaduri", insertable=false, updatable=false)
public Thread getThread() {
return thread;
}
public void setThread(Thread thread) {
this.thread = thread;
}
@Column(name="timestamp", nullable = false)
public Timestamp getTimestamp() {
return timestamp;
}
public void setTimestamp(Timestamp timestamp) {
this.timestamp = timestamp;
}
@Override
public String toString() {
return "Message{" +
"messageuri='" + messageuri + '\'' +
", threaduri='" + threaduri + '\'' +
", messagetitle='" + messagetitle + '\'' +
", contributor='" + contributor + '\'' +
", creationdate='" + creationdate + '\'' +
", messagepoint=" + messagepoint +
", thread=" + thread +
'}';
}
@Override
public long createTimestamp() {
DateFormat dateFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy", Locale.UK);
Date date = null;
try {
date = dateFormat.parse(creationdate);
} catch (ParseException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
return date.getTime();
}
}
| [
"[email protected]"
]
| |
2d4d4bde931c6b61254b8130f6d535b9f0759f45 | 2a457d1d5bad4e9b894bf84b4892426946c4597b | /Submissions-3/src/tests/Testsubmitdesigns.java | 93d1a05ea90f1b8fa337adb7539920bdb606581f | []
| no_license | vcramach/Zephyr | d0f157b490fdc092d9e242dc4976e0446b3ee809 | 216945cb19ba78b2900955f1d4297779ddfb0758 | refs/heads/master | 2022-01-28T19:49:47.983479 | 2014-11-23T04:10:16 | 2014-11-23T04:10:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 444 | java | import junit.framework.TestCase;
public class submitdesignsTest extends TestCase {
submitdesigns sd = new submitdesigns();
public void testsubmitdesign(){
try{
sd.submit("filename.txt");
assertTrue(true);
}catch(Exception e){
assertFalse(true);
}
}
public void testsubmitdesignwrong(){
try{
sd.submit("wrongfilename.txt");
assertTrue(false);
}catch(filedoesntexistexception e){
assertFalse(false);
}
}
}
| [
"[email protected]"
]
| |
8cc060be840aca2d0d611a7d5b01c2c9585bc195 | 827185727f28e1a732700b5bfa2925f68e664aa8 | /app/src/main/java/com/cd/dnf/credit/ui/borrow/fragment/BorrowStepFourFragment.java | 3d4f993a682e30bebb3c1dfaf097ea85766fb0d3 | []
| no_license | andylihang/DanaBerkat | aca12e7b31bc5b9b4dd27e1900e935ff1a531ff4 | 8a5fab7fe30cc4377678fddc94a729f2ee915ba9 | refs/heads/master | 2020-03-19T02:49:36.053480 | 2018-05-18T03:45:26 | 2018-05-18T03:49:02 | 135,664,910 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 34,559 | java | package com.cd.dnf.credit.ui.borrow.fragment;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.Parcelable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.cd.dnf.credit.R;
import com.cd.dnf.credit.api.CreditApi;
import com.cd.dnf.credit.api.CreditApiRequstCallback;
import com.cd.dnf.credit.application.CreditApplication;
import com.cd.dnf.credit.bean.BankBean;
import com.cd.dnf.credit.bean.BankInfoBean;
import com.cd.dnf.credit.bean.BorrowOperateBean;
import com.cd.dnf.credit.bean.BorrowOrderBean;
import com.cd.dnf.credit.bean.BorrowOrderStatusBean;
import com.cd.dnf.credit.bean.CallRecordBean;
import com.cd.dnf.credit.bean.ContactBean;
import com.cd.dnf.credit.bean.CreditNotification;
import com.cd.dnf.credit.bean.CreditResponse;
import com.cd.dnf.credit.bean.SmsRecordBean;
import com.cd.dnf.credit.bean.UploadTime;
import com.cd.dnf.credit.fragment.CreditBaseFragment;
import com.cd.dnf.credit.ui.borrow.actvitiy.BankActivity;
import com.cd.dnf.credit.ui.borrow.actvitiy.BorrowOrderActivity;
import com.cd.dnf.credit.util.AnalyticUtil;
import com.cd.dnf.credit.util.AppPreferences;
import com.cd.dnf.credit.util.BuildConstant;
import com.cd.dnf.credit.util.ContactUtil;
import com.cd.dnf.credit.util.CreditNotifyType;
import com.cd.dnf.credit.util.CreditUtil;
import com.cd.dnf.credit.util.KeyBordUtils;
import com.cd.dnf.credit.view.ToastUtil;
import com.cd.dnf.credit.view.borrow.BorrowChooseOptionDialog;
import com.cd.dnf.credit.view.borrow.interfaces.BorrowChooseOptionInterface;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.jakewharton.rxbinding.view.RxView;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.Response;
import org.json.JSONObject;
import org.litepal.crud.DataSupport;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.OnTouch;
import de.greenrobot.event.EventBus;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Action1;
import static android.app.Activity.RESULT_OK;
/**
* Created by jack on 2018/1/25.
* 银行信息
*/
public class BorrowStepFourFragment extends CreditBaseFragment {
@Bind(R.id.bank_view)
TextView mBankNameView;//银行名称
@Bind(R.id.bank_account_viw)
EditText mBankAccountView;//银行卡号
@Bind(R.id.bank_user_name_view)
EditText mBankAccountUserName;//开户名 只能是字母大小写和空格
@Bind(R.id.tax_number_view)
EditText mTaxNumberView;//税号
@Bind(R.id.contact_autorize_view)
TextView mContactAutoRizeView;//联系人认证view
@Bind(R.id.sms_autorize_view)
TextView mSmsAutoRizeView;//短信认证view
@Bind(R.id.call_autorize_view)
TextView mCallAutoRizeView;//通话记录认证
@Bind(R.id.btn_next)
TextView mBtnNext;//下一步
@Bind(R.id.sms_progress_view)
ProgressBar mSmsProgressView;//短信上传进度条
@Bind(R.id.contact_layout)
LinearLayout mContactLayout;//联系人
@Bind(R.id.sms_layout)
LinearLayout mSmsLayout;//短信
@Bind(R.id.call_layout)
LinearLayout mCallLayout;//通话记录
private BorrowOrderActivity mActivity;
private List<ContactBean> contactSource = new ArrayList<>();//所有联系人
private List<CallRecordBean> callRecordSource = new ArrayList<>();//所有通话记录
private List<SmsRecordBean> smsRecordSource = new ArrayList<>();//短信记录
private ContactHander mContactHander;
private final int READ_CONTACT = 0X0231;//读取联系人
private final int READ_CALL_LOG = 0x0232;//获取通话记录
private final int READ_SMS = 0x0234;//读取短信内容
private BorrowOrderBean mBorrowBean;
private final int CHOOSE_BANK = 0x78;//选择银行
private BankBean mChooseBank;//选择的银行
private boolean isCheckContact = false;//是否验证了联系人
private boolean isCheckCall = false;//是否验证了通话记录
private boolean isCheckSms = false;//是否验证了短信
private List<BankInfoBean> mBankInfoSource = new ArrayList<>();
private List<String> mBankShowSource = new ArrayList<>();//弹框显示的名称
private int chooseBankIndex = -1;
private BorrowChooseOptionDialog mBankDialog;
private BankInfoBean mChooseBankInfo;
private UploadTime mUploadTimeBean;//最后上传时间
private final int PROGRESS_SMS = 0x134;//短信进度条
private ProgressHandler mProgressHandler;
private int smsProgressValue = 1;
private AppPreferences mAppPreference;
private FirebaseAnalytics mFirebaseAnalytics;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_borrow_step_four_layout, container, false);
ButterKnife.bind(this, view);
return view;
}
/* public void setBorrowOrder(BorrowOrderBean borrowOrder) {
mBorrowBean = borrowOrder;
}*/
class ContactHander extends Handler {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case READ_CONTACT:
dismissProgressDialog();
uploadContactSource();
break;
case READ_CALL_LOG:
dismissProgressDialog();
uploadCallSource();
break;
case READ_SMS:
dismissProgressDialog();
uploadSmsSource();
break;
}
}
}
class ProgressHandler extends Handler {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case PROGRESS_SMS:
int progress = smsProgressValue + 5;
if (progress < 100) {
mSmsProgressView.setProgress(progress);
}
mProgressHandler.sendEmptyMessageDelayed(PROGRESS_SMS, 100);
break;
}
}
}
private void uploadSmsSource() {
/* List<SmsRecordBean> smsRecordSource = new ArrayList<>();
for (int i = 1; i <= 30; i++) {
SmsRecordBean smsRecordBean = new SmsRecordBean();
smsRecordBean.setContent("测试测试测试短信测试短信");
smsRecordBean.setName("张三" + i);
smsRecordBean.setPhone("163788289");
smsRecordBean.setTime("1515413278564");
smsRecordBean.setFrom(1);
smsRecordBean.setIsRead(1);
smsRecordSource.add(smsRecordBean);
}*/
smsProgressValue = 5;
mProgressHandler.sendEmptyMessage(PROGRESS_SMS);
String jsonStr = JSON.toJSONString(smsRecordSource);
OkGo.<String>post(CreditApi.API_UPLOAD_SMS_LOG).upJson(jsonStr).tag("uploadSms").execute(
new CreditApiRequstCallback(getActivity(), false) {
@Override
public void onError(Response<String> response) {
super.onError(response);
mSmsLayout.setClickable(true);
}
@Override
public void RequestSuccess(String body) {
//fetchUpLoadTime();
CreditResponse response = JSON.parseObject(body, CreditResponse.class);
mUploadTimeBean = JSON.parseObject(response.getData(), UploadTime.class);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
if (mSmsAutoRizeView.isAttachedToWindow()) {
mSmsAutoRizeView.setText(R.string.authorizaiton_str);
mSmsAutoRizeView.setTextColor(getResources().getColor(R.color.borrow_autorize_ok_color));
mSmsProgressView.setProgress(100);
}
} else {
mSmsAutoRizeView.setText(R.string.authorizaiton_str);
mSmsAutoRizeView.setTextColor(getResources().getColor(R.color.borrow_autorize_ok_color));
mSmsProgressView.setProgress(100);
}
mSmsLayout.setClickable(true);
isCheckSms = true;
mProgressHandler.removeCallbacksAndMessages(null);
checkCanNext();
}
@Override
public void RequestFail(String body) {
mSmsLayout.setClickable(true);
mSmsProgressView.setProgress(0);
mProgressHandler.removeCallbacksAndMessages(null);
if (isCheckSms) {
mSmsProgressView.setProgress(100);
}
}
});
}
private void uploadCallSource() {
/* List<CallRecordBean> callRecordSource = new ArrayList<>();
for (int i = 1; i < 60; i++) {
CallRecordBean callRecordBean = new CallRecordBean();
callRecordBean.setName("崔浩军");
callRecordBean.setPhone("13402832322");
callRecordBean.setCallStartTime("1515413278564");
callRecordBean.setCallTimeLong("100");
callRecordBean.setIsCall(1);
callRecordSource.add(callRecordBean);
}*/
String jsonStr = JSON.toJSONString(callRecordSource);
OkGo.<String>post(CreditApi.API_UPLOAD_CALL_LOG).upJson(jsonStr).tag("uploadCall").execute(
new CreditApiRequstCallback(getActivity(), true) {
@Override
public void onError(Response<String> response) {
super.onError(response);
mCallLayout.setClickable(true);
}
@Override
public void RequestSuccess(String body) {
mCallLayout.setClickable(true);
CreditResponse response = JSON.parseObject(body, CreditResponse.class);
mUploadTimeBean = JSON.parseObject(response.getData(), UploadTime.class);
//fetchUpLoadTime();
isCheckCall = true;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
if (mCallAutoRizeView.isAttachedToWindow()) {
mCallAutoRizeView.setText(R.string.authorizaiton_str);
mCallAutoRizeView.setTextColor(getResources().getColor(R.color.borrow_autorize_ok_color));
}
} else {
mCallAutoRizeView.setText(R.string.authorizaiton_str);
mCallAutoRizeView.setTextColor(getResources().getColor(R.color.borrow_autorize_ok_color));
}
checkCanNext();
}
@Override
public void RequestFail(String body) {
mCallLayout.setClickable(true);
}
});
}
private void uploadContactSource() {
/* List<ContactBean> contactSource = new ArrayList<>();
for (int i = 1; i < 1000; i++) {
ContactBean contactBean = new ContactBean();
contactBean.setName("崔浩军");
contactBean.setPhone("13402832322");
contactSource.add(contactBean);
}*/
String jsonStr = JSON.toJSONString(contactSource);
OkGo.<String>post(CreditApi.API_UPLOAD_CONTACT).upJson(jsonStr).tag("uploadContact").execute(
new CreditApiRequstCallback(getActivity(), true) {
@Override
public void onError(Response<String> response) {
super.onError(response);
mContactLayout.setClickable(true);
}
@Override
public void RequestSuccess(String body) {
mContactLayout.setClickable(true);
CreditResponse response = JSON.parseObject(body, CreditResponse.class);
//fetchUpLoadTime();
isCheckContact = true;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT) {
if (mContactAutoRizeView.isAttachedToWindow()) {
mContactAutoRizeView.setText(R.string.authorizaiton_str);
mContactAutoRizeView.setTextColor(getResources().getColor(R.color.borrow_autorize_ok_color));
}
} else {
mContactAutoRizeView.setText(R.string.authorizaiton_str);
mContactAutoRizeView.setTextColor(getResources().getColor(R.color.borrow_autorize_ok_color));
}
checkCanNext();
}
@Override
public void RequestFail(String body) {
mContactLayout.setClickable(true);
}
});
}
private void initListener(){
mBankAccountView.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) {
checkCanNext();
}
@Override
public void afterTextChanged(Editable s) {
}
});
mBankAccountUserName.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) {
checkCanNext();
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
private void checkCanNext(){
String bankAccountStr = mBankAccountView.getText().toString();//银行卡号
String bankUserNameStr = mBankAccountUserName.getText().toString().trim();//开户名
String bankNameStr=mBankNameView.getText().toString();//银行名称
if(!TextUtils.isEmpty(bankNameStr)&&!TextUtils.isEmpty(bankUserNameStr)&&!TextUtils.isEmpty(bankAccountStr)
&&isCheckContact&&isCheckCall&&isCheckSms){
mBtnNext.setTextColor(CreditApplication.getInstance().getResources().getColor(R.color.white));
mBtnNext.setBackgroundResource(R.mipmap.bg_register);
}else {
mBtnNext.setTextColor(CreditApplication.getInstance().getResources().getColor(R.color.need_input_color));
mBtnNext.setBackgroundResource(R.drawable.bg_need_input);
}
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mAppPreference = new AppPreferences(getActivity());
mActivity = (BorrowOrderActivity) getActivity();
mContactHander = new ContactHander();
mProgressHandler = new ProgressHandler();
mBorrowBean = getArguments().getParcelable("orderBean");
mBankInfoSource = CreditApplication.getInstance().getMindBankInfo();
initView();
initRxBinding();
initListener();
if (mBankInfoSource != null && mBankInfoSource.size() > 0) {
initBankDilog();
}
fetchUpLoadTime();
mFirebaseAnalytics = FirebaseAnalytics.getInstance(getActivity());
}
private void initView() {
//银行卡
if (!TextUtils.isEmpty(mBorrowBean.getBankName())) {
mBankNameView.setText(mBorrowBean.getBankName());
}
if (!TextUtils.isEmpty(mBorrowBean.getBankAccount())) {
mBankAccountView.setText(mBorrowBean.getBankAccount());
}
if (!TextUtils.isEmpty(mBorrowBean.getBankUserName())) {
mBankAccountUserName.setText(mBorrowBean.getBankUserName());
}
if (!TextUtils.isEmpty(mBorrowBean.getBankName())) {
mChooseBank = new BankBean();
mChooseBank.setBankCode(mBorrowBean.getBankCode());
mChooseBank.setBankName(mBorrowBean.getBankName());
handleChooseBankIndex(mChooseBank);
}
//税号
if (!TextUtils.isEmpty(mBorrowBean.getDutyParagraph())) {
mTaxNumberView.setText(mBorrowBean.getDutyParagraph());
}
checkCanNext();
}
private void handleChooseBankIndex(BankBean mChooseBank) {
for (int i = 0; i < mBankInfoSource.size(); i++) {
BankInfoBean mBankInfoBean = mBankInfoSource.get(i);
if (TextUtils.equals(mBankInfoBean.getBankCode(), mChooseBank.getBankCode())) {
chooseBankIndex = i;
break;
}
}
}
@Override
public void onDestroy() {
super.onDestroy();
//取消网络请求
Log.e("sakura","----第四步,取消网络请求 所有的");
OkGo.getInstance().cancelTag("uploadContact");
OkGo.getInstance().cancelTag("uploadCall");
OkGo.getInstance().cancelTag("uploadSms");
OkGo.getInstance().cancelTag("fetchupdatetime");
OkGo.getInstance().cancelTag("borrowOrder");
if (mContactHander != null) {
mContactHander.removeCallbacksAndMessages(null);
}
if (mProgressHandler != null) {
mProgressHandler.removeCallbacksAndMessages(null);
}
}
//获取上传的时间
private void fetchUpLoadTime() {
OkGo.<String>get(CreditApi.API_FETCH_UPDATE_TIME).tag("fetchupdatetime").execute(
new CreditApiRequstCallback(getActivity(), false) {
@Override
public void RequestSuccess(String body) {
CreditResponse response = JSON.parseObject(body, CreditResponse.class);
mUploadTimeBean = JSON.parseObject(response.getData(), UploadTime.class);
}
@Override
public void RequestFail(String body) {
}
});
}
private void checkInputInformation() {
if (mChooseBankInfo == null && mChooseBank == null) {
mBtnNext.setClickable(true);
//未选择银行卡
ToastUtil.showShort(R.string.choose_open_bank);
return;
}
String bankAccountStr = mBankAccountView.getText().toString();//银行卡号
String bankUserNameStr = mBankAccountUserName.getText().toString().trim();//开户名
String taxStr = mTaxNumberView.getText().toString();//税号
if (TextUtils.isEmpty(bankAccountStr)) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.input_bank_accout_tip);
return;
}
if (TextUtils.isEmpty(bankUserNameStr)) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.input_bank_open_account_name_tip);
return;
}
if (!CreditUtil.checkBankUserName(bankUserNameStr)) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.input_right_account_user_name_tip);
return;
}
if (mChooseBank != null) {
mBorrowBean.setBankName(mChooseBank.getBankName());
mBorrowBean.setBankCode(mChooseBank.getBankCode());
} else {
mBorrowBean.setBankName(mChooseBankInfo.getBankName());
mBorrowBean.setBankCode(mChooseBankInfo.getBankCode());
}
mBorrowBean.setBankUserName(bankUserNameStr);
mBorrowBean.setBankAccount(bankAccountStr);
mBorrowBean.setDutyParagraph(taxStr);
if (!isCheckContact) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.upload_contact_tip_str);
return;
}
if (!isCheckCall) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.upload_call_tip_str);
return;
}
if (!isCheckSms) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.upload_sms_tip_str);
return;
}
String indentifyOssKey = mBorrowBean.getIdCardPhotoFront();
String handleOssKey = mBorrowBean.getPeopleIdCardPhoto();
String workOssKey = mBorrowBean.getWorkCardPhoto();
String articOssKey = mBorrowBean.getPayrollPhoto();
if (TextUtils.isEmpty(indentifyOssKey)) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.need_upload_indentify_card_tip_str);
return;
}
if (TextUtils.isEmpty(handleOssKey)) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.need_upload_handle_card_tip_str);
return;
}
if (TextUtils.isEmpty(workOssKey)) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.need_upload_work_card_tip_str);
return;
}
if (TextUtils.isEmpty(articOssKey)) {
mBtnNext.setClickable(true);
ToastUtil.showShort(R.string.need_upload_article_card_tip_str);
return;
}
submitBorrowOrder();
}
private void deleteUserBorrowStatus() {
//清空用户订单的状态
String userId = mAppPreference.get(AppPreferences.USER_ID, "");
DataSupport.deleteAll(BorrowOperateBean.class, "userId='" + userId + "'");
}
private void submitBorrowOrder() {
String serialId = CreditUtil.getSerialNumber(getActivity());
mBorrowBean.setDeviceId(serialId);
String imeiStr = CreditUtil.getImeiValue(getActivity());
mBorrowBean.setImeis(imeiStr);
String jsonStr = JSON.toJSONString(mBorrowBean);
OkGo.<String>post(CreditApi.API_APPLY_BORROW).upJson(jsonStr).tag("borrowOrder").execute(
new CreditApiRequstCallback(getActivity(), true) {
@Override
public void onError(Response<String> response) {
super.onError(response);
mBtnNext.setClickable(true);
}
@Override
public void RequestSuccess(String body) {
mBtnNext.setClickable(true);
deleteUserBorrowStatus();
CreditResponse response = JSON.parseObject(body, CreditResponse.class);
BorrowOrderStatusBean orderStatusBean=JSON.parseObject(response.getData(),BorrowOrderStatusBean.class);
CreditNotification notification = new CreditNotification();
notification.setNotifyType(CreditNotifyType.NOTIFY_BORROW_ORDER_APPLY_OK);
notification.setNotifyData(orderStatusBean);
EventBus.getDefault().post(notification);
//ToastUtil.showShort(response.getMsg());
//提交订单成功 需要更新首页状态
/* UserOrderBean userOrderBean = null;
try {
JSONObject jsonObject = new JSONObject(response.getData());
String orderId = jsonObject.getString("id");
String planId = jsonObject.getString("planId");
String userId = jsonObject.getString("userId");
userOrderBean = new UserOrderBean();
userOrderBean.setOrderId(orderId);
userOrderBean.setUserId(userId);
userOrderBean.setPlanId(planId);
userOrderBean.setCreateTime(response.getTimestamp());
} catch (Exception e) {
}
CreditNotification notification = new CreditNotification();
notification.setNotifyType(CreditNotifyType.NOTIFY_BORROW_ORDER_APPLY_OK);
notification.setNotifyData("");
EventBus.getDefault().post(notification);*/
mActivity.finish();
}
@Override
public void RequestFail(String body) {
mBtnNext.setClickable(true);
}
});
}
private void storeSource() {
if (mChooseBank != null) {
mBorrowBean.setBankName(mChooseBank.getBankName());
mBorrowBean.setBankCode(mChooseBank.getBankCode());
} else if (mChooseBankInfo != null) {
mBorrowBean.setBankName(mChooseBankInfo.getBankName());
mBorrowBean.setBankCode(mChooseBankInfo.getBankCode());
}
String bankAccountStr = mBankAccountView.getText().toString();//银行卡号
String bankUserNameStr = mBankAccountUserName.getText().toString();//开户名
String taxStr = mTaxNumberView.getText().toString();//税号
mBorrowBean.setBankUserName(bankUserNameStr);
mBorrowBean.setBankAccount(bankAccountStr);
mBorrowBean.setDutyParagraph(taxStr);
}
@Override
public void onPause() {
super.onPause();
storeSource();
}
@OnTouch(value = {R.id.touch_panel})
boolean onTouch(View v, MotionEvent event) {
switch (v.getId()) {
case R.id.touch_panel:
KeyBordUtils.hideSoft(this);
break;
}
return false;
}
private void initRxBinding() {
RxView.clicks(mBtnNext)
.debounce(BuildConstant.RXBINT_VIEW_TIME, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
mBtnNext.setClickable(false);
checkInputInformation();
if (mFirebaseAnalytics != null) {
mFirebaseAnalytics.logEvent(AnalyticUtil.BORROW_STEP_FOUR_CLICK, null);
}
}
});
//通讯录
RxView.clicks(mContactLayout)
.debounce(BuildConstant.RXBINT_VIEW_TIME, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
mContactLayout.setClickable(false);
new ContactAsyncTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, "");
if (mFirebaseAnalytics != null) {
mFirebaseAnalytics.logEvent(AnalyticUtil.BORROW_STEP_FOUR_CONTACT_CLICK, null);
}
}
});
//短信
RxView.clicks(mSmsLayout)
.debounce(BuildConstant.RXBINT_VIEW_TIME, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
mSmsLayout.setClickable(false);
new SMSAsyncTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, "");
if (mFirebaseAnalytics != null) {
mFirebaseAnalytics.logEvent(AnalyticUtil.BORROW_STEP_FOUR_SMS_CLICK, null);
}
}
});
//通话记录
RxView.clicks(mCallLayout)
.debounce(BuildConstant.RXBINT_VIEW_TIME, TimeUnit.MILLISECONDS)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<Void>() {
@Override
public void call(Void aVoid) {
mCallLayout.setClickable(false);
new CallAsyncTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, "");
if (mFirebaseAnalytics != null) {
mFirebaseAnalytics.logEvent(AnalyticUtil.BORROW_STEP_FOUR_CALL_CLICK, null);
}
}
});
}
class ContactAsyncTask extends AsyncTask {
@Override
protected void onPreExecute() {
super.onPreExecute();
showProgressDialog(getResources().getString(R.string.fetch_contact_str));
}
@Override
protected Object doInBackground(Object[] params) {
contactSource = ContactUtil.fetchContact(getActivity());
return null;
}
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
mContactHander.sendEmptyMessage(READ_CONTACT);
}
}
class SMSAsyncTask extends AsyncTask {
@Override
protected void onPreExecute() {
super.onPreExecute();
showProgressDialog(getResources().getString(R.string.fetch_sms_str));
}
@Override
protected Object doInBackground(Object[] params) {
smsRecordSource = ContactUtil.fetchSmsRecord(getActivity(), mUploadTimeBean);
return null;
}
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
mContactHander.sendEmptyMessage(READ_SMS);
}
}
class CallAsyncTask extends AsyncTask {
@Override
protected void onPreExecute() {
super.onPreExecute();
showProgressDialog(getResources().getString(R.string.fetch_call_record_str));
}
@Override
protected Object doInBackground(Object[] params) {
callRecordSource = ContactUtil.fetchCallRecord(getActivity(), mUploadTimeBean);
return null;
}
@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
mContactHander.sendEmptyMessage(READ_CALL_LOG);
}
}
@OnClick(value = {R.id.bank_layout})
void onClick(View view) {
switch (view.getId()) {
case R.id.bank_layout:
//选中银行
if (mBankInfoSource.size() > 0) {
if (!mBankDialog.isShow()) {
mBankDialog.show();
}
} else {
Intent bankIntent = new Intent(getActivity(), BankActivity.class);
startActivityForResult(bankIntent, CHOOSE_BANK);
}
break;
}
}
//显示bankDialog
private void initBankDilog() {
for (int i = 0; i < mBankInfoSource.size(); i++) {
BankInfoBean bankInfoBean = mBankInfoSource.get(i);
String bankName = bankInfoBean.getBankName();
mBankShowSource.add(bankName);
}
mBankShowSource.add(getActivity().getString(R.string.bank_other_tip_str));
mBankDialog = new BorrowChooseOptionDialog(getActivity(), mBankShowSource);
mBankDialog.setChooseOption(chooseBankIndex);
mBankDialog.setChooseOptionInterface(new BorrowChooseOptionInterface() {
@Override
public void chooseOption(int chooseOption) {
mBankDialog.dismiss();
if (chooseBankIndex != chooseOption) {
chooseBankIndex = chooseOption;
if (chooseBankIndex == (mBankShowSource.size() - 1)) {
chooseBankIndex = -1;
mBankDialog.setChooseOption(chooseBankIndex);
//选择的是其他 那么就需要跳转到银行列表页
mChooseBankInfo = null;
mBankNameView.setText("");
mBankAccountView.setText("");
mBankAccountUserName.setText("");
//需要跳转到银行页
Intent bankIntent = new Intent(getActivity(), BankActivity.class);
startActivityForResult(bankIntent, CHOOSE_BANK);
} else {
mBankDialog.setChooseOption(chooseBankIndex);
//选择了哪个银行
mChooseBankInfo = mBankInfoSource.get(chooseOption);
mBankNameView.setText(mChooseBankInfo.getBankName());
mBankAccountView.setText(mChooseBankInfo.getCardNumber());
mBankAccountUserName.setText(mChooseBankInfo.getCardUsername());
}
}
}
});
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == CHOOSE_BANK) {
mChooseBank = data.getParcelableExtra("chooseBank");
mBankNameView.setText(mChooseBank.getBankName());
checkCanNext();
}
}
}
}
| [
"[email protected]"
]
| |
c1e4e46c861e7500ea554d992f1ee0a656d7ab98 | 6039140d132a5a83e639c23ec3d13fc8ebcc48d7 | /com.Itcast/InnerClassPractice/src/InterfaceAsVars/SkillImpl.java | eccd875c18fdb4805f3e650ccb2622cba532ea05 | []
| no_license | zzdpk2/Java_Practice | 2d2f1b0cfea44bccad26a01e1273b7a26bc008cb | 3c32a53b2d97ba13c10867d63318ebc1f22142bd | refs/heads/master | 2020-03-10T12:55:23.350120 | 2020-01-21T06:33:22 | 2020-01-21T06:33:22 | 129,388,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 157 | java | package InterfaceAsVars;
public class SkillImpl implements Skill{
@Override
public void use() {
System.out.println("Biu~biu~biu~");
}
}
| [
"[email protected]"
]
| |
2d3a2e66733f06cc67895ebaf998c65acff6c085 | 72868428a8a92d60a1d68590f49068ba023e263d | /gui/ExitListener.java | fbfdcb1a1c6d2e7909701eaa4d3be5e79e06ac2f | []
| no_license | abstracta/DBMonitor | ed32c13ed005ca25013859c9420b25117e6ee958 | 71b57d374edc43428ab9a203f5aa601953c87bca | refs/heads/master | 2021-01-21T13:48:22.133552 | 2014-08-04T23:42:23 | 2014-08-04T23:42:23 | 22,623,438 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 359 | java | package gui;
import java.awt.event.*;
/**
* A listener that you attach to the top-level Frame or JFrame of your
* application, so quitting the frame exits the application. 1998 Marty Hall,
* http://www.apl.jhu.edu/~hall/java/
*/
public class ExitListener extends WindowAdapter
{
public void windowClosing(WindowEvent event)
{
System.exit(0);
}
} | [
"[email protected]"
]
| |
0dc3f56497892cab38c9d3ae630f57b61f524a84 | e8c831669c90f4635e49ea3053cdaebbaa343fcd | /EnsembleLearning/src/ensemblelearning/knn.java | 8d69ef6ab8e189ab93c0eb3c8bea28e36656b048 | []
| no_license | sandeep2/Ensemble-Learning | db3ce16f444e29700741a023440599ffe617afbf | 481fbca3a59308e8a20c8f8cddb39274b08e4382 | refs/heads/master | 2021-01-10T04:00:37.785703 | 2015-10-23T17:48:58 | 2015-10-23T17:48:58 | 43,528,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 640 | java | import java.io.BufferedReader;
import java.io.FileReader;
import weka.classifiers.lazy.IBk;
import weka.core.Instances;
public class knn {
private final String train_file;
public knn(String train_file){
this.train_file = train_file;
}
public IBk knnclassifier() throws Exception{
BufferedReader traindata = new BufferedReader(new FileReader(this.train_file));
Instances traininstance = new Instances(traindata);
traindata.close();
traininstance.setClassIndex(traininstance.numAttributes() - 1);
IBk c = new IBk();
c.buildClassifier(traininstance);
c.setKNN(11);
return c;
}
}
| [
"[email protected]"
]
| |
09eac5f8ab377d128a0dd89e93e40e19ce6d0df0 | df24f1a8e6f0404229002987805e398d1444df12 | /Client/src/main/java/models/WatchResponse.java | daa38de3a0eba54344b69aab703c2dc3576f3843 | []
| no_license | reza2002801/BattleShipGame | 442ab4592e0b3b78dcbde079f5e0bd9b0aea24be | 313e0d58af80a61013fc0cf1316e04a8f8470fc0 | refs/heads/master | 2023-08-18T11:05:46.729640 | 2021-09-25T10:03:05 | 2021-09-25T10:03:05 | 409,996,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | package models;
public class WatchResponse {
int[][] myMatrix;
int[][] oppMatrix;
int[][] myShips;
int[][] oppShips;
int time;
public int turn;
public String player1;
public String player2;
public boolean isfinished=false;
WatchResponse(int[][] matrix,int[][] oppMatrix,int[][]myShips,int[][]oppShips, int time,int turn,String player1,String player2){
this.myMatrix = matrix;
this.oppMatrix = oppMatrix;
this.myShips = myShips;
this.oppShips = oppShips;
this.time = time;
this.turn = turn;
this.player1=player1;
this.player2=player2;
}
public int[][] getMyMatrix() {
return myMatrix;
}
public int[][] getOppMatrix() {
return oppMatrix;
}
public int[][] getMyShips() {
return myShips;
}
public int[][] getOppShips() {
return oppShips;
}
public int getTime() {
return time;
}
public int getTurn() {
return turn;
}
}
| [
"[email protected]"
]
| |
c96a4abc36ee5ad23ab688a8e1dbd4f1bea6c7aa | 7008108f72cab0242bd5a2a5027ac45badcdfac8 | /DtoToEntityConversion/src/main/java/com/mapper/DtoToEntityConversionApplication.java | f46da4c82aead66daeac5777bc2e3be243659000 | []
| no_license | davijsouza/youtube | 874c076c49fbf4a435198cab52215421f37897fb | bb1c75ab4e08426d22286a800ef4296dc2216455 | refs/heads/master | 2023-01-23T20:10:33.958354 | 2020-11-25T08:05:41 | 2020-11-25T08:05:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package com.mapper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DtoToEntityConversionApplication {
public static void main(String[] args) {
SpringApplication.run(DtoToEntityConversionApplication.class, args);
}
}
| [
"[email protected]"
]
| |
ea32c91871c020880daa97377e19cc9cfb88082e | f766baf255197dd4c1561ae6858a67ad23dcda68 | /app/src/main/java/com/davemorrissey/labs/subscaleview/c/a.java | 82d3c7da83803f6e82db525e051b672ba89f0549 | []
| no_license | jianghan200/wxsrc6.6.7 | d83f3fbbb77235c7f2c8bc945fa3f09d9bac3849 | eb6c56587cfca596f8c7095b0854cbbc78254178 | refs/heads/master | 2020-03-19T23:40:49.532494 | 2018-06-12T06:00:50 | 2018-06-12T06:00:50 | 137,015,278 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package com.davemorrissey.labs.subscaleview.c;
import android.content.Context;
import android.net.Uri;
import com.davemorrissey.labs.subscaleview.a.d;
import com.davemorrissey.labs.subscaleview.view.SubsamplingScaleImageView;
public abstract interface a
{
public abstract b a(SubsamplingScaleImageView paramSubsamplingScaleImageView, Context paramContext, com.davemorrissey.labs.subscaleview.a.b<? extends d> paramb, Uri paramUri, boolean paramBoolean);
}
/* Location: /Users/Han/Desktop/wxall/微信反编译/反编译 6.6.7/dex2jar-2.0/classes6-dex2jar.jar!/com/davemorrissey/labs/subscaleview/c/a.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
]
| |
be92ad08f45e4e4c7ef589d1e12d92ecc0a9a1e2 | e933b208678823da1c596f01479d4a28afeafd0c | /src/com/lukassestic/interviewQuestions/q4/Q4.java | c7550af08e7e16c69b9c3029baace5a5e2801152 | []
| no_license | drlukas6/CTCI-ArraysAndStrings | 34d8d1c7ad48990b59a87b86484d481bae2973cd | 790cc9bc0f12083126face6877bbfc6c14cccf3b | refs/heads/master | 2020-08-29T13:08:28.772947 | 2019-11-11T20:53:58 | 2019-11-11T20:53:58 | 218,040,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,014 | java | package com.lukassestic.interviewQuestions.q4;
/**
* Implement an algorithm to check if it is a permutation of a palindrome
*
* IDEA:
*
* Time complexity: O(n)
*/
public class Q4 {
private static int lastLowercaseValue = Character.getNumericValue('z');
private static int firstLowercaseValue = Character.getNumericValue('a');
// Assuming we won't receive non-letter values
private static char toLowercase(char c) {
int charValue = Character.getNumericValue(c);
if (charValue >= firstLowercaseValue && charValue <= lastLowercaseValue) {
return c;
}
return (char) (charValue + 32);
}
private static int getCharValue(char c) {
int charValue = Character.getNumericValue(c);
if (firstLowercaseValue <= charValue && charValue <= lastLowercaseValue) {
// if c == 'a' returns 0, if c == 'z' returns 25
return charValue - firstLowercaseValue;
}
return -1;
}
private static int[] buildCharFreqTable(String string) {
int[] table = new int[Character.getNumericValue('z') - Character.getNumericValue('a') + 1];
for(char c: string.toCharArray()) {
if (!Character.isLetter(c)) {
continue;
}
table[getCharValue(c)]++;
}
return table;
}
private static boolean isPalindromePermutation(String string) {
int[] frequencies = buildCharFreqTable(string);
int oddOnes = 0;
for(int value: frequencies) {
if (value % 2 != 0) {
oddOnes++;
}
if (oddOnes > 1) {
return false;
}
}
return true;
}
public static void main(String[] args) {
String[] testStrings = {"Tact Coa", "arc btos at ab sc roa", "kas lu tic ses"};
for(String string: testStrings) {
System.out.println(string + ": " + isPalindromePermutation(string));
}
}
}
| [
"[email protected]"
]
| |
7f788a58f6a114826a09c9ee79b4ef4fb7293191 | d1b2327a2f8e476637b1fa7c147c26f5113c2366 | /src/la/devcode/capitulo2/Ejemplo4.java | 58b56fe0ac277c17a22ce17d2a4248041443575e | []
| no_license | ivanlopezbreaperez/curso-java-8 | 1183462124ed0335e5a26a8588d17652daadbdab | 153ddbbd06d20611839cca271ae7c513cba27f43 | refs/heads/master | 2021-01-06T15:18:19.020517 | 2018-04-24T22:15:11 | 2018-04-24T22:15:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,454 | java | package la.devcode.capitulo2;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
// Capítulo 2: limitar y combinar streams
public class Ejemplo4 {
public static void main(String[] args) {
Stream<Double> randoms = Stream.generate(Math::random).limit(100);
show("randoms", randoms);
Stream<Integer> integers = Stream.iterate(0, n -> n + 1);
Stream<Integer> firstFive = integers.limit(5);
show("firstFive", firstFive);
integers = Stream.iterate(0, n -> n + 1);
Stream<Integer> notTheFirst = integers.skip(1).limit(5);
show("notTheFirst", notTheFirst);
Stream<Character> combined = Stream.concat(
Stream.of('H', 'e', 'l', 'l', 'o'),
Stream.of('w', 'o', 'r', 'l', 'd'));
show("combined", combined);
Object[] powers = Stream.iterate(1.0, p -> p * 2)
.peek(e -> System.out.println("Fetching " + e))
.limit(10)
.toArray();
}
// Muestra hasta 10 elementos de un Stream.
private static <T> void show(String title, Stream<T> stream) {
int size = 10;
List<T> firstElements = stream.limit(size + 1).collect(Collectors.toList());
System.out.print(title + ": ");
if (firstElements.size() <= size)
System.out.println(firstElements);
else {
firstElements.remove(size);
String out = firstElements.toString();
System.out.println(out.substring(0, out.length() - 1) + ", ...]");
}
}
}
| [
"[email protected]"
]
| |
5c986c03003dd56d749fa3c5e03a0d1e81967ea0 | ae1513dfbf9a6d94b8aaa8db701b19b9defd3f1b | /Auction_Narubina/Auction_Narubina-ejb/src/java/entity/Rating.java | 1371d6c0c9c96dc6327c625af1c5c01f28468544 | []
| no_license | Tanjusja/KURSACH | e51c4a1d14bc46be3a240edcfc09f2485c894d2a | 9326f5bdab3bd14cd98d33c4b8a05fd27920ea2d | refs/heads/master | 2021-01-23T14:05:29.824363 | 2013-11-25T22:45:37 | 2013-11-25T22:45:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,685 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package entity;
import java.io.Serializable;
import javax.persistence.Basic;
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.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
/**
*
* @author Танюся
*/
@Entity
@Table(name = "rating")
@NamedQueries({
@NamedQuery(name = "Rating.findAll", query = "SELECT r FROM Rating r"),
@NamedQuery(name = "Rating.findByIDUser", query = "SELECT r FROM Rating r WHERE r.iDUser = :iDUser"),
@NamedQuery(name = "Rating.findByAmountLots", query = "SELECT r FROM Rating r WHERE r.amountLots = :amountLots"),
@NamedQuery(name = "Rating.findByAmountLikes", query = "SELECT r FROM Rating r WHERE r.amountLikes = :amountLikes"),
@NamedQuery(name = "Rating.findByAmountOwnLikes", query = "SELECT r FROM Rating r WHERE r.amountOwnLikes = :amountOwnLikes"),
@NamedQuery(name = "Rating.findByAmountSales", query = "SELECT r FROM Rating r WHERE r.amountSales = :amountSales"),
@NamedQuery(name = "Rating.findByMark", query = "SELECT r FROM Rating r WHERE r.mark = :mark")})
public class Rating implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@NotNull
@Column(name = "ID_User")
private Integer iDUser;
@Basic(optional = false)
@NotNull
@Column(name = "Amount_Lots")
private int amountLots;
@Basic(optional = false)
@NotNull
@Column(name = "Amount_Likes")
private int amountLikes;
@Basic(optional = false)
@NotNull
@Column(name = "Amount_Own_Likes")
private int amountOwnLikes;
@Basic(optional = false)
@NotNull
@Column(name = "Amount_Sales")
private int amountSales;
@Basic(optional = false)
@NotNull
@Column(name = "Mark")
private int mark;
@JoinColumn(name = "ID_User", referencedColumnName = "ID_User", insertable = false, updatable = false)
@OneToOne(optional = false, fetch = FetchType.EAGER)
private Users users;
public Rating() {
}
public Rating(Integer iDUser) {
this.iDUser = iDUser;
}
public Rating(Integer iDUser, int amountLots, int amountLikes, int amountOwnLikes, int amountSales, int mark) {
this.iDUser = iDUser;
this.amountLots = amountLots;
this.amountLikes = amountLikes;
this.amountOwnLikes = amountOwnLikes;
this.amountSales = amountSales;
this.mark = mark;
}
public Integer getIDUser() {
return iDUser;
}
public void setIDUser(Integer iDUser) {
this.iDUser = iDUser;
}
public int getAmountLots() {
return amountLots;
}
public void setAmountLots(int amountLots) {
this.amountLots = amountLots;
}
public int getAmountLikes() {
return amountLikes;
}
public void setAmountLikes(int amountLikes) {
this.amountLikes = amountLikes;
}
public int getAmountOwnLikes() {
return amountOwnLikes;
}
public void setAmountOwnLikes(int amountOwnLikes) {
this.amountOwnLikes = amountOwnLikes;
}
public int getAmountSales() {
return amountSales;
}
public void setAmountSales(int amountSales) {
this.amountSales = amountSales;
}
public int getMark() {
return mark;
}
public void setMark(int mark) {
this.mark = mark;
}
public Users getUsers() {
return users;
}
public void setUsers(Users users) {
this.users = users;
}
@Override
public int hashCode() {
int hash = 0;
hash += (iDUser != null ? iDUser.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 Rating)) {
return false;
}
Rating other = (Rating) object;
if ((this.iDUser == null && other.iDUser != null) || (this.iDUser != null && !this.iDUser.equals(other.iDUser))) {
return false;
}
return true;
}
@Override
public String toString() {
return "entity.Rating[ iDUser=" + iDUser + " ]";
}
}
| [
"[email protected]"
]
| |
ae00d8fdbd1e546d506b3a6046541e28ac20bdd7 | 0b4844d550c8e77cd93940e4a1d8b06d0fbeabf7 | /JavaSource/dream/asset/rpt/maintcost/dao/sqlImpl/AssetRptMaintCostListDAOSqlImpl.java | d5a9befbf13d7e68f32d64fb9ee25f9416ef9fad | []
| no_license | eMainTec-DREAM/DREAM | bbf928b5c50dd416e1d45db3722f6c9e35d8973c | 05e3ea85f9adb6ad6cbe02f4af44d941400a1620 | refs/heads/master | 2020-12-22T20:44:44.387788 | 2020-01-29T06:47:47 | 2020-01-29T06:47:47 | 236,912,749 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 8,421 | java | package dream.asset.rpt.maintcost.dao.sqlImpl;
import java.util.List;
import common.bean.User;
import common.spring.BaseJdbcDaoSupportSql;
import common.util.DateUtil;
import common.util.QuerySqlBuffer;
import dream.asset.rpt.maintcost.dao.AssetRptMaintCostListDAO;
import dream.asset.rpt.maintcost.dto.AssetRptMaintCostCommonDTO;
/**
* 수선유지비 집행현황 - List DAO implements
* @author youngjoo38
* @version $Id:$
* @since 1.0
*
* @spring.bean id="assetRptMaintCostListDAOTarget"
* @spring.txbn id="assetRptMaintCostListDAO"
* @spring.property name="dataSource" ref="dataSource"
*/
public class AssetRptMaintCostListDAOSqlImpl extends BaseJdbcDaoSupportSql implements AssetRptMaintCostListDAO
{
/**
* grid find
* @author youngjoo38
* @version $Id:$
* @since 1.0
*
* @param assetRptMaintCostCommonDTO
* @return List
*/
public List findList(AssetRptMaintCostCommonDTO assetRptMaintCostCommonDTO, User user) throws Exception
{
QuerySqlBuffer query = new QuerySqlBuffer();
query.append("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; ");
query.append("select ");
query.append(" '' as seqNo ");
query.append(" ,a.plant as plantId ");
query.append(" ,(select description from TAPLANT where comp_no = a.comp_no and plant = a.plant) as plantDesc ");
query.append(" ,(SELECT c.description FROM TADEPT c WHERE c.comp_no = a.comp_no AND c.dept_id = b.dept_id) DEPTDESC ");
query.append(" ,SUBSTRING(a.tmonth,1,4)+'-'+SUBSTRING(a.tmonth,5,2) as month ");
query.append(" ,isnull(b.tot_cnt,0) as EXEMAINTAMT ");
query.append(" ,isnull(b.mit_cnt,0) as PLANMAINTAMT ");
query.append(" ,ROUND(isnull(b.mit_cnt,0) / case when b.tot_cnt is null then 1 else b.tot_cnt end *100,2) as PLANVSRSLTAMT ");
query.append("from (select y.plant, x.tmonth, y.comp_no ");
query.append(" from TAMONTH x inner join TAPLANT y on 1=1 ");
query.append(" where 1=1 ");
query.append(this.getWhere(assetRptMaintCostCommonDTO, user, "y"));
query.append(" ) a left outer join ");
query.append(" (select ");
query.append(" a.plant ");
query.append(" ,a.res_date as tmonth ");
query.append(" ,COUNT(*) as tot_cnt ");
query.append(" ,SUM(mit_cnt) as mit_cnt ");
query.append(" ,a.dept_id ");
query.append(" from ( ");
query.append(" select ");
query.append(" b.plant ");
query.append(" ,SUBSTRING(a.res_date,1,6) as res_date ");
query.append(" ,case when a.woreq_gen_type ='EM' then 1 else 0 end mit_cnt ");
query.append(" , b.dept_id as dept_id ");
query.append(" from TAWOREQRES a inner join TAWORKORDER b on a.comp_no = b.comp_no and a.wkor_id = b.wkor_id ");
query.append(" where 1=1 ");
query.append(this.getWhere(assetRptMaintCostCommonDTO, user, "b"));
query.append(" ) a ");
query.append(" where 1=1 ");
query.append(" group by a.plant, a.res_date ");
query.append(" , a.dept_id ");
query.append(" ) b on a.plant = b.plant and a.tmonth = b.tmonth ");
query.append("where 1=1 ");
// query.append("order by MONTH,b.plant ");
query.getOrderByQuery("a.tmonth", "MONTH, b.plant", assetRptMaintCostCommonDTO.getOrderBy(), assetRptMaintCostCommonDTO.getDirection());
return getJdbcTemplate().queryForList(query.toString(assetRptMaintCostCommonDTO.getIsLoadMaxCount(), assetRptMaintCostCommonDTO.getFirstRow()));
}
/**
* Filter 조건
* @author youngjoo38
* @version $Id: $
* @since 1.0
*
* @param assetRptMaintCostCommonDTO
* @return
* @throws Exception
*/
private String getWhere(AssetRptMaintCostCommonDTO assetRptMaintCostCommonDTO, User user, String alias) throws Exception
{
QuerySqlBuffer query = new QuerySqlBuffer();
query.getAndQuery(alias+".comp_no", user.getCompNo());
// 공장
query.getCodeLikeQuery(alias + ".plant", "(SELECT xx.description FROM TAPLANT xx WHERE xx.comp_no = '"+user.getCompNo()+"' AND " +alias +".plant = xx.plant )",
assetRptMaintCostCommonDTO.getFilterPlantId(), assetRptMaintCostCommonDTO.getFilterPlantDesc());
// 월
String fromMonth = assetRptMaintCostCommonDTO.getFilterStartDate();
String toMonth = assetRptMaintCostCommonDTO.getFilterEndDate();
if (fromMonth != null && !"".equals(fromMonth) && toMonth != null && !"".equals(toMonth))
{
if ("b".equals(alias)) {
query.getAndDateQuery("a.res_date", fromMonth +"01", DateUtil.plusLastDayOfMonth(toMonth));
} else if ("y".equals(alias)){
query.getAndDateQuery("x.tmonth", fromMonth, toMonth);
}
}
if ("b".equals(alias)) {
query.getAndQuery("a.woreqres_method", "WO");
query.getAndQuery("b.is_deleted", "N");
//부서
query.getDeptLevelQuery("b.dept_id", assetRptMaintCostCommonDTO.getFilterDeptId(), assetRptMaintCostCommonDTO.getFilterDeptDesc(), user.getCompNo());
}
return query.toString();
}
public String findTotalCount(
AssetRptMaintCostCommonDTO assetRptMaintCostCommonDTO, User user) throws Exception {
QuerySqlBuffer query = new QuerySqlBuffer();
query.append("SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; ");
query.append("SELECT ");
query.append(" count(1) ");
query.append("from (select y.plant, x.tmonth, y.comp_no ");
query.append(" from TAMONTH x inner join TAPLANT y on 1=1 ");
query.append(" where 1=1 ");
query.append(this.getWhere(assetRptMaintCostCommonDTO, user, "y"));
query.append(" ) a left outer join ");
query.append(" (select ");
query.append(" a.plant ");
query.append(" ,a.res_date as tmonth ");
query.append(" ,COUNT(*) as tot_cnt ");
query.append(" ,SUM(mit_cnt) as mit_cnt ");
query.append(" ,a.dept_id ");
query.append(" from ( ");
query.append(" select ");
query.append(" b.plant ");
query.append(" ,SUBSTRING(a.res_date,1,6) as res_date ");
query.append(" ,case when a.woreq_gen_type ='EM' then 1 else 0 end mit_cnt ");
query.append(" , b.dept_id as dept_id ");
query.append(" from TAWOREQRES a inner join TAWORKORDER b on a.comp_no = b.comp_no and a.wkor_id = b.wkor_id ");
query.append(" where 1=1 ");
query.append(this.getWhere(assetRptMaintCostCommonDTO, user, "b"));
query.append(" ) a ");
query.append(" where 1=1 ");
query.append(" group by a.plant, a.res_date ");
query.append(" , a.dept_id ");
query.append(" ) b on a.plant = b.plant and a.tmonth = b.tmonth ");
query.append("where 1=1 ");
List resultList= getJdbcTemplate().queryForList(query.toString());
return QuerySqlBuffer.listToString(resultList);
}
}
| [
"[email protected]"
]
| |
97c0aa886980e9a5402f75434e23d2f76ae382b5 | 2633fb1280a23e747162d44ae7e8694401b4da54 | /VidyoPortal/src/com/vidyo/portal/ucclients/GetUserStatusResponse.java | 0f551011789fb568beff88161fe1ac0aaf33afbb | []
| no_license | rahitkumar/VidyoPortal | 2159cc515acd22471f484867805cd4a4105f209f | 60101525c0e2cb1a50c55cbb94deb7c44685f1ab | refs/heads/master | 2020-06-16T20:16:33.920559 | 2019-07-07T19:47:47 | 2019-07-07T19:47:47 | 195,687,237 | 4 | 3 | null | null | null | null | UTF-8 | Java | false | false | 15,878 | java | /**
* GetUserStatusResponse.java
*
* This file was auto-generated from WSDL
* by the Apache Axis2 version: 1.6.0 Built on : May 17, 2011 (04:21:18 IST)
*/
package com.vidyo.portal.ucclients;
/**
* GetUserStatusResponse bean class
*/
@SuppressWarnings({ "unchecked", "unused" })
public class GetUserStatusResponse implements
org.apache.axis2.databinding.ADBBean {
public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName(
"http://portal.vidyo.com/ucclients", "GetUserStatusResponse", "ns4");
/**
* field for UserStatus This was an Array!
*/
protected com.vidyo.portal.ucclients.UserStatus_type0[] localUserStatus;
/**
* Auto generated getter method
*
* @return com.vidyo.portal.ucclients.UserStatus_type0[]
*/
public com.vidyo.portal.ucclients.UserStatus_type0[] getUserStatus() {
return localUserStatus;
}
/**
* validate the array for UserStatus
*/
protected void validateUserStatus(
com.vidyo.portal.ucclients.UserStatus_type0[] param) {
if ((param != null) && (param.length < 1)) {
throw new java.lang.RuntimeException();
}
}
/**
* Auto generated setter method
*
* @param param
* UserStatus
*/
public void setUserStatus(
com.vidyo.portal.ucclients.UserStatus_type0[] param) {
validateUserStatus(param);
this.localUserStatus = param;
}
/**
* Auto generated add method for the array for convenience
*
* @param param
* com.vidyo.portal.ucclients.UserStatus_type0
*/
public void addUserStatus(com.vidyo.portal.ucclients.UserStatus_type0 param) {
if (localUserStatus == null) {
localUserStatus = new com.vidyo.portal.ucclients.UserStatus_type0[] {};
}
java.util.List list = org.apache.axis2.databinding.utils.ConverterUtil
.toList(localUserStatus);
list.add(param);
this.localUserStatus = (com.vidyo.portal.ucclients.UserStatus_type0[]) list
.toArray(new com.vidyo.portal.ucclients.UserStatus_type0[list
.size()]);
}
/**
*
* @param parentQName
* @param factory
* @return org.apache.axiom.om.OMElement
*/
public org.apache.axiom.om.OMElement getOMElement(
final javax.xml.namespace.QName parentQName,
final org.apache.axiom.om.OMFactory factory)
throws org.apache.axis2.databinding.ADBException {
org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource(
this, MY_QNAME);
return factory.createOMElement(dataSource, MY_QNAME);
}
public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException,
org.apache.axis2.databinding.ADBException {
serialize(parentQName, xmlWriter, false);
}
public void serialize(final javax.xml.namespace.QName parentQName,
javax.xml.stream.XMLStreamWriter xmlWriter, boolean serializeType)
throws javax.xml.stream.XMLStreamException,
org.apache.axis2.databinding.ADBException {
java.lang.String prefix = null;
java.lang.String namespace = null;
prefix = parentQName.getPrefix();
namespace = parentQName.getNamespaceURI();
writeStartElement(prefix, namespace, parentQName.getLocalPart(),
xmlWriter);
if (serializeType) {
java.lang.String namespacePrefix = registerPrefix(xmlWriter,
"http://portal.vidyo.com/ucclients");
if ((namespacePrefix != null)
&& (namespacePrefix.trim().length() > 0)) {
writeAttribute("xsi",
"http://www.w3.org/2001/XMLSchema-instance", "type",
namespacePrefix + ":GetUserStatusResponse", xmlWriter);
} else {
writeAttribute("xsi",
"http://www.w3.org/2001/XMLSchema-instance", "type",
"GetUserStatusResponse", xmlWriter);
}
}
if (localUserStatus != null) {
for (int i = 0; i < localUserStatus.length; i++) {
if (localUserStatus[i] != null) {
localUserStatus[i].serialize(new javax.xml.namespace.QName(
"http://portal.vidyo.com/ucclients", "UserStatus"),
xmlWriter);
} else {
throw new org.apache.axis2.databinding.ADBException(
"UserStatus cannot be null!!");
}
}
} else {
throw new org.apache.axis2.databinding.ADBException(
"UserStatus cannot be null!!");
}
xmlWriter.writeEndElement();
}
private static java.lang.String generatePrefix(java.lang.String namespace) {
if (namespace.equals("http://portal.vidyo.com/ucclients")) {
return "ns4";
}
return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix();
}
/**
* Utility method to write an element start tag.
*/
private void writeStartElement(java.lang.String prefix,
java.lang.String namespace, java.lang.String localPart,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException {
java.lang.String writerPrefix = xmlWriter.getPrefix(namespace);
if (writerPrefix != null) {
xmlWriter.writeStartElement(namespace, localPart);
} else {
if (namespace.length() == 0) {
prefix = "";
} else if (prefix == null) {
prefix = generatePrefix(namespace);
}
xmlWriter.writeStartElement(prefix, localPart, namespace);
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
}
/**
* Util method to write an attribute with the ns prefix
*/
private void writeAttribute(java.lang.String prefix,
java.lang.String namespace, java.lang.String attName,
java.lang.String attValue,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException {
if (xmlWriter.getPrefix(namespace) == null) {
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
xmlWriter.writeAttribute(namespace, attName, attValue);
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeAttribute(java.lang.String namespace,
java.lang.String attName, java.lang.String attValue,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException {
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attValue);
}
}
/**
* Util method to write an attribute without the ns prefix
*/
private void writeQNameAttribute(java.lang.String namespace,
java.lang.String attName, javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException {
java.lang.String attributeNamespace = qname.getNamespaceURI();
java.lang.String attributePrefix = xmlWriter
.getPrefix(attributeNamespace);
if (attributePrefix == null) {
attributePrefix = registerPrefix(xmlWriter, attributeNamespace);
}
java.lang.String attributeValue;
if (attributePrefix.trim().length() > 0) {
attributeValue = attributePrefix + ":" + qname.getLocalPart();
} else {
attributeValue = qname.getLocalPart();
}
if (namespace.equals("")) {
xmlWriter.writeAttribute(attName, attributeValue);
} else {
registerPrefix(xmlWriter, namespace);
xmlWriter.writeAttribute(namespace, attName, attributeValue);
}
}
/**
* method to handle Qnames
*/
private void writeQName(javax.xml.namespace.QName qname,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException {
java.lang.String namespaceURI = qname.getNamespaceURI();
if (namespaceURI != null) {
java.lang.String prefix = xmlWriter.getPrefix(namespaceURI);
if (prefix == null) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
xmlWriter.writeCharacters(prefix
+ ":"
+ org.apache.axis2.databinding.utils.ConverterUtil
.convertToString(qname));
} else {
// i.e this is the default namespace
xmlWriter
.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil
.convertToString(qname));
}
} else {
xmlWriter
.writeCharacters(org.apache.axis2.databinding.utils.ConverterUtil
.convertToString(qname));
}
}
private void writeQNames(javax.xml.namespace.QName[] qnames,
javax.xml.stream.XMLStreamWriter xmlWriter)
throws javax.xml.stream.XMLStreamException {
if (qnames != null) {
// we have to store this data until last moment since it is not
// possible to write any
// namespace data after writing the charactor data
java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer();
java.lang.String namespaceURI = null;
java.lang.String prefix = null;
for (int i = 0; i < qnames.length; i++) {
if (i > 0) {
stringToWrite.append(" ");
}
namespaceURI = qnames[i].getNamespaceURI();
if (namespaceURI != null) {
prefix = xmlWriter.getPrefix(namespaceURI);
if ((prefix == null) || (prefix.length() == 0)) {
prefix = generatePrefix(namespaceURI);
xmlWriter.writeNamespace(prefix, namespaceURI);
xmlWriter.setPrefix(prefix, namespaceURI);
}
if (prefix.trim().length() > 0) {
stringToWrite
.append(prefix)
.append(":")
.append(org.apache.axis2.databinding.utils.ConverterUtil
.convertToString(qnames[i]));
} else {
stringToWrite
.append(org.apache.axis2.databinding.utils.ConverterUtil
.convertToString(qnames[i]));
}
} else {
stringToWrite
.append(org.apache.axis2.databinding.utils.ConverterUtil
.convertToString(qnames[i]));
}
}
xmlWriter.writeCharacters(stringToWrite.toString());
}
}
/**
* Register a namespace prefix
*/
private java.lang.String registerPrefix(
javax.xml.stream.XMLStreamWriter xmlWriter,
java.lang.String namespace)
throws javax.xml.stream.XMLStreamException {
java.lang.String prefix = xmlWriter.getPrefix(namespace);
if (prefix == null) {
prefix = generatePrefix(namespace);
while (xmlWriter.getNamespaceContext().getNamespaceURI(prefix) != null) {
prefix = org.apache.axis2.databinding.utils.BeanUtil
.getUniquePrefix();
}
xmlWriter.writeNamespace(prefix, namespace);
xmlWriter.setPrefix(prefix, namespace);
}
return prefix;
}
/**
* databinding method to get an XML representation of this object
*
*/
public javax.xml.stream.XMLStreamReader getPullParser(
javax.xml.namespace.QName qName)
throws org.apache.axis2.databinding.ADBException {
java.util.ArrayList elementList = new java.util.ArrayList();
java.util.ArrayList attribList = new java.util.ArrayList();
if (localUserStatus != null) {
for (int i = 0; i < localUserStatus.length; i++) {
if (localUserStatus[i] != null) {
elementList.add(new javax.xml.namespace.QName(
"http://portal.vidyo.com/ucclients", "UserStatus"));
elementList.add(localUserStatus[i]);
} else {
throw new org.apache.axis2.databinding.ADBException(
"UserStatus cannot be null !!");
}
}
} else {
throw new org.apache.axis2.databinding.ADBException(
"UserStatus cannot be null!!");
}
return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl(
qName, elementList.toArray(), attribList.toArray());
}
/**
* Factory class that keeps the parse method
*/
public static class Factory {
/**
* static method to create the object Precondition: If this object is an
* element, the current or next start element starts this object and any
* intervening reader events are ignorable If this object is not an
* element, it is a complex type and the reader is at the event just
* after the outer start element Postcondition: If this object is an
* element, the reader is positioned at its end element If this object
* is a complex type, the reader is positioned at the end element of its
* outer element
*/
public static GetUserStatusResponse parse(
javax.xml.stream.XMLStreamReader reader)
throws java.lang.Exception {
GetUserStatusResponse object = new GetUserStatusResponse();
int event;
java.lang.String nillableValue = null;
java.lang.String prefix = "";
java.lang.String namespaceuri = "";
try {
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.getAttributeValue(
"http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
java.lang.String fullTypeName = reader
.getAttributeValue(
"http://www.w3.org/2001/XMLSchema-instance",
"type");
if (fullTypeName != null) {
java.lang.String nsPrefix = null;
if (fullTypeName.indexOf(":") > -1) {
nsPrefix = fullTypeName.substring(0,
fullTypeName.indexOf(":"));
}
nsPrefix = nsPrefix == null ? "" : nsPrefix;
java.lang.String type = fullTypeName
.substring(fullTypeName.indexOf(":") + 1);
if (!"GetUserStatusResponse".equals(type)) {
// find namespace for the prefix
java.lang.String nsUri = reader
.getNamespaceContext().getNamespaceURI(
nsPrefix);
return (GetUserStatusResponse) com.vidyo.portal.ucclients.ExtensionMapper
.getTypeObject(nsUri, type, reader);
}
}
}
// Note all attributes that were handled. Used to differ normal
// attributes
// from anyAttributes.
java.util.Vector handledAttributes = new java.util.Vector();
reader.next();
java.util.ArrayList list1 = new java.util.ArrayList();
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement()
&& new javax.xml.namespace.QName(
"http://portal.vidyo.com/ucclients",
"UserStatus").equals(reader.getName())) {
// Process the array and step past its final element's end.
list1.add(com.vidyo.portal.ucclients.UserStatus_type0.Factory
.parse(reader));
// loop until we find a start element that is not part of
// this array
boolean loopDone1 = false;
while (!loopDone1) {
// We should be at the end element, but make sure
while (!reader.isEndElement())
reader.next();
// Step out of this element
reader.next();
// Step to next element event.
while (!reader.isStartElement()
&& !reader.isEndElement())
reader.next();
if (reader.isEndElement()) {
// two continuous end elements means we are exiting
// the xml structure
loopDone1 = true;
} else {
if (new javax.xml.namespace.QName(
"http://portal.vidyo.com/ucclients",
"UserStatus").equals(reader.getName())) {
list1.add(com.vidyo.portal.ucclients.UserStatus_type0.Factory
.parse(reader));
} else {
loopDone1 = true;
}
}
}
// call the converter utility to convert and set the array
object.setUserStatus((com.vidyo.portal.ucclients.UserStatus_type0[]) org.apache.axis2.databinding.utils.ConverterUtil
.convertToArray(
com.vidyo.portal.ucclients.UserStatus_type0.class,
list1));
} // End of if for expected property start element
else {
// A start element we are not expecting indicates an invalid
// parameter was passed
throw new org.apache.axis2.databinding.ADBException(
"Unexpected subelement " + reader.getName());
}
while (!reader.isStartElement() && !reader.isEndElement())
reader.next();
if (reader.isStartElement())
// A start element we are not expecting indicates a trailing
// invalid property
throw new org.apache.axis2.databinding.ADBException(
"Unexpected subelement " + reader.getName());
} catch (javax.xml.stream.XMLStreamException e) {
throw new java.lang.Exception(e);
}
return object;
}
}// end of factory class
}
| [
"[email protected]"
]
| |
969258588cc0bde75d9e90b7eff09979bef53317 | 4ba39581e024360f3aa7684f3d3af101378574d9 | /app/src/main/java/com/example/timesheetforemployees/EmpProfile.java | 9b9cd5f36eae14bd067ba3f5d1665b8c2ab8a82a | []
| no_license | manohar-poduri/Timesheet_for_employees | 0b1b3d6e2185dd3b0bbab1767e38fdc4c3a3e416 | 6676f38dd2bed068e5df2b83d7299f2e501bafc4 | refs/heads/master | 2022-12-20T18:11:20.824561 | 2020-09-09T03:45:33 | 2020-09-09T03:45:33 | 287,578,806 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,081 | java | package com.example.timesheetforemployees;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;
import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
public class EmpProfile extends AppCompatActivity {
TextView name, designation, birth, father, email, phone,join;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_emp_profile);
name = findViewById(R.id.name_profile);
designation = findViewById(R.id.designation_profile);
birth = findViewById(R.id.birth_profile);
father = findViewById(R.id.father_profile);
email = findViewById(R.id.email_profile);
phone = findViewById(R.id.phone_profile);
showAllUserDate();
}
private void showAllUserDate() {
Intent intent = getIntent();
String user_name = intent.getStringExtra("name");
String user_designation = intent.getStringExtra("designation");
String user_birth = intent.getStringExtra("birth");
String user_father = intent.getStringExtra("father");
String user_email = intent.getStringExtra("email");
String user_phone = intent.getStringExtra("phone");
String user_join = intent.getStringExtra("join");
name.setText(user_name);
designation.setText(user_designation);
birth.setText(user_birth);
father.setText(user_father);
email.setText(user_email);
phone.setText(user_phone);
join.setText(user_join);
}
} | [
"[email protected]"
]
| |
99f0a84700f179de5b8b7a6827985241493d6715 | 3c63907025075a4eb5554b3cb4a2bbcce6d04cc9 | /itsnat_featshow/src/main/webapp/WEB-INF/src/org/itsnat/feashow/features/core/domutils/PersonExtended.java | 5fadb6107b01ef3ff08feebb8a45af28e48ec9e6 | []
| no_license | jmarranz/itsnat_server | 36da4d7c2c91c7d07c4a6c639b6513f16def639d | 49337e09adda04ad120eecf9eea614ac4e44c8ab | refs/heads/master | 2020-04-10T15:52:49.481387 | 2016-04-13T18:04:28 | 2016-04-13T18:04:28 | 6,872,297 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,253 | java | /*
* This file is not part of the ItsNat framework.
*
* Original source code use and closed source derivatives are authorized
* to third parties with no restriction or fee.
* The original source code is owned by the author.
*
* This program is distributed AS IS 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.
*
* (C) Innowhere Software a service of Jose Maria Arranz Santamaria, Spanish citizen.
*/
package org.itsnat.feashow.features.core.domutils;
import org.itsnat.feashow.features.comp.shared.Person;
public class PersonExtended extends Person
{
protected int age;
protected boolean married;
public PersonExtended(String firstName,String lastName,int age,boolean married)
{
super(firstName,lastName);
this.age = age;
this.married = married;
}
public int getAge()
{
return age;
}
public void setAge(int age)
{
this.age = age;
}
public boolean isMarried()
{
return married;
}
public void setMarried(boolean married)
{
this.married = married;
}
}
| [
"[email protected]"
]
| |
ac3497d9346f9b8b00db16609190282b808594d1 | 109f5fd1a4042672529c7cccad394afe38473bd1 | /src/com/fourkkm/citylife/control/activity/SubjectMapMarkerActivity.java | 236aa6b318f833f8c955462611a74abd0cd9b158 | []
| no_license | ShanZha/CityLife | 3e436d36254d306755a7b4e015a0b5d5ab0cd5f5 | 2f09b68b34b4fc6c9425f8c6206a87de1a248871 | refs/heads/master | 2016-09-09T18:44:10.978495 | 2014-05-05T02:00:46 | 2014-05-05T02:00:46 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,865 | java | package com.fourkkm.citylife.control.activity;
import android.util.Log;
import android.view.View;
import com.andrnes.modoer.ModoerSubject;
import com.fourkkm.citylife.R;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.CameraPosition;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.zj.app.BaseFragmentActivity;
/**
* 店铺位置展示界面
*
* @author ShanZha
*
*/
public class SubjectMapMarkerActivity extends BaseFragmentActivity implements
OnMarkerClickListener {
private static final String TAG = "SubjectMapMarkerActivity";
private GoogleMap mMap;
private ModoerSubject mSubject;
@Override
protected void prepareViews() {
// TODO Auto-generated method stub
super.prepareViews();
this.setContentView(R.layout.subject_map_marker);
mMap = ((SupportMapFragment) this.getSupportFragmentManager()
.findFragmentById(R.id.subject_map_marker_fragment)).getMap();
}
@Override
protected void prepareDatas() {
// TODO Auto-generated method stub
super.prepareDatas();
mSubject = (ModoerSubject) this.getIntent().getSerializableExtra(
"ModoerSubject");
if (null == mSubject) {
Log.e(TAG, "shan-->mSubject is null");
return;
}
mMap.setOnMarkerClickListener(this);
// mMap.setOnInfoWindowClickListener(this);
// mMap.setOnMarkerDragListener(this);
// Hide the zoom controls as the button panel will cover it.
mMap.getUiSettings().setZoomControlsEnabled(false);
LatLng latlng = new LatLng(mSubject.getMapLat(), mSubject
.getMapLng());
MarkerOptions options = new MarkerOptions();
options.position(latlng);
options.draggable(false);
options.visible(true);
options.anchor(0.5f, 0.5f);
options.title(mSubject.getName());
options.snippet(mSubject.getAddress());
options.icon(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_AZURE));
mMap.addMarker(options);
// 将摄影机移动到指定的地理位置
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(latlng).zoom(17) // 缩放比例
.bearing(0) // 地图方位(East)
.tilt(0) // 地图倾斜角度
.build();
mMap.animateCamera(CameraUpdateFactory
.newCameraPosition(cameraPosition));
}
public void onClickBack(View view) {
this.finish();
}
@Override
public boolean onMarkerClick(Marker marker) {
// TODO Auto-generated method stub
return false;
}
}
| [
"[email protected]"
]
| |
a4d651d1fa303e7d86d992f6d1b0863086589391 | f4d8f789541888f81cadcb0fb34e807926e673bc | /chapter_002/src/main/java/ru/job4j/tracker2/start/interfaces/Input.java | 0a6de95eb3641a73aa117fcf34ec1784d8a82d95 | [
"Apache-2.0"
]
| permissive | Massimilian/Vasily-Maslov | 844cc913e78463a06b961c9890d4d8188d85e793 | c741c19831fcb9eabd6d83ba0450e931925f48de | refs/heads/master | 2021-06-14T03:39:15.012034 | 2020-02-28T22:13:23 | 2020-02-28T22:13:23 | 111,004,725 | 0 | 1 | Apache-2.0 | 2020-10-12T17:45:26 | 2017-11-16T18:01:06 | Java | UTF-8 | Java | false | false | 164 | java | package ru.job4j.tracker2.start.interfaces;
public interface Input {
String ask(String question);
int ask(String question, int[] range); // overloading
} | [
"[email protected]"
]
| |
44995adea41d0c7544a76e07903c8118cfa65cce | 4ea1afec746384694ecbd08efad6b94fe198bd33 | /spring-03-ioc2/src/main/java/com/kuang/pojo/User.java | 26b66bc98892d87011afc714e5c8d63b904e3af8 | []
| no_license | lirulei/sprint-study | cbd07e6f969f1e1c1b133afb5181f3097a4b7b99 | af4b2cd69a35a89d6da7317ddc0bd86ec3ba511d | refs/heads/master | 2023-03-14T10:21:10.806701 | 2021-02-23T11:56:20 | 2021-02-23T11:56:20 | 329,032,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package com.kuang.pojo;
/***
* @author lee
*/
public class User {
private String name;
/***
* 构造器(有参)方式注入
*/
public User(String name) {
this.name = name;
}
public String getName() {
return name;
}
/***
* setter方式注入
*/
public void setName(String name) {
this.name = name;
}
public void show() {
System.out.println("姓名 ==> " + this.name);
}
}
| [
"[email protected]"
]
| |
a1192afd1ae9a7123d0de09efe9106358dbfa454 | 60488a984a38eb7fea59acc09f8a9c43e3b28d3e | /src/product/model/OrderDAO.java | fe38938c8717cc31acedafcc2c54dde5cffd40e7 | []
| no_license | ortemis94/Covengers | 332b4e50eb390381162589e7dfaba30962cf4679 | 1038177704060e72d62989a8b12e419cc5d73f04 | refs/heads/master | 2023-02-13T16:09:40.653938 | 2021-01-14T08:53:37 | 2021-01-14T08:53:37 | 313,332,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,507 | java | package product.model;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import java.io.UnsupportedEncodingException;
import util.security.AES256;
import util.security.SecretMyKey;
public class OrderDAO implements InterOrderDAO {
private DataSource ds; // DataSource ds 는 아파치톰캣이 제공하는 DBCP(DB Connection Pool) 이다.
private Connection conn;
private PreparedStatement pstmt;
private ResultSet rs;
private AES256 aes;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public OrderDAO() {
try {
Context initContext = new InitialContext();
Context envContext = (Context) initContext.lookup("java:/comp/env");
ds = (DataSource) envContext.lookup("jdbc/covengers_oracle");
aes = new AES256(SecretMyKey.KEY);
} catch (NamingException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void close() {
try {
if (rs != null) {
rs.close();
rs = null;
}
if (pstmt != null) {
pstmt.close();
pstmt = null;
}
if (conn != null) {
conn.close();
conn = null;
}
} catch (SQLException e) {
e.printStackTrace();
}
}
// 개별 주문 내역 가져오기
@Override
public List<OrderVO> selectDetailList(String fk_userno) throws SQLException {
List<OrderVO> orderList = new ArrayList<>();
int total = 0;
try {
conn = ds.getConnection();
String sql = " select p.paymentno, p.fk_userno, p.totalprice, to_char(p.paymentdate, 'yyyy-mm-dd hh24:mi:ss') as paymentdate, " +
" p.fk_shippingno, d.pdetailno, d.fk_optioncode, t.krproductname, o.optionname, t.price as price, d.orderqty as orderqty, t.productimg1 as productimg, d.delstatus " +
" from tbl_payment p " +
" join tbl_payment_detail d " +
" on p.paymentno = fk_paymentno " +
" join tbl_option o " +
" on o.optioncode = d.fk_optioncode " +
" join tbl_product t " +
" on t.productcode = o.fk_productcode " +
" where p.fk_userno = ? " +
" order by paymentdate desc " ;
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, fk_userno);
rs = pstmt.executeQuery();
while (rs.next()) {
OrderVO order = new OrderVO();
total = rs.getInt(3);
order.setO_paymentno(rs.getInt(1));
order.setO_fk_userno(rs.getString(2));
order.setO_totalprice(total);
order.setO_paymentdate(rs.getString(4));
order.setO_fk_shippingno(rs.getInt(5));
order.setO_pdetailno(rs.getInt(6));
order.setO_fk_optioncode(rs.getString(7));
order.setO_krproductname(rs.getString(8));
order.setO_optionname(rs.getString(9));
order.setO_price(rs.getInt(10));
order.setO_orderqty(rs.getInt(11));
order.setO_productimg(rs.getString(12));
order.setO_delstatus(rs.getInt(13));
orderList.add(order);
}
} finally {
close();
}
return orderList;
}
// 전체 주문 내역 가져오기
@Override
public List<OrderVO> selectOrderList(String fk_userno) throws SQLException {
List<OrderVO> orderList = new ArrayList<>();
try {
conn = ds.getConnection();
String sql = " select e.fk_paymentno, p.fk_userno, to_char(p.paymentdate, 'yyyy-mm-dd hh24:mi:ss') as paymentdate, p.totalprice, p.fk_shippingno, e.pdetailno, e.orderqty, e.fk_optioncode, d.optionname, r.krproductname, r.productcode "
+ " from tbl_payment p " + " join ( select PDETAILNO, FK_PAYMENTNO, FK_OPTIONCODE, ORDERQTY "
+ " from tbl_payment_detail " + " where rowid in ( " + " select max(rowid) "
+ " from tbl_payment_detail " + " group by fk_paymentno) ) e " + " on p.paymentno = e.fk_paymentno "
+ " join tbl_option d " + " on d.OPTIONCODE = e.fk_optioncode " + " join tbl_product r "
+ " on r.PRODUCTCODE = d.FK_PRODUCTCODE " + " where fk_userno = ? "
+ " order by e.fk_paymentno desc ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, fk_userno);
rs = pstmt.executeQuery();
while (rs.next()) {
OrderVO order = new OrderVO();
order.setPaymentno(rs.getInt(1));
order.setUserno(rs.getString(2));
order.setPaymentdate(rs.getString(3));
order.setTotalprice(rs.getString(4));
order.setShippingno(rs.getInt(5));
order.setPdetailno(rs.getInt(6));
order.setOrderqty(rs.getInt(7));
order.setOptioncode(rs.getString(8));
order.setOptionname(rs.getString(9));
order.setKrname(rs.getString(10));
order.setO_productcode(rs.getString(11));
orderList.add(order);
}
} finally {
close();
}
return orderList;
}
@Override
public List<Map<String, String>> getPurchaseList(String userno) throws SQLException {
List<Map<String, String>> purchaseList = new ArrayList<>();
try {
conn = ds.getConnection();
String sql = "select m.paymentno, p.productimg1, p.krproductname, o.optionname, d.orderqty\n"+
", case (trunc(sysdate) - trunc(m.paymentdate)) when 0 then 0 \n"+
" when 1 then 1\n"+
" when 2 then 2\n"+
" when 3 then 3\n"+
" when 4 then 4\n"+
" when 5 then 5\n"+
" else 6 end as paymentcheck\n"+
", p.productcode, d.reviewstatus\n"+
"from tbl_payment_detail d join \n"+
" ( select paymentno, paymentdate\n"+
" from tbl_payment\n"+
" where fk_userno = ? and sysdate - paymentdate < 7 \n"+
" ) m\n"+
"on d.fk_paymentno = m.paymentno\n"+
"join tbl_option o\n"+
"on d.fk_optioncode = o.optioncode\n"+
"join tbl_product p\n"+
"on o.fk_productcode = p.productcode\n"+
"where delstatus > 0\n"+
"order by m.paymentdate";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, userno);
rs = pstmt.executeQuery();
while(rs.next()) {
Map<String, String> purchase = new HashMap<String, String>();
purchase.put("paymentno", rs.getString(1));
purchase.put("productimg1", rs.getString(2));
purchase.put("krproductname", rs.getString(3));
purchase.put("optionname", rs.getString(4));
purchase.put("orderqty", rs.getString(5));
purchase.put("paymentcheck", rs.getString(6));
purchase.put("productcode", rs.getString(7));
purchase.put("reviewstatus", rs.getString(8));
purchaseList.add(purchase);
}
} finally {
close();
}
return purchaseList;
}
} | [
"[email protected]"
]
| |
f8e1f7fbea8003d97408de9f67c29688566e9ee1 | 4e4e6fae8a814c4b47870d3ff4b43741687c737d | /src/main/java/org/algodev/jeux/batailleNavale/CaseNavale.java | 66efa4312e8d1b2d60bf1773d2d02ea26a3c5d89 | []
| no_license | lucienleclercq/algodev | 803f2d7279263ea9023886e87d5f3d3101617085 | bda7d9bdd1fb163f12402d69332a7c57607f3388 | refs/heads/master | 2020-07-27T03:23:48.921409 | 2019-12-13T09:18:48 | 2019-12-13T09:18:48 | 208,850,210 | 1 | 1 | null | 2019-11-20T22:34:06 | 2019-09-16T16:45:49 | Java | UTF-8 | Java | false | false | 443 | java | package org.algodev.jeux.batailleNavale;
import org.algodev.jeux.Case;
public class CaseNavale extends Case {
protected boolean etat;
//Initialise l'état de la case qui correspond a n'a pas été toucher
public CaseNavale (){
super();
etat = true;
}
//change l'état en a été toucher
public void setEtat() {
etat = false;
}
public boolean isEtat() {
return etat;
}
} | [
"[email protected]"
]
| |
72c55b7a1557ee91f71a88b927f0ff6c5c6a1bdd | c3ba29f19ff7c961dfd5b1b28fad3e64530d4076 | /src/main/java/com/database/in28minutes/entity/Review.java | 973c03e1c41b4fb25dc16ac5e89366ab15852aa4 | []
| no_license | abhaykhati/Hibernate-JPA-IN-100-STEPS | 46c007ac70652c53214ad058793684261895ef7b | 862146954bcf865f84d72f7b80ea6803296a5580 | refs/heads/master | 2022-03-20T03:46:04.231239 | 2019-12-17T07:20:33 | 2019-12-17T07:20:33 | 227,175,599 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,612 | java | package com.database.in28minutes.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "review")
public class Review {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(name = "description")
private String description;
@Column(name = "rating")
private Long rating;
public Review() {
}
public Review(Long rating, String description) {
super();
this.description = description;
this.rating = rating;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getId() {
return id;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof Review))
return false;
Review other = (Review) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
public Long getRating() {
return rating;
}
public void setRating(Long rating) {
this.rating = rating;
}
@Override
public String toString() {
return "Review [description=" + description + ", rating=" + rating + "]";
}
}
| [
"Bak-Pc@BAK-Labs"
]
| Bak-Pc@BAK-Labs |
02b9dbde0bb0d850684d59a074de427bcd4e0c1d | 823fdb3df50c8be782ee0bed774d4dd146cebb89 | /src/graph/GraphFactory.java | 114689676a7c932025e78b72b160d123dfc4a8d7 | [
"MIT"
]
| permissive | pawelkopec/Scheduling | 0b2894078f0fd3833e2782bb53f114bc6ee3076a | 321ef1a07f2e3310d13e23da6b27b519e76dc8c8 | refs/heads/master | 2021-01-12T06:32:35.068304 | 2018-09-02T19:05:39 | 2018-09-02T19:05:39 | 77,377,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,124 | java | package graph;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
/**
* Created by Paweł Kopeć on 26.12.16.
*
* Class providing universal interface
* for constructing instances of Graph subclasses.
*/
public class GraphFactory {
private static final String NO_SUCH_CONSTRUCTOR = "This subclass does not provide requested constructor.";
private static final String NON_CALLABLE_CONSTRUCTOR = "This subclass is abstract and cannot be initialized.";
private static final String NO_ACCESS_TO_CONSTRUCTOR = "This subclass does not give access to requested constructor.";
private static final String CONSTRUCTOR_EXCPECTION = "This constructor threw its underlying exception.";
/**
* Unum for all Graph subclasses that provide a
* constructor for given parameters of getInstance(...)
* methods.
*
* For universal constructor interface
* @see #getInstance(Class, int)
* @see #getInstanceFromString(Class, String)
* @see #getInstanceFromStream(Class, InputStream)
*/
public enum GRAPH_TYPES { LIST_GRAPH, MATRIX_GRAPH }
public static <G extends Graph> G getInstance(Class<G> graphSubclass, int verticesNumber) throws IllegalArgumentException {
try {
return graphSubclass.getDeclaredConstructor(Integer.TYPE).newInstance(verticesNumber);
} catch (Exception e) {
throw getTranslatedConstructorException(e);
}
}
public static <G extends Graph> G getInstance(Class<G> graphSubclass) {
return getInstance(graphSubclass, 0);
}
public static <G extends Graph> G getInstanceFromString(Class<G> graphSubclass, String s) throws IllegalArgumentException {
try {
return graphSubclass.getDeclaredConstructor(String.class).newInstance(s);
} catch (Exception e) {
throw getTranslatedConstructorException(e);
}
}
public static <G extends Graph> G getInstanceFromStream(Class<G> graphSubclass, InputStream in) throws IllegalArgumentException {
try {
return graphSubclass.getDeclaredConstructor(InputStream.class).newInstance(in);
} catch (Exception e) {
throw getTranslatedConstructorException(e);
}
}
public static BaseGraph getInstance(GRAPH_TYPES type, int verticesNumber) {
switch (type) {
case LIST_GRAPH:
return new ListGraph(verticesNumber);
case MATRIX_GRAPH:
return new MatrixGraph(verticesNumber);
default:
return null;
}
}
public static BaseGraph getInstance(GRAPH_TYPES type) {
return GraphFactory.getInstance(type, 0);
}
public static BaseGraph getInstanceFromString(GRAPH_TYPES type, String s) {
switch (type) {
case LIST_GRAPH:
return new ListGraph(s);
case MATRIX_GRAPH:
return new MatrixGraph(s);
default:
return null;
}
}
public static BaseGraph getInstanceFromStream(GRAPH_TYPES type, InputStream in) {
switch (type) {
case LIST_GRAPH:
return new ListGraph(in);
case MATRIX_GRAPH:
return new MatrixGraph(in);
default:
return null;
}
}
protected static IllegalArgumentException getTranslatedConstructorException(Exception e) {
if(e instanceof InstantiationException) {
return new IllegalArgumentException(NON_CALLABLE_CONSTRUCTOR);
}
else if(e instanceof IllegalAccessException) {
return new IllegalArgumentException(NO_ACCESS_TO_CONSTRUCTOR);
}
else if(e instanceof InvocationTargetException) {
return new IllegalArgumentException(CONSTRUCTOR_EXCPECTION + " " + e.getMessage());
}
else if(e instanceof NoSuchMethodException) {
return new IllegalArgumentException(NO_SUCH_CONSTRUCTOR);
}
else {
return new IllegalArgumentException(e);
}
}
}
| [
"[email protected]"
]
| |
23a943b90d6f06c9d5d15aaacdd98e97a9819c61 | 2304063a4e203a63f200aab9e3a7d7db7eb0d2e9 | /app/src/main/java/com/example/nai/app/MyApplication.java | 171fa1c702a9cc31ce5dd800c4aac8916bc52c84 | []
| no_license | marijoip/NaI | f01b26d74bc0bccb6b3c2023898c9a328732cdc3 | b039928aabd4bbd5a14aab9875e0aa5402fedc95 | refs/heads/master | 2020-05-23T19:16:21.144284 | 2019-05-17T03:51:03 | 2019-05-17T03:51:03 | 186,907,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,326 | java | package com.example.nai.app;
import android.app.Application;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
public class MyApplication extends Application {
public static final String TAG = MyApplication.class
.getSimpleName();
private RequestQueue mRequestQueue;
private static MyApplication mInstance;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public static synchronized MyApplication getInstance() {
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public <T> void addToRequestQueue(Request<T> req, String tag) {
// set the default tag if tag is empty
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
}
| [
"[email protected]"
]
| |
d3579272d1521cdb4d26ef5720f2289449c7e7f1 | 052228ac8c5aef2e94770398268180b2f1326cff | /src/REST/esdk_ec/src/main/java/com/huawei/esdk/ec/north/rest/bean/eserver/multiapponline/GetIMGroupResponse.java | a27c2132cd4eff83cf4a21f82cd4380f494d849f | [
"Apache-2.0"
]
| permissive | Hr2013/eSDK_EC_SDK_Java | 091ee3828cd0e0f2959a3cfc6fff9d660d7999ff | 99adf0dc17add9cab47ef8e47e677340b84e746f | refs/heads/master | 2020-06-14T15:13:03.844905 | 2016-09-06T01:35:17 | 2016-09-06T01:35:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,970 | java | package com.huawei.esdk.ec.north.rest.bean.eserver.multiapponline;
import java.util.List;
import com.huawei.esdk.ec.business.professional.rest.multiapponline.callback.AbstractCallbackMsg;
import com.huawei.esdk.ec.domain.model.multiapponline.IMGroupInfo;
import com.huawei.esdk.ec.domain.model.multiapponline.MultiAppOnlineModel;
import com.huawei.esdk.ec.north.rest.eserver.resource.multiapponline.convert.GroupResourceConvert;
import com.huawei.esdk.ec.northcommu.rest.callback.RestEServerListener;
public class GetIMGroupResponse extends AbstractCallbackMsg
{
private String resultCode;
private String recordAmount;
private String count;
private List<IMGroup> imGroupList;
private String pageIndex;
public String getResultCode()
{
return resultCode;
}
public void setResultCode(String resultCode)
{
this.resultCode = resultCode;
}
public String getRecordAmount()
{
return recordAmount;
}
public void setRecordAmount(String recordAmount)
{
this.recordAmount = recordAmount;
}
public String getCount()
{
return count;
}
public void setCount(String count)
{
this.count = count;
}
public List<IMGroup> getImGroupList()
{
return imGroupList;
}
public void setImGroupList(List<IMGroup> imGroupList)
{
this.imGroupList = imGroupList;
}
public String getPageIndex()
{
return pageIndex;
}
public void setPageIndex(String pageIndex)
{
this.pageIndex = pageIndex;
}
@Override
public void notifyCallbackMsg(RestEServerListener listener, MultiAppOnlineModel msg)
{
GetIMGroupResponse payload = new GroupResourceConvert().getIMGroupModel2Rest((IMGroupInfo)msg);
processNorthSno(msg, payload);
listener.sendCallbackMsg(payload, "imgroup");
}
}
| [
"[email protected]"
]
| |
cdf4c579525afd773e93feda2fb2b9c80cbed5bd | b15aa778fd9f945d129c88387cf7927402daeda8 | /src/main/java/com/jonvallet/twitter/Main.java | 31b526f06fe875adda08c65078c3c697cdde2bfa | []
| no_license | jonvallet/twitter | b346fee92e65a5e7c96ca33423e320ef98856660 | 3516753522326ca06d9598687ebf573eb9419e45 | refs/heads/master | 2021-01-24T20:40:20.345927 | 2018-02-28T08:39:36 | 2018-02-28T08:39:36 | 123,255,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,870 | java | package com.jonvallet.twitter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
ImmutableList<Post> posts = ImmutableList.of();
ImmutableSet<Follower> followers = ImmutableSet.of();
final String HELP = "Twitter Console\n" +
"posting: <user name> -> <message>\n" +
"reading: <user name>\n" +
"following: <user name> follows <other user>\n" +
"wall: <user name> wall\n" +
"Exit: exit";
System.out.println(HELP);
Scanner scanner = new Scanner(System.in);
String line = scanner.nextLine();
while (!line.equals("exit")) {
String [] lineArgs = line.split(" ");
String user = lineArgs[0];
if (lineArgs.length == 1) {
Twitter.read(user, posts).forEach(System.out::println);
} else {
String command = lineArgs[1];
switch (command) {
case "->" :
String message = String.join(" ", Arrays.copyOfRange(lineArgs, 2, lineArgs.length));
posts = Twitter.post(user, message, posts);
break;
case "follows":
String follow = lineArgs[2];
followers = Twitter.follow(follow, user, followers);
break;
case "wall":
Twitter.wall(user, posts, followers).forEach(System.out::println);
break;
}
}
line = scanner.nextLine();
}
}
}
| [
"[email protected]"
]
| |
ea203dd03f303653d17f1570451521babfcf6aac | b7eab1bc2c0ffd9d6689df9d803db375326baf56 | /common/src/com/mediatek/camera/common/mode/photo/heif/HeifWriter.java | 63f4e171dddc3cf278edf00c634ddc0acaca9341 | [
"ISC",
"Apache-2.0"
]
| permissive | cc-china/MTK_AS_Camera2 | 8e687aa319db7009faee103496a79bd60ffdadec | 9b3b73174047f0ea8d2f7860813c0a72f37a2d7a | refs/heads/master | 2022-03-09T08:21:11.948397 | 2019-11-14T09:37:30 | 2019-11-14T09:37:30 | 221,654,668 | 3 | 2 | null | null | null | null | UTF-8 | Java | false | false | 23,018 | java | /*
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.mediatek.camera.common.mode.photo.heif;
import static android.media.MediaMuxer.OutputFormat.MUXER_OUTPUT_HEIF;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.media.MediaCodec;
import android.media.MediaFormat;
import android.media.MediaMuxer;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Process;
import android.util.Log;
import android.view.Surface;
import java.io.FileDescriptor;
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.nio.ByteBuffer;
import java.util.concurrent.TimeoutException;
/**
* This class writes one or more still images (of the same dimensions) into
* a heif file.
*
* It currently supports three input modes: {@link #INPUT_MODE_BUFFER},
* {@link #INPUT_MODE_SURFACE}, or {@link #INPUT_MODE_BITMAP}.
*
* The general sequence (in pseudo-code) to write a heif file using this class is as follows:
*
* 1) Construct the writer:
* HeifWriter heifwriter = new HeifWriter(...);
*
* 2) If using surface input mode, obtain the input surface:
* Surface surface = heifwriter.getInputSurface();
*
* 3) Call start:
* heifwriter.start();
*
* 4) Depending on the chosen input mode, add one or more images using one of these methods:
* heifwriter.addYuvBuffer(...); Or
* heifwriter.addBitmap(...); Or
* render to the previously obtained surface
*
* 5) Call stop:
* heifwriter.stop(...);
*
* 6) Close the writer:
* heifwriter.close();
*
* Please refer to the documentations on individual methods for the exact usage.
*/
public final class HeifWriter implements AutoCloseable {
private static final String TAG = "HeifWriter";
private static final boolean DEBUG = true;
private final int mInputMode;
private final HandlerThread mHandlerThread;
private final Handler mHandler;
private int mNumTiles;
private final int mRotation;
private final int mMaxImages;
private final int mPrimaryIndex;
private final ResultWaiter mResultWaiter = new ResultWaiter();
private MediaMuxer mMuxer;
private HeifEncoder mHeifEncoder;
private int[] mTrackIndexArray;
private int mOutputIndex;
private boolean mStarted;
/**
* The input mode where the client adds input buffers with YUV data.
*
* @see #addYuvBuffer(int, byte[])
*/
public static final int INPUT_MODE_BUFFER = 0;
/**
* The input mode where the client renders the images to an input Surface
* created by the writer.
*
* @see #getInputSurface()
*/
public static final int INPUT_MODE_SURFACE = 1;
/**
* The input mode where the client adds bitmaps.
*
* @see #addBitmap(Bitmap)
*/
public static final int INPUT_MODE_BITMAP = 2;
/**
* Builder class for constructing a HeifWriter object from specified parameters.
*/
public static final class Builder {
private final String mPath;
private final FileDescriptor mFd;
private final int mWidth;
private final int mHeight;
private final int mInputMode;
private boolean mGridEnabled = true;
private int mQuality = 100;
private int mMaxImages = 1;
private int mPrimaryIndex = 0;
private int mRotation = 0;
private Handler mHandler;
/**
* Construct a Builder with output specified by its path.
*
* @param path Path of the file to be written.
* @param width Width of the image.
* @param height Height of the image.
* @param inputMode Input mode for this writer, must be one of {@link #INPUT_MODE_BUFFER},
* {@link #INPUT_MODE_SURFACE}, or {@link #INPUT_MODE_BITMAP}.
*/
public Builder( String path,
int width, int height, int inputMode) {
this(path, null, width, height, inputMode);
}
/**
* Construct a Builder with output specified by its file descriptor.
*
* @param fd File descriptor of the file to be written.
* @param width Width of the image.
* @param height Height of the image.
* @param inputMode Input mode for this writer, must be one of {@link #INPUT_MODE_BUFFER},
* {@link #INPUT_MODE_SURFACE}, or {@link #INPUT_MODE_BITMAP}.
*/
public Builder( FileDescriptor fd,
int width, int height, int inputMode) {
this(null, fd, width, height, inputMode);
}
private Builder(String path, FileDescriptor fd,
int width, int height, int inputMode) {
if (width <= 0 || height <= 0) {
throw new IllegalArgumentException("Invalid image size: " + width + "x" + height);
}
mPath = path;
mFd = fd;
mWidth = width;
mHeight = height;
mInputMode = inputMode;
}
/**
* Set the image rotation in degrees.
*
* @param rotation Rotation angle (clockwise) of the image, must be 0, 90, 180 or 270.
* Default is 0.
* @return this Builder object.
*/
public Builder setRotation(int rotation) {
if (rotation != 0 && rotation != 90 && rotation != 180 && rotation != 270) {
throw new IllegalArgumentException("Invalid rotation angle: " + rotation);
}
mRotation = rotation;
return this;
}
/**
* Set whether to enable grid option.
*
* @param gridEnabled Whether to enable grid option. If enabled, the tile size will be
* automatically chosen. Default is to enable.
* @return this Builder object.
*/
public Builder setGridEnabled(boolean gridEnabled) {
mGridEnabled = gridEnabled;
return this;
}
/**
* Set the quality for encoding images.
*
* @param quality A number between 0 and 100 (inclusive), with 100 indicating the best
* quality supported by this implementation. Default is 100.
* @return this Builder object.
*/
public Builder setQuality(int quality) {
if (quality < 0 || quality > 100) {
throw new IllegalArgumentException("Invalid quality: " + quality);
}
mQuality = quality;
return this;
}
/**
* Set the maximum number of images to write.
*
* @param maxImages Max number of images to write. Frames exceeding this number will not be
* written to file. The writing can be stopped earlier before this number
* of images are written by {@link #stop(long)}, except for the input mode
* of {@link #INPUT_MODE_SURFACE}, where the EOS timestamp must be
* specified (via {@link #setInputEndOfStreamTimestamp(long)} and reached.
* Default is 1.
* @return this Builder object.
*/
public Builder setMaxImages(int maxImages) {
if (maxImages <= 0) {
throw new IllegalArgumentException("Invalid maxImage: " + maxImages);
}
mMaxImages = maxImages;
return this;
}
/**
* Set the primary image index.
*
* @param primaryIndex Index of the image that should be marked as primary, must be within
* range [0, maxImages - 1] inclusive. Default is 0.
* @return this Builder object.
*/
public Builder setPrimaryIndex(int primaryIndex) {
if (primaryIndex < 0) {
throw new IllegalArgumentException("Invalid primaryIndex: " + primaryIndex);
}
mPrimaryIndex = primaryIndex;
return this;
}
/**
* Provide a handler for the HeifWriter to use.
*
* @param handler If not null, client will receive all callbacks on the handler's looper.
* Otherwise, client will receive callbacks on a looper created by the
* writer. Default is null.
* @return this Builder object.
*/
public Builder setHandler( Handler handler) {
mHandler = handler;
return this;
}
/**
* Build a HeifWriter object.
*
* @return a HeifWriter object built according to the specifications.
* @throws IOException if failed to create the writer, possibly due to failure to create
* {@link MediaMuxer} or {@link MediaCodec}.
*/
public HeifWriter build() throws IOException {
return new HeifWriter(mPath, mFd, mWidth, mHeight, mRotation, mGridEnabled, mQuality,
mMaxImages, mPrimaryIndex, mInputMode, mHandler);
}
}
@SuppressLint("WrongConstant")
private HeifWriter( String path,
FileDescriptor fd,
int width,
int height,
int rotation,
boolean gridEnabled,
int quality,
int maxImages,
int primaryIndex,
int inputMode,
Handler handler) throws IOException {
if (primaryIndex >= maxImages) {
throw new IllegalArgumentException(
"Invalid maxImages (" + maxImages + ") or primaryIndex (" + primaryIndex + ")");
}
if (DEBUG) {
Log.d(TAG, "width: " + width
+ ", height: " + height
+ ", rotation: " + rotation
+ ", gridEnabled: " + gridEnabled
+ ", quality: " + quality
+ ", maxImages: " + maxImages
+ ", primaryIndex: " + primaryIndex
+ ", inputMode: " + inputMode);
}
MediaFormat format = MediaFormat.createVideoFormat(
MediaFormat.MIMETYPE_IMAGE_ANDROID_HEIC, width, height);
// set to 1 initially, and wait for output format to know for sure
mNumTiles = 1;
mRotation = rotation;
mInputMode = inputMode;
mMaxImages = maxImages;
mPrimaryIndex = primaryIndex;
Looper looper = (handler != null) ? handler.getLooper() : null;
if (looper == null) {
mHandlerThread = new HandlerThread("HeifEncoderThread",
Process.THREAD_PRIORITY_FOREGROUND);
mHandlerThread.start();
looper = mHandlerThread.getLooper();
} else {
mHandlerThread = null;
}
mHandler = new Handler(looper);
mMuxer = (path != null) ? new MediaMuxer(path, MUXER_OUTPUT_HEIF)
: new MediaMuxer(fd, MUXER_OUTPUT_HEIF);
mHeifEncoder = new HeifEncoder(width, height, gridEnabled, quality,
mInputMode, mHandler, new HeifCallback());
}
/**
* Start the heif writer. Can only be called once.
*
* @throws IllegalStateException if called more than once.
*/
public void start() {
checkStarted(false);
mStarted = true;
mHeifEncoder.start();
}
/**
* Add one YUV buffer to the heif file.
*
* @param format The YUV format as defined in {@link android.graphics.ImageFormat}, currently
* only support YUV_420_888.
*
* @param data byte array containing the YUV data. If the format has more than one planes,
* they must be concatenated.
*
* @throws IllegalStateException if not started or not configured to use buffer input.
*/
public void addYuvBuffer(int format, byte[] data) {
checkStartedAndMode(INPUT_MODE_BUFFER);
synchronized (this) {
if (mHeifEncoder != null) {
mHeifEncoder.addYuvBuffer(format, data);
}
}
}
/**
* Retrieves the input surface for encoding.
*
* @return the input surface if configured to use surface input.
*
* @throws IllegalStateException if called after start or not configured to use surface input.
*/
public Surface getInputSurface() {
checkStarted(false);
checkMode(INPUT_MODE_SURFACE);
return mHeifEncoder.getInputSurface();
}
/**
* Set the timestamp (in nano seconds) of the last input frame to encode.
*
* This call is only valid for surface input. Client can use this to stop the heif writer
* earlier before the maximum number of images are written. If not called, the writer will
* only stop when the maximum number of images are written.
*
* @param timestampNs timestamp (in nano seconds) of the last frame that will be written to the
* heif file. Frames with timestamps larger than the specified value will not
* be written. However, if a frame already started encoding when this is set,
* all tiles within that frame will be encoded.
*
* @throws IllegalStateException if not started or not configured to use surface input.
*/
public void setInputEndOfStreamTimestamp(long timestampNs) {
checkStartedAndMode(INPUT_MODE_SURFACE);
synchronized (this) {
if (mHeifEncoder != null) {
mHeifEncoder.setEndOfInputStreamTimestamp(timestampNs);
}
}
}
/**
* Add one bitmap to the heif file.
*
* @param bitmap the bitmap to be added to the file.
* @throws IllegalStateException if not started or not configured to use bitmap input.
*/
public void addBitmap( Bitmap bitmap) {
checkStartedAndMode(INPUT_MODE_BITMAP);
synchronized (this) {
if (mHeifEncoder != null) {
mHeifEncoder.addBitmap(bitmap);
}
}
}
/**
* Stop the heif writer synchronously. Throws exception if the writer didn't finish writing
* successfully. Upon a success return:
*
* - For buffer and bitmap inputs, all images sent before stop will be written.
*
* - For surface input, images with timestamp on or before that specified in
* {@link #setInputEndOfStreamTimestamp(long)} will be written. In case where
* {@link #setInputEndOfStreamTimestamp(long)} was never called, stop will block
* until maximum number of images are received.
*
* @param timeoutMs Maximum time (in microsec) to wait for the writer to complete, with zero
* indicating waiting indefinitely.
* @see #setInputEndOfStreamTimestamp(long)
* @throws Exception if encountered error, in which case the output file may not be valid. In
* particular, {@link TimeoutException} is thrown when timed out, and {@link
* MediaCodec.CodecException} is thrown when encountered codec error.
*/
public void stop(long timeoutMs) throws Exception {
checkStarted(true);
synchronized (this) {
if (mHeifEncoder != null) {
mHeifEncoder.stopAsync();
}
}
mResultWaiter.waitForResult(timeoutMs);
}
private void checkStarted(boolean requiredStarted) {
if (mStarted != requiredStarted) {
throw new IllegalStateException("Already started");
}
}
private void checkMode( int requiredMode) {
if (mInputMode != requiredMode) {
throw new IllegalStateException("Not valid in input mode " + mInputMode);
}
}
private void checkStartedAndMode( int requiredMode) {
checkStarted(true);
checkMode(requiredMode);
}
/**
* Routine to stop and release writer, must be called on the same looper
* that receives heif encoder callbacks.
*/
private void closeInternal() {
if (DEBUG) Log.d(TAG, "closeInternal");
if (mMuxer != null) {
mMuxer.stop();
mMuxer.release();
mMuxer = null;
}
if (mHeifEncoder != null) {
mHeifEncoder.close();
synchronized (this) {
mHeifEncoder = null;
}
}
}
/**
* Callback from the heif encoder.
*/
private class HeifCallback extends HeifEncoder.Callback {
/**
* Upon receiving output format from the encoder, add the requested number of
* image tracks to the muxer and start the muxer.
*/
@Override
public void onOutputFormatChanged(
HeifEncoder encoder, MediaFormat format) {
if (encoder != mHeifEncoder) return;
if (DEBUG) {
Log.d(TAG, "onOutputFormatChanged: " + format);
}
if (mTrackIndexArray != null) {
stopAndNotify(new IllegalStateException(
"Output format changed after muxer started"));
return;
}
try {
int gridRows = format.getInteger(MediaFormat.KEY_GRID_ROWS);
int gridCols = format.getInteger(MediaFormat.KEY_GRID_COLUMNS);
mNumTiles = gridRows * gridCols;
} catch (NullPointerException | ClassCastException e) {
mNumTiles = 1;
}
// add mMaxImages image tracks of the same format
mTrackIndexArray = new int[mMaxImages];
// set rotation angle
if (mRotation > 0) {
Log.d(TAG, "setting rotation: " + mRotation);
mMuxer.setOrientationHint(mRotation);
}
for (int i = 0; i < mTrackIndexArray.length; i++) {
// mark primary
format.setInteger(MediaFormat.KEY_IS_DEFAULT, (i == mPrimaryIndex) ? 1 : 0);
mTrackIndexArray[i] = mMuxer.addTrack(format);
}
mMuxer.start();
}
/**
* Upon receiving an output buffer from the encoder (which is one image when
* grid is not used, or one tile if grid is used), add that sample to the muxer.
*/
@Override
public void onDrainOutputBuffer(
HeifEncoder encoder, ByteBuffer byteBuffer) {
if (encoder != mHeifEncoder) return;
if (DEBUG) {
Log.d(TAG, "onDrainOutputBuffer: " + mOutputIndex);
}
if (mTrackIndexArray == null) {
stopAndNotify(new IllegalStateException(
"Output buffer received before format info"));
return;
}
if (mOutputIndex < mMaxImages * mNumTiles) {
MediaCodec.BufferInfo info = new MediaCodec.BufferInfo();
info.set(byteBuffer.position(), byteBuffer.remaining(), 0, 0);
mMuxer.writeSampleData(
mTrackIndexArray[mOutputIndex / mNumTiles], byteBuffer, info);
}
mOutputIndex++;
// post EOS if reached max number of images allowed.
if (mOutputIndex == mMaxImages * mNumTiles) {
stopAndNotify(null);
}
}
@Override
public void onComplete( HeifEncoder encoder) {
if (encoder != mHeifEncoder) return;
stopAndNotify(null);
}
@Override
public void onError( HeifEncoder encoder, MediaCodec.CodecException e) {
if (encoder != mHeifEncoder) return;
stopAndNotify(e);
}
private void stopAndNotify( Exception error) {
try {
closeInternal();
} catch (Exception e) {
// if there is an error during muxer stop, that must be propagated,
// unless error exists already.
if (error == null) {
error = e;
}
}
mResultWaiter.signalResult(error);
}
}
private static class ResultWaiter {
private boolean mDone;
private Exception mException;
synchronized void waitForResult(long timeoutMs) throws Exception {
if (timeoutMs < 0) {
throw new IllegalArgumentException("timeoutMs is negative");
}
if (timeoutMs == 0) {
while (!mDone) {
try {
wait();
} catch (InterruptedException ex) {}
}
} else {
final long startTimeMs = System.currentTimeMillis();
long remainingWaitTimeMs = timeoutMs;
// avoid early termination by "spurious" wakeup.
while (!mDone && remainingWaitTimeMs > 0) {
try {
wait(remainingWaitTimeMs);
} catch (InterruptedException ex) {}
remainingWaitTimeMs -= (System.currentTimeMillis() - startTimeMs);
}
}
if (!mDone) {
mDone = true;
mException = new TimeoutException("timed out waiting for result");
}
if (mException != null) {
throw mException;
}
}
synchronized void signalResult( Exception e) {
if (!mDone) {
mDone = true;
mException = e;
notifyAll();
}
}
}
@Override
public void close() {
mHandler.postAtFrontOfQueue(new Runnable() {
@Override
public void run() {
try {
closeInternal();
} catch (Exception e) {
// If the client called stop() properly, any errors would have been
// reported there. We don't want to crash when closing.
}
}
});
}
}
| [
"[email protected]"
]
| |
c79a29d9be278a8170d061c0145303d29370b567 | f31402c778b0838c679a6a61fb57e09d11f9b074 | /app/src/main/java/com/rfstar/kevin/main/BatteryActivity.java | 895a180997bf78cbf53307cb52399f0e3a56476e | []
| no_license | xinggede/CubicBLEOpen | 23f4a7aa5c2c1f3f9595784d3999f854ea8a3d17 | 9c604b25b10ce7b10a664ae079040ccf3a7be8fb | refs/heads/master | 2020-05-29T20:40:25.612140 | 2019-11-25T11:02:56 | 2019-11-25T11:02:56 | 189,358,200 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,062 | java | package com.rfstar.kevin.main;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
import com.rfstar.kevin.R;
import com.rfstar.kevin.app.App;
import com.rfstar.kevin.params.BLEDevice.RFStarBLEBroadcastReceiver;
import com.rfstar.kevin.params.MemberItem;
import com.rfstar.kevin.service.RFStarBLEService;
/**
* @author Kevin.wu E-mail:[email protected]
* <p>
* 0x180F 2A19提供电量的百分比
*/
public class BatteryActivity extends BaseActivity implements
RFStarBLEBroadcastReceiver {
private TextView batteryTxt = null;
@SuppressWarnings("static-access")
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.setContentView(R.layout.activity_battery);
this.initView();
}
@SuppressWarnings("static-access")
private void initView() {
// TODO Auto-generated method stub
Intent intent = this.getIntent();
MemberItem member = (MemberItem) intent.getSerializableExtra(App.TAG);
this.initNavigation(member.name);
batteryTxt = (TextView) this.findViewById(R.id.batteryTxt);
}
@Override
protected void onResume() {
// TODO Auto-generated method stub
super.onResume();
if (app.manager.cubicBLEDevice != null) {
app.manager.cubicBLEDevice.setBLEBroadcastDelegate(this);
app.manager.cubicBLEDevice.readValue("180f", "2a19");
app.manager.cubicBLEDevice.setNotification("180f", "2a19", true);
}
}
/**
* 获取电量
*
* @param view
*/
public void getBattry(View view) {
if (app.manager.cubicBLEDevice != null) {
app.manager.cubicBLEDevice.readValue("180f", "2a19");
}
}
@Override
public void onReceive(Context context, Intent intent, String macData,
String uuid) {
// TODO Auto-generated method stub
Log.d(App.TAG, "有数据返回");
// TODO Auto-generated method stub
String action = intent.getAction();
this.connectedOrDis(intent.getAction());
if (RFStarBLEService.ACTION_GATT_CONNECTED.equals(action)) {
Log.d(App.TAG, "111111111 连接完成");
this.setTitle(macData + "已连接");
} else if (RFStarBLEService.ACTION_GATT_DISCONNECTED.equals(action)) {
Log.d(App.TAG, "111111111 连接断开");
this.setTitle(macData + "已断开");
} else if (RFStarBLEService.ACTION_DATA_AVAILABLE.equals(action)) {
if (uuid.contains("2a19")) {
byte[] data = intent
.getByteArrayExtra(RFStarBLEService.EXTRA_DATA);
batteryTxt.setText((int) data[0] + "%");
}
} else if (RFStarBLEService.ACTION_GATT_SERVICES_DISCOVERED
.equals(action)) {
}
}
}
| [
"[email protected]"
]
| |
a68ec39699a26a5801cb3b13b1d24dc3a0b05579 | 8ee34f10125f246535e9840726f695203a758c11 | /payctr/busi/baofudf/bens/req/BaofudfReqBF0040002.java | 63c5e6a82fb8fbade51009722b0f6dd7f3985894 | []
| no_license | zom110/alipay | b0fc70b0c762f2ed5fbf11a70939e6717c530b85 | f370fe11c70394fb5fb91ff7bdb8bc6bb1034b2b | refs/heads/master | 2020-05-22T11:49:09.271687 | 2019-05-13T02:33:45 | 2019-05-13T02:33:45 | 186,331,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,992 | java | package com.sdhoo.pdloan.payctr.busi.baofudf.bens.req;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.sdhoo.pdloan.payctr.busi.baofudf.bens.rsp.BaofudfRspBF0040002;
/**
*
* 交易状态查询接口
* @author SDPC_LIU
*
*/
public class BaofudfReqBF0040002 extends BaofudfBaseReq<BaofudfRspBF0040002> {
private List<TransReqBF0040002> transReqInfs = new ArrayList<>() ;
public void appendTransReq(TransReqBF0040002 req) {
transReqInfs.add(req);
}
@Override
public String doGetTranCode() {
return "BF0040002";
}
/**
* 获取交易请求数据
*/
@Override
public List<Map<String, List<TransReqBF0040002>>> getTrans_reqDatas() {
List<Map<String,List<TransReqBF0040002>>> transReqDatas = new ArrayList<>();
Map<String,List<TransReqBF0040002>> trans_reqData = new HashMap<>();
List<TransReqBF0040002> reqDataList = new ArrayList<>();
for(TransReqBF0040002 transReq : transReqInfs ) {
reqDataList.add(transReq);
}
trans_reqData.put("trans_reqData", reqDataList);
transReqDatas.add(trans_reqData);
return transReqDatas ;
}
@Override
public Class<BaofudfRspBF0040002> doGetRspClass() {
return BaofudfRspBF0040002.class;
}
/**
* 代付交易
*
* @author Administrator
*
*/
public static class TransReqBF0040002 {
private String trans_batchid; //宝付批次号
private String trans_no; // 商户订单号
public String getTrans_batchid() {
return trans_batchid;
}
public void setTrans_batchid(String trans_batchid) {
this.trans_batchid = trans_batchid;
}
public String getTrans_no() {
return trans_no;
}
public void setTrans_no(String trans_no) {
this.trans_no = trans_no;
}
}
}
| [
"[email protected]"
]
| |
0d7497c3defda51f088ef9adefa7e095de5dc17b | 101e1cc5c4b4b2b9c384e7f98dc8ba2be1ace444 | /app/src/main/java/com/msy/rrodemo/app/MyApp.java | a82f1956e0d3b334baf7315c5e7ea08f1098d851 | []
| no_license | androidMsy/misy_RRO | e109729cb7fb0f46d1b27e057e216544b5690ddf | bb9b1dd4a3b1a741f6fc43ca4f85ac1c1770c779 | refs/heads/master | 2020-10-01T12:29:26.123565 | 2019-12-12T07:26:13 | 2019-12-12T07:26:13 | 227,538,816 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 921 | java | package com.msy.rrodemo.app;
import android.app.Application;
import com.msy.rrodemo.di.component.AppComponent;
import com.msy.rrodemo.di.component.DaggerAppComponent;
import com.msy.rrodemo.di.module.AppModule;
import com.msy.rrodemo.di.module.HttpModule;
/**
* Created by Administrator on 2019/9/27/027.
*/
public class MyApp extends Application {
public AppComponent mAppComponent;
private static MyApp mApp;
@Override
public void onCreate() {
super.onCreate();
mApp = this;
initAppComponent();
}
private void initAppComponent(){
mAppComponent = DaggerAppComponent.builder()
.appModule(new AppModule(this))
.httpModule(new HttpModule())
.build();
}
public static MyApp getApplication(){
return mApp;
}
public AppComponent getAppComponent() {
return mAppComponent;
}
}
| [
"[email protected]"
]
| |
688d99e402e1a8199058308b16a22b4543d8f3c5 | aa2d419d40713a5ff02b62bbf5cb5c3e7a39e48b | /src/main/java/shapes/Circle.java | 4f37c4c00addf762a696794a4a53c9bb0d9fc11c | []
| no_license | efoxblack/javaClassWork | 90fba59cb8ae244dc35b82db10e5318f73dd169a | eac9425adc7d985ac7fc940f6bd1ba4a9291eb15 | refs/heads/master | 2021-03-13T12:11:32.048094 | 2020-04-27T20:16:42 | 2020-04-27T20:16:42 | 246,680,033 | 0 | 0 | null | 2020-10-13T20:51:26 | 2020-03-11T21:06:33 | Java | UTF-8 | Java | false | false | 192 | java | package shapes;
public class Circle extends Shape {
public Double radius;
//method
public void calculateArea() {
System.out.println(Math.PI * radius * radius);
}
}
| [
"[email protected]"
]
| |
69b65550042cba585c0b0d5a0e52490766731f90 | 204ed7097c2eca124ba44a4b8ec32825bc61dcd0 | /nms-biz-client/src/java/com/yuep/nms/biz/client/topo/view/AddDomainOrGroupView.java | 55aa466d21bdc408f5079fdb9b704a937bd0bf29 | []
| no_license | frankggyy/YUEP | 8ee9a7d547f8fa471fda88a42c9e3a31ad3f94d2 | 827115c99b84b9cbfbc501802b18c06c62c1c507 | refs/heads/master | 2016-09-16T13:49:11.258476 | 2011-08-31T13:30:34 | 2011-08-31T13:30:34 | 2,299,133 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 6,475 | java | /*
* $Id: AddDomainOrGroupView.java, 2011-4-19 ÏÂÎç03:50:12 aaron Exp $
*
* Copyright (c) 2010 Wuhan Yangtze Communications Industry Group Co.,Ltd
* All rights reserved.
*
* This software is copyrighted and owned by YCIG or the copyright holder
* specified, unless otherwise noted, and may not be reproduced or distributed
* in whole or in part in any form or medium without express written permission.
*/
package com.yuep.nms.biz.client.topo.view;
import java.util.List;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import org.apache.commons.collections.CollectionUtils;
import twaver.swing.TableLayout;
import com.yuep.core.client.ClientCoreContext;
import com.yuep.core.client.component.factory.SwingFactory;
import com.yuep.core.client.component.factory.decorator.editor.ComboBoxEditorDecorator;
import com.yuep.core.client.component.factory.decorator.editor.StringEditorDecorator;
import com.yuep.core.client.component.factory.decorator.label.LabelDecorator;
import com.yuep.core.client.component.menu.action.AbstractButtonAction;
import com.yuep.core.client.component.validate.editor.DefaultXEditor;
import com.yuep.core.client.component.validate.editor.XComboBoxEditor;
import com.yuep.core.client.component.validate.validator.StringValidator;
import com.yuep.core.client.mvc.ClientController;
import com.yuep.core.client.mvc.validate.AbstractValidateView;
import com.yuep.nms.core.common.mocore.naming.MoNaming;
import com.yuep.nms.core.common.mocore.service.MoCore;
import com.yuep.nms.core.common.momanager.module.constants.MoManagerModuleConstants;
import com.yuep.nms.core.common.momanager.service.MoManager;
/**
* <p>
* Title: AddDomainOrGroupView
* </p>
* <p>
* Description:
* </p>
*
* @author aaron
* created 2011-4-19 ÏÂÎç03:50:12
* modified [who date description]
* check [who date description]
*/
public class AddDomainOrGroupView extends AbstractValidateView<Object> {
private static final long serialVersionUID = -3252214346664206430L;
private DefaultXEditor<StringValidator> nameEditor;
private MoNaming parent;
private XComboBoxEditor typeEditor;
/**
* @see com.yuep.core.client.mvc.validate.AbstractValidateView#addButtonListener(com.yuep.core.client.mvc.ClientController)
*/
@Override
protected <V, M> void addButtonListener(ClientController<Object, V, M> controller) {
okButton.addActionListener(new AbstractButtonAction("") {
private static final long serialVersionUID = -4625176666445968309L;
@Override
protected Object[] commitData(Object... objs) {
Object selectedItem = typeEditor.getSelectedItem();
String type = "";
if (selectedItem != null) {
if (selectedItem.equals(ClientCoreContext.getString("AddDomainOrGroupView.type.domain"))) {
type = "domain";
} else if (selectedItem.equals(ClientCoreContext.getString("AddDomainOrGroupView.type.group"))) {
type = "group";
}
}
String domainName = nameEditor.getText();
MoManager moManager = ClientCoreContext.getRemoteService(MoManagerModuleConstants.MOMANAGER_REMOTE_SERVICE, MoManager.class);
MoCore moCore = ClientCoreContext.getLocalService("moCore", MoCore.class);
if(parent==null)
parent=moCore.getRootMo().getMoNaming();
moManager.createManagedDomain(parent, domainName, type);
return null;
}
@Override
protected void updateUi(Object... objs) {
dispose();
}
});
}
/**
* @see com.yuep.core.client.mvc.validate.AbstractValidateView#createContentPane()
*/
@Override
protected JComponent createContentPane() {
SwingFactory swingFactory = ClientCoreContext.getSwingFactory();
JPanel mainPanel = swingFactory.getPanel();
double[][] ds = { { 10, 100, TableLayout.FILL, 10 }, swingFactory.getTableLayoutRowParam(2, 4, 4) };
mainPanel.setLayout(swingFactory.getTableLayout(ds));
JLabel typeLabel = swingFactory.getLabel(new LabelDecorator("AddDomainOrGroupView.type"));
typeEditor = swingFactory.getXEditor(new ComboBoxEditorDecorator("AddDomainOrGroupView.type"));
JLabel domainNameLabel = swingFactory.getLabel(new LabelDecorator("AddDomainOrGroupView.name"));
nameEditor = swingFactory.getXEditor(new StringEditorDecorator("AddDomainOrGroupView.name", true, 1, 64));
mainPanel.add(typeLabel, "1,1,f,c");
mainPanel.add(typeEditor, "2,1,f,c");
mainPanel.add(domainNameLabel, "1,3,f,c");
mainPanel.add(nameEditor, "2,3,f,c");
return mainPanel;
}
/**
* @see com.yuep.core.client.mvc.validate.AbstractValidateView#getDescription()
*/
@Override
protected String getDescription() {
return "AddDomainOrGroupView.title";
}
/**
* @see com.yuep.core.client.mvc.ClientView#collectData()
*/
@Override
public List<Object> collectData() {
// TODO Auto-generated method stub
return null;
}
/**
* @see com.yuep.core.client.mvc.ClientView#getDefaultFocus()
*/
@Override
public JComponent getDefaultFocus() {
// TODO Auto-generated method stub
return null;
}
/**
* @see com.yuep.core.client.mvc.ClientView#getHelpId()
*/
@Override
public String getHelpId() {
// TODO Auto-generated method stub
return null;
}
/**
* @see com.yuep.core.client.mvc.ClientView#getTitle()
*/
@Override
public String getTitle() {
return "AddDomainOrGroupView.title";
}
@Override
protected void initializeData(List<Object> data) {
if (CollectionUtils.isEmpty(data))
return;
typeEditor.addItem(ClientCoreContext.getString("AddDomainOrGroupView.type.domain"));
typeEditor.addItem(ClientCoreContext.getString("AddDomainOrGroupView.type.group"));
Object object = data.get(0);
if (object instanceof MoNaming)
this.parent = (MoNaming) object;
}
}
| [
"[email protected]"
]
| |
907e3f5cebba4bf64021e23299f310f7151fe9ac | 67c3daf2420735a1b7e64272f6a8b7c61ae06af4 | /src/main/java/edu/asu/voctec/utilities/AspectRatio.java | abe91d6d307132423a986a35698126c427d621d8 | []
| no_license | gmann1/Sizing | 2ce56fc2c46db9d77e0adc20bc29b522b21f6d5f | bdcd8681d311606eda6856d955248ee47ffda408 | refs/heads/master | 2021-01-15T16:29:13.004978 | 2014-06-30T01:49:00 | 2014-06-30T01:49:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,610 | java | package edu.asu.voctec.utilities;
import java.awt.Dimension;
import java.awt.Rectangle;
public enum AspectRatio
{
x16_9(16, 9), x4_3(4, 3);
/**
* If ASPECT_RATIO_MARGIN > 0, then each AspectRatio can be used to
* represent dimensions that are *close* to the desired AspectRatio, using
* this constant as a MOE. For instance, if ASPECT_RATIO_MARGIN is 5, then
* an aspect ratio of 4:3 can be used to represent the dimension 800x600, as
* well as 805x605 and 795x600, etc. This constant should generally be 0,
* unless imprecise image resizing is being done outside of this class.
*/
public static final int ASPECT_RATIO_MARGIN = 0;
public final int width;
public final int height;
private AspectRatio(int width, int height)
{
this.width = width;
this.height = height;
}
// TODO abstract to apply to all ratios
/**
* Finds a maximized window of the desired aspect ratio within the given
* baseScreen. For instance, if given a 1280x720 screen, and an aspect ratio
* of 4:3, this method will return a 960x720 window, centered in the
* baseScreen (new Rectangle(160, 0, 960, 720)).
*
* At the moment, only 16:9 to 4:3 subsections are supported.
*
* @param baseScreen
* @param subSectionAspectRatio
* @return
*/
public static Rectangle getSubSection(ScreenResolution baseScreen,
AspectRatio subSectionAspectRatio)
throws ResolutionNotSupportedException
{
// Ensure aspect ratios are supported
if (!(baseScreen.getAspectRatio().equals(AspectRatio.x16_9))
|| !(subSectionAspectRatio.equals(x4_3)))
{
throw new ResolutionNotSupportedException("getSubSection only "
+ "supports 16:9 to 4:3. (Given: "
+ baseScreen.getAspectRatio().toString() + " to "
+ subSectionAspectRatio.toString());
}
else
// Specified operation is supported
{
// TODO abstract to apply to all ratios
// Get 4:3 window centered in 16:9 window
// Determine scale of subSection
// Because 3 maps to 9 sooner (3 steps) than 4 maps to 16
// (4 steps), use height as a basis for scale.
int scale = baseScreen.height / subSectionAspectRatio.height;
// Determine width and height of subSection based on the calculated
// scale.
int width = subSectionAspectRatio.width * scale;
int height = subSectionAspectRatio.height * scale;
// Determine topleft corner of subSection in order to center the
// subSection.
int x = (baseScreen.width - width) / 2;
int y = 0; // Because subSection height = baseScreen height, it will
// be centered with y=0;
return new Rectangle(x, y, width, height);
}
}
public static AspectRatio getAspectRatio(int width, int height)
throws ResolutionNotSupportedException
{
AspectRatio matchingAspectRatio = null;
// TODO optimize search
for (AspectRatio aspectRatio : AspectRatio.values())
{
int scale;
// Ensure width corresponds to aspect ratio
if ((width % aspectRatio.width) <= ASPECT_RATIO_MARGIN)
{
// TODO account for case in which height = ratio - MARGIN and
// TODO_CONT width = ratio + MARGIN
// Determine the constant that is modified by the aspect ratio
// to obtain the desired resolution
scale = width / aspectRatio.width;
// Ensure height corresponds to aspect ratio and scale
if ((height % aspectRatio.height) <= ASPECT_RATIO_MARGIN
&& (height / aspectRatio.height) == scale)
{
// Found matching aspect ratio; stop searching
matchingAspectRatio = aspectRatio;
break;
}
}
}
// If a matchingAspectRatio was not found, this resolution is not
// supported
if (matchingAspectRatio == null)
throw new ResolutionNotSupportedException(width, height);
else
return matchingAspectRatio;
}
public static AspectRatio getAspectRatio(Dimension dimension)
throws ResolutionNotSupportedException
{
return getAspectRatio(dimension.width, dimension.height);
}
// TODO move to exceptions package
public static class ResolutionNotSupportedException extends Exception
{
private static final long serialVersionUID = 1548486820456150649L;
public ResolutionNotSupportedException(int width, int height)
{
super("This resolution is not supported: " + width + "x" + height);
}
public ResolutionNotSupportedException(String message)
{
super(message);
}
}
@Override
public String toString()
{
// WxH e.g. 16x9 or 4x3
return "" + this.width + "x" + this.height;
}
}
| [
"[email protected]"
]
| |
9609f7e16a83abf87b300178360a098a2865f38f | 0e4ba903a2452880937855e7bdde7b96347288da | /app/src/main/java/com/lidaofu/android/presenter/LoginPresenter.java | 860cd107ccf30645b23e5abd1cbce0be6621fe2f | []
| no_license | shenzhaoxiang/AndroidTemplet | 02ffb428b1b844b09c2d673abbfb0a0dec25c9ac | 765c2bc9fbf5c28b6a4b795149b125a127c7ccd7 | refs/heads/master | 2021-01-19T08:28:10.489913 | 2016-08-14T13:14:29 | 2016-08-14T13:14:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 540 | java | package com.lidaofu.android.presenter;
import com.lidaofu.android.presenter.base.BasePresenter;
import com.lidaofu.android.presenter.base.BaseView;
/**
* Created by LiDaofu on 16/7/10.
*/
public interface LoginPresenter extends BasePresenter{
interface LoginView extends BaseView{
/**
* 添加view中需要的方法
*/
public String getUserName();
public String getUserPass();
}
/**
* 添加presenter中需要的方法
*
*/
public void loginByHttp();
}
| [
"[email protected]"
]
| |
42b9666058e491858379545ed3ae7e5633c543fc | 621cd97b26a7cf929a8fdab78b5db992dab27f9e | /src/main/java/edu/teilar/jcrop/domain/builder/graph/node/NodeBuilder.java | a0ba0cbc46798082871a47d28527a42b26d936ea | []
| no_license | tsiakmaki/jcrop-core | dc9b8ca8eee1513112fa59173108f6ce653163cb | e60f701ec9876836258c8f92ba24bc09c5c280b3 | refs/heads/master | 2022-11-20T08:00:06.829234 | 2019-11-13T08:16:59 | 2019-11-13T08:16:59 | 36,111,782 | 0 | 0 | null | 2022-11-16T08:58:10 | 2015-05-23T07:19:08 | Java | UTF-8 | Java | false | false | 1,119 | java | /*
* (C) Copyright 2010-2013 m.tsiakmaki.
*
* This file is part of jcropeditor.
*
* jcropeditor is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License (LGPL)
* as published by the Free Software Foundation, version 3.
*
* jcropeditor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with jcropeditor. If not, see <http://www.gnu.org/licenses/>.
*/
package edu.teilar.jcrop.domain.builder.graph.node;
import edu.teilar.jcrop.domain.graph.node.Node;
import edu.teilar.jcrop.domain.resource.KObject;
/**
* @author m.tsiakmaki
*
*/
public interface NodeBuilder {
public void buildNode(String name);
public void buildAssociated(KObject kobj);
public void buildIsStartOf(KObject kobj);
public void buildIsEndOf(KObject kobj);
public Node getNode();
}
| [
"[email protected]"
]
| |
d565283085a4ec17f4c3d38b8d38f1afc365f05d | ac7129e9e72b2e7a4c5564fea217735838f811e0 | /src/NodeMonHoc.java | d4af0c46f2d33dd9dae36bb1a10cc73c66234bae | []
| no_license | nnhuy86/CTDL_Demo | 543b5436769bb7e27eb91a0ec2708feb00762611 | 5f2e42337abd4e67d9685454484759f0c3e59bfe | refs/heads/master | 2020-09-04T20:19:54.895419 | 2019-11-14T15:48:40 | 2019-11-14T15:48:40 | 219,787,364 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 152 | java |
public class NodeMonHoc {
MonHoc data;
NodeMonHoc next;
NodeMonHoc(MonHoc _data)
{
data = _data;
next = null;
}
}
| [
"[email protected]"
]
| |
4b06c0ad0ddd1ec8ad14781e42fb7fa8a517be17 | e3fbca1cbc2f69a00d9b02d315fd39abdadcb1ba | /xmall-admin/src/main/java/com/yzsunlei/xmall/admin/service/impl/PmsBrandServiceImpl.java | 58419847120f661dbf0b8896d8eee36ca2d0b2ce | [
"MIT"
]
| permissive | pipipapi/xmall | 27b63e8f06359dd627ee35e1d67f74f1307bd8d0 | 79a9d9ba77e92cc832063114c5a520cf111bff1f | refs/heads/master | 2020-09-23T20:52:23.766180 | 2019-12-03T17:28:56 | 2019-12-03T17:28:56 | 225,584,553 | 0 | 0 | MIT | 2019-12-03T09:47:11 | 2019-12-03T09:47:10 | null | UTF-8 | Java | false | false | 4,179 | java | package com.yzsunlei.xmall.admin.service.impl;
import com.github.pagehelper.PageHelper;
import com.yzsunlei.xmall.admin.dto.PmsBrandParam;
import com.yzsunlei.xmall.db.mapper.PmsBrandMapper;
import com.yzsunlei.xmall.db.mapper.PmsProductMapper;
import com.yzsunlei.xmall.db.model.PmsBrand;
import com.yzsunlei.xmall.db.model.PmsBrandExample;
import com.yzsunlei.xmall.db.model.PmsProduct;
import com.yzsunlei.xmall.db.model.PmsProductExample;
import com.yzsunlei.xmall.admin.service.PmsBrandService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* 商品品牌Service实现类
* Created by macro on 2018/4/26.
*/
@Service
public class PmsBrandServiceImpl implements PmsBrandService {
@Autowired
private PmsBrandMapper brandMapper;
@Autowired
private PmsProductMapper productMapper;
@Override
public List<PmsBrand> listAllBrand() {
return brandMapper.selectByExample(new PmsBrandExample());
}
@Override
public int createBrand(PmsBrandParam pmsBrandParam) {
PmsBrand pmsBrand = new PmsBrand();
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
//如果创建时首字母为空,取名称的第一个为首字母
if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
}
return brandMapper.insertSelective(pmsBrand);
}
@Override
public int updateBrand(Long id, PmsBrandParam pmsBrandParam) {
PmsBrand pmsBrand = new PmsBrand();
BeanUtils.copyProperties(pmsBrandParam, pmsBrand);
pmsBrand.setId(id);
//如果创建时首字母为空,取名称的第一个为首字母
if (StringUtils.isEmpty(pmsBrand.getFirstLetter())) {
pmsBrand.setFirstLetter(pmsBrand.getName().substring(0, 1));
}
//更新品牌时要更新商品中的品牌名称
PmsProduct product = new PmsProduct();
product.setBrandName(pmsBrand.getName());
PmsProductExample example = new PmsProductExample();
example.createCriteria().andBrandIdEqualTo(id);
productMapper.updateByExampleSelective(product,example);
return brandMapper.updateByPrimaryKeySelective(pmsBrand);
}
@Override
public int deleteBrand(Long id) {
return brandMapper.deleteByPrimaryKey(id);
}
@Override
public int deleteBrand(List<Long> ids) {
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.createCriteria().andIdIn(ids);
return brandMapper.deleteByExample(pmsBrandExample);
}
@Override
public List<PmsBrand> listBrand(String keyword, int pageNum, int pageSize) {
PageHelper.startPage(pageNum, pageSize);
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.setOrderByClause("sort desc");
PmsBrandExample.Criteria criteria = pmsBrandExample.createCriteria();
if (!StringUtils.isEmpty(keyword)) {
criteria.andNameLike("%" + keyword + "%");
}
return brandMapper.selectByExample(pmsBrandExample);
}
@Override
public PmsBrand getBrand(Long id) {
return brandMapper.selectByPrimaryKey(id);
}
@Override
public int updateShowStatus(List<Long> ids, Integer showStatus) {
PmsBrand pmsBrand = new PmsBrand();
pmsBrand.setShowStatus(showStatus);
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.createCriteria().andIdIn(ids);
return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
}
@Override
public int updateFactoryStatus(List<Long> ids, Integer factoryStatus) {
PmsBrand pmsBrand = new PmsBrand();
pmsBrand.setFactoryStatus(factoryStatus);
PmsBrandExample pmsBrandExample = new PmsBrandExample();
pmsBrandExample.createCriteria().andIdIn(ids);
return brandMapper.updateByExampleSelective(pmsBrand, pmsBrandExample);
}
}
| [
"sun4763"
]
| sun4763 |
19eed8a3cd51da7beef686c808d82f71da2b6fc5 | 53d6a07c1a7f7ce6f58135fefcbd0e0740b059a6 | /23Code/XCL-Charts-master/XCL-Charts-master/XCL-Charts/src/org/xclcharts/event/zoom/ChartZoom.java | 6322ef9bc65afbcc39b08a5d3b29bf4fd7033244 | [
"Apache-2.0"
]
| permissive | jx-admin/Code2 | 33dfa8d7a1acfa143d07309b6cf33a9ad7efef7f | c0ced8c812c0d44d82ebd50943af8b3381544ec7 | refs/heads/master | 2021-01-15T15:36:33.439310 | 2017-05-17T03:22:30 | 2017-05-17T03:22:30 | 43,429,217 | 8 | 4 | null | null | null | null | UTF-8 | Java | false | false | 3,519 | java | /**
* Copyright 2014 XCL-Charts
*
* 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.
*
* @Project XCL-Charts
* @Description Android图表基类库
* @author XiongChuanLiang<br/>([email protected])
* @license http://www.apache.org/licenses/ Apache v2 License
* @version 1.0
*/
package org.xclcharts.event.zoom;
import org.xclcharts.renderer.XChart;
import android.util.Log;
import android.view.View;
/**
* @ClassName ChartZoom
* @Description 放大缩小图表 <br/>
* @author XiongChuanLiang<br/>([email protected])
*/
//附注: 对于有放大缩小图,数据随着放大缩小或左右移动要求的,可在view中
// 通过控制图的Axis和Datasource重置来实现。
// 图表库本身其实应当只负责绘图的。唉。不能对图表库要求太多。
// 像动画之类完全都应当是在view中去操作的,见我写的Demo。
public class ChartZoom implements IChartZoom {
private static final String TAG = "ChartZoom";
private View mView;
private XChart mChart;
//图原始的宽高
private float mInitWidth = 0.0f;
private float mInitHeight = 0.0f;
//处理类型
private static final int ZOOM_IN = 0; //放大
private static final int ZOOM_OUT = 1; //缩小
//当前缩放比
private float mScaleRate = 0.1f;
//所允许的最小缩小比,固定为0.5f;
private static final float MIN_SCALE_RATE = 0.5f;
//最小缩小比对应的宽高
private float mScaleMinWidth = 0.0f;
private float mScaleMinHeight = 0.0f;
public ChartZoom(View view, XChart chart) {
this.mChart = chart;
this.mView = view;
mInitWidth = chart.getWidth();
mInitHeight = chart.getHeight();
mScaleMinWidth = (int)(MIN_SCALE_RATE * mInitWidth);
mScaleMinHeight = (int)(MIN_SCALE_RATE * mInitHeight);
}
@Override
public void setZoomRate(float rate) {
// TODO Auto-generated method stub
mScaleRate = rate;
}
@Override
public void zoomIn() {
// TODO Auto-generated method stub
//放大
reSize(ZOOM_IN);
}
@Override
public void zoomOut() {
// TODO Auto-generated method stub
reSize(ZOOM_OUT);
}
//重置大小
private void reSize(int flag)
{
float newWidth = 0.0f,newHeight = 0.0f;
int scaleWidth = (int)(mScaleRate * mInitWidth);
int scaleHeight = (int)(mScaleRate * mInitHeight);
if(ZOOM_OUT == flag) //缩小
{
newWidth = mChart.getWidth() - scaleWidth;
newHeight = mChart.getHeight() - scaleHeight;
if(mScaleMinWidth > newWidth) newWidth = mScaleMinWidth;
if(mScaleMinHeight > newHeight) newHeight = mScaleMinHeight;
}else if(ZOOM_IN == flag){ //放大
newWidth = mChart.getWidth() + scaleWidth;
newHeight = mChart.getHeight() + scaleHeight;
}else{
Log.e(TAG, "不认识这个参数.");
return ;
}
if( Float.compare(newWidth, 0) > 0 && Float.compare(newHeight,0) > 0 )
{
mChart.setChartRange(mChart.getLeft(),mChart.getTop(), newWidth, newHeight);
mView.invalidate();
}
}
}
| [
"[email protected]"
]
| |
0780b127b84ce5f5d36bf8ae6ce84991198564f2 | e92ff8e704140248b6d3348ca3d06d8f4d3596b7 | /acmdb-lab2/src/java/simpledb/HeapPage.java | d8b820c3693fa7574c6841b3aef0e328adf48b48 | []
| no_license | jyqhahah/acmdb20-518120910136 | 1a705d1cd5b99a2678391752a83e4e61a8df3b4c | 418877969adcf5271f098bf30a0ca27df4bec7bd | refs/heads/main | 2023-06-01T23:52:50.105131 | 2021-06-15T11:44:17 | 2021-06-15T11:44:17 | 355,848,496 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,263 | java | package simpledb;
import java.util.*;
import java.io.*;
/**
* Each instance of HeapPage stores data for one page of HeapFiles and
* implements the Page interface that is used by BufferPool.
*
* @see HeapFile
* @see BufferPool
*
*/
public class HeapPage implements Page {
final HeapPageId pid;
final TupleDesc td;
final byte header[];
final Tuple tuples[];
final int numSlots;
byte[] oldData;
private final Byte oldDataLock=new Byte((byte)0);
/**
* Create a HeapPage from a set of bytes of data read from disk.
* The format of a HeapPage is a set of header bytes indicating
* the slots of the page that are in use, some number of tuple slots.
* Specifically, the number of tuples is equal to: <p>
* floor((BufferPool.getPageSize()*8) / (tuple size * 8 + 1))
* <p> where tuple size is the size of tuples in this
* database table, which can be determined via {@link Catalog#getTupleDesc}.
* The number of 8-bit header words is equal to:
* <p>
* ceiling(no. tuple slots / 8)
* <p>
* @see Database#getCatalog
* @see Catalog#getTupleDesc
* @see BufferPool#getPageSize()
*/
public HeapPage(HeapPageId id, byte[] data) throws IOException {
this.pid = id;
this.td = Database.getCatalog().getTupleDesc(id.getTableId());
this.numSlots = getNumTuples();
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data));
// allocate and read the header slots of this page
header = new byte[getHeaderSize()];
for (int i=0; i<header.length; i++)
header[i] = dis.readByte();
tuples = new Tuple[numSlots];
try{
// allocate and read the actual records of this page
for (int i=0; i<tuples.length; i++)
tuples[i] = readNextTuple(dis,i);
}catch(NoSuchElementException e){
e.printStackTrace();
}
dis.close();
setBeforeImage();
}
/** Retrieve the number of tuples on this page.
@return the number of tuples on this page
*/
private int getNumTuples() {
// some code goes here
return BufferPool.getPageSize() * 8 / (td.getSize() * 8 + 1);
}
/**
* Computes the number of bytes in the header of a page in a HeapFile with each tuple occupying tupleSize bytes
* @return the number of bytes in the header of a page in a HeapFile with each tuple occupying tupleSize bytes
*/
private int getHeaderSize() {
// some code goes here
return numSlots / 8 + ((numSlots % 8 == 0) ? 0 : 1);
}
/** Return a view of this page before it was modified
-- used by recovery */
public HeapPage getBeforeImage(){
try {
byte[] oldDataRef = null;
synchronized(oldDataLock)
{
oldDataRef = oldData;
}
return new HeapPage(pid,oldDataRef);
} catch (IOException e) {
e.printStackTrace();
//should never happen -- we parsed it OK before!
System.exit(1);
}
return null;
}
public void setBeforeImage() {
synchronized(oldDataLock)
{
oldData = getPageData().clone();
}
}
/**
* @return the PageId associated with this page.
*/
public HeapPageId getId() {
// some code goes here
// throw new UnsupportedOperationException("implement this");
return pid;
}
/**
* Suck up tuples from the source file.
*/
private Tuple readNextTuple(DataInputStream dis, int slotId) throws NoSuchElementException {
// if associated bit is not set, read forward to the next tuple, and
// return null.
if (!isSlotUsed(slotId)) {
for (int i=0; i<td.getSize(); i++) {
try {
dis.readByte();
} catch (IOException e) {
throw new NoSuchElementException("error reading empty tuple");
}
}
return null;
}
// read fields in the tuple
Tuple t = new Tuple(td);
RecordId rid = new RecordId(pid, slotId);
t.setRecordId(rid);
try {
for (int j=0; j<td.numFields(); j++) {
Field f = td.getFieldType(j).parse(dis);
t.setField(j, f);
}
} catch (java.text.ParseException e) {
e.printStackTrace();
throw new NoSuchElementException("parsing error!");
}
return t;
}
/**
* Generates a byte array representing the contents of this page.
* Used to serialize this page to disk.
* <p>
* The invariant here is that it should be possible to pass the byte
* array generated by getPageData to the HeapPage constructor and
* have it produce an identical HeapPage object.
*
* @see #HeapPage
* @return A byte array correspond to the bytes of this page.
*/
public byte[] getPageData() {
int len = BufferPool.getPageSize();
ByteArrayOutputStream baos = new ByteArrayOutputStream(len);
DataOutputStream dos = new DataOutputStream(baos);
// create the header of the page
for (int i=0; i<header.length; i++) {
try {
dos.writeByte(header[i]);
} catch (IOException e) {
// this really shouldn't happen
e.printStackTrace();
}
}
// create the tuples
for (int i=0; i<tuples.length; i++) {
// empty slot
if (!isSlotUsed(i)) {
for (int j=0; j<td.getSize(); j++) {
try {
dos.writeByte(0);
} catch (IOException e) {
e.printStackTrace();
}
}
continue;
}
// non-empty slot
for (int j=0; j<td.numFields(); j++) {
Field f = tuples[i].getField(j);
try {
f.serialize(dos);
} catch (IOException e) {
e.printStackTrace();
}
}
}
// padding
int zerolen = BufferPool.getPageSize() - (header.length + td.getSize() * tuples.length); //- numSlots * td.getSize();
byte[] zeroes = new byte[zerolen];
try {
dos.write(zeroes, 0, zerolen);
} catch (IOException e) {
e.printStackTrace();
}
try {
dos.flush();
} catch (IOException e) {
e.printStackTrace();
}
return baos.toByteArray();
}
/**
* Static method to generate a byte array corresponding to an empty
* HeapPage.
* Used to add new, empty pages to the file. Passing the results of
* this method to the HeapPage constructor will create a HeapPage with
* no valid tuples in it.
*
* @return The returned ByteArray.
*/
public static byte[] createEmptyPageData() {
int len = BufferPool.getPageSize();
return new byte[len]; //all 0
}
/**
* Delete the specified tuple from the page; the tuple should be updated to reflect
* that it is no longer stored on any page.
* @throws DbException if this tuple is not on this page, or tuple slot is
* already empty.
* @param t The tuple to delete
*/
public void deleteTuple(Tuple t) throws DbException {
// some code goes here
// not necessary for lab1
RecordId rid = t.getRecordId();
if(rid.getPageId().pageNumber() != pid.pageNumber() || rid.getPageId().getTableId() != pid.getTableId())
throw new DbException("Invalid tuple throw by HeapPage deleteTuple()");
if(!isSlotUsed(rid.tupleno()))
throw new DbException("empty tuple throw by HeapPage deleteTuple()");
t.setRecordId(null);
markSlotUsed(rid.tupleno(), false);
}
/**
* Adds the specified tuple to the page; the tuple should be updated to reflect
* that it is now stored on this page.
* @throws DbException if the page is full (no empty slots) or tupledesc
* is mismatch.
* @param t The tuple to add.
*/
public void insertTuple(Tuple t) throws DbException {
// some code goes here
// not necessary for lab1
if(!t.getTupleDesc().equals(td))
throw new DbException("tuplesesc mismatch throw by HeapPage insertTuple()");
int loc = -1;
for(int i = 0; i < numSlots; ++i){
if(!isSlotUsed(i)){
loc = i;
break;
}
}
if(loc == -1)
throw new DbException("No empty slots throw by HeapPage insertTuple()");
RecordId rid = new RecordId(pid, loc);
t.setRecordId(rid);
tuples[loc] = t;
markSlotUsed(loc, true);
}
/**
* Marks this page as dirty/not dirty and record that transaction
* that did the dirtying
*/
public void markDirty(boolean dirty, TransactionId tid) {
// some code goes here
// not necessary for lab1
}
/**
* Returns the tid of the transaction that last dirtied this page, or null if the page is not dirty
*/
public TransactionId isDirty() {
// some code goes here
// Not necessary for lab1
return null;
}
/**
* Returns the number of empty slots on this page.
*/
public int getNumEmptySlots() {
// some code goes here
int num = 0;
for (int i = 0; i < numSlots; i++)
if (!isSlotUsed(i))
num++;
return num;
}
/**
* Returns true if associated slot on this page is filled.
*/
public boolean isSlotUsed(int i) {
// some code goes here
return (header[i / 8] & (1 << (i % 8))) != 0;
}
/**
* Abstraction to fill or clear a slot on this page.
*/
private void markSlotUsed(int i, boolean value) {
// some code goes here
// not necessary for lab1
}
public class TupleIterator implements Iterator<Tuple>{
private int offset = 0;
private int cnt = 0;
@Override
public boolean hasNext() {
return (offset < numSlots) && (cnt < getNumTuples() - getNumEmptySlots());
}
@Override
public Tuple next() {
if (!hasNext())
throw new NoSuchElementException("NoSuchElementException throw by TupleIterator");
while (!isSlotUsed(offset))
offset++;
cnt++;
return tuples[offset++];
}
}
/**
* @return an iterator over all tuples on this page (calling remove on this iterator throws an UnsupportedOperationException)
* (note that this iterator shouldn't return tuples in empty slots!)
*/
public Iterator<Tuple> iterator() {
// some code goes here
return new TupleIterator();
}
}
| [
"[email protected]"
]
| |
b43f24f9f11557009b033fb85fa2b07ab79d46ab | 5ba4fc4471d3e486e7eeca9e367bf1da4c317538 | /My Spring Hibernate (Address Book)/src/main/java/com/addressbook/main/App.java | cb5caf478406d79d55a2b2955d97ec07d67f95a9 | []
| no_license | kardash/java-tutorials | c208207dc377d5407191b0ec377fa94e9ca92430 | 20f3fe8e42693c3fbc024454a94e9b4f6bc042c4 | refs/heads/master | 2021-01-22T00:30:07.502870 | 2015-05-29T05:31:01 | 2015-05-29T05:31:01 | 36,558,109 | 2 | 0 | null | 2015-05-30T12:59:12 | 2015-05-30T12:59:12 | null | UTF-8 | Java | false | false | 1,802 | java | package com.addressbook.main;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.addressbook.dao.ContactDao;
import com.addressbook.dao.PersonDao;
import com.addressbook.entities.Contact;
import com.addressbook.entities.Person;
public class App {
private static ClassPathXmlApplicationContext context;
public static void main(String[] args) {
context = new ClassPathXmlApplicationContext("spring.xml");
PersonDao personDao = context.getBean(PersonDao.class);
ContactDao contactDao = context.getBean(ContactDao.class);
//Create the person
Person person = new Person();
person.setId(UUID.randomUUID().toString());
person.setFirstname("Hanna Samantha");
person.setMiddlename("Narciso");
person.setLastname("Lising");
person.setAge(7);
person.setBirthdate("2007-06-19");
person.setGender("Female");
//Create the contacts
Contact contactOne = new Contact(UUID.randomUUID().toString(), "09232104978",
"09232104978", "Home", "Yes", "[email protected]");
Contact contactTwo = new Contact(UUID.randomUUID().toString(), "09232104978",
"09232104978", "Work", "Yes", "[email protected]");
List<Contact> contacts = new ArrayList<Contact>();
contacts.add(contactOne);
contacts.add(contactTwo);
//Set each contact to person
contactOne.setPerson(person);
contactTwo.setPerson(person);
//Save person in the session
personDao.save(person);
//Save each contact in the session
contactDao.save(contactOne);
contactDao.save(contactTwo);
//List<Person> list = personDao.getList();
//for(Person p : list){
// System.out.println("Person List::"+p);
//}
}
}
| [
"[email protected]"
]
| |
42340518e17a5fe498498b742916b89d08371990 | f96253fe3f59e032aff9af7c6e5d4b3d58d24c8b | /Programa/core/src/com/services/collision/userdata/UserData.java | 7819d8a074c40bc90f543dbc87ef8647f1e6877c | []
| no_license | MartinGGomez/ProyectoJava | cb9427bab51c71343ca53cd186d193f6cee75ed0 | c5a60ac05f8ae4b37e6cece91692c10ef044f7dc | refs/heads/master | 2020-03-28T11:27:52.993241 | 2018-12-04T14:30:47 | 2018-12-04T14:30:47 | 148,215,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | java | package com.services.collision.userdata;
public class UserData {
public String type;
public int index;
public boolean sensor;
public String sensorDirection;
public UserData(String type, int index, boolean sensor) {
this.type = type;
this.index = index;
this.sensor = sensor;
}
}
| [
"[email protected]"
]
| |
8cb829b55c90defd5e90314c8b6d6630478f7450 | 65af96d3085410f06712c74213f66c591f4dbf1f | /src/tec/Invernadero_Ac.java | 55df1ace5a71ca4e8193772bca76ee4ff2ec084d | []
| no_license | AlanJ97/TecMaps | c72b485edc256024e759f4c6d34e90686aadc609 | f2928254a59f84ac5d655f56863f1dbf6d1c65bb | refs/heads/master | 2022-12-09T01:52:56.002871 | 2020-08-15T13:28:02 | 2020-08-15T13:28:02 | 287,751,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,617 | 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 tec;
/**
*
* @author alann
*/
public class Invernadero_Ac extends javax.swing.JFrame {
/**
* Creates new form Invernadero_Ac
*/
public Invernadero_Ac() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/DOCUMENTACIÓN 2/Laboratorio_de_invernadero_centro_de_idiomas.png"))); // NOI18N
jLabel2.setText("jLabel2");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 340, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Invernadero_Ac.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Invernadero_Ac.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Invernadero_Ac.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Invernadero_Ac.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Invernadero_Ac().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel2;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
6cbfba4434cc4c6839aba3ecd3aeed631f1dd2e4 | bc7b378abb39cf90850a07a30289d6d58a913933 | /oopsdemo/src/oopsdemo3/Candidate.java | 25d0efb817aa465a893d55208287a8412ea4dc8d | []
| no_license | mayank0816/oopsdemo | 4494ccc3ed4ba261347ca6181c372c6a5e2783e8 | 9f72723308c2eaffb49951482e9219971856770f | refs/heads/master | 2023-07-04T02:56:16.839373 | 2021-08-04T10:36:43 | 2021-08-04T10:36:43 | 392,645,156 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 538 | java | package oopsdemo3;
public class Candidate {
String name;
int roll_no,mark1,mark2;
public Candidate(String name, int roll_no, int mark1, int mark2) {
this.name = name;
this.roll_no = roll_no;
this.mark1 = mark1;
this.mark2 = mark2;
}
void display()
{
System.out.println ("Name of Student: "+name);
System.out.println ("Roll No. of Student: "+roll_no);
System.out.println ("Marks of Subject 1: "+mark1);
System.out.println ("Marks of Subject 2: "+mark2);
}
}
| [
"[email protected]"
]
| |
9577a6365f305001ebbb868365a2f8fd11185fc8 | a2b6eefd30b8c0dca99c1a676f08037c29614a9d | /src/hashmapimplementation/LineDetector.java | 6a2c4546826919ebbcf9bea7c617fb8cd9328b5a | []
| no_license | ianmurphy1/patterndetection | 6c1d071525ceab4250ec03844481c0e1988c7f68 | 7e88d254ae04b4dd7ab0b8b8dac8f04b6fe78086 | refs/heads/master | 2021-01-19T15:03:32.837982 | 2013-12-05T23:07:35 | 2013-12-05T23:07:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,744 | java | package hashmapimplementation;
import Point.Point;
import edu.princeton.cs.introcs.*;
import java.awt.Color;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.TreeSet;
import java.util.SortedSet;
import java.util.Collections;
/**
*
*/
public class LineDetector {
private Map<String, SortedSet<Point>> lines;
private int count;
public LineDetector() {
lines = new HashMap<String, SortedSet<Point>>();
count = 0;
}
/**
* @param args
*/
public static void main(String[] args) {
LineDetector det = new LineDetector();
det.run("input10000.txt");
}
/**
*
* @param s
*/
public void run(String s) {
Stopwatch stopwatch = new Stopwatch();
StdDraw.show(0);
Point[] points = getPoints(s);
for (int i = 0; i < points.length; i++) {
createLines(points[i], Arrays.copyOfRange(points, i + 1, points.length));
}
StdAudio.play("inputs/success.wav");
drawLines();
StdDraw.show(0);
StdDraw.save("outputs/" + s.replace(".txt", ".png"));
StdOut.println("Number of lines: " + lines.size());
StdOut.println("Done in: " + stopwatch.elapsedTime() + "s");
StdOut.println("Op Count: " + count);
}
/**
*
*/
private void drawLines() {
for (Map.Entry<String, SortedSet<Point>> line: lines.entrySet()) {
StdDraw.setPenColor(Color.getHSBColor((float) Math.random(), .8f, .8f));
line.getValue().first().drawTo(line.getValue().last());
StdDraw.setPenColor(StdDraw.BLACK);
double rad = StdDraw.getPenRadius();
StdDraw.setPenRadius(rad * 3);
StdOut.print(line.getValue().size() + ": ");
for (Point p: line.getValue()) {
StdOut.print(p);
if (!p.equals(Collections.max(line.getValue()))) StdOut.print(" -> ");
else StdOut.print("\n");
p.draw();
}
StdDraw.setPenRadius(rad);
}
}
/**
*
* @param p
* @param points
*/
private void createLines(Point p, Point[] points) {
Arrays.sort(points, p.SLOPE_ORDER);
double slope1, slope2;
for (int i = 0; i < points.length - 2; i++) {
SortedSet<Point> line = new TreeSet<Point>();
line.add(p);
line.add(points[i]);
slope1 = p.slopeTo(points[i]);
for (int j = i + 1; j < points.length; j++) {
slope2 = p.slopeTo(points[j]);
count++;
if (Double.compare(slope1, slope2) == 0) {
line.add(points[j]);
String key = equationOfLine(slope1, points[i]) ; //Create key for map
if (line.size() > 3) { //If line has 4 or more points try adding to map.
if (!lines.containsKey(key)) lines.put(key, line);
else if (lines.containsKey(key) && lines.get(key).size() < line.size()) lines.put(key, line);
//Check if a set with a key exists, if it doesn't put it into map
//if the map has entry with the same key check if its the biggest, if it is bigger
//than the current entry, add it otherwise leave the current one there.
}
if (j == points.length - 1) i = points.length;
} else { //if not equal, might as well stop checking as array is sorted by slope
//so no more equal slopes left
i = j - 1;
break;
}
}
}
}
/**
*
* @param file
* @return
*/
private Point[] getPoints(String file) {
In in = new In("inputs/" + file);
if (!in.exists()) System.exit(1);
int n = in.readInt();
Point[] points = new Point[n];
double min, max;
min = Double.MAX_VALUE;
max = Double.MIN_VALUE;
int i = 0;
while (i < n) {
int x = in.readInt(), y = in.readInt();
double tMax, tMin;
tMax = Math.max(x, y);
tMin = Math.min(x, y);
if (tMax > max) max = tMax;
if (tMin < min) min = tMin;
points[i] = new Point(x, y);
points[i].draw();
i++;
}
StdOut.println("Number of points: " + n);
StdOut.println("Min: " + min);
StdOut.println("Max: " + max);
StdDraw.setScale(min, max * 1.1);
double rad = StdDraw.getPenRadius();
StdDraw.setPenRadius(rad * 1.5);
StdDraw.setPenColor(StdDraw.BOOK_RED);
StdDraw.line(min, 0, max, 0);
StdDraw.line(0, min, 0, max);
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.setPenRadius(rad);
StdDraw.text(max * 1.05, 0, "x");
StdDraw.text(15, max * 1.05, "y");
return points;
}
/**
* Method that takes in the slope and a point and works out the
* equation of the line, used to have a unique key for the Map.
*
* Returns in the form y = mx + b or x = x;
*
* @param slope Slope of the line trying to be added to Map
* @param p Point on the line being added
* @return The equation of the line
*/
private String equationOfLine(double slope, Point p) {
double y, x, m, b;
y = p.getY();
x = p.getX();
m = slope;
b = (m*x) - y;
if (slope == Double.POSITIVE_INFINITY)
return "x = " + x;
return ("y = " + Double.toString(m) + "x + " + Double.toString(b));
}
}
| [
"[email protected]"
]
| |
ec8ad34d08151cb34411092cce26279b69fa5a46 | 6df34b3ee06700c766064fe41dc15e4d9b49d37a | /SampleApplication/src/main/java/com/innobright/ws/service/EmployeeService.java | 675c1f038491c3e32e700d3cae3d88b541c08eb1 | []
| no_license | venkatasatishreddy/RestfulWSApp | 0bc2343be56cbf317567264fa643befb67cc37e6 | 47656abd990806f5c108a41c5df72cecd0e75354 | refs/heads/master | 2023-05-22T15:58:06.577152 | 2021-06-14T15:59:51 | 2021-06-14T15:59:51 | 373,559,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,527 | java | package com.innobright.ws.service;
import java.util.List;
import java.util.Optional;
import javax.annotation.Resource;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import com.innobright.ws.exception.EmployeeNotFoundException;
import com.innobright.ws.model.Employee;
import com.innobright.ws.repository.EmployeeRepository;
@Service
public class EmployeeService {
@Resource
EmployeeRepository employeeRepository;
public List<Employee> getAllEmployees() {
return employeeRepository.findAll();
}
public Employee getEmployee(String id) {
Optional<Employee> findById = employeeRepository.findById(id);
if(findById.isPresent())
return findById.get();
else
throw new EmployeeNotFoundException("Employee not found on this id : " + id);
}
public ResponseEntity<Employee> createEmployees(Employee employee) {
employeeRepository.save(employee);
return new ResponseEntity<Employee>(HttpStatus.CREATED);
}
public void updateEmployee(String id, Employee employee) {
Optional<Employee> findFirst = getAllEmployees().stream().filter(emp -> emp.getId().equals(id)).findFirst();
if(findFirst.isPresent()) {
employee.setId(id);
employeeRepository.save(employee);
}
else
throw new EmployeeNotFoundException("Employee not found on this id : " + id);
}
public void deleteEmployee(String id) {
employeeRepository.deleteById(id);
}
}
| [
"[email protected]"
]
| |
590c1fb0863a5ef6b9aec56a0f9dd45541f7355b | 08bb57e406a63493ba3e97e6e98c576d68738ccc | /basequery-biz/src/main/java/com/eenet/basequery/learncenter/LCReserveOrderServiceImpl.java | bedc207b731d4de9a6f224040d6e0c011ddbefc4 | []
| no_license | lhb27/basequery-products-test | a79679cdd073e0635b90855ccc1c297c167cd54e | bd81e1fdf6acfc557bd4e6ce97799f1ad31b7b23 | refs/heads/master | 2020-04-02T04:39:13.646136 | 2016-08-09T06:54:41 | 2016-08-09T06:54:41 | 65,269,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 963 | java | package com.eenet.basequery.learncenter;
import java.util.ArrayList;
import com.eenet.base.SimpleResultSet;
import com.eenet.base.biz.SimpleBizImpl;
import com.eenet.base.query.OrderBy;
import com.eenet.base.query.Rank;
import com.eenet.base.query.QueryCondition;
public class LCReserveOrderServiceImpl extends SimpleBizImpl implements LCReserveOrderService {
@Override
public SimpleResultSet<LCReserveOrder> getLCReserveOrder(QueryCondition condition) {
if(condition.getOrderBySet()== null ||condition.getOrderBySet().isEmpty()){
ArrayList<OrderBy> orderList = new ArrayList<OrderBy>();
OrderBy order = new OrderBy();
order.setAttName("createdDt");
order.setRank(Rank.DESC);
orderList.add(order);
condition.setOrderBySet(orderList);
}
return super.query(condition);
}
@Override
public Class<LCReserveOrder> getPojoCLS() {
// TODO Auto-generated method stub
return LCReserveOrder.class;
}
}
| [
"lhb@PC201606202317"
]
| lhb@PC201606202317 |
9c384b62cab86e683d96e784a92826213bb6b411 | 11002d1052b546105738829e1f49cff37588dba2 | /ai.relational.orm.codegen/src/edu/neumont/schemas/orm/_2006/_04/orm/core/TooManyReadingRolesErrorType.java | 5f57f68088252a87dae3be3236b735517bcdcd22 | []
| no_license | imbur/orm-codegen | 2f0ddb929e364dc8945cf699ecaf08156062962c | 962821f5ac2c55ffbc087eca6b45aa5e3dbe408c | refs/heads/master | 2023-05-03T05:25:32.203415 | 2021-05-20T18:35:43 | 2021-05-20T18:35:43 | 364,452,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,742 | java | /**
*/
package edu.neumont.schemas.orm._2006._04.orm.core;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Too Many Reading Roles Error Type</b></em>'.
* <!-- end-user-doc -->
*
* <!-- begin-model-doc -->
* Reading text does not have enough placeholders for all roles.
* <!-- end-model-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link edu.neumont.schemas.orm._2006._04.orm.core.TooManyReadingRolesErrorType#getReading <em>Reading</em>}</li>
* </ul>
*
* @see edu.neumont.schemas.orm._2006._04.orm.core.CorePackage#getTooManyReadingRolesErrorType()
* @model extendedMetaData="name='TooManyReadingRolesErrorType' kind='elementOnly'"
* @generated
*/
public interface TooManyReadingRolesErrorType extends ModelError {
/**
* Returns the value of the '<em><b>Reading</b></em>' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>Reading</em>' containment reference.
* @see #setReading(ReadingRef)
* @see edu.neumont.schemas.orm._2006._04.orm.core.CorePackage#getTooManyReadingRolesErrorType_Reading()
* @model containment="true" required="true"
* extendedMetaData="kind='element' name='Reading' namespace='##targetNamespace'"
* @generated
*/
ReadingRef getReading();
/**
* Sets the value of the '{@link edu.neumont.schemas.orm._2006._04.orm.core.TooManyReadingRolesErrorType#getReading <em>Reading</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Reading</em>' containment reference.
* @see #getReading()
* @generated
*/
void setReading(ReadingRef value);
} // TooManyReadingRolesErrorType
| [
"[email protected]"
]
| |
3f7d47feca6c4df058d1b8d0b517a15d50c9c8c7 | 6aef731b1a2017a63756c6da01d36ed20e8701da | /src/com/jwetherell/openmap/common/Planet.java | 82e856ee0450accc622e1c31db7f03374e528ae1 | [
"Apache-2.0"
]
| permissive | trybeapps/android-openmap-framework | 4f5b7aafe0feb502ab43d7ef938690b2c850cc47 | 0831ab608f0cc4a357c428a591b2e7b54ff0cd62 | refs/heads/master | 2020-03-23T22:18:08.117144 | 2015-12-09T15:04:35 | 2015-12-09T15:04:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,548 | java | // **********************************************************************
//
// <copyright>
//
// BBN Technologies
// 10 Moulton Street
// Cambridge, MA 02138
// (617) 873-8000
//
// Copyright (C) BBNT Solutions LLC. All rights reserved.
//
// </copyright>
// **********************************************************************
package com.jwetherell.openmap.common;
public abstract class Planet {
// Solar system id's. Add new ones as needed.
final public static transient int Earth = 3;
final public static transient int Mars = 4;
// WGS84 / GRS80 datums
final public static transient float wgs84_earthPolarRadiusMeters = 6356752.3142f;
final public static transient double wgs84_earthPolarRadiusMeters_D = 6356752.3142;
final public static transient float wgs84_earthEquatorialRadiusMeters = 6378137.0f;
final public static transient double wgs84_earthEquatorialRadiusMeters_D = 6378137.0;
/* 1 - (minor/major) = 1/298.257 */
final public static transient float wgs84_earthFlat = 1 - (wgs84_earthPolarRadiusMeters / wgs84_earthEquatorialRadiusMeters);
/* sqrt(2*f - f^2) = 0.081819221f */
final public static transient float wgs84_earthEccen = (float) Math.sqrt(2 * wgs84_earthFlat - (wgs84_earthFlat * wgs84_earthFlat));
final public static transient float wgs84_earthEquatorialCircumferenceMeters = MoreMath.TWO_PI * wgs84_earthEquatorialRadiusMeters;
final public static transient float wgs84_earthEquatorialCircumferenceKM = wgs84_earthEquatorialCircumferenceMeters / 1000f;
final public static transient float wgs84_earthEquatorialCircumferenceMiles = wgs84_earthEquatorialCircumferenceKM * 0.62137119f;// HACK
/* 60.0f * 360.0f -- sixty nm per degree units? */
final public static transient float wgs84_earthEquatorialCircumferenceNMiles = 21600.0f;
final public static transient double wgs84_earthEquatorialCircumferenceMeters_D = MoreMath.TWO_PI_D * wgs84_earthEquatorialRadiusMeters_D;
final public static transient double wgs84_earthEquatorialCircumferenceKM_D = wgs84_earthEquatorialCircumferenceMeters_D / 1000;
final public static transient double wgs84_earthEquatorialCircumferenceMiles_D = wgs84_earthEquatorialCircumferenceKM_D * 0.62137119;// HACK
/* 60.0f * 360.0f; sixty nm per degree */// units?
final public static transient double wgs84_earthEquatorialCircumferenceNMiles_D = 21600.0;
// wgs84_earthEquatorialCircumferenceKM*0.5389892f; // calculated,
// same as line above.
// wgs84_earthEquatorialCircumferenceKM*0.5399568f;//HACK use UNIX
// units? << This was wrong.
// Mars
final public static transient float marsEquatorialRadius = 3393400.0f;// meters
final public static transient float marsEccen = 0.101929f;// eccentricity
// e
final public static transient float marsFlat = 0.005208324f;// 1-(1-e^2)^1/2
// International 1974
final public static transient float international1974_earthPolarRadiusMeters = 6356911.946f;
final public static transient float international1974_earthEquatorialRadiusMeters = 6378388f;
/* 1 - (minor/major) = 1/297 */
final public static transient float international1974_earthFlat = 1 - (international1974_earthPolarRadiusMeters / international1974_earthEquatorialRadiusMeters);
/*
* Extra scale constant for better viewing of maps (do not use this to
* calculate anything but points to be viewed!) 3384: mattserver/Map.C,
* 3488: dcw
*/
public transient static int defaultPixelsPerMeter = 3272;
}
| [
"phishman3579@4b5513c3-5bd7-70cd-7e60-9a64e22c1e62"
]
| phishman3579@4b5513c3-5bd7-70cd-7e60-9a64e22c1e62 |
7267817e2e725d90e23b60b8a1045776f950f2c8 | eae6fb036cb14222207903f48e8329e1eae1cf94 | /Core/src/test/java/prompto/translate/oeo/TestNative.java | f5445e74e1b42976022ee24620893fd579af70ee | []
| no_license | balqeesawawde/prompto-java | 0cd765d3d3a7e2d530efef6208037b2e0c5e018f | 9991ed6c3f47050ad882d87bee0840fbe8754976 | refs/heads/master | 2023-03-13T06:37:53.919759 | 2021-03-06T16:49:15 | 2021-03-06T16:49:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,314 | java | package prompto.translate.oeo;
import org.junit.Test;
import prompto.parser.o.BaseOParserTest;
public class TestNative extends BaseOParserTest {
@Test
public void testCategory() throws Exception {
compareResourceOEO("native/category.poc");
}
@Test
public void testCategoryReturn() throws Exception {
compareResourceOEO("native/categoryReturn.poc");
}
@Test
public void testMethod() throws Exception {
compareResourceOEO("native/method.poc");
}
@Test
public void testReturn() throws Exception {
compareResourceOEO("native/return.poc");
}
@Test
public void testReturnBooleanLiteral() throws Exception {
compareResourceOEO("native/returnBooleanLiteral.poc");
}
@Test
public void testReturnBooleanObject() throws Exception {
compareResourceOEO("native/returnBooleanObject.poc");
}
@Test
public void testReturnBooleanValue() throws Exception {
compareResourceOEO("native/returnBooleanValue.poc");
}
@Test
public void testReturnCharacterLiteral() throws Exception {
compareResourceOEO("native/returnCharacterLiteral.poc");
}
@Test
public void testReturnCharacterObject() throws Exception {
compareResourceOEO("native/returnCharacterObject.poc");
}
@Test
public void testReturnCharacterValue() throws Exception {
compareResourceOEO("native/returnCharacterValue.poc");
}
@Test
public void testReturnDecimalLiteral() throws Exception {
compareResourceOEO("native/returnDecimalLiteral.poc");
}
@Test
public void testReturnIntegerLiteral() throws Exception {
compareResourceOEO("native/returnIntegerLiteral.poc");
}
@Test
public void testReturnIntegerObject() throws Exception {
compareResourceOEO("native/returnIntegerObject.poc");
}
@Test
public void testReturnIntegerValue() throws Exception {
compareResourceOEO("native/returnIntegerValue.poc");
}
@Test
public void testReturnLongLiteral() throws Exception {
compareResourceOEO("native/returnLongLiteral.poc");
}
@Test
public void testReturnLongObject() throws Exception {
compareResourceOEO("native/returnLongObject.poc");
}
@Test
public void testReturnLongValue() throws Exception {
compareResourceOEO("native/returnLongValue.poc");
}
@Test
public void testReturnStringLiteral() throws Exception {
compareResourceOEO("native/returnStringLiteral.poc");
}
}
| [
"[email protected]"
]
| |
4e702eec8147e3776cecf723ebd1125dec58b48e | 7fb9e6e69208aa3f7baa962fc10c85e1f99d0387 | /app/src/main/java/com/gmy/blog/LoginActivity.java | c234632f28d9efe3fb58d0059d3496d636e82eb6 | []
| no_license | gmyboy/Blog | 1d688a48f9fd683adaa5b83d8802cd7a12c6d5f2 | aa5e254d06846101752a84e420054d3395d3c065 | refs/heads/master | 2016-09-10T19:51:04.520209 | 2015-07-28T10:19:00 | 2015-07-28T10:19:00 | 39,002,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,858 | java | package com.gmy.blog;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager.LayoutParams;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gmy.blog.thread.DataRunnable;
import com.gmy.blog.thread.TaskExecutor;
import com.gmy.blog.utils.Config;
import com.gmy.blog.utils.UserNetUtil;
import org.json.JSONException;
import org.json.JSONObject;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import butterknife.Bind;
import butterknife.OnClick;
/**
* 用户登录
*
* @author GMY
*/
public class LoginActivity extends BaseActivity {
@Bind(R.id.etLoginName)
EditText etLoginName;
@Bind(R.id.et_login_pwd)
EditText etLoginPwd;
@Bind(R.id.b_login)
Button bLogin;
@Bind(R.id.tv_login_findpwd)
TextView tvLoginFindpwd;
@Bind(R.id.tv_login_regist)
TextView tvLoginRegist;
private String loginback;
@OnClick(R.id.b_login)
void submit() {
if (etLoginName.getText().toString().equals("")) {
showToast("用户名不能为空!!");
} else if (etLoginPwd.getText().toString().equals("")) {
showToast("密码不能为空!!");
} else {
Map<String, String> map = new HashMap<>();
map.put("username", etLoginName.getText().toString().trim());
map.put("password", etLoginPwd.getText().toString().trim());
TaskExecutor.Execute(new DataRunnable(this, "/user/login", mHandler, Config.WHAT_ONE, map));
}
}
@OnClick(R.id.tv_login_findpwd)
void findPwd() {
Intent intent1 = new Intent();
intent1.setClass(mContext, FindPwdActivity.class);
startActivityForResult(intent1, 1000);
}
@OnClick(R.id.tv_login_regist)
void regist() {
Intent intent = new Intent();
intent.setClass(mContext, RegistActivity.class);
startActivityForResult(intent, 1000);
}
// @SuppressLint("HandlerLeak")
// private Handler handler = new Handler() {
// public void handleMessage(Message msg) {
// if (msg.what == 1) {
// if (loginback.equals("1")) {
// showToast("用户名不存在!!");
// } else if (loginback.equals("2")) {
// showToast("密码错误!!");
// } else if (loginback.equals("0")) {
// showToast("登录成功");
//
// getSharePreferencesEditor()
// .remove(Config.USER_NAME)
// .putString(Config.USER_NAME,
// etLoginName.getText().toString().trim())
// .putString("list_username",
// etLoginName.getText().toString().trim())
// .putString("list_pwd",
// etLoginPwd.getText().toString().trim())
// .commit();
// Intent intent = new Intent();
// intent.setClass(mContext, MainActivity.class);
// startActivityForResult(intent, 1000);
// finish();
// } else {
// showToast("登录失败");
// }
// }
// }
// };
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
// 透明状态栏
getWindow().addFlags(
LayoutParams.FLAG_TRANSLUCENT_STATUS);
// 透明导航栏
getWindow().addFlags(
LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
}
@Override
public void setLayout() {
setContentView(R.layout.activity_login);
}
@Override
public void initView() {
mHandler = new LoginHandler(this);
}
private class LoginHandler extends Handler {
private WeakReference<Activity> mWeak;
public LoginHandler(Activity activity) {
mWeak = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
Activity activity = mWeak.get();
doAction(activity, msg.what, (String) msg.obj);
}
/**
* @Title doAction
* @Description 动作
*/
private void doAction(Activity activity, int what, String json) {
switch (what) {
case Config.WHAT_ONE: // 验证用户名
Log.d("gmyboy", json);
if (!json.isEmpty()) {
try {
JSONObject jb = new JSONObject(json);
String status = jb.getString("status");
String msg = jb.getString("msg");
if (status.equals("0")) {
showToast("登录成功");
getSharePreferencesEditor()
.remove(Config.USER_NAME)
.putString(Config.USER_NAME,
etLoginName.getText().toString().trim())
.putString("list_username",
etLoginName.getText().toString().trim())
.putString("list_pwd",
etLoginPwd.getText().toString().trim())
.commit();
Intent intent = new Intent();
intent.setClass(mContext, MainActivity.class);
startActivityForResult(intent, 1000);
finish();
}else
showToast(msg);
} catch (JSONException e) {
e.printStackTrace();
Log.d(TAG, e.getMessage());
}
}
break;
}
}
}
}
| [
"[email protected]"
]
| |
b87154cecf44a3a572123c02fe919c9f178c6298 | 38ef8664bc129b9aae171618dd87622748e77dfb | /security/src/main/java/com/example/security/domain/service/userdetails/SampleUserDetails.java | 6fa484d5d06914d07db8b50cd0641c5097895aa7 | []
| no_license | sage1500/todo | 7fba9e6edc074ee8a383b7c5c7487bacbdd93d85 | 25f710721ae1dcbf726c1f2b7ded3daed31b16e1 | refs/heads/master | 2022-11-25T06:22:49.312982 | 2020-08-02T11:38:23 | 2020-08-02T11:38:23 | 282,113,490 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 689 | java | package com.example.security.domain.service.userdetails;
import com.example.security.domain.model.Account;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;
import lombok.EqualsAndHashCode;
import lombok.Value;
@Value
@EqualsAndHashCode(callSuper=true)
public class SampleUserDetails extends User {
private static final long serialVersionUID = 1L;
private final Account account;
public SampleUserDetails(final Account account) {
super(account.getUsername(), account.getPassword(), AuthorityUtils
.createAuthorityList("ROLE_USER"));
this.account = account;
}
} | [
"[email protected]"
]
| |
dc09bafe30043a9d6f35358e7524ad0de095fb98 | 33ae45d7d4fe63f2ff56f00ab0459e13cf62a59f | /library/src/main/java/com/ray/library/utils/T.java | 00b99912c9881a047366fd723ec4026f4960a1e8 | []
| no_license | Ray512512/GankDay | 2e0d8d8d1774ef32cb6489a3803075e9ef445489 | afff748d564c8af0f555dd18a927fa06763bcb12 | refs/heads/master | 2020-03-18T14:15:38.608251 | 2018-06-04T09:38:43 | 2018-06-04T09:38:45 | 134,838,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 979 | java | package com.ray.library.utils;
import android.content.Context;
import com.ray.library.BaseApplication;
/**
* Created by Ray on 2017/5/16.
* email:[email protected]
*/
public class T {
/**
* 短暂显示Toast提示(来自String) *
*/
public static void show(Context context, String text) {
android.widget.Toast.makeText(context, text, android.widget.Toast.LENGTH_SHORT).show();
}
/**
* 短暂显示Toast提示(来自res) *
*/
public static void show(Context context, int resId) {
android.widget.Toast.makeText(context, resId, android.widget.Toast.LENGTH_SHORT).show();
}
public static void show(String text) {
android.widget.Toast.makeText(BaseApplication.getInstance(), text, android.widget.Toast.LENGTH_SHORT).show();
}
public static void show(int resId) {
android.widget.Toast.makeText(BaseApplication.getInstance(), resId, android.widget.Toast.LENGTH_SHORT).show();
}
}
| [
"[email protected]"
]
| |
a54e2babcbdbb515849cf8d41001acc3cc89ba49 | 53aec9d04954d6ca2b74e0fb1448338f0c654152 | /incubationtask1/src/Index.java | b1e973eba43f5ab71c1a512a1f9e5ffac088c784 | []
| no_license | Narmadha154/TaxiBooking | a716335c2d5ec378efa9b8858b857a3c02a8f0e3 | 673c0d4bf91688a16b9864943969e8e21c7bba20 | refs/heads/master | 2023-08-05T13:40:12.479502 | 2021-09-24T00:39:56 | 2021-09-24T00:39:56 | 409,783,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package Task-1;
import java.util.Arrays;
import java.util.Scanner;
public class Index {
public void findIndex() {
int r,n;
Scanner sc=new Scanner(System.in);
System.out.println("enter the array size:");
n=sc.nextInt();
int [] array=new int[n];
System.out.println("enter the elements:");
for(int i=0;i<n;i++)
array[i]=sc.nextInt();
System.out.println("Array elements are :" + Arrays.toString(array));
System.out.println("enter the element for which you want the index:");
r = sc.nextInt();
System.out.println("Index position is:"+ Arrays.binarySearch(array,r));
}
}
| [
"[email protected]"
]
| |
a1de85eb48e1d4e8ca907b4e461fdf3fdffeca75 | d23e4a29a96b6914908251c3b3a52be668165bce | /branches/branch-1.0/mgrs-grid/src/main/java/mil/usmc/mgrs/MgrsXmlResource.java | be57e061abb25f9817a8493beb0621e0cb6a9af7 | []
| no_license | MoebiusSolutions/milmaps | c989310dbb59866ca15d7dd0d8433cd301271843 | 1305f961cc80f40512baba38a04e0fb9798be718 | refs/heads/master | 2020-12-11T09:15:35.375145 | 2015-04-22T15:59:49 | 2015-04-22T15:59:49 | 33,573,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 43,410 | java | package mil.usmc.mgrs;
import mil.usmc.mgrs.objects.BoundingBox;
import mil.usmc.mgrs.objects.Grid;
import mil.usmc.mgrs.objects.Point;
import mil.usmc.mgrs.objects.Line;
import mil.usmc.mgrs.objects.GridCell;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ws.rs.core.MultivaluedMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import mil.geotransj.GeoTransException;
import mil.geotransj.Geodetic;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
* Create XML for grid lines.
* @author Alex Pastel
*/
public class MgrsXmlResource {
private static final Logger LOGGER = Logger.getLogger(MgrsXmlResource.class.getName());
private static MgrsHelper mgrsHelper = new MgrsHelper();
public static BoundingBox m_bbox;
private static boolean UPDATE_XML_ON_DISK = true;
private static final boolean ZONE_GRID_ON = true;
private static final boolean HUNDRED_KM_GRID_ON = true;
private static final boolean TEN_KM_GRID_ON = false;
static final String ZONE_GRID = "ZoneGrid";
static final String HUNDRED_KM_GRID = "HundredKmGrid";
static final String TEN_KM_GRID = "TenKmGrid";
private static final String BBOX_QUERY_PARAMETER_NAME = "BBOX";
private ArrayList<GridCell> ZONE_CELLS = null;
static GridlineXmlPathProvider MGRS_XML_PATH_PROVIDER = new GridlineXmlPathProvider() {
@Override
public File get() {
return new File("/var/mgrs");
}
};
interface GridlineXmlPathProvider {
public File get();
}
public Document makeMgrsXml(double span) throws ParserConfigurationException, DOMException, GeoTransException {
MgrsHelper.SUPPRESS_EXCEPTIONS = true; // suppresses geo/mgrs conversion error stack traces
DocumentBuilder db = makeDocBuilder();
Document doc = db.newDocument();
Element bbox = doc.createElement("BBOX");
bbox.setAttribute("value", m_bbox.toString());
doc.appendChild(bbox);
Element mgrs = doc.createElement("MGRS");
bbox.appendChild(mgrs);
if (span <= 125 && ZONE_GRID_ON) {
createGridXml(doc, ZONE_GRID);
}
if (span <= 25 && HUNDRED_KM_GRID_ON) {
createGridXml(doc, HUNDRED_KM_GRID);
}
if (span <= 2 && TEN_KM_GRID_ON) {
createGridXml(doc, TEN_KM_GRID);
}
maybeWriteToDisk(doc);
return doc;
}
private void createGridXml(Document doc, String gridName) throws DOMException {
Element gridEl = doc.createElement(gridName);
doc.getElementsByTagName("MGRS").item(0).appendChild(gridEl);
Grid grid = null;
grid = makeGrid(gridName);
if (grid == null) {
LOGGER.log(Level.SEVERE, "{0} is null", gridName);
return;
}
Element latLineEl = doc.createElement("LatLines");
Element lngLineEl = doc.createElement("LngLines");
for (Line latLine : grid.getLatLines()) {
Element lineEl = doc.createElement("Line");
lineEl.setAttribute("start", latLine.getStart().toString());
lineEl.setAttribute("end", latLine.getEnd().toString());
if (latLine.getLabelPoint() != null) {
lineEl.setAttribute("lblPnt", latLine.getLabelPoint().toString());
}
if (latLine.getLabelName() != null) {
lineEl.setAttribute("lblName", latLine.getLabelName());
}
latLineEl.appendChild(lineEl);
}
for (Line lngLine : grid.getLngLines()) {
if (lngLine == null || skipNorwayLines(lngLine)) {
continue;
}
Element lineEl = doc.createElement("Line");
lineEl.setAttribute("start", lngLine.getStart().toString());
lineEl.setAttribute("end", lngLine.getEnd().toString());
if (lngLine.getLabelPoint() != null) {
lineEl.setAttribute("lblPnt", lngLine.getLabelPoint().toString());
}
if (lngLine.getLabelName() != null) {
lineEl.setAttribute("lblName", lngLine.getLabelName());
}
lngLineEl.appendChild(lineEl);
}
gridEl.appendChild(latLineEl);
gridEl.appendChild(lngLineEl);
}
public Grid makeMgrsGrid( String gridName ){
if ( gridName != ZONE_GRID ){
makeZoneGrid();
}
return makeGrid(gridName);
}
private Grid makeGrid(String gridName) {
LOGGER.log(Level.INFO, "Create lines for {0}\n", gridName);
if (gridName.equals(ZONE_GRID)) {
return makeZoneGrid();
}
if (gridName.equals(HUNDRED_KM_GRID)) {
return makeHundredKmGrid();
}
if (gridName.equals(TEN_KM_GRID)) {
return makeTenKmGrid();
}
return null;
}
private Grid makeZoneGrid() {
GridCell gridCell = null;
ArrayList<GridCell> gridCells = new ArrayList<GridCell>();
ZONE_CELLS = new ArrayList<GridCell>();
double sLat = m_bbox.getMinLat();
double wLng = m_bbox.getMinLon();
double nLat = m_bbox.getMaxLat();
double eLng = m_bbox.getMaxLon();
// adjust bbox params to fix bug with disappearing lines
if (wLng < 12 && eLng > 335) {
wLng = -180;
eLng = 180;
}
double x1 = (Math.floor((wLng / 6) + 1) * 6.0);
double y1;
if (sLat < -80) { // far southern zone; limit of UTM definition
y1 = -80;
} else {
y1 = (Math.floor((sLat / 8) + 1) * 8.0);
}
ArrayList<Double> lat_coords = new ArrayList<Double>();
ArrayList<Double> lng_coords = new ArrayList<Double>();
// compute the latitude coordinates that belong to this viewport
if (sLat < -80) {
lat_coords.add(0, -80.0); // special case of southern limit
} else {
sLat = Math.floor(sLat / 8) * 8; // round to nearest multiple of 8
lat_coords.add(0, sLat); // normal case
}
int j;
double lat, lng;
if (nLat > 80) {
nLat = 80;
}
for (lat = y1, j = 1; lat < nLat; lat += 8, j++) {
if (lat <= 72) {
lat_coords.add(j, lat);
} else if (lat <= 80) {
lat_coords.add(j, 84.0);
} else {
j--;
}
}
nLat = Math.ceil(nLat / 8) * 8;
lat_coords.add(j, nLat);
// compute the longitude coordinates that belong to this viewport
wLng = Math.floor(wLng / 6) * 6; // round to nearest multiple of 6
lng_coords.add(0, wLng);
if (wLng < eLng) { // normal case
for (lng = x1, j = 1; lng < eLng; lng += 6, j++) {
lng_coords.add(j, lng);
}
} else { // special case of window that includes the international dateline
for (lng = x1, j = 1; lng <= 180; lng += 6, j++) {
lng_coords.add(j, lng);
}
for (lng = -180; lng < eLng; lng += 6, j++) {
lng_coords.add(j, lng);
}
}
eLng = Math.ceil(eLng / 6) * 6;
lng_coords.add(j++, eLng);
// store corners and center point for each geographic rectangle in the viewport
// each rectangle may be a full UTM cell, but more commonly will have one or more
// edges bounded by the extent of the viewport
// these geographic rectangles are stored in instances of the class 'usng_georectangle'
for (int i = 0; i < lat_coords.size() - 1; i++) {
for (j = 0; j < lng_coords.size() - 1; j++) {
double latA = lat_coords.get(i);
double latB = lat_coords.get(i + 1);
double lngA = lng_coords.get(j);
double lngB = lng_coords.get(j + 1);
// Leave out 3 lines near Svalbard. Still unknown as to why this is done
// if (latA >= 72 && lngA == 6) {
// continue;
// }
// if (latA >= 72 && lngA == 18) {
// continue;
// }
// if (latA >= 72 && lngA == 30) {
// continue;
// }
Point sw = new Point(latA, lngA);
Point se = new Point(latA, lngB);
Point ne = new Point(latB, lngB);
Point nw = new Point(latB, lngA);
gridCell = new GridCell(sw, se, ne, nw);
/* Zone markers */
if (latA != latB) {
// adjust labels for special norway case
if (latA == 56 && lngA == 6) {
lngA = 3;
} else if (latA == 56 && lngA == 0) {
lngB = 3;
}
double centerLat = (latA + latB) / 2;
double centerLng = (lngA + lngB) / 2;
Point center = new Point(centerLat, centerLng);
String name = getGridLabelFromPoint(center);
if (name != null) {
gridCell.setLabel(center, name.substring(0, 3));
}
}
gridCells.add(gridCell);
if (gridCell.isFullSized()) {
ZONE_CELLS.add(gridCell);
}
}
}
Grid grid = new Grid(gridCells);
ArrayList<Line> lines = handleSpecialCases(lat_coords, lng_coords);
grid.getLngLines().addAll(lines);
return grid;
}
private Grid makeHundredKmGrid() {
ArrayList<Line> latLines = new ArrayList<Line>();
ArrayList<Line> lngLines = new ArrayList<Line>();
// Loop over each zone
for (GridCell zoneCell : ZONE_CELLS) {
double sLat = zoneCell.m_sw.getLat();
double wLng = zoneCell.m_sw.getLng();
double nLat = zoneCell.m_ne.getLat();
double eLng = zoneCell.m_ne.getLng();
// Four zone corners
String mgrsSW = mgrsHelper.geoToMgrs(sLat, wLng, MgrsHelper.MAX_PRECISION);
String mgrsSE = mgrsHelper.geoToMgrs(sLat, eLng, MgrsHelper.MAX_PRECISION);
String mgrsNW = mgrsHelper.geoToMgrs(nLat, wLng, MgrsHelper.MAX_PRECISION);
String mgrsNE = mgrsHelper.geoToMgrs(nLat, eLng, MgrsHelper.MAX_PRECISION);
if (mgrsSW == null || mgrsSE == null || mgrsNW == null || mgrsNE == null) {
continue;
}
// construct latitude lines
String mgrsStart = mgrsSW;
String mgrsEnd = mgrsSE;
char gridRow = mgrsSW.charAt(2);
boolean flag = true;
while (mgrsHelper.isValid(mgrsStart)) {
// advance 100km north to get next start point
mgrsHelper.setMgrs(mgrsStart);
mgrsHelper.setGridSquareRow(mgrsHelper.getNextGridSquareRow());
mgrsHelper.setNorthing(0);
mgrsStart = mgrsHelper.toString();
// advance 100km north to get next end point
mgrsHelper.setMgrs(mgrsEnd);
mgrsHelper.setGridSquareRow(mgrsHelper.getNextGridSquareRow());
mgrsHelper.setNorthing(0);
mgrsEnd = mgrsHelper.toString();
if (!mgrsHelper.isValid(mgrsStart) || !mgrsHelper.isValid(mgrsEnd)) {
break;
}
// This adjustment to mgrsStart moves the starting point within
// the current zone boundaries
if (mgrsStart == null) {
break;
}
mgrsHelper.setMgrs(mgrsStart);
Geodetic geo = mgrsHelper.mgrsToGeo(mgrsHelper.toString());
double lat;
if (geo == null) {
break;
}
lat = geo.getLatitude();
String easting = mgrsHelper.geoToMgrs(lat, wLng, MgrsHelper.MAX_PRECISION);
if (easting == null) {
break;
}
easting = easting.substring(5, 10);
mgrsHelper.setEasting(Integer.parseInt(easting));
geo = mgrsHelper.mgrsToGeo(mgrsHelper.toString());
if (geo == null) {
break;
}
if ((gridRow == 'J' || gridRow == 'F') && Integer.parseInt(easting) > 90000 && flag) {
mgrsHelper.setGridSquareColumn(mgrsHelper.getPreviousGridSquareColumn());
} else if ((gridRow == 'R' && geo.getLatitude() > 26 && flag)
|| (gridRow == 'U' && geo.getLatitude() > 54 && flag)) {
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
}
mgrsStart = mgrsHelper.toString();
// This adjustment to mgrsEnd moves the ending point within
// the current zone boundaries
if (mgrsEnd == null) {
break;
}
mgrsHelper.setMgrs(mgrsEnd);
geo = mgrsHelper.mgrsToGeo(mgrsHelper.toString());
if (geo != null) {
lat = geo.getLatitude();
} else {
continue;
}
easting = mgrsHelper.geoToMgrs(lat, eLng, MgrsHelper.MAX_PRECISION);
if (easting != null) {
easting = easting.substring(5, 10);
} else {
continue;
}
mgrsHelper.setEasting(Integer.parseInt(easting));
geo = mgrsHelper.mgrsToGeo(mgrsHelper.toString());
if (geo == null) {
continue;
}
if ((gridRow == 'J' || gridRow == 'F') && Integer.parseInt(easting) > 90000 && flag) {
flag = false;
mgrsHelper.setGridSquareColumn(mgrsHelper.getPreviousGridSquareColumn());
} else if ((gridRow == 'R' && geo.getLatitude() > 26 && flag)
|| (gridRow == 'U' && geo.getLatitude() > 54 && flag)) {
flag = false;
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
}
mgrsEnd = mgrsHelper.toString();
// break lines up for each cell
mgrsHelper.setMgrs(mgrsStart);
while (true) {
String start = mgrsHelper.toString();
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
mgrsHelper.setEasting(0);
String end = mgrsHelper.toString();
geo = mgrsHelper.mgrsToGeo(end);
double endLng = Double.MIN_NORMAL;
if (geo != null) {
endLng = geo.getLongitude();
}
if (!mgrsHelper.isValid(end) || endLng > eLng) {
geo = mgrsHelper.mgrsToGeo(mgrsStart);
if (geo == null) {
break;
}
end = mgrsHelper.geoToMgrs(geo.getLatitude(), eLng, MgrsHelper.MAX_PRECISION);
if (end == null) {
break;
}
Line line = new Line(start, end);
Point label = line.calculateLabelPoint();
String name = getGridLabelFromPoint(label);
if (name != null) {
line.setLabel(label, name.substring(3, 5));
}
latLines.add(line);
break;
}
Line line = new Line(start, end);
Point label = line.calculateLabelPoint();
String name = getGridLabelFromPoint(label);
if (name != null) {
line.setLabel(label, name.substring(3, 5));
}
latLines.add(line);
}
}
// construct longitude lines
mgrsStart = mgrsSW;
mgrsEnd = mgrsNW;
flag = true;
boolean xFlag = true;
while (true) {
boolean flag2 = true;
String temp = mgrsStart;
mgrsHelper.setMgrs(mgrsStart);
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
mgrsHelper.setEasting(0);
mgrsStart = mgrsHelper.toString();
if (!xFlag) {
break;
}
// necessary hack for lines below the equator
if (gridRow <= 'M' && gridRow != 'C') {
if (gridRow == 'J') {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() - 2));
} else {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() - 1));
}
mgrsStart = mgrsHelper.toString();
}
if (!mgrsHelper.isValid(mgrsStart)) {
break;
}
if ((gridRow == 'R' || gridRow == 'U' || gridRow == 'X') && flag) {
flag = false;
// construct left-corner line
Line line = constructMergeLineN(mgrsStart, gridRow, wLng, eLng, true);
lngLines.add(line);
continue;
}
mgrsHelper.setMgrs(mgrsEnd);
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
mgrsHelper.setEasting(0);
mgrsEnd = mgrsHelper.toString();
// necessary hack for lines below the equator
if (gridRow <= 'M') {
if (mgrsEnd.charAt(2) == 'J') {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() - 2));
} else {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() - 1));
}
mgrsEnd = mgrsHelper.toString();
}
if (!mgrsHelper.isValid(mgrsEnd)) {
break;
}
if ((gridRow == 'J' || gridRow == 'F' || gridRow == 'C') && flag) {
flag = false;
flag2 = false;
Line line = constructMergeLineSLeft(mgrsEnd, gridRow, wLng);
lngLines.add(line);
mgrsStart = temp;
} else if (xFlag) {
Line line = new Line(mgrsStart, mgrsEnd);
lngLines.add(line);
}
if (gridRow == 'X') {
xFlag = false;
}
//reset start/end for lines below equator
if (gridRow <= 'M') {
if (flag2) {
mgrsHelper.setMgrs(mgrsStart);
if (mgrsStart.charAt(2) == 'H') {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() + 2));
} else {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() + 1));
}
mgrsStart = mgrsHelper.toString();
}
mgrsHelper.setMgrs(mgrsEnd);
if (mgrsEnd.charAt(2) == 'H') {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() + 2));
} else {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() + 1));
}
mgrsEnd = mgrsHelper.toString();
}
}
//construct right-corner line
if (gridRow == 'R' || gridRow == 'U' || gridRow == 'X') {
Line line = constructMergeLineN(mgrsStart, gridRow, wLng, eLng, false);
lngLines.add(line);
} else if (gridRow == 'J' || gridRow == 'F' || gridRow == 'C') {
Line line = constructMergeLineSRight(mgrsEnd, gridRow, eLng);
lngLines.add(line);
}
}
return new Grid(latLines, lngLines);
}
private Grid makeTenKmGrid() {
ArrayList<Line> latLines = new ArrayList<Line>();
ArrayList<Line> lngLines = new ArrayList<Line>();
for (GridCell zoneCell : ZONE_CELLS) {
double sLat = zoneCell.m_sw.getLat();
double wLng = zoneCell.m_sw.getLng();
double nLat = zoneCell.m_ne.getLat();
double eLng = zoneCell.m_ne.getLng();
String mgrsSW = mgrsHelper.geoToMgrs(sLat, wLng, MgrsHelper.MAX_PRECISION);
String mgrsSE = mgrsHelper.geoToMgrs(sLat, eLng, MgrsHelper.MAX_PRECISION);
String mgrsNW = mgrsHelper.geoToMgrs(nLat, wLng, MgrsHelper.MAX_PRECISION);
String mgrsNE = mgrsHelper.geoToMgrs(nLat, eLng, MgrsHelper.MAX_PRECISION);
if (mgrsSW == null || mgrsSE == null || mgrsNW == null || mgrsNE == null) {
continue;
}
// construct latitude lines
String mgrsStart = mgrsSW;
String mgrsEnd = mgrsSE;
char gridRow = mgrsSW.charAt(2);
boolean f = true;
while (mgrsHelper.isValid(mgrsStart)) {
mgrsHelper.setMgrs(mgrsStart);
int northing = mgrsHelper.getNorthing();
if (northing % 10000 == 0) {
if (northing < 90000) {
northing += 10000;
} else {
northing = 0;
mgrsHelper.setGridSquareRow(mgrsHelper.getNextGridSquareRow());
}
} else {
if (northing < 90000) {
northing = ((int) Math.ceil(northing / 10000.0)) * 10000; // round up to next 10km interval
}
}
mgrsHelper.setNorthing(northing);
mgrsStart = mgrsHelper.toString();
mgrsHelper.setMgrs(mgrsEnd);
northing = mgrsHelper.getNorthing();
if (northing % 10000 == 0) {
if (northing < 90000) {
northing += 10000;
} else {
northing = 0;
mgrsHelper.setGridSquareRow(mgrsHelper.getNextGridSquareRow());
}
} else {
if (northing < 90000) {
northing = ((int) Math.ceil(northing / 10000.0)) * 10000; // round up to next 10km interval
}
}
mgrsHelper.setNorthing(northing);
mgrsEnd = mgrsHelper.toString();
if (!mgrsHelper.isValid(mgrsStart) || !mgrsHelper.isValid(mgrsEnd)) {
break;
}
// This adjustment to mgrsStart moves the starting point within
// the current zone boundaries
mgrsHelper.setMgrs(mgrsStart);
double lat = mgrsHelper.mgrsToGeo(mgrsHelper.toString()).getLatitude();
String easting = mgrsHelper.geoToMgrs(lat, wLng, MgrsHelper.MAX_PRECISION).substring(5, 10);
if (gridRow == 'J' && Integer.parseInt(easting) > 90000 && f) {
mgrsHelper.setGridSquareColumn(mgrsHelper.getPreviousGridSquareColumn());
}
mgrsHelper.setEasting(Integer.parseInt(easting));
mgrsStart = mgrsHelper.toString();
// This adjustment to mgrsEnd moves the ending point within
// the current zone boundaries
mgrsHelper.setMgrs(mgrsEnd);
lat = mgrsHelper.mgrsToGeo(mgrsHelper.toString()).getLatitude();
easting = mgrsHelper.geoToMgrs(lat, eLng, MgrsHelper.MAX_PRECISION).substring(5, 10);
if (gridRow == 'J' && Integer.parseInt(easting) > 90000 && f) {
mgrsHelper.setGridSquareColumn(mgrsHelper.getPreviousGridSquareColumn());
}
mgrsHelper.setEasting(Integer.parseInt(easting));
mgrsEnd = mgrsHelper.toString();
Line line = new Line(mgrsStart, mgrsEnd);
latLines.add(line);
}
// construct longitude lines
mgrsStart = mgrsSW;
mgrsEnd = mgrsNW;
boolean flag = true;
while (true) {
boolean flag2 = true;
mgrsHelper.setMgrs(mgrsStart);
int easting = mgrsHelper.getEasting();
if (easting % 10000 == 0) {
if (easting < 90000) {
easting += 10000;
} else {
easting = 0;
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
}
} else {
if (easting < 90000) {
easting = ((int) Math.ceil(easting / 10000.0)) * 10000; // round up to next 10km interval
} else {
easting = 0;
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
}
}
mgrsHelper.setEasting(easting);
mgrsStart = mgrsHelper.toString();
// hack for lines below equator
if (gridRow <= 'M' && gridRow != 'C') {
if (gridRow == 'J') {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() - 2));
} else {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() - 1));
}
mgrsStart = mgrsHelper.toString();
}
if (!mgrsHelper.isValid(mgrsStart)) {
break;
}
mgrsHelper.setMgrs(mgrsEnd);
easting = mgrsHelper.getEasting();
if (easting % 10000 == 0) {
if (easting < 90000) {
easting += 10000;
} else {
easting = 0;
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
}
} else {
if (easting < 90000) {
easting = ((int) Math.ceil(easting / 10000.0)) * 10000; // round up to next 10km interval
} else {
easting = 0;
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
}
}
mgrsHelper.setEasting(easting);
mgrsEnd = mgrsHelper.toString();
// necessary hack for lines below the equator
if (gridRow <= 'M') {
if (mgrsEnd.charAt(2) == 'J') {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() - 2));
} else {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() - 1));
}
mgrsEnd = mgrsHelper.toString();
}
if (!mgrsHelper.isValid(mgrsEnd)) {
break;
}
Line line = new Line(mgrsStart, mgrsEnd, null, null);
lngLines.add(line);
//reset start/end for lines below equator
if (gridRow <= 'M') {
if (flag2) {
mgrsHelper.setMgrs(mgrsStart);
if (mgrsStart.charAt(2) == 'H') {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() + 2));
} else {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() + 1));
}
mgrsStart = mgrsHelper.toString();
}
mgrsHelper.setMgrs(mgrsEnd);
if (mgrsEnd.charAt(2) == 'H') {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() + 2));
} else {
mgrsHelper.setGridRow((char) (mgrsHelper.getGridRow() + 1));
}
mgrsEnd = mgrsHelper.toString();
}
}
}
return new Grid(latLines, lngLines);
}
private Line constructMergeLineN(String mgrsStart, char gridRow, double wLng, double eLng, boolean left) {
double lat;
switch (gridRow) {
case 'X':
lat = 72.6;
break;
case 'U':
lat = 53.25;
break;
case 'R':
lat = 26.2;
break;
default:
lat = 0;
}
Geodetic geo = mgrsHelper.mgrsToGeo(mgrsStart);
if (geo == null) {
return new Line();
}
Point start = new Point(geo.getLatitude(), geo.getLongitude());
double lng = (left) ? wLng : eLng;
Point end = new Point(lat, lng);
return new Line(start, end);
}
private Line constructMergeLineSLeft(String mgrsStart, char gridRow, double wLng) {
double lat;
switch (gridRow) {
case 'J':
lat = -26.2;
break;
case 'F':
lat = -53.25;
break;
case 'C':
lat = -72.6;
break;
default:
lat = 0;
}
Geodetic geo = mgrsHelper.mgrsToGeo(mgrsStart);
if (geo == null) {
return new Line();
}
Point start = new Point(geo.getLatitude(), geo.getLongitude());
Point end = new Point(lat, wLng);
return new Line(start, end);
}
private Line constructMergeLineSRight(String mgrsStart, char gridRow, double eLng) {
mgrsHelper.setMgrs(mgrsStart);
mgrsHelper.setGridRow(mgrsHelper.getPreviousGridRow());
mgrsHelper.setGridSquareColumn(mgrsHelper.getNextGridSquareColumn());
mgrsStart = mgrsHelper.toString();
double lat;
switch (gridRow) {
case 'J':
lat = -26.2;
break;
case 'F':
lat = -53.25;
break;
case 'C':
lat = -72.6;
break;
default:
lat = 0;
}
Geodetic geo = mgrsHelper.mgrsToGeo(mgrsStart);
if (geo == null) {
return new Line();
}
Point start = new Point(geo.getLatitude(), geo.getLongitude());
Point end = new Point(lat, eLng);
return new Line(start, end);
}
private String getGridLabelFromPoint(Point center) {
String result = mgrsHelper.geoToMgrs(center.getLat(), center.getLng(), MgrsHelper.MAX_PRECISION);
return result;
}
private ArrayList<Line> handleSpecialCases(ArrayList<Double> latcoords, ArrayList<Double> lngcoords) {
ArrayList<Point> points1 = new ArrayList<Point>();
ArrayList<Point> points2 = new ArrayList<Point>();
ArrayList<Point> points3 = new ArrayList<Point>();
ArrayList<Point> points4 = new ArrayList<Point>();
ArrayList<Point> points5 = new ArrayList<Point>();
ArrayList<Point> points6 = new ArrayList<Point>();
ArrayList<Point> points7 = new ArrayList<Point>();
for (int i = 1; i < lngcoords.size(); i++) {
// deal with norway special case
if (lngcoords.get(i) == 6) {
for (int j = 0; j < latcoords.size(); j++) {
if (latcoords.get(j) == 56) {
points1.add(new Point(latcoords.get(j), lngcoords.get(i)));
points1.add(new Point(latcoords.get(j), lngcoords.get(i) - 3));
} else if (latcoords.get(j) < 56 || latcoords.get(j) > 64 && latcoords.get(j) < 72) {
points1.add(new Point(latcoords.get(j), lngcoords.get(i)));
} else if (latcoords.get(j) > 56 && latcoords.get(j) < 64) {
points1.add(new Point(latcoords.get(j), lngcoords.get(i) - 3));
} else if (latcoords.get(j) == 64) {
points1.add(new Point(latcoords.get(j), lngcoords.get(i) - 3));
points1.add(new Point(latcoords.get(j), lngcoords.get(i)));
} // Svalbard special case
else if (latcoords.get(j) == 72) {
points2.add(new Point(latcoords.get(j), lngcoords.get(i)));
points2.add(new Point(latcoords.get(j), lngcoords.get(i) + 3));
} else if (latcoords.get(j) < 72) {
points2.add(new Point(latcoords.get(j), lngcoords.get(i)));
} else if (latcoords.get(j) > 72) {
points2.add(new Point(latcoords.get(j), lngcoords.get(i) + 3));
} else {
points2.add(new Point(latcoords.get(j), lngcoords.get(i) - 3));
}
}
} // additional Svalbard cases
else if (lngcoords.get(i) == 12) {
for (int j = 0; j < latcoords.size(); j++) {
if (latcoords.get(j) == 72) {
points3.add(new Point(latcoords.get(j), lngcoords.get(i)));
} else if (latcoords.get(j) < 72) {
points3.add(new Point(latcoords.get(j), lngcoords.get(i)));
}
}
} else if (lngcoords.get(i) == 18) {
for (int j = 0; j < latcoords.size(); j++) {
if (latcoords.get(j) == 72) {
points4.add(new Point(latcoords.get(j), lngcoords.get(i)));
} else if (latcoords.get(j) < 72) {
points4.add(new Point(latcoords.get(j), lngcoords.get(i)));
}
}
} else if (lngcoords.get(i) == 24) {
for (int j = 0; j < latcoords.size(); j++) {
if (latcoords.get(j) == 72) {
points5.add(new Point(latcoords.get(j), lngcoords.get(i)));
points5.add(new Point(latcoords.get(j), lngcoords.get(i) - 3));
} else if (latcoords.get(j) < 72) {
points5.add(new Point(latcoords.get(j), lngcoords.get(i)));
} else if (latcoords.get(j) > 72) {
points5.add(new Point(latcoords.get(j), lngcoords.get(i) - 3));
}
}
} else if (lngcoords.get(i) == 30) {
for (int j = 0; j < latcoords.size(); j++) {
if (latcoords.get(j) == 72) {
points6.add(new Point(latcoords.get(j), lngcoords.get(i)));
points6.add(new Point(latcoords.get(j), lngcoords.get(i) + 3));
} else if (latcoords.get(j) < 72) {
points6.add(new Point(latcoords.get(j), lngcoords.get(i)));
} else if (latcoords.get(j) > 72) {
points6.add(new Point(latcoords.get(j), lngcoords.get(i) + 3));
}
}
} else if (lngcoords.get(i) == 36) {
for (int j = 0; j < latcoords.size(); j++) {
if (latcoords.get(j) == 72) {
points7.add(new Point(latcoords.get(j), lngcoords.get(i)));
} else if (latcoords.get(j) < 72) {
points7.add(new Point(latcoords.get(j), lngcoords.get(i)));
}
}
}
}
ArrayList<Line> lines = new ArrayList<Line>();
for (int i = 0; i < points1.size() - 1; i++) {
Line line = new Line(points1.get(i), points1.get(i + 1));
lines.add(line);
}
for (int i = 0; i < points2.size() - 1; i++) {
Line line = new Line(points2.get(i), points2.get(i + 1));
lines.add(line);
}
for (int i = 0; i < points3.size() - 1; i++) {
Line line = new Line(points3.get(i), points3.get(i + 1));
lines.add(line);
}
for (int i = 0; i < points4.size() - 1; i++) {
Line line = new Line(points4.get(i), points4.get(i + 1));
lines.add(line);
}
for (int i = 0; i < points5.size() - 1; i++) {
Line line = new Line(points5.get(i), points5.get(i + 1));
lines.add(line);
}
for (int i = 0; i < points6.size() - 1; i++) {
Line line = new Line(points6.get(i), points6.get(i + 1));
lines.add(line);
}
for (int i = 0; i < points7.size() - 1; i++) {
Line line = new Line(points7.get(i), points7.get(i + 1));
lines.add(line);
}
return lines;
}
public boolean skipNorwayLines(Line lngLine) {
double startLat = lngLine.getStart().getLat();
double startLng = lngLine.getStart().getLng();
double endLat = lngLine.getEnd().getLat();
double endLng = lngLine.getEnd().getLng();
boolean skipNorway = ((startLat == 56 && startLng == 6) && (endLat == 64 && endLng == 6)
|| (startLat == 64 && startLng == 6) && (endLat == 56 && endLng == 6)
|| (startLat > 56 && startLat < 64) && startLng == 6
|| (endLat > 56 && endLat < 64) && endLng == 6);
boolean skipSvalbard = ((startLat == 72 && startLng == 6) && (endLat == 84 && endLng == 6)
|| (startLat == 84 && startLng == 6) && (endLat == 72 && endLng == 6)
|| (startLat > 72 && startLat < 84) && startLng == 6
|| (endLat > 72 && endLat < 84) && endLng == 6);
boolean skipSvalbard2 = ((startLat == 72 && startLng == 12) && (endLat == 84 && endLng == 12)
|| (startLat == 84 && startLng == 12) && (endLat == 72 && endLng == 12)
|| (startLat > 72 && startLat < 84) && startLng == 12
|| (endLat > 72 && endLat < 84) && endLng == 12);
boolean skipSvalbard3 = ((startLat == 72 && startLng == 18) && (endLat == 84 && endLng == 18)
|| (startLat == 84 && startLng == 18) && (endLat == 72 && endLng == 18)
|| (startLat > 72 && startLat < 84) && startLng == 18
|| (endLat > 72 && endLat < 84) && endLng == 18);
boolean skipSvalbard4 = ((startLat == 72 && startLng == 24) && (endLat == 84 && endLng == 24)
|| (startLat == 84 && startLng == 24) && (endLat == 72 && endLng == 24)
|| (startLat > 72 && startLat < 84) && startLng == 24
|| (endLat > 72 && endLat < 84) && endLng == 24);
boolean skipSvalbard5 = ((startLat == 72 && startLng == 30) && (endLat == 84 && endLng == 30)
|| (startLat == 84 && startLng == 30) && (endLat == 72 && endLng == 30)
|| (startLat > 72 && startLat < 84) && startLng == 30
|| (endLat > 72 && endLat < 84) && endLng == 30);
boolean skipSvalbard6 = ((startLat == 72 && startLng == 36) && (endLat == 84 && endLng == 36)
|| (startLat == 84 && startLng == 36) && (endLat == 72 && endLng == 36)
|| (startLat > 72 && startLat < 84) && startLng == 36
|| (endLat > 72 && endLat < 84) && endLng == 36);
return skipNorway || skipSvalbard || skipSvalbard2 || skipSvalbard3 || skipSvalbard4 || skipSvalbard5 || skipSvalbard6;
}
private void maybeWriteToDisk(Document doc) {
if (UPDATE_XML_ON_DISK) {
try {
LOGGER.log(Level.INFO, "Writing grid xml to disk");
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Transformer tf = TransformerFactory.newInstance().newTransformer();
tf.setOutputProperty(OutputKeys.INDENT, "yes");
tf.transform(new DOMSource(doc), new StreamResult(bos));
byte[] gridxmlbytes = bos.toByteArray();
updateXmlOnDisk(gridxmlbytes, "grid.xml");
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, "failed", ex);
} catch (TransformerException ex) {
LOGGER.log(Level.SEVERE, "failed", ex);
}
}
}
private void updateXmlOnDisk(byte[] xmlbytes, String filename) throws IOException {
FileOutputStream fos = null;
try {
File dir = MGRS_XML_PATH_PROVIDER.get();
dir.mkdirs();
File file = new File(dir, filename);
fos = new FileOutputStream(file);
fos.write(xmlbytes);
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, "Failed to update xml on disk", ex);
} finally {
fos.close();
}
}
public void setBoundingBox( BoundingBox bbox ){
MgrsXmlResource.m_bbox = bbox;
}
public BoundingBox calculateBoundingBox(MultivaluedMap<String, String> map) {
String bboxString = stripBrackets(map.get(BBOX_QUERY_PARAMETER_NAME).toString());
try {
MgrsXmlResource.m_bbox = BoundingBox.valueOf(bboxString);
return MgrsXmlResource.m_bbox;
} catch (Exception ex) {
LOGGER.log(Level.SEVERE, "Failed to get value of bounding box", ex);
}
return new BoundingBox();
}
private DocumentBuilder makeDocBuilder() throws ParserConfigurationException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// NOTE: By stripping the namespace we handle both old documents
// without ns and new documents with ns, as long as the new
// documents just use the default ns.
factory.setNamespaceAware(false);
return factory.newDocumentBuilder();
}
private String stripBrackets(String str) {
return str.replaceAll("\\[|\\]", "");
}
}
| [
"[email protected]@afb9890d-5ef5-9d65-7322-0cae69767e52"
]
| [email protected]@afb9890d-5ef5-9d65-7322-0cae69767e52 |
c475a4033dd9ea7d938d9fd86206b13328275022 | 9c610d3e4f5d9087bbad006c57cd88c656e94b5f | /WebViewX5/app/src/main/java/com/example/qd/webviewx5/MainActivity.java | e1178f8a076f0a951fde28298e63c83448dae739 | [
"MIT"
]
| permissive | wuqingsen/X5WebView | a5f3781bff305d7140f67671b60cd7c77c02337e | 2bd5d81d2410bce74c23b2ab761bccb812455bad | refs/heads/master | 2020-04-22T15:00:51.330176 | 2019-02-13T08:08:12 | 2019-02-13T08:08:12 | 170,463,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,283 | java | package com.example.qd.webviewx5;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ProgressBar;
import com.tencent.smtt.export.external.interfaces.WebResourceError;
import com.tencent.smtt.export.external.interfaces.WebResourceRequest;
import com.tencent.smtt.sdk.WebChromeClient;
import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient;
public class MainActivity extends AppCompatActivity {
private X5WebView mX5WebView;
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mX5WebView = findViewById(R.id.x5WebView);
progressBar = findViewById(R.id.progressBar);
mX5WebView.loadUrl("https://blog.csdn.net/wuqingsen1");
initX5WebView();
setProgressBar();
setClick();
}
/**
* 启用硬件加速
*/
private void initX5WebView() {
try {
if (Integer.parseInt(android.os.Build.VERSION.SDK) >= 11) {
getWindow()
.setFlags(
android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
android.view.WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
}
} catch (Exception e) {
}
}
/**
* 设置进度条
*/
private void setProgressBar() {
mX5WebView.setWebChromeClient(new WebChromeClient(){
@Override
public void onProgressChanged(WebView view, int newProgress) {
//显示进度条
if (newProgress < 100) {
progressBar.setProgress(newProgress);
progressBar.setVisibility(View.VISIBLE);
}else {
progressBar.setVisibility(View.GONE);
}
}
});
}
/**
* 点击事件
*/
private void setClick() {
mX5WebView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
return super.shouldOverrideUrlLoading(view, request);
//点击事件
}
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
super.onReceivedError(view, request, error);
//加载错误
}
});
}
/**
* 返回键监听
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mX5WebView != null && mX5WebView.canGoBack()) {
mX5WebView.goBack();
return true;
} else {
return super.onKeyDown(keyCode, event);
}
}
return super.onKeyDown(keyCode, event);
}
@Override
protected void onDestroy() {
//释放资源
if (mX5WebView != null)
mX5WebView.destroy();
super.onDestroy();
}
}
| [
"[email protected]"
]
| |
bf1ebe735865310c7741136709ea096eac506da4 | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/transform/CreateSmsTemplateResultJsonUnmarshaller.java | b86e93dd2c7c7b1382dd4b2feea3cb81a13fa40e | [
"Apache-2.0"
]
| permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 2,350 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.pinpoint.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.pinpoint.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* CreateSmsTemplateResult JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateSmsTemplateResultJsonUnmarshaller implements Unmarshaller<CreateSmsTemplateResult, JsonUnmarshallerContext> {
public CreateSmsTemplateResult unmarshall(JsonUnmarshallerContext context) throws Exception {
CreateSmsTemplateResult createSmsTemplateResult = new CreateSmsTemplateResult();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return createSmsTemplateResult;
}
while (true) {
if (token == null)
break;
createSmsTemplateResult.setCreateTemplateMessageBody(CreateTemplateMessageBodyJsonUnmarshaller.getInstance().unmarshall(context));
token = context.nextToken();
}
return createSmsTemplateResult;
}
private static CreateSmsTemplateResultJsonUnmarshaller instance;
public static CreateSmsTemplateResultJsonUnmarshaller getInstance() {
if (instance == null)
instance = new CreateSmsTemplateResultJsonUnmarshaller();
return instance;
}
}
| [
""
]
| |
a47a9a5e762c6cf902ec7d28863886c99c85d296 | cac7a4cc063e5b9e07fb16865cfc01860cebd464 | /src/main/java/com/dynamic/ui/configuration/SqlConfiguration.java | 04e12da8a7c5860a46df9a26e67cdb10f73dc637 | []
| no_license | aviral-92/Admin-Service | 1e9fc0808afb36a3a94c53d1c3084df127108aea | 559af602e8b7571b17cf5ca3530cb42dfdd3d036 | refs/heads/master | 2021-01-17T14:37:37.985822 | 2017-03-06T16:30:19 | 2017-03-06T16:30:19 | 84,094,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | package com.dynamic.ui.configuration;
import java.sql.SQLException;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
@Configuration
public class SqlConfiguration {
@Value("${db.mysql.driver}")
private String dbDriver;
@Value("${db.mysql.url}")
private String dbURL;
@Value("${db.mysql.username}")
private String dbUsername;
@Value("${db.mysql.password}")
private String dbPassword;
@Bean
public DataSource getDataSource() throws SQLException {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(dbDriver);
dataSource.setUrl(dbURL);
dataSource.setUsername(dbUsername);
dataSource.setPassword(dbPassword);
return dataSource;
}
@Bean(name = "jdbcTemplate")
public JdbcTemplate getJdbcTemplate() throws SQLException {
DataSource dataSource = getDataSource();
System.out.println("conn===" + dataSource.getConnection());
return new JdbcTemplate(getDataSource());
}
}
| [
"[email protected]"
]
| |
7f47fa6dc3477f0bda8c7d9f9e093b901698037a | eb97ee5d4f19d7bf028ae9a400642a8c644f8fe3 | /tags/2008-02-22/seasar2-2.4.23/seasar-benchmark/src/main/java/benchmark/many/b08/NullBean08194.java | 8aa61b7e2695bb98c7db93fafcf87aee07339e9c | []
| no_license | svn2github/s2container | 54ca27cf0c1200a93e1cb88884eb8226a9be677d | 625adc6c4e1396654a7297d00ec206c077a78696 | refs/heads/master | 2020-06-04T17:15:02.140847 | 2013-08-09T09:38:15 | 2013-08-09T09:38:15 | 10,850,644 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 62 | java | package benchmark.many.b08;
public class NullBean08194 {
}
| [
"koichik@319488c0-e101-0410-93bc-b5e51f62721a"
]
| koichik@319488c0-e101-0410-93bc-b5e51f62721a |
487402a6affe33933487189cf82963fb9b3bc3f8 | 6d54eab6217dc861e7a20aecefc16112524b71af | /HealthFirst/src/test/java/healthFirst/HoverMouse.java | 354bf3d919d47095448b434cd156f1bc555dedb6 | []
| no_license | kibria07/SeleniumFrameworkSauce | 8125ddc2c4d9817d470517ddd1c29dea4650bc7b | c92e991628b399e1bcdc0a0ae40f3ef54e910d80 | refs/heads/master | 2021-01-18T21:04:33.454737 | 2015-01-22T05:03:01 | 2015-01-22T05:03:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,181 | java | package healthFirst;
import Testing.CommoneApi;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
import org.testng.annotations.Test;
import java.util.List;
public class HoverMouse extends CommoneApi {
@Test
public void test()throws Exception{
WebElement element = getWebElement1(".//*[@id='topnav']/ul/li[1]/h2/a");
Actions actions = new Actions(driver);
actions.moveToElement(element).perform();
List<WebElement> list = getListOfWebElement1(".//*[@id='topnav']/ul/li[1]/div/div[1]/ul[1]/li");
for (int i =0; i<list.size(); i++){
if (i<list.size()){
list.get(i).findElement(By.tagName("a")).click();
sleep(5);
}
navigateBack();
list = getListOfWebElement1(".//*[@id='topnav']/ul/li[1]/div/div[1]/ul[1]/li");
WebElement element1 = getWebElement1(".//*[@id='topnav']/ul/li[1]/h2/a");
Actions actions1 = new Actions(driver);
actions1.moveToElement(element1).perform();
}
}
}
| [
"[email protected]"
]
| |
28f6ad763d1f9c2070e37b4a6b49b63780f634a1 | 0664667fb5dd8d9d23eb257c18b361dc050092a1 | /src/main/java/com/hfy/utils/DateJsonValueProcessor.java | af3fae2be98e2694c1a943f0bc226c8fee77f677 | []
| no_license | yan253319066/yanning | 4bf17bb5e000d972cd0041c8f37ddc80321c074d | e25ee85f02571271fdf8c923d7df2cea85fca87f | refs/heads/master | 2021-04-09T16:16:22.670964 | 2018-03-18T05:57:05 | 2018-03-18T05:57:05 | 125,618,593 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,575 | java | package com.hfy.utils;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import net.sf.json.JsonConfig;
import net.sf.json.processors.JsonValueProcessor;
/**
* net.sf.json
* JSON日期转换
******************************************************************************
* 本程序为深圳浩丰源有限公司开发研制。未经本公司正式书面同意,其他任何个人和团体均不得做任何用途
* 复制、修改或发布本软件.
* Copyright (C) 2016 ShenZhen HFY Co.,Ltd
* All Rights Reserved.
*****************************************************************************
* @author yanning
* @date 2016年10月15日 下午5:43:24
* @version 1.0
*
*/
public class DateJsonValueProcessor implements JsonValueProcessor {
/**
* 字母 日期或时间元素 表示 示例 <br>
* G Era 标志符 Text AD <br>
* y 年 Year 1996; 96 <br>
* M 年中的月份 Month July; Jul; 07 <br>
* w 年中的周数 Number 27 <br>
* W 月份中的周数 Number 2 <br>
* D 年中的天数 Number 189 <br>
* d 月份中的天数 Number 10 <br>
* F 月份中的星期 Number 2 <br>
* E 星期中的天数 Text Tuesday; Tue<br>
* a Am/pm 标记 Text PM <br>
* H 一天中的小时数(0-23) Number 0 <br>
* k 一天中的小时数(1-24) Number 24<br>
* K am/pm 中的小时数(0-11) Number 0 <br>
* h am/pm 中的小时数(1-12) Number 12 <br>
* m 小时中的分钟数 Number 30 <br>
* s 分钟中的秒数 Number 55 <br>
* S 毫秒数 Number 978 <br>
* z 时区 General time zone Pacific Standard Time; PST; GMT-08:00 <br>
* Z 时区 RFC 822 time zone -0800 <br>
*/
public static final String Default_DATE_PATTERN = "yyyy-MM-dd HH:mm:ss";
private DateFormat dateFormat;
public DateJsonValueProcessor(String datePattern) {
try {
dateFormat = new SimpleDateFormat(datePattern);
} catch (Exception e) {
dateFormat = new SimpleDateFormat(Default_DATE_PATTERN);
}
}
public Object processArrayValue(Object value, JsonConfig jsonConfig) {
return process(value);
}
public Object processObjectValue(String key, Object value,
JsonConfig jsonConfig) {
return process(value);
}
private Object process(Object value) {
if(value==null)
return null;
else
return dateFormat.format((Date) value);
}
} | [
"[email protected]"
]
| |
ccb34dcd1d2ce9decc97f1851baa646c4bad5ca0 | d39ccf65250d04d5f7826584a06ee316babb3426 | /wb-mmb/wb-bdb/src/main/java/org/ihtsdo/concept/component/image/ImageBinder.java | 39776e1f935d7087f7e195d1db7ad37fbaca550d | []
| no_license | va-collabnet-archive/workbench | ab4c45504cf751296070cfe423e39d3ef2410287 | d57d55cb30172720b9aeeb02032c7d675bda75ae | refs/heads/master | 2021-01-10T02:02:09.685099 | 2012-01-25T19:15:44 | 2012-01-25T19:15:44 | 47,691,158 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 443 | java | package org.ihtsdo.concept.component.image;
import java.util.concurrent.atomic.AtomicInteger;
import org.ihtsdo.concept.component.ConceptComponentBinder;
public class ImageBinder extends ConceptComponentBinder<ImageRevision, Image> {
public static AtomicInteger encountered = new AtomicInteger();
public static AtomicInteger written = new AtomicInteger();
public ImageBinder() {
super(new ImageFactory(), encountered, written);
}
}
| [
"wsmoak"
]
| wsmoak |
3f61f909bd274ce7988aaa36a5a7c09a1e260544 | dbd8addd7e0be2576be468e06b6468ddd7edcafb | /com.reflexit.magiccards.ui/src/com/reflexit/magiccards/ui/views/columns/StringEditingSupport.java | 110f7cc3dc4c24f1826cf9b19a78de97d4d3511d | []
| no_license | lrdjdgmnt/mtgbrowser-git-ebd221ee80b16de1ea5b076d3e8640164725a79a | 4a0a337312bbd793b438d68550fc6c69639ab57f | 79072557896a77a284d51c191a8df66f81544b01 | refs/heads/master | 2022-11-30T15:10:49.558134 | 2020-08-07T20:08:20 | 2020-08-07T20:08:20 | 285,912,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,555 | java | package com.reflexit.magiccards.ui.views.columns;
import java.util.Collections;
import java.util.Set;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import com.reflexit.magiccards.core.DataManager;
import com.reflexit.magiccards.core.model.IMagicCard;
import com.reflexit.magiccards.core.model.abs.ICardField;
import com.reflexit.magiccards.core.model.abs.ICardModifiable;
import com.reflexit.magiccards.core.xml.StringCache;
public class StringEditingSupport extends EditingSupport {
private AbstractColumn column;
public StringEditingSupport(ColumnViewer viewer, AbstractColumn col) {
super(viewer);
this.column = col;
}
@Override
protected boolean canEdit(Object element) {
return element instanceof ICardModifiable;
}
@Override
protected CellEditor getCellEditor(final Object element) {
return new TextCellEditor((Composite) getViewer().getControl(), SWT.NONE);
}
@Override
protected Object getValue(Object element) {
return column.getText(element);
}
@Override
protected void setValue(Object element, Object value) {
ICardModifiable card = (ICardModifiable) element;
card.set(column.getDataField(), StringCache.intern((String) value));
Set<ICardField> of = Collections.singleton(column.getDataField());
DataManager.getInstance().update((IMagicCard) card, of);
// getViewer().refresh(true);
}
} | [
"[email protected]"
]
| |
0abdd93e888bc7cc1d5d96ed5416be17ea2df58a | fcb132e2e94e2e11ba4ee3180221fc636c686cd8 | /src/test/java/LogoutServletTests.java | 75d231ec02c2d0cca8da102c246383a254ad3b37 | []
| no_license | KeithSpiteri/Software.Testing | 5bc6f50ed07033a8f0d965508f1461b9bef24af9 | ccd7de1c775a9024b704a81e909acf1cd3ac19e9 | refs/heads/master | 2021-01-02T23:03:02.925791 | 2015-01-12T09:53:11 | 2015-01-12T09:53:11 | 26,328,908 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,590 | java | import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import db.services.DbService;
import persistant.User;
import servlet.LogoutServlet;
import servlet.RegisterServlet;
import validators.UserValidator;
import javax.servlet.http.Cookie;
public class LogoutServletTests {
private LogoutServlet logoutServlet;
@Mock
private HttpServletRequest request;
@Mock
private HttpServletResponse response;
private Cookie[] cookies = { new Cookie("user", "pass") };
@Before
public void init() throws Exception {
MockitoAnnotations.initMocks(this);
logoutServlet = new LogoutServlet();
}
@Test
public void testLogout() throws ServletException, IOException {
doReturn(cookies).when(request).getCookies();
logoutServlet.doPost(request, response);
verify(response).sendRedirect("index.jsp");
}
@Test
public void testLogoutCookiesAreNull() throws ServletException, IOException {
doReturn(null).when(request).getCookies();
logoutServlet.doPost(request, response);
verify(response).sendRedirect("index.jsp");
}
} | [
"[email protected]"
]
| |
44c85e27eaa9c85e43377aed30f6c54ad936850b | e04059a4dd1970005d5f630766c80c85e4d24d08 | /Servidor-Descarga/src/server/consola.java | efdbfe7f6ce15654900c971d36492270821adbd4 | []
| no_license | darkjuan193/Redes2-ClienteServidorCentralServidorDescargaDeLibros | 5aa81b02bb213cb2fbcdbf54589f84357a40c0f1 | e6e56fc55265267950c413405c2f2f4f8d565afb | refs/heads/master | 2021-01-11T22:11:08.545308 | 2017-01-30T23:23:45 | 2017-01-30T23:23:45 | 78,932,901 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,044 | 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 server;
import archivos.escribirXml;
import static archivos.escribirXml.libros_descargados;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
/**
*
* @author Pablo
*/
public class consola extends Thread{
/**
* metodo encargado de mostrar en pantalla las distintas opciones que tiene el servidor de descarga
*/
public void run(){
while(true){
System.out.println("consola");
Scanner es = new Scanner(System.in);
String a = es.nextLine();
if(a.equals("descargando")){
if(SerDes.getEstadistica().size()!=0){
for(int i =0;i<SerDes.getEstadistica().size();i++){
System.out.println("el servidor tiene la coleccion "+SerDes.getEstadistica().get(i).getNombre()+" con "+SerDes.getEstadistica().get(i).getCantidad()+" clientes asociados");
}
}
else
System.out.println("No hay libros descargando");
}
if(a.equals("descargas")){
if(SerDes.getLibrosDescargados().size()!=0){
for(int i =0;i<SerDes.getLibrosDescargados().size();i++){
System.out.println("La coleccion "+SerDes.getLibrosDescargados().get(i).getNombre()+" ha sido descargada "+SerDes.getLibrosDescargados().get(i).getCantidad());
}
}
else
System.out.println("no hay libros descargados por parte del servidor");
}
if(a.equals("clientes_fieles")){
// System.out.println("la cantidad de lcietnes ene lser des "+SerDes.getClientes().size());
for(int i = 0; i<SerDes.getClientes().size();i++){
System.out.println("El cliente "+SerDes.getClientes().get(i).getNombre()+" con ip: "+SerDes.getClientes().get(i).getIp()+" ha descargado "+SerDes.getClientes().get(i).getBandera()+ " veces");
}
}
if(a.equals("salir")){
System.out.println("Saliendo consola");
try {
escribirXml.libros_descargados(SerDes.getLibrosDescargados());
escribirXml.escribir_fieles(SerDes.getClientes());
} catch (TransformerException ex) {
Logger.getLogger(consola.class.getName()).log(Level.SEVERE, null, ex);
} catch (ParserConfigurationException ex) {
Logger.getLogger(consola.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}
}
| [
"[email protected]"
]
| |
4f8024ec0a46f7889f81ae0dafa2a881d0a0b2ee | 3821eb5cd05dac229e54ff538369af19c5ca2665 | /src/main/java/com/skat/smev/snils/controllers/Smev3Controller.java | dc2adb35163818c4152972bb6beaaef1bd451a62 | []
| no_license | dkulaga/smev-snils-transformer | 51b8ee2095ee00f19a50a81238408b0b9a9be884 | 5de7dff200b920e496d4b16b08d984702677d6f3 | refs/heads/master | 2020-03-12T03:09:20.190995 | 2019-04-12T10:31:18 | 2019-04-12T10:31:18 | 130,418,802 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,833 | java | package com.skat.smev.snils.controllers;
import com.skat.smev.snils.domain.AdapterResponseModel;
import com.skat.smev.snils.domain.RequestModel;
import com.skat.smev.snils.services.Smev3Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/smevadapter")
public class Smev3Controller {
@Autowired
private Smev3Service smev3Service;
/**
* Метод преобразования и отправки запроса от ВИС и отправки в СМЭВ-адаптер
* @param request модель запроса в формате JSON
* @return возвращает сведения об успешности отправки запроса
* @throws Exception
*/
@PostMapping("/snils/request")
public String sendConsumerRequest(@RequestBody RequestModel request) throws Exception {
return smev3Service.sendRequest(request);
}
/**
* Метод для приема ответа от СМЭВ-адаптера, его парсинга и отправки в ВИС
* @param adapterResponse модель ответа от СМЭВ-адаптера
* @return сведения об успешной отправке либо об ошибке отправки
* @throws Exception
*/
@PostMapping("/response/send")
public String sendConsumerResponse(@RequestBody AdapterResponseModel adapterResponse) throws Exception {
return smev3Service.sendResponse(adapterResponse);
}
}
| [
"[email protected]"
]
| |
e3e09f378a47150d4a932d8bb254c1217f1d8714 | 05b45280cc605767c43142495095792a1143a32f | /greendaolib/src/main/java/com/example/greendaolib/dao/PlanSummaryDao.java | 6a07dce5853ba34059dbb110ac82eac621712852 | []
| no_license | wallehuhuchaojian/controlSu | 900e255fce71036de4ee0d1e01cf834c57a7743e | 08ff1f4983bd59b9553c2a71a3ab2a0e398c7fed | refs/heads/master | 2021-01-01T16:52:48.973798 | 2017-08-16T10:30:20 | 2017-08-16T10:30:20 | 97,939,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,567 | java | package com.example.greendaolib.dao;
import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;
import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import com.example.greendaolib.pojo.db.PlanSummary;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "PLAN_SUMMARY".
*/
public class PlanSummaryDao extends AbstractDao<PlanSummary, Long> {
public static final String TABLENAME = "PLAN_SUMMARY";
/**
* Properties of entity PlanSummary.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/
public static class Properties {
public final static Property Id = new Property(0, Long.class, "id", true, "_id");
public final static Property BeLongsId = new Property(1, long.class, "beLongsId", false, "BE_LONGS_ID");
public final static Property Rate = new Property(2, float.class, "rate", false, "RATE");
public final static Property Evaluation = new Property(3, String.class, "evaluation", false, "EVALUATION");
};
public PlanSummaryDao(DaoConfig config) {
super(config);
}
public PlanSummaryDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
}
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"PLAN_SUMMARY\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"\"BE_LONGS_ID\" INTEGER NOT NULL ," + // 1: beLongsId
"\"RATE\" REAL NOT NULL ," + // 2: rate
"\"EVALUATION\" TEXT);"); // 3: evaluation
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"PLAN_SUMMARY\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, PlanSummary entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindLong(2, entity.getBeLongsId());
stmt.bindDouble(3, entity.getRate());
String evaluation = entity.getEvaluation();
if (evaluation != null) {
stmt.bindString(4, evaluation);
}
}
@Override
protected final void bindValues(SQLiteStatement stmt, PlanSummary entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindLong(2, entity.getBeLongsId());
stmt.bindDouble(3, entity.getRate());
String evaluation = entity.getEvaluation();
if (evaluation != null) {
stmt.bindString(4, evaluation);
}
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public PlanSummary readEntity(Cursor cursor, int offset) {
PlanSummary entity = new PlanSummary( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getLong(offset + 1), // beLongsId
cursor.getFloat(offset + 2), // rate
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // evaluation
);
return entity;
}
@Override
public void readEntity(Cursor cursor, PlanSummary entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setBeLongsId(cursor.getLong(offset + 1));
entity.setRate(cursor.getFloat(offset + 2));
entity.setEvaluation(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
}
@Override
protected final Long updateKeyAfterInsert(PlanSummary entity, long rowId) {
entity.setId(rowId);
return rowId;
}
@Override
public Long getKey(PlanSummary entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}
| [
"[email protected]"
]
| |
20f27456839bd550e260997596e122dd3fceeafe | 822e8f298cb24cb713dd450cedad2018f2de55eb | /src/main/java/com/brennus/o2o/entity/Shop.java | d29b5b546f505b08b8cdd51e874cefd7b3b5a858 | []
| no_license | brennus1991/o2o | 7b4cbe0689485e577e78d33083775bbc606f0ae6 | 8f622e805b0963e72f2579f9324f48e18a036694 | refs/heads/master | 2020-03-20T21:00:47.601073 | 2018-07-02T03:26:59 | 2018-07-02T03:26:59 | 137,714,589 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,248 | java | package com.brennus.o2o.entity;
import java.util.Date;
public class Shop {
private Long shopId;
private String shopName;
private String shopDesc;
private String shopAddr;
private String phone;
private String shopImg;
private Integer priority;
private Date createTime;
private Date lastEditTime;
private Integer enableStatus;
private String advice;
private Area area;
private PersonInfo owner;
private ShopCategory shopCategory;
public Long getShopId() {
return shopId;
}
public void setShopId(Long shopId) {
this.shopId = shopId;
}
public String getShopName() {
return shopName;
}
public void setShopName(String shopName) {
this.shopName = shopName;
}
public String getShopDesc() {
return shopDesc;
}
public void setShopDesc(String shopDesc) {
this.shopDesc = shopDesc;
}
public String getShopAddr() {
return shopAddr;
}
public void setShopAddr(String shopAddr) {
this.shopAddr = shopAddr;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getShopImg() {
return shopImg;
}
public void setShopImg(String shopImg) {
this.shopImg = shopImg;
}
public Integer getPriority() {
return priority;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getLastEditTime() {
return lastEditTime;
}
public void setLastEditTime(Date lastEditTime) {
this.lastEditTime = lastEditTime;
}
public Integer getEnableStatus() {
return enableStatus;
}
public void setEnableStatus(Integer enableStatus) {
this.enableStatus = enableStatus;
}
public String getAdvice() {
return advice;
}
public void setAdvice(String advice) {
this.advice = advice;
}
public Area getArea() {
return area;
}
public void setArea(Area area) {
this.area = area;
}
public PersonInfo getOwner() {
return owner;
}
public void setOwner(PersonInfo owner) {
this.owner = owner;
}
public ShopCategory getShopCategory() {
return shopCategory;
}
public void setShopCategory(ShopCategory shopCategory) {
this.shopCategory = shopCategory;
}
}
| [
"[email protected]"
]
| |
8e9d9a216696570d65ddc2b01b95d192ec31a239 | 74b79d80da52c3d6f9b99e7c8c6c304f5123b1e7 | /SpotPer/src/View/MostrarResultado.java | 5cadf3029a5ea502bf0a5d84527700bb7854679b | []
| no_license | dqrtec/Banco_de_dados | a1df35a461fd6332e092e8f2b0ba83d39311228a | 2b705ff9fa211a2c8fe020f0e1551b26541762db | refs/heads/master | 2020-03-28T02:57:23.605326 | 2019-12-12T18:46:09 | 2019-12-12T18:46:09 | 147,609,099 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 31,488 | 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 View;
import Controller.AlbumSQL;
import Controller.Conexao;
import Controller.FaixaController;
import Controller.FaixaSQL;
import Controller.PlaylistSQL;
import Model.Album;
import Model.Faixa;
import Model.Playlist;
import java.awt.Color;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import static java.lang.Integer.parseInt;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import javax.sound.sampled.Clip;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
/**
*
* @author tibet
*/
public class MostrarResultado extends javax.swing.JFrame {
private String busca;
/**
* Creates new form MostrarResultado
*/
public MostrarResultado(String busca) {
initComponents();
this.busca = busca;
labelTitulo.setText("Resultado de: '" + busca + "'");
jTextBuscar.setText(busca);
atualizaTabelaResultado(busca);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
labelTitulo = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
tabelaResultado = new javax.swing.JTable();
labelNovaPlaylist = new javax.swing.JLabel();
menuMusica = new javax.swing.JLabel();
menuArtista = new javax.swing.JLabel();
menuAlbum = new javax.swing.JLabel();
menuPlaylist = new javax.swing.JLabel();
jTextBuscar = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setBackground(new java.awt.Color(40, 40, 40));
jPanel2.setBackground(new java.awt.Color(24, 24, 24));
jPanel2.setPreferredSize(new java.awt.Dimension(832, 37));
labelTitulo.setFont(new java.awt.Font("MV Boli", 0, 36)); // NOI18N
labelTitulo.setForeground(new java.awt.Color(240, 240, 240));
labelTitulo.setText("Resultado de: ");
tabelaResultado.setBackground(new java.awt.Color(24, 24, 24));
tabelaResultado.setForeground(new java.awt.Color(240, 240, 240));
tabelaResultado.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"#", "Descrição", "Tipo"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
boolean[] canEdit = new boolean [] {
false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tabelaResultado.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tabelaResultadoMouseClicked(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
tabelaResultadoMousePressed(evt);
}
});
jScrollPane2.setViewportView(tabelaResultado);
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(labelTitulo, javax.swing.GroupLayout.DEFAULT_SIZE, 833, Short.MAX_VALUE)
.addComponent(jScrollPane2))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(labelTitulo)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
labelNovaPlaylist.setFont(new java.awt.Font("MV Boli", 0, 16)); // NOI18N
labelNovaPlaylist.setForeground(new java.awt.Color(155, 155, 155));
labelNovaPlaylist.setText("+ Nova Playlist");
labelNovaPlaylist.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
labelNovaPlaylist.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
labelNovaPlaylistMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
labelNovaPlaylistMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
labelNovaPlaylistMouseExited(evt);
}
});
menuMusica.setFont(new java.awt.Font("MV Boli", 0, 18)); // NOI18N
menuMusica.setForeground(new java.awt.Color(155, 155, 155));
menuMusica.setText("Músicas");
menuMusica.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
menuMusicaMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
menuMusicaMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
menuMusicaMouseExited(evt);
}
});
menuArtista.setFont(new java.awt.Font("MV Boli", 0, 18)); // NOI18N
menuArtista.setForeground(new java.awt.Color(155, 155, 155));
menuArtista.setText("Artistas");
menuArtista.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
menuArtistaMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
menuArtistaMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
menuArtistaMouseExited(evt);
}
});
menuAlbum.setFont(new java.awt.Font("MV Boli", 0, 18)); // NOI18N
menuAlbum.setForeground(new java.awt.Color(155, 155, 155));
menuAlbum.setText("Álbuns");
menuAlbum.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
menuAlbumMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
menuAlbumMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
menuAlbumMouseExited(evt);
}
});
menuPlaylist.setFont(new java.awt.Font("MV Boli", 0, 18)); // NOI18N
menuPlaylist.setForeground(new java.awt.Color(155, 155, 155));
menuPlaylist.setText("Playlists");
menuPlaylist.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
menuPlaylistMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
menuPlaylistMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
menuPlaylistMouseExited(evt);
}
});
jTextBuscar.setBackground(new java.awt.Color(51, 51, 51));
jTextBuscar.setForeground(new java.awt.Color(255, 255, 255));
jTextBuscar.setText("Buscar...");
jTextBuscar.setCaretColor(new java.awt.Color(255, 255, 255));
jTextBuscar.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTextBuscarKeyPressed(evt);
}
});
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(labelNovaPlaylist, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(menuArtista, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(menuAlbum, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(menuPlaylist, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(menuMusica, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(0, 14, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextBuscar)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 853, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 542, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(41, 41, 41)
.addComponent(jTextBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(menuMusica, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(menuArtista, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(menuAlbum, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(menuPlaylist, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(86, 86, 86)
.addComponent(labelNovaPlaylist, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(21, 21, 21))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void labelNovaPlaylistMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelNovaPlaylistMouseExited
Color gray = new Color(155, 155, 155);
labelNovaPlaylist.setForeground(gray);
}//GEN-LAST:event_labelNovaPlaylistMouseExited
private void labelNovaPlaylistMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelNovaPlaylistMouseEntered
labelNovaPlaylist.setForeground(Color.WHITE);
}//GEN-LAST:event_labelNovaPlaylistMouseEntered
private void labelNovaPlaylistMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelNovaPlaylistMouseClicked
new CriarPlaylist(this).setVisible(true);
dispose();
}//GEN-LAST:event_labelNovaPlaylistMouseClicked
private void menuMusicaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuMusicaMouseClicked
new MostrarFaixas().setVisible(true);
dispose();
}//GEN-LAST:event_menuMusicaMouseClicked
private void menuMusicaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuMusicaMouseEntered
menuMusica.setForeground(Color.WHITE);
}//GEN-LAST:event_menuMusicaMouseEntered
private void menuMusicaMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuMusicaMouseExited
Color gray = new Color(155, 155, 155);
menuMusica.setForeground(gray);
}//GEN-LAST:event_menuMusicaMouseExited
private void menuArtistaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuArtistaMouseClicked
// TODO add your handling code here:
}//GEN-LAST:event_menuArtistaMouseClicked
private void menuArtistaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuArtistaMouseEntered
menuArtista.setForeground(Color.WHITE);
}//GEN-LAST:event_menuArtistaMouseEntered
private void menuArtistaMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuArtistaMouseExited
Color gray = new Color(155, 155, 155);
menuArtista.setForeground(gray);
}//GEN-LAST:event_menuArtistaMouseExited
private void menuAlbumMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuAlbumMouseClicked
new MostrarAlbum().setVisible(true);
dispose();
}//GEN-LAST:event_menuAlbumMouseClicked
private void menuAlbumMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuAlbumMouseEntered
menuAlbum.setForeground(Color.WHITE);
}//GEN-LAST:event_menuAlbumMouseEntered
private void menuAlbumMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuAlbumMouseExited
Color gray = new Color(155, 155, 155);
menuAlbum.setForeground(gray);
}//GEN-LAST:event_menuAlbumMouseExited
private void menuPlaylistMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuPlaylistMouseClicked
new MostrarPlaylist().setVisible(true);
dispose();
}//GEN-LAST:event_menuPlaylistMouseClicked
private void menuPlaylistMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuPlaylistMouseEntered
menuPlaylist.setForeground(Color.WHITE);
}//GEN-LAST:event_menuPlaylistMouseEntered
private void menuPlaylistMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menuPlaylistMouseExited
Color gray = new Color(155, 155, 155);
menuPlaylist.setForeground(gray);
}//GEN-LAST:event_menuPlaylistMouseExited
private void jTextBuscarKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextBuscarKeyPressed
if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
String strTexto = jTextBuscar.getText();
new MostrarResultado(strTexto).setVisible(true);
dispose();
}
}//GEN-LAST:event_jTextBuscarKeyPressed
private void tabelaResultadoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaResultadoMouseClicked
int row = tabelaResultado.getSelectedRow();
String tipo = (String) tabelaResultado.getValueAt(row, 2);
JFrame aqui = this;
if (tipo.equals("Álbum")) {
System.out.println(tipo);
int codigo = (int) tabelaResultado.getValueAt(row, 0);
System.out.println(codigo);
JPopupMenu jPopupMenu = new JPopupMenu();
JMenuItem menuItemEditar = new JMenuItem("Editar");
JMenu menuItemPlaylist = new JMenu("Adicionar à Playlist");
JMenuItem menuCriarPlaylist = new JMenuItem("Nova Playlist");
jPopupMenu.add(menuItemEditar);
jPopupMenu.add(menuItemPlaylist);
menuItemPlaylist.add(menuCriarPlaylist);
List<Playlist> listaPlaylist = listarPlaylists();
for (Playlist playlist : listaPlaylist) {
JMenuItem playlistSelected = new JMenuItem(playlist.getNome());
menuItemPlaylist.add(playlistSelected);
playlistSelected.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
Album album = selecionaAlbum(codigo);
adicionarAlbumPlaylist(playlist, album);
}
});
}
menuItemEditar.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
Album album = selecionaAlbum(codigo);
new EditarAlbum(album).setVisible(true);
dispose();
}
});
menuCriarPlaylist.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
new CriarPlaylist(aqui).setVisible(true);
dispose();
}
});
tabelaResultado.addMouseListener(
new java.awt.event.MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3) {
jPopupMenu.show(tabelaResultado, e.getX(), e.getY());
}
}
});
} else if (tipo.equals("Playlist")) {
int idPlaylist = (int) tabelaResultado.getValueAt(row, 0);
JPopupMenu jPopupMenu = new JPopupMenu();
JMenuItem menuItemEditar = new JMenuItem("Editar");
JMenuItem menuItemRemover = new JMenuItem("Remover");
jPopupMenu.add(menuItemEditar);
jPopupMenu.add(menuItemRemover);
menuItemEditar.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
}
});
menuItemRemover.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
int dialogResult = JOptionPane.showConfirmDialog(null, "Deseja realmente excluir?",
"Atenção!", JOptionPane.YES_NO_OPTION);
if (dialogResult == JOptionPane.YES_OPTION) {
removerPlaylist(idPlaylist);
atualizaTabelaResultado(busca);
}
}
});
tabelaResultado.addMouseListener(
new java.awt.event.MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3) {
jPopupMenu.show(tabelaResultado, e.getX(), e.getY());
}
}
});
} else if (tipo.equals("Faixa")) {
String codigo = (String) tabelaResultado.getValueAt(row, 0);
int numFaixa = parseInt(codigo.split(" - ")[0]);
int idAlbum = parseInt(codigo.split(" - ")[1]);
JPopupMenu jPopupMenu = new JPopupMenu();
JMenuItem menuItemTocar = new JMenuItem("Tocar");
JMenu menuItemPlaylist = new JMenu("Adicionar à Playlist");
JMenuItem menuCriarPlaylist = new JMenuItem("Nova Playlist");
jPopupMenu.add(menuItemTocar);
jPopupMenu.add(menuItemPlaylist);
menuItemPlaylist.add(menuCriarPlaylist);
List<Playlist> listaPlaylist = listarPlaylists();
for (Playlist playlist : listaPlaylist) {
JMenuItem playlistSelected = new JMenuItem(playlist.getNome());
menuItemPlaylist.add(playlistSelected);
playlistSelected.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
Faixa faixa = selecionaFaixa(numFaixa, idAlbum);
adicionarFaixaPlaylist(playlist, faixa);
}
});
}
menuItemTocar.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
Faixa faixa = selecionaFaixa(numFaixa, idAlbum);
if (FaixaController.clip != null) {
FaixaController.pararFaixa();
}
FaixaController.clip = FaixaController.tocarFaixa(faixa);
}
});
menuCriarPlaylist.addActionListener(
new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
new CriarPlaylist(aqui).setVisible(true);
}
});
tabelaResultado.addMouseListener(
new java.awt.event.MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3) {
jPopupMenu.show(tabelaResultado, e.getX(), e.getY());
}
}
});
}
}//GEN-LAST:event_tabelaResultadoMouseClicked
private void tabelaResultadoMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabelaResultadoMousePressed
int row = tabelaResultado.getSelectedRow();
String tipo = (String) tabelaResultado.getValueAt(row, 2);
if (tipo.equals("Álbum")) {
Point point = evt.getPoint();
if (evt.getClickCount() == 2 && tabelaResultado.getSelectedRow() != -1) {
int idAlbum = (int) tabelaResultado.getValueAt(row, 0);
String descricao = (String) tabelaResultado.getValueAt(row, 1);
new MostrarFaixasAlbum(idAlbum, descricao).setVisible(true);
dispose();
}
} else if (tipo.equals("Playlist")) {
Point point = evt.getPoint();
if (evt.getClickCount() == 2 && tabelaResultado.getSelectedRow() != -1) {
int idPlaylist = (int) tabelaResultado.getValueAt(row, 0);
String nomePlaylist = (String) tabelaResultado.getValueAt(row, 1);
new MostrarFaixasPlaylist(idPlaylist, nomePlaylist).setVisible(true);
dispose();
}
}
}//GEN-LAST:event_tabelaResultadoMousePressed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MostrarResultado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MostrarResultado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MostrarResultado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MostrarResultado.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
//new MostrarResultado().setVisible(true);
}
});
}
private void atualizaTabelaResultado(String busca) {
List<Album> resultadoAlbum = buscarAlbum(busca);
List<Faixa> resultadoFaixa = buscarFaixa(busca);
List<Playlist> resultadoPlaylist = buscarPlaylist(busca);
DefaultTableModel tbm = (DefaultTableModel) tabelaResultado.getModel();
while (tbm.getRowCount() > 0) {
tbm.removeRow(0);
}
int i = 0;
if (resultadoFaixa != null) {
for (Faixa tab : resultadoFaixa) {
tbm.addRow(new String[i]);
tabelaResultado.setValueAt(tab.getNumFaixa() + " - " + tab.getIdAlbum(), i, 0);
tabelaResultado.setValueAt(tab.getDescricao(), i, 1);
tabelaResultado.setValueAt("Faixa", i, 2);
i++;
}
}
if (resultadoPlaylist != null) {
for (Playlist tab : resultadoPlaylist) {
tbm.addRow(new String[i]);
tabelaResultado.setValueAt(tab.getIdPlaylist(), i, 0);
tabelaResultado.setValueAt(tab.getNome(), i, 1);
tabelaResultado.setValueAt("Playlist", i, 2);
i++;
}
}
if (resultadoAlbum != null) {
for (Album tab : resultadoAlbum) {
tbm.addRow(new String[i]);
tabelaResultado.setValueAt(tab.getIdAlbum(), i, 0);
tabelaResultado.setValueAt(tab.getDescricao(), i, 1);
tabelaResultado.setValueAt("Álbum", i, 2);
i++;
}
}
}
private List<Album> buscarAlbum(String busca) {
Connection conn = Conexao.abrirConexao();
AlbumSQL albumSQL = new AlbumSQL(conn);
List<Album> resultadoAlbum = albumSQL.listarResultadoAlbum(busca);
Conexao.fecharConexao(conn);
return resultadoAlbum;
}
private List<Faixa> buscarFaixa(String busca) {
Connection conn = Conexao.abrirConexao();
FaixaSQL faixaSQL = new FaixaSQL(conn);
List<Faixa> resultadoFaixa = faixaSQL.listarResultadoFaixa(busca);
Conexao.fecharConexao(conn);
return resultadoFaixa;
}
private List<Playlist> buscarPlaylist(String busca) {
Connection conn = Conexao.abrirConexao();
PlaylistSQL playlistSQL = new PlaylistSQL(conn);
List<Playlist> resultadoPlaylist = playlistSQL.listarResultadoPlaylist(busca);
Conexao.fecharConexao(conn);
return resultadoPlaylist;
}
private List<Playlist> listarPlaylists() {
Connection conn = Conexao.abrirConexao();
PlaylistSQL playlistSQL = new PlaylistSQL(conn);
List<Playlist> lista = playlistSQL.listarPlaylist();
Conexao.fecharConexao(conn);
return lista;
}
private void adicionarAlbumPlaylist(Playlist p, Album a) {
Connection conn = Conexao.abrirConexao();
PlaylistSQL playlistSQL = new PlaylistSQL(conn);
playlistSQL.adicionaAlbumPlaylist(p, a);
Conexao.fecharConexao(conn);
}
private Album selecionaAlbum(int idAlbum) {
Connection conn = Conexao.abrirConexao();
AlbumSQL albumSQL = new AlbumSQL(conn);
Album album = albumSQL.listaAlbum(idAlbum);
Conexao.fecharConexao(conn);
return album;
}
private void removerPlaylist(int idPlaylist) {
Connection conn = Conexao.abrirConexao();
PlaylistSQL playlistSQL = new PlaylistSQL(conn);
String message = playlistSQL.removerPlaylist(idPlaylist);
Conexao.fecharConexao(conn);
JOptionPane.showMessageDialog(null, message);
}
private void adicionarFaixaPlaylist(Playlist p, Faixa f) {
Connection conn = Conexao.abrirConexao();
PlaylistSQL playlistSQL = new PlaylistSQL(conn);
playlistSQL.adicionaFaixaPlaylist(p, f);
Conexao.fecharConexao(conn);
}
private Faixa selecionaFaixa(int numFaixa, int idAlbum) {
Connection conn = Conexao.abrirConexao();
FaixaSQL faixaSQL = new FaixaSQL(conn);
Faixa faixa = faixaSQL.listaFaixa(idAlbum, numFaixa);
Conexao.fecharConexao(conn);
return faixa;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextField jTextBuscar;
private javax.swing.JLabel labelNovaPlaylist;
private javax.swing.JLabel labelTitulo;
private javax.swing.JLabel menuAlbum;
private javax.swing.JLabel menuArtista;
private javax.swing.JLabel menuMusica;
private javax.swing.JLabel menuPlaylist;
private javax.swing.JTable tabelaResultado;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
cebf1832fc55d7ebf1db0057faa7d213bab47215 | 6aee0e0a21c636dc329fae26aa7bd850bbf67b12 | /apexAgent-api/src/main/java/io/verticle/oss/apex/agent/api/transport/payload/MetricMessage.java | eb53da2b0179c12dfb0ebf1cbc9cc2416c064a9b | [
"Apache-2.0"
]
| permissive | verticle-io/apex-toolkit | 1f55af2f0a1cb4a757223664671c7c3341541905 | 7c3f290d4f5a4aa619e8b4e5dffadc1087d27288 | refs/heads/master | 2021-01-11T08:24:43.956647 | 2017-01-29T13:27:36 | 2017-01-29T13:27:36 | 78,287,872 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,013 | java | /*
* Copyright 2016 Jens Saade <[email protected]>
*
* 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 io.verticle.oss.apex.agent.api.transport.payload;
import io.verticle.apex.commons.oss.collectors.model.Domain;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Metric Message object
* @author Jens Saade
*/
public final class MetricMessage {
Map<String, Object> meta = new HashMap();
Map<String, Object> metrics = new HashMap();
/**
* MetricMessageFormat V1
* @param index
* @param type
* @param timestamp
*/
public MetricMessage(String index, String type, Date timestamp){
meta.put("index", index);
meta.put("type", type);
meta.put("@timestamp", timestamp);
}
/**
* MetricMessageFormat V2
* @param domain
* @param qualifier
* @param timestamp
*/
public MetricMessage(Domain domain, String qualifier, Date timestamp){
meta.put("domain", domain);
meta.put("qualifier", qualifier);
meta.put("@timestamp", timestamp);
}
public void addField(String fieldName, Object fieldValue){
metrics.put(fieldName, fieldValue);
}
public Map<String, Object> getMeta() {
return meta;
}
public Map<String, Object> getMetrics() {
return metrics;
}
public void addMeta(String fieldName, Object fieldValue) {
meta.put(fieldName, fieldValue);
}
}
| [
"[email protected]"
]
| |
6aabec63520aa93f8ed852b839ca3f6e83ad4b60 | 79595075622ded0bf43023f716389f61d8e96e94 | /app/src/main/java/android/widget/RadioButton.java | c0857c7147bd0ad09cbe2d54ea1d7b30f940e4b7 | []
| no_license | dstmath/OppoR15 | 96f1f7bb4d9cfad47609316debc55095edcd6b56 | b9a4da845af251213d7b4c1b35db3e2415290c96 | refs/heads/master | 2020-03-24T16:52:14.198588 | 2019-05-27T02:24:53 | 2019-05-27T02:24:53 | 142,840,716 | 7 | 4 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | package android.widget;
import android.content.Context;
import android.util.AttributeSet;
import com.android.internal.R;
public class RadioButton extends CompoundButton {
public RadioButton(Context context) {
this(context, null);
}
public RadioButton(Context context, AttributeSet attrs) {
this(context, attrs, R.attr.radioButtonStyle);
}
public RadioButton(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public RadioButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
public void toggle() {
if (!isChecked()) {
super.toggle();
}
}
public CharSequence getAccessibilityClassName() {
return RadioButton.class.getName();
}
}
| [
"[email protected]"
]
| |
2617780943b814a6c8ae29f2c9978af71a4190e3 | fa82ec4395e60d743314f43037770f503311ea99 | /plugins/dummy/core/src/main/java/org/pentaho/di/be/ibridge/kettle/dummy/DummyPluginMeta.java | e2e3dbe116963334fc0ec4fd32fec3b8edf29cc9 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | vivostar/pentaho-kettle-webspoon-0.8.1.17 | fb65046ee38c59ba54fdf947132e96beb1ea76b0 | 30523f66c95d9164b6dacb570a78f6a7f0e45fd0 | refs/heads/master | 2022-01-15T07:26:35.643881 | 2019-05-20T02:45:09 | 2019-05-20T02:45:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,600 | java | /*! ******************************************************************************
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.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.pentaho.di.be.ibridge.kettle.dummy;
import org.eclipse.swt.widgets.*;
import org.pentaho.di.core.*;
import org.pentaho.di.core.annotations.*;
import org.pentaho.di.core.database.*;
import org.pentaho.di.core.exception.*;
import org.pentaho.di.core.row.*;
import org.pentaho.di.core.row.value.*;
import org.pentaho.di.core.variables.*;
import org.pentaho.di.core.xml.*;
import org.pentaho.di.repository.*;
import org.pentaho.di.trans.*;
import org.pentaho.di.trans.step.*;
import org.w3c.dom.*;
import java.util.List;
import java.util.*;
/*
* Created on 02-jun-2003
*
*/
@Step( id = "DummyStep",
image = "DPL.svg",
i18nPackageName = "be.ibridge.kettle.dummy",
name = "DummyPlugin.Step.Name",
description = "DummyPlugin.Step.Description",
categoryDescription = "Deprecated" )
public class DummyPluginMeta extends BaseStepMeta implements StepMetaInterface {
private ValueMetaAndData value;
public DummyPluginMeta() {
super(); // allocate BaseStepInfo
}
/**
* @return Returns the value.
*/
public ValueMetaAndData getValue() {
return value;
}
/**
* @param value The value to set.
*/
public void setValue( ValueMetaAndData value ) {
this.value = value;
}
@Override
public String getXML() throws KettleException {
String retval = "";
retval += " <values>" + Const.CR;
if ( value != null ) {
retval += value.getXML();
}
retval += " </values>" + Const.CR;
return retval;
}
@Override
public void getFields( RowMetaInterface r, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space ) {
if ( value != null ) {
ValueMetaInterface v = value.getValueMeta();
v.setOrigin( origin );
r.addValueMeta( v );
}
}
@Override
public Object clone() {
Object retval = super.clone();
return retval;
}
@Override
public void loadXML( Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters ) throws KettleXMLException {
try {
value = new ValueMetaAndData();
Node valnode = XMLHandler.getSubNode( stepnode, "values", "value" );
if ( valnode != null ) {
System.out.println( "reading value in " + valnode );
value.loadXML( valnode );
}
} catch ( Exception e ) {
throw new KettleXMLException( "Unable to read step info from XML node", e );
}
}
@Override
public void setDefault() {
value = new ValueMetaAndData( new ValueMetaNumber( "valuename" ), new Double( 123.456 ) );
value.getValueMeta().setLength( 12 );
value.getValueMeta().setPrecision( 4 );
}
@Override
public void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters ) throws KettleException {
try {
String name = rep.getStepAttributeString( id_step, 0, "value_name" );
String typedesc = rep.getStepAttributeString( id_step, 0, "value_type" );
String text = rep.getStepAttributeString( id_step, 0, "value_text" );
boolean isnull = rep.getStepAttributeBoolean( id_step, 0, "value_null" );
int length = (int) rep.getStepAttributeInteger( id_step, 0, "value_length" );
int precision = (int) rep.getStepAttributeInteger( id_step, 0, "value_precision" );
int type = ValueMetaFactory.getIdForValueMeta( typedesc );
value = new ValueMetaAndData( new ValueMeta( name, type ), null );
value.getValueMeta().setLength( length );
value.getValueMeta().setPrecision( precision );
if ( isnull ) {
value.setValueData( null );
} else {
ValueMetaInterface stringMeta = new ValueMetaString( name );
if ( type != ValueMetaInterface.TYPE_STRING ) {
text = Const.trim( text );
}
value.setValueData( value.getValueMeta().convertData( stringMeta, text ) );
}
} catch ( KettleDatabaseException dbe ) {
throw new KettleException( "error reading step with id_step=" + id_step + " from the repository", dbe );
} catch ( Exception e ) {
throw new KettleException( "Unexpected error reading step with id_step=" + id_step + " from the repository", e );
}
}
@Override
public void saveRep( Repository rep, ObjectId id_transformation, ObjectId id_step ) throws KettleException {
try {
rep.saveStepAttribute( id_transformation, id_step, "value_name", value.getValueMeta().getName() );
rep.saveStepAttribute( id_transformation, id_step, 0, "value_type", value.getValueMeta().getTypeDesc() );
rep.saveStepAttribute( id_transformation, id_step, 0, "value_text", value.getValueMeta().getString( value.getValueData() ) );
rep.saveStepAttribute( id_transformation, id_step, 0, "value_null", value.getValueMeta().isNull( value.getValueData() ) );
rep.saveStepAttribute( id_transformation, id_step, 0, "value_length", value.getValueMeta().getLength() );
rep.saveStepAttribute( id_transformation, id_step, 0, "value_precision", value.getValueMeta().getPrecision() );
} catch ( KettleDatabaseException dbe ) {
throw new KettleException( "Unable to save step information to the repository, id_step=" + id_step, dbe );
}
}
@Override
public void check( List<CheckResultInterface> remarks, TransMeta transmeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info ) {
CheckResult cr;
if ( prev == null || prev.size() == 0 ) {
cr = new CheckResult( CheckResult.TYPE_RESULT_WARNING, "Not receiving any fields from previous steps!", stepMeta );
remarks.add( cr );
} else {
cr = new CheckResult( CheckResult.TYPE_RESULT_OK, "Step is connected to previous one, receiving " + prev.size() + " fields", stepMeta );
remarks.add( cr );
}
// See if we have input streams leading to this step!
if ( input.length > 0 ) {
cr = new CheckResult( CheckResult.TYPE_RESULT_OK, "Step is receiving info from other steps.", stepMeta );
remarks.add( cr );
} else {
cr = new CheckResult( CheckResult.TYPE_RESULT_ERROR, "No input received from other steps!", stepMeta );
remarks.add( cr );
}
}
public StepDialogInterface getDialog( Shell shell, StepMetaInterface meta, TransMeta transMeta, String name ) {
return new DummyPluginDialog( shell, meta, transMeta, name );
}
@Override
public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta, Trans disp ) {
return new DummyPlugin( stepMeta, stepDataInterface, cnr, transMeta, disp );
}
@Override
public StepDataInterface getStepData() {
return new DummyPluginData();
}
}
| [
"[email protected]"
]
| |
383ae145963193866a3be93ebbc6fb84d85bc246 | b45875c4668ac8a969baf230733b105abbc652cc | /src/model/Services.java | e0f4fa241bdebd975cdeaacd43e79cb7686253fa | []
| no_license | beyon83/IMDb-BILD-IT | b20aee8a3f754d9eac547084897947298edc6608 | e5390740b421df37f36fdd39f9b209455d375381 | refs/heads/master | 2021-01-15T21:39:35.889491 | 2015-12-11T09:14:03 | 2015-12-11T09:14:03 | 47,420,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,751 | java | package model;
//import java.io.ByteArrayOutputStream;
//import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
//import java.io.OutputStream;
//import java.sql.Blob;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.ArrayList;
/**
* @author Bojan Aleksic
*/
public class Services {
////////////////////////////////////////////////////////////////////////////////
/**
* Method for authenticate username and password
* @param userName
* @param password
* @param mysqlConnect
* @return
*/
public boolean authenticateUser(String userName, String password, Connection mysqlConnect) {
/** Assign an sql query to the String variable */
String sql = " SELECT `userName`, `password` FROM `users` ";
/** Create PreparedStatement and ResultSet and pass sql query to the PreparedStatement object */
try(PreparedStatement prepStat = mysqlConnect.prepareStatement(sql);
ResultSet rs = prepStat.executeQuery();) {
while(rs.next()) {
/** Compare input's username and password with username and password in database */
if((userName.equals(rs.getString("userName"))) && (password.equals(rs.getString("password")))) {
return true;
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Check if logged user is administrator
* @param userName
* @param mysqlConnect
* @return
*/
public boolean isAdmin(String userName, Connection mysqlConnect) {
/** Assign an sql query to the String variable */
String sqlSelect = " SELECT `isAdmin` FROM `users` WHERE `userName` = '" + userName + "' ";
/** Create PreparedStatement and ResultSet and pass sql query to the PreparedStatement object */
try(PreparedStatement prepStat = mysqlConnect.prepareStatement(sqlSelect);
ResultSet rs = prepStat.executeQuery();) {
while(rs.next()) {
String isAdmin = rs.getString("isAdmin");
/** Check if logged user is administrator */
if(isAdmin.equals("true")) {
return true;
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* User Sign-Up
* @param userName
* @param firstName
* @param lastName
* @param password
* @param gender
* @param registrationDate
* @param email
* @param mysqlConnect
*/
public void signUp(String userName, String firstName, String lastName, String password, String gender, String registrationDate, String email, Connection mysqlConnect) {
/** Declare String sql query for prepared statement */
String sqlQuery = " INSERT INTO `users` "
+ " (`userName`, `firstName`, `lastName`, `password`, `gender`, `registrationDate`, `email`) "
+ " VALUES (?, ?, ?, ?, ?, ?, ?) ";
/** Instantiate PreparedStatement object and pass sql query to it */
try(PreparedStatement prepStatement = mysqlConnect.prepareStatement(sqlQuery);) {
/** Insert data to the fields in the database */
prepStatement.setString(1, userName);
prepStatement.setString(2, firstName);
prepStatement.setString(3, lastName);
prepStatement.setString(4, password);
prepStatement.setString(5, gender);
prepStatement.setString(6, registrationDate);
prepStatement.setString(7, email);
prepStatement.executeUpdate(); // execute prepared statement
} catch (SQLException e) {
e.printStackTrace();
}
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Check if username is already taken
* @param userName
* @param mysqlConnect
* @return
*/
public boolean isUsernameTaken(String userName, Connection mysqlConnect) {
/** Declare String with sql query */
String sqlQuery = " SELECT `userName` FROM `users` ";
/** Declare ResultSet object */
ResultSet rs = null;
/** Instantiate PreparedStatement and pass sqlQuery to it */
try(PreparedStatement prepStatement = mysqlConnect.prepareStatement(sqlQuery);) {
rs = prepStatement.executeQuery(); // execute PreparedStatement
while(rs.next()) {
/** Assign userName from the database to the String */
String name = rs.getString("userName");
/** Check if passed userName matches username from the database */
if(userName.equals(name)) {
return true; // if so, return true, user already exists in the database
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return false; // otherwise return false, user does not exist in the database.
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Method for uploading movie data (title, year, genre, description and movie photo)
* @param movieTitle
* @param movieYear
* @param genre
* @param description
* @param cast
* @param director
* @param inputStream
* @param mysqlConnect
*/
public void uploadMovie(String movieTitle, int movieYear, String genre, String description, String cast, String director, InputStream inputStream, Connection mysqlConnect) {
/** Sql query for inserting data into database */
String sqlQuery = " INSERT INTO `movies`(`movieTitle`, `year`, `genre`, `description`, `cast`, `director`, `photo`) "
+ " VALUES(?, ?, ?, ?, ?, ?, ?) ";
/** Create PreparedStatement for inserting data into database */
try(PreparedStatement prepStatement = mysqlConnect.prepareStatement(sqlQuery);) {
/** Set data */
prepStatement.setString(1, movieTitle);
prepStatement.setInt(2, movieYear);
prepStatement.setString(3, genre);
prepStatement.setString(4, description);
prepStatement.setString(5, cast);
prepStatement.setString(6, director);
prepStatement.setBlob(7, inputStream);
prepStatement.executeUpdate(); // execute update
} catch (SQLException e) {
e.printStackTrace();
}
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Simple algorithm for displaying max 5 page links in pagination
* @param page
* @return
*/
public ArrayList<Integer> paginationList(int page) {
ArrayList<Integer> list = new ArrayList<>();
if(page == 1 || page == 2) {
if(Movie.getNumberOfPages() <= 5) {
for(int i = 1; i <= Movie.getNumberOfPages(); i++) {
list.add(i);
}
} else if(Movie.getNumberOfPages() > 5) {
for(int i = 1; i <= 5; i++) {
list.add(i);
}
}
} else if(page > 2 && page < Movie.getNumberOfPages()-1) {
for(int i = page - 2; i <= page + 2; i++) {
list.add(i);
}
} else if((page + 2) > Movie.getNumberOfPages() || (page + 2) == Movie.getNumberOfPages()) {
list.clear();
for(int i = page - 2; i <= Movie.getNumberOfPages(); i++) {
list.add(i);
}
}
return list;
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Obtain list of all movies from the database
* @param row
* @param mysqlConnect
* @return
* @throws IOException
*/
public ArrayList<Movie> getMovies(int row, Connection mysqlConnect) throws IOException {
/** Create ArrayList for movies */
ArrayList<Movie> moviesList = new ArrayList<>();
/** Pagination set limit to 15 per page */
int rowsPerPage = 15;
row = row * rowsPerPage; // get starting row depending on which page is clicked on
/** Row numbers */
int rowNumber = 1;
if(row != 0) {
rowNumber = row + 1;
}
/** Declare String with sql select syntax, set limit to 15 records per page */
String sqlQuery = " SELECT * FROM `movies` LIMIT " + row + ", " + rowsPerPage + " " ;
String sqlCount = " SELECT COUNT(*) FROM `movies` ";
ResultSet rs = null; // ResultSet object
/** Initialize PreparedStatement and pass sql string to it */
try(PreparedStatement prepStatement = mysqlConnect.prepareStatement(sqlQuery)) {
rs = prepStatement.executeQuery(); // execute PreparedStatement
while(rs.next()) { // while result set contains data
int id = rs.getInt("movieID");
String movieTitle = rs.getString("movieTitle"); // Assign movieTitle from the DB to the string variable
if(movieTitle.length() > 25) {
movieTitle = movieTitle.substring(0, 25) + " ...";
}
String titleTrimmed = movieTitle.replaceAll("\\s", ""); // Remove empty spaces between words
int year = rs.getInt("year"); // Assign year from the DB to the int year variable
String genre = rs.getString("genre"); // Do same for rest
if(genre.length() > 15) {
genre = genre.substring(0, 15) + " ...";
}
double rating = rs.getDouble("rating"); // Obtain rating from the DB
DecimalFormat decFormat = new DecimalFormat("#.00"); // Format double value into two decimal places
rating = Double.valueOf(decFormat.format(rating)); // parse back decimal format object into double
int votes = rs.getInt("votes");
String cast = rs.getString("cast");
if(cast.length() > 20) { // If length of the "cast" exceeds 20 characters...
cast = cast.substring(0, 20) + " ..."; // ...show only first 25 characters
}
String director = rs.getString("director");
if(director.length() > 25) {
director = director.substring(0, 25) + " ...";
}
String description = rs.getString("description");
if(description.length() > 25) { // If length of the "description" exceeds 25 chars...
description = description.substring(0, 25) + " ..."; // ...show first 25 chars
}
/** Initialize Movie constructor, and pass data from the database */
Movie movie = new Movie(id, rowNumber, movieTitle, year, genre, rating, votes, cast, director, description);
moviesList.add(movie); // add data to the ArrayList
movie.setTitleTrimmed(titleTrimmed);
rowNumber++;
// Blob imageBlob = rs.getBlob("photo"); // get image using Blob object
// InputStream binaryStream = imageBlob.getBinaryStream(); // Retrieve binary data of the image blob using getBinaryStream()
// ByteArrayOutputStream outByteArray = new ByteArrayOutputStream();
// /** Saving path of the file on your computer (c:/users/beyon/images) */
// OutputStream outputStream = new FileOutputStream(System.getProperty("user.home") + "/images/" + id + ".jpg");
//
// /** Get length of the image */
// int length = (int) imageBlob.length();
//
// /** Create byte[] array */
// byte[] buffer = new byte[1024];
//
// System.out.println("write to has been invoked.");
// while ((length = binaryStream.read(buffer)) != -1) {
//// System.out.println("writing " + length + " bytes");
// outByteArray.write(buffer, 0, length);
// }
// outByteArray.writeTo(outputStream); // Write image content from ByteArrayOutputStream to the OutputStream
}
rs.close();
/** Obtain number of records from the movies table */
rs = prepStatement.executeQuery(sqlCount);
rs.next();
int rowsCount = rs.getInt(1); // get count
/** Get number of pages for pagination */
double numbOfPages = (double) rowsCount / rowsPerPage; // divide count by 10, to get decimal number
int pages = (int) Math.ceil(numbOfPages); // rounding up to the next whole number
Movie.setNumberOfPages(pages); // set number of pages
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
return moviesList; // return ArrayList of movies
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Display movie
* @param movieId
* @param mysqlConnect
* @return
*/
public Movie[] showMovie(int movieId, Connection mysqlConnect) {
Movie[] getMovie = new Movie[1];
String sqlQuery = " SELECT * FROM `movies` WHERE `movieID` = '" + movieId + "' ";
ResultSet rs = null;
try(PreparedStatement prepStatement = mysqlConnect.prepareStatement(sqlQuery)) {
rs = prepStatement.executeQuery();
while(rs.next()) {
int id = rs.getInt("movieID");
String movieTitle = rs.getString("movieTitle"); // Assign movieTitle from the DB to the string variable
int year = rs.getInt("year"); // Assign year from the DB to the int year variable
String genre = rs.getString("genre"); // Do same for rest
double rating = rs.getDouble("rating");
DecimalFormat decFormat = new DecimalFormat("#.00");
rating = Double.valueOf(decFormat.format(rating));
int votes = rs.getInt("votes");
String cast = rs.getString("cast");
String director = rs.getString("director");
String description = rs.getString("description");
getMovie[0] = new Movie(id, movieTitle, year, genre, rating, votes, cast, director, description);
}
} catch (SQLException e) {
e.printStackTrace();
}
return getMovie;
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Check if user is already rated current movie
* @param userId
* @param movieId
* @param mysqlConnect
* @return
*/
public boolean isAlreadyVoted(int userId, int movieId, Connection mysqlConnect) {
String sqlSelect = " SELECT * FROM `user_votes` ";
ResultSet rs = null;
try(PreparedStatement statementSelect = mysqlConnect.prepareStatement(sqlSelect)) {
rs = statementSelect.executeQuery();
while(rs.next()) {
int idUser = rs.getInt("userID");
int idMovie = rs.getInt("movieID");
if((idUser == userId) && (idMovie == movieId)) {
System.out.println("You already submitted rate for this movie!!!");
return true;
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Rate movie
* @param userId
* @param movieId
* @param rating
* @param mysqlConnect
*/
public void vote(int userId, int movieId, int rating, Connection mysqlConnect) {
String sqlInsert = " INSERT INTO `user_votes`(`userID`, `movieID`, `rating`) VALUES(?, ?, ?) ";
try(PreparedStatement statementInsert = mysqlConnect.prepareStatement(sqlInsert)) {
statementInsert.setInt(1, userId);
statementInsert.setInt(2, movieId);
statementInsert.setInt(3, rating);
statementInsert.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Retrieve user's rating for current movie
* @param userId
* @param movieId
* @param mysqlConnect
* @return
*/
public int getUsersRating(int userId, int movieId, Connection mysqlConnect) {
int yourRating = 0;
String sqlSelect = " SELECT * FROM `user_votes` ";
ResultSet rs = null;
try(PreparedStatement statementSelect = mysqlConnect.prepareStatement(sqlSelect)) {
rs = statementSelect.executeQuery();
while(rs.next()) {
int idUser = rs.getInt("userID");
int idMovie = rs.getInt("movieID");
if((idUser == userId) && (idMovie == movieId)) {
yourRating = rs.getInt("rating");
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return yourRating;
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Update ratings
* @param movieId
* @param ratingNumber
* @param mysqlConnect
*/
public void updateVotes(int movieId, int ratingNumber, Connection mysqlConnect) {
String sqlUpdate = " UPDATE `movies` SET `votes` = `votes` + 1, `overallPoints` = `overallPoints` + '" + ratingNumber + "', "
+ " `rating` = `overallPoints` / `votes` "
+ " WHERE `movieID` = '" + movieId + "' ";
try(PreparedStatement statementUpdate = mysqlConnect.prepareStatement(sqlUpdate)) {
statementUpdate.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Return logged user's ID
* @param userName
* @param mysqlConnect
* @return
*/
public int getUserId(String userName, Connection mysqlConnect) {
int userId = 0;
String sqlSelect = " SELECT `userID` FROM `users` WHERE `userName` = '" + userName + "' ";
ResultSet rs = null;
try(PreparedStatement prepStatement = mysqlConnect.prepareStatement(sqlSelect)) {
rs = prepStatement.executeQuery();
while(rs.next()) {
userId = rs.getInt("userID");
}
} catch (SQLException e) {
e.printStackTrace();
}
return userId;
}
///////////////////////////////////////////////////////////////////////////////////////////
/**
* Get Search Results
* @param query
* @param mysqlConnect
* @return
*/
public ArrayList<Movie> searchResults(String query, Connection mysqlConnect) {
ArrayList<Movie> listResults = new ArrayList<>();
ResultSet rs = null;
String sqlSelect = " SELECT * FROM `movies` ";
try(PreparedStatement prepStat = mysqlConnect.prepareStatement(sqlSelect)) {
rs = prepStat.executeQuery();
while(rs.next()) {
int id = rs.getInt("movieID");
String movieTitle = rs.getString("movieTitle");
if(movieTitle.length() > 25) {
movieTitle = movieTitle.substring(0, 25) + " ...";
}
int year = rs.getInt("year");
String genre = rs.getString("genre");
if(genre.length() > 15) {
genre = genre.substring(0, 15) + " ...";
}
double rating = rs.getDouble("rating");
int votes = rs.getInt("votes");
String cast = rs.getString("cast");
// String castSearch = cast; // Copy cast into castSearch for searching by cast members
if(cast.length() > 25) { // If length of the "cast" exceeds 25 characters...
cast = cast.substring(0, 25) + " ..."; // ...show only first 25 characters
}
String director = rs.getString("director");
if(director.length() > 25) {
director = director.substring(0, 25) + " ...";
}
String description = rs.getString("description");
if(description.length() > 25) { // If length of the "description" exceeds 25 chars...
description = description.substring(0, 25) + " ..."; // ...show first 25 chars
}
Movie getResult = new Movie(id, movieTitle, year, genre, rating, votes, cast, director, description);
/** If length of the query is only one letter */
if(query.length() < 2) {
/** Check if only first letter matches in movie title */
if(movieTitle.matches("(?i:" + query + ".*)")) {
listResults.add(getResult);
}
} else { // otherwise, match query before and after query
/** Use "(?i:X)" - case insensitive pattern to ignore case letters */
if(movieTitle.matches("(?i:.*" + query + ".*)")) {
listResults.add(getResult);
}
}
}
} catch (SQLException e) {
e.printStackTrace();
}
return listResults;
}
///////////////////////////////////////////////////////////////////////////////////////////
}
| [
"[email protected]"
]
| |
c1dd69d64de46da71f6fce6b8f52705f9251d910 | 3b852385680224459d33055b9ffd000eb70b52d1 | /Dubbing/src/main/java/com/liubowang/dubbing/HunYin/FileAlertDialog.java | 88904d9bc8f38e0d22f6b6ee7dc03ba085c65365 | []
| no_license | 439ED537979D8E831561964DBBBD7413/xuexiziliao | 22c9337529d55b8904b44c47ec100e00564a6e9d | 482a7db13fb4ac71750d5cf2d1784dbbb410c899 | refs/heads/master | 2020-06-18T16:04:07.343923 | 2017-11-13T08:09:35 | 2017-11-13T08:09:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,360 | java | package com.liubowang.dubbing.HunYin;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.StyleRes;
import android.view.Display;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import com.liubowang.dubbing.R;
/**
* Created by heshaobo on 2017/10/27.
*/
public class FileAlertDialog extends AlertDialog implements View.OnClickListener{
private Context context;
private Button videoButton;
private Button musicButton;
private OnActionListener actionListener;
protected FileAlertDialog(Context context) {
super(context);
this.context = context;
}
protected FileAlertDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
this.context = context;
}
protected FileAlertDialog(Context context, @StyleRes int themeResId) {
super(context, themeResId);
this.context = context;
}
public void setActionListener(OnActionListener actionListener) {
this.actionListener = actionListener;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_file_dialog);
videoButton = findViewById(R.id.b_video_dl);
videoButton.setOnClickListener(this);
musicButton = findViewById(R.id.b_music_dl);
musicButton.setOnClickListener(this);
}
@Override
public void show() {
Window dialogWindow = getWindow();
WindowManager.LayoutParams p = dialogWindow.getAttributes(); // 获取对话框当前的参数值
p.gravity = Gravity.BOTTOM;
dialogWindow.setAttributes(p);
super.show();
}
@Override
public void onClick(View view) {
if (actionListener == null) return;
if (view.getId() == R.id.b_music_dl){
actionListener.onMusicAction();
}
else if (view.getId() == R.id.b_video_dl){
actionListener.onVideoAction();
}
}
interface OnActionListener{
void onVideoAction();
void onMusicAction();
}
}
| [
"[email protected]"
]
| |
d0757bfcdb9f57d4563b6531518065a82d601741 | eed99867f28267a41e5a27f22f06a5b8a4f7a207 | /Selenium/src/TestNgEx/SessionIdEx.java | ced39948dee61bccba2b6e78eea35e41fb08d678 | []
| no_license | krishnabelagam1/Selenium | 5d390c83b39cd060352b3116faaa1252737d7b99 | e0312ad96e5f7a088236885eae1ed9037a7d8e95 | refs/heads/master | 2020-04-24T07:09:27.662102 | 2019-05-14T09:26:31 | 2019-05-14T09:26:31 | 171,788,928 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,109 | java | package TestNgEx;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class SessionIdEx {
@Test
public void executSessionOne() {
// First session of WebDriver
WebDriver driver = new ChromeDriver();
// Goto guru99 site
driver.get("http://demo.guru99.com/V4/");
// find user name text box and fill it
driver.findElement(By.name("uid")).sendKeys("Driver 1");
}
@Test
public void executeSessionTwo() {
// Second session of WebDriver
WebDriver driver = new ChromeDriver();
// Goto guru99 site
driver.get("http://demo.guru99.com/V4/");
// find user name text box and fill it
driver.findElement(By.name("uid")).sendKeys("Driver 2");
}
@Test
public void executSessionThree() {
// Third session of WebDriver
WebDriver driver = new ChromeDriver();
// Goto guru99 site
driver.get("http://demo.guru99.com/V4/");
// find user name text box and fill it
driver.findElement(By.name("uid")).sendKeys("Driver 3");
}
}
| [
"Dell@DESKTOP-HBF7D93"
]
| Dell@DESKTOP-HBF7D93 |
42fb5404bf2fee166b585040f811d0ef0abd67bb | ff4e606f2d1b8435d346540e60ac8dc6721c79ba | /presto-hdfs/src/main/java/com/facebook/presto/hdfs/HDFSConnectorId.java | 73e72c42a65198c302da877dbacda0d0bbebc92c | [
"Apache-2.0"
]
| permissive | blankroom/presto | 68083a3ce0d24c38c8202b7830f5340bce7b29c6 | 2d0857534fffc9797af2b708a6bab58227a4958e | refs/heads/master | 2021-01-11T07:36:34.366687 | 2016-12-14T12:05:43 | 2016-12-14T12:05:43 | 82,787,076 | 0 | 0 | null | 2017-04-04T07:48:01 | 2017-02-22T09:38:58 | Java | UTF-8 | Java | false | false | 1,475 | 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 com.facebook.presto.hdfs;
import java.util.Objects;
import static java.util.Objects.requireNonNull;
/**
* @author [email protected]
*/
public class HDFSConnectorId
{
private final String connectorId;
public HDFSConnectorId(String connectorId)
{
requireNonNull(connectorId, "connectorId is null");
this.connectorId = connectorId;
}
@Override
public int hashCode()
{
return Objects.hash(connectorId);
}
@Override
public boolean equals(Object obj)
{
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
HDFSConnectorId other = (HDFSConnectorId) obj;
return Objects.equals(this.connectorId, other.connectorId);
}
@Override
public String toString()
{
return connectorId;
}
}
| [
"[email protected]"
]
| |
aa7ea17ad4a85dd7e8bdf79f7b4aed26a5405c6e | 0429d90be93613772efa0d3f088f03f8ef7770c1 | /src/main/java/Logic/Features/NumberOfKeywords3.java | 93347c756461e6fb5670e761fc242b23e1f547c5 | []
| no_license | BartlomiejSzewczyk/KSR | b114a422ab60deee7a43b8b1e77603e9e9441f12 | 3584f243c3bdec53a2d1d78ccbee6396cdd2f368 | refs/heads/master | 2022-05-30T20:56:00.178047 | 2019-06-02T17:32:51 | 2019-06-02T17:32:51 | 178,479,675 | 0 | 0 | null | 2022-05-20T20:58:21 | 2019-03-29T21:50:11 | Java | UTF-8 | Java | false | false | 938 | java | package Logic.Features;
import java.util.List;
import java.util.Map;
public class NumberOfKeywords3 implements IFeature {
private List<List<String>> listOfKeyWord;
public NumberOfKeywords3(List<List<String>> listOfKeyWord){
this.listOfKeyWord = listOfKeyWord;
}
@Override
public double count(List<String> listOfWords) {
double howManyKeyWords = 0;
if(listOfKeyWord.get(2).size() > 0){
for (String word : listOfWords) {
for(int i = 0; i < listOfKeyWord.get(2).size() ; ++i){
if(word.equals(listOfKeyWord.get(2).get(i))){
++howManyKeyWords;
}
}
}
}
return howManyKeyWords;
// return howManyKeyWords/(double)listOfWords.size();
}
@Override
public Map<String, Integer> count(Map<List<String>, String> data) {
return null;
}
}
| [
"[email protected]"
]
| |
c2adf31490a99e209928727bf94977065bfd5e43 | 0fff4cd12b37d085c2b9be3a1ccd24a81f61b042 | /src/main/java/lehjr/numina/client/config/IMeterConfig.java | e60b177220dabcae231863a16e969fb0922903db | [
"BSD-2-Clause"
]
| permissive | lehjr/MachineMusePowersuits | 673e0c9ab40ff5fa220813b0c78aa99ad54cb794 | 082834036cf665a5ccdf5fe34c9e59937dce612b | refs/heads/1.19.2 | 2023-09-01T08:03:35.603524 | 2023-08-29T10:54:11 | 2023-08-29T10:54:11 | 323,434,512 | 11 | 9 | NOASSERTION | 2023-08-20T23:34:57 | 2020-12-21T19:54:53 | Java | UTF-8 | Java | false | false | 310 | java | package lehjr.numina.client.config;
import lehjr.numina.common.math.Color;
public interface IMeterConfig {
default float getDebugValue() {
return 0;
}
default Color getGlassColor() {
return Color.WHITE;
}
default Color getBarColor() {
return Color.WHITE;
}
} | [
"[email protected]"
]
| |
4dd7e459d4be61b9d946fd01d11a01015779691a | ec4981a08438e4982d555be8b6fc9f63c5f9fe17 | /gen/kg/max/android/gpstracker/R.java | 845d8dc76ee7e381bab8368e5c38ee4a2e4059fc | []
| no_license | pMax89/GPSTracker | 52f7a1735eb27a10d2a50a24107002742e71c899 | 12ec5c47f695a000193110a74e6ea93c00511922 | refs/heads/master | 2021-01-10T00:54:54.985705 | 2012-11-12T11:54:49 | 2012-11-12T11:54:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,840 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package kg.max.android.gpstracker;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
public static final int item=0x7f020001;
}
public static final class id {
public static final int m_vwMap=0x7f060000;
}
public static final class layout {
public static final int map_layout=0x7f030000;
}
public static final class menu {
public static final int menu=0x7f050000;
}
public static final class string {
public static final int app_name=0x7f040000;
public static final int enableGPS=0x7f040007;
/** Load/Save strings
*/
public static final int geoPathFileName=0x7f04000a;
public static final int load=0x7f040004;
public static final int loadFailed=0x7f04000f;
public static final int loadNoFile=0x7f040010;
public static final int loadSuccess=0x7f04000e;
public static final int mapApiKey=0x7f040001;
/** CameraPreview Result strings
*/
public static final int pictureFail=0x7f040008;
public static final int pictureSuccess=0x7f040009;
public static final int save=0x7f040005;
public static final int saveFailed=0x7f04000c;
public static final int saveNoData=0x7f04000d;
public static final int saveSuccess=0x7f04000b;
/** MenuItem titles
*/
public static final int startRecording=0x7f040002;
public static final int stopRecording=0x7f040003;
public static final int takePicture=0x7f040006;
}
}
| [
"[email protected]"
]
| |
83510e16793567a5de507373bd31208aa97f636d | 1feb56f4daad3ac4eba9b3b52fb5f1209c5a9b9a | /cloudalibaba-provider-payment9001/src/main/java/com/atguigu/springcloud/controller/PaymentController.java | 6f5fcb60d6e3d9452d02281f5d41c3c265dd100f | []
| no_license | BNUZ-YOscar/cloud2020 | 63d58c49ef17417efe993ebf4bc6913b95186151 | adc9c11809b174256b7c4243c901d956a992262e | refs/heads/master | 2023-03-18T10:12:47.506275 | 2021-03-03T09:31:33 | 2021-03-03T09:31:33 | 340,594,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package com.atguigu.springcloud.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class PaymentController {
@Value("${server.port}")
private String serverPort;
@GetMapping(value = "/payment/nacos/{id}")
public String getPayment(@PathVariable("id") Integer id) {
return "Hello Nacos Discovery: " + serverPort + " \t id: " + id;
}
}
| [
"[email protected]"
]
| |
70a6dad558185706e49de92f6fa0d90d5c42ddaa | d390ed66ed762370c516ce41aa76f62804110e01 | /src/vector_bank/pkg12/pkg03/pkg2018/summary.java | a199b742cbe43c09e461255a877e6542112cf0ff | []
| no_license | technophile1199/Vector-Bank | 92ac4371019bb4801c7ab682a12754fa4cb5e6fe | 89af94339d4790ece3ae5d586cae986528b9879c | refs/heads/master | 2023-03-02T19:57:11.989232 | 2021-02-16T02:21:27 | 2021-02-16T02:21:27 | 339,262,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,448 | java | package vector_bank.pkg12.pkg03.pkg2018;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.LayoutManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.Timer;
import javax.swing.table.DefaultTableModel;
public class summary extends javax.swing.JFrame {
int xMouse, yMouse;
int s_id;
String s_time = "";
String s_path = "";
String transaction_details;
int amount, summary_balance;
int temp = 0, val = 0;
String summary_time;
private Timer t;
private ActionListener al;
public summary() {
initComponents();
}
public summary(int id) throws Exception {
initComponents();
al=new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if(jProgressBar1.getValue()<100) {
jProgressBar1.setValue(jProgressBar1.getValue()+10);
try{Thread.sleep(5);}catch(Exception ev){}
}
else {
t.stop();
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/vector_bank", "root", "");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from summary where ID=" +s_id + " order by Transaction_ID DESC");
while (rs.next()) {
transaction_details = rs.getString(1);
amount = rs.getInt(2);
summary_balance = rs.getInt(3);
summary_time = rs.getString(4);
DefaultTableModel m = (DefaultTableModel) jTable1.getModel();
m.addRow(new Object[]{transaction_details, amount, summary_balance, summary_time});
}
}
catch(Exception ev) {
}
System.out.println("Done");
}
}
};
t=new Timer(200,al);
s_id = id;
Logout.setVisible(false);
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/vector_bank", "root", "");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from create_Account where ID=" + id + "");
while (rs.next()) {
s_path = rs.getString(7);
int constructor_bal = rs.getInt(10);
rs = st.executeQuery("select * from register_login where ID=" + id + "");
while (rs.next()) {
s_time = rs.getString(5);
jLabel3.setText(" Total Balance : " + constructor_bal);
ImageIcon img = new ImageIcon(s_path);
Image im = img.getImage();
Image newimg = im.getScaledInstance(Profile_Pic.getWidth(), Profile_Pic.getWidth(), Image.SCALE_SMOOTH);
ImageIcon image = new ImageIcon(newimg);
Profile_Pic.setIcon(image);
}
}
/*rs = st.executeQuery("select * from summary where ID=" +s_id + " order by Transaction_ID DESC");
while (rs.next()) {
transaction_details = rs.getString(1);
amount = rs.getInt(2);
summary_balance = rs.getInt(3);
summary_time = rs.getString(4);
DefaultTableModel m = (DefaultTableModel) jTable1.getModel();
m.addRow(new Object[]{transaction_details, amount, summary_balance, summary_time});
// }*/
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory("vector_bank?zeroDateTimeBehavior=convertToNullPU").createEntityManager();
summary_1Query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery("SELECT s FROM Summary_1 s");
summary_1List = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : summary_1Query.getResultList();
Minimize = new javax.swing.JLabel();
Cross = new javax.swing.JLabel();
Upper_Layer = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
Back_btn = new javax.swing.JLabel();
Logout = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jLabel2 = new javax.swing.JLabel();
jProgressBar1 = new javax.swing.JProgressBar();
Profile_Pic = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
Minimize.setFont(new java.awt.Font("Times New Roman", 1, 48)); // NOI18N
Minimize.setForeground(new java.awt.Color(255, 255, 255));
Minimize.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Minimize.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
MinimizeMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
MinimizeMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
MinimizeMouseExited(evt);
}
});
getContentPane().add(Minimize, new org.netbeans.lib.awtextra.AbsoluteConstraints(940, 0, 40, 40));
Cross.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
Cross.setForeground(new java.awt.Color(255, 255, 255));
Cross.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Cross.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
CrossMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
CrossMouseEntered(evt);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
CrossMouseExited(evt);
}
});
getContentPane().add(Cross, new org.netbeans.lib.awtextra.AbsoluteConstraints(980, 0, 40, 40));
Upper_Layer.setFont(new java.awt.Font("Times New Roman", 1, 14)); // NOI18N
Upper_Layer.setCursor(new java.awt.Cursor(java.awt.Cursor.MOVE_CURSOR));
Upper_Layer.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
public void mouseDragged(java.awt.event.MouseEvent evt) {
Upper_LayerMouseDragged(evt);
}
});
Upper_Layer.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
Upper_LayerMousePressed(evt);
}
});
getContentPane().add(Upper_Layer, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1020, 40));
jLabel3.setFont(new java.awt.Font("AR JULIAN", 1, 18)); // NOI18N
getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 160, 660, 30));
Back_btn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Back_btn.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
Back_btnMouseClicked(evt);
}
});
getContentPane().add(Back_btn, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 200, 80, 60));
Logout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Backgroung_Images/logoutnew.png"))); // NOI18N
Logout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Logout.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
LogoutMouseClicked(evt);
}
});
getContentPane().add(Logout, new org.netbeans.lib.awtextra.AbsoluteConstraints(880, 180, -1, -1));
jTable1.setFont(new java.awt.Font("AR JULIAN", 1, 14)); // NOI18N
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Transaction_Details", "Amount", "Total Balance Left", "Time"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
jScrollPane1.setViewportView(jTable1);
if (jTable1.getColumnModel().getColumnCount() > 0) {
jTable1.getColumnModel().getColumn(0).setResizable(false);
jTable1.getColumnModel().getColumn(1).setResizable(false);
jTable1.getColumnModel().getColumn(3).setResizable(false);
}
getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 360, 1020, 230));
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Backgroung_Images/New_Refresh_03.jpg"))); // NOI18N
jLabel2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel2MouseClicked(evt);
}
});
getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(820, 310, 180, 40));
jProgressBar1.setCursor(new java.awt.Cursor(java.awt.Cursor.WAIT_CURSOR));
jProgressBar1.setStringPainted(true);
getContentPane().add(jProgressBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(590, 320, 200, 30));
Profile_Pic.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
Profile_Pic.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
Profile_PicMouseClicked(evt);
}
public void mouseEntered(java.awt.event.MouseEvent evt) {
Profile_PicMouseEntered(evt);
}
});
getContentPane().add(Profile_Pic, new org.netbeans.lib.awtextra.AbsoluteConstraints(880, 50, 125, 130));
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Backgroung_Images/myacc_s.jpg"))); // NOI18N
jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jLabel1MouseClicked(evt);
}
});
getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void Upper_LayerMouseDragged(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Upper_LayerMouseDragged
int x = evt.getXOnScreen();
int y = evt.getYOnScreen();
this.setLocation(x - xMouse, y - yMouse);
}//GEN-LAST:event_Upper_LayerMouseDragged
private void Upper_LayerMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Upper_LayerMousePressed
// TODO add your handling code here:
xMouse = evt.getX();
yMouse = evt.getY();
}//GEN-LAST:event_Upper_LayerMousePressed
private void Back_btnMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Back_btnMouseClicked
// TODO add your handling code here:
try {
MyAccount m1 = new MyAccount(s_id);
m1.setVisible(true);
this.setVisible(false);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Error In MyAccount");
}
}//GEN-LAST:event_Back_btnMouseClicked
private void LogoutMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_LogoutMouseClicked
// TODO add your handling code here:
Login l = new Login();
l.setVisible(true);
this.setVisible(false);
}//GEN-LAST:event_LogoutMouseClicked
private void MinimizeMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MinimizeMouseClicked
this.setState(ICONIFIED);
}//GEN-LAST:event_MinimizeMouseClicked
private void MinimizeMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MinimizeMouseEntered
Minimize.setForeground(Color.red);
}//GEN-LAST:event_MinimizeMouseEntered
private void MinimizeMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_MinimizeMouseExited
Minimize.setForeground(Color.WHITE);
}//GEN-LAST:event_MinimizeMouseExited
private void CrossMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CrossMouseClicked
System.exit(0);
}//GEN-LAST:event_CrossMouseClicked
private void CrossMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CrossMouseEntered
Cross.setForeground(Color.red);
}//GEN-LAST:event_CrossMouseEntered
private void CrossMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CrossMouseExited
Cross.setForeground(Color.WHITE);
}//GEN-LAST:event_CrossMouseExited
private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked
// TODO add your handling code here:
Logout.setVisible(false);
}//GEN-LAST:event_jLabel1MouseClicked
private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel2MouseClicked
// TODO add your handling code here:
t.start();
}//GEN-LAST:event_jLabel2MouseClicked
private void Profile_PicMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Profile_PicMouseClicked
// TODO add your handling code here:
Logout.setVisible(true);
}//GEN-LAST:event_Profile_PicMouseClicked
private void Profile_PicMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_Profile_PicMouseEntered
// TODO add your handling code here:
Logout.setVisible(true);
}//GEN-LAST:event_Profile_PicMouseEntered
public void iterate() {
}
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(summary.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(summary.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(summary.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(summary.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new summary().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel Back_btn;
private javax.swing.JLabel Cross;
private javax.swing.JLabel Logout;
private javax.swing.JLabel Minimize;
private javax.swing.JLabel Profile_Pic;
private javax.swing.JLabel Upper_Layer;
private javax.persistence.EntityManager entityManager;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JProgressBar jProgressBar1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private java.util.List<vector_bank.pkg12.pkg03.pkg2018.Summary_1> summary_1List;
private javax.persistence.Query summary_1Query;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
fb7d5d5938249a3f6bd5d1450dcf1240bb1fe2b6 | 035d2685d65e472b060156669a6a771aed341bb6 | /JTServer/Unit2.java | 005294162019bb08214150c3d121d13daf6e8d02 | []
| no_license | bbblitz/Just-Tactics | 364328c43cb3a03b1f1a76ff5307bf0ad770f422 | e75d329cd61ee65a95d80e8bf2e302c401a9ef8e | refs/heads/master | 2021-01-23T02:53:34.562069 | 2013-04-28T17:58:23 | 2013-04-28T17:58:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 214 | java | package JTServer;
public class Unit2 extends Character {
public Unit2(Location loc, int player) {
super(loc, player);
this.graphicID = 5;
this.health = 50;
this.attackDamage = 5;
this.speed = 3;
}
}
| [
"[email protected]"
]
| |
3ca1a7e4e0794c8a6cb7f9a48a8c2ddaf03159ed | 1b1af5868713e6d688046f9c7d767864756b558e | /app/src/main/java/com/sunrise/treadmill/activity/workout/running/HRCRunningActivity.java | a5a7b61148a908e8b20efe42540bfacb9013f4d9 | []
| no_license | ChuHuiApp/TreadMill | b0c9247f68d03ca6c987b02b8f6848f28707357d | 4c64995e6464fd505d03b08bec0fbe15668c0a7a | refs/heads/master | 2021-08-30T18:32:08.476162 | 2017-11-27T08:00:59 | 2017-11-27T08:00:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,883 | java | package com.sunrise.treadmill.activity.workout.running;
import android.widget.ImageView;
import com.sunrise.treadmill.R;
import com.sunrise.treadmill.utils.ImageUtils;
/**
* Created by ChuHui on 2017/9/27.
*/
public class HRCRunningActivity extends BaseRunningActivity {
@Override
public void init() {
super.init();
ImageUtils.changeImageView((ImageView) bottomView.findViewById(R.id.workout_running_level_up), R.drawable.btn_sportmode_up_3);
ImageUtils.changeImageView((ImageView) bottomView.findViewById(R.id.workout_running_level_down), R.drawable.btn_sportmode_down_3);
}
@Override
protected void setUpInfo() {
super.setUpInfo();
runningDistanceTarget = Integer.valueOf(workOutInfo.getDistance());
runningDistanceTotal = Integer.valueOf(workOutInfo.getRunningDistance());
runningDistanceSurplus = runningDistanceTarget - runningDistanceTotal;
headView.setDistanceValue(runningDistanceTotal + "");
runningCaloriesTarget = Integer.valueOf(workOutInfo.getCalories());
runningCaloriesTotal = Integer.valueOf(workOutInfo.getRunningCalories());
runningCaloriesSurplus = runningCaloriesTarget - runningCaloriesTotal;
headView.setCaloriesValue(runningCaloriesTotal + "");
headView.setPulseValue(runningPulseTarget + "");
headView.setWattValue(valueWatt + "");
headView.setSpeedValue(valueSpeed + "");
}
@Override
public void onStartTypeA() {
drawLevelView();
bindServer();
showCountDownDialog();
}
@Override
public void onStartTypeB() {
drawLevelView();
bindServer();
runningTimer.start();
}
@Override
public void onStartTypeC() {
}
@Override
public void onLevelUp() {
}
@Override
public void onLevelDown() {
}
}
| [
"[email protected]"
]
| |
1ff4d0ceda9b3e2f7aa594b4ec92021b0d496ae0 | 42878a543b4a1a3deb4c3aba0836e0f837d5712c | /google-cloud-spanner/src/main/java/com/google/cloud/spanner/InstanceConfig.java | 9b96dda4df73a4ca6d17fc21611f088146b1312a | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
]
| permissive | googleapis/java-spanner | defa282fe5f99c1c9e724441eff420b7704d7714 | 465df7bad12fbea7dbcf6dbabb1b29d088c42665 | refs/heads/main | 2023-09-04T04:53:41.217563 | 2023-08-31T13:09:29 | 2023-08-31T13:09:29 | 203,461,499 | 46 | 90 | Apache-2.0 | 2023-09-14T20:38:20 | 2019-08-20T22:07:45 | Java | UTF-8 | Java | false | false | 4,316 | java | /*
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.spanner;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Represents a Cloud Spanner instance config.{@code InstanceConfig} adds a layer of service related
* functionality over {@code InstanceConfigInfo}.
*/
public class InstanceConfig extends InstanceConfigInfo {
private final InstanceAdminClient client;
/** Builder of {@code InstanceConfig}. */
public static class Builder extends InstanceConfigInfo.BuilderImpl {
private final InstanceAdminClient client;
Builder(InstanceConfig instanceConfig) {
super(instanceConfig);
this.client = instanceConfig.client;
}
Builder(InstanceAdminClient client, InstanceConfigId id) {
super(id);
this.client = client;
}
@Override
public Builder setDisplayName(String displayName) {
super.setDisplayName(displayName);
return this;
}
@Override
protected Builder setReplicas(List<ReplicaInfo> replicas) {
super.setReplicas(replicas);
return this;
}
@Override
public Builder setLeaderOptions(List<String> leaderOptions) {
super.setLeaderOptions(leaderOptions);
return this;
}
@Override
protected Builder setOptionalReplicas(List<ReplicaInfo> optionalReplicas) {
super.setOptionalReplicas(optionalReplicas);
return this;
}
@Override
protected Builder setBaseConfig(InstanceConfigInfo baseConfig) {
super.setBaseConfig(baseConfig);
return this;
}
@Override
protected Builder setConfigType(Type configType) {
super.setConfigType(configType);
return this;
}
@Override
protected Builder setState(State state) {
super.setState(state);
return this;
}
@Override
public Builder setEtag(String etag) {
super.setEtag(etag);
return this;
}
@Override
protected Builder setReconciling(boolean reconciling) {
super.setReconciling(reconciling);
return this;
}
@Override
public Builder addLabel(String key, String value) {
super.addLabel(key, value);
return this;
}
@Override
public Builder putAllLabels(Map<String, String> labels) {
super.putAllLabels(labels);
return this;
}
@Override
public Builder addReadOnlyReplicas(List<ReplicaInfo> readOnlyReplicas) {
super.addReadOnlyReplicas(readOnlyReplicas);
return this;
}
@Override
public InstanceConfig build() {
return new InstanceConfig(this);
}
}
public static Builder newBuilder(InstanceConfig instanceConfig) {
return new Builder(instanceConfig);
}
public static Builder newBuilder(InstanceAdminClient client, InstanceConfigId instanceConfigId) {
return new Builder(client, instanceConfigId);
}
/** Use {@link #newBuilder} instead */
@Deprecated
public InstanceConfig(InstanceConfigId id, String displayName, InstanceAdminClient client) {
this(id, displayName, Collections.emptyList(), Collections.emptyList(), client);
}
/** Use {@link #newBuilder} instead */
@Deprecated
public InstanceConfig(
InstanceConfigId id,
String displayName,
List<ReplicaInfo> replicas,
List<String> leaderOptions,
InstanceAdminClient client) {
super(id, displayName, replicas, leaderOptions);
this.client = client;
}
InstanceConfig(Builder builder) {
super(builder);
this.client = builder.client;
}
/** Gets the current state of this instance config. */
public InstanceConfig reload() {
return client.getInstanceConfig(getId().getInstanceConfig());
}
@Override
public Builder toBuilder() {
return new Builder(this);
}
}
| [
"[email protected]"
]
| |
c622b9ebfc2a48fbd962a697d588c1f89a46cc0c | f242369cb362f1009a47d17214b389d405dfe9b3 | /TestAutomation/project/org/martus/client/swingui/actions/ActionMenuChangeUserNamePassword.java | 7f3fe428564b96d603d43a6f970f0d117bee6ba2 | []
| no_license | CSCI-362-02-2016/HABA | eb06c094f9b1b2bde9956d5d684b0460cc82fa4f | faac30eb4cd2d333ddb73807b6cdcb11fdc0ff06 | refs/heads/master | 2021-05-01T01:25:46.876250 | 2016-12-01T15:51:57 | 2016-12-01T15:51:57 | 66,593,286 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,380 | java | /*
The Martus(tm) free, social justice documentation and
monitoring software. Copyright (C) 2005-2007, Beneficent
Technology, Inc. (The Benetech Initiative).
Martus is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later
version with the additions and exceptions described in the
accompanying Martus license file entitled "license.txt".
It is distributed WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, including warranties of fitness of purpose or
merchantability. See the accompanying Martus License and
GPL license for more details on the required license terms
for this software.
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.
*/
package org.martus.client.swingui.actions;
import java.awt.event.ActionEvent;
import org.martus.client.swingui.UiMainWindow;
public class ActionMenuChangeUserNamePassword extends UiMenuAction
{
public ActionMenuChangeUserNamePassword(UiMainWindow mainWindowToUse)
{
super(mainWindowToUse, "changeUserNamePassword");
}
public void actionPerformed(ActionEvent ae)
{
mainWindow.doChangeUserNamePassword();
}
} | [
"[email protected]"
]
| |
8c6e976e8060f6ae47263c12d907ed12a1af7641 | 37c5eaa46e9c1686b6427b9d31c8227bc0cd25c0 | /Student_App/app/src/main/java/com/example/prattoy/student/LocationActivity.java | cc708e0074ecd9a8fe517aa86c535fa0ea01abad | []
| no_license | prattoy29/MBSTU_Bus_Tracking_System | 5e2f7afea9a84eb9d0d97eae2b8de5c142b94a8d | d10f006679fb71f0c77d73d2f75af98983b192ff | refs/heads/main | 2023-05-07T14:24:40.841838 | 2021-06-05T09:24:16 | 2021-06-05T09:24:16 | 281,399,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,030 | java | package com.example.prattoy.student;
import android.content.Intent;
import android.location.Address;
import android.location.Geocoder;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class LocationActivity extends AppCompatActivity {
public Geocoder geocoder;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location);
/*List<Address> addresses = null;
geocoder = new Geocoder(LocationActivity.this, Locale.getDefault());
try {
addresses = geocoder.getFromLocation(la, lt, 3);
} catch (IOException ioException) {
ioException.printStackTrace();
} catch (IllegalArgumentException illegalArgumentException) {
illegalArgumentException.printStackTrace();
}
if (addresses == null || addresses.size() == 0) {
} else {
Address address = addresses.get(0);
final ArrayList<String> addressFragments = new ArrayList<String>();
for (int i = 0; i <= address.getMaxAddressLineIndex(); i++) {
addressFragments.add(address.getAddressLine(i));
}*/
Intent intent = new Intent(LocationActivity.this, MapsActivity.class);
startActivity(intent);
finish();
}
}
| [
"[email protected]"
]
| |
7e140e32a23c80ebe34c4fadbd34bdc7e5871292 | 8166475fa9d94473f6738f345641269f9b013ee3 | /Page1.java | a86acf0d6df524d1732149918d6855b17b59f583 | []
| no_license | aparnamnn/Library-Manager | 34d353cd6558702f0a9c2385eff15206e504aa30 | 7bb4450b6730439b2b43e584562bf719cf051f7d | refs/heads/master | 2020-12-24T19:59:55.992404 | 2017-03-26T15:56:28 | 2017-03-26T15:56:28 | 86,222,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,573 | 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 javaproject;
/**
*
* @author Aparna
*/
public class Page1 extends javax.swing.JFrame {
/**
* Creates new form Page1
*/
public Page1() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
Librarian = new javax.swing.JButton();
Student = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
jLabel1.setText("Welcome to the Library!");
Librarian.setText("Librarian");
Librarian.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
LibrarianActionPerformed(evt);
}
});
Student.setText("Student");
Student.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
StudentActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(106, 106, 106)
.addComponent(jLabel1)
.addContainerGap(105, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(Librarian)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Student)
.addGap(64, 64, 64))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(66, 66, 66)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Librarian)
.addComponent(Student))
.addContainerGap(151, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void LibrarianActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LibrarianActionPerformed
LibrarianLogIn lli = new LibrarianLogIn();
lli.setVisible(true);
this.dispose();
}//GEN-LAST:event_LibrarianActionPerformed
private void StudentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_StudentActionPerformed
StudentLogIn sli = new StudentLogIn();
sli.setVisible(true);
this.dispose();
}//GEN-LAST:event_StudentActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Page1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Page1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Page1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Page1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Page1().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton Librarian;
private javax.swing.JButton Student;
private javax.swing.JLabel jLabel1;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
]
| |
b0d36641e4a64a402b01c52127d2ef583590aa7f | 073f06ca7d9ff811a770465a90b1d470b07e703d | /src/main/java/com/stackoverflow/models/User.java | dfad8a758738b1b1e4c093b43102840cf9b53d95 | []
| no_license | melbaloty/stackoverflow | ec140d68c707aff7b59d6829ac151b9b67264901 | 865482bf41601eb6c151a504b4f474dd90c3e7e1 | refs/heads/master | 2021-09-08T23:33:45.104606 | 2021-09-01T07:33:32 | 2021-09-01T07:33:32 | 230,152,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,114 | java | package com.stackoverflow.models;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
@Table(name = "user")
public class User {
private long id;
private String username;
private String email;
private String password;
public User() {
}
public User(String username, String email, String password) {
this.username = username;
this.email = email;
this.password = password;
}
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@JsonIgnore
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
]
| |
ce55bac5bf09e9cbbd5b46f1d2762039e195a050 | 23d36b9f0521865691ee4a76fc56477a073a3728 | /Sysrubricas-2020/src/main/java/pe/edu/com/sysrubricas/serviceImp/RolServiceImp.java | 5b44a34b9393a848e1e05a70e603df588c8ffaf5 | []
| no_license | JosueMoron120/SysRubricasbackend | f083fb4c607d2db163a073aa89a376bec4654a64 | ab1974350493427cda74694d26f06b87ca6e6e5e | refs/heads/master | 2023-02-05T08:28:05.966547 | 2020-12-24T18:25:54 | 2020-12-24T18:25:54 | 321,126,287 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | package pe.edu.com.sysrubricas.serviceImp;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pe.edu.com.sysrubricas.dao.RolDao;
import pe.edu.com.sysrubricas.entity.Rol;
import pe.edu.com.sysrubricas.service.RolService;
@Service
public class RolServiceImp implements RolService{
@Autowired
private RolDao rdao;
@Override
public int create(Rol r) {
return rdao.create(r);
}
@Override
public int update(Rol r) {
return rdao.update(r);
}
@Override
public Map<String, Object> read(int id) {
return rdao.read(id);
}
@Override
public Map<String, Object> readAll() {
return rdao.readAll();
}
@Override
public int delete(int id) {
return rdao.delete(id);
}
}
| [
"[email protected]"
]
| |
ca5eb0a337d7648ad97a1c2d4bd58930212248bd | 78322b8556677178b629460e9a870241892964eb | /li.strolch.agent/src/main/java/li/strolch/agent/impl/EmptyRealm.java | 17a70e1b1543aaf774aec45bda6f0c7e3ce4e7fc | [
"Apache-2.0"
]
| permissive | taitruong/strolch | 28ac6fa66cc9e55cf5e5bcd9b3ff7f6e2cca3f1c | 7134e603968def9e0f513d82a44a924ac2a47d2d | refs/heads/master | 2020-11-24T07:38:28.885317 | 2017-08-28T08:38:15 | 2017-08-28T08:38:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,575 | java | /*
* Copyright 2013 Robert von Burg <[email protected]>
*
* 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 li.strolch.agent.impl;
import java.text.MessageFormat;
import li.strolch.agent.api.ActivityMap;
import li.strolch.agent.api.AuditTrail;
import li.strolch.agent.api.ComponentContainer;
import li.strolch.agent.api.OrderMap;
import li.strolch.agent.api.ResourceMap;
import li.strolch.persistence.api.PersistenceHandler;
import li.strolch.persistence.api.StrolchTransaction;
import li.strolch.persistence.inmemory.InMemoryPersistence;
import li.strolch.privilege.model.Certificate;
import li.strolch.privilege.model.PrivilegeContext;
import li.strolch.runtime.StrolchConstants;
import li.strolch.runtime.configuration.ComponentConfiguration;
import li.strolch.utils.dbc.DBC;
/**
* @author Robert von Burg <[email protected]>
*/
public class EmptyRealm extends InternalStrolchRealm {
private ResourceMap resourceMap;
private OrderMap orderMap;
private ActivityMap activityMap;
private AuditTrail auditTrail;
private PersistenceHandler persistenceHandler;
public EmptyRealm(String realm) {
super(realm);
}
@Override
public DataStoreMode getMode() {
return DataStoreMode.EMPTY;
}
@Override
public StrolchTransaction openTx(Certificate certificate, String action) {
DBC.PRE.assertNotNull("Certificate must be set!", certificate); //$NON-NLS-1$
return this.persistenceHandler.openTx(this, certificate, action);
}
@Override
public StrolchTransaction openTx(Certificate certificate, Class<?> clazz) {
DBC.PRE.assertNotNull("Certificate must be set!", certificate); //$NON-NLS-1$
return this.persistenceHandler.openTx(this, certificate, clazz.getName());
}
@Override
public ResourceMap getResourceMap() {
return this.resourceMap;
}
@Override
public OrderMap getOrderMap() {
return this.orderMap;
}
@Override
public ActivityMap getActivityMap() {
return this.activityMap;
}
@Override
public AuditTrail getAuditTrail() {
return this.auditTrail;
}
@Override
public void initialize(ComponentContainer container, ComponentConfiguration configuration) {
super.initialize(container, configuration);
this.persistenceHandler = new InMemoryPersistence(container.getPrivilegeHandler());
this.resourceMap = new TransactionalResourceMap();
this.orderMap = new TransactionalOrderMap();
String enableAuditKey = StrolchConstants.makeRealmKey(getRealm(), DefaultRealmHandler.PROP_ENABLE_AUDIT_TRAIL);
if (configuration.getBoolean(enableAuditKey, Boolean.FALSE)) {
this.auditTrail = new TransactionalAuditTrail();
logger.info("Enabling AuditTrail for realm " + getRealm()); //$NON-NLS-1$
} else {
this.auditTrail = new NoStrategyAuditTrail();
logger.info("AuditTrail is disabled for realm " + getRealm()); //$NON-NLS-1$
}
}
@Override
public void start(PrivilegeContext privilegeContext) {
logger.info(MessageFormat.format("Initialized EMPTY Realm {0}", getRealm())); //$NON-NLS-1$
}
@Override
public void stop() {
//
}
@Override
public void destroy() {
//
}
}
| [
"[email protected]"
]
| |
5f1f070f999dc4f9f3385af1eb555baac840991b | 75b0eeb95f30029bae0ab8d0f6550e31d2af7c02 | /spring-boot-ecommerce/src/main/java/com/florinolteanu/ecommerce/entity/State.java | f6f16c52276bbd7a90ca9b39e129867742792fb8 | []
| no_license | olteanuflorin86/spring-angular-mysql-ecommerce-project | 58e4f0ddd24969acaac3db60317ca82f151abd69 | a85133cdabf813aa211770b3c40d8a5bdd5e9914 | refs/heads/master | 2023-05-27T11:35:27.972645 | 2021-06-10T15:19:38 | 2021-06-10T15:19:38 | 367,408,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.florinolteanu.ecommerce.entity;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
@Entity
@Table(name = "state")
@Getter
@Setter
public class State {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "name")
private String name;
@ManyToOne
@JoinColumn(name = "country_id")
private Country country;
}
| [
"[email protected]"
]
| |
1ea0ee615dc2fe9fd9ebd68c5c51891a7809c358 | 385e3414ccb7458bbd3cec326320f11819decc7b | /packages/apps/ContactsCommon/src/com/mediatek/contacts/simcontact/SimCardUtils.java | a59545e335dd779a1198d3017a11dc2774dd4fc2 | []
| no_license | carlos22211/Tango_AL813 | 14de7f2693c3045b9d3c0cb52017ba2bb6e6b28f | b50b1b7491dc9c5e6b92c2d94503635c43e93200 | refs/heads/master | 2020-03-28T08:09:11.127995 | 2017-06-26T05:05:29 | 2017-06-26T05:05:29 | 147,947,860 | 1 | 0 | null | 2018-09-08T15:55:46 | 2018-09-08T15:55:45 | null | UTF-8 | Java | false | false | 32,688 | java | /* Copyright Statement:
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein
* is confidential and proprietary to MediaTek Inc. and/or its licensors.
* Without the prior written permission of MediaTek inc. and/or its licensors,
* any reproduction, modification, use or disclosure of MediaTek Software,
* and information contained herein, in whole or in part, shall be strictly prohibited.
*
* MediaTek Inc. (C) 2010. All rights reserved.
*
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
* THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
* CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
* SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
* CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* The following software/firmware and/or related documentation ("MediaTek Software")
* have been modified by MediaTek Inc. All revisions are subject to any receiver's
* applicable license agreements with MediaTek Inc.
*/
package com.mediatek.contacts.simcontact;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.provider.Settings;
import android.telephony.SubscriptionInfo;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
import com.android.internal.telephony.ITelephony;
import com.google.common.annotations.VisibleForTesting;
import com.mediatek.internal.telephony.ITelephonyEx;
import com.mediatek.contacts.simservice.SIMServiceUtils;
import com.mediatek.contacts.util.LogUtils;
import java.util.HashMap;
import java.util.List;
import com.android.contacts.common.R;
public class SimCardUtils {
private static final String TAG = "SimCardUtils";
public interface SimType {
String SIM_TYPE_USIM_TAG = "USIM";
String SIM_TYPE_SIM_TAG = "SIM";
String SIM_TYPE_UIM_TAG = "RUIM";
String SIM_TYPE_CSIM_TAG = "CSIM";
int SIM_TYPE_SIM = 0;
int SIM_TYPE_USIM = 1;
int SIM_TYPE_UIM = 2;
int SIM_TYPE_CSIM = 3;
int SIM_TYPE_UNKNOWN = -1;
}
public static boolean isSimPinRequest(long slotId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(slotId), SIM_KEY_WITHSLOT_PIN_REQUEST);
if (v != null) {
LogUtils.w(TAG, "[isSimPinRequest]slotId:" + slotId +
",v:" + v);
return v;
}
boolean isPinRequest = (TelephonyManager.SIM_STATE_PIN_REQUIRED == TelephonyManager
.getDefault().getSimState((int) slotId));
LogUtils.d(TAG, "[isSimPinRequest]slotId:" + slotId +
",isPukRequest:" + isPinRequest);
return isPinRequest;
}
public static boolean isSimStateReady(long slotId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(slotId), SIM_KEY_WITHSLOT_STATE_READY);
if (v != null) {
LogUtils.w(TAG, "[isSimStateReady]slotId:" + slotId +
",v:" + v);
return v;
}
boolean isSimStateReady = (TelephonyManager.SIM_STATE_READY == TelephonyManager
.getDefault().getSimState((int) slotId));
LogUtils.d(TAG, "[isSimStateReady]slotId:" + slotId +
",isPukRequest:" + isSimStateReady);
return isSimStateReady;
}
public static boolean isSimInserted(int slotId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(slotId), SIM_KEY_WITHSLOT_SIM_INSERTED);
if (v != null) {
LogUtils.w(TAG, "[isSimInserted]slotId:" + slotId +
",v:" + v);
return v;
}
final ITelephony iTel = ITelephony.Stub.asInterface(ServiceManager
.getService(Context.TELEPHONY_SERVICE));
boolean isSimInsert = false;
try {
if (iTel != null) {
isSimInsert = iTel.hasIccCardUsingSlotId(slotId);
}
} catch (RemoteException e) {
LogUtils.e(TAG, "[isSimInserted]catch exception:");
e.printStackTrace();
isSimInsert = false;
}
LogUtils.d(TAG, "[isSimInserted]slotId:" + slotId +
",isPukRequest:" + isSimInsert);
return isSimInsert;
}
public static boolean isFdnEnabed(int slotId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(slotId), SIM_KEY_WITHSLOT_FDN_ENABLED);
if (v != null) {
LogUtils.w(TAG, "[isFdnEnabed]slotId:" + slotId +
",v:" + v);
return v;
}
final ITelephonyEx iTel = ITelephonyEx.Stub.asInterface(ServiceManager
.getService(Context.TELEPHONY_SERVICE_EX));
boolean isFdnEnabled = false;
try {
if (iTel != null) {
if (SlotUtils.isGeminiEnabled()) {
isFdnEnabled = iTel.isFdnEnabled(slotId);
} else {
isFdnEnabled = iTel.isFdnEnabled(0);
}
}
} catch (RemoteException e) {
LogUtils.e(TAG, "[isFdnEnabed]catch exception:");
e.printStackTrace();
isFdnEnabled = false;
}
LogUtils.d(TAG, "[isFdnEnabed]slotId:" + slotId +
",isFdnEnabled:" + isFdnEnabled);
return isFdnEnabled;
}
public static boolean isSetRadioOn(ContentResolver resolver, int subId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(subId), SIM_KEY_WITHSLOT_SET_RADIO_ON);
if (v != null) {
LogUtils.w(TAG, "[isSetRadioOn]subId:" + subId +
",v:" + v);
return v;
}
boolean isRadioOn = false;
if (SlotUtils.isGeminiEnabled()) {
///[Gemini+] dualSimSet rule: each bit stands for each slot radio status
/// e.g. 0101 means only slot 0 & slot 2 is set radio on
final int flagAllSimOn = (1 << SlotUtils.getSlotCount()) - 1;
int dualSimSet = Settings.System.getInt(resolver, Settings.System.MSIM_MODE_SETTING, flagAllSimOn);
isRadioOn = (Settings.Global.getInt(resolver, Settings.Global.AIRPLANE_MODE_ON, 0) == 0)
&& ((1 << (subId - SlotUtils.getFirstSlotId())) & dualSimSet) != 0;
} else {
isRadioOn = Settings.Global.getInt(resolver,
Settings.Global.AIRPLANE_MODE_ON, 0) == 0;
}
LogUtils.d(TAG, "[isSetRadioOn]subId:" + subId +
",isRadioOn:" + isRadioOn);
return isRadioOn;
}
/**
* check PhoneBook State is ready if ready, then return true.
*
* @param subId
* @return
*/
public static boolean isPhoneBookReady(int subId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(subId), SIM_KEY_WITHSLOT_PHB_READY);
if (v != null) {
LogUtils.w(TAG, "[isPhoneBookReady]subId:" + subId +
",v:" + v);
return v;
}
final ITelephonyEx telephonyEx = ITelephonyEx.Stub.asInterface(ServiceManager
.getService("phoneEx"));
if (null == telephonyEx) {
LogUtils.w(TAG, "[isPhoneBookReady]phoneEx == null");
return false;
}
boolean isPbReady = false;
try {
isPbReady = telephonyEx.isPhbReady(subId);
LogUtils.d(TAG, "[isPhoneBookReady]isPbReady:" + isPbReady + "||subId:" + subId);
} catch (RemoteException e) {
LogUtils.e(TAG, "[isPhoneBookReady]catch exception:");
e.printStackTrace();
}
LogUtils.d(TAG, "[isPhoneBookReady]subId:" + subId +
", isPbReady:" + isPbReady);
return isPbReady;
}
/**
* [Gemini+] get sim type integer by subId
* sim type is integer defined in SimCardUtils.SimType
* @param subId
* @return SimCardUtils.SimType
*/
public static int getSimTypeBySubId(int subId) {
Integer v = (Integer) getPresetObject(String.valueOf(subId), SIM_KEY_WITHSLOT_SIM_TYPE);
if (v != null) {
LogUtils.w(TAG, "[getSimTypeBySubId]subId:" + subId +
",v:" + v);
return v;
}
int simType = -1;
final ITelephonyEx iTel = ITelephonyEx.Stub.asInterface(ServiceManager
.getService(Context.TELEPHONY_SERVICE_EX));
if (iTel == null) {
LogUtils.w(TAG, "[getSimTypeBySubId]iTel == null");
return simType;
}
try {
String iccCardType = iTel.getIccCardType(subId);
if (SimType.SIM_TYPE_USIM_TAG.equals(iccCardType)) {
simType = SimType.SIM_TYPE_USIM;
} else if (SimType.SIM_TYPE_UIM_TAG.equals(iccCardType)) {
simType = SimType.SIM_TYPE_UIM;
} else if (SimType.SIM_TYPE_SIM_TAG.equals(iccCardType)) {
simType = SimType.SIM_TYPE_SIM;
} else if (SimType.SIM_TYPE_CSIM_TAG.equals(iccCardType)) {
simType = SimType.SIM_TYPE_CSIM;
}
} catch (RemoteException e) {
LogUtils.e(TAG, "[getSimTypeBySubId]catch exception:");
e.printStackTrace();
}
LogUtils.d(TAG, "[getSimTypeBySubId]subId:" + subId +
",simType:" + simType);
return simType;
}
public static String getIccCardType(int subId) {
final ITelephonyEx iTel = ITelephonyEx.Stub.asInterface(ServiceManager
.getService(Context.TELEPHONY_SERVICE_EX));
if (iTel == null) {
LogUtils.w(TAG, "[getIccCardType]iTel == null");
return null;
}
String iccCardType = null;
try {
iccCardType = iTel.getIccCardType(subId);
} catch (RemoteException e) {
LogUtils.e(TAG, "[getIccCardType]catch exception:");
e.printStackTrace();
}
LogUtils.d(TAG, "[getIccCardType]subId:" + subId +
",iccCardType:" + iccCardType);
return iccCardType;
}
/**
* [Gemini+] check whether a slot is insert a usim card
* @param subId
* @return true if it is usim card
*/
public static boolean isSimUsimType(int subId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(subId), SIM_KEY_WITHSLOT_IS_USIM);
if (v != null) {
LogUtils.w(TAG, "[isSimUsimType]subId:" + subId +
",v:" + v);
return v;
}
boolean isUsim = false;
final ITelephonyEx iTel = ITelephonyEx.Stub.asInterface(ServiceManager
.getService(Context.TELEPHONY_SERVICE_EX));
if (iTel == null) {
LogUtils.w(TAG, "[isSimUsimType]iTel == null");
return isUsim;
}
try {
if (SimType.SIM_TYPE_USIM_TAG.equals(iTel.getIccCardType(subId))
|| SimType.SIM_TYPE_CSIM_TAG.equals(iTel.getIccCardType(subId))) {
isUsim = true;
}
} catch (RemoteException e) {
LogUtils.e(TAG, "[isSimUsimType]catch exception:");
e.printStackTrace();
}
LogUtils.d(TAG, "[isSimUsimType]subId:" + subId +
",isUsim:" + isUsim);
return isUsim;
}
/**
* For test
*/
private static HashMap<String, ContentValues> sPresetSimData = null;
@VisibleForTesting
public static void clearPreSetSimData() {
sPresetSimData = null;
}
private static Object getPresetObject(String key1, String key2) {
if (sPresetSimData != null) {
ContentValues values = sPresetSimData.get(key1);
if (values != null) {
Object v = values.get(key2);
if (v != null) {
return v;
}
}
}
return null;
}
private static final String NO_SLOT = String.valueOf(-1);
private static final String SIM_KEY_WITHSLOT_PUK_REQUEST = "isSimPukRequest";
private static final String SIM_KEY_WITHSLOT_PIN_REQUEST = "isSimPinRequest";
private static final String SIM_KEY_WITHSLOT_STATE_READY = "isSimStateReady";
private static final String SIM_KEY_WITHSLOT_SIM_INSERTED = "isSimInserted";
private static final String SIM_KEY_WITHSLOT_FDN_ENABLED = "isFdnEnabed";
private static final String SIM_KEY_WITHSLOT_SET_RADIO_ON = "isSetRadioOn";
private static final String SIM_KEY_WITHSLOT_PHB_READY = "isPhoneBookReady";
private static final String SIM_KEY_WITHSLOT_SIM_TYPE = "getSimTypeBySlot";
private static final String SIM_KEY_WITHSLOT_IS_USIM = "isSimUsimType";
private static final String SIM_KEY_SIMINFO_READY = "isSimInfoReady";
private static final String SIM_KEY_WITHSLOT_RADIO_ON = "isRadioOn";
private static final String SIM_KEY_WITHSLOT_HAS_ICC_CARD = "hasIccCard";
private static final String SIM_KEY_WITHSLOT_GET_SIM_INDICATOR_STATE = "getSimIndicatorState";
@VisibleForTesting
public static void preSetSimData(int slot, Boolean fdnEnabled,
Boolean isUsim, Boolean phbReady, Boolean pinRequest,
Boolean pukRequest, Boolean isRadioOn, Boolean isSimInserted,
Integer simType, Boolean simStateReady, Boolean simInfoReady) {
ContentValues value1 = new ContentValues();
if (fdnEnabled != null) {
value1.put(SIM_KEY_WITHSLOT_FDN_ENABLED, fdnEnabled);
}
if (isUsim != null) {
value1.put(SIM_KEY_WITHSLOT_IS_USIM, isUsim);
}
if (phbReady != null) {
value1.put(SIM_KEY_WITHSLOT_PHB_READY, phbReady);
}
if (pinRequest != null) {
value1.put(SIM_KEY_WITHSLOT_PIN_REQUEST, pinRequest);
}
if (pukRequest != null) {
value1.put(SIM_KEY_WITHSLOT_PUK_REQUEST, pukRequest);
}
if (isRadioOn != null) {
value1.put(SIM_KEY_WITHSLOT_SET_RADIO_ON, isRadioOn);
}
if (isSimInserted != null) {
value1.put(SIM_KEY_WITHSLOT_SIM_INSERTED, isSimInserted);
}
if (simType != null) {
value1.put(SIM_KEY_WITHSLOT_SIM_TYPE, simType);
}
if (simStateReady != null) {
value1.put(SIM_KEY_WITHSLOT_STATE_READY, simStateReady);
}
if (sPresetSimData == null) {
sPresetSimData = new HashMap<String, ContentValues>();
}
if (value1 != null && value1.size() > 0) {
String key1 = String.valueOf(slot);
if (sPresetSimData.containsKey(key1)) {
sPresetSimData.remove(key1);
}
sPresetSimData.put(key1, value1);
}
ContentValues value2 = new ContentValues();
if (simInfoReady != null) {
value2.put(SIM_KEY_SIMINFO_READY, simInfoReady);
}
if (value2 != null && value2.size() > 0) {
if (sPresetSimData.containsKey(NO_SLOT)) {
sPresetSimData.remove(NO_SLOT);
}
sPresetSimData.put(NO_SLOT, value2);
}
}
public static class ShowSimCardStorageInfoTask extends AsyncTask<Void, Void, Void> {
private static ShowSimCardStorageInfoTask sInstance = null;
private boolean mIsCancelled = false;
private boolean mIsException = false;
private String mDlgContent = null;
private Context mContext = null;
private static boolean sNeedPopUp = false;
private static HashMap<Integer, Integer> sSurplugMap = new HashMap<Integer, Integer>();
public static void showSimCardStorageInfo(Context context, boolean needPopUp) {
sNeedPopUp = needPopUp;
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]_beg");
if (sInstance != null) {
sInstance.cancel();
sInstance = null;
}
sInstance = new ShowSimCardStorageInfoTask(context);
sInstance.execute();
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]_end");
}
public ShowSimCardStorageInfoTask(Context context) {
mContext = context;
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask] onCreate()");
}
@Override
protected Void doInBackground(Void... args) {
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]: doInBackground_beg");
sSurplugMap.clear();
List<SubscriptionInfo> subscriptionInfoList = SubInfoUtils.getActivatedSubInfoList();
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]: subInfos.size = "
+ SubInfoUtils.getActivatedSubInfoCount());
if (!mIsCancelled && (subscriptionInfoList != null) && subscriptionInfoList.size() > 0) {
StringBuilder build = new StringBuilder();
int id = 0;
for (SubscriptionInfo subscriptionInfo : subscriptionInfoList) {
if (id > 0) {
build.append("\n\n");
}
id++;
int[] storageInfos = null;
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask] simName = "
+ subscriptionInfo.getDisplayName()
+ "; simSlot = " + subscriptionInfo.getSimSlotIndex()
+ "; subId = " + subscriptionInfo.getSubscriptionId());
build.append(subscriptionInfo.getDisplayName());
build.append(":\n");
try {
ITelephonyEx phoneEx = ITelephonyEx.Stub.asInterface(ServiceManager
.checkService("phoneEx"));
if (!mIsCancelled && phoneEx != null) {
storageInfos = phoneEx.getAdnStorageInfo(subscriptionInfo.getSubscriptionId());
if (storageInfos == null) {
mIsException = true;
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]storageInfos is null.");
return null;
}
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask] infos: "
+ storageInfos.toString());
} else {
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]: phone = null");
mIsException = true;
return null;
}
} catch (RemoteException ex) {
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]_exception: " + ex);
mIsException = true;
return null;
}
LogUtils.i(TAG, "subId:" + subscriptionInfo.getSubscriptionId() + "||storage:"
+ (storageInfos == null ? "NULL" : storageInfos[1]) + "||used:"
+ (storageInfos == null ? "NULL" : storageInfos[0]));
if (storageInfos != null && storageInfos[1] > 0) {
sSurplugMap.put(subscriptionInfo.getSubscriptionId(), storageInfos[1] - storageInfos[0]);
}
build.append(mContext.getResources().getString(R.string.dlg_simstorage_content,
storageInfos[1], storageInfos[0]));
if (mIsCancelled) {
return null;
}
}
mDlgContent = build.toString();
}
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]: doInBackground_end");
return null;
}
public void cancel() {
super.cancel(true);
mIsCancelled = true;
LogUtils.i(TAG, "[ShowSimCardStorageInfoTask]: mIsCancelled = true");
}
@Override
protected void onPostExecute(Void v) {
sInstance = null;
mIsCancelled = false;
mIsException = false;
}
public static int getSurplugCount(int subId) {
LogUtils.d(TAG, "[getSurplugCount] sSurplugMap : " + sSurplugMap
+ ",subId:" + subId);
if (null != sSurplugMap && sSurplugMap.containsKey(subId)) {
int result = sSurplugMap.get(subId);
LogUtils.d(TAG, "[getSurplugCount] result : " + result);
return result;
} else {
LogUtils.i(TAG, "[getSurplugCount] return -1");
return -1;
}
}
}
/**
* [Gemini+] wrapper gemini & common API
*
* @param subId
* the slot id
* @return true if radio on
*/
public static boolean isRadioOn(int subId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(subId), SIM_KEY_WITHSLOT_RADIO_ON);
if (v != null) {
LogUtils.w(TAG, "[isRadioOn]slotId:" + subId +
",v:" + v);
return v;
}
final ITelephony iTel = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
if (iTel == null) {
LogUtils.w(TAG, "[isRadioOn]iTel is null!");
return false;
}
boolean isRadioOn = false;
try {
isRadioOn = iTel.isRadioOnForSubscriber(subId);
} catch (RemoteException e) {
LogUtils.e(TAG, "[isRadioOn] failed to get radio state for sub " + subId);
e.printStackTrace();
isRadioOn = false;
}
LogUtils.d(TAG, "[isRadioOn]subId:" + subId +
"|isRadioOn:" + isRadioOn);
return isRadioOn;
}
/**
* [Gemini+] wrapper gemini & common API
*
* @param slotId
* @return
*/
public static boolean hasIccCard(int slotId) {
Boolean v = (Boolean) getPresetObject(String.valueOf(slotId), SIM_KEY_WITHSLOT_HAS_ICC_CARD);
if (v != null) {
LogUtils.w(TAG, "[hasIccCard]slotId:" + slotId +
",v:" + v);
return v;
}
final ITelephony iTel = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
if (iTel == null) {
LogUtils.w(TAG, "[hasIccCard]iTel is null.");
return false;
}
boolean hasIccCard = false;
try {
hasIccCard = iTel.hasIccCardUsingSlotId(slotId);
} catch (RemoteException e) {
LogUtils.e(TAG, "[hasIccCard] failed to check icc card state for slot " + slotId);
e.printStackTrace();
hasIccCard = false;
}
LogUtils.d(TAG, "[hasIccCard]slotId:" + slotId +
"|hasIccCard:" + hasIccCard);
return hasIccCard;
}
/**
* M: [Gemini+] not only ready, but also idle for all sim operations its
* requirement is: 1. iccCard is insert 2. radio is on 3. FDN is off 4. PHB
* is ready 5. simstate is ready 6. simService is not running
*
* @param slotId
* the slotId to check
* @return true if idle
*/
public static boolean isSimStateIdle(int subId) {
LogUtils.i(TAG, "[isSimStateIdle] subId: " + subId);
if (!SubInfoUtils.checkSubscriber(subId)) {
return false;
}
///change for SIM Service Refactoring
boolean isSimServiceRunning = SIMServiceUtils.isServiceRunning(subId);
LogUtils.i(TAG, "[isSimStateIdle], isSimServiceRunning = " + isSimServiceRunning);
return isPhoneBookReady(subId) && !isSimServiceRunning;
}
/** M: change for CR ALPS00707504 & ALPS00721348 @ {
* remove condition about isSimServiceRunningOnSlot
*/
public static boolean isSimReady(int subId) {
boolean isPhoneBookReady = isPhoneBookReady(subId);
LogUtils.i(TAG, "[isSimReady] isPhoneBookReady=" + isPhoneBookReady);
return isPhoneBookReady;
}
/** @ } */
/**
* M: [Gemini+] wrapper gemini & common API
*
* @param slotId
* @return
*/
public static int getSimIndicatorState(int slotId) {
Integer v = (Integer) getPresetObject(String.valueOf(slotId), SIM_KEY_WITHSLOT_GET_SIM_INDICATOR_STATE);
if (v != null) {
LogUtils.w(TAG, "[getSimIndicatorState]slotId:" + slotId +
",v:" + v);
return v;
}
final ITelephony iTel = ITelephony.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE));
final ITelephonyEx iTelEx = ITelephonyEx.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE_EX));
if (iTel == null) {
LogUtils.w(TAG, "[getSimIndicatorState]iTel is null.");
return -1;
}
int simIndicatorState = -1;
/** qinglei comment out for build pass
try {
if (SlotUtils.isGeminiEnabled()) {
///M:Lego API Refactoring
simIndicatorState = iTelEx.getSimIndicatorState(slotId);
} else {
simIndicatorState = iTel.getSimIndicatorState();
}
} catch (RemoteException e) {
LogUtils.e(TAG, "[getSimIndicatorState] failed to get sim indicator state for slot " + slotId);
e.printStackTrace();
}
*/
LogUtils.d(TAG, "[getSimIndicatorState]slotId:" + slotId +
"|simIndicatorState:" + simIndicatorState);
return simIndicatorState;
}
/**
* M: [Gemini+] wrapper gemini & common API
*
* @param input
* @param subId
* @return
*/
public static boolean handlePinMmi(String input, int subId) {
///M:Lego Sim API Refactoring
final ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
if (phone == null) {
LogUtils.w(TAG, "[handlePinMmi] fail to get phone for subId " + subId);
return false;
}
boolean isHandled;
try {
isHandled = phone.handlePinMmiForSubscriber(subId, input);
} catch (RemoteException e) {
LogUtils.e(TAG, "[handlePinMmi]exception : ");
e.printStackTrace();
isHandled = false;
}
LogUtils.d(TAG, "[handlePinMmi]subId:" + subId + "|input:" + input +
"|isHandled:" + isHandled);
return isHandled;
}
/**
* [Gemini+] get sim tag like "SIM", "USIM", "UIM" by slot id
*
* @param subId
* @return
*/
public static String getSimTagBySlot(int subId) {
if (!SlotUtils.isSlotValid(subId)) {
LogUtils.e(TAG, "[getSimTagBySlot]subId:" + subId + "is invalid!");
return null;
}
final ITelephonyEx iTel = ITelephonyEx.Stub.asInterface(ServiceManager.getService(Context.TELEPHONY_SERVICE_EX));
try {
return iTel.getIccCardType(subId);
} catch (RemoteException e) {
LogUtils.e(TAG, "catched exception. subId: " + subId);
e.printStackTrace();
}
return null;
}
/**
* M: [Gemini+] when a sim card was turned on or off in Settings, a broadcast
* Intent.ACTION_MSIM_MODE_CHANGED would be sent, and carry current Dual sim mode.
* This method is defined to parse the intent, and check whether the slot is on or off.
* @param slotId slot to check
* @param the mode retrived from the broadcast intent
* @return true if on, false if off
*/
public static boolean isDualSimModeOn(int slotId, int mode) {
assert (SlotUtils.isSlotValid(slotId));
assert (mode >= 0 && mode < (1 << SlotUtils.getSlotCount()));
return (1 << (slotId - SlotUtils.getFirstSlotId()) & mode) != 0;
}
/** M: Bug Fix for ALPS00557517 @{ */
public static int getAnrCount(int subId) {
return SlotUtils.getUsimAnrCount(subId);
}
/** @ } */
/** M: Bug Fix for ALPS00566570 , get support email count
* some USIM cards have no Email fields.
* if the slot is invalid, return -1, otherwise return the email count
* @{ */
public static int getIccCardEmailCount(int subId) {
return SlotUtils.getUsimEmailCount(subId);
}
/** @ } */
/**
* M: Check that whether the phone book is ready, and whether the sim card storage is full.
* @param context the caller's context.
* @param subId the slot to check.
* @return true the phb is ready and sim card storage is OK,
* false the phb is not ready or sim card storage is full.
*/
public static boolean checkPHBState(Context context, int subId) {
long startTime = System.currentTimeMillis();
boolean hitError = false;
int errorToastId = -1;
if (!isPhoneBookReady(subId)) {
hitError = true;
errorToastId = R.string.icc_phone_book_invalid;
} else if (0 == ShowSimCardStorageInfoTask.getSurplugCount(subId)) {
hitError = true;
errorToastId = R.string.storage_full;
}
if (context == null) {
Log.w(TAG, "[checkPHBState] context is null,subId:" + subId);
}
if (hitError && context != null) {
Toast.makeText(context, errorToastId, Toast.LENGTH_LONG).show();
LogUtils.d(TAG, "[checkPHBState] hitError=" + hitError);
}
return !hitError;
}
/**
* Check that whether the phone book is ready only
* @param context the caller's context.
* @param subId the slot to check.
* @return true the phb is ready false the phb is not ready
*/
public static boolean isPhoneBookReady(Context context, int subId) {
boolean hitError = false;
int errorToastId = -1;
if (!isPhoneBookReady(subId)) {
hitError = true;
errorToastId = R.string.icc_phone_book_invalid;
}
if (context == null) {
Log.w(TAG, "[checkPHBState] context is null,subId:" + subId);
}
if (hitError && context != null) {
Toast.makeText(context, errorToastId, Toast.LENGTH_LONG).show();
LogUtils.d(TAG, "[checkPHBState] hitError=" + hitError);
}
return !hitError;
}
/**
* Check subid and return the sim type value.
* @param subId The sim card subid.
* @return sim type string value.
*/
public static String getSimTypeTagBySubId(int subId) {
int simType = getSimTypeBySubId(subId);
String value;
switch (simType) {
case SimType.SIM_TYPE_SIM:
value = "SIM";
break;
case SimType.SIM_TYPE_USIM:
value = "USIM";
break;
case SimType.SIM_TYPE_UIM:
value = "UIM";
break;
case SimType.SIM_TYPE_CSIM:
value = "UIM";
break;
default:
value = "UNKNOWN";
break;
}
LogUtils.d(TAG, "[getSimTypeTagBySubId] simType=" + simType + " | subId : " + subId
+ " | value : " + value);
return value;
}
}
| [
"[email protected]"
]
| |
d0bac6a74e48872ed0877cbe466e18478f5c79d0 | 587f36eb986dfb93f426f1c96fdc366d5edfc7bf | /Cucumber/src/test/java/Stepdefination/Fbcreatenewuser.java | 2f794ec69682959e44fdbec2ae45948160603397 | []
| no_license | shivapriyaramidi/CucumberNandiniHm | a3e125da3a38613c87f78165aa5632f76d9cf6d6 | 58ecc4f1e3ba18f869a76df35cfd7f654ce797ec | refs/heads/main | 2023-03-22T00:51:18.480640 | 2021-03-15T18:43:16 | 2021-03-15T18:43:16 | 347,206,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,579 | java | package Stepdefination;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class Fbcreatenewuser {
WebDriver driver;
@Given("^user able to lanch fb page$")
public void user_able_to_lanch_fb_page() throws Throwable {
System.out.println("Lanching fb account");
// Write code here that turns the phrase above into concrete actions
System.setProperty("webdriver.chrome.drive", "C:\\chromeexe\\chrome89.chromedriver.exe");
driver = new ChromeDriver();
driver.get("https://www.facebook.com/");
driver.findElement(By.linkText("Create New Account")).click();
}
@When("^click create newuser button$")
public void click_create_newuser_button() throws Throwable {
// Write code here that turns the phrase above into concrete actions
}
@When("^enter frist name$")
public void enter_frist_name() throws Throwable {
// Write code here that turns the phrase above into concrete actions
}
@Then("^enter lastname$")
public void enter_lastname() throws Throwable {
// Write code here that turns the phrase above into concrete actions
}
@Then("^enter emain$")
public void enter_emain() throws Throwable {
// Write code here that turns the phrase above into concrete actions
}
@Then("^enter password$")
public void enter_password() throws Throwable {
// Write code here that turns the phrase above into concrete actions
}
}
| [
"[email protected]"
]
| |
7edf058a9441ae8b83d4ba27f9bad74d75003f6d | 23f42be278044c0840f980d7a200c9486720867b | /dorado-core/src/main/java/ai/houyi/dorado/spring/DoradoApplicationContext.java | 43eb4f14b25bc74792609f6e7856ba598e5dfc8e | [
"Apache-2.0"
]
| permissive | javagossip/dorado | 5920871c77d33cc39fdc0d630cc228d677f03a43 | 3576041f60a4763323e1c56f0a41739280822eb7 | refs/heads/master | 2022-08-08T20:08:47.832321 | 2022-07-31T02:34:53 | 2022-07-31T02:34:53 | 141,869,327 | 80 | 29 | Apache-2.0 | 2022-07-31T02:34:54 | 2018-07-22T05:45:18 | Java | UTF-8 | Java | false | false | 1,098 | java | /*
* Copyright 2017 The OpenDSP Project
*
* The OpenDSP Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package ai.houyi.dorado.spring;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
/**
*
* @author wangwp
*/
public class DoradoApplicationContext extends AnnotationConfigApplicationContext {
private final DoradoClassPathBeanDefinitionScanner scanner;
public DoradoApplicationContext(String... basePackages) {
scanner = new DoradoClassPathBeanDefinitionScanner(this);
scanner.scan(basePackages);
refresh();
}
}
| [
"[email protected]"
]
| |
7e9317ce535ec731412e3aa30d113b47031ca25c | 1fad63aadffa3da749b7d3c2ad66f378de86a080 | /java-collection-framework/thuc-hanh/comparable-comparator/src/Main.java | fc1e1e32643f94869c22606b504ffb3d012abd0d | []
| no_license | tiendat2905/codegym-java-module-2 | 0049455bdaa90d5b3ce20f20be98352d64ff0f00 | 43fc4d49c297450e51735e425158d8946bf64ad1 | refs/heads/master | 2023-02-16T16:46:39.903944 | 2021-01-14T03:38:10 | 2021-01-14T03:38:10 | 317,818,994 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 916 | java | import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Main {
public static void main(String[] args) {
Student student = new Student("Kien", 30, "HT");
Student student1 = new Student("Nam", 26, "HN");
Student student2 = new Student("Anh", 38, "HT" );
Student student3 = new Student("Tung", 38, "HT" );
List<Student> lists = new ArrayList<Student>();
lists.add(student);
lists.add(student1);
lists.add(student2);
lists.add(student3);
Collections.sort(lists);
for(Student st : lists){
System.out.println(st.toString());
}
AgeComparator ageComparator = new AgeComparator();
lists.sort(ageComparator);
System.out.println("So sanh theo tuoi:");
for(Student st : lists){
System.out.println(st.toString());
}
}
}
| [
"[email protected]"
]
| |
6a346ad020c861ffdde7b27b79fa0e8f65db9145 | 278fe84a0e6dcc4aa48120ccab5a2b4689b05349 | /src/main/java/br/com/sensedia/users/adapters/DefaultException.java | 9076df8310ea6bd7a0900f040e9c8aa433b251c0 | []
| no_license | oliveiradep/users-crud-hex | 1c0de1c482fde13e97cf16a985c7496396c929ff | d1634c0abfea2c8d4fc57c990857c91dedb71f22 | refs/heads/master | 2022-10-12T04:20:39.156847 | 2020-06-09T05:13:19 | 2020-06-09T05:13:19 | 270,144,918 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,049 | java | package br.com.sensedia.users.adapters;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.validation.annotation.Validated;
import java.util.Objects;
@Validated
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DefaultException {
private String message;
public DefaultException(String message) {
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DefaultException that = (DefaultException) o;
return Objects.equals(message, that.message);
}
@Override
public int hashCode() {
return Objects.hash(message);
}
@Override
public String toString() {
return "ApplicationException{" +
"message='" + message + '\'' +
'}';
}
} | [
"[email protected]"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.