blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
22e18a7c608f945dd9422ca5de9c2cb0a2b686c7 | 72b5967e0e5e6b7ac3f8765d069c9aca7624fbdc | /test/src/main/java/com/woofer/commentandreply/view/NoScrollListView.java | 046b5a279cedffcd21b72cb9201b5e810f509662 | [] | no_license | zsyh/Romaunt | 819eab1826df825b9004c4cf56563bde7ec72d17 | ace1c4cf7c3fbf1f6a5e0b1a08a00840c97c48b2 | refs/heads/master | 2021-06-08T07:28:16.011126 | 2016-07-11T00:10:46 | 2016-07-11T00:10:46 | 62,441,398 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package com.woofer.commentandreply.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;
/**
* 重写一个不可以滑动的listview
*
* @author yangjiabei
* Created by Admin on 2016/5/10.
*/
public class NoScrollListView extends ListView {
public NoScrollListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int mExpandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, mExpandSpec);
}
}
| [
"[email protected]"
] | |
d3d21a92f1c72e40df07bf81ea4e9210fdac62be | 37866894ee287dc4e194a819188d1709cfb685ca | /group_15_bank_atm/src/bank/Name.java | 3dfd1dbcdef705f176bc51e308f6b2c26d0b5684 | [] | no_license | ScholarOftheFirstSin/Bank-Management-System | 9793398e6ea30d9a66e828fbc471e55094bfd062 | f7a2f971b461d65e0dde721cdf034663ee1141bf | refs/heads/master | 2022-12-07T02:31:57.958305 | 2020-08-23T21:50:12 | 2020-08-23T21:50:12 | 289,772,045 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 666 | java | /*
* Athanasios Filippidis
* [email protected]
* BU ID U95061883
* */
package bank;
public class Name {
private String firstName;
private String lastName;
public Name(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
@Override
public String toString() {
return firstName + " " + lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
| [
"[email protected]"
] | |
97892843d51e3439c2472a65ecc60dcac77d82f1 | 402852bd4c58f9deca8ddecc187ebd5b1f026ef0 | /logica-de-programacao-java/src/main/java/logica/metodo/ConversorTemperatuira.java | 79966e84b57f7d4c1bde05f22cf10c8b91e58fd7 | [] | no_license | JeffersonSilvaLeal/logicaProgramacaoJava | 261f94b1e7c20c7e46a4328f544ae9335266093f | 1eccfb198e0918dd417da0a92e357e2adb1ad1de | refs/heads/master | 2023-07-12T03:27:22.651855 | 2021-08-20T23:09:21 | 2021-08-20T23:09:21 | 353,164,357 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,221 | java | package logica.metodo;
import java.util.Scanner;
public class ConversorTemperatuira {
public static void main(String[] args) {
// Dados de entrada
Scanner ler = new Scanner(System.in);
Scanner op = new Scanner(System.in);
System.out.println("Digite a temperatura: ");
// Váriavel que recebe o dado do usuário
double temp = ler.nextDouble();
System.out.println("1 = Fahrenheit");
System.out.println("2 = Celsius");
// váriavel para escolher opção
int opcao = op.nextInt();
// Váriavale para resposta
double r;
if (opcao == 1) {
r = converterFahrenheitCelsius(temp);
} else if (opcao == 2) {
r = converterCelsiusFahrenheit(temp);
} else {
System.out.println("Opção inválida");
return;
}
System.out.println("A temperatura convertida é: " + r);
}
// Conversor de fahrenheit para celsius
static double converterFahrenheitCelsius(double fahrenheit) {
double celsius = (fahrenheit - 32) / 1.8;
return celsius;
}
// conversor de celsius para fahrenheit
static double converterCelsiusFahrenheit(double celsius) {
double fahrenheit = celsius * 1.8 + 32;
return fahrenheit;
}
}
| [
"[email protected]"
] | |
40637b5221e706180bf87904e0e8d4df3acac15e | 9c4eeab181d6c76f79e4c47e0b0351732b0ff8b8 | /src/main/java/pl/camp/it/model/parent/Parent.java | 493f5e8f5485be65725878b0f8075013660be7f4 | [] | no_license | MarKrol/LawFinancialAccouting | 9aa9b0b3ae9c4d632d5ba85eebc3e96f2b5a73cd | 567f3dd2e68ac3a0a4b45ccd04989e7e6dfc1f53 | refs/heads/master | 2022-07-09T18:12:29.261159 | 2020-03-01T23:13:44 | 2020-03-01T23:13:44 | 244,238,350 | 0 | 0 | null | 2022-02-10T02:59:47 | 2020-03-01T23:09:23 | Java | UTF-8 | Java | false | false | 2,140 | java | package pl.camp.it.model.parent;
import pl.camp.it.model.preschooler.Preschooler;
import javax.persistence.*;
@Entity(name = "tparent")
public class Parent {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int id;
private String name;
private String surname;
private String phone;
private String email;
private String street;
private String numberHouse;
private String zip;
private String city;
private boolean quantity;
@ManyToOne
@JoinColumn(name="preschoolerId")
Preschooler preschooler;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public boolean isQuantity() {
return quantity;
}
public void setQuantity(boolean quantity) {
this.quantity = quantity;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurname(String surname) {
this.surname = surname;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getStreet() {
return street;
}
public void setStreet(String street) {
this.street = street;
}
public String getNumberHouse() {
return numberHouse;
}
public void setNumberHouse(String numberHouse) {
this.numberHouse = numberHouse;
}
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public Preschooler getPreschooler() {
return preschooler;
}
public void setPreschooler(Preschooler preschooler) {
this.preschooler = preschooler;
}
}
| [
"[email protected]"
] | |
b105ed8ef64831291374e0a3b52562227e592403 | f1b1cbe1b1871f79721072f1c5d415570399208e | /src/org/opengts/CompileTime.java | 66940f6bfdf629ff7c7a46bdbd75f3052bb94c9f | [
"Apache-2.0"
] | permissive | pecko/apgprotection | e13b803bff6e4a14f8c4a3751f931a43f8f68099 | 9744fb507a5f7bc9c7cce18fe97eaf89047fab35 | refs/heads/master | 2020-06-05T19:44:17.888230 | 2014-07-02T16:14:53 | 2014-07-02T16:17:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package org.opengts;
public class CompileTime
{
// 2014/06/30 17:26:24 CEST
public static final long COMPILE_TIMESTAMP = 1404141984L;
public static final String COMPILE_DATETIME = "2014/06/30 17:26:24 CEST";
public static final String SERVICE_ACCOUNT_ID = "opengts";
public static final String SERVICE_ACCOUNT_NAME = "APG Protection";
public static final String SERVICE_ACCOUNT_KEY = "";
}
| [
"[email protected]"
] | |
474f2caabc071a2c0fb2f717632ab26b4b2db01e | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project408/src/test/java/org/gradle/test/performance/largejavamultiproject/project408/p2042/Test40855.java | ddde8e29381318351578add343fbed20ee700b2d | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package org.gradle.test.performance.largejavamultiproject.project408.p2042;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test40855 {
Production40855 objectUnderTest = new Production40855();
@Test
public void testProperty0() {
String value = "value";
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
String value = "value";
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
String value = "value";
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"[email protected]"
] | |
0bba5754bd977128b88a59d3fe3ca21e32e17fa1 | e893bafbb51993ee8ad152ad93ea3b16c6ef0945 | /entirej-core/src/org/entirej/framework/core/renderers/definitions/interfaces/EJLovRendererDefinition.java | 52fee012e79eef27710573e11599f0411a5238e4 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | luciferaaa/core | 15bb47569a9bf465afa3c07e317dbbbd66bd72ba | 9a925955315ee79a4b39a00b596bc5ad5088a2c1 | refs/heads/master | 2020-06-13T16:27:37.166914 | 2015-03-25T17:23:00 | 2015-03-25T17:23:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,478 | java | /*******************************************************************************
* Copyright 2013 Mojave Innovations GmbH
*
* 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.
*
* Contributors:
* Mojave Innovations GmbH - initial API and implementation
******************************************************************************/
package org.entirej.framework.core.renderers.definitions.interfaces;
import org.entirej.framework.core.properties.definitions.interfaces.EJPropertyDefinitionGroup;
public interface EJLovRendererDefinition extends EJRendererDefinition
{
/**
* Indicates to the EntireJ Plugin that it can allow users to create spacer
* items on this lov
* <p>
* Spacer items are used by users to help create complex lov screens
*
* @return <code>true</code> if this lov renderer allows spacers, otherwise
* <code>false</code>
*/
public boolean allowSpacerItems();
/**
* Returns the renderer properties that need to be entered by the users
* <p>
* The <code>EJPropertyDefinitionGroup</code> returned by this method will
* be used by the <b>EntireJ Framework Plugin</code> to display a list of
* properties to the user. These values will then be saved to the form
* definition file and later made available to the
* <code>EJLovRenderer</code> by the <b>EntireJ Framework</b>
*
* @return The property definitions for this item or <code>null</code> if no
* properties are available
*/
public EJPropertyDefinitionGroup getLovPropertyDefinitionGroup();
/**
* It is possible that each lov renderer requires its item renderers to have
* various properties set in order for the item renderer to work correctly
* within the lov. This method returns the properties group that contains
* all required item properties
*
* @return The lov renderer defined properties for each item or
* <code>null</code> if no properties are available
*/
public EJPropertyDefinitionGroup getItemPropertiesDefinitionGroup();
/**
* It is possible for an LOV renderer to allow the display of spacer item in
* order to ease the creation of complex screens. This method returns the
* definition group for a spacer item or <code>null</code> if there is no
* spacers allowed on this lov
*
* @return The lov renderer defined properties for each spacer item or
* <code>null</code> if no spacer items are allowed
*/
public EJPropertyDefinitionGroup getSpacerItemPropertiesDefinitionGroup();
/**
* Returns the renderer properties that can be entered by the users for each
* item groups contained within the main screen
* <p>
* The <code>IPropertyDefinitionGroup</code> returned by this method will be
* used by the <b>EntireJ Framework Plugin</code> to display a list of
* properties to the user. These values will then be saved to the form
* definition file and later made available to the
* <code>{@link EJBlockRenderer}</code> by the <b>EntireJ Framework</b>
*
* @return The property definitions for the main screen item groups or
* <code>null</code> if no properties are defined
*/
public EJPropertyDefinitionGroup getItemGroupPropertiesDefinitionGroup();
/**
* Indicates that the lov renderer requires that all rows in the lov
* definition block be retrieved
* <p>
* If this is not set then it is possible for the records to be retrieved in
* pages
*
* @return <code>true</code> if all records must be retrieved otherwise
* <code>false</code>
*/
public boolean requiresAllRowsRetrieved();
/**
* Indicates if the lov renderer allows the user to use the standard query
* pane as with standard blocks
*
* @return <code>true</code> if the user can use a standard query, otherwise
* <code>false</code>
*/
public boolean allowsUserQuery();
/**
* If the lov renderer allows a user query, then a
* <code>{@link EJQueryScreenRendererDefinition}</code> is required. This
* will be used to display the correct properties and viewer within the EJ
* Plugin
*
* @return The <code>{@link EJQueryScreenRendererDefinition}</code> for this
* Lov Renderer or <code>null</code> if the lov does not allow a
* user query
*/
public EJQueryScreenRendererDefinition getQueryScreenRendererDefinition();
/**
* Indicates if the lov renderer requires an automatic query when the lov
* window is displayed
* <p>
* Automatic queries are executed as the lov is opened
*
* @return <code>true</code> if the renderer requires an automatic query
* otherwise <code>false</code>
*/
public boolean executeAutomaticQuery();
}
| [
"[email protected]"
] | |
e336f10986d36bf097d1e5c00abb572bf60b3340 | 30d42c2d99296078fd220e7db4afb7514de14cf6 | /wustrive-java-core/src/main/java/org/wustrive/java/core/request/StateMap.java | 308c5749d13da3a612f6a1089c77abe36a0ba2d8 | [] | no_license | wustrive2008/wustrive-java | d6713c5776b5933c064fed9266215b434d4c5ebc | 71696821a39ce1371d1fa89eaab694a828c042d8 | refs/heads/master | 2020-05-21T10:49:17.859278 | 2018-03-20T08:51:46 | 2018-03-20T08:51:46 | 84,619,875 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,922 | java | package org.wustrive.java.core.request;
import java.util.HashMap;
import java.util.Map;
/**
* @Description: HTTP API 错误码定义
* @author wubaoguo
* @mail: [email protected]
* @date: 2017年3月14日 上午10:13:02
* @version: v0.0.1
*/
public class StateMap {
private static final Map<Integer, String> map;
/** 调用处理成功 **/
// 成功返回标识
public static final int S_SUCCESS = 1;
/** 客户端输入错误 **/
//参数为空
public static final int S_CLIENT_PARAM_NULL = 10001;
//参数错误
public static final int S_CLIENT_PARAM_ERROR = 10002;
//操作警告
public static final int S_CLIENT_WARNING = 10003;
/** 客户端权限错误 **/
//登录认证失败
public static final int S_AUTH_ERROR = 20001;
//重复登录
public static final int S_AUTH_REPET_LOGIN = 20002;
//Token过期
public static final int S_AUTH_TIMEOUT = 20003;
/** 服务器输出错误 **/
//服务端异常
public static final int S_SERVER_EXCEPTION = 30001;
//请求过快,稍后重试
public static final int S_SERVER_CONCURRENT = 30002;
static {
map = new HashMap<Integer, String>() {
private static final long serialVersionUID = 2465184251826686088L;
{
put(S_SUCCESS, "操作成功");
put(S_CLIENT_PARAM_NULL, "参数不能为空");
put(S_CLIENT_PARAM_ERROR, "参数错误");
put(S_AUTH_ERROR, "登录失败,请确认账号密码后重试");
put(S_AUTH_REPET_LOGIN, "重复登录");
put(S_AUTH_TIMEOUT, "授权过期,请重新登录");
put(S_SERVER_EXCEPTION, "服务端异常,稍后重试或联系管理员");
put(S_SERVER_CONCURRENT, "操作过快,稍后重试");
}};
}
public static String get(Integer key) {
return map.get(key);
}
}
| [
"[email protected]"
] | |
642ee2b2f493ceaebeaa388532413566f5fcc62f | 16bd4e214cccbb931d32d610490214aee017b5eb | /bridge/src/com/sri/pal/upgrader/ActionVisitor.java | 5da06c92a2d8c78af9db04b1f87310802ffc94e5 | [
"Apache-2.0"
] | permissive | SRI-SAVE/ESE | df081e0f974fc37c1054f0a6d552d3fbf69fe300 | e06ec5cd47d69ee6da10e0c7544787a53189a024 | refs/heads/master | 2021-01-10T15:31:33.086493 | 2016-07-26T17:05:01 | 2016-07-26T17:05:01 | 54,749,142 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,313 | java | /*
* Copyright 2016 SRI International
*
* 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.
*/
// $Id: ActionVisitor.java 7401 2016-03-25 20:18:20Z Chris Jones (E24486) $
package com.sri.pal.upgrader;
/**
* This interface is implemented by code that wishes to examine each action call
* in a procedure source. The action calls can be modified.
*
* @see ProcedureUpgrader#visitActions
*/
public interface ActionVisitor {
/**
* Visits a particular action call. The implementor can examine the given
* action name and arguments, and a new action name and/or arguments can be
* supplied.
*
* @param action
* the called action
* @return a new called action to replace the original, or the same object
*/
public ActionCall visit(ActionCall action);
}
| [
"[email protected]"
] | |
b800bcc29524c65693eb25fb2c6884ff4fe49c95 | c464d474081e777cddce0dd1be194dc3b4450323 | /src/main/java/paquete/practicas/config/CacheConfiguration.java | d03b4e2542194ec7bd87ef9f0d1e066ddd49e36e | [] | no_license | JR-10/proyecto-jhipster | a42cc5bcb9fbb06642ecadb4343406332822ab45 | ed437302af4c44980182ce002a400276ea8a73f0 | refs/heads/master | 2021-06-29T03:04:23.544363 | 2017-09-20T19:16:50 | 2017-09-20T19:16:50 | 104,256,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,103 | java | package paquete.practicas.config;
import io.github.jhipster.config.JHipsterProperties;
import org.ehcache.config.builders.CacheConfigurationBuilder;
import org.ehcache.config.builders.ResourcePoolsBuilder;
import org.ehcache.expiry.Duration;
import org.ehcache.expiry.Expirations;
import org.ehcache.jsr107.Eh107Configuration;
import java.util.concurrent.TimeUnit;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.*;
@Configuration
@EnableCaching
@AutoConfigureAfter(value = { MetricsConfiguration.class })
@AutoConfigureBefore(value = { WebConfigurer.class, DatabaseConfiguration.class })
public class CacheConfiguration {
private final javax.cache.configuration.Configuration<Object, Object> jcacheConfiguration;
public CacheConfiguration(JHipsterProperties jHipsterProperties) {
JHipsterProperties.Cache.Ehcache ehcache =
jHipsterProperties.getCache().getEhcache();
jcacheConfiguration = Eh107Configuration.fromEhcacheCacheConfiguration(
CacheConfigurationBuilder.newCacheConfigurationBuilder(Object.class, Object.class,
ResourcePoolsBuilder.heap(ehcache.getMaxEntries()))
.withExpiry(Expirations.timeToLiveExpiration(Duration.of(ehcache.getTimeToLiveSeconds(), TimeUnit.SECONDS)))
.build());
}
@Bean
public JCacheManagerCustomizer cacheManagerCustomizer() {
return cm -> {
cm.createCache("users", jcacheConfiguration);
cm.createCache(paquete.practicas.domain.User.class.getName(), jcacheConfiguration);
cm.createCache(paquete.practicas.domain.Authority.class.getName(), jcacheConfiguration);
cm.createCache(paquete.practicas.domain.User.class.getName() + ".authorities", jcacheConfiguration);
// jhipster-needle-ehcache-add-entry
};
}
}
| [
"[email protected]"
] | |
aa162a0c6c6d22adbe5d3c7188d18872194fcdd2 | 9216609c8ae7fb4dfd531da417be597c806b84b3 | /src/Map1/Topping1.java | 50f9d9ed3a8155b89275f9efe35dbc90d06d92e8 | [] | no_license | radoslavh/CodingBat | 0d2d77953dd1f083692eb6111f28d89a53808315 | da2023683fd8ef2090f9e0022b1edd1510188fda | refs/heads/master | 2021-08-20T09:32:06.590756 | 2017-11-27T20:05:56 | 2017-11-28T19:43:12 | 112,087,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package Map1;
import java.util.Map;
/**
* Given a map of food keys and topping values, modify and return the map as follows:
* if the key "ice cream" is present, set its value to "cherry".
* In all cases, set the key "bread" to have the value "butter".
*/
public class Topping1 {
public Map<String, String> topping1(Map<String, String> map) {
map.put("bread", "butter");
if (map.containsKey("ice cream")) map.put("ice cream", "cherry");
return map;
}
}
| [
"[email protected]"
] | |
d7f21783a50dfbe08f3d8e1efe9e234a26c0165b | b717f72c64eb89bbc04370190c3fe54b661a70c5 | /Wired_Woodmen_2018_A1_To_Crater.java | 9f8871b4bfdbdfa5f983858d21455359b3e352f5 | [] | no_license | Madzook/WW8793_2018 | b23adb8fe8d95b6a70baf6df807c0afa3a328c25 | 1f58a9cf774d09e0c2c50320d626569b1ff2a876 | refs/heads/master | 2020-04-02T07:59:42.263095 | 2019-09-02T13:57:14 | 2019-09-02T13:57:14 | 154,224,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,606 | java | package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
@Autonomous(name="Wired_Woodmen_2018_A1_To_Crater", group="Wired Woodman")
public class Wired_Woodmen_2018_A1_To_Crater extends AutoLinearAbstract_2018 {
//Created for position that is not in front of crater
public void runOpMode() {
super.runOpMode();
latchArmGripper.goToPositionNow(LATCH_ARM_GRIPPER_CLOSED_POS);
latchArm.goToAbsoluteDegrees(90, .1);
generalTimer.reset();
//extends latchArm
//opens up the claw
latchArm.goToRelativeDistance(-16500, 1);
backExtension.goToPositionNow(BACK_EXTEND_POS);
generalTimer.reset();
while (!latchArm.isMoveDone(100)&& generalTimer.seconds() > 3.0) {
telemetry.addLine("Wait - Latch Arm landing the robot");
motorTelemetry(latchArm);
telemetry.update();
if (autoTimer.seconds() > 28) {
latchArm.stop();
break;
}
}
telemetry.addLine("Wait - Open gripper");
latchArmGripper.goToPosition(LATCH_ARM_GRIPPER_OPEN_POS, .01);
driveTrain.goStraightToTarget(24, DRIVE_TRAIN_DEFAULT_SPEED);
while (!driveTrain.isMoveDone(MAX_DRIVE_TRAIN_POSITION_ERROR_INCHES)) {
telemetry.addLine("Wait - Drive train move straight towards team marker area");
driveTrainTelemetry();
telemetry.update();
if (autoTimer.seconds() > 28) {
driveTrain.stop();
break;
}
}
driveTrain.goRoundToTarget(0, 33, DRIVE_TRAIN_DEFAULT_SPEED);
while (!driveTrain.isMoveDone(MAX_DRIVE_TRAIN_POSITION_ERROR_INCHES)) {
telemetry.addLine("Wait - Drive train move left towards crater");
driveTrainTelemetry();
telemetry.update();
if (autoTimer.seconds() > 28) {
driveTrain.stop();
break;
}
}
driveTrain.goStraightToTarget(55, DRIVE_TRAIN_DEFAULT_SPEED);
while (!driveTrain.isMoveDone(MAX_DRIVE_TRAIN_POSITION_ERROR_INCHES)) {
telemetry.addLine("Wait - Drive train move straight towards crater");
driveTrainTelemetry();
telemetry.update();
if (autoTimer.seconds() > 28) {
driveTrain.stop();
break;
}
}
}
} | [
"[email protected]"
] | |
6ded8771c342b86b2fe6b4b81f30c04fd3a74dc8 | 6d3ea1f8617dc237ea015ca0544c5f44d04c9f4f | /email-gateway-emulator/src/main/java/com/emailgateway/vo/UserInfo.java | 07c5c86e5f00bc98cc0448b0866c46025adb5d67 | [] | no_license | mahisandip/spring-boot | d12e682050dd2ab50f014dd57b1ebc24f155f767 | 6ffc3d9740022193c6628882b374313c169b2225 | refs/heads/master | 2021-05-20T20:00:33.340286 | 2020-08-05T06:16:22 | 2020-08-05T06:16:22 | 252,399,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 993 | java | package com.emailgateway.vo;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonRootName(value = "userInfo")
public class UserInfo implements Serializable {
private static final long serialVersionUID = 1L;
@JsonProperty("username")
@NotNull
private String username;
@JsonProperty("password")
@NotNull
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
] | |
054137456e100e042068ed0d495230bb8ce512e6 | b4e3ef903d12b3cbff39ecaacc4a8b144aba7057 | /onlineEducation/src/main/java/com/gxg/service/impl/UserServiceImpl.java | 0eb4176ad3fb706c0ff2f23b7345d7ce94057e91 | [] | no_license | xinguang1996/onlineEducation | 0ff43ad95790abf1b569e67249c1cc76c03f8372 | 34850288c1b44ce6bb78ca2034ec7d4ba6072421 | refs/heads/master | 2022-01-08T20:57:02.449501 | 2019-05-21T07:14:57 | 2019-05-21T07:14:57 | 165,813,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,659 | java | package com.gxg.service.impl;
import com.gxg.dao.MessageDao;
import com.gxg.dao.UserDao;
import com.gxg.entities.User;
import com.gxg.service.MailService;
import com.gxg.service.MessageService;
import com.gxg.service.UserService;
import com.gxg.utils.FileUtils;
import com.gxg.utils.Md5;
import com.gxg.utils.StringUtils;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.ui.freemarker.FreeMarkerTemplateUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* 用户相关业务处理
* @author 郭欣光
* @date 2019/1/16 14:48
*/
@Service(value = "userService")
public class UserServiceImpl implements UserService {
@Value("${user.headImage.max.size}")
private long userHeadImageMaxSize;
@Value("${user.headImage.max.size.string}")
private String userHeadImageMaxSizeString;
@Autowired
private UserDao userDao;
@Value("${user.resource.dir}")
private String userResourceDir;
@Value("${sys.name}")
private String sysName;
@Autowired
Configuration configuration;//这里注入的是freeMarker的configuration
@Autowired
private MailService mailService;
@Value("${sys.root.url}")
private String sysRootUrl;
@Autowired
private MessageDao messageDao;
@Autowired
private MessageService messageService;
/**
* 用户注册信息处理
*
* @param email 邮箱
* @param name 姓名
* @param password 密码
* @param repassword 重复密码
* @param sex 性别
* @param job 职业
* @param headImage 头像
* @param request 用户请求信息
* @return 处理结果
* @author 郭欣光
*/
@Override
public String register(String email, String name, String password, String repassword, String sex, String job, MultipartFile headImage, HttpServletRequest request) {
JSONObject result = new JSONObject();
String status = "false";
String content = "注册失败!";
if (StringUtils.isEmpty(email)) {
content = "邮箱不能为空,请输入您的邮箱";
} else if (email.length() > 150) {
content = "邮箱长度不能超过150个字符!";
} else if (!StringUtils.isEmail(email)) {
content = "给个正确的邮箱格式吧~";
} else if (StringUtils.isEmpty(name)) {
content = "留下您的姓名吧!";
} else if (name.length() > 100) {
content = "您的姓名太长啦,超过100字符我有点记不住";
} else if (StringUtils.isEmpty(password)) {
content = "留下密码才安全";
} else if (password.length() > 20) {
content = "密码20字符以内就很安全啦!";
} else if (!password.equals(repassword)) {
content = "两次输入的密码不一致,我该记住哪一个呢?";
} else if (StringUtils.isEmpty(sex)) {
content = "咦?难道没有默认性别吗?";
} else if (sex.length() > 1) {
content = "难道性别长度被篡改了?";
} else if (StringUtils.isEmpty(job)) {
content = "咦?难道没有默认职业吗?";
} else if (job.length() > 10) {
content = "难道职位长度被篡改了?";
} else if (headImage == null) {
content = "选一个头像更有吸引力哦~";
} else {
boolean isImage = true;
try {
if (!FileUtils.isImage(headImage)) {
isImage = false;
content = "上传的头像必须是图片类型哦~";
}
} catch (Exception e) {
isImage = false;
System.out.println("ERROR:用户注册在判断上传头像是否为图片时出错,错误原因:" + e);
content = "系统在判断上传头像是否为图片类型时出错";
}
if (isImage) {
String headImageName = headImage.getOriginalFilename();
String headImageType = headImageName.substring(headImageName.lastIndexOf(".") + 1);//上传图片的后缀类型
if (!FileUtils.isImageByType(headImageType)) {
content = "上传的头像必须是图片类型哦~";
} else if (FileUtils.getFileSize(headImage) > userHeadImageMaxSize) {
content = "头像太大啦,不要超过" + userHeadImageMaxSizeString + "哦~";
} else if (userDao.getUserCountByEmail(email) > 0) {
content = "该邮箱已被注册!";
} else {
String emailMd5 = Md5.md5(email);
String headImageDir = userResourceDir + emailMd5 + "/";
String imageName = emailMd5 + "." + headImageType;
JSONObject uploadHeadImageResult = FileUtils.uploadFile(headImage, imageName, headImageDir);
if ("true".equals(uploadHeadImageResult.getString("status"))) {
Timestamp time = new Timestamp(System.currentTimeMillis());
User user = new User();
user.setEmail(email);
user.setPassword(Md5.md5(password));
user.setName(name);
user.setSex(sex);
user.setRole(job);
user.setHeadImage(emailMd5 + "/" + imageName);
user.setCreateTime(time);
user.setIsVerification("0");
boolean insertSuccess = false;
try {
if (userDao.createUser(user) == 0) {
System.out.println("ERROR:用户注册时操作数据库失败!");
content = "操作数据库失败!";
} else {
insertSuccess = true;
}
} catch (Exception e) {
System.out.println("ERROR:用户注册时操作数据库失败!失败原因:" + e);
content = "操作数据库失败!";
}
if (insertSuccess) {
boolean isSendEmailSuccess = false;
String emailMessage = createUserRegisterEmailMessage(user);
Map<String, Object> model = new HashMap<String, Object>();
model.put("time", new Date());
model.put("emailMessage", emailMessage);
model.put("toUserName", name);
model.put("fromUserName", sysName);
try {
Template t = configuration.getTemplate("email_html_temp.ftl");
String emailContent = FreeMarkerTemplateUtils.processTemplateIntoString(t, model);
JSONObject sendEmailResult = mailService.sendHtmlMail(email, "邮箱验证", emailContent);
if ("true".equals(sendEmailResult.getString("status"))) {
isSendEmailSuccess = true;
} else {
System.out.println("ERROR:用户注册时发送邮件失败!");
content = "系统向邮箱中发送验证信息失败,请确认您的邮箱信息是否正确,如邮箱信息正确,请您稍后再次尝试!";
}
} catch (Exception e) {
System.out.println("ERROR:用户注册时发送邮件失败,失败原因:" + e);
content = "系统向邮箱中发送验证信息失败,请确认您的邮箱信息是否正确,如邮箱信息正确,请您稍后再次尝试!";
}
if (isSendEmailSuccess) {
status = "true";
content = "为了您的信息安全,验证信息已发送至您的邮箱,请您在两小时之内点击邮箱内链接完成验证";
} else {
boolean deleteUserSuccess = false;
try {
if (userDao.deleteUserByEmail(email) == 0) {
System.out.println("ERROR:用户注册时发送邮件失败,删除用户信息时操作数据库出错!");
} else {
deleteUserSuccess = true;
}
} catch (Exception e) {
System.out.println("ERROR:用户注册时发送邮件失败,删除用户信息时操作数据库出错!错误信息为:" + e);
}
if (deleteUserSuccess) {
JSONObject deleteHeadImageResult = FileUtils.deleteFile(headImageDir + imageName);
System.out.println("INFO:用户注册时发送邮件失败后删除头像结果:" + deleteHeadImageResult.toString());
}
}
} else {
JSONObject deleteHeadImageResult = FileUtils.deleteFile(headImageDir + imageName);
System.out.println("INFO:用户注册时操作数据库失败后删除头像结果:" + deleteHeadImageResult.toString());
}
} else {
System.out.println("ERROR:用户注册时上传头像失败,失败原因:" + uploadHeadImageResult.getString("content"));
content = "上传头像失败,失败原因:" + uploadHeadImageResult.getString("content");
}
}
}
}
result.accumulate("status", status);
result.accumulate("content", content);
return result.toString();
}
private String createUserRegisterEmailMessage(User user) {
String message;
if ("教师".equals(user.getRole())) {
message = "<p>欢迎您注册" + sysName + ",我们将竭诚为您服务,您可以随意发布课程及其内容(注意遵守国家相关法律法规),您的公开课程将面向所有用户,您的付出将为祖国培养更多的人才,我们再次对您表示感谢。" +
"如果您有部分课程不愿意公开,可以发布为私有课程,您可以手动添加学生前来学习,方便您正常的教学。" +
"为了您的信息安全,请您点击下列连接完成邮箱验证:<a href='" + sysRootUrl + "user/register/" + user.getEmail() + "/" + registerRule(user) + "/'>" + sysRootUrl + "user/register/" + user.getEmail() + "/" + registerRule(user) + "/ </a></p>";
message += "<p style='color:red'>请在两小时内完成验证,否则将导致注册失败!</p>";
message += "祝您身体健康,工作愉快!";
} else {
message = "<p>欢迎您注册" + sysName + ",我们将竭诚为您服务," + sysName + "有大量课程资源,您可以免费学习所有公开课程,私有课程只有教师主动添加才可以进行学习。" +
"我们相信在这里您的学习成绩将有一个质的的飞跃!" +
"为了您的信息安全,请您点击下列连接完成邮箱验证:<a href='" + sysRootUrl + "user/register/" + user.getEmail() + "/" + registerRule(user) + "/'>" + sysRootUrl + "user/register/" + user.getEmail() + "/" + registerRule(user) + "/ </a></p>";
message += "<p style='color:red'>请在两小时内完成验证,否则将导致注册失败!</p>";
message += "祝您身体健康,学业有成!";
}
return message;
}
/**
* 注册验证规则
* @param user 用户信息
* @return 密文
*/
private String registerRule(User user) {
String message = Md5.md5(user.getEmail() + user.getPassword());
return message;
}
/**
* 删除用户
*
* @param user 用户信息
* @return 删除结果
*/
@Override
public JSONObject deleteUser(User user) {
JSONObject result = new JSONObject();
String status = "false";
String content = "删除失败!";
if (userDao.getUserCountByEmail(user.getEmail()) == 0) {
content = "该用户不存在!";
} else {
boolean isDeleteUser = false;
try {
if (userDao.deleteUserByEmail(user.getEmail()) == 0) {
System.out.println("ERROR:删除用户" + user.getEmail() + "失败!");
content = "操作数据库失败!";
} else {
isDeleteUser = true;
status = "true";
content= "删除成功!";
}
} catch (Exception e) {
System.out.println("ERROR:删除用户" + user.getEmail() + "失败,失败原因:" + e);
content = "操作数据库失败!";
}
if (isDeleteUser) {
//查询是否有未清除的消息进行清除
if (messageDao.getCountByEmail(user.getEmail()) != 0) {
try {
if (messageDao.deleteMessageByEmail(user.getEmail()) == 0) {
System.out.println("ERROR:系统在删除用户" + user.getEmail() + "的消息通知时操作数据库失败,改变数据库行数0");
}
} catch (Exception e) {
System.out.println("ERROR:系统在删除用户" + user.getEmail() + "的消息通知时操作数据库失败,失败原因:" + e);
}
}
String userHeadImageUrl = userResourceDir + user.getHeadImage();
if (FileUtils.fileExists(userHeadImageUrl)) {
// 删除用户头像文件
JSONObject deleteHeadImageResult = FileUtils.deleteFile(userHeadImageUrl);
System.out.println("INFO:系统在删除用户" + user.getEmail() + "头像" + userHeadImageUrl + "结果:" + deleteHeadImageResult.toString());
}
}
}
result.accumulate("status", status);
result.accumulate("content", content);
return result;
}
/**
* 用户注册验证
*
* @param email 邮箱
* @param verificationRule 验证规则
* @return 验证结果
*/
@Override
public JSONObject register(String email, String verificationRule) {
JSONObject result = new JSONObject();
String promptTitle = "验证失败";
String promptMessage = "对不起,邮箱验证失败,请您确认验证时间是否超时或向您邮箱发送的验证连接的正确性";
if (userDao.getUserCountByEmail(email) == 0) {
promptMessage = "对不起,没有查询到" + email + "相关的注册信息,请您确认验证时间是否超时或向您邮箱发送的验证连接的正确性";
} else {
User user = userDao.getUserByEmail(email);
if ("0".equals(user.getIsVerification())) {
String systemVerificationRule = registerRule(user);
if (systemVerificationRule != null && systemVerificationRule.equals(verificationRule)) {
user.setIsVerification("1");
try {
if (userDao.updateUser(user) == 0) {
System.out.println("ERROR:用户注册验证邮箱时操作数据库错误");
promptMessage = "对不起,邮箱" + email + "在验证时操作数据库错误,请您稍后再试,给您带来的不便敬请谅解";
} else {
promptTitle = "验证成功";
promptMessage = "恭喜您,邮箱" + email + "验证成功!欢迎加入" + sysName + "!";
String messageTitle = "欢迎加入" + sysName;
String messageContent = createVerificationSuccessEmailMessage();
JSONObject createMessageResult = messageService.createMessage(user.getEmail(), messageTitle, messageContent);
System.out.println("INFO:用户" + user.getEmail() + "注册验证时创建消息通知结果:" + createMessageResult.toString());
}
} catch (Exception e) {
System.out.println("ERROR:用户注册验证邮箱时操作数据库错误,错误信息:" + e);
}
} else {
promptMessage = "对不起," + email + "的验证连接不正确,请您确认向您邮箱发送的验证连接的正确性";
}
} else {
promptMessage = "对不起," + email + "已被验证,请您确认向您邮箱发送的验证连接的正确性";
}
}
result.accumulate("promptTitle", promptTitle);
result.accumulate("promptMessage", promptMessage);
return result;
}
private String createVerificationSuccessEmailMessage() {
String message = "<p>欢迎加入" + sysName + ",感谢您对我们的信赖与支持,茫茫人海我们相遇,感谢您的选择,我们将竭诚为您服务。</p>";
message += "<p>祝您在" + sysName + "学习进步!</p>";
return message;
}
/**
* 用户登录
*
* @param email 邮箱
* @param password 密码
* @param nextPage 登陆成功后转入页面
* @param request 用户请求信息
* @return 登录结果
* @author 郭欣光
*/
@Override
public String login(String email, String password, String nextPage, HttpServletRequest request) {
JSONObject result = new JSONObject();
String status = "false";
String content = "登录失败!";
if (StringUtils.isEmpty(email)) {
content = "请输入邮箱!";
} else if (email.length() > 150) {
content = "邮箱长度不能超过150字符!";
} else if (!StringUtils.isEmail(email)) {
content = "您输入的邮箱格式不正确!";
} else if (StringUtils.isEmpty(password)) {
content = "请输入密码!";
} else if (userDao.getUserCountByEmail(email) == 0) {
content = "该用户不存在!";
} else {
User user = userDao.getUserByEmail(email);
if ("0".equals(user.getIsVerification())) {
content = "账号:" + email + "未进行邮箱验证,请您点击邮箱内链接进行验证!";
} else if (Md5.md5(password).equals(user.getPassword())) {
HttpSession session = request.getSession();
session.setAttribute("user", user);
content = nextPage;
status = "true";
} else {
content = "密码错误!";
}
}
result.accumulate("status", status);
result.accumulate("content", content);
return result.toString();
}
/**
* 注销用户
*
* @param request 用户请求信息
* @return 处理结果
* @author 郭欣光
*/
@Override
public String cancel(HttpServletRequest request) {
JSONObject result = new JSONObject();
String status = "false";
String content = "注销失败!";
HttpSession session = request.getSession();
if (session.getAttribute("user") == null) {
content = "系统未检测到登录用户,请您刷新页面后重新尝试!";
} else {
User user = (User)session.getAttribute("user");
JSONObject deleteUserResult = deleteUser(user);
if ("true".equals(deleteUserResult.getString("status"))) {
status = "true";
content = "删除成功!";
session.setAttribute("user", null);
//发送邮件进行通知
String emailMessage = createCancelEmailMessage(user);
Map<String, Object> model = new HashMap<String, Object>();
model.put("time", new Date());
model.put("emailMessage", emailMessage);
model.put("toUserName", user.getName());
model.put("fromUserName", sysName);
try {
Template t = configuration.getTemplate("email_html_temp.ftl");
String emailContent = FreeMarkerTemplateUtils.processTemplateIntoString(t, model);
JSONObject sendEmailResult = mailService.sendHtmlMail(user.getEmail(), "感谢您一路的陪伴", emailContent);
System.out.println("INFO:系统在注销用户时为用户" + user.getEmail() + "发送邮件结果:" + sendEmailResult.toString());
} catch (Exception e) {
System.out.println("ERROR:系统在注销用户时为用户" + user.getEmail() + "发送邮件失败,失败原因:" + e);
}
} else {
content = deleteUserResult.getString("content");
}
}
result.accumulate("status", status);
result.accumulate("content", content);
return result.toString();
}
/**
* 退出登录
*
* @param request 用户请求信息
* @return 处理结果
* @author 郭欣光
*/
@Override
public String logout(HttpServletRequest request) {
JSONObject result = new JSONObject();
String status = "false";
String content = "退出失败!";
HttpSession session = request.getSession();
session.setAttribute("user", null);
content = "退出成功!";
result.accumulate("status", status);
result.accumulate("content", content);
return result.toString();
}
private String createCancelEmailMessage(User user) {
String message = "<p>感谢您自从" + user.getCreateTime().toString().split("\\.")[0] + "以来对" + sysName + "的陪伴,感谢您对我们的信任,我们会努力发展完善自己,期待与您再次见面。</p>";
message += "<p>祝您身体健康,阖家欢乐!</p>";
return message;
}
/**
* 用户发起重置密码请求,向用户发送重置密码邮箱确认
*
* @param request 用户请求信息
* @return 处理结果
* @author 郭欣光
*/
@Override
public String sendResetPasswordEmail(HttpServletRequest request) {
JSONObject result = new JSONObject();
String status = "false";
String content = "系统出错!";
HttpSession session = request.getSession();
if (session.getAttribute("user") == null) {
content = "系统未检测到登录用户,请刷新后尝试!";
} else {
User user = (User)session.getAttribute("user");
String emailMessage = createUserResetPasswordEmailMessage(user);
Map<String, Object> model = new HashMap<String, Object>();
model.put("time", new Date());
model.put("emailMessage", emailMessage);
model.put("toUserName", user.getName());
model.put("fromUserName", sysName);
try {
Template t = configuration.getTemplate("email_html_temp.ftl");
String emailContent = FreeMarkerTemplateUtils.processTemplateIntoString(t, model);
JSONObject sendEmailResult = mailService.sendHtmlMail(user.getEmail(), "重置密码邮箱验证", emailContent);
if ("true".equals(sendEmailResult.getString("status"))) {
status = "true";
content = "为了您的信息安全,已将验证信息发送至您的邮箱,请前往邮箱进行确认!";
} else {
System.out.println("ERROR:用户请求修改密码时发送邮件失败!");
content = "系统向邮箱中发送验证信息失败,请您稍后再次尝试!";
}
} catch (Exception e) {
System.out.println("ERROR:用户请求修改密码时发送邮件失败,失败原因:" + e);
content = "系统向邮箱中发送验证信息失败,请您稍后再次尝试!";
}
}
result.accumulate("status", status);
result.accumulate("content", content);
return result.toString();
}
private String createUserResetPasswordEmailMessage(User user) {
String message;
message = "<p>您的" + sysName + "账号:" + user.getEmail() + " 正在申请重置密码,为了您的账号安全,请您点击以下链接进行确认。<a href='" + sysRootUrl + "user/password/reset/" + user.getEmail() + "/" + resetPasswordRule(user) + "/'>" + sysRootUrl + "user/password/reset/" + user.getEmail() + "/" + resetPasswordRule(user) + "/ </a></p>";
message += "<p style='color:red'>该链接打死都不能告诉别人哦~</p>";
message += "祝您身体健康,阖家欢乐!";
return message;
}
private String resetPasswordRule(User user) {
String rule = Md5.md5(user.getEmail()) + Md5.md5(user.toString()) + Md5.md5(user.getPassword());
rule = Md5.md5(rule);
return rule;
}
/**
* 重回密码邮箱验证
*
* @param email 邮箱
* @param rule 验证规则
* @param request 用户请求信息
* @return 验证结果
* @author 郭欣光
*/
@Override
public JSONObject resetPasswordVerification(String email, String rule, HttpServletRequest request) {
JSONObject result = new JSONObject();
String status = "false";
String content = "重置密码验证失败,请查看您的邮箱确认您的链接是否正确";
if (userDao.getUserCountByEmail(email) == 0) {
content = "重置密码验证失败,该用户不存在,请查看您的邮箱确认您的链接是否正确";
} else {
User user = userDao.getUserByEmail(email);
if (resetPasswordRule(user).equals(rule)) {
HttpSession session = request.getSession();
session.setAttribute("user", user);
status = "true";
content = "验证成功!";
} else {
content = "重置密码验证失败,请查看您的邮箱确认您的链接是否正确";
}
}
result.accumulate("status", status);
result.accumulate("content", content);
return result;
}
/**
* 用户重置密码
*
* @param password 密码
* @param repassword 确认面膜
* @param request 用户请求信息
* @return 重置结果
* @author 郭欣光
*/
@Override
public String resetPassword(String password, String repassword, HttpServletRequest request) {
JSONObject result = new JSONObject();
String status = "false";
String content = "重置密码失败!";
HttpSession session = request.getSession();
if (session.getAttribute("user") == null) {
content = "系统未检测到用户信息,请刷新页面后重试!";
} else {
User user = (User)session.getAttribute("user");
if (StringUtils.isEmpty(password)) {
content = "请输入密码!";
} else if (!password.equals(repassword)) {
content = "两次密码不一致!";
} else {
user.setPassword(Md5.md5(password));
try {
if (userDao.updateUser(user) == 0) {
System.out.println("ERROR:用户:" + user.getEmail() + "重置密码时操作数据库失败!");
content = "操作数据库失败!";
} else {
session.setAttribute("user", null);
status = "true";
content = "重置密码成功!";
}
} catch (Exception e) {
System.out.println("ERROR:用户" + user.getEmail() + "重置密码时操作数据库失败,失败原因:" + e);
content = "操作数据库失败!";
}
}
if ("true".equals(status)) {
String messageTitle = "重置密码提醒";
String messageContent = createResetPasswordSuccessMessage(user);
JSONObject createMessageResult = messageService.createMessage(user.getEmail(), messageTitle, messageContent);
System.out.println("INFO:用户" + user.getEmail() + "重置密码时创建消息通知结果:" + createMessageResult.toString());
}
}
result.accumulate("status", status);
result.accumulate("content", content);
return result.toString();
}
private String createResetPasswordSuccessMessage(User user) {
Timestamp time = new Timestamp(System.currentTimeMillis());
String timeString = time.toString().split("\\.")[0];
String message;
message = "<p>您的" + sysName + "账号:" + user.getEmail() + " 在" + timeString + "进行了密码重置。</p>";
message += "祝您身体健康,阖家欢乐!";
return message;
}
}
| [
"[email protected]"
] | |
09fe392c6faa4c61d591501d7f4a637e1a12eddf | a464856e8424df518f83c842325fcc8ccf1930d6 | /app/src/main/java/com/adev/root/snipps/utils/ReadingModes.java | 4d18f5fd3201bc9a2db2a711a318d07e0508757b | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Cool-fire/Snipps | 9898f2e16cfe61e68d0d533e489f6af336741175 | 39be3dd1b0e72ff9549c0a00c5ed8c845e7bcb98 | refs/heads/master | 2020-03-20T23:30:05.090961 | 2020-01-04T08:58:34 | 2020-01-04T08:58:34 | 137,849,314 | 5 | 0 | null | 2018-10-03T05:18:54 | 2018-06-19T06:27:15 | Java | UTF-8 | Java | false | false | 569 | java |
package com.adev.root.snipps.utils;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ReadingModes {
@SerializedName("text")
@Expose
private Boolean text;
@SerializedName("image")
@Expose
private Boolean image;
public Boolean getText() {
return text;
}
public void setText(Boolean text) {
this.text = text;
}
public Boolean getImage() {
return image;
}
public void setImage(Boolean image) {
this.image = image;
}
}
| [
"[email protected]"
] | |
e2cae617d8da8e99874d16cace91a1dcd6842611 | ddf59a17fd7c5f715aa7cd72a77f179590539641 | /Milestone1Game/src/milestone1/PlayerMovement.java | bfc775b8698e2db7e3bde1396f9cf5773358471f | [] | no_license | PauliusRRR/adbt189 | ef05d47552857c7a1cfc1e64ecfdd8fad0ffa3a6 | 82bcd8d43d066084bb1482485a2930d666a8f5c5 | refs/heads/master | 2023-03-27T22:24:14.059442 | 2021-03-28T16:00:12 | 2021-03-28T16:00:12 | 302,600,652 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,190 | java | package milestone1;
import city.cs.engine.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
/** Player Movement Development */
public class PlayerMovement implements KeyListener {
private static final float WALKING_SPEED = 5;
private static final float JUMP_speed = 12;
private Player player;
public PlayerMovement(Player p)
{
player = p;
}
@Override
public void keyTyped(KeyEvent e) {
}
//player movement assignment
@Override
public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
if (code == KeyEvent.VK_A) {
player.startWalking(-WALKING_SPEED);
} else if (code == KeyEvent.VK_D) {
player.startWalking(WALKING_SPEED);
}
if (code == KeyEvent.VK_SPACE) {
player.jump(JUMP_speed);
}
}
@Override
public void keyReleased(KeyEvent e) {
int code = e.getKeyCode();
if (code == KeyEvent.VK_A) {
player.stopWalking();
} else if (code == KeyEvent.VK_D) {
player.stopWalking();
}
}
public void updatePlayer(Player player) {this.player = player;}
} | [
"[email protected]"
] | |
0cf5ce9c5878c6977fc09845f28d45a83a92a822 | a32460ae770b9ca795872506697327b57ad231c5 | /NMSUT/src/com/symantec/mobilesecurity/service/JCase1Test.java | 1f4e6ddf34d116f11e5d8b373513e4f4c1ba5fb9 | [] | no_license | jackyliu/Java | cf00570f938a5ed4af873d302478b7ca41395464 | 58aa4e1a674c75788a9620fb30348ed6fbb5a972 | refs/heads/master | 2016-09-06T13:08:41.895089 | 2010-12-17T12:40:52 | 2010-12-17T12:40:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | /*
* JCase1Test.java 1.00 Fri Dec 17 11:50:47 +0800 2010
*
*/
package com.symantec.mobilesecurity.service;
import junit.framework.TestCase;
import junit.framework.Assert;
/**
* @version 1.00
* @author
*/
public class JCase1Test extends TestCase {
public void testXYZ() {
Assert.assertTrue(false);
}
}
// vim: ft=java
| [
"[email protected]"
] | |
b7b9fdacfed648344f9af27f16e6191582c4582e | 81b55c4ea03152ea7d06369b128137d56f6c3281 | /monitor/src/main/java/net/gwy/monitor/config/SecuritySecureConfig.java | ef14d185cdffa0ced976780b52cd80fe6dbf5c5c | [] | no_license | cike001/Project2019 | 5711e13ececb68676387ce3cc67e56ef36fbdb4b | 8781ea5f6f52004d1b8e8d499af3951c97485d1a | refs/heads/master | 2022-12-10T16:27:12.971976 | 2020-05-07T15:19:54 | 2020-05-07T15:19:54 | 192,943,466 | 0 | 0 | null | 2022-12-06T00:44:22 | 2019-06-20T15:20:57 | Java | UTF-8 | Java | false | false | 1,655 | java | package net.gwy.monitor.config;
import de.codecentric.boot.admin.server.config.AdminServerProperties;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
/**
* @author guoweiyang
* @date 2019-05-26
*/
@EnableWebSecurity
public class SecuritySecureConfig extends WebSecurityConfigurerAdapter {
private final String adminContextPath;
public SecuritySecureConfig(AdminServerProperties adminServerProperties) {
this.adminContextPath = adminServerProperties.getContextPath();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
successHandler.setTargetUrlParameter( "redirectTo" );
http.authorizeRequests()
.antMatchers( adminContextPath + "/assets/**" ).permitAll()
.antMatchers( adminContextPath + "/login" ).permitAll()
.anyRequest().authenticated()
.and()
.formLogin().loginPage( adminContextPath + "/login" ).successHandler( successHandler ).and()
.logout().logoutUrl( adminContextPath + "/logout" ).and()
.httpBasic().and()
.csrf().disable();
// @formatter:on
}
}
| [
"[email protected]"
] | |
b96f450ed64dfec67f43fd667d11ed4500817e66 | 5d23a8b1372704fc3c33cf06d6299e77dcfcbfd9 | /RentalCarsTest/src/main/java/com/rentcars/SpringBootConsoleApplication.java | a7248d048f7169225ab05dc4c24c7eff02b345bb | [] | no_license | FerxSal/RentalCarsTest | c6b8606ac337e8600fa0762254c32be43d72651f | 1397be6f69c0d8e4d58b9d7951838517b791abf1 | refs/heads/master | 2021-01-01T06:25:38.559248 | 2017-07-17T02:55:37 | 2017-07-17T02:55:37 | 97,426,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,149 | java | package com.rentcars;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//import com.rentcars.service.HelloMessageService;
import com.rentcars.service.MessageService;
import static java.lang.System.exit;
@SpringBootApplication
public class SpringBootConsoleApplication implements CommandLineRunner {
@Autowired
private MessageService helloService;
public static void main(String[] args) throws Exception {
//disabled banner, don't want to see the spring logo
SpringApplication app = new SpringApplication(SpringBootConsoleApplication.class);
app.setBannerMode(Banner.Mode.OFF);
app.run(args);
}
// Put your logic here.
@Override
public void run(String... args) throws Exception {
if (args.length > 0) {
helloService.getMessage(args[0].toString());
} else {
helloService.getMessage();
}
exit(0);
}
} | [
"[email protected]"
] | |
143ec7f977926ef53a911d8aa13568e56107241c | 146938128d686c9bf775f92374705ad526c58e2a | /archive/other/CodeFestival2017A-C.java | 452aa8999885958b87f3dcbbd9fbc82e64154d06 | [] | no_license | Ziphil/Competitive | 3b3223e94af9f49f86ec93ad1d0a75637e88ddec | 81e95ec57ceefd159efabe71a766818aeb57785a | refs/heads/master | 2020-03-19T11:33:00.452059 | 2018-08-08T14:09:40 | 2018-08-08T14:09:40 | 136,461,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,131 | java | import java.io.*;
import java.util.*;
public class Main implements Runnable {
public void run() {
Scanner scanner = new Scanner(System.in);
int h = scanner.nextInt();
int w = scanner.nextInt();
int[] nums = new int[26];
for (int i = 0 ; i < h ; i ++) {
String a = scanner.next();
for (int j = 0 ; j < w ; j ++) {
nums[(int)a.charAt(j) - 97] ++;
}
}
if (h % 2 == 0 && w % 2 == 0) {
boolean res = true;
for (int c = 0 ; c < 26 ; c ++) {
if (nums[c] % 4 != 0) {
res = false;
break;
}
}
System.out.println((res) ? "Yes" : "No");
} else if ((h % 2 == 1 && w % 2 == 0) || (h % 2 == 0 && w % 2 == 1)) {
boolean res = true;
int count = 0;
for (int c = 0 ; c < 26 ; c ++) {
if (nums[c] % 2 != 0) {
res = false;
break;
}
if (nums[c] % 4 == 2) {
count ++;
}
}
if (res) {
if ((w % 2 == 0 && count <= w / 2) || (h % 2 == 0 && count <= h / 2)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
} else {
System.out.println("No");
}
} else {
int[] mods = new int[26];
for (int c = 0 ; c < 26 ; c ++) {
mods[nums[c] % 4] ++;
}
if (mods[2] <= (h + w - 2) / 2 && mods[1] + mods[3] <= 1) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
public static void main(String[] args) {
Main main = new Main();
main.run();
}
public static class BetterScanner {
private InputStream stream;
private byte[] buffer = new byte[1024];
private int pointer = 0;
private int bufferLength = 0;
public BetterScanner(InputStream stream) {
this.stream = stream;
}
private boolean updateBuffer() {
if (pointer >= bufferLength) {
pointer = 0;
try {
bufferLength = stream.read(buffer);
} catch (IOException exception) {
exception.printStackTrace();
}
return bufferLength > 0;
} else {
return true;
}
}
private int read() {
if (updateBuffer()) {
return buffer[pointer ++];
} else {
return -1;
}
}
public boolean hasNext() {
skipUnprintable();
return updateBuffer();
}
private void skipUnprintable() {
while (updateBuffer() && !isPrintableChar(buffer[pointer])) {
pointer ++;
}
}
public String next() {
if (hasNext()) {
StringBuilder builder = new StringBuilder();
int codePoint = read();
while (isPrintableChar(codePoint)) {
builder.appendCodePoint(codePoint);
codePoint = read();
}
return builder.toString();
} else {
throw new NoSuchElementException();
}
}
public long nextLong() {
if (hasNext()) {
long number = 0;
boolean minus = false;
int codePoint = read();
if (codePoint == '-') {
minus = true;
codePoint = read();
}
if (codePoint >= '0' && codePoint <= '9') {
while (true) {
if (codePoint >= '0' && codePoint <= '9') {
number *= 10;
number += codePoint - '0';
} else if (codePoint < 0 || !isPrintableChar(codePoint)) {
return (minus) ? -number : number;
} else {
throw new NumberFormatException();
}
codePoint = read();
}
} else {
throw new NumberFormatException();
}
} else {
throw new NoSuchElementException();
}
}
public int nextInt() {
long number = nextLong();
if (number >= Integer.MIN_VALUE && number <= Integer.MAX_VALUE) {
return (int)number;
} else {
throw new NumberFormatException();
}
}
private boolean isPrintableChar(int codePoint) {
return codePoint >= 33 && codePoint <= 126;
}
}
}
| [
"[email protected]"
] | |
6367f806dd5dead3d4ca4357416b04dea59f2e7e | 68a39e520c88c529d42924db2144ad9ba57f9779 | /services/src/main/java/org/jia/ptrack/services/SecurityInfoProviderImpl.java | d55bf36285e2317bae8c766657342c0738213a4f | [] | no_license | preetham-chinta/projecttrack | b9bed3198fb888a26a65dfea7143bb32dc6a2c11 | 576d78f9e69cea4cbcce85763c39d30914c57121 | refs/heads/master | 2023-07-19T22:32:29.566371 | 2008-10-12T20:30:41 | 2008-10-12T20:30:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,140 | java | package org.jia.ptrack.services;
import org.acegisecurity.Authentication;
import org.acegisecurity.GrantedAuthority;
import org.acegisecurity.context.SecurityContext;
import org.acegisecurity.context.SecurityContextHolder;
import org.acegisecurity.userdetails.UserDetails;
import org.jia.ptrack.domain.User;
import org.jia.ptrack.domain.UserRepository;
public class SecurityInfoProviderImpl implements SecurityInfoProvider {
private UserRepository userRepository;
public SecurityInfoProviderImpl(UserRepository userRepository) {
this.userRepository = userRepository;
}
public String getUsername() {
// pia-lab-method-stub(acegi-biz)
SecurityContext context = SecurityContextHolder.getContext();
Authentication authentication = context.getAuthentication();
Object principal = authentication.getPrincipal();
String username = null;
if (principal instanceof UserDetails) {
username = ((UserDetails) principal).getUsername();
} else {
username = principal.toString();
}
return username;
}
public String[] getGrantedAuthorities() {
// pia-lab-method-stub(acegi-biz)
SecurityContext context = SecurityContextHolder.getContext();
Authentication authentication = context.getAuthentication();
GrantedAuthority[] authorities = authentication.getAuthorities();
String[] result = new String[authorities.length];
for (int i = 0; i < authorities.length; i++) {
GrantedAuthority authority = authorities[i];
result[i] = authority.getAuthority();
}
return result;
}
public boolean isGrantedAuthority(String authority) {
// pia-lab-method-stub(acegi-biz)
SecurityContext context = SecurityContextHolder.getContext();
Authentication authentication = context.getAuthentication();
GrantedAuthority[] authorities = authentication.getAuthorities();
for (int i = 0; i < authorities.length; i++) {
GrantedAuthority authority1 = authorities[i];
if (authority.equals(authority1.getAuthority()))
return true;
}
return false;
}
public User getCurrentUser() {
return userRepository.findUser(getUsername());
}
}
| [
"chris.e.richardson@96aafd2f-ff2b-0410-b1e4-c16dfad04aa2"
] | chris.e.richardson@96aafd2f-ff2b-0410-b1e4-c16dfad04aa2 |
7dfd2e7d3b83bc11c7a67fc2c581c576a5bd50af | 556ee15e0571140800da91f9a9025dda51c2f1b5 | /src/main/java/com/egen/texashamburger/service/InterceptorServiceImpl.java | 27fa6be5b7c26800339375d73328c7a89f8917a1 | [] | no_license | skmagarajan/TexasHamburger | 6d4922a83483a59c2283cbb836f3b2a1366f0ac8 | e531489b803e43dd891be631076a1b37b1dab1cc | refs/heads/main | 2023-06-24T23:58:32.170682 | 2021-07-08T21:06:28 | 2021-07-08T21:06:28 | 383,890,946 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,913 | java | package com.egen.texashamburger.service;
import com.egen.texashamburger.entity.InterceptorRecorder;
import com.egen.texashamburger.exception.InterceptorServiceException;
import com.egen.texashamburger.exception.MenuServiceException;
import com.egen.texashamburger.repository.InterceptorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class InterceptorServiceImpl implements InterceptorService{
private InterceptorRepository interceptorRepository;
@Autowired
public InterceptorServiceImpl(InterceptorRepository interceptorRepository) {
this.interceptorRepository = interceptorRepository;
}
@Override
public void create(InterceptorRecorder interceptorRecorder) {
interceptorRepository.save(interceptorRecorder);
}
@Override
public List<InterceptorRecorder> getAll() {
try {
List<InterceptorRecorder> entries = interceptorRepository.findAll();
return entries;
} catch (Exception e) {
throw new InterceptorServiceException("Entries Not Found",e);
}
}
@Override
public List<InterceptorRecorder> getByControllerName(String controllerName) {
try {
List<InterceptorRecorder> entries = interceptorRepository.findAllByAPIContainingIgnoreCase(controllerName);
return entries;
} catch (Exception e) {
throw new InterceptorServiceException("Entries Not Found",e);
}
}
@Override
public List<InterceptorRecorder> getByDate(String date) {
try {
List<InterceptorRecorder> entries = interceptorRepository.findAllByCreatedAtContaining(date);
return entries;
} catch (Exception e) {
throw new InterceptorServiceException("Entries Not Found",e);
}
}
}
| [
"[email protected]"
] | |
14fad55ebb8539412b94a59b0ed582df02a141b4 | 9f944a555c462107f010bc433f241ad808a14938 | /src/main/java/com/zcf/service/GetredenvelopesService.java | 32167b68c53110243c34efc5513da3c56717f975 | [] | no_license | Huaweiweis/da | abfafee78bb77dd8dbc680c6931523060e2f7763 | 91b38259342565779be49b664e53da333e2c1c8d | refs/heads/master | 2022-12-21T14:31:05.009765 | 2019-06-24T02:24:04 | 2019-06-24T02:24:04 | 193,427,342 | 0 | 0 | null | 2022-12-16T08:32:04 | 2019-06-24T03:26:22 | Java | UTF-8 | Java | false | false | 296 | java | package com.zcf.service;
import com.baomidou.mybatisplus.service.IService;
import com.zcf.pojo.Getredenvelopes;
/**
* <p>
* 领取红包记录表 服务类
* </p>
*
* @author Huaweiwei
* @since 2019-05-09
*/
public interface GetredenvelopesService extends IService<Getredenvelopes> {
}
| [
"[email protected]"
] | |
ed2b8b86d75bf5ab19324cd13e1c0c2bf06abe5d | e07ab48c9b6cee423d12a1a4292e0184ecbde9f9 | /src/main/java/org/monet/core/model/ncc/AccountMetaData.java | 9a1e192299f55debbc28599e7eebe0fa63351b5f | [
"MIT"
] | permissive | MonetChain-Project/MonetBlockchain | 18db875b9384f62dbfcb9ff155e2970082918e31 | c50e9608fd8ad1c5980e05ea09b947b9199595c4 | refs/heads/master | 2020-03-17T09:56:59.454007 | 2019-03-22T06:24:02 | 2019-03-22T06:24:02 | 133,494,339 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,578 | java | package org.monet.core.model.ncc;
import org.monet.core.model.*;
import org.monet.core.serialization.*;
import java.util.List;
/**
* Class for holding additional information about an account required by ncc.
*/
public class AccountMetaData implements SerializableEntity {
private final AccountStatus status;
private final AccountRemoteStatus remoteStatus;
private final List<AccountInfo> cosignatoryOf;
private final List<AccountInfo> cosignatories;
/**
* Creates a new meta data.
*
* @param status The account status.
* @param remoteStatus The remote status.
* @param cosignatoryOf The list of multisig accounts.
* @param cosignatories The list of multisig cosigners.
*/
public AccountMetaData(
final AccountStatus status,
final AccountRemoteStatus remoteStatus,
final List<AccountInfo> cosignatoryOf,
final List<AccountInfo> cosignatories) {
this.status = status;
this.remoteStatus = remoteStatus;
this.cosignatoryOf = cosignatoryOf;
this.cosignatories = cosignatories;
}
/**
* Deserializes a meta data.
*
* @param deserializer The deserializer.
*/
public AccountMetaData(final Deserializer deserializer) {
this.status = AccountStatus.readFrom(deserializer, "status");
this.remoteStatus = AccountRemoteStatus.readFrom(deserializer, "remoteStatus");
this.cosignatoryOf = deserializer.readObjectArray("cosignatoryOf", AccountInfo::new);
this.cosignatories = deserializer.readObjectArray("cosignatories", AccountInfo::new);
}
/**
* Returns The status of the account (locked/unlocked).
*
* @return The status.
*/
public AccountStatus getStatus() {
return this.status;
}
/**
* Gets the remote account status
*
* @return The remote account status.
*/
public AccountRemoteStatus getRemoteStatus() {
return this.remoteStatus;
}
/**
* Gets the list of multisig accounts, for which this account is cosignatory.
*
* @return The list of multisig accounts.
*/
public List<AccountInfo> getCosignatoryOf() {
return this.cosignatoryOf;
}
/**
* Gets the list of cosigners for this account.
*
* @return The list of cosigners for this account.
*/
public List<AccountInfo> getCosignatories() {
return this.cosignatories;
}
@Override
public void serialize(final Serializer serializer) {
AccountStatus.writeTo(serializer, "status", this.status);
AccountRemoteStatus.writeTo(serializer, "remoteStatus", this.getRemoteStatus());
serializer.writeObjectArray("cosignatoryOf", this.cosignatoryOf);
serializer.writeObjectArray("cosignatories", this.cosignatories);
}
}
| [
"[email protected]"
] | |
eb764f2212acbfde6ef64f3325b401467bca3d55 | fe96c4d4cbb1b4f48d5ec8cd335c679c25c679f5 | /src/main/java/com/ibm/spectrumcomputing/cwl/model/process/parameter/input/WorkflowStepInput.java | 506c8b0442c115e0deeb7471f0468928b691e610 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | drjrm3/cwlexec | c0285e1b1e2937e621c8508992f3ccbc29955825 | 1cc134ae46d06578096b7cb1fd4adb26f5d2e758 | refs/heads/master | 2020-03-15T02:55:11.594534 | 2018-05-03T02:37:29 | 2018-05-03T02:37:29 | 131,929,633 | 0 | 0 | null | 2018-05-03T02:15:24 | 2018-05-03T02:15:24 | null | UTF-8 | Java | false | false | 4,044 | java | /*
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ibm.spectrumcomputing.cwl.model.process.parameter.input;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.ibm.spectrumcomputing.cwl.model.CWLFieldValue;
import com.ibm.spectrumcomputing.cwl.model.process.parameter.method.LinkMergeMethod;
/**
* Represents a WorkflowStepInput object
*/
@JsonInclude(Include.NON_NULL)
public class WorkflowStepInput {
private String id;
private List<String> source;
private LinkMergeMethod linkMerge = LinkMergeMethod.MERGE_NESTED;
@XmlElement(name = "default")
private Object defaultValue;
private CWLFieldValue valueFrom;
/**
* Constructs a WorkflowStepInput object
*
* @param id
* The ID of this object
*/
public WorkflowStepInput(String id) {
this.id = id;
}
/**
* Returns one or more workflow parameters that will provide input to the
* underlying step parameter.
*
* @return A list of sources
*/
public List<String> getSource() {
return source;
}
/**
* Sets one or more workflow parameters that will provide input to the
* underlying step parameter.
*
* @param source
* A list of sources
*/
public void setSource(List<String> source) {
this.source = source;
}
/**
* Returns the method to use to merge multiple inbound links into a single
* array. If not specified, the default method is "merge_nested".
*
* @return A LinkMergeMethod object
*/
public LinkMergeMethod getLinkMerge() {
return linkMerge;
}
/**
* Sets the method to use to merge multiple inbound links into a single
* array.
*
* @param linkMerge
* A LinkMergeMethod object
*/
public void setLinkMerge(LinkMergeMethod linkMerge) {
this.linkMerge = linkMerge;
}
/**
* Returns the default value for this parameter to use if either there is no
* source field, or the value produced by the source is null.
*
* @return The default value of this parameter
*/
public Object getDefaultValue() {
return defaultValue;
}
/**
* Sets the default value for this parameter to use if either there is no
* source field, or the value produced by the source is null.
*
* @param defaultValue
* The default value for this parameter
*/
public void setDefaultValue(Object defaultValue) {
this.defaultValue = defaultValue;
}
/**
* Returns the valueFrom of this parameter, the value of valueFrom will used
* as the final value for input parameter
*
* @return The valueFrom of this parameter
*/
public CWLFieldValue getValueFrom() {
return valueFrom;
}
/**
* Sets the valueFrom for this parameter, the value of valueFrom will used
* as the final value for input parameter
*
* @param valueFrom
* The valueFrom for this parameter
*/
public void setValueFrom(CWLFieldValue valueFrom) {
this.valueFrom = valueFrom;
}
/**
* Returns the ID of this object
*
* @return An ID of this object
*/
public String getId() {
return id;
}
}
| [
"[email protected]"
] | |
6fc56b6022b00c0d256a4150b0be78ca25cfd356 | c337294844845f6d6b736d664f5a71efe720d65b | /site/src/site-ear/resources/generated/org/reverse/FdnFormularios.java | c7ff397d56ef5dc17ce0fdce86081623981edbf0 | [] | no_license | MGDevelopment/site-jrun | 25ad663b4a9d0b9b07cf0a3d4ef436594976ad5b | 0547d837bbd1ed7328b4e8d775adf9defd622981 | refs/heads/master | 2020-06-05T02:28:11.102960 | 2013-09-10T13:12:27 | 2013-09-10T13:12:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,002 | java | package org.reverse;
// Generated Oct 20, 2010 10:21:56 AM by Hibernate Tools 3.4.0.Beta1
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
/**
* FdnFormularios generated by hbm2java
*/
public class FdnFormularios implements java.io.Serializable {
private String nroFormulario;
private Date fecha;
private String datosAdicionales;
private String usrAlta;
private Date FAlta;
private String usrModi;
private Date FModi;
private Integer dperCodigo;
private Set fdnTarjetasXCuentases = new HashSet(0);
public FdnFormularios() {
}
public FdnFormularios(String nroFormulario, Date fecha, String datosAdicionales, String usrAlta, Date FAlta) {
this.nroFormulario = nroFormulario;
this.fecha = fecha;
this.datosAdicionales = datosAdicionales;
this.usrAlta = usrAlta;
this.FAlta = FAlta;
}
public FdnFormularios(String nroFormulario, Date fecha, String datosAdicionales, String usrAlta, Date FAlta, String usrModi, Date FModi, Integer dperCodigo, Set fdnTarjetasXCuentases) {
this.nroFormulario = nroFormulario;
this.fecha = fecha;
this.datosAdicionales = datosAdicionales;
this.usrAlta = usrAlta;
this.FAlta = FAlta;
this.usrModi = usrModi;
this.FModi = FModi;
this.dperCodigo = dperCodigo;
this.fdnTarjetasXCuentases = fdnTarjetasXCuentases;
}
public String getNroFormulario() {
return this.nroFormulario;
}
public void setNroFormulario(String nroFormulario) {
this.nroFormulario = nroFormulario;
}
public Date getFecha() {
return this.fecha;
}
public void setFecha(Date fecha) {
this.fecha = fecha;
}
public String getDatosAdicionales() {
return this.datosAdicionales;
}
public void setDatosAdicionales(String datosAdicionales) {
this.datosAdicionales = datosAdicionales;
}
public String getUsrAlta() {
return this.usrAlta;
}
public void setUsrAlta(String usrAlta) {
this.usrAlta = usrAlta;
}
public Date getFAlta() {
return this.FAlta;
}
public void setFAlta(Date FAlta) {
this.FAlta = FAlta;
}
public String getUsrModi() {
return this.usrModi;
}
public void setUsrModi(String usrModi) {
this.usrModi = usrModi;
}
public Date getFModi() {
return this.FModi;
}
public void setFModi(Date FModi) {
this.FModi = FModi;
}
public Integer getDperCodigo() {
return this.dperCodigo;
}
public void setDperCodigo(Integer dperCodigo) {
this.dperCodigo = dperCodigo;
}
public Set getFdnTarjetasXCuentases() {
return this.fdnTarjetasXCuentases;
}
public void setFdnTarjetasXCuentases(Set fdnTarjetasXCuentases) {
this.fdnTarjetasXCuentases = fdnTarjetasXCuentases;
}
}
| [
"[email protected]"
] | |
34a0bbc729c48b62a73ecaeb86161602c4544011 | 88174f7fb15023fedd0d344b4559fb76fe96acab | /hls-oa/src/main/java/com/lq/work/modules/cms/entity/Category.java | b4c54af86757d96318b84f83d535ca6061905005 | [
"Apache-2.0"
] | permissive | guguguaiguai/hlsoa | 0003ea8f2c2485973891070de4bc35fe41a0c6fb | 26f6fbc8c712856740adbd8e73cc4b8289257ea1 | refs/heads/master | 2021-06-21T18:27:16.765680 | 2017-08-21T14:22:03 | 2017-08-21T14:22:03 | 100,584,798 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,213 | java | /**
*
*/
package com.lq.work.modules.cms.entity;
import java.util.Date;
import java.util.List;
import org.hibernate.validator.constraints.Length;
import com.google.common.collect.Lists;
import com.lq.work.common.config.Global;
import com.lq.work.common.persistence.TreeEntity;
import com.lq.work.modules.cms.utils.CmsUtils;
import com.lq.work.modules.sys.entity.Office;
/**
* 栏目Entity
*
* @version 2013-05-15
*/
public class Category extends TreeEntity<Category> {
public static final String DEFAULT_TEMPLATE = "frontList";
private static final long serialVersionUID = 1L;
private Site site; // 归属站点
private Office office; // 归属部门
// private Category parent;// 父级菜单
// private String parentIds;// 所有父级编号
private String module; // 栏目模型(article:文章;picture:图片;download:下载;link:链接;special:专题)
// private String name; // 栏目名称
private String image; // 栏目图片
private String href; // 链接
private String target; // 目标( _blank、_self、_parent、_top)
private String description; // 描述,填写有助于搜索引擎优化
private String keywords; // 关键字,填写有助于搜索引擎优化
// private Integer sort; // 排序(升序)
private String inMenu; // 是否在导航中显示(1:显示;0:不显示)
private String inList; // 是否在分类页中显示列表(1:显示;0:不显示)
private String showModes; // 展现方式(0:有子栏目显示栏目列表,无子栏目显示内容列表;1:首栏目内容列表;2:栏目第一条内容)
private String allowComment;// 是否允许评论
private String isAudit; // 是否需要审核
private String customListView; // 自定义列表视图
private String customContentView; // 自定义内容视图
private String viewConfig; // 视图参数
private Date beginDate; // 开始时间
private Date endDate; // 结束时间
private String cnt;//信息量
private String hits;//点击量
private List<Category> childList = Lists.newArrayList(); // 拥有子分类列表
public Category(){
super();
this.module = "";
this.sort = 30;
this.inMenu = Global.HIDE;
this.inList = Global.SHOW;
this.showModes = "0";
this.allowComment = Global.NO;
this.delFlag = DEL_FLAG_NORMAL;
this.isAudit = Global.NO;
}
public Category(String id){
this();
this.id = id;
}
public Category(String id, Site site){
this();
this.id = id;
this.setSite(site);
}
public Site getSite() {
return site;
}
public String getHits() {
return hits;
}
public void setHits(String hits) {
this.hits = hits;
}
public void setSite(Site site) {
this.site = site;
}
public Office getOffice() {
return office;
}
public void setOffice(Office office) {
this.office = office;
}
// @JsonBackReference
// @NotNull
public Category getParent() {
return parent;
}
public void setParent(Category parent) {
this.parent = parent;
}
// @Length(min=1, max=255)
// public String getParentIds() {
// return parentIds;
// }
//
// public void setParentIds(String parentIds) {
// this.parentIds = parentIds;
// }
@Length(min=0, max=20)
public String getModule() {
return module;
}
public void setModule(String module) {
this.module = module;
}
// @Length(min=0, max=100)
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
@Length(min=0, max=255)
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
@Length(min=0, max=255)
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
@Length(min=0, max=20)
public String getTarget() {
return target;
}
public Date getBeginDate() {
return beginDate;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public void setTarget(String target) {
this.target = target;
}
@Length(min=0, max=255)
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Length(min=0, max=255)
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
// @NotNull
// public Integer getSort() {
// return sort;
// }
//
// public void setSort(Integer sort) {
// this.sort = sort;
// }
@Length(min=1, max=1)
public String getInMenu() {
return inMenu;
}
public void setInMenu(String inMenu) {
this.inMenu = inMenu;
}
@Length(min=1, max=1)
public String getInList() {
return inList;
}
public void setInList(String inList) {
this.inList = inList;
}
@Length(min=1, max=1)
public String getShowModes() {
return showModes;
}
public void setShowModes(String showModes) {
this.showModes = showModes;
}
@Length(min=1, max=1)
public String getAllowComment() {
return allowComment;
}
public void setAllowComment(String allowComment) {
this.allowComment = allowComment;
}
@Length(min=1, max=1)
public String getIsAudit() {
return isAudit;
}
public void setIsAudit(String isAudit) {
this.isAudit = isAudit;
}
public String getCustomListView() {
return customListView;
}
public void setCustomListView(String customListView) {
this.customListView = customListView;
}
public String getCustomContentView() {
return customContentView;
}
public void setCustomContentView(String customContentView) {
this.customContentView = customContentView;
}
public String getViewConfig() {
return viewConfig;
}
public void setViewConfig(String viewConfig) {
this.viewConfig = viewConfig;
}
public List<Category> getChildList() {
return childList;
}
public void setChildList(List<Category> childList) {
this.childList = childList;
}
public String getCnt() {
return cnt;
}
public void setCnt(String cnt) {
this.cnt = cnt;
}
public static void sortList(List<Category> list, List<Category> sourcelist, String parentId){
for (int i=0; i<sourcelist.size(); i++){
Category e = sourcelist.get(i);
if (e.getParent()!=null && e.getParent().getId()!=null
&& e.getParent().getId().equals(parentId)){
list.add(e);
// 判断是否还有子节点, 有则继续获取子节点
for (int j=0; j<sourcelist.size(); j++){
Category child = sourcelist.get(j);
if (child.getParent()!=null && child.getParent().getId()!=null
&& child.getParent().getId().equals(e.getId())){
sortList(list, sourcelist, e.getId());
break;
}
}
}
}
}
public String getIds() {
return (this.getParentIds() !=null ? this.getParentIds().replaceAll(",", " ") : "")
+ (this.getId() != null ? this.getId() : "");
}
public boolean isRoot(){
return isRoot(this.id);
}
public static boolean isRoot(String id){
return id != null && id.equals("1");
}
public String getUrl() {
return CmsUtils.getUrlDynamic(this);
}
} | [
"[email protected]"
] | |
ed906bfc490b8dd4c003b38fa5b438c80fe18f37 | 3e4f3dc2293d598de2ef7f18fe926d7142a60343 | /Proyectos OpenGL ES/TankGL/app/build/generated/source/r/debug/com/opengl10/android/R.java | 5bb26bbcdba2ff0ca72d21267cbf02a829cf3a50 | [] | no_license | EvaristPerez/Proyectos-moviles- | b1001a62ae529757d0ea176e7f0f88ddf0a7a66f | 825d2b5e4053c8a28a8ef2e4302d2cdf9836ced0 | refs/heads/master | 2021-01-09T20:32:35.413807 | 2016-07-28T09:52:05 | 2016-07-28T09:52:05 | 63,624,550 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 146,768 | 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 com.opengl10.android;
public final class R {
public static final class anim {
public static final int abc_fade_in=0x7f040000;
public static final int abc_fade_out=0x7f040001;
public static final int abc_slide_in_bottom=0x7f040002;
public static final int abc_slide_in_top=0x7f040003;
public static final int abc_slide_out_bottom=0x7f040004;
public static final int abc_slide_out_top=0x7f040005;
}
public static final class attr {
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionBarDivider=0x7f010000;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionBarItemBackground=0x7f010001;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int actionBarSize=0x7f010002;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionBarSplitStyle=0x7f010003;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionBarStyle=0x7f010004;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionBarTabBarStyle=0x7f010005;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionBarTabStyle=0x7f010006;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionBarTabTextStyle=0x7f010007;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionBarWidgetTheme=0x7f010008;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionButtonStyle=0x7f010009;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionDropDownStyle=0x7f010066;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionLayout=0x7f01005d;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionMenuTextAppearance=0x7f01000a;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static final int actionMenuTextColor=0x7f01000b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeBackground=0x7f01000c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeCloseButtonStyle=0x7f01000d;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeCloseDrawable=0x7f01000e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeCopyDrawable=0x7f01000f;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeCutDrawable=0x7f010010;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeFindDrawable=0x7f010011;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModePasteDrawable=0x7f010012;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModePopupWindowStyle=0x7f010013;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeSelectAllDrawable=0x7f010014;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeShareDrawable=0x7f010015;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeSplitBackground=0x7f010016;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeStyle=0x7f010017;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionModeWebSearchDrawable=0x7f010018;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int actionOverflowButtonStyle=0x7f010019;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int actionProviderClass=0x7f01005f;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int actionViewClass=0x7f01005e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int activityChooserViewStyle=0x7f01001a;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int background=0x7f010047;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static final int backgroundSplit=0x7f010049;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static final int backgroundStacked=0x7f010048;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int buttonBarButtonStyle=0x7f01001b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int buttonBarStyle=0x7f01001c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int customNavigationLayout=0x7f01004a;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int disableChildrenWhenDisabled=0x7f010065;
/** <p>Must be one or more (separated by '|') of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr>
<tr><td><code>showHome</code></td><td>0x2</td><td></td></tr>
<tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr>
<tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr>
<tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr>
<tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr>
</table>
*/
public static final int displayOptions=0x7f010040;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int divider=0x7f010046;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int dividerHorizontal=0x7f01001d;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dividerPadding=0x7f01005b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int dividerVertical=0x7f01001e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int dropDownListViewStyle=0x7f01001f;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int dropdownListPreferredItemHeight=0x7f010067;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int expandActivityOverflowButtonDrawable=0x7f010058;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int height=0x7f010020;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int homeAsUpIndicator=0x7f010021;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int homeLayout=0x7f01004b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int icon=0x7f010044;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int iconifiedByDefault=0x7f010060;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int indeterminateProgressStyle=0x7f01004d;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int initialActivityCount=0x7f010057;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int isLightTheme=0x7f010022;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int itemPadding=0x7f01004f;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int listChoiceBackgroundIndicator=0x7f01006b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int listPopupWindowStyle=0x7f010023;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int listPreferredItemHeight=0x7f010024;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int listPreferredItemHeightLarge=0x7f010025;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int listPreferredItemHeightSmall=0x7f010026;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int listPreferredItemPaddingLeft=0x7f010027;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int listPreferredItemPaddingRight=0x7f010028;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int logo=0x7f010045;
/** <p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>normal</code></td><td>0</td><td></td></tr>
<tr><td><code>listMode</code></td><td>1</td><td></td></tr>
<tr><td><code>tabMode</code></td><td>2</td><td></td></tr>
</table>
*/
public static final int navigationMode=0x7f01003f;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int paddingEnd=0x7f01006d;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int paddingStart=0x7f01006c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int panelMenuListTheme=0x7f01006a;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int panelMenuListWidth=0x7f010069;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int popupMenuStyle=0x7f010068;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int popupPromptView=0x7f010064;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int progressBarPadding=0x7f01004e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int progressBarStyle=0x7f01004c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int prompt=0x7f010062;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int queryHint=0x7f010061;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchDropdownBackground=0x7f010029;
/** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int searchResultListItemHeight=0x7f01002a;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewAutoCompleteTextView=0x7f01002b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewCloseIcon=0x7f01002c;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewEditQuery=0x7f01002d;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewEditQueryBackground=0x7f01002e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewGoIcon=0x7f01002f;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewSearchIcon=0x7f010030;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewTextField=0x7f010031;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewTextFieldRight=0x7f010032;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int searchViewVoiceIcon=0x7f010033;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int selectableItemBackground=0x7f010034;
/** <p>Must be one or more (separated by '|') of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>never</code></td><td>0</td><td></td></tr>
<tr><td><code>ifRoom</code></td><td>1</td><td></td></tr>
<tr><td><code>always</code></td><td>2</td><td></td></tr>
<tr><td><code>withText</code></td><td>4</td><td></td></tr>
<tr><td><code>collapseActionView</code></td><td>8</td><td></td></tr>
</table>
*/
public static final int showAsAction=0x7f01005c;
/** <p>Must be one or more (separated by '|') of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>none</code></td><td>0</td><td></td></tr>
<tr><td><code>beginning</code></td><td>1</td><td></td></tr>
<tr><td><code>middle</code></td><td>2</td><td></td></tr>
<tr><td><code>end</code></td><td>4</td><td></td></tr>
</table>
*/
public static final int showDividers=0x7f01005a;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int spinnerDropDownItemStyle=0x7f010035;
/** <p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>dialog</code></td><td>0</td><td></td></tr>
<tr><td><code>dropdown</code></td><td>1</td><td></td></tr>
</table>
*/
public static final int spinnerMode=0x7f010063;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int spinnerStyle=0x7f010036;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int subtitle=0x7f010041;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int subtitleTextStyle=0x7f010043;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a boolean value, either "<code>true</code>" or "<code>false</code>".
*/
public static final int textAllCaps=0x7f010059;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int textAppearanceLargePopupMenu=0x7f010037;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int textAppearanceListItem=0x7f010038;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int textAppearanceListItemSmall=0x7f010039;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int textAppearanceSearchResultSubtitle=0x7f01003a;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int textAppearanceSearchResultTitle=0x7f01003b;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int textAppearanceSmallPopupMenu=0x7f01003c;
/** <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
*/
public static final int textColorSearchUrl=0x7f01003d;
/** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int title=0x7f01003e;
/** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
*/
public static final int titleTextStyle=0x7f010042;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int windowActionBar=0x7f010050;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int windowActionBarOverlay=0x7f010051;
/** <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>".
The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to
some parent container.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int windowFixedHeightMajor=0x7f010056;
/** <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>".
The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to
some parent container.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int windowFixedHeightMinor=0x7f010054;
/** <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>".
The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to
some parent container.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int windowFixedWidthMajor=0x7f010053;
/** <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>".
The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to
some parent container.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int windowFixedWidthMinor=0x7f010055;
/** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
*/
public static final int windowSplitActionBar=0x7f010052;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs_pre_jb=0x7f070000;
public static final int abc_action_bar_expanded_action_views_exclusive=0x7f070003;
public static final int abc_config_actionMenuItemAllCaps=0x7f070004;
public static final int abc_config_allowActionMenuItemTextWithIcon=0x7f070001;
public static final int abc_config_showMenuShortcutsWhenKeyboardPresent=0x7f070005;
public static final int abc_split_action_bar_is_narrow=0x7f070002;
}
public static final class color {
public static final int abc_search_url_text_holo=0x7f0b0004;
public static final int abc_search_url_text_normal=0x7f0b0000;
public static final int abc_search_url_text_pressed=0x7f0b0001;
public static final int abc_search_url_text_selected=0x7f0b0002;
public static final int black=0x7f0b0003;
}
public static final class dimen {
public static final int abc_action_bar_default_height=0x7f080000;
public static final int abc_action_bar_icon_vertical_padding=0x7f080001;
public static final int abc_action_bar_progress_bar_size=0x7f080002;
public static final int abc_action_bar_stacked_max_height=0x7f08000f;
public static final int abc_action_bar_stacked_tab_max_width=0x7f080010;
public static final int abc_action_bar_subtitle_bottom_margin=0x7f080003;
public static final int abc_action_bar_subtitle_text_size=0x7f080004;
public static final int abc_action_bar_subtitle_top_margin=0x7f080005;
public static final int abc_action_bar_title_text_size=0x7f080006;
public static final int abc_action_button_min_width=0x7f08000d;
public static final int abc_config_prefDialogWidth=0x7f080007;
public static final int abc_dropdownitem_icon_width=0x7f080011;
public static final int abc_dropdownitem_text_padding_left=0x7f080012;
public static final int abc_dropdownitem_text_padding_right=0x7f080013;
public static final int abc_panel_menu_list_width=0x7f080014;
public static final int abc_search_view_preferred_width=0x7f080015;
public static final int abc_search_view_text_min_width=0x7f080008;
public static final int activity_horizontal_margin=0x7f08000e;
public static final int activity_vertical_margin=0x7f080016;
public static final int dialog_fixed_height_major=0x7f080009;
public static final int dialog_fixed_height_minor=0x7f08000a;
public static final int dialog_fixed_width_major=0x7f08000b;
public static final int dialog_fixed_width_minor=0x7f08000c;
}
public static final class drawable {
public static final int abc_ab_bottom_solid_dark_holo=0x7f020000;
public static final int abc_ab_bottom_solid_light_holo=0x7f020001;
public static final int abc_ab_bottom_transparent_dark_holo=0x7f020002;
public static final int abc_ab_bottom_transparent_light_holo=0x7f020003;
public static final int abc_ab_share_pack_holo_dark=0x7f020004;
public static final int abc_ab_share_pack_holo_light=0x7f020005;
public static final int abc_ab_solid_dark_holo=0x7f020006;
public static final int abc_ab_solid_light_holo=0x7f020007;
public static final int abc_ab_stacked_solid_dark_holo=0x7f020008;
public static final int abc_ab_stacked_solid_light_holo=0x7f020009;
public static final int abc_ab_stacked_transparent_dark_holo=0x7f02000a;
public static final int abc_ab_stacked_transparent_light_holo=0x7f02000b;
public static final int abc_ab_transparent_dark_holo=0x7f02000c;
public static final int abc_ab_transparent_light_holo=0x7f02000d;
public static final int abc_cab_background_bottom_holo_dark=0x7f02000e;
public static final int abc_cab_background_bottom_holo_light=0x7f02000f;
public static final int abc_cab_background_top_holo_dark=0x7f020010;
public static final int abc_cab_background_top_holo_light=0x7f020011;
public static final int abc_ic_ab_back_holo_dark=0x7f020012;
public static final int abc_ic_ab_back_holo_light=0x7f020013;
public static final int abc_ic_cab_done_holo_dark=0x7f020014;
public static final int abc_ic_cab_done_holo_light=0x7f020015;
public static final int abc_ic_clear=0x7f020016;
public static final int abc_ic_clear_disabled=0x7f020017;
public static final int abc_ic_clear_holo_light=0x7f020018;
public static final int abc_ic_clear_normal=0x7f020019;
public static final int abc_ic_clear_search_api_disabled_holo_light=0x7f02001a;
public static final int abc_ic_clear_search_api_holo_light=0x7f02001b;
public static final int abc_ic_commit_search_api_holo_dark=0x7f02001c;
public static final int abc_ic_commit_search_api_holo_light=0x7f02001d;
public static final int abc_ic_go=0x7f02001e;
public static final int abc_ic_go_search_api_holo_light=0x7f02001f;
public static final int abc_ic_menu_moreoverflow_normal_holo_dark=0x7f020020;
public static final int abc_ic_menu_moreoverflow_normal_holo_light=0x7f020021;
public static final int abc_ic_menu_share_holo_dark=0x7f020022;
public static final int abc_ic_menu_share_holo_light=0x7f020023;
public static final int abc_ic_search=0x7f020024;
public static final int abc_ic_search_api_holo_light=0x7f020025;
public static final int abc_ic_voice_search=0x7f020026;
public static final int abc_ic_voice_search_api_holo_light=0x7f020027;
public static final int abc_item_background_holo_dark=0x7f020028;
public static final int abc_item_background_holo_light=0x7f020029;
public static final int abc_list_divider_holo_dark=0x7f02002a;
public static final int abc_list_divider_holo_light=0x7f02002b;
public static final int abc_list_focused_holo=0x7f02002c;
public static final int abc_list_longpressed_holo=0x7f02002d;
public static final int abc_list_pressed_holo_dark=0x7f02002e;
public static final int abc_list_pressed_holo_light=0x7f02002f;
public static final int abc_list_selector_background_transition_holo_dark=0x7f020030;
public static final int abc_list_selector_background_transition_holo_light=0x7f020031;
public static final int abc_list_selector_disabled_holo_dark=0x7f020032;
public static final int abc_list_selector_disabled_holo_light=0x7f020033;
public static final int abc_list_selector_holo_dark=0x7f020034;
public static final int abc_list_selector_holo_light=0x7f020035;
public static final int abc_menu_dropdown_panel_holo_dark=0x7f020036;
public static final int abc_menu_dropdown_panel_holo_light=0x7f020037;
public static final int abc_menu_hardkey_panel_holo_dark=0x7f020038;
public static final int abc_menu_hardkey_panel_holo_light=0x7f020039;
public static final int abc_search_dropdown_dark=0x7f02003a;
public static final int abc_search_dropdown_light=0x7f02003b;
public static final int abc_spinner_ab_default_holo_dark=0x7f02003c;
public static final int abc_spinner_ab_default_holo_light=0x7f02003d;
public static final int abc_spinner_ab_disabled_holo_dark=0x7f02003e;
public static final int abc_spinner_ab_disabled_holo_light=0x7f02003f;
public static final int abc_spinner_ab_focused_holo_dark=0x7f020040;
public static final int abc_spinner_ab_focused_holo_light=0x7f020041;
public static final int abc_spinner_ab_holo_dark=0x7f020042;
public static final int abc_spinner_ab_holo_light=0x7f020043;
public static final int abc_spinner_ab_pressed_holo_dark=0x7f020044;
public static final int abc_spinner_ab_pressed_holo_light=0x7f020045;
public static final int abc_tab_indicator_ab_holo=0x7f020046;
public static final int abc_tab_selected_focused_holo=0x7f020047;
public static final int abc_tab_selected_holo=0x7f020048;
public static final int abc_tab_selected_pressed_holo=0x7f020049;
public static final int abc_tab_unselected_pressed_holo=0x7f02004a;
public static final int abc_textfield_search_default_holo_dark=0x7f02004b;
public static final int abc_textfield_search_default_holo_light=0x7f02004c;
public static final int abc_textfield_search_right_default_holo_dark=0x7f02004d;
public static final int abc_textfield_search_right_default_holo_light=0x7f02004e;
public static final int abc_textfield_search_right_selected_holo_dark=0x7f02004f;
public static final int abc_textfield_search_right_selected_holo_light=0x7f020050;
public static final int abc_textfield_search_selected_holo_dark=0x7f020051;
public static final int abc_textfield_search_selected_holo_light=0x7f020052;
public static final int abc_textfield_searchview_holo_dark=0x7f020053;
public static final int abc_textfield_searchview_holo_light=0x7f020054;
public static final int abc_textfield_searchview_right_holo_dark=0x7f020055;
public static final int abc_textfield_searchview_right_holo_light=0x7f020056;
public static final int basetextura=0x7f020057;
public static final int cintatextura=0x7f020058;
public static final int floor=0x7f020059;
public static final int grass=0x7f02005a;
public static final int ic_launcher=0x7f02005b;
public static final int mono_tex=0x7f02005c;
public static final int ruedastextura=0x7f02005d;
public static final int torretatextura=0x7f02005e;
}
public static final class id {
public static final int action_bar=0x7f0c001c;
public static final int action_bar_activity_content=0x7f0c0000;
public static final int action_bar_container=0x7f0c001b;
public static final int action_bar_overlay_layout=0x7f0c001f;
public static final int action_bar_root=0x7f0c001a;
public static final int action_bar_subtitle=0x7f0c0023;
public static final int action_bar_title=0x7f0c0022;
public static final int action_context_bar=0x7f0c001d;
public static final int action_menu_divider=0x7f0c0001;
public static final int action_menu_presenter=0x7f0c0002;
public static final int action_mode_close_button=0x7f0c0024;
public static final int action_settings=0x7f0c003c;
public static final int activity_chooser_view_content=0x7f0c0025;
public static final int always=0x7f0c0013;
public static final int beginning=0x7f0c000f;
public static final int checkbox=0x7f0c002d;
public static final int collapseActionView=0x7f0c0014;
public static final int default_activity_button=0x7f0c0028;
public static final int dialog=0x7f0c0018;
public static final int disableHome=0x7f0c0009;
public static final int dropdown=0x7f0c0019;
public static final int edit_query=0x7f0c0030;
public static final int end=0x7f0c0010;
public static final int expand_activities_button=0x7f0c0026;
public static final int expanded_menu=0x7f0c002c;
public static final int home=0x7f0c0003;
public static final int homeAsUp=0x7f0c000a;
public static final int icon=0x7f0c002a;
public static final int ifRoom=0x7f0c0015;
public static final int image=0x7f0c0027;
public static final int listMode=0x7f0c0006;
public static final int list_item=0x7f0c0029;
public static final int middle=0x7f0c0011;
public static final int never=0x7f0c0016;
public static final int none=0x7f0c0012;
public static final int normal=0x7f0c0007;
public static final int progress_circular=0x7f0c0004;
public static final int progress_horizontal=0x7f0c0005;
public static final int radio=0x7f0c002f;
public static final int search_badge=0x7f0c0032;
public static final int search_bar=0x7f0c0031;
public static final int search_button=0x7f0c0033;
public static final int search_close_btn=0x7f0c0038;
public static final int search_edit_frame=0x7f0c0034;
public static final int search_go_btn=0x7f0c003a;
public static final int search_mag_icon=0x7f0c0035;
public static final int search_plate=0x7f0c0036;
public static final int search_src_text=0x7f0c0037;
public static final int search_voice_btn=0x7f0c003b;
public static final int shortcut=0x7f0c002e;
public static final int showCustom=0x7f0c000b;
public static final int showHome=0x7f0c000c;
public static final int showTitle=0x7f0c000d;
public static final int split_action_bar=0x7f0c001e;
public static final int submit_area=0x7f0c0039;
public static final int tabMode=0x7f0c0008;
public static final int title=0x7f0c002b;
public static final int top_action_bar=0x7f0c0020;
public static final int up=0x7f0c0021;
public static final int useLogo=0x7f0c000e;
public static final int withText=0x7f0c0017;
}
public static final class integer {
public static final int abc_max_action_buttons=0x7f0a0000;
}
public static final class layout {
public static final int abc_action_bar_decor=0x7f030000;
public static final int abc_action_bar_decor_include=0x7f030001;
public static final int abc_action_bar_decor_overlay=0x7f030002;
public static final int abc_action_bar_home=0x7f030003;
public static final int abc_action_bar_tab=0x7f030004;
public static final int abc_action_bar_tabbar=0x7f030005;
public static final int abc_action_bar_title_item=0x7f030006;
public static final int abc_action_bar_view_list_nav_layout=0x7f030007;
public static final int abc_action_menu_item_layout=0x7f030008;
public static final int abc_action_menu_layout=0x7f030009;
public static final int abc_action_mode_bar=0x7f03000a;
public static final int abc_action_mode_close_item=0x7f03000b;
public static final int abc_activity_chooser_view=0x7f03000c;
public static final int abc_activity_chooser_view_include=0x7f03000d;
public static final int abc_activity_chooser_view_list_item=0x7f03000e;
public static final int abc_expanded_menu_layout=0x7f03000f;
public static final int abc_list_menu_item_checkbox=0x7f030010;
public static final int abc_list_menu_item_icon=0x7f030011;
public static final int abc_list_menu_item_layout=0x7f030012;
public static final int abc_list_menu_item_radio=0x7f030013;
public static final int abc_popup_menu_item_layout=0x7f030014;
public static final int abc_search_dropdown_item_icons_2line=0x7f030015;
public static final int abc_search_view=0x7f030016;
public static final int abc_simple_decor=0x7f030017;
public static final int activity_open_gl2=0x7f030018;
public static final int support_simple_spinner_dropdown_item=0x7f030019;
}
public static final class menu {
public static final int open_gl1=0x7f0d0000;
}
public static final class raw {
public static final int base=0x7f050000;
public static final int cinta1=0x7f050001;
public static final int cinta2=0x7f050002;
public static final int cinta3=0x7f050003;
public static final int cinta4=0x7f050004;
public static final int cinta5=0x7f050005;
public static final int cubo=0x7f050006;
public static final int diffuse_fragment_shader=0x7f050007;
public static final int diffuse_vertex_shader=0x7f050008;
public static final int esfera=0x7f050009;
public static final int esfera2=0x7f05000a;
public static final int mono=0x7f05000b;
public static final int mono2=0x7f05000c;
public static final int ruedas=0x7f05000d;
public static final int simple_fragment_shader=0x7f05000e;
public static final int simple_fragment_shader3=0x7f05000f;
public static final int simple_vertex_shader=0x7f050010;
public static final int simple_vertex_shader3=0x7f050011;
public static final int specular_fragment_shader=0x7f050012;
public static final int specular_fragment_shader2=0x7f050013;
public static final int specular_vertex_shader=0x7f050014;
public static final int specular_vertex_shader2=0x7f050015;
public static final int suelo=0x7f050016;
public static final int t90a=0x7f050017;
public static final int tierra=0x7f050018;
public static final int torreta=0x7f050019;
public static final int torretaprueba=0x7f05001a;
public static final int torus=0x7f05001b;
public static final int touareg=0x7f05001c;
public static final int transparente=0x7f05001d;
}
public static final class string {
public static final int abc_action_bar_home_description=0x7f060000;
public static final int abc_action_bar_up_description=0x7f060001;
public static final int abc_action_menu_overflow_description=0x7f060002;
public static final int abc_action_mode_done=0x7f060003;
public static final int abc_activity_chooser_view_see_all=0x7f060004;
public static final int abc_activitychooserview_choose_application=0x7f060005;
public static final int abc_searchview_description_clear=0x7f060006;
public static final int abc_searchview_description_query=0x7f060007;
public static final int abc_searchview_description_search=0x7f060008;
public static final int abc_searchview_description_submit=0x7f060009;
public static final int abc_searchview_description_voice=0x7f06000a;
public static final int abc_shareactionprovider_share_with=0x7f06000b;
public static final int abc_shareactionprovider_share_with_application=0x7f06000c;
public static final int action_settings=0x7f06000d;
public static final int app_name=0x7f06000e;
public static final int hello_world=0x7f06000f;
}
public static final class style {
/** API 11 theme customizations can go here.
API 14 theme customizations can go here.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
*/
public static final int AppBaseTheme=0x7f090002;
/** All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f090042;
public static final int TextAppearance_AppCompat_Base_CompactMenu_Dialog=0x7f090043;
public static final int TextAppearance_AppCompat_Base_SearchResult=0x7f090044;
public static final int TextAppearance_AppCompat_Base_SearchResult_Subtitle=0x7f09000b;
public static final int TextAppearance_AppCompat_Base_SearchResult_Title=0x7f09000c;
public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Large=0x7f09000d;
public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Small=0x7f09000e;
public static final int TextAppearance_AppCompat_Light_Base_SearchResult=0x7f090045;
public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Subtitle=0x7f09000f;
public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Title=0x7f090010;
public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Large=0x7f090011;
public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Small=0x7f090012;
public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle=0x7f090046;
public static final int TextAppearance_AppCompat_Light_SearchResult_Title=0x7f090047;
public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large=0x7f090048;
public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small=0x7f090049;
public static final int TextAppearance_AppCompat_SearchResult_Subtitle=0x7f09004a;
public static final int TextAppearance_AppCompat_SearchResult_Title=0x7f09004b;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu=0x7f09004c;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle=0x7f09004d;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse=0x7f09004e;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Title=0x7f09004f;
public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse=0x7f090050;
public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle=0x7f090051;
public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse=0x7f090052;
public static final int TextAppearance_AppCompat_Widget_ActionMode_Title=0x7f090053;
public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse=0x7f090054;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Menu=0x7f090013;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle=0x7f090014;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle_Inverse=0x7f090015;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title=0x7f090016;
public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title_Inverse=0x7f090017;
public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle=0x7f090018;
public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle_Inverse=0x7f090019;
public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title=0x7f09001a;
public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title_Inverse=0x7f09001b;
public static final int TextAppearance_AppCompat_Widget_Base_DropDownItem=0x7f090055;
public static final int TextAppearance_AppCompat_Widget_DropDownItem=0x7f090056;
public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large=0x7f090057;
public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small=0x7f090058;
public static final int TextAppearance_Widget_AppCompat_Base_ExpandedMenu_Item=0x7f090059;
public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item=0x7f09005a;
public static final int Theme_AppCompat=0x7f09005b;
public static final int Theme_AppCompat_Base_CompactMenu=0x7f09005c;
public static final int Theme_AppCompat_Base_CompactMenu_Dialog=0x7f09005d;
public static final int Theme_AppCompat_CompactMenu=0x7f09005e;
public static final int Theme_AppCompat_CompactMenu_Dialog=0x7f09005f;
public static final int Theme_AppCompat_DialogWhenLarge=0x7f090060;
public static final int Theme_AppCompat_Light=0x7f090061;
public static final int Theme_AppCompat_Light_DarkActionBar=0x7f090062;
public static final int Theme_AppCompat_Light_DialogWhenLarge=0x7f090063;
public static final int Theme_Base=0x7f090003;
public static final int Theme_Base_AppCompat=0x7f09001c;
public static final int Theme_Base_AppCompat_Dialog_FixedSize=0x7f090004;
public static final int Theme_Base_AppCompat_Dialog_Light_FixedSize=0x7f090005;
public static final int Theme_Base_AppCompat_DialogWhenLarge=0x7f090000;
public static final int Theme_Base_AppCompat_DialogWhenLarge_Base=0x7f09001d;
public static final int Theme_Base_AppCompat_Light=0x7f09001e;
public static final int Theme_Base_AppCompat_Light_DarkActionBar=0x7f09001f;
public static final int Theme_Base_AppCompat_Light_DialogWhenLarge=0x7f090001;
public static final int Theme_Base_AppCompat_Light_DialogWhenLarge_Base=0x7f090020;
public static final int Theme_Base_Light=0x7f090006;
public static final int Widget_AppCompat_ActionBar=0x7f090064;
public static final int Widget_AppCompat_ActionBar_Solid=0x7f090065;
public static final int Widget_AppCompat_ActionBar_TabBar=0x7f090066;
public static final int Widget_AppCompat_ActionBar_TabText=0x7f090067;
public static final int Widget_AppCompat_ActionBar_TabView=0x7f090068;
public static final int Widget_AppCompat_ActionButton=0x7f090069;
public static final int Widget_AppCompat_ActionButton_CloseMode=0x7f09006a;
public static final int Widget_AppCompat_ActionButton_Overflow=0x7f09006b;
public static final int Widget_AppCompat_ActionMode=0x7f09006c;
public static final int Widget_AppCompat_ActivityChooserView=0x7f09006d;
public static final int Widget_AppCompat_AutoCompleteTextView=0x7f09006e;
public static final int Widget_AppCompat_Base_ActionBar=0x7f090021;
public static final int Widget_AppCompat_Base_ActionBar_Solid=0x7f090022;
public static final int Widget_AppCompat_Base_ActionBar_TabBar=0x7f090023;
public static final int Widget_AppCompat_Base_ActionBar_TabText=0x7f090024;
public static final int Widget_AppCompat_Base_ActionBar_TabView=0x7f090025;
public static final int Widget_AppCompat_Base_ActionButton=0x7f090026;
public static final int Widget_AppCompat_Base_ActionButton_CloseMode=0x7f090027;
public static final int Widget_AppCompat_Base_ActionButton_Overflow=0x7f090028;
public static final int Widget_AppCompat_Base_ActionMode=0x7f09006f;
public static final int Widget_AppCompat_Base_ActivityChooserView=0x7f090029;
public static final int Widget_AppCompat_Base_AutoCompleteTextView=0x7f090007;
public static final int Widget_AppCompat_Base_DropDownItem_Spinner=0x7f09002a;
public static final int Widget_AppCompat_Base_ListPopupWindow=0x7f09002b;
public static final int Widget_AppCompat_Base_ListView_DropDown=0x7f09002c;
public static final int Widget_AppCompat_Base_ListView_Menu=0x7f09002d;
public static final int Widget_AppCompat_Base_PopupMenu=0x7f09002e;
public static final int Widget_AppCompat_Base_ProgressBar=0x7f090008;
public static final int Widget_AppCompat_Base_ProgressBar_Horizontal=0x7f090009;
public static final int Widget_AppCompat_Base_Spinner=0x7f09002f;
public static final int Widget_AppCompat_DropDownItem_Spinner=0x7f090070;
public static final int Widget_AppCompat_Light_ActionBar=0x7f090071;
public static final int Widget_AppCompat_Light_ActionBar_Solid=0x7f090072;
public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse=0x7f090073;
public static final int Widget_AppCompat_Light_ActionBar_TabBar=0x7f090074;
public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse=0x7f090075;
public static final int Widget_AppCompat_Light_ActionBar_TabText=0x7f090076;
public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse=0x7f090077;
public static final int Widget_AppCompat_Light_ActionBar_TabView=0x7f090078;
public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse=0x7f090079;
public static final int Widget_AppCompat_Light_ActionButton=0x7f09007a;
public static final int Widget_AppCompat_Light_ActionButton_CloseMode=0x7f09007b;
public static final int Widget_AppCompat_Light_ActionButton_Overflow=0x7f09007c;
public static final int Widget_AppCompat_Light_ActionMode_Inverse=0x7f09007d;
public static final int Widget_AppCompat_Light_ActivityChooserView=0x7f09007e;
public static final int Widget_AppCompat_Light_AutoCompleteTextView=0x7f09007f;
public static final int Widget_AppCompat_Light_Base_ActionBar=0x7f090030;
public static final int Widget_AppCompat_Light_Base_ActionBar_Solid=0x7f090031;
public static final int Widget_AppCompat_Light_Base_ActionBar_Solid_Inverse=0x7f090032;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar=0x7f090033;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar_Inverse=0x7f090034;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabText=0x7f090035;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabText_Inverse=0x7f090036;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabView=0x7f090037;
public static final int Widget_AppCompat_Light_Base_ActionBar_TabView_Inverse=0x7f090038;
public static final int Widget_AppCompat_Light_Base_ActionButton=0x7f090039;
public static final int Widget_AppCompat_Light_Base_ActionButton_CloseMode=0x7f09003a;
public static final int Widget_AppCompat_Light_Base_ActionButton_Overflow=0x7f09003b;
public static final int Widget_AppCompat_Light_Base_ActionMode_Inverse=0x7f09003c;
public static final int Widget_AppCompat_Light_Base_ActivityChooserView=0x7f090080;
public static final int Widget_AppCompat_Light_Base_AutoCompleteTextView=0x7f09000a;
public static final int Widget_AppCompat_Light_Base_DropDownItem_Spinner=0x7f09003d;
public static final int Widget_AppCompat_Light_Base_ListPopupWindow=0x7f09003e;
public static final int Widget_AppCompat_Light_Base_ListView_DropDown=0x7f09003f;
public static final int Widget_AppCompat_Light_Base_PopupMenu=0x7f090040;
public static final int Widget_AppCompat_Light_Base_Spinner=0x7f090041;
public static final int Widget_AppCompat_Light_DropDownItem_Spinner=0x7f090081;
public static final int Widget_AppCompat_Light_ListPopupWindow=0x7f090082;
public static final int Widget_AppCompat_Light_ListView_DropDown=0x7f090083;
public static final int Widget_AppCompat_Light_PopupMenu=0x7f090084;
public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar=0x7f090085;
public static final int Widget_AppCompat_ListPopupWindow=0x7f090086;
public static final int Widget_AppCompat_ListView_DropDown=0x7f090087;
public static final int Widget_AppCompat_ListView_Menu=0x7f090088;
public static final int Widget_AppCompat_PopupMenu=0x7f090089;
public static final int Widget_AppCompat_ProgressBar=0x7f09008a;
public static final int Widget_AppCompat_ProgressBar_Horizontal=0x7f09008b;
public static final int Widget_AppCompat_Spinner_DropDown_ActionBar=0x7f09008c;
}
public static final class styleable {
/** Attributes that can be used with a ActionBar.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #ActionBar_background com.opengl10.android:background}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_backgroundSplit com.opengl10.android:backgroundSplit}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_backgroundStacked com.opengl10.android:backgroundStacked}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_customNavigationLayout com.opengl10.android:customNavigationLayout}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_displayOptions com.opengl10.android:displayOptions}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_divider com.opengl10.android:divider}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_height com.opengl10.android:height}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_homeLayout com.opengl10.android:homeLayout}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_icon com.opengl10.android:icon}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_indeterminateProgressStyle com.opengl10.android:indeterminateProgressStyle}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_itemPadding com.opengl10.android:itemPadding}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_logo com.opengl10.android:logo}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_navigationMode com.opengl10.android:navigationMode}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_progressBarPadding com.opengl10.android:progressBarPadding}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_progressBarStyle com.opengl10.android:progressBarStyle}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_subtitle com.opengl10.android:subtitle}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_subtitleTextStyle com.opengl10.android:subtitleTextStyle}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_title com.opengl10.android:title}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBar_titleTextStyle com.opengl10.android:titleTextStyle}</code></td><td></td></tr>
</table>
@see #ActionBar_background
@see #ActionBar_backgroundSplit
@see #ActionBar_backgroundStacked
@see #ActionBar_customNavigationLayout
@see #ActionBar_displayOptions
@see #ActionBar_divider
@see #ActionBar_height
@see #ActionBar_homeLayout
@see #ActionBar_icon
@see #ActionBar_indeterminateProgressStyle
@see #ActionBar_itemPadding
@see #ActionBar_logo
@see #ActionBar_navigationMode
@see #ActionBar_progressBarPadding
@see #ActionBar_progressBarStyle
@see #ActionBar_subtitle
@see #ActionBar_subtitleTextStyle
@see #ActionBar_title
@see #ActionBar_titleTextStyle
*/
public static final int[] ActionBar = {
0x7f010020, 0x7f01003e, 0x7f01003f, 0x7f010040,
0x7f010041, 0x7f010042, 0x7f010043, 0x7f010044,
0x7f010045, 0x7f010046, 0x7f010047, 0x7f010048,
0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c,
0x7f01004d, 0x7f01004e, 0x7f01004f
};
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#background}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:background
*/
public static final int ActionBar_background = 10;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#backgroundSplit}
attribute's value can be found in the {@link #ActionBar} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.opengl10.android:backgroundSplit
*/
public static final int ActionBar_backgroundSplit = 12;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#backgroundStacked}
attribute's value can be found in the {@link #ActionBar} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.opengl10.android:backgroundStacked
*/
public static final int ActionBar_backgroundStacked = 11;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#customNavigationLayout}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:customNavigationLayout
*/
public static final int ActionBar_customNavigationLayout = 13;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#displayOptions}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be one or more (separated by '|') of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr>
<tr><td><code>showHome</code></td><td>0x2</td><td></td></tr>
<tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr>
<tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr>
<tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr>
<tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr>
</table>
@attr name com.opengl10.android:displayOptions
*/
public static final int ActionBar_displayOptions = 3;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#divider}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:divider
*/
public static final int ActionBar_divider = 9;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#height}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:height
*/
public static final int ActionBar_height = 0;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#homeLayout}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:homeLayout
*/
public static final int ActionBar_homeLayout = 14;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#icon}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:icon
*/
public static final int ActionBar_icon = 7;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#indeterminateProgressStyle}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:indeterminateProgressStyle
*/
public static final int ActionBar_indeterminateProgressStyle = 16;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#itemPadding}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:itemPadding
*/
public static final int ActionBar_itemPadding = 18;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#logo}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:logo
*/
public static final int ActionBar_logo = 8;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#navigationMode}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>normal</code></td><td>0</td><td></td></tr>
<tr><td><code>listMode</code></td><td>1</td><td></td></tr>
<tr><td><code>tabMode</code></td><td>2</td><td></td></tr>
</table>
@attr name com.opengl10.android:navigationMode
*/
public static final int ActionBar_navigationMode = 2;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#progressBarPadding}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:progressBarPadding
*/
public static final int ActionBar_progressBarPadding = 17;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#progressBarStyle}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:progressBarStyle
*/
public static final int ActionBar_progressBarStyle = 15;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#subtitle}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:subtitle
*/
public static final int ActionBar_subtitle = 4;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#subtitleTextStyle}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:subtitleTextStyle
*/
public static final int ActionBar_subtitleTextStyle = 6;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#title}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:title
*/
public static final int ActionBar_title = 1;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#titleTextStyle}
attribute's value can be found in the {@link #ActionBar} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:titleTextStyle
*/
public static final int ActionBar_titleTextStyle = 5;
/** Attributes that can be used with a ActionBarLayout.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #ActionBarLayout_android_layout_gravity android:layout_gravity}</code></td><td></td></tr>
</table>
@see #ActionBarLayout_android_layout_gravity
*/
public static final int[] ActionBarLayout = {
0x010100b3
};
/**
<p>This symbol is the offset where the {@link android.R.attr#layout_gravity}
attribute's value can be found in the {@link #ActionBarLayout} array.
@attr name android:layout_gravity
*/
public static final int ActionBarLayout_android_layout_gravity = 0;
/** Attributes that can be used with a ActionBarWindow.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #ActionBarWindow_windowActionBar com.opengl10.android:windowActionBar}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBarWindow_windowActionBarOverlay com.opengl10.android:windowActionBarOverlay}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBarWindow_windowFixedHeightMajor com.opengl10.android:windowFixedHeightMajor}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBarWindow_windowFixedHeightMinor com.opengl10.android:windowFixedHeightMinor}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBarWindow_windowFixedWidthMajor com.opengl10.android:windowFixedWidthMajor}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBarWindow_windowFixedWidthMinor com.opengl10.android:windowFixedWidthMinor}</code></td><td></td></tr>
<tr><td><code>{@link #ActionBarWindow_windowSplitActionBar com.opengl10.android:windowSplitActionBar}</code></td><td></td></tr>
</table>
@see #ActionBarWindow_windowActionBar
@see #ActionBarWindow_windowActionBarOverlay
@see #ActionBarWindow_windowFixedHeightMajor
@see #ActionBarWindow_windowFixedHeightMinor
@see #ActionBarWindow_windowFixedWidthMajor
@see #ActionBarWindow_windowFixedWidthMinor
@see #ActionBarWindow_windowSplitActionBar
*/
public static final int[] ActionBarWindow = {
0x7f010050, 0x7f010051, 0x7f010052, 0x7f010053,
0x7f010054, 0x7f010055, 0x7f010056
};
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#windowActionBar}
attribute's value can be found in the {@link #ActionBarWindow} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:windowActionBar
*/
public static final int ActionBarWindow_windowActionBar = 0;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#windowActionBarOverlay}
attribute's value can be found in the {@link #ActionBarWindow} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:windowActionBarOverlay
*/
public static final int ActionBarWindow_windowActionBarOverlay = 1;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#windowFixedHeightMajor}
attribute's value can be found in the {@link #ActionBarWindow} array.
<p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>".
The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to
some parent container.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:windowFixedHeightMajor
*/
public static final int ActionBarWindow_windowFixedHeightMajor = 6;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#windowFixedHeightMinor}
attribute's value can be found in the {@link #ActionBarWindow} array.
<p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>".
The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to
some parent container.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:windowFixedHeightMinor
*/
public static final int ActionBarWindow_windowFixedHeightMinor = 4;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#windowFixedWidthMajor}
attribute's value can be found in the {@link #ActionBarWindow} array.
<p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>".
The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to
some parent container.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:windowFixedWidthMajor
*/
public static final int ActionBarWindow_windowFixedWidthMajor = 3;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#windowFixedWidthMinor}
attribute's value can be found in the {@link #ActionBarWindow} array.
<p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>".
The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to
some parent container.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:windowFixedWidthMinor
*/
public static final int ActionBarWindow_windowFixedWidthMinor = 5;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#windowSplitActionBar}
attribute's value can be found in the {@link #ActionBarWindow} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:windowSplitActionBar
*/
public static final int ActionBarWindow_windowSplitActionBar = 2;
/** Attributes that can be used with a ActionMenuItemView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #ActionMenuItemView_android_minWidth android:minWidth}</code></td><td></td></tr>
</table>
@see #ActionMenuItemView_android_minWidth
*/
public static final int[] ActionMenuItemView = {
0x0101013f
};
/**
<p>This symbol is the offset where the {@link android.R.attr#minWidth}
attribute's value can be found in the {@link #ActionMenuItemView} array.
@attr name android:minWidth
*/
public static final int ActionMenuItemView_android_minWidth = 0;
/** Attributes that can be used with a ActionMenuView.
*/
public static final int[] ActionMenuView = {
};
/** Attributes that can be used with a ActionMode.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #ActionMode_background com.opengl10.android:background}</code></td><td></td></tr>
<tr><td><code>{@link #ActionMode_backgroundSplit com.opengl10.android:backgroundSplit}</code></td><td></td></tr>
<tr><td><code>{@link #ActionMode_height com.opengl10.android:height}</code></td><td></td></tr>
<tr><td><code>{@link #ActionMode_subtitleTextStyle com.opengl10.android:subtitleTextStyle}</code></td><td></td></tr>
<tr><td><code>{@link #ActionMode_titleTextStyle com.opengl10.android:titleTextStyle}</code></td><td></td></tr>
</table>
@see #ActionMode_background
@see #ActionMode_backgroundSplit
@see #ActionMode_height
@see #ActionMode_subtitleTextStyle
@see #ActionMode_titleTextStyle
*/
public static final int[] ActionMode = {
0x7f010020, 0x7f010042, 0x7f010043, 0x7f010047,
0x7f010049
};
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#background}
attribute's value can be found in the {@link #ActionMode} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:background
*/
public static final int ActionMode_background = 3;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#backgroundSplit}
attribute's value can be found in the {@link #ActionMode} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>",
"<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>".
@attr name com.opengl10.android:backgroundSplit
*/
public static final int ActionMode_backgroundSplit = 4;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#height}
attribute's value can be found in the {@link #ActionMode} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:height
*/
public static final int ActionMode_height = 0;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#subtitleTextStyle}
attribute's value can be found in the {@link #ActionMode} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:subtitleTextStyle
*/
public static final int ActionMode_subtitleTextStyle = 2;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#titleTextStyle}
attribute's value can be found in the {@link #ActionMode} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:titleTextStyle
*/
public static final int ActionMode_titleTextStyle = 1;
/** Attributes that can be used with a ActivityChooserView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #ActivityChooserView_expandActivityOverflowButtonDrawable com.opengl10.android:expandActivityOverflowButtonDrawable}</code></td><td></td></tr>
<tr><td><code>{@link #ActivityChooserView_initialActivityCount com.opengl10.android:initialActivityCount}</code></td><td></td></tr>
</table>
@see #ActivityChooserView_expandActivityOverflowButtonDrawable
@see #ActivityChooserView_initialActivityCount
*/
public static final int[] ActivityChooserView = {
0x7f010057, 0x7f010058
};
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#expandActivityOverflowButtonDrawable}
attribute's value can be found in the {@link #ActivityChooserView} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:expandActivityOverflowButtonDrawable
*/
public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#initialActivityCount}
attribute's value can be found in the {@link #ActivityChooserView} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:initialActivityCount
*/
public static final int ActivityChooserView_initialActivityCount = 0;
/** Attributes that can be used with a CompatTextView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #CompatTextView_textAllCaps com.opengl10.android:textAllCaps}</code></td><td></td></tr>
</table>
@see #CompatTextView_textAllCaps
*/
public static final int[] CompatTextView = {
0x7f010059
};
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#textAllCaps}
attribute's value can be found in the {@link #CompatTextView} array.
<p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
<p>May be a boolean value, either "<code>true</code>" or "<code>false</code>".
@attr name com.opengl10.android:textAllCaps
*/
public static final int CompatTextView_textAllCaps = 0;
/** Attributes that can be used with a LinearLayoutICS.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #LinearLayoutICS_divider com.opengl10.android:divider}</code></td><td></td></tr>
<tr><td><code>{@link #LinearLayoutICS_dividerPadding com.opengl10.android:dividerPadding}</code></td><td></td></tr>
<tr><td><code>{@link #LinearLayoutICS_showDividers com.opengl10.android:showDividers}</code></td><td></td></tr>
</table>
@see #LinearLayoutICS_divider
@see #LinearLayoutICS_dividerPadding
@see #LinearLayoutICS_showDividers
*/
public static final int[] LinearLayoutICS = {
0x7f010046, 0x7f01005a, 0x7f01005b
};
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#divider}
attribute's value can be found in the {@link #LinearLayoutICS} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:divider
*/
public static final int LinearLayoutICS_divider = 0;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#dividerPadding}
attribute's value can be found in the {@link #LinearLayoutICS} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:dividerPadding
*/
public static final int LinearLayoutICS_dividerPadding = 2;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#showDividers}
attribute's value can be found in the {@link #LinearLayoutICS} array.
<p>Must be one or more (separated by '|') of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>none</code></td><td>0</td><td></td></tr>
<tr><td><code>beginning</code></td><td>1</td><td></td></tr>
<tr><td><code>middle</code></td><td>2</td><td></td></tr>
<tr><td><code>end</code></td><td>4</td><td></td></tr>
</table>
@attr name com.opengl10.android:showDividers
*/
public static final int LinearLayoutICS_showDividers = 1;
/** Attributes that can be used with a MenuGroup.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #MenuGroup_android_checkableBehavior android:checkableBehavior}</code></td><td></td></tr>
<tr><td><code>{@link #MenuGroup_android_enabled android:enabled}</code></td><td></td></tr>
<tr><td><code>{@link #MenuGroup_android_id android:id}</code></td><td></td></tr>
<tr><td><code>{@link #MenuGroup_android_menuCategory android:menuCategory}</code></td><td></td></tr>
<tr><td><code>{@link #MenuGroup_android_orderInCategory android:orderInCategory}</code></td><td></td></tr>
<tr><td><code>{@link #MenuGroup_android_visible android:visible}</code></td><td></td></tr>
</table>
@see #MenuGroup_android_checkableBehavior
@see #MenuGroup_android_enabled
@see #MenuGroup_android_id
@see #MenuGroup_android_menuCategory
@see #MenuGroup_android_orderInCategory
@see #MenuGroup_android_visible
*/
public static final int[] MenuGroup = {
0x0101000e, 0x010100d0, 0x01010194, 0x010101de,
0x010101df, 0x010101e0
};
/**
<p>This symbol is the offset where the {@link android.R.attr#checkableBehavior}
attribute's value can be found in the {@link #MenuGroup} array.
@attr name android:checkableBehavior
*/
public static final int MenuGroup_android_checkableBehavior = 5;
/**
<p>This symbol is the offset where the {@link android.R.attr#enabled}
attribute's value can be found in the {@link #MenuGroup} array.
@attr name android:enabled
*/
public static final int MenuGroup_android_enabled = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#id}
attribute's value can be found in the {@link #MenuGroup} array.
@attr name android:id
*/
public static final int MenuGroup_android_id = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#menuCategory}
attribute's value can be found in the {@link #MenuGroup} array.
@attr name android:menuCategory
*/
public static final int MenuGroup_android_menuCategory = 3;
/**
<p>This symbol is the offset where the {@link android.R.attr#orderInCategory}
attribute's value can be found in the {@link #MenuGroup} array.
@attr name android:orderInCategory
*/
public static final int MenuGroup_android_orderInCategory = 4;
/**
<p>This symbol is the offset where the {@link android.R.attr#visible}
attribute's value can be found in the {@link #MenuGroup} array.
@attr name android:visible
*/
public static final int MenuGroup_android_visible = 2;
/** Attributes that can be used with a MenuItem.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #MenuItem_actionLayout com.opengl10.android:actionLayout}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_actionProviderClass com.opengl10.android:actionProviderClass}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_actionViewClass com.opengl10.android:actionViewClass}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_alphabeticShortcut android:alphabeticShortcut}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_checkable android:checkable}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_checked android:checked}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_enabled android:enabled}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_icon android:icon}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_id android:id}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_menuCategory android:menuCategory}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_numericShortcut android:numericShortcut}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_onClick android:onClick}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_orderInCategory android:orderInCategory}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_title android:title}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_titleCondensed android:titleCondensed}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_android_visible android:visible}</code></td><td></td></tr>
<tr><td><code>{@link #MenuItem_showAsAction com.opengl10.android:showAsAction}</code></td><td></td></tr>
</table>
@see #MenuItem_actionLayout
@see #MenuItem_actionProviderClass
@see #MenuItem_actionViewClass
@see #MenuItem_android_alphabeticShortcut
@see #MenuItem_android_checkable
@see #MenuItem_android_checked
@see #MenuItem_android_enabled
@see #MenuItem_android_icon
@see #MenuItem_android_id
@see #MenuItem_android_menuCategory
@see #MenuItem_android_numericShortcut
@see #MenuItem_android_onClick
@see #MenuItem_android_orderInCategory
@see #MenuItem_android_title
@see #MenuItem_android_titleCondensed
@see #MenuItem_android_visible
@see #MenuItem_showAsAction
*/
public static final int[] MenuItem = {
0x01010002, 0x0101000e, 0x010100d0, 0x01010106,
0x01010194, 0x010101de, 0x010101df, 0x010101e1,
0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5,
0x0101026f, 0x7f01005c, 0x7f01005d, 0x7f01005e,
0x7f01005f
};
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#actionLayout}
attribute's value can be found in the {@link #MenuItem} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:actionLayout
*/
public static final int MenuItem_actionLayout = 14;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#actionProviderClass}
attribute's value can be found in the {@link #MenuItem} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:actionProviderClass
*/
public static final int MenuItem_actionProviderClass = 16;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#actionViewClass}
attribute's value can be found in the {@link #MenuItem} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:actionViewClass
*/
public static final int MenuItem_actionViewClass = 15;
/**
<p>This symbol is the offset where the {@link android.R.attr#alphabeticShortcut}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:alphabeticShortcut
*/
public static final int MenuItem_android_alphabeticShortcut = 9;
/**
<p>This symbol is the offset where the {@link android.R.attr#checkable}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:checkable
*/
public static final int MenuItem_android_checkable = 11;
/**
<p>This symbol is the offset where the {@link android.R.attr#checked}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:checked
*/
public static final int MenuItem_android_checked = 3;
/**
<p>This symbol is the offset where the {@link android.R.attr#enabled}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:enabled
*/
public static final int MenuItem_android_enabled = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#icon}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:icon
*/
public static final int MenuItem_android_icon = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#id}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:id
*/
public static final int MenuItem_android_id = 2;
/**
<p>This symbol is the offset where the {@link android.R.attr#menuCategory}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:menuCategory
*/
public static final int MenuItem_android_menuCategory = 5;
/**
<p>This symbol is the offset where the {@link android.R.attr#numericShortcut}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:numericShortcut
*/
public static final int MenuItem_android_numericShortcut = 10;
/**
<p>This symbol is the offset where the {@link android.R.attr#onClick}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:onClick
*/
public static final int MenuItem_android_onClick = 12;
/**
<p>This symbol is the offset where the {@link android.R.attr#orderInCategory}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:orderInCategory
*/
public static final int MenuItem_android_orderInCategory = 6;
/**
<p>This symbol is the offset where the {@link android.R.attr#title}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:title
*/
public static final int MenuItem_android_title = 7;
/**
<p>This symbol is the offset where the {@link android.R.attr#titleCondensed}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:titleCondensed
*/
public static final int MenuItem_android_titleCondensed = 8;
/**
<p>This symbol is the offset where the {@link android.R.attr#visible}
attribute's value can be found in the {@link #MenuItem} array.
@attr name android:visible
*/
public static final int MenuItem_android_visible = 4;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#showAsAction}
attribute's value can be found in the {@link #MenuItem} array.
<p>Must be one or more (separated by '|') of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>never</code></td><td>0</td><td></td></tr>
<tr><td><code>ifRoom</code></td><td>1</td><td></td></tr>
<tr><td><code>always</code></td><td>2</td><td></td></tr>
<tr><td><code>withText</code></td><td>4</td><td></td></tr>
<tr><td><code>collapseActionView</code></td><td>8</td><td></td></tr>
</table>
@attr name com.opengl10.android:showAsAction
*/
public static final int MenuItem_showAsAction = 13;
/** Attributes that can be used with a MenuView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #MenuView_android_headerBackground android:headerBackground}</code></td><td></td></tr>
<tr><td><code>{@link #MenuView_android_horizontalDivider android:horizontalDivider}</code></td><td></td></tr>
<tr><td><code>{@link #MenuView_android_itemBackground android:itemBackground}</code></td><td></td></tr>
<tr><td><code>{@link #MenuView_android_itemIconDisabledAlpha android:itemIconDisabledAlpha}</code></td><td></td></tr>
<tr><td><code>{@link #MenuView_android_itemTextAppearance android:itemTextAppearance}</code></td><td></td></tr>
<tr><td><code>{@link #MenuView_android_preserveIconSpacing android:preserveIconSpacing}</code></td><td></td></tr>
<tr><td><code>{@link #MenuView_android_verticalDivider android:verticalDivider}</code></td><td></td></tr>
<tr><td><code>{@link #MenuView_android_windowAnimationStyle android:windowAnimationStyle}</code></td><td></td></tr>
</table>
@see #MenuView_android_headerBackground
@see #MenuView_android_horizontalDivider
@see #MenuView_android_itemBackground
@see #MenuView_android_itemIconDisabledAlpha
@see #MenuView_android_itemTextAppearance
@see #MenuView_android_preserveIconSpacing
@see #MenuView_android_verticalDivider
@see #MenuView_android_windowAnimationStyle
*/
public static final int[] MenuView = {
0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e,
0x0101012f, 0x01010130, 0x01010131, 0x01010435
};
/**
<p>This symbol is the offset where the {@link android.R.attr#headerBackground}
attribute's value can be found in the {@link #MenuView} array.
@attr name android:headerBackground
*/
public static final int MenuView_android_headerBackground = 4;
/**
<p>This symbol is the offset where the {@link android.R.attr#horizontalDivider}
attribute's value can be found in the {@link #MenuView} array.
@attr name android:horizontalDivider
*/
public static final int MenuView_android_horizontalDivider = 2;
/**
<p>This symbol is the offset where the {@link android.R.attr#itemBackground}
attribute's value can be found in the {@link #MenuView} array.
@attr name android:itemBackground
*/
public static final int MenuView_android_itemBackground = 5;
/**
<p>This symbol is the offset where the {@link android.R.attr#itemIconDisabledAlpha}
attribute's value can be found in the {@link #MenuView} array.
@attr name android:itemIconDisabledAlpha
*/
public static final int MenuView_android_itemIconDisabledAlpha = 6;
/**
<p>This symbol is the offset where the {@link android.R.attr#itemTextAppearance}
attribute's value can be found in the {@link #MenuView} array.
@attr name android:itemTextAppearance
*/
public static final int MenuView_android_itemTextAppearance = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#preserveIconSpacing}
attribute's value can be found in the {@link #MenuView} array.
@attr name android:preserveIconSpacing
*/
public static final int MenuView_android_preserveIconSpacing = 7;
/**
<p>This symbol is the offset where the {@link android.R.attr#verticalDivider}
attribute's value can be found in the {@link #MenuView} array.
@attr name android:verticalDivider
*/
public static final int MenuView_android_verticalDivider = 3;
/**
<p>This symbol is the offset where the {@link android.R.attr#windowAnimationStyle}
attribute's value can be found in the {@link #MenuView} array.
@attr name android:windowAnimationStyle
*/
public static final int MenuView_android_windowAnimationStyle = 0;
/** Attributes that can be used with a SearchView.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #SearchView_android_imeOptions android:imeOptions}</code></td><td></td></tr>
<tr><td><code>{@link #SearchView_android_inputType android:inputType}</code></td><td></td></tr>
<tr><td><code>{@link #SearchView_android_maxWidth android:maxWidth}</code></td><td></td></tr>
<tr><td><code>{@link #SearchView_iconifiedByDefault com.opengl10.android:iconifiedByDefault}</code></td><td></td></tr>
<tr><td><code>{@link #SearchView_queryHint com.opengl10.android:queryHint}</code></td><td></td></tr>
</table>
@see #SearchView_android_imeOptions
@see #SearchView_android_inputType
@see #SearchView_android_maxWidth
@see #SearchView_iconifiedByDefault
@see #SearchView_queryHint
*/
public static final int[] SearchView = {
0x0101011f, 0x01010220, 0x01010264, 0x7f010060,
0x7f010061
};
/**
<p>This symbol is the offset where the {@link android.R.attr#imeOptions}
attribute's value can be found in the {@link #SearchView} array.
@attr name android:imeOptions
*/
public static final int SearchView_android_imeOptions = 2;
/**
<p>This symbol is the offset where the {@link android.R.attr#inputType}
attribute's value can be found in the {@link #SearchView} array.
@attr name android:inputType
*/
public static final int SearchView_android_inputType = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#maxWidth}
attribute's value can be found in the {@link #SearchView} array.
@attr name android:maxWidth
*/
public static final int SearchView_android_maxWidth = 0;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#iconifiedByDefault}
attribute's value can be found in the {@link #SearchView} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:iconifiedByDefault
*/
public static final int SearchView_iconifiedByDefault = 3;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#queryHint}
attribute's value can be found in the {@link #SearchView} array.
<p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character.
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:queryHint
*/
public static final int SearchView_queryHint = 4;
/** Attributes that can be used with a Spinner.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #Spinner_android_dropDownHorizontalOffset android:dropDownHorizontalOffset}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_android_dropDownSelector android:dropDownSelector}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_android_dropDownVerticalOffset android:dropDownVerticalOffset}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_android_dropDownWidth android:dropDownWidth}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_android_gravity android:gravity}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_android_popupBackground android:popupBackground}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_disableChildrenWhenDisabled com.opengl10.android:disableChildrenWhenDisabled}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_popupPromptView com.opengl10.android:popupPromptView}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_prompt com.opengl10.android:prompt}</code></td><td></td></tr>
<tr><td><code>{@link #Spinner_spinnerMode com.opengl10.android:spinnerMode}</code></td><td></td></tr>
</table>
@see #Spinner_android_dropDownHorizontalOffset
@see #Spinner_android_dropDownSelector
@see #Spinner_android_dropDownVerticalOffset
@see #Spinner_android_dropDownWidth
@see #Spinner_android_gravity
@see #Spinner_android_popupBackground
@see #Spinner_disableChildrenWhenDisabled
@see #Spinner_popupPromptView
@see #Spinner_prompt
@see #Spinner_spinnerMode
*/
public static final int[] Spinner = {
0x010100af, 0x01010175, 0x01010176, 0x01010262,
0x010102ac, 0x010102ad, 0x7f010062, 0x7f010063,
0x7f010064, 0x7f010065
};
/**
<p>This symbol is the offset where the {@link android.R.attr#dropDownHorizontalOffset}
attribute's value can be found in the {@link #Spinner} array.
@attr name android:dropDownHorizontalOffset
*/
public static final int Spinner_android_dropDownHorizontalOffset = 4;
/**
<p>This symbol is the offset where the {@link android.R.attr#dropDownSelector}
attribute's value can be found in the {@link #Spinner} array.
@attr name android:dropDownSelector
*/
public static final int Spinner_android_dropDownSelector = 1;
/**
<p>This symbol is the offset where the {@link android.R.attr#dropDownVerticalOffset}
attribute's value can be found in the {@link #Spinner} array.
@attr name android:dropDownVerticalOffset
*/
public static final int Spinner_android_dropDownVerticalOffset = 5;
/**
<p>This symbol is the offset where the {@link android.R.attr#dropDownWidth}
attribute's value can be found in the {@link #Spinner} array.
@attr name android:dropDownWidth
*/
public static final int Spinner_android_dropDownWidth = 3;
/**
<p>This symbol is the offset where the {@link android.R.attr#gravity}
attribute's value can be found in the {@link #Spinner} array.
@attr name android:gravity
*/
public static final int Spinner_android_gravity = 0;
/**
<p>This symbol is the offset where the {@link android.R.attr#popupBackground}
attribute's value can be found in the {@link #Spinner} array.
@attr name android:popupBackground
*/
public static final int Spinner_android_popupBackground = 2;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#disableChildrenWhenDisabled}
attribute's value can be found in the {@link #Spinner} array.
<p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>".
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:disableChildrenWhenDisabled
*/
public static final int Spinner_disableChildrenWhenDisabled = 9;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#popupPromptView}
attribute's value can be found in the {@link #Spinner} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:popupPromptView
*/
public static final int Spinner_popupPromptView = 8;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#prompt}
attribute's value can be found in the {@link #Spinner} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:prompt
*/
public static final int Spinner_prompt = 6;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#spinnerMode}
attribute's value can be found in the {@link #Spinner} array.
<p>Must be one of the following constant values.</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Constant</th><th>Value</th><th>Description</th></tr>
<tr><td><code>dialog</code></td><td>0</td><td></td></tr>
<tr><td><code>dropdown</code></td><td>1</td><td></td></tr>
</table>
@attr name com.opengl10.android:spinnerMode
*/
public static final int Spinner_spinnerMode = 7;
/** Attributes that can be used with a Theme.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #Theme_actionDropDownStyle com.opengl10.android:actionDropDownStyle}</code></td><td></td></tr>
<tr><td><code>{@link #Theme_dropdownListPreferredItemHeight com.opengl10.android:dropdownListPreferredItemHeight}</code></td><td></td></tr>
<tr><td><code>{@link #Theme_listChoiceBackgroundIndicator com.opengl10.android:listChoiceBackgroundIndicator}</code></td><td></td></tr>
<tr><td><code>{@link #Theme_panelMenuListTheme com.opengl10.android:panelMenuListTheme}</code></td><td></td></tr>
<tr><td><code>{@link #Theme_panelMenuListWidth com.opengl10.android:panelMenuListWidth}</code></td><td></td></tr>
<tr><td><code>{@link #Theme_popupMenuStyle com.opengl10.android:popupMenuStyle}</code></td><td></td></tr>
</table>
@see #Theme_actionDropDownStyle
@see #Theme_dropdownListPreferredItemHeight
@see #Theme_listChoiceBackgroundIndicator
@see #Theme_panelMenuListTheme
@see #Theme_panelMenuListWidth
@see #Theme_popupMenuStyle
*/
public static final int[] Theme = {
0x7f010066, 0x7f010067, 0x7f010068, 0x7f010069,
0x7f01006a, 0x7f01006b
};
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#actionDropDownStyle}
attribute's value can be found in the {@link #Theme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:actionDropDownStyle
*/
public static final int Theme_actionDropDownStyle = 0;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#dropdownListPreferredItemHeight}
attribute's value can be found in the {@link #Theme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:dropdownListPreferredItemHeight
*/
public static final int Theme_dropdownListPreferredItemHeight = 1;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#listChoiceBackgroundIndicator}
attribute's value can be found in the {@link #Theme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:listChoiceBackgroundIndicator
*/
public static final int Theme_listChoiceBackgroundIndicator = 5;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#panelMenuListTheme}
attribute's value can be found in the {@link #Theme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:panelMenuListTheme
*/
public static final int Theme_panelMenuListTheme = 4;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#panelMenuListWidth}
attribute's value can be found in the {@link #Theme} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:panelMenuListWidth
*/
public static final int Theme_panelMenuListWidth = 3;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#popupMenuStyle}
attribute's value can be found in the {@link #Theme} array.
<p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>"
or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>".
@attr name com.opengl10.android:popupMenuStyle
*/
public static final int Theme_popupMenuStyle = 2;
/** Attributes that can be used with a View.
<p>Includes the following attributes:</p>
<table>
<colgroup align="left" />
<colgroup align="left" />
<tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>{@link #View_android_focusable android:focusable}</code></td><td></td></tr>
<tr><td><code>{@link #View_paddingEnd com.opengl10.android:paddingEnd}</code></td><td></td></tr>
<tr><td><code>{@link #View_paddingStart com.opengl10.android:paddingStart}</code></td><td></td></tr>
</table>
@see #View_android_focusable
@see #View_paddingEnd
@see #View_paddingStart
*/
public static final int[] View = {
0x010100da, 0x7f01006c, 0x7f01006d
};
/**
<p>This symbol is the offset where the {@link android.R.attr#focusable}
attribute's value can be found in the {@link #View} array.
@attr name android:focusable
*/
public static final int View_android_focusable = 0;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#paddingEnd}
attribute's value can be found in the {@link #View} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:paddingEnd
*/
public static final int View_paddingEnd = 2;
/**
<p>This symbol is the offset where the {@link com.opengl10.android.R.attr#paddingStart}
attribute's value can be found in the {@link #View} array.
<p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>".
Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size),
in (inches), mm (millimeters).
<p>This may also be a reference to a resource (in the form
"<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or
theme attribute (in the form
"<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>")
containing a value of this type.
@attr name com.opengl10.android:paddingStart
*/
public static final int View_paddingStart = 1;
};
}
| [
"[email protected]"
] | |
a0cff2b3a977d52abaee5ba2e502b2aa2f080a53 | 3d4d3e59e9276dedb243313f80f71df0473c84d6 | /app/src/main/java/com/cooksdev/dagger2template/presentation/di/module/PresenterModule.java | 7d2a166da1ecbc444cb6cedb55a49d7cd57ca781 | [] | no_license | kukharroma/dagger2-android-template | 68d935d4015702f7212167de9621523b1a1d489f | 6ac357bfe7cb6cf7fa335258e98cb19f0e8edcd1 | refs/heads/master | 2020-05-21T09:40:15.529352 | 2017-03-12T17:55:29 | 2017-03-12T17:55:29 | 84,612,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | package com.cooksdev.dagger2template.presentation.di.module;
import com.cooksdev.dagger2template.domain.GetUserUseCase;
import com.cooksdev.dagger2template.presentation.presenter.MainPresenter;
import javax.inject.Named;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
@Module
public class PresenterModule {
@Provides
@Singleton
MainPresenter mainPresenter(@Named("cache") GetUserUseCase getUserUseCase, @Named("non_cache") GetUserUseCase getUserUseCaseNoNCache) {
return new MainPresenter(getUserUseCase, getUserUseCaseNoNCache);
}
}
| [
"[email protected]"
] | |
a029396650f84ad27f6600b5f0fa8a29e69f72ff | 3898d6d186a61e8be3709141d40f7b949ce09d48 | /src/main/java/com/cisco/axl/api/_10/UpdatePhoneNtpReq.java | 2f34e2930dc7671b97debb858587bde734118177 | [] | no_license | dert261/cucmAxlImpl | a155bf1a8694a341fe932f8f601dafadd2a374a1 | 3000b6e614937d973cd4444a0dd7faf2513f569a | refs/heads/master | 2021-01-21T04:19:13.714018 | 2016-06-29T08:07:29 | 2016-06-29T08:07:29 | 54,956,061 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,067 | java |
package com.cisco.axl.api._10;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for UpdatePhoneNtpReq complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="UpdatePhoneNtpReq">
* <complexContent>
* <extension base="{http://www.cisco.com/AXL/API/10.0}APIRequest">
* <sequence>
* <choice>
* <element name="uuid" type="{http://www.cisco.com/AXL/API/10.0}XUUID"/>
* <element name="ipAddress" type="{http://www.w3.org/2001/XMLSchema}string"/>
* </choice>
* <element name="newIpAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="mode" type="{http://www.cisco.com/AXL/API/10.0}XZzntpmode" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UpdatePhoneNtpReq", propOrder = {
"uuid",
"ipAddress",
"newIpAddress",
"description",
"mode"
})
public class UpdatePhoneNtpReq
extends APIRequest
{
protected String uuid;
protected String ipAddress;
protected String newIpAddress;
protected String description;
@XmlElement(defaultValue = "Directed Broadcast")
@XmlSchemaType(name = "anySimpleType")
protected String mode;
/**
* Gets the value of the uuid property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getUuid() {
return uuid;
}
/**
* Sets the value of the uuid property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUuid(String value) {
this.uuid = value;
}
/**
* Gets the value of the ipAddress property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIpAddress() {
return ipAddress;
}
/**
* Sets the value of the ipAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIpAddress(String value) {
this.ipAddress = value;
}
/**
* Gets the value of the newIpAddress property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNewIpAddress() {
return newIpAddress;
}
/**
* Sets the value of the newIpAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNewIpAddress(String value) {
this.newIpAddress = value;
}
/**
* Gets the value of the description property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescription() {
return description;
}
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/**
* Gets the value of the mode property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMode() {
return mode;
}
/**
* Sets the value of the mode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMode(String value) {
this.mode = value;
}
}
| [
"[email protected]"
] | |
0bfad1878efb54f3adb2ad3aea50517bf2012565 | a5a19b7e19f2f9c67b8d4cfdf57583df8610f09e | /serverconnect/app/src/main/java/com/shakibcsekuet/serverconnect/RegisterRequest.java | fd417a0f7170006aff5812d1dd2f151fee98eb5b | [] | no_license | shahidul034/All-android-project | e1a5f3363584e9892800373643e963aaa192ad4c | 7530014443d29cf2724eff5ad953f979539e75b9 | refs/heads/master | 2020-04-28T08:47:13.601280 | 2019-03-12T05:35:39 | 2019-03-12T05:35:39 | 175,141,683 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 844 | java | package com.shakibcsekuet.serverconnect;
import com.android.volley.Response;
import com.android.volley.toolbox.StringRequest;
import java.util.HashMap;
import java.util.Map;
public class RegisterRequest extends StringRequest {
private static final String REGISTER_REQUEST_URL = "http://tonikamitv.hostei.com/Register.php";
private Map<String, String> params;
public RegisterRequest(String name, String username, int age, String password, Response.Listener<String> listener) {
super(Method.POST, REGISTER_REQUEST_URL, listener, null);
params = new HashMap<>();
params.put("name", name);
params.put("age", age + "");
params.put("username", username);
params.put("password", password);
}
@Override
public Map<String, String> getParams() {
return params;
}
}
| [
"[email protected]"
] | |
be406fcb36b936ed97ab3fe5fd442cd9f0a95490 | a19378bc6822ce5d6bd3bc26d6950521c451ec56 | /src/main/java/co/edu/utp/laboratorio/microprofile/ejemplo/negocio/exceptions/BeanValidationExceptionMapper.java | 6d963a21203f9ae0d5fbcd6b3e310264a66e04db | [] | no_license | christiancandela-utp/microprofile-ejemplo | 0a0c10687b026055941a07025faf9b80e93039ce | a322e496fd30c0f2e21de3411ab04f2aeaeeca96 | refs/heads/main | 2023-09-03T18:50:16.375809 | 2021-11-17T01:11:09 | 2021-11-17T01:11:09 | 416,579,594 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,290 | java | package co.edu.utp.laboratorio.microprofile.ejemplo.negocio.exceptions;
import javax.json.Json;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import java.util.Collections;
import java.util.Set;
@Provider
public class BeanValidationExceptionMapper
implements ExceptionMapper<ConstraintViolationException> {
@Override
public Response toResponse(final ConstraintViolationException exception) {
Set<ConstraintViolation<?>> constraintViolations = exception.getConstraintViolations();
String message = constraintViolations.stream()
.map(constraintViolation -> constraintViolation.getMessage()).findFirst().orElse("");
return Response
.status(Response.Status.BAD_REQUEST)
.type(MediaType.APPLICATION_JSON_TYPE)
.entity(
Json.createBuilderFactory(Collections.emptyMap())
.createObjectBuilder()
.add("error",message)
.build()
)
.build();
}
} | [
"[email protected]"
] | |
f53b64ce033fecd0bb883ef8ad67473197864e52 | 03d86ca2d5f44ede9c28bde8dfde0d9350cca4bd | /app/src/main/java/com/mrbrainy/app/ButtonHolder.java | 3c15b7423c50a2503e9fc5cb6553dcee60c9690e | [] | no_license | Co2p/MrBrainy | 254163a6f132d9c245fe6dbea08e42250b97b7f8 | c968d720b0c88f4055e955e83be0cb791d72719a | refs/heads/master | 2020-05-15T12:35:13.217611 | 2014-08-27T15:22:49 | 2014-08-27T15:22:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,363 | java | package com.mrbrainy.app;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.Button;
/**
* Contains a button
*/
public class ButtonHolder implements android.view.View.OnClickListener{
private Drawable orgColor;
private Button button;
private String caption="";
private boolean isRightAnswer;
private GameActivity gameLogic;
public void resetColor(){
button.setBackground(orgColor);
button.refreshDrawableState();
}
public ButtonHolder(GameActivity pGameLogic,Button button){
gameLogic = pGameLogic;
setButton(button);
}
public void onClick(View v){
gameLogic.onAnswer(isRightAnswer,this);
}
public void setButtonBackground(int pBackground){
button.setBackgroundResource(pBackground);
button.refreshDrawableState();
}
private void setButton(Button pButton) {
this.button = pButton;
orgColor = button.getBackground();
button.setText(caption);
button.setOnClickListener(this);
}
public void setCaption(String caption) {
this.caption = caption;
if(button!=null){
button.setText(caption);
}
}
public void setIsRightAnswer(boolean isRightAnswer) {
this.isRightAnswer = isRightAnswer;
}
}
| [
"[email protected]"
] | |
1237128f8535a7c117ba5b832837b8cb463e2241 | 071e5d2896f8b0910271c5309e82d039a6baa0ea | /ultimoTp/java/Controller/MetodologiaListaEmpresaController.java | f2f572a1345663c2458597aacf6dbd271ac39af1 | [] | no_license | meligomez/gr13 | fe7c9e8f7f990c354830c39fe179cf2743edc917 | e4c917db11b37674cbd3ada1bebab98233baf6a1 | refs/heads/master | 2021-08-29T18:36:49.352189 | 2017-12-14T16:31:12 | 2017-12-14T16:31:12 | 103,183,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 870 | java | package Controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import Modelo.DAOjson;
import Modelo.DAOmetodologiaJson;
import spark.ModelAndView;
import spark.Request;
import spark.Response;
public class MetodologiaListaEmpresaController {
private Map<String, Object> model=new HashMap<>();
public ModelAndView inicioMetodologiaListaEmpresas(Request req, Response res){
DAOmetodologiaJson modelSuper = DAOmetodologiaJson.getInstance();
modelSuper.addAllStruct();
model.put("empresas", modelSuper.getAll());
//model.put("periodosDesde", modelSuper.getAllPeriodos());
//model.put("periodosHasta", modelSuper.getAllPeriodos());
//model.put("metodologias", modelSuper.getAllMetodogologia());
return new ModelAndView(model, "metodologiaListaEmpresas.hbs");
}
}
| [
"[email protected]"
] | |
8fd8a6fa12b8b6e45d18547d98aff3c621e95a70 | 75682bd8e0c124e8f1c38a7d46b884320f3d82c3 | /app/src/main/java/plaza/genius/lakshmi/geniususerprofile/UserAdapter.java | fd6b3c6f200fcb2bac190f6b39013822e831b58e | [] | no_license | Maga1982/GeniusUserProfile | 7be2bb38523925a9e8872317b49fcb95cace0b28 | 93300f3b0c9c72f58eb57637a6f9b269b08ae961 | refs/heads/master | 2020-05-21T09:45:45.537131 | 2019-05-10T18:32:11 | 2019-05-10T18:32:11 | 186,004,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,826 | java | package plaza.genius.lakshmi.geniususerprofile;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
public class UserAdapter extends RecyclerView.Adapter<UserAdapter.MyViewHolder>{
Context context;
ArrayList<Users> arrayList;
Users users;
public UserAdapter(Context context,ArrayList<Users> arrayList) {
this.context=context;
this.arrayList=arrayList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int position) {
View view= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.my_list,viewGroup,false);
return new MyViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder myViewHolder, int position) {
users=arrayList.get(position);
myViewHolder.textView1.setText(String.valueOf(users.getFirstName()));
myViewHolder.textView2.setText(String.valueOf(users.getLastName()));
Picasso.get().load(users.getImageUrl()).into(myViewHolder.imageView);
}
@Override
public int getItemCount() {
return arrayList.size();
}
public class MyViewHolder extends RecyclerView.ViewHolder{
TextView textView1,textView2;
ImageView imageView;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
textView1 =itemView.findViewById(R.id.first);
textView2 =itemView.findViewById(R.id.last);
imageView=itemView.findViewById(R.id.image);
}
}
}
| [
"[email protected]"
] | |
806e6501099dd815c55b04f0947b67fee58bb7a7 | f7af9da8632b3b602bf1909495e07a64e5c67d1d | /task511/MaxNumber.java | 0ed7305b9f0dac5ceec354c661c38197bf1f3cf4 | [] | no_license | Dalv1k/Prog.kiev.ua | 3a8ef673c0f9685faf26ce0d526dceb525cc364e | e7d2c8d12d72d99c362af86a1d824cd802d7c89a | refs/heads/master | 2020-04-06T07:05:47.053027 | 2016-09-05T15:08:47 | 2016-09-05T15:08:47 | 63,638,827 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 593 | java | import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;
public class MaxNumber {
public static void main(String[] args) {
Random rn = new Random();
int length = rn.nextInt(10);
int[] array = new int[length];
for (int i = 0; i < array.length; i++ ) {
array[i] = rn.nextInt(10);
}
System.out.println("Your array:" + Arrays.toString(array));
System.out.println("Max number in array: " + getMaxNumber(array));
}
static int getMaxNumber (int [] array) {
int max = array[0];
for (int i : array) {
max = (max < i ) ? i : max;
}
return max;
}
} | [
"[email protected]"
] | |
fe3bdea50ee0c78a35ae1ade933d2a8cebbddd4c | e0e8e97e211c34b740516e70150ec054e62df6c1 | /cloud-stream-rabbitmq-provider8801/src/main/java/com/jmy/springcloud/service/IMessageProvider.java | ccdaa82291ced2df2acc5ccf53bd4cf1b0f3d05e | [] | no_license | Star-Rats/cloud-learn | e27571bba3d34739d2162f34922e8bb48eb0e035 | afa99e9d70ded6cb8628f5bdefb038af89445be7 | refs/heads/master | 2023-06-21T21:23:18.680588 | 2021-07-11T00:59:11 | 2021-07-11T00:59:11 | 351,969,439 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 102 | java | package com.jmy.springcloud.service;
public interface IMessageProvider {
public String send();
}
| [
"[email protected]"
] | |
cb262e94fe9ba82a7544f189736b2efa755dd7c0 | 1b84fbdd99948c3f4e7619e2f2ae2c1b76a9bd5d | /QT2/src/ws/hoyland/qt/Task.java | 501ef2773117b4473713b33c39e9b7b2fa95c392 | [] | no_license | manyhelp/hoy | 6f23af1a32f21e5f9f078c5d513eea3ac6b93783 | 41a1a4f327624c3d4293920b8b9966859b28c283 | refs/heads/master | 2021-01-18T05:17:05.565142 | 2015-08-13T06:46:59 | 2015-08-13T06:46:59 | 61,263,145 | 1 | 0 | null | 2016-06-16T04:52:04 | 2016-06-16T04:52:01 | null | UTF-8 | Java | false | false | 24,498 | java | package ws.hoyland.qt;
import java.math.BigInteger;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.security.MessageDigest;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ThreadPoolExecutor;
import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.conn.params.ConnRoutePNames;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.CoreConnectionPNames;
import org.apache.http.util.EntityUtils;
import org.eclipse.swt.widgets.Display;
import org.json.JSONObject;
public class Task implements Runnable {
private ThreadPoolExecutor pool;
private List<String> proxies;
private List<String> tokens;
private String token;
private String uin;
private String password;
private QT qt;
private int err = -1;
private int tkn_usable = -1;
private Random rnd = new Random();
private String px;
private String line;
private boolean useProxy;
private boolean dna;
private int isdna = -1;
//private final String UAG = "Dalvik/1.2.0 (Linux; U; Android 2.2; sdk Build/FRF91)";
private final String UAG = "QQMobileToken/4.7 CFNetwork/548.1.4 Darwin/11.0.0";
private int model = 0;
// private long st;
// private String time;
public Task(ThreadPoolExecutor pool, List<String> proxies, List<String> tokens, QT qt, String uin, String password) {
this.pool = pool;
this.proxies = proxies;
this.qt = qt;
this.useProxy = qt.useProxy();
this.dna = qt.dna();
this.model = qt.model();
this.tokens = tokens;
//this.token = "1406087124841854";
// this.token = "1475688552139964";
//this.token = "6980777939050726";
this.uin = uin;
this.password = password;
if(useProxy){
synchronized(proxies){
if(proxies.size()==0){
qt.shutdown();
}else{
this.px = proxies.get(rnd.nextInt(proxies.size()));
}
}
}
}
@Override
public void run() {
// this.st = System.currentTimeMillis();
//String token = "1406087124841854"; // 手机上的令牌序列号
// if(useProxy){
// }
// if(ips.length<1){
// System.out.println(px);
// }
// System.getProperties().put("proxySet", "true");
// System.getProperties().setProperty("http.proxyHost", ips[0]);
// System.getProperties().setProperty("http.proxyPort", ips[1]);
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 5000);
httpclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 5000);
// HttpMethodParams
//CoreConnectionPNames.;
//CoreConnectionPNames.
HttpHost proxy = null;
// proxy = new HttpHost("1.50.213.245", 6668, "http");
// httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
if(useProxy){
String[] ips = px.split(":");
proxy = new HttpHost(ips[0], Integer.parseInt(ips[1]), "http");
httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
BigInteger root = new BigInteger("2");
BigInteger d = new BigInteger(
"B8008767A628A4F53BCB84C13C961A55BF87607DAA5BE0BA3AC2E0CB778E494579BD444F699885F4968CD9028BB3FC6FA657D532F1718F581669BDC333F83DC3",
16);
// if(cc>50) break;
// generate random e
byte[] bs = new byte[14];
Random r = new Random();
bs[0] = (byte) (Math.abs(r.nextInt()) % 64);
for (int i = 0; i < bs.length; i++) {
bs[i] = (byte) (Math.abs(r.nextInt()) % 256);
}
BigInteger e = new BigInteger(bs);
// generate my crypt-pub-key
String fcpk = root.modPow(e, d).toString(16).toUpperCase();
//time = "[1]"+(System.currentTimeMillis()-this.st)+"->";
// System.out.println(fcpk);
// StringBuffer sb = new StringBuffer();
try {
// URL url = new URL(
// "http://w.aq.qq.com/cn/mbtoken3/mbtoken3_exchange_key_v2?mobile_type=4&client_type=2&client_ver=15&local_id=0&config_ver=100&pub_key="
// + fcpk + "&sys_ver=2.2");
// InputStream in = url.openStream();
// BufferedReader bin = new BufferedReader(new InputStreamReader(in));
// while ((line = bin.readLine()) != null) {
// sb.append(line);
// // System.out.println(line);
// }
// bin.close();
boolean gt = false;
String ctk = null;
synchronized(qt){
if((ctk=qt.getCTK2())!=null){//原是getCTK()
token = ctk;
}else{
gt = true;
}
}
// synchronized(tokens){
// if(tokens.size()!=0){
// token = tokens.get(rnd.nextInt(tokens.size()));
// }else{
// gt = true;
// }
// }
Crypter crypter = new Crypter();
HttpGet httpGet = null;
HttpResponse response = null;
HttpEntity entity = null;
JSONObject json = null;
if(gt){ //need get a new token
httpGet = new HttpGet("http://w.aq.qq.com/cn/mbtoken3/mbtoken3_exchange_key_v2?mobile_type=4&client_type=2&client_ver=15&local_id=0&config_ver=100&pub_key="
+ fcpk + "&sys_ver=2.2");
httpGet.setHeader("User-Agent", UAG);
httpGet.setHeader("Connection", "Keep-Alive");
response = httpclient.execute(httpGet);
entity = response.getEntity();
// do something useful with the response body
// and ensure it is fully consumed
line = EntityUtils.toString(entity);
EntityUtils.consume(entity);
httpGet.releaseConnection();
if(!line.contains("sess_id")){
//err ! ++;
// err = 106; //操作失败 { "uin": 2474713063, "err": 106, "info": "操作失败,请重试。" }
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
return;
}else{
json = new JSONObject(line);
String sid = json.getString("sess_id");
String tcpk = json.getString("pub_key"); // get server's crypt pub key
// System.out.println(tcpk);
// caculate the key
BigInteger btcpk = new BigInteger(tcpk, 16);
String sk = btcpk.modPow(e, d).toString(16).toUpperCase();
byte[] key = Converts.MD5Encode(Converts.hexStringToByte(sk));
// System.out.println(key.length);
String imei = "012419002637419";
imei = Converts.bytesToHexString(Converts.MD5Encode(imei.getBytes()));
// System.out.println(imei);
// System.out.println(Converts.MD5EncodeToHex("123456"));
json = new JSONObject();
json.put("imei", imei);
// System.out.println(json.toString());
byte[] array = json.toString().getBytes();
byte[] bb = crypter.encrypt(array, key);
String data = Converts.bytesToHexString(bb);
// System.out.println(data);
//gen client-pub-key
bs = new byte[14];
bs[0] = (byte) (Math.abs(r.nextInt()) % 64);
for (int i = 0; i < bs.length; i++) {
bs[i] = (byte) (Math.abs(r.nextInt()) % 256);
}
line = null;
e = new BigInteger(bs);
String cpk = root.modPow(e, d).toString(16).toUpperCase();
httpclient.getCookieStore().clear();
httpGet = new HttpGet("http://w.aq.qq.com/cn/mbtoken3/mbtoken3_activate_token?aq_base_sid="
+ sid + "&data=" + data + "&clt_pub_key=" + cpk);
httpGet.setHeader("User-Agent", UAG);
httpGet.setHeader("Connection", "Keep-Alive");
response = httpclient.execute(httpGet);
//System.out.println(response1.getStatusLine());
entity = response.getEntity();
// do something useful with the response body
// and ensure it is fully consumed
line = EntityUtils.toString(entity);
EntityUtils.consume(entity);
//entity.get
httpGet.releaseConnection();
if(!line.contains("svc_pub_key")){
//err ! ++;
// err = 106; //操作失败 { "uin": 2474713063, "err": 106, "info": "操作失败,请重试。" }
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
return;
}else{
json = new JSONObject(line);
String spk = json.getString("svc_pub_key");
btcpk = new BigInteger(spk, 16);
sk = btcpk.modPow(e, d).toString(16).toUpperCase();
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(Converts.hexStringToByte(sk));
byte[] tk = md.digest(); //32 return 的处理
// System.out.println(tk.length);
//System.out.println(tks.length);
int[] tokenx = new int[16];
//md = MessageDigest.getInstance("SHA-256");
md.update(tk);
byte[] tks = md.digest(); //32
//md = MessageDigest.getInstance("SHA-256");
md.update(tks);
tks = md.digest(); //32
// System.out.println(tks.length);
byte[] tklist = new byte[tks.length * 2]; //64
// System.out.println(tokenkey.length);
// System.out.println(tklist.length);
for(int i=0;i<tks.length;i++){
tklist[i*2] = (byte)((tks[i]&0xFF) >>> 4);
tklist[i*2+1] = (byte)(tks[i]&0xF);
}
//System.out.println(tklist.length);
int k = 0;
for(int i=0;i<tokenx.length;i++){
k = 0;
for(int j=0;j<4;j++){
k += tklist[j*16+i];
}
tokenx[i] = k%10;
}
if(tokenx[0]==0){
tokenx[0]=1;
}
token = "";
for(int i=0;i<tokenx.length;i++){
token += tokenx[i];
//System.out.print(tokenx[i]);
}
synchronized(qt){
qt.setCTK(token);
}
// synchronized(tokens){
// tokens.add(token);
// }
}
}
}//end get token
line = null;
e = new BigInteger(bs);
// httpGet = new HttpGet("http://w.aq.qq.com/cn/mbtoken3/mbtoken3_exchange_key_v2?mobile_type=4&client_type=2&client_ver=15&local_id=0&config_ver=100&pub_key="
// + fcpk + "&sys_ver=2.2");
httpclient.getCookieStore().clear();
//httpGet = new HttpGet("http://w.aq.qq.com/cn/mbtoken3/mbtoken3_exchange_key_v2?mobile_type=4&client_type=2&client_ver=18&local_id=0&config_ver=100&tkn_seq="+token+"&ill_priv=android.permission.GET_TASKS&pub_key="+fcpk+"&sys_ver=2.2");
httpGet = new HttpGet("http://w.aq.qq.com/cn/mbtoken3/mbtoken3_exchange_key_v2?mobile_type=1&client_type=2&client_ver=14&local_id=0&sys_ver=5.1.1_1&pub_key="+fcpk+"&tkn_seq="+token+"&config_ver=0");
httpGet.setHeader("User-Agent", UAG);
httpGet.setHeader("Connection", "Keep-Alive");
response = httpclient.execute(httpGet);
//System.out.println(response1.getStatusLine());
entity = response.getEntity();
// do something useful with the response body
// and ensure it is fully consumed
line = EntityUtils.toString(entity);
EntityUtils.consume(entity);
//entity.get
httpGet.releaseConnection();
//time += "[2]"+(System.currentTimeMillis()-this.st)+"->";
if(!line.contains("sess_id")){
//err ! ++;
// err = 106; //操作失败 { "uin": 2474713063, "err": 106, "info": "操作失败,请重试。" }
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
// Display.getDefault().asyncExec(new Runnable(){
// @Override
// public void run() {
// if(qt.getFlag()){
// qt.uppx();
// }
// }
// });
return;
}else{
//Thread.sleep(5*1000);
json = new JSONObject(line);
//System.out.println(json);
String sid = json.getString("sess_id");
String tcpk = json.getString("pub_key"); // get server's crypt pub key
// System.out.println(tcpk);
try{
line = null;
httpclient.getCookieStore().clear();
httpGet = new HttpGet(
"http://w.aq.qq.com/cn/mbtoken3/mbtoken3_query_captcha?aq_base_sid="+sid+"&uin="+uin+"&scenario_id=1");
httpGet.setHeader("User-Agent", UAG);
httpGet.setHeader("Connection", "Keep-Alive");
response = httpclient.execute(httpGet);
entity = response.getEntity();
// do something useful with the response body
// and ensure it is fully consumed
line = EntityUtils.toString(entity);
EntityUtils.consume(entity);
httpGet.releaseConnection();
}catch(Exception ex){
//ex.printStackTrace();
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
return;
}
// System.out.println(line);
// System.out.println();
// caculate the key
BigInteger btcpk = new BigInteger(tcpk, 16);
String sk = btcpk.modPow(e, d).toString(16).toUpperCase();
byte[] key = Converts.MD5Encode(Converts.hexStringToByte(sk));
// System.out.println(key.length);
// System.out.println(Converts.MD5EncodeToHex("123456"));
json = new JSONObject();
json.put("tkn_seq", token);
json.put("password", Converts.MD5EncodeToHex(password));
// System.out.println(json.toString());
byte[] array = json.toString().getBytes();
byte[] bb = crypter.encrypt(array, key);
String data = Converts.bytesToHexString(bb);
// System.out.println(data);
//time += "[3]"+(System.currentTimeMillis()-this.st)+"->";
//sb = new StringBuffer();
httpclient.getCookieStore().clear();
httpGet = new HttpGet("http://w.aq.qq.com/cn/mbtoken3/mbtoken3_upgrade_determin_v2?uin="
+ uin + "&sess_id=" + sid + "&data=" + data);
httpGet.setHeader("User-Agent", UAG);
httpGet.setHeader("Connection", "Keep-Alive");
// httpGet.removeHeaders("Proxy-Connection");
// url = new URL(
// "http://w.aq.qq.com/cn/mbtoken3/mbtoken3_upgrade_determin_v2?uin="
// + uin + "&sess_id=" + sid + "&data=" + data);
// System.out.print(cc+"\t");
// System.out.println(url.toString());
// output.write(url.toString()+"\r\n");
// output.flush();
// in = url.openStream();
// bin = new BufferedReader(new InputStreamReader(in));
line = null;
response = httpclient.execute(httpGet);
//System.out.println(response1.getStatusLine());
entity = response.getEntity();
// do something useful with the response body
// and ensure it is fully consumed
line = EntityUtils.toString(entity);
EntityUtils.consume(entity);
//entity.get
httpGet.releaseConnection();
//time += "[4]"+(System.currentTimeMillis()-this.st)+"->";
json = new JSONObject(line);
err = json.getInt("err");
if(err==120){ //网络异常
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
// Display.getDefault().asyncExec(new Runnable(){
// @Override
// public void run() {
// if(qt.getFlag()){
// qt.uppx();
// }
// }
// });
//System.out.println(120);
return;
}else if(err==106){//操作错误, 网络波动 IP重复
//System.out.println("ERR="+err+":"+line);
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
// Display.getDefault().asyncExec(new Runnable(){
// @Override
// public void run() {
// if(qt.getFlag()){
// qt.uppx();
// }
// }
// });
//System.out.println("[106]C");
return;
}else if(err==140&&model==2){
//donoting, 计入未知错误
}else if(err==140||err==141||err==142||err==201||err==122){//操作错误, 网络波动 token重复, 201 操作失败,122安全中心绑定失败,140验证码
System.out.println("ERR="+err+":"+line);
// synchronized(tokens){
// tokens.remove(token); //删除当前token
// }
synchronized(qt){
qt.setCTK(null);
}
if(useProxy){
synchronized(proxies){//删除代理
if(err==140&&model==1){
//do nothing
}else{
proxies.remove(px);
}
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
return;
}else if(err==0){
tkn_usable = json.getInt("tkn_usable");
if(dna){
isdna = json.getInt("isdna");
}
if(tkn_usable==0){ //令牌无效
// synchronized(tokens){
// tokens.remove(token); //删除当前token
// }
synchronized(qt){
qt.setCTK(null);
}
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
return;
}
}
// while ((line = bin.readLine()) != null) {
// //sb.append(line);
// json = new JSONObject(line);
// err = json.getInt("err");
// // if(err==0){
// //
// // }else if(err==136){
// //
// // }else{
// //
// // }
// // if(err==120){
// // System.out.println(line);
// // }
// // System.out.println(line);
// }
// bin.close();
}
}
catch(SocketTimeoutException ex){
//System.out.println(this.time);
err = -6;
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
// Display.getDefault().asyncExec(new Runnable(){
// @Override
// public void run() {
// if(qt.getFlag()){
// qt.uppx();
// }
// }
// });
//System.out.println(-5);
//add new task
return;//not need update
}
catch(ClientProtocolException ex){
err = -5;
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
// Display.getDefault().asyncExec(new Runnable(){
// @Override
// public void run() {
// if(qt.getFlag()){
// qt.uppx();
// }
// }
// });
//System.out.println(-5);
//add new task
return;//not need update
}
catch(SocketException ex){ //包含HttpHostConnectException
//System.out.println(this.time);
err = -4;
//System.out.print("SocketException:"+proxies.size()+"->");
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
// Display.getDefault().asyncExec(new Runnable(){
// @Override
// public void run() {
// if(qt.getFlag()){
// qt.uppx();
// }
// }
// });
//System.out.println(-4);
//add new task
return;//not need update
}
catch(NoHttpResponseException ex){
//System.out.println(this.time);
err = -3;
//System.out.print("NoHttpResponseException:"+proxies.size()+"->");
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
// Display.getDefault().asyncExec(new Runnable(){
// @Override
// public void run() {
// if(qt.getFlag()){
// qt.uppx();
// }
// }
// });
//System.out.println(-3);
//add new task
return;//not need update
}catch(ConnectTimeoutException ex){
//System.out.println(this.time);
err = -2;
if(useProxy){
synchronized(proxies){//删除代理
proxies.remove(px);
if(!this.pool.isShutdown()&&proxies.size()!=0){
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
}
}else{
Task task = new Task(pool, proxies, tokens, qt, uin, password);
this.pool.execute(task);
}
// Display.getDefault().asyncExec(new Runnable(){
// @Override
// public void run() {
// if(qt.getFlag()){
// qt.uppx();
// }
// }
// });
//System.out.println(-2);
//add new task
return;//not need update
}
// catch(HttpHostConnectException ex){//代理超时
// err = -2;
// synchronized(proxies){//删除代理
// proxies.remove(px);
// }
// System.out.println(-2);
// //add new task
// Task task = new Task(pool, proxies, qt, token, uin, password);
// this.pool.execute(task);
// return;//not need update
// }
catch (Exception ex) {
err = -1;
System.out.println(-1);
ex.printStackTrace();
}finally{
httpclient.getConnectionManager().shutdown();
}
//time += "[5]"+(System.currentTimeMillis()-this.st)+"->";
//System.out.println("ERR:"+err);
Display.getDefault().asyncExec(new Runnable(){
@Override
public void run() {
//if(qt.getFlag()){
if(err!=132&&err!=0&&err!=136&&err!=140){
System.err.println(err+"->"+uin+":"+password+"->"+px+"->"+line);
}
//if(err==0){
//System.out.println(line);
//}
// if(err==136){
// System.out.println(line);
// }
if(qt.getFlag()){
//System.err.print(time);
qt.up(uin+"----"+password, err, isdna);
}
//}
}
});
}
}
| [
"hoyzhang@1b99f47e-fe51-0410-be24-b111b41e0848"
] | hoyzhang@1b99f47e-fe51-0410-be24-b111b41e0848 |
a66ec9fdaebeb71892d8bff8092b07f194ca2784 | d955ba4c4f4be7f602ff3025bb664027f1779bc4 | /FuteboLisses/src/Jogador.java | caa2b261f11ae753b251c63dd5eae7f1c636653d | [] | no_license | ulissesdifreitas/Football-Manager | be889f265743e87a846a817f4747efd993233c4f | c924582d0ee3cb5cea6366ee2697881f46d76a9d | refs/heads/main | 2023-06-01T19:27:10.770531 | 2021-06-16T16:02:20 | 2021-06-16T16:02:20 | 377,550,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 609 | java |
public class Jogador {
private String nome;
protected int idade;
protected int habilidade;
private int gols;
private int numeroCamisa;
public Jogador() {
gols = 0;
}
public Jogador(String nomeJogador, int idadeJogador, int habilidadeJogador) {
this.nome = nomeJogador;
this.idade = idadeJogador;
this.habilidade = habilidadeJogador;
gols = 0;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public int getHabilidade() {
return habilidade;
}
public int getGols() {
return gols;
}
public void somaGol() {
gols = gols + 1;
}
} | [
"[email protected]"
] | |
49ace908b9e3422d6fb8121fa002b7c477a7ec34 | cfc60fc1148916c0a1c9b421543e02f8cdf31549 | /src/testcases/CWE470_Unsafe_Reflection/CWE470_Unsafe_Reflection__listen_tcp_54b.java | c0b22bbb2bda6f708b625dd758b5427bc319996f | [
"LicenseRef-scancode-public-domain"
] | permissive | zhujinhua/GitFun | c77c8c08e89e61006f7bdbc5dd175e5d8bce8bd2 | 987f72fdccf871ece67f2240eea90e8c1971d183 | refs/heads/master | 2021-01-18T05:46:03.351267 | 2012-09-11T16:43:44 | 2012-09-11T16:43:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,411 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE470_Unsafe_Reflection__listen_tcp_54b.java
Label Definition File: CWE470_Unsafe_Reflection.label.xml
Template File: sources-sinks-54b.tmpl.java
*/
/*
* @description
* CWE: 470 Unsafe Reflection
* BadSource: listen_tcp Read data using a listening tcp connection
* GoodSource: Hardcoded class to load
* Sinks:
* GoodSink: instantiate only certain fixed classes
* BadSink : instantiate arbitrary class
* Flow Variant: 54 Data flow: data passed as an argument from one method through three others to a fifth; all five functions are in different classes in the same package
*
* */
package testcases.CWE470_Unsafe_Reflection;
import testcasesupport.*;
import java.sql.*;
import javax.servlet.http.*;
import java.util.Properties;
import java.io.*;
public class CWE470_Unsafe_Reflection__listen_tcp_54b
{
public void bad_sink(String data ) throws Throwable
{
(new CWE470_Unsafe_Reflection__listen_tcp_54c()).bad_sink(data );
}
/* goodG2B() - use goodsource and badsink */
public void goodG2B_sink(String data ) throws Throwable
{
(new CWE470_Unsafe_Reflection__listen_tcp_54c()).goodG2B_sink(data );
}
/* goodB2G() - use badsource and goodsink */
public void goodB2G_sink(String data ) throws Throwable
{
(new CWE470_Unsafe_Reflection__listen_tcp_54c()).goodB2G_sink(data );
}
}
| [
"[email protected]"
] | |
fd3911ba6d14dc31098f3b3548fb78556554c027 | 1110f84b141cbaef08f8a44d80e7f4007dc99183 | /src/java/Model/UserInfoModel.java | f05a2813b390f0a38087fc256c5fccb748400ac1 | [] | no_license | lukamix/WebTech-EService | 9b6fbd40e776ed413120fb44843d0b0234aec0b1 | 18c019e9e521168dde0dd5e3071aeb8b64fb2be9 | refs/heads/dev | 2023-04-21T09:42:32.731106 | 2021-05-26T16:28:42 | 2021-05-26T16:28:42 | 364,933,744 | 2 | 1 | null | 2021-05-26T16:28:43 | 2021-05-06T14:13:59 | HTML | UTF-8 | Java | false | false | 1,571 | java | package Model;
public class UserInfoModel extends AbstractModel<UserInfoModel> {
private int userid;
private String firstname;
private String lastname;
private String email;
private String avatarlink;
private int userstatus;
private String auth;
private UserModel user;
public int getUserid() {
return userid;
}
public void setUserid(int userid) {
this.userid = userid;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAvatarlink() {
return avatarlink;
}
public void setAvatarlink(String avatarlink) {
this.avatarlink = avatarlink;
}
public int getUserstatus() {
return userstatus;
}
public void setUserstatus(int userstatus) {
this.userstatus = userstatus;
}
public String getAuth() {
return auth;
}
public void setAuth(String auth) {
this.auth = auth;
}
public UserModel getUser() {
return user;
}
public void setUser(UserModel user) {
this.user = user;
}
}
| [
"[email protected]"
] | |
a6a0a93fda5ff846d1d3c3b005c670498b294bd9 | 0d6a8007e1a73f76129c1dfbe34e222dadc3d7f5 | /src/main/java/com/cl/slack/mixaudio/play/AudioDecoder.java | 2172efec1de3f0d95d9d2d0cb1fd3f86b96937c1 | [] | no_license | CL-window/AudioMix | 18f353cab8c3bd7b9b7ce8c10b71ebf13ea5b165 | ef528601a09d4b1d50d28cd1bae15a6e551d5482 | refs/heads/master | 2021-01-20T09:20:59.645093 | 2017-05-26T05:32:16 | 2017-05-26T05:32:16 | 90,242,223 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 9,220 | java | package com.cl.slack.mixaudio.play;
import android.media.MediaCodec;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.util.Log;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
/**
* Created by slack
* on 17/2/7 上午11:11.
* mp3/mp4 --> audio pcm data
*/
public class AudioDecoder {
/**
* 初始化解码器
*/
private static final Object lockPCM = new Object();
private static final int BUFFER_SIZE = 2048;
private List<PCM> chunkPCMDataContainer = new ArrayList<>();//PCM数据块容器
private MediaExtractor mediaExtractor;
private MediaCodec mediaDecode;
private ByteBuffer[] decodeInputBuffers;
private ByteBuffer[] decodeOutputBuffers;
private MediaCodec.BufferInfo decodeBufferInfo;
boolean isPCMExtractorEOS() {
return sawOutputEOS;
}
private boolean sawOutputEOS = false;
private String mp3FilePath;
private MediaFormat mMediaFormat;
public AudioDecoder(String path) {
mp3FilePath = path;
}
private boolean mStartDecode = false;
public AudioDecoder startPcmExtractor(){
if(mStartDecode){
return this;
}
mStartDecode = true;
initMediaDecode();
new Thread(new Runnable() {
@Override
public void run() {
srcAudioFormatToPCM();
}
}).start();
return this;
}
public AudioDecoder release(){
sawOutputEOS = true;
chunkPCMDataContainer.clear();
return this;
}
public byte[] getPCMData() {
synchronized (lockPCM) {//记得加锁
if (chunkPCMDataContainer.isEmpty()) {
return null;
}
byte[] pcmChunk = chunkPCMDataContainer.get(0).bufferBytes;//每次取出index 0 的数据
chunkPCMDataContainer.remove(0);//取出后将此数据remove掉 既能保证PCM数据块的取出顺序 又能及时释放内存
return pcmChunk;
}
}
/**
* 测试时发现 播放音频的 MediaCodec.BufferInfo.size 是变换的
*/
int getBufferSize() {
synchronized (lockPCM) {//记得加锁
if (chunkPCMDataContainer.isEmpty()) {
return BUFFER_SIZE;
}
return chunkPCMDataContainer.get(0).bufferSize;
}
}
public MediaFormat getMediaFormat() {
return mMediaFormat;
}
public int getSampleRate(){
try {
return mMediaFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE);
}catch (Exception e){
e.printStackTrace();
return 44100;
}
}
public int getChannelNumber(){
try {
return mMediaFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
}catch (Exception e){
e.printStackTrace();
return 1;
}
}
private void initMediaDecode() {
try {
mediaExtractor = new MediaExtractor();//此类可分离视频文件的音轨和视频轨道
mediaExtractor.setDataSource(mp3FilePath);//媒体文件的位置
for (int i = 0; i < mediaExtractor.getTrackCount(); i++) {//遍历媒体轨道 此处我们传入的是音频文件,所以也就只有一条轨道
mMediaFormat = mediaExtractor.getTrackFormat(i);
String mime = mMediaFormat.getString(MediaFormat.KEY_MIME);
int sampleRate = mMediaFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE);
// 声道个数:单声道或双声道
int channels = mMediaFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT);
if (mime.startsWith("audio/")) {//获取音频轨道
// format.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, 200 * 1024);
mediaExtractor.selectTrack(i);//选择此音频轨道
mediaDecode = MediaCodec.createDecoderByType(mime);//创建Decode解码器
mediaDecode.configure(mMediaFormat, null, null, 0);
break;
}
}
} catch (Exception e) {
e.printStackTrace();
Log.e("slack","error :: " + e.getMessage());
}
if (mediaDecode == null) {
Log.e("slack", "create mediaDecode failed");
return;
}
mediaDecode.start();//启动MediaCodec ,等待传入数据
decodeInputBuffers = mediaDecode.getInputBuffers();//MediaCodec在此ByteBuffer[]中获取输入数据
decodeOutputBuffers = mediaDecode.getOutputBuffers();//MediaCodec将解码后的数据放到此ByteBuffer[]中 我们可以直接在这里面得到PCM数据
decodeBufferInfo = new MediaCodec.BufferInfo();//用于描述解码得到的byte[]数据的相关信息
}
private void putPCMData(byte[] pcmChunk,int bufferSize) {
synchronized (lockPCM) {//记得加锁
chunkPCMDataContainer.add(new PCM(pcmChunk,bufferSize));
// Log.i("slack","put pcm data ...");
}
}
/**
* 解码音频文件 得到PCM数据块
*/
private void srcAudioFormatToPCM() {
sawOutputEOS = false;
boolean sawInputEOS = false;
try {
while (!sawOutputEOS) {
if (!sawInputEOS) {
int inputIndex = mediaDecode.dequeueInputBuffer(-1);//获取可用的inputBuffer -1代表一直等待,0表示不等待 建议-1,避免丢帧
if (inputIndex >= 0) {
ByteBuffer inputBuffer = decodeInputBuffers[inputIndex];//拿到inputBuffer
inputBuffer.clear();//清空之前传入inputBuffer内的数据
int sampleSize = mediaExtractor.readSampleData(inputBuffer, 0);//MediaExtractor读取数据到inputBuffer中
if (sampleSize < 0) {//小于0 代表所有数据已读取完成
sawInputEOS = true;
mediaDecode.queueInputBuffer(inputIndex, 0, 0, 0L, MediaCodec.BUFFER_FLAG_END_OF_STREAM);
} else {
long presentationTimeUs = mediaExtractor.getSampleTime();
mediaDecode.queueInputBuffer(inputIndex, 0, sampleSize, presentationTimeUs, 0);//通知MediaDecode解码刚刚传入的数据
mediaExtractor.advance();//MediaExtractor移动到下一取样处
}
}
}
//获取解码得到的byte[]数据 参数BufferInfo上面已介绍 10000同样为等待时间 同上-1代表一直等待,0代表不等待。此处单位为微秒
//此处建议不要填-1 有些时候并没有数据输出,那么他就会一直卡在这 等待
int outputIndex = mediaDecode.dequeueOutputBuffer(decodeBufferInfo, 10000);
if (outputIndex >= 0) {
// Simply ignore codec config buffers.
if ((decodeBufferInfo.flags & MediaCodec.BUFFER_FLAG_CODEC_CONFIG) != 0) {
mediaDecode.releaseOutputBuffer(outputIndex, false);
continue;
}
if (decodeBufferInfo.size != 0) {
ByteBuffer outBuf = decodeOutputBuffers[outputIndex];//拿到用于存放PCM数据的Buffer
outBuf.position(decodeBufferInfo.offset);
outBuf.limit(decodeBufferInfo.offset + decodeBufferInfo.size);
byte[] data = new byte[decodeBufferInfo.size];//BufferInfo内定义了此数据块的大小
outBuf.get(data);//将Buffer内的数据取出到字节数组中
// Log.i("slack","try put pcm data ...");
putPCMData(data,decodeBufferInfo.size);//自己定义的方法,供编码器所在的线程获取数据,下面会贴出代码
}
mediaDecode.releaseOutputBuffer(outputIndex, false);//此操作一定要做,不然MediaCodec用完所有的Buffer后 将不能向外输出数据
if ((decodeBufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
sawOutputEOS = true;
Log.i("slack","pcm finished..." + mp3FilePath);
}
} else if (outputIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
decodeOutputBuffers = mediaDecode.getOutputBuffers();
// } else if (outputIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
}
}
} finally {
if(mediaDecode != null) {
mediaDecode.release();
}
if(mediaExtractor != null){
mediaExtractor.release();
}
}
}
private class PCM{
PCM(byte[] bufferBytes, int bufferSize) {
this.bufferBytes = bufferBytes;
this.bufferSize = bufferSize;
}
byte[] bufferBytes;
int bufferSize;
}
}
| [
"[email protected]"
] | |
cb11545f51d6b0ce437b6a19bba4cbdb9b6b6a1d | 4688d19282b2b3b46fc7911d5d67eac0e87bbe24 | /aws-java-sdk-clouddirectory/src/main/java/com/amazonaws/services/clouddirectory/model/transform/ListObjectPoliciesRequestMarshaller.java | b4091c7139b18c34dbd397156ce5dc4fc1f51eea | [
"Apache-2.0"
] | permissive | emilva/aws-sdk-java | c123009b816963a8dc86469405b7e687602579ba | 8fdbdbacdb289fdc0ede057015722b8f7a0d89dc | refs/heads/master | 2021-05-13T17:39:35.101322 | 2018-12-12T13:11:42 | 2018-12-12T13:11:42 | 116,821,450 | 1 | 0 | Apache-2.0 | 2018-09-19T04:17:41 | 2018-01-09T13:45:39 | Java | UTF-8 | Java | false | false | 3,427 | java | /*
* Copyright 2012-2018 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.clouddirectory.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.clouddirectory.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* ListObjectPoliciesRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ListObjectPoliciesRequestMarshaller {
private static final MarshallingInfo<String> DIRECTORYARN_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.HEADER).marshallLocationName("x-amz-data-partition").build();
private static final MarshallingInfo<StructuredPojo> OBJECTREFERENCE_BINDING = MarshallingInfo.builder(MarshallingType.STRUCTURED)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ObjectReference").build();
private static final MarshallingInfo<String> NEXTTOKEN_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("NextToken").build();
private static final MarshallingInfo<Integer> MAXRESULTS_BINDING = MarshallingInfo.builder(MarshallingType.INTEGER)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("MaxResults").build();
private static final MarshallingInfo<String> CONSISTENCYLEVEL_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.HEADER).marshallLocationName("x-amz-consistency-level").build();
private static final ListObjectPoliciesRequestMarshaller instance = new ListObjectPoliciesRequestMarshaller();
public static ListObjectPoliciesRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(ListObjectPoliciesRequest listObjectPoliciesRequest, ProtocolMarshaller protocolMarshaller) {
if (listObjectPoliciesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listObjectPoliciesRequest.getDirectoryArn(), DIRECTORYARN_BINDING);
protocolMarshaller.marshall(listObjectPoliciesRequest.getObjectReference(), OBJECTREFERENCE_BINDING);
protocolMarshaller.marshall(listObjectPoliciesRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listObjectPoliciesRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(listObjectPoliciesRequest.getConsistencyLevel(), CONSISTENCYLEVEL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
847c4e6f4e091e6bdd643f71ac39ab102ac8bdfb | 094fac7d3a5bd711a98a239600f4f9b59ed12f9b | /Java_Assignment_2/CustomStack.java | ceb889c9e3df377a2df3eaafa09cc5842b8f1141 | [] | no_license | upendra-dakuri/Java-Assignment1 | 23436e3bf1170f7f722a749d9e510d4e7a37b167 | e1d7d4dd0a259447c50b4a39234a46856d206a8a | refs/heads/master | 2020-09-10T22:45:28.998136 | 2019-12-10T17:43:44 | 2019-12-10T17:43:44 | 221,855,620 | 0 | 0 | null | 2019-11-18T05:32:59 | 2019-11-15T06:06:32 | Java | UTF-8 | Java | false | false | 717 | java | package com.omniwyse.assignment2;
/**
* This Class implemented Stack DataStructure methods
* @author Upendra
*
*/
public class CustomStack {
public int index = -1;
int[] items;
CustomStack(int size) {
items = new int[size];
}
void push(int x) {
if (index == 99) {
System.out.println("Stack is full...");
} else {
items[++index] = x;
}
}
int pop() {
if (index == -1) {
System.out.println("Underflow stack");
return '\0';
} else {
int element = items[index];
index--;
return element;
}
}
boolean isEmpty() {
if (index == -1) {
return true;
} else {
return false;
}
}
int size() {
return index + 1;
}
}
| [
"[email protected]"
] | |
3f7c9f2379f0934d93123760e395fabea73e3e2b | adcd551678604f20d9a768dac5eff225ceceb1dc | /app/src/main/java/com/dyy/newtest/ui/activity/service/PlayerServiceActivity.java | cdd52e653d0c1c1eef08a84fc8af0a1e827948d8 | [] | no_license | d071225/MyApplication | bad7291e4066624a30a33feffb82e9f7afc33d89 | 1a4df129201dd61b72f995ad8f8d2db0eefba292 | refs/heads/master | 2021-05-09T11:21:32.528355 | 2019-02-26T05:59:33 | 2019-02-26T05:59:33 | 118,988,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,783 | java | package com.dyy.newtest.ui.activity.service;
import android.app.NotificationManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.NotificationCompat;
import android.view.View;
import android.widget.Button;
import com.blankj.utilcode.util.LogUtils;
import com.dyy.newtest.R;
import com.dyy.newtest.ui.service.PlayerService;
import java.io.Serializable;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class PlayerServiceActivity extends AppCompatActivity {
@BindView(R.id.btn_play)
Button btnPlay;
@BindView(R.id.btn_pause)
Button btnPause;
@BindView(R.id.btn_stop)
Button btnStop;
private Context mContext;
private ServiceConnection serviceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
LogUtils.e("-----------onServiceConnected------------");
}
@Override
public void onServiceDisconnected(ComponentName name) {
LogUtils.e("-----------onServiceDisconnected------------");
}
};
private long i = 1;
private int NO_3=3;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_player_service);
ButterKnife.bind(this);
mContext = this;
}
@OnClick({R.id.btn_play, R.id.btn_pause, R.id.btn_stop})
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_play:
//1.startservice
goToPlayerSevice(PlayerService.PLAY);
//2.binderservice
// Intent intent = new Intent(mContext, BinderService.class);
// Bundle bundle = new Bundle();
// bundle.putSerializable("key", PlayerService.PLAY);
// intent.putExtras(bundle);
// bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);
//3.intentservice
// Intent intent=new Intent(mContext, MyIntentService.class);
// Bundle bundle=new Bundle();
// bundle.putSerializable("key","当前值"+ i++);
// intent.putExtras(bundle);
// startService(intent);
//带进度的notification
// startProgress();
break;
case R.id.btn_pause:
goToPlayerSevice(PlayerService.PAUSE);
break;
case R.id.btn_stop:
// goToPlayerSevice(PlayerService.STOP);
// unbindService(serviceConnection);
break;
}
}
private void goToPlayerSevice(Serializable value) {
Intent intent = new Intent(mContext, PlayerService.class);
Bundle bundle = new Bundle();
bundle.putSerializable("key", value);
intent.putExtras(bundle);
startService(intent);
}
public void startProgress() {
final NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(R.mipmap.ic_launcher_round);
builder.setContentTitle("下载");
builder.setContentText("正在下载");
final NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(NO_3, builder.build());
builder.setProgress(100, 0, false);
//下载以及安装线程模拟
new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
builder.setProgress(100, i, false);
manager.notify(NO_3, builder.build());
//下载进度提示
builder.setContentText("下载" + i + "%");
try {
Thread.sleep(50);//演示休眠50毫秒
} catch (InterruptedException e) {
e.printStackTrace();
}
}
//下载完成后更改标题以及提示信息
builder.setContentTitle("开始安装");
builder.setContentText("安装中...");
//设置进度为不确定,用于模拟安装
builder.setProgress(0, 0, true);
manager.notify(NO_3, builder.build());
// manager.cancel(NO_3);//设置关闭通知栏
}
}).start();
}
}
| [
"[email protected]"
] | |
12a51b89bce2d76fda72f37e208b3605eeeb6542 | 054f8943ac7af758f8c7c3f7f469a482d2ca92bb | /src/main/java/io/stevensairafian/github/data/provider/LocalThemeParkManager.java | 5e2144315f42a0c05c3ea65fb7f5242b5ec66e9c | [] | no_license | StevenSairafian/demo-web-project | d698f303c7a8311e9dbfcfc0b190995b40ea614b | d48bfdbc7846302d01613112e0ebda3515da298c | refs/heads/master | 2020-12-28T23:36:03.679978 | 2015-03-10T08:10:06 | 2015-03-10T08:10:06 | 29,606,667 | 0 | 0 | null | 2015-01-21T19:16:37 | 2015-01-21T19:16:37 | Java | UTF-8 | Java | false | false | 4,124 | java | package io.stevensairafian.github.data.provider;
import io.stevensairafian.github.data.ThemePark;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.stevensairafian.github.util.ResourceResolver;
import io.stevensairafian.github.data.*;
public class LocalThemeParkManager implements ThemeParkManager{
private static final ObjectMapper JSON = new ObjectMapper();
public LocalThemeParkManager() {
ScheduledExecutorService scheduler =
Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Document doc;
try {
// need http protocol
doc = Jsoup.connect("http://m.universalstudioshollywood.com/waittimes").get();
// get page title
String hours = doc.select("a").first().text();
//hours are in format 10am - 6pm
//int openingHours = Integer.parseInt(hours.substring(0, 4).replaceAll("\\D", ""));
//int closingHours = Integer.parseInt(hours.substring(hours.length() - 4, hours.length()).replace("\\D", ""));
System.out.println("hours : " + hours);
Set<Attraction> attractions = new HashSet<Attraction>();
// get all table cells (the only tables on the page only hold elements of concern
Elements td = doc.select("td");
/*
* The site is set up such that td's are next to each other in form "attraction" "wait time"
* We may assume that it will always start with an atraction name, followed by a wait time. thus
* we may create attractions by grabbing the 0th element, setting it's wiat time to element 1
* and then grabbing element 2, setting its wait time to element 3 so on and so forth
*/
Element link;
for (int i = 0; i < td.size(); i++) {
link = td.get(i);
System.out.println("text : " + link.text());
Attraction a = new Attraction();
a.setName(link.text());
//get wait time (the next element. Note pre-increment is used
link = td.get(++i);
a.setWaitTime(link.text());
}
// save to the file
JSON.writeValue(ResourceResolver.getThemeParkFile(),
attractions);
} catch (IOException e) {
e.printStackTrace();
}
}}, 0, 10, TimeUnit.SECONDS);
}
@Override
public List<ThemePark> searchParks(String keyword) {
// load the movies from the file
Set<ThemePark> parks = new HashSet<ThemePark>();
try {
parks = JSON.readValue(ResourceResolver.getThemeParkFile(),
new TypeReference<Set<Attraction>>() {});
System.out.println(parks);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// search
List<ThemePark> res = new ArrayList<ThemePark>();
for(ThemePark m : parks) {
System.out.println(m.getName() + " " + keyword);
if (m.getName().toLowerCase().contains(keyword.toLowerCase())) {
res.add(m);
}
}
return res;
}
}
| [
"[email protected]"
] | |
0c78274c25b0355aa119bb3fc7c95331b7da0ecb | 1043c01b7637098d046fbb9dba79b15eefbad509 | /entity-view/testsuite/src/test/java/com/blazebit/persistence/view/testsuite/update/embeddable/simple/updatableonly/model/UpdatableDocumentEmbeddableView.java | 07536748c4db4ff24fc0b7450e3083ac32c50466 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ares3/blaze-persistence | 45c06a3ec25c98236a109ab55a3205fc766734ed | 2258e9d9c44bb993d41c5295eccbc894f420f263 | refs/heads/master | 2020-10-01T16:13:01.380347 | 2019-12-06T01:24:34 | 2019-12-09T09:29:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | /*
* Copyright 2014 - 2019 Blazebit.
*
* 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.blazebit.persistence.view.testsuite.update.embeddable.simple.updatableonly.model;
import com.blazebit.persistence.testsuite.entity.NameObject;
import com.blazebit.persistence.view.UpdatableMapping;
import com.blazebit.persistence.view.testsuite.update.embeddable.simple.model.UpdatableDocumentEmbeddableViewBase;
/**
*
* @author Christian Beikov
* @since 1.2.0
*/
public interface UpdatableDocumentEmbeddableView extends UpdatableDocumentEmbeddableViewBase {
@UpdatableMapping(updatable = true, cascade = { })
public NameObject getNameObject();
public void setNameObject(NameObject nameObject);
}
| [
"[email protected]"
] | |
9493af51d79563f5af2b0dc7eac70e319fa36eee | c531c3876c6de9dcd221f2ab134ae4cd0b836cbc | /src/com/google/zxing/client/android/FinishListener.java | 772584e5fffbbe08f8964d6f8be1e929daa163ea | [] | no_license | silhouttee/zxingBarcode | c4776bbab1eccca0ef9c53bfef1c34c94805e891 | 6d1f5e3290d45b71355a291f7a56884828bed12a | refs/heads/master | 2021-01-12T18:26:06.337126 | 2014-08-12T14:38:55 | 2014-08-12T14:38:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,295 | java | /*
* Copyright (C) 2010 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.client.android;
import android.app.Activity;
import android.content.DialogInterface;
/**
* Simple listener used to exit the app in a few cases.
*
* @author Sean Owen
*/
public final class FinishListener
implements DialogInterface.OnClickListener, DialogInterface.OnCancelListener, Runnable {
private final Activity activityToFinish;
public FinishListener(Activity activityToFinish) {
this.activityToFinish = activityToFinish;
}
public void onCancel(DialogInterface dialogInterface) {
run();
}
public void onClick(DialogInterface dialogInterface, int i) {
run();
}
public void run() {
activityToFinish.finish();
}
}
| [
"[email protected]"
] | |
7f714c4afe0253767180a0db458a9502f10da254 | 38a4978f01364918a200ffdccacbca938bd05cdc | /RandomNumberGame/app/src/main/java/com/example/workspace/randomnumbergame/MainActivity.java | 3849b1e19b6f11e94ac43c40f2db41f42bae4c78 | [] | no_license | rashedulhoque049/Android-studio-RandomNumberGame | 9f33d16338b1c91226f0ba44f0a56f866088ba4b | 07e45004890ca876a00ebafb80b03ae631f6ae79 | refs/heads/master | 2020-03-25T15:33:44.399665 | 2018-08-07T15:00:26 | 2018-08-07T15:00:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,882 | java | package com.example.workspace.randomnumbergame;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.util.Random;
public class MainActivity extends AppCompatActivity {
TextView score;
Button btn1;
Button btn2;
int randomNumber1;
int randomNumber2;
int s=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
score = (TextView) findViewById(R.id.scoreNumber);
btn1 = (Button) findViewById(R.id.bt1);
btn2 = (Button) findViewById(R.id.bt2);
random();
btn1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (randomNumber1 >= randomNumber2){
s++;
score.setText(String.valueOf(s));
}else{
s--;
score.setText(String.valueOf(s));
}
random();
}
});
btn2.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (randomNumber2 >= randomNumber1){
s++;
score.setText(String.valueOf(s));
}else{
s--;
score.setText(String.valueOf(s));
}
random();
}
});
}
public void random() {
Random r1 = new Random();
Random r2 = new Random();
randomNumber1 = r1.nextInt(100);
randomNumber2 = r2.nextInt(100);
btn1.setText(String.valueOf(randomNumber1));
btn2.setText(String.valueOf(randomNumber2));
}
}
| [
"[email protected]"
] | |
559153cb46c8ea8b18817af64878201477e90787 | 46adcdcdd7699ddee844ef39d8da593a0d81971c | /patternity-maven-plugin/src/test/java/com/patternity/data/domain/Epic2.java | 2b349dc522c91bf1caa26907c708429ec48c28fe | [
"Apache-2.0"
] | permissive | SanderSmee/Patternity | f2f72bfada80881193948e3b009ad5498d6c4961 | 45ecfeced4089395f37dbbbaddefd6260fa12e38 | refs/heads/master | 2020-04-14T18:33:30.295350 | 2017-09-04T09:57:55 | 2017-09-04T09:57:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.patternity.data.domain;
import com.patternity.data.service.StoryRepository;
import java.util.List;
/**
*
*/
public class Epic2 {
public List<Story> getStories() {
return StoryRepository.get().loadStories();
}
}
| [
"[email protected]"
] | |
cc2a8a6c47cdbbfba8e17009fad59bd196594112 | 957852f2339da953ee98948ab04df2ef937e38d1 | /src ref/classes-dex2jar_source_from_jdcore/kotlin/system/ProcessKt.java | 33c41734e5ee1d657f5598afd2eeeb5a6c647fcd | [] | no_license | nvcervantes/apc_softdev_mi151_04 | c58fdc7d9e7450654fcb3ce2da48ee62cda5394f | 1d23bd19466d2528934110878fdc930c00777636 | refs/heads/master | 2020-03-22T03:00:40.022931 | 2019-05-06T04:48:09 | 2019-05-06T04:48:09 | 139,407,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 617 | java | package kotlin.system;
import kotlin.Metadata;
import kotlin.internal.InlineOnly;
import kotlin.jvm.JvmName;
@Metadata(bv={1, 0, 2}, d1={"\000\016\n\000\n\002\020\001\n\000\n\002\020\b\n\000\032\021\020\000\032\0020\0012\006\020\002\032\0020\003H\b¨\006\004"}, d2={"exitProcess", "", "status", "", "kotlin-stdlib"}, k=2, mv={1, 1, 9})
@JvmName(name="ProcessKt")
public final class ProcessKt
{
@InlineOnly
private static final Void exitProcess(int paramInt)
{
System.exit(paramInt);
throw ((Throwable)new RuntimeException("System.exit returned normally, while it was supposed to halt JVM."));
}
}
| [
"[email protected]"
] | |
caaa6c2d0112a4911cb44d24787f1f01560fcf9f | eaca378517a46d363ca69131feb39d6301b91a8d | /src/main/resources/archetype-resources/src/main/java/web/api/RestApplication.java | 8e339b5a524ca8eb3a9a308ed9326e7f3de213b0 | [
"MIT"
] | permissive | jabaraster/archetype-javaee7-simple | 1c08ee70d5f4b137e7d0f694c936da9b5750e68c | 01a08780f388f261519f648aba92b284a0050eac | refs/heads/master | 2021-01-10T10:27:02.425344 | 2015-12-25T16:46:51 | 2015-12-25T16:46:51 | 48,583,929 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | /**
*
*/
package ${package}.web.api;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
/**
*
*/
@ApplicationPath("/api")
public class RestApplication extends Application {
// nodef
}
| [
"[email protected]"
] | |
e43d7114d1ead26ff85146cff64cf5d9bc80f4d1 | 4a598494819402e9f353ce5fae9d58c309eb4b80 | /chasing-server/chasing-common/src/main/java/com/prosper/chasing/common/bean/wrapper/ChannelInfo.java | daca490234d30bad716bb42b9f7e9c7dfca29f14 | [] | no_license | deaconcu/chasing | 6bb6293d2cedfa202c019a54e15cf77be7a44d02 | 07252cdf2117f95d01837453208cca2751510c56 | refs/heads/master | 2020-12-29T02:32:46.704711 | 2020-08-14T16:27:04 | 2020-08-14T16:27:04 | 52,885,222 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package com.prosper.chasing.common.bean.wrapper;
import java.util.HashMap;
import java.util.Map;
public class ChannelInfo {
private Integer key;
private Map<String, Object> customValues;
public ChannelInfo() {
customValues = new HashMap<>();
}
public void putCustomValue(String key, Object value) {
customValues.put(key, value);
}
public Map<String, Object> getCustomValues() {
return customValues;
}
public void setCustomValues(Map<String, Object> customValues) {
this.customValues = customValues;
}
public Integer getKey() {
return key;
}
public void setKey(Integer key) {
this.key = key;
}
}
| [
"[email protected]"
] | |
ebe4b3f1cfcd1a836fdcadc0289b9c62b4953ef3 | cb2cfdf7ce18321ae02d4bdd9ce0e594d774a805 | /p8/ChatBotI.java | 0c1feeaf02bc3e799e0b86911887e998b86e049f | [] | no_license | emanuel0918/OOP | 8c1cf5977e0b8bb79f724702ad6cd91ce13212df | 582a11b0fa3736ad449523bf8672e69560572881 | refs/heads/master | 2022-11-30T13:36:41.308998 | 2020-08-12T06:21:53 | 2020-08-12T06:21:53 | 286,928,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 133 | java | import java.rmi.*;
public interface ChatBotI extends Remote {
public String responde(String pregunta) throws RemoteException;
} | [
"[email protected]"
] | |
6311b8e66cc4cb1691b70b4bfccda859b0abaaed | 26e5727f1cd30a123a201d47af83015744b34e8c | /SeleniumGrid_QA/src/test/java/data/Url.java | 18dda377f476c0b3f95146d0290551120929e096 | [] | no_license | marisita/AQA_educational_projects | 9557cbaebfff65bb8bf8562c523a69742c74ccf2 | 993e02b06558521f2584522a978eaa63e77adca4 | refs/heads/master | 2020-05-09T00:58:30.118455 | 2019-04-12T09:33:50 | 2019-04-12T09:33:50 | 180,976,212 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 265 | java | package data;
public enum Url {
LOCALHOST("http://localhost:4444/wd/hub"),
GOOGLE("https://www.google.com.ua")
;
private String url;
Url(String url) {
this.url = url;
}
public String getValue() {
return url;
}
}
| [
"[email protected]"
] | |
daf882536738c5c2be8e6ab3e903925ca5221d34 | 6d91e9267e0797ca40e3b24f27f25eb8ab087961 | /src/com/company/duxiaoman01.java | 7cd47839cffd249c3c029154eb6912c93d328761 | [] | no_license | bo1234566/tomcat | ee77516ebaf362fe2b341c6944ad3a7dda5d4a47 | 948b1fbaad60c6da2a732ab6d93ab8a4f8ac63b4 | refs/heads/master | 2022-12-29T18:35:13.067344 | 2020-10-20T14:19:59 | 2020-10-20T14:19:59 | 302,213,586 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 860 | java | package com.company;
import java.util.HashMap;
import java.util.Scanner;
public class duxiaoman01 {
public static void main(String[] arg){
Scanner sc = new Scanner(System.in);
String s1 = sc.nextLine();
String s2 = sc.nextLine();
HashMap<Character,Integer> map = new HashMap<>();
for(int i = 0;i<s1.length();i++){
if(map.containsKey(s1.charAt(i))){
map.put(s1.charAt(i),map.get(s1.charAt(i))+1);
}
else
map.put(s1.charAt(i),1);
}
int res = 0;
for(int i = 0;i<s2.length();i++){
if(map.containsKey(s2.charAt(i))){
if(map.get(s2.charAt(i))!=0)
res++;
map.put(s2.charAt(i),map.get(s2.charAt(i))-1);
}
}
System.out.println(res);
}
}
| [
"[email protected]@163.com"
] | [email protected]@163.com |
9ace5ba734fe05f16fc84548a1e0d7b58129a803 | bb1b0faf70a39c0ac28999309cdddf22d0c28f9f | /GPSTest/src/com/example/gpstest/BluetoothInterfaceService.java | 616cbc6434c8f9fd116b44f0bf588e4b9d646c30 | [] | no_license | geekylou/android_examples | 1d0781176fd8d2383dc4013b70cb3239c81c72b5 | 270e0397ad8cb3a1825ac2072a6fd79a348653c3 | refs/heads/master | 2020-06-04T03:32:47.729257 | 2014-06-27T08:02:11 | 2014-06-27T08:02:11 | null | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 8,348 | java | package com.example.gpstest;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
import android.telephony.PhoneStateListener;
import android.telephony.SmsManager;
import android.telephony.SmsMessage;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
public class BluetoothInterfaceService extends Service {
public static final String ACTION_RESP =
"uk.me.geekylou.GPSTest.MESSAGE_PROCESSED";
public static final String PARAM_OUT_MSG = "GPS";
MyLocationListener mLocListener=null,mLocListener2=null;
LocationManager mLocManager;
IPSocketThread mIPSocketThread = new IPSocketThread();
SmsManager sms = SmsManager.getDefault();
Object mLock[]=new Object[1];
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return (IBinder) BluetoothInterfaceService.this;
}
@Override
public void onCreate() {
Toast.makeText(this, "Service Created", Toast.LENGTH_SHORT).show();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.i("LocalService", "Received start id " + startId + ": " + intent);
Toast.makeText(this, "Service Started", Toast.LENGTH_SHORT).show();
mLocManager = (LocationManager)
getSystemService(Context.LOCATION_SERVICE);
if (mLocListener == null)
{
mLocListener = new MyLocationListener("GPS",mLock);
mLocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
0, mLocListener);
}
if (mLocListener2 == null)
{
mLocListener2 = new MyLocationListener("NET",mLock);
mLocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0,
0, mLocListener2);
}
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
tm.listen(new CallStateListener(), PhoneStateListener.LISTEN_CALL_STATE);
mLock[0] = mIPSocketThread.lock;
if(!mIPSocketThread.running)
{
mIPSocketThread.running = true;
mIPSocketThread.start();
}
// We want this service to continue running until it is explicitly
// stopped, so return sticky.
return START_STICKY;
}
@SuppressWarnings("deprecation")
@Override
public void onDestroy() {
// Tell the user we stopped.
Toast.makeText(this, "Service Stopped", Toast.LENGTH_SHORT).show();
if (mLocManager != null && mLocListener != null)
{
mLocManager.removeUpdates(mLocListener);
mLocListener = null;
}
if (mLocManager != null && mLocListener2 != null)
{
mLocManager.removeUpdates(mLocListener2);
mLocListener2 = null;
}
mIPSocketThread.running = false;
try {
synchronized(mIPSocketThread.lock)
{
// mIPSocketThread.lock.notify();
}
if (mIPSocketThread.mSocket != null) mIPSocketThread.mSocket.close();
if (mIPSocketThread.mServerSocket != null) mIPSocketThread.mServerSocket.close();
mIPSocketThread.join(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* Listener to detect incoming calls.
*/
private class CallStateListener extends PhoneStateListener {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
switch (state) {
case TelephonyManager.CALL_STATE_RINGING:
// called when someone is ringing to this phone
if (mIPSocketThread.isOpen)
{
try {
mIPSocketThread.out.writeBytes("PHONE:"+incomingNumber+"\n");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
break;
}
}
}
class MyLocationListener implements LocationListener
{
String header;
Object locks[];
public MyLocationListener(String header,Object lock[])
{
this.locks = lock;
this.header = header;
}
@Override
public void onLocationChanged(Location arg0) {
// TODO Auto-generated method stub
String resultTxt = header+": SPD:"+arg0.getSpeed()+"\nLocX:"+arg0.getLongitude()+ "\nLocY:"+arg0.getLatitude()
+ "\nAlt:"+arg0.getAltitude()+"\nAcc:"+arg0.getAccuracy();
if (mIPSocketThread.isOpen)
{
try {
mIPSocketThread.out.writeBytes(resultTxt+"\n");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// processing done hereŽ.
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(ACTION_RESP);
broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT);
broadcastIntent.putExtra(header, resultTxt);
sendBroadcast(broadcastIntent);
}
@Override
public void onProviderDisabled(String arg0) {
// TODO Auto-generated method stub
}
@Override
public void onProviderEnabled(String arg0) {
// TODO Auto-generated method stub
}
@Override
public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
// TODO Auto-generated method stub
}
}
class IPSocketThread extends Thread
{
public Object lock = new Object();
String msg = "";
ServerSocket mServerSocket;
Socket mSocket;
DataOutputStream out = null;
DataInputStream in;
boolean running = false, isOpen = false;
public void run()
{
try {
mServerSocket = new ServerSocket(10025);
mSocket = mServerSocket.accept();
out = new DataOutputStream(mSocket.getOutputStream());
in = new DataInputStream(mSocket.getInputStream());
synchronized(this)
{
isOpen = true;
}
while(running)
{
String resultTxt = in.readLine();
// processing done hereŽ.
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(ACTION_RESP);
broadcastIntent.addCategory(Intent.CATEGORY_DEFAULT);
broadcastIntent.putExtra("SOCK", resultTxt);
sendBroadcast(broadcastIntent);
}
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
// } catch (InterruptedException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
}
out = null;
}
//private void synchronized(IPSocketThread ipSocketThread) {
// TODO Auto-generated method stub
}
protected void onHandleIntent (Intent intent)
{
// Retrieves a map of extended data from the intent.
final Bundle bundle = intent.getExtras();
try {
if (bundle != null) {
final Object[] pdusObj = (Object[]) bundle.get("pdus");
for (int i = 0; i < pdusObj.length; i++) {
SmsMessage currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[i]);
String phoneNumber = currentMessage.getDisplayOriginatingAddress();
String senderNum = phoneNumber;
String message = currentMessage.getDisplayMessageBody();
Log.i("SmsReceiver", "senderNum: "+ senderNum + "; message: " + message);
// Show Alert
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(BluetoothInterfaceService.this,
"senderNum: "+ senderNum + ", message: " + message, duration);
toast.show();
} // end for loop
} // bundle is null
} catch (Exception e) {
Log.e("SmsReceiver", "Exception smsReceiver" +e);
}
}
}
| [
"[email protected]"
] | |
5246f867cf2cf323e6f919a8283260a7ac3cffd1 | ba239793842db1eb1af0ab682e30c52ee47a9b64 | /source/java/mirc/files/FileService.java | 80daecd5b7edb827f95cc7e64df35227bf728a6d | [] | no_license | johnperry/MIRC2 | 8af17ff6f3ef6eb8392dc2d31f91a392573eb33a | 39c3a5a1cffe99f88a2e4caa8a99b9798cd534b0 | refs/heads/master | 2021-08-28T15:47:31.130246 | 2020-08-07T01:52:19 | 2020-08-07T01:52:19 | 1,988,616 | 6 | 4 | null | null | null | null | UTF-8 | Java | false | false | 34,880 | java | /*---------------------------------------------------------------
* Copyright 2010 by the Radiological Society of North America
*
* This source software is released under the terms of the
* RSNA Public License (http://mirc.rsna.org/rsnapubliclicense)
*----------------------------------------------------------------*/
package mirc.files;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Properties;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import org.apache.log4j.Logger;
import org.rsna.servlets.Servlet;
import org.rsna.server.HttpRequest;
import org.rsna.server.HttpResponse;
import org.rsna.server.Path;
import org.rsna.multipart.UploadedFile;
import org.rsna.ctp.Configuration;
import org.rsna.ctp.pipeline.PipelineStage;
import org.rsna.ctp.stdstages.DicomAnonymizer;
import org.rsna.ctp.stdstages.ScriptableDicom;
import org.rsna.ctp.stdstages.anonymizer.dicom.DAScript;
import org.rsna.ctp.stdstages.anonymizer.dicom.DICOMAnonymizer;
import org.rsna.ctp.stdstages.anonymizer.IntegerTable;
import org.rsna.ctp.stdstages.anonymizer.LookupTable;
import org.rsna.ctp.objects.DicomObject;
import mirc.MircConfig;
import mirc.util.*;
import org.rsna.util.*;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
/**
* The top-level class of the MIRC File Cabinet servlet.
* The File Cabinet stores and manages files for users.
* This servlet responds to both HTTP GET and POST.
*/
public class FileService extends Servlet {
static final Logger logger = Logger.getLogger(FileService.class);
static File shared;
static File personal;
FileFilter dirsOnly = new GeneralFileFilter();
String username = "";
/**
* Construct a FileService.
* @param root the root directory of the server.
* @param context the path identifying the servlet.
*/
public FileService(File root, String context) {
super(root, context);
//Override the root supplied by the HttpServer
//with the root of the MIRC plugin.
this.root = MircConfig.getInstance().getRootDirectory();
}
/**
* Static init method to initialize the static variables.
* This method is called by the ServletSelector when the
* servlet is added to the list of servlets by the MIRC
* plugin. At that point, the MircConfig instance has
* been created and is available. This method is only
* called once as the server starts.
*/
public static void init(File root, String context) {
File files = new File( MircConfig.getInstance().getRootDirectory(), context );
shared = new File(files, "Shared");
personal = new File(files, "Personal");
shared.mkdirs();
personal.mkdirs();
}
/**
* Clean up as the server shuts down.
*/
public void destroy() { }
/**
* The servlet method that responds to an HTTP GET and provides
* the user interface to the shared and personal file cabinets.
* @param req the HttpServletRequest provided by the servlet container.
* @param res the HttpServletResponse provided by the servlet container.
* @throws Exception if the servlet cannot handle the request.
*/
public void doGet(HttpRequest req, HttpResponse res) throws Exception {
//Make sure the user is authorized to do this.
if (!req.isFromAuthenticatedUser()) { res.redirect("/query"); return; }
//Okay, the user was authenticated, get the name.
username = req.getUser().getUsername();
Path path = req.getParsedPath();
if (path.length() == 1) {
//This is a GET for the main file cabinet page.
//Get the HTML file from either the disk or the jar.
File files = new File(root, context);
File htmlFile = new File(files, "FileService.html");
String page = FileUtil.getText( FileUtil.getStream(htmlFile, "/files/FileService.html") );
//Put in the parameters
Properties props = new Properties();
props.setProperty("username", username);
props.setProperty("userisadmin", (req.userHasRole("admin") ? "true" : "false"));
String openpath = req.getParameter("openpath", "");
props.setProperty("openpath", openpath);
String suppressHome = req.getParameter("suppressHome", "no");
props.setProperty("suppressHome", suppressHome);
page = StringUtil.replace(page, props);
//Send the page
res.disableCaching();
res.setContentType("html");
res.write(page);
res.send();
return;
}
String function = path.element(1).toLowerCase();
String subfunction = path.element(2).toLowerCase();
if (function.equals("tree")) {
String myrsnaParam = req.getParameter("myrsna", "no");
boolean includeMyRSNA = !myrsnaParam.equals("no");
Document doc = XmlUtil.getDocument();
Element root = doc.createElement("tree");
doc.appendChild(root);
appendDir(root, new File(shared, "Files"), "Shared");
File userDir = new File(personal, username);
userDir = new File(userDir, "Files");
appendDir(root, userDir, "Personal");
if (includeMyRSNA) appendMyRsnaFiles(root, "MyRSNA");
res.disableCaching();
res.setContentType("xml");
res.write( XmlUtil.toString(root) );
res.send();
return;
}
else if (function.equals("mirc")) {
//This is a GET for the contents of a single MIRC file cabinet directory.
Document doc = getDirContentsDoc( new Path( path.subpath(2) ) );
res.disableCaching();
res.setContentType("xml");
res.write( XmlUtil.toString( doc.getDocumentElement() ) );
res.send();
return;
}
else if (function.equals("myrsna") && subfunction.equals("folder/")) {
//This is a GET for the contents of a single myRSNA folder
String nodeID = path.subpath(3).substring(1);
res.disableCaching();
res.setContentType("xml");
try {
Document doc = getMyRsnaDirContentsDoc(nodeID);
res.write( XmlUtil.toString( doc.getDocumentElement() ) );
}
catch (Exception ex) { res.setResponseCode( res.notfound ); }
res.send();
return;
}
else if (function.equals("createfolder")) {
//This a request to create a directory and return the tree of its parent
Path subpath = new Path( path.subpath(2) );
FilePath fp = new FilePath(subpath, username, shared, personal);
fp.filesDir.mkdirs();
fp.iconsDir.mkdirs();
Document doc = XmlUtil.getDocument();
Element root = doc.createElement("tree");
doc.appendChild(root);
File parentDir = fp.filesDir.getParentFile();
appendDir(root, parentDir, parentDir.getName());
res.disableCaching();
res.setContentType("xml");
res.write( XmlUtil.toString(root) );
res.send();
return;
}
else if (function.equals("deletefolder")) {
//This a request to delete a directory and return the tree of its parent
Path subpath = new Path( path.subpath(2) );
FilePath fp = new FilePath(subpath, username, shared, personal);
File parentDir = fp.filesDir.getParentFile();
FileUtil.deleteAll(fp.filesDir);
FileUtil.deleteAll(fp.iconsDir);
Document doc = XmlUtil.getDocument();
Element root = doc.createElement("tree");
doc.appendChild(root);
appendDir(root, parentDir, parentDir.getName());
res.disableCaching();
res.setContentType("xml");
res.write( XmlUtil.toString(root) );
res.send();
return;
}
else if (function.equals("renamefolder")) {
//This a request to rename a directory
Path subpath = new Path( path.subpath(2) );
FilePath fp = new FilePath(subpath, username, shared, personal);
String newname = req.getParameter("newname", "x");
File newFilesDir = new File(fp.filesDir.getParentFile(), newname);
File newIconsDir = new File(fp.iconsDir.getParentFile(), newname);
if (newFilesDir.exists() || newIconsDir.exists()) {
res.write("<notok/>");
}
else {
boolean filesResult = fp.filesDir.renameTo(newFilesDir);
boolean iconsResult = fp.iconsDir.renameTo(newIconsDir);
res.write(
"<ok>\n"
+" <filesResult dir=\""+fp.filesDir+"\">"+filesResult+"</filesResult>\n"
+" <iconsResult dir=\""+fp.iconsDir+"\">"+iconsResult+"</iconsResult>\n"
+"</ok>"
);
}
res.disableCaching();
res.setContentType("xml");
res.send();
return;
}
else if (function.equals("deletefiles")) {
//This a request to delete a list of files from a directory.
//Note: only a response code is returned; the client will make
//another call to get the contents.
Path subpath = new Path( path.subpath(2) );
FilePath fp = new FilePath(subpath, username, shared, personal);
res.setResponseCode( deleteFiles( fp, req.getParameter("list"), req.userHasRole("admin") ) );
res.send();
return;
}
else if (function.equals("renamefile")) {
//This a request to rename a single file.
Path subpath = new Path( path.subpath(2) );
FilePath fp = new FilePath(subpath, username, shared, personal);
res.setResponseCode(
renameFile(
fp, req.getParameter("oldname"), req.getParameter("newname"), req.userHasRole("admin")
)
);
res.disableCaching();
res.setContentType("xml");
res.send();
return;
}
else if (function.equals("copyfiles")) {
//This a request to copy a list of files from one directory to another.
//As in the case of deleteFiles, the client will make another call to
//display whatever directory it wants. Unlike deleteFiles, however, in
//this case the source and destination path information is passed in
//query parameters, along with the list of files.
String sourcePath = req.getParameter("sourcePath");
String destPath = req.getParameter("destPath");
String files = req.getParameter("files");
res.setResponseCode( copyFiles( sourcePath, destPath, files) );
res.disableCaching();
res.setContentType("xml");
res.send();
return;
}
else if (function.equals("exportfiles")) {
//This is a request to export a list of files from a directory as a zip file.
Path subpath = new Path( path.subpath(2) );
FilePath fp = new FilePath(subpath, username, shared, personal);
String list = req.getParameter("list", "");
if (list.trim().equals("")) res.setResponseCode( res.notfound );
else {
String[] docs = list.split("\\|");
if (docs.length > 0) {
File outDir = MircConfig.getInstance().createTempDirectory();
File outFile = new File(outDir, "Export.zip");
if (FileUtil.zipFiles(docs, fp.filesDir, outFile)) {
res.setContentType("zip");
res.setContentDisposition(outFile);
res.write(outFile);
res.send();
}
else {
res.setResponseCode( res.notfound );
res.send();
}
FileUtil.deleteAll(outDir);
return;
}
else res.setResponseCode( res.notfound );
}
res.send();
return;
}
else if (function.equals("save")) {
//This is a request from a MIRCdocument to save its images.
//Put them in a subdirectory of the user's Personal/Files directory.
String docpath = path.subpath(2);
File doc = new File(root, docpath);
File docdir = doc.getParentFile();
//Okay, here is a kludge to try to avoid saving MIRCdocuments
//on top of one another. If a MIRCdocument was created by the
//ZipService, it will be in a directory called {datetime}/n.
//If we just get the parent of the file in the path, then we just get n.
//Let's try to do a little better. If the parent has a short name and
//the grandparent has a long name (for example, "200901011234132/1"),
//then get the grandparent and parent together.
String parentName = docdir.getName();
String grandparentName = docdir.getParentFile().getName();
if ((parentName.length() < 17) && (grandparentName.length() == 17)) {
//Note: datetime names are ALWAYS 17 chars.
parentName = grandparentName + "/" + parentName;
}
String targetDir = "Personal/"+parentName;
Path targetDirPath = new Path(targetDir);
FilePath fp = new FilePath(targetDirPath, username, shared, personal);
saveImages(docpath, fp);
res.redirect("/"+context+"?openpath="+targetDir);
return;
}
else if (function.equals("personal") && subfunction.equals("files")) {
String filePath = path.subpath(2).substring(1);
File file = new File( new File(personal, username), filePath );
returnFile(req, res, file);
return;
}
else if (function.equals("personal") && subfunction.equals("icons")) {
String filePath = path.subpath(2).substring(1);
File file = new File( new File(personal, username), filePath );
res.write(file);
res.setContentType(file);
res.send();
return;
}
else if (function.equals("shared") && subfunction.equals("files")) {
String filePath = path.subpath(2).substring(1);
File file = new File( shared, filePath );
returnFile(req, res, file);
return;
}
else if (function.equals("shared") && subfunction.equals("icons")) {
String filePath = path.subpath(2).substring(1);
File file = new File( shared, filePath );
res.write(file);
res.setContentType(file);
res.send();
return;
}
//This must be a regular file request; handle it in the superclass.
super.doGet(req, res);
}
//Get a file and return it as requested
private void returnFile(HttpRequest req, HttpResponse res, File file) {
boolean isDicomFile = file.getName().toLowerCase().endsWith(".dcm");
if (isDicomFile && req.hasParameter("list")) {
try {
DicomObject dob = new DicomObject(file);
res.write( dob.getElementTablePage( req.userHasRole("admin") ) );
res.setContentType("html");
res.send();
return;
}
catch (Exception justReturnTheFile) { logger.warn("Unable to create the element listing"); }
}
//If we get here, we didn't return a DICOM element listing,
//either because it isn't a DicomObject, a listing wasn't
//requested, or the attempt to list the elements failed.
//In any case, the right thing to do is to return the file.
res.setContentType(file);
if (isDicomFile) res.setContentDisposition(file);
res.write(file);
res.send();
}
/**
* The servlet method that responds to an HTTP POST.
* @param req The HttpRequest provided by the servlet container.
* @param res The HttpResponse provided by the servlet container.
* @throws ServletException if the servlet cannot handle the request.
*/
public void doPost(HttpRequest req, HttpResponse res) throws Exception {
//Make sure the user is authorized to do this.
if (!req.isFromAuthenticatedUser()) { res.redirect("/query"); return; }
//Okay, the user was authenticated, get the name.
username = req.getUser().getUsername();
Path path = req.getParsedPath();
String function = path.element(1).toLowerCase();
//Figure out what kind of POST this is.
String contentType = req.getContentType().toLowerCase();
if (contentType.contains("multipart/form-data")) {
if (function.equals("uploadfile")) {
//This a request to upload a file and return a file cabinet page.
String dirPath = path.subpath(2).substring(1);
Path subpath = new Path( dirPath );
FilePath fp = new FilePath(subpath, username, shared, personal);
uploadFile(req, res, fp);
String ui = req.getParameter("ui", "");
if (ui.equals("integrated")) res.redirect("/query");
else res.redirect("/files?openpath="+dirPath);
return;
}
}
//If we get here, we couldn't service the POST
res.setResponseCode( res.notimplemented );
res.send();
}
private Document getDirContentsDoc(Path path) throws Exception {
FilePath fp = new FilePath(path, username, shared, personal);
File[] files = fp.filesDir.listFiles();
Document doc = XmlUtil.getDocument();
Element root = doc.createElement("dir");
root.setAttribute("title", fp.dirTitle);
doc.appendChild(root);
for (int i=0; i<files.length; i++) {
if (files[i].isFile()) {
Element el = doc.createElement("file");
String name = files[i].getName();
//Figure out whether the icon is a gif or a jpg
String iconName = "";
File iconFile = new File(fp.iconsDir, name+".gif");
if (!iconFile.exists()) iconFile = new File(fp.iconsDir, name+".jpg");
if (iconFile.exists()) iconName = iconFile.getName();
el.setAttribute("fileURL", fp.filesURL + "/" + name);
el.setAttribute("iconURL", fp.iconsURL + "/" + iconName);
el.setAttribute("title", name);
root.appendChild(el);
}
}
return doc;
}
//Add a category node to a tree
private Element appendCategory(Node parent, String title) throws Exception {
Element el = parent.getOwnerDocument().createElement("node");
el.setAttribute("name", title);
parent.appendChild(el);
return el;
}
//Add a directory and its child directories to a tree
private void appendDir(Node parent, File dir, String title) throws Exception {
Element el = parent.getOwnerDocument().createElement("node");
el.setAttribute("name", title);
el.setAttribute("sclickHandler", "showFileDirContents");
parent.appendChild(el);
dir.mkdirs();
File[] files = dir.listFiles(dirsOnly);
for (int i=0; i<files.length; i++) {
appendDir(el, files[i], files[i].getName());
}
}
//Add the user's MyRSNA folders to a tree
private void appendMyRsnaFiles(Element parent, String title) {
MyRsnaSession mrs = MyRsnaSessions.getInstance().getMyRsnaSession(username);
if (mrs != null) {
try {
Element folders = mrs.getMyRSNAFolders();
Element el = parent.getOwnerDocument().createElement("node");
el.setAttribute("name", title);
parent.appendChild(el);
appendMyRsnaFolderDir(el, folders);
}
catch (Exception skipMyRsna) { }
}
}
//Walk a tree of MyRsna folders
private void appendMyRsnaFolderDir(Node parent, Node folders) {
if (folders == null) return;
Node child = folders.getFirstChild();
while (child != null) {
if ((child.getNodeType() == Node.ELEMENT_NODE) && child.getNodeName().equals("folder")) {
Element folder = (Element)child;
Node name = getFirstNamedChild(folder, "name");
if (name != null) {
Element el = parent.getOwnerDocument().createElement("node");
el.setAttribute("name", name.getTextContent().trim());
el.setAttribute("nodeID", folder.getAttribute("id"));
el.setAttribute("sclickHandler", "showMyRsnaDirContents");
parent.appendChild(el);
Node subfolders = getFirstNamedChild(folder, "folders");
if (subfolders != null) appendMyRsnaFolderDir(el, subfolders);
}
}
child = child.getNextSibling();
}
}
//Get the contents of a myRSNA folder
private Document getMyRsnaDirContentsDoc(String nodeID) throws Exception {
//Make the return document
Document doc = XmlUtil.getDocument();
Element root = doc.createElement("dir");
doc.appendChild(root);
//Get the session
MyRsnaSession mrs = MyRsnaSessions.getInstance().getMyRsnaSession(username);
if (mrs != null) {
try {
Element result = mrs.getMyRSNAFiles(null);
//Get the requested folder
Node folder = findMyRsnaFolder(result, nodeID);
if (folder != null) {
//Got it, get the files child
Node files = getFirstNamedChild(folder, "files");
if (files != null) {
//OK, we're there, now put in all the file children
Node child = files.getFirstChild();
while (child != null) {
if ((child.getNodeType() == Node.ELEMENT_NODE) && child.getNodeName().equals("file")) {
appendMyRsnaFile(root, child);
}
child = child.getNextSibling();
}
}
}
}
catch (Exception quit) { }
}
return doc;
}
private void appendMyRsnaFile(Node parent, Node file) {
Element el = parent.getOwnerDocument().createElement("file");
Element eFile = (Element)file;
el.setAttribute("id", eFile.getAttribute("id"));
el.setAttribute("title", getFirstNamedChild(file, "name") .getTextContent().trim());
el.setAttribute("fileURL", getFirstNamedChild(file, "original") .getTextContent().trim());
el.setAttribute("iconURL", getFirstNamedChild(file, "thumbnail").getTextContent().trim());
parent.appendChild(el);
}
private Node findMyRsnaFolder(Node node, String id) {
if (node == null) return null;
if ((node.getNodeType() == Node.ELEMENT_NODE)
&& node.getNodeName().equals("folder")
&& ((Element)node).getAttribute("id").equals(id)) return node;
//If we get here, the current node is not the one we want; look at its children
Node result;
Node child = node.getFirstChild();
while (child != null) {
if ((result=findMyRsnaFolder(child, id)) != null) return result;
child = child.getNextSibling();
}
return null;
}
private Node getFirstNamedChild(Node node, String name) {
Node child = node.getFirstChild();
while (child != null) {
if ((child.getNodeType() == Node.ELEMENT_NODE) && child.getNodeName().equals(name)) return child;
child = child.getNextSibling();
}
return null;
}
// Delete files from the specified directory.
private int deleteFiles(FilePath fp, String list, boolean userIsAdmin) {
//If the delete request is for the shared directory, determine
//whether the user has the admin role and abort if he doesn't.
//if (fp.isShared() && !userIsAdmin) return HttpResponse.forbidden;
//Get the list of document names and verify it.
//Do everything we can, and ignore errors.
if ((list == null) || (list.trim().equals(""))) return HttpResponse.notfound;
String[] docs = list.split("\\|");
for (int i=0; i<docs.length; i++) {
docs[i] = docs[i].replace("../","").trim();
File file = new File(fp.filesDir, docs[i]);
File jpgIcon = new File(fp.iconsDir, docs[i]+".jpg");
File gifIcon = new File(fp.iconsDir, docs[i]+".gif");
file.delete();
jpgIcon.delete();
gifIcon.delete();
}
return HttpResponse.ok;
}
// Rename a file in the specified directory.
private int renameFile(FilePath fp, String oldName, String newName, boolean userIsAdmin) {
//If the delete request is for the shared directory, determine
//whether the user has the admin role and abort if he doesn't.
if (fp.isShared() && !userIsAdmin) return HttpResponse.forbidden;
if ((oldName == null) || (oldName.trim().equals(""))) return HttpResponse.notfound;
if ((newName == null) || (newName.trim().equals(""))) return HttpResponse.notfound;
newName = fixExtension(newName, oldName);
File oldFile = new File(fp.filesDir, oldName);
File oldJpgIcon = new File(fp.iconsDir, oldName+".jpg");
File oldGifIcon = new File(fp.iconsDir, oldName+".gif");
File newFile = new File(fp.filesDir, newName);
File newJpgIcon = new File(fp.iconsDir, newName+".jpg");
File newGifIcon = new File(fp.iconsDir, newName+".gif");
oldFile.renameTo(newFile);
oldJpgIcon.renameTo(newJpgIcon);
oldGifIcon.renameTo(newGifIcon);
return HttpResponse.ok;
}
private String fixExtension(String newName, String oldName) {
//Get the extension on the old filename
String ext = "";
int k = oldName.lastIndexOf(".");
if (k != -1) ext = oldName.substring(k);
//See if the new filename is the same
if (newName.endsWith(ext)) return newName;
//It doesn't. Append the extension to the new filename.
if (newName.endsWith(".")) newName = newName.substring(0, newName.length() - 1);
return newName + ext;
}
// Copy files from one directory to another.
private int copyFiles(String sourcePath, String destPath, String fileList) throws Exception {
//Get the path
if (sourcePath == null) return HttpResponse.notfound;
if (destPath == null) return HttpResponse.notfound;
FilePath src = new FilePath( new Path(sourcePath), username, shared, personal );
if (!src.isShared() && !src.isPersonal()) return HttpResponse.notfound;
FilePath dest = new FilePath(new Path(destPath), username, shared, personal);
if (!dest.isShared() && !dest.isPersonal()) return HttpResponse.notfound;
//Get the list of document names and verify it.
//Do everything we can, and ignore errors.
if ((fileList == null) || (fileList.trim().equals(""))) return HttpResponse.notfound;
String[] files = fileList.split("\\|");
for (String name : files) {
name = name.replace("../", "").trim();
copyFile(src, dest, name);
}
return HttpResponse.ok;
}
//Copy one file
private void copyFile(FilePath src, FilePath dest, String name) {
File destFile = new File(dest.filesDir, name);
File destJpgIcon = new File(dest.iconsDir, name+".jpg");
File destGifIcon = new File(dest.iconsDir, name+".gif");
destFile.delete();
destJpgIcon.delete();
destGifIcon.delete();
File srcFile = new File(src.filesDir, name);
File srcJpgIcon = new File(src.iconsDir, name+".jpg");
File srcGifIcon = new File(src.iconsDir, name+".gif");
FileUtil.copy(srcFile, destFile);
if (srcJpgIcon.exists()) FileUtil.copy(srcJpgIcon, destJpgIcon);
if (srcGifIcon.exists()) FileUtil.copy(srcGifIcon, destGifIcon);
}
// Get a file from a multipart form, store it, and add it to the specified directory
private void uploadFile(HttpRequest req, HttpResponse res, FilePath fp) throws Exception {
MircConfig mc = MircConfig.getInstance();
Element fileService = mc.getFileService();
int maxsize;
try { maxsize = Integer.parseInt( fileService.getAttribute("maxsize") ); }
catch (Exception ex) { maxsize = 75; }
maxsize *= 1024 * 1024;
File dir = MircConfig.getInstance().createTempDirectory();
//Get the submission
LinkedList<UploadedFile> files = req.getParts(dir, maxsize);
boolean anonymize = req.hasParameter("anonymize");
//Note: the UI only allows one file to be uploaded at a time.
//We process all the submitted files here, in case the UI changes
//in the future.
//Also note: if an uploaded file is a zip file, it is possible
//that the submission will result in multiple files being stored,
//because the zip file will be automatically unpacked by the
//saveFile method.
for (UploadedFile file : files) {
File dataFile = file.getFile();
saveFile(fp, dataFile, anonymize); //ignore errors
}
FileUtil.deleteAll(dir);
}
// Put all the images from a MIRCdocument into the file cabinet.
private void saveImages(String path, FilePath fp) throws Exception {
//Get a File pointing to the MIRCdocument
if (path.startsWith("/")) path = path.substring(1);
path = path.replace('/', File.separatorChar);
File docFile = new File(root, path);
File docParent = docFile.getParentFile();
fp.filesDir.mkdirs();
fp.iconsDir.mkdirs();
Document doc = XmlUtil.getDocument(docFile);
Element rootElement = doc.getDocumentElement();
NodeList nodeList = rootElement.getElementsByTagName("image");
for (int i=0; i<nodeList.getLength(); i++) {
File file = getBestImage(docParent, (Element)nodeList.item(i));
if ((file != null) && file.exists()) {
String filename = file.getName();
File target = new File(fp.filesDir, filename);
File targetJPG = new File(fp.iconsDir, filename+".jpg");
File targetGIF = new File(fp.iconsDir, filename+".gif");
//Delete the target if it exists.
target.delete();
targetJPG.delete();
targetGIF.delete();
//Now copy the inFile into the target
if (FileUtil.copy(file, target)) makeIcon(target, fp.iconsDir);
}
}
}
// Find the best image identified by an image element.
private File getBestImage(File docParent, Element image) {
NodeList nodeList = image.getElementsByTagName("alternative-image");
Element e = getImageForRole(nodeList,"original-format");
if (e == null) e = getImageForRole(nodeList,"original-dimensions");
if (e == null) e = image;
String src = e.getAttribute("src");
if ((src == null) || src.trim().equals("") || (src.indexOf("/") != -1))
return null;
return new File(docParent,src);
}
// Find an element with a specific role attribute.
private Element getImageForRole(NodeList nodeList, String role) {
for (int i=0; i<nodeList.getLength(); i++) {
Element e = (Element)nodeList.item(i);
if ((e != null) && e.getAttribute("role").equals(role))
return e;
}
return null;
}
// Make an output File corresponding to an input File, eliminating the
// appendages put on such files by MIRCdocument generators.
private File getTargetFile(File targetDir, File file) {
String name = file.getName();
int k = name.lastIndexOf(".");
if (k == -1) return new File(targetDir, name);
String nameNoExt = name.substring(0,k);
if (nameNoExt.endsWith("_base") ||
nameNoExt.endsWith("_icon") ||
nameNoExt.endsWith("_full")) {
name = nameNoExt.substring(0, nameNoExt.length()-5) + name.substring(k);
}
return new File(targetDir, name);
}
//Store a file in the file cabinet.
// fp: the object identifying the directories to be modified.
// dataFile: the file to store.
// filename: the name under which the file is to be stored.
// anonymize: true if DICOM files are to be anonymized.
// return true if the operation succeeded completely; false otherwise.
private boolean saveFile(
FilePath fp,
File dataFile,
boolean anonymize) {
String filename = dataFile.getName();
if (filename.toLowerCase().endsWith(".zip")) {
boolean ok = unzipFile(fp, dataFile, anonymize);
dataFile.delete();
return ok;
}
else {
File target = new File(fp.filesDir, filename);
//Fix the filename if necessary
target = new File(target.getAbsolutePath());
File parent = target.getParentFile();
String name = target.getName();
name = name.replaceAll("\\s+", "_");
name = name.replace("%20", "_");
target = new File(parent, name);
//Make sure the rename will succeed
deleteTarget(fp, target);
//Now rename the dataFile into the target
if (dataFile.renameTo(target)) {
target = handleDicomObject(target, anonymize);
makeIcon(target, fp.iconsDir);
return true;
}
}
return false;
}
private void deleteTarget(FilePath fp, File target) {
//Delete the target and its icons.
String filename = target.getName();
File targetJPG = new File(fp.iconsDir, filename+".jpg");
File targetGIF = new File(fp.iconsDir, filename+".gif");
target.delete();
targetJPG.delete();
targetGIF.delete();
}
// Unpack a zip submission. Note: this function ignores
// any path information and puts all files in the
// directory pointed to by the FilePath object.
private boolean unzipFile(
FilePath fp,
File inZipFile,
boolean anonymize) {
if (!inZipFile.exists()) return false;
try {
ZipFile zipFile = new ZipFile(inZipFile);
Enumeration zipEntries = zipFile.entries();
while (zipEntries.hasMoreElements()) {
ZipEntry entry = (ZipEntry)zipEntries.nextElement();
String name = entry.getName().replace('/',File.separatorChar);
//name = name.substring(name.lastIndexOf(File.separator)+1); //remove the path information
if (!entry.isDirectory()) {
File outFile = new File(fp.filesDir, name);
File iconDir = (new File(fp.iconsDir, name)).getParentFile();
outFile.getParentFile().mkdirs();
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(outFile));
BufferedInputStream in = new BufferedInputStream(zipFile.getInputStream(entry));
int size = 1024;
int n;
byte[] b = new byte[size];
while ((n = in.read(b,0,size)) != -1) out.write(b,0,n);
in.close();
out.close();
outFile = handleDicomObject(outFile, anonymize);
makeIcon(outFile, iconDir);
}
}
zipFile.close();
return true;
}
catch (Exception e) { return false; }
}
//Check whether a file is a DicomObject, and if so, set its extension
//and handle anonymization if requested.
private static File handleDicomObject(File file, boolean anonymize) {
try {
DicomObject dob = new DicomObject(file);
if (anonymize) {
DicomAnonymizer fsa = MircConfig.getInstance().getFileServiceDicomAnonymizer();
if (fsa != null) {
DAScript dascript = DAScript.getInstance(fsa.getDAScriptFile());
Properties script = dascript.toProperties();
Properties lookup = LookupTable.getProperties(fsa.getLookupTableFile());
IntegerTable intTable = fsa.getIntegerTable();
DICOMAnonymizer.anonymize(file, file, script, lookup, intTable, false, false);
dob = new DicomObject(dob.getFile());
dob.renameToUID();
file = dob.getFile();
}
}
else file = dob.setStandardExtension();
}
catch (Exception ex) { }
return file;
}
/**
* Create and store an icon image for a file.
* Try to load the file as an image.
* If it loads, create a 96-pixel-wide jpeg icon.
* If not, determine whether the file has an icon stored
* in the common directory, and if so, use it.
* If no special icon exists for the file extension,
* create one from the default icon.
* For non-image files, write the name of the target
* near the bottom of the icon.
* @param target the file for which to create the icon image.
* @param iconsDir the directory in which to store the icon image.
* @return the icon image file, or null if the icon image file
* could not be created.
*/
public static File makeIcon(File target, File iconsDir) {
iconsDir.mkdirs();
String name = target.getName();
int k = name.lastIndexOf(".") + 1;
String ext = (k>0) ? name.substring(k).toLowerCase() : "";
try {
ImageObject image = new ImageObject(target);
File iconFile = new File(iconsDir, name+".jpg");
image.saveAsJPEG(iconFile, 0, 96, 0); //(frame 0)
return iconFile;
}
catch (Exception e) {
//It's not an image.
//See if there is an icon for this file
String iconName = ext+".gif";
ImageObject icon = null;
try {
try { icon = new ImageObject("/files/common/"+iconName); }
catch (Exception ex) { icon = new ImageObject("/files/common/default.gif"); }
//Now create an icon specifically for this file
iconName = name+".gif";
File iconFile = new File(iconsDir, iconName);
icon.saveAsIconGIF(iconFile, 96, target.getName());
return iconFile;
}
catch (Exception ex) { }
}
return null;
}
/**
* Get a File pointing to a file in a file cabinet.
* @param path the path to the file cabinet directory
* @param filename the name of the file in the file cabinet.
* @param username the name of the user requesting the file.
* @return a File pointing to the requested file in the file cabinet.
*/
public static File getFile(String path, String filename, String username) {
Path p = new Path(path);
FilePath fp = new FilePath(p, username, shared, personal);
return new File( fp.filesDir, filename );
}
/**
* Get a File pointing to a file cabinet directory.
* @param path the path to the file cabinet directory
* @param username the name of the user requesting the file.
* @return a File pointing to the requested file in the file cabinet.
*/
public static FilePath getFilePath(String path, String username) {
Path p = new Path(path);
return new FilePath(p, username, shared, personal);
}
}
| [
"[email protected]"
] | |
e39f469ab10ad68a2cbe2708457e0b92c98ac1a8 | 1ab27ab74b12453eee4e9608ebacbf4cc55b358e | /utils/JsonSerializer.java | c6ffe8f39ebb27c31132942876b83054aaa65ca0 | [] | no_license | ViktorDimitrov1989/HibernateSpringJPAExample | dc9722eef267bc6030df0984df061fe4fa861492 | 162a0f636f6611fb06e39de7f1b05ffb7aa7c886 | refs/heads/master | 2021-01-23T12:52:55.839114 | 2017-09-06T20:28:41 | 2017-09-06T20:28:41 | 102,655,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package app.utils;
import app.utils.exceptions.SerializeException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException;
import java.util.Date;
@Component(value = "JsonSerializer")
public class JsonSerializer implements Serializer {
private Gson gson;
@Autowired
private FileIO fileIO;
public JsonSerializer() {
gson = new GsonBuilder()
.excludeFieldsWithoutExposeAnnotation()
.setPrettyPrinting()
.serializeNulls()//added
.setDateFormat("yyyy-MM-dd'T'HH:mm:ss")//date format
//.registerTypeAdapter(Date.class, new DateDeserializer())//added
.create();
}
@Override
public <T> void serialize(T obj, String fileName) {
File file = new File(fileName);
String json = gson.toJson(obj);
try {
if(!file.exists()){
//create all directories if not exists
file.getParentFile().mkdirs();
file.createNewFile();
}
this.fileIO.write(json, fileName);
} catch (IOException e) {
throw new SerializeException(json + " was not serialized to " + fileName, e);
}
}
@Override
public <T> T deserialize(Class<T> clazz, String fileName) {
String jsonInput = this.fileIO.read(fileName);
return gson.fromJson(jsonInput, clazz);
}
} | [
"[email protected]"
] | |
5736e00e22b61d979cbbc772a354a28c1e9fba84 | 87bcde1afd828f4a46b92c260ae74ee62b26ae9b | /EjemploMVCProfesor/app/src/main/java/com/example/ernesto/ejemplomvc/Controller.java | 3f95ab4cf671a75c8bda4c0b0e96984e4776364e | [] | no_license | RamiroAg/CursoAndroidFirstApp | 40f7eb27dc2f326d0a41b2c9dac3ae19e7ad3bcc | 0a57c0d5d4270e5b9f24140e033e5233095953f0 | refs/heads/master | 2021-06-06T03:33:31.293091 | 2018-03-12T00:24:48 | 2018-03-12T00:24:48 | 102,532,899 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 591 | java | package com.example.ernesto.ejemplomvc;
import android.view.View;
/**
* Created by ernesto on 12/09/17.
*/
public class Controller implements View.OnClickListener {
private Model model;
private ScreenManager screenm;
public Controller(Model model, ScreenManager screenm)
{
this.model = model;
this.screenm = screenm;
this.screenm.setButtonListener(this);
this.screenm.showNumber(model.getCounter());
}
@Override
public void onClick(View view) {
model.add();
screenm.showNumber(model.getCounter());
}
}
| [
"[email protected]"
] | |
ee94d633be854fa3feae65144831400c7b8bb344 | 80b8e77707ba521b5a81fd651b1e646c90a597a5 | /src/main/java/com/daniel/entity/Person.java | 99ad200407cd18523a9df35c081ef6265ab3ca2e | [] | no_license | DanielSemilleroUAO/personasJavaBackend | 8922e0258cb3936beba9010bb34784a618edbb8f | a38c8aa3c2750da488d827d022a17b684ecd6aeb | refs/heads/master | 2023-07-16T21:44:30.239671 | 2021-08-18T01:43:43 | 2021-08-18T01:43:43 | 397,395,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,585 | java | package com.daniel.entity;
import javax.annotation.Generated;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
@Entity
@Table(name="person")
public class Person{
@Id
@Column(name = "cedula")
private Long cedula;
@Column(name = "nombre")
private String nombre;
@Column(name = "fecha_nacimiento")
private String fechaNacimiento;
@Column(name = "numero_telefono")
private String numeroTelefonico;
@Column(name = "email")
private String email;
@Column(name = "direccion")
private String direccion;
@Column(name = "ciudad")
private String ciudadResidencia;
@Column(name = "profesion")
private String profesion;
@Column(name = "trabajo_actual")
private String trabajoActual;
@Column(name = "ingresos")
private String ingresos;
@Column(name = "egresos")
private String egresos;
@OneToOne
@JoinColumn(name = "id_tarjeta")
private Count count;
public Person() {
// TODO Auto-generated constructor stub
}
public Person(Long cedula, String nombre, String fechaNacimiento, String numeroTelefonico, String email,
String direccion, String ciudadResidencia, String profesion, String trabajoActual, String ingresos,
String egresos, Count count) {
super();
this.cedula = cedula;
this.nombre = nombre;
this.fechaNacimiento = fechaNacimiento;
this.numeroTelefonico = numeroTelefonico;
this.email = email;
this.direccion = direccion;
this.ciudadResidencia = ciudadResidencia;
this.profesion = profesion;
this.trabajoActual = trabajoActual;
this.ingresos = ingresos;
this.egresos = egresos;
this.count = count;
}
public Long getCedula() {
return cedula;
}
public void setCedula(Long cedula) {
this.cedula = cedula;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getFechaNacimiento() {
return fechaNacimiento;
}
public void setFechaNacimiento(String fechaNacimiento) {
this.fechaNacimiento = fechaNacimiento;
}
public String getNumeroTelefonico() {
return numeroTelefonico;
}
public void setNumeroTelefonico(String numeroTelefonico) {
this.numeroTelefonico = numeroTelefonico;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getDireccion() {
return direccion;
}
public void setDireccion(String direccion) {
this.direccion = direccion;
}
public String getCiudadResidencia() {
return ciudadResidencia;
}
public void setCiudadResidencia(String ciudadResidencia) {
this.ciudadResidencia = ciudadResidencia;
}
public String getProfesion() {
return profesion;
}
public void setProfesion(String profesion) {
this.profesion = profesion;
}
public String getTrabajoActual() {
return trabajoActual;
}
public void setTrabajoActual(String trabajoActual) {
this.trabajoActual = trabajoActual;
}
public String getIngresos() {
return ingresos;
}
public void setIngresos(String ingresos) {
this.ingresos = ingresos;
}
public String getEgresos() {
return egresos;
}
public void setEgresos(String egresos) {
this.egresos = egresos;
}
public Count getCount() {
return count;
}
public void setCount(Count count) {
this.count = count;
}
}
| [
"[email protected]"
] | |
89c5a27ac4e6151f77050c3f1ade453706daceb8 | e601962865419fddd538fc50fdd79431a35cf558 | /src/main/java/org/refact4j/test/AssertConditionHandler.java | 0b055253ff6ccef031e6f5c1d29bd0f88cb17d41 | [] | no_license | vdupain/refact4j | 1993e94a7ea12df9fa5bcdbb9798be33df5cd076 | b679fcac58d42bc2beaf491ebc2a8dd0fe7dee9a | refs/heads/master | 2021-10-29T20:20:42.980418 | 2021-10-21T09:58:45 | 2021-10-21T09:58:45 | 3,265,746 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java | package org.refact4j.test;
import org.refact4j.function.UnaryPredicate;
public interface AssertConditionHandler extends UnaryPredicate<Boolean>, AssertionHandler {
Boolean getCondition();
void setCondition(Boolean condition);
}
| [
"[email protected]"
] | |
083e79f550f36d1d235e97c4d268c618a4faf18f | af68b4442b927fe329a91e266f796d0eef188fa2 | /src/www/ybm/it/dos/exam5/Solution03.java | c54c15aefa336959d591729cd37e40d28955928e | [] | no_license | quirinal36/COS-PRO-2nd | d299ef5cce4e262d5b850cdffa180c58dc6434b2 | dfac8c424c47f4464942632d41cfcd0fda539f39 | refs/heads/master | 2023-01-29T08:54:29.754175 | 2020-12-01T12:26:08 | 2020-12-01T12:26:08 | 270,955,084 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 977 | java | package www.ybm.it.dos.exam5;
class Solution03{
public int solution(int speed, int[] cars) {
int answer = 0;
for(int i = 0; i < cars.length; i++) {
if(cars[i] >= speed * 11 / 10 && cars[i] < speed * 12 / 10)
answer += 3;
else if(cars[i] >= @@@ && cars[i] < @@@)
answer += 5;
else if(cars[i] >= @@@)
answer += 7;
}
return answer;
}
// 아래는 테스트케이스 출력을 해보기 위한 main 메소드입니다.
public static void main(String[] args) {
Solution03 sol = new Solution03();
int speed = 100;
int[] cars = {110, 98, 125, 148, 120, 112, 89};
int ret = sol.solution(speed, cars);
// [실행] 버튼을 누르면 출력 값을 볼 수 있습니다.
System.out.println("solution 메소드의 반환 값은 " + ret + " 입니다.");
}
} | [
"[email protected]"
] | |
719c85ee7d05a70956439da9101883564db7cc8b | 0f313e943300a71ebd418bd4a6ab640532049f5d | /singleton/src/test/java/lesson/patten/hungry/HungrySingletonTest.java | 6a4fd5d19c50920791b7b38f2547205df3d18c65 | [] | no_license | Rfruelu/pattern | 03d6339b1ec1454ae6755952c9bf5bd74ee8ad98 | 912de2bfd2a76a143034ba57b083c425f11063ce | refs/heads/master | 2020-05-16T19:26:46.671745 | 2019-04-30T07:39:16 | 2019-04-30T07:39:16 | 183,260,684 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,677 | java | package lesson.patten.hungry;
import org.junit.Test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
/**
*
* @author :lujia
* @date :2019/4/23 23:39
*/
public class HungrySingletonTest {
@Test
public void test(){
HungrySingleton hungrySingleton=HungrySingleton.getInstance();
System.out.println(hungrySingleton);
HungrySingleton instance = HungrySingleton.getInstance();
System.out.println(instance);
boolean b = hungrySingleton == instance;
System.out.println("==:"+b);
}
@Test
public void testSerializable() throws IOException {
HungrySingleton hungrySingleton=HungrySingleton.getInstance();
ObjectOutputStream objectOutputStream=null;
ObjectInputStream objectInputStream=null;
try {
objectOutputStream=new ObjectOutputStream(new FileOutputStream("hungrySingleton"));
objectOutputStream.writeObject(hungrySingleton);
System.out.println(hungrySingleton);
objectInputStream=new ObjectInputStream(new FileInputStream(new File("hungrySingleton")));
HungrySingleton o = (HungrySingleton)objectInputStream.readObject();
System.out.println(o);
System.out.println(hungrySingleton==o);
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}finally {
objectOutputStream.close();
objectInputStream.close();
}
}
}
| [
"[email protected]"
] | |
065c16af0a0073d915f110f7a6edf1abffea689b | c0fa0a9ca522851a38a780c9505373b733a035a9 | /source/iHealthCare/app/src/main/java/com/ase/team22/ihealthcare/NewDiagnosis.java | 5eb44858e6f4a80d9e40170c43066b8f88c41f11 | [] | no_license | Navyasreek/iHealthCare | da2566e9889b220742bae0e7093688c61956d1a7 | b1422bac5c586d420f43380b1bcf9846a1cb342b | refs/heads/master | 2021-01-22T17:28:42.132704 | 2017-03-12T03:42:37 | 2017-03-12T03:42:37 | 85,017,049 | 0 | 0 | null | 2017-03-15T01:57:40 | 2017-03-15T01:57:39 | null | UTF-8 | Java | false | false | 6,328 | java | package com.ase.team22.ihealthcare;
import android.net.Uri;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import com.ase.team22.ihealthcare.helpers.GroupMultipleTypeQuestion;
import com.ase.team22.ihealthcare.helpers.GroupSingleTypeQuestion;
import com.ase.team22.ihealthcare.helpers.SingleTypeQuestion;
import com.ase.team22.ihealthcare.questions.GroupMultiple;
import com.ase.team22.ihealthcare.questions.GroupSingle;
import com.ase.team22.ihealthcare.questions.QuestionInitiatorFragment;
import com.ase.team22.ihealthcare.questions.Single;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import java.util.Timer;
import java.util.TimerTask;
public class NewDiagnosis extends AppCompatActivity
implements Single.OnFragmentInteractionListener,
GroupMultiple.OnFragmentInteractionListener,
GroupSingle.OnFragmentInteractionListener,
QuestionInitiatorFragment.OnFragmentInteractionListener {
private Button nextQuestion;
private ArrayList<Condition> conditions = new ArrayList();
private int identifier;
private Stack<String> mTransactionStack = new Stack<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_new_diagnosis);
nextQuestion = (Button) findViewById(R.id.btn_next);
nextQuestion.setVisibility(View.INVISIBLE);
QuestionInitiatorFragment questionInitiatorFragment = new QuestionInitiatorFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
//transaction.setCustomAnimations(R.anim.slide_out_left, R.anim.slide_in_right);
transaction.add(R.id.fragment_container, questionInitiatorFragment,QuestionInitiatorFragment.tag);
transaction.addToBackStack(null);
transaction.commit();
}
@Override
public void onFragmentInteraction(ArrayList<Condition> conditions,int identifier) {
this.identifier = identifier;
//this is temperory implementation to test navigation and UI rendering
if(identifier == 0){
nextQuestion.setVisibility(View.VISIBLE);
renderSingleQuestionFragment(null);
}
else if(identifier == 1){
enableNextButton();
this.conditions.addAll(conditions);
}
else if(identifier == 2){
enableNextButton();
this.conditions.addAll(conditions);
}
else{
enableNextButton();
this.conditions.addAll(conditions);
}
}
public void enableNextButton(){
nextQuestion.setBackgroundColor(getResources().getColor(R.color.md_blue_600));
nextQuestion.setEnabled(true);
}
public void disableNextButton(){
nextQuestion.setBackgroundColor(getResources().getColor(R.color.md_grey_100));
nextQuestion.setEnabled(false);
}
/*
* Depending on the question type in each API response one of the below methods will be called.
*/
public void renderSingleQuestionFragment(JSONObject object){
Single singleQuestionFragment = Single.newInstance(object);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_right,R.anim.slide_out_left);
transaction.replace(R.id.fragment_container, singleQuestionFragment,Single.tag);
disableNextButton();
transaction.addToBackStack(null);
transaction.commit();
/*getSupportFragmentManager().beginTransaction().hide(getSupportFragmentManager().findFragmentByTag(mTransactionStack.peek())).commit();
Log.i(this.getClass().getName(),"Stack after first peek: "+mTransactionStack);
mTransactionStack.add(Single.tag);
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
getSupportFragmentManager().beginTransaction().remove(getSupportFragmentManager().findFragmentByTag(mTransactionStack.pop())).commit();
Log.i(this.getClass().getName(),"Stack after first pop : "+mTransactionStack);
}
}, 1000);*/
}
public void renderGroupSingleQuestionFragment(JSONObject object){
GroupSingle groupSingleQuestionFragment = GroupSingle.newInstance(object);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_right,R.anim.slide_out_left);
transaction.replace(R.id.fragment_container, groupSingleQuestionFragment,GroupSingle.tag);
disableNextButton();
transaction.addToBackStack(null);
transaction.commit();
}
public void renderGroupMultipleQuestionFragment(JSONObject object){
GroupMultiple groupMultipleQuestionFragment = GroupMultiple.newInstance(object);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_right,R.anim.slide_out_left);
transaction.replace(R.id.fragment_container, groupMultipleQuestionFragment,GroupMultiple.tag);
disableNextButton();
transaction.addToBackStack(null);
transaction.commit();
}
// TODO - all this impelementaion is temporary. render method should be called based on questiontype in returned json object.
public void getNextQuestion(View view){
if(identifier == 1){
GroupSingleTypeQuestion groupSingleTypeQuestion = new GroupSingleTypeQuestion(conditions);
JSONObject obj = groupSingleTypeQuestion.getJsonObject();
renderGroupSingleQuestionFragment(obj);
}
else if(identifier == 2){
GroupMultipleTypeQuestion groupMultipleTypeQuestion = new GroupMultipleTypeQuestion(conditions);
JSONObject obj = groupMultipleTypeQuestion.getJsonObject();
renderGroupMultipleQuestionFragment(obj);
}
else{
}
}
}
| [
"[email protected]"
] | |
6930b6c437d28a5c954ffbcf7f312214f8a32d1a | 67f07ef6ded2ec68c9b4b5bfd5d1b7949b8bf4e7 | /app/src/main/java/com/example/sqlite/DB/NoteHelper.java | 6c200cba8365e7ad79d5fa82235a08ce1dfdd8d0 | [] | no_license | fajar-upn/SQLiteGIT | fe6d8a3e7de4436155b6775295f826f5378e24ce | b29091b0339d9fb7c5a45bfe79de63985eee2730 | refs/heads/master | 2020-12-05T06:50:35.771437 | 2020-01-06T06:35:20 | 2020-01-06T06:35:20 | 232,039,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,139 | java | package com.example.sqlite.DB;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import static android.provider.BaseColumns._ID;
import static com.example.sqlite.DB.DatabaseContract.TABLE_NAME;
public class NoteHelper {
private static final String DATABASE_TABLE = TABLE_NAME;
private static DatabaseHelper dataBaseHelper;
private static NoteHelper INSTANCE;
private static SQLiteDatabase database;
private NoteHelper(Context context) {
dataBaseHelper = new DatabaseHelper(context);
}
public static NoteHelper getInstance(Context context) {
if (INSTANCE == null) {
synchronized (SQLiteOpenHelper.class) {
if (INSTANCE == null) {
INSTANCE = new NoteHelper(context);
}
}
}
return INSTANCE;
}
public void open() throws SQLException {
database = dataBaseHelper.getWritableDatabase();
}
public void close() {
dataBaseHelper.close();
if (database.isOpen())
database.close();
}
public Cursor queryAll() {
return database.query(DATABASE_TABLE,
null,
null,
null,
null,
null,
_ID + " DESC");
}
public Cursor queryById(String id) {
return database.query(DATABASE_TABLE, null
, _ID + " = ?"
, new String[]{id}
, null
, null
, null
, null);
}
public long insert(ContentValues values) {
return database.insert(DATABASE_TABLE, null, values);
}
public int update(String id, ContentValues values) {
return database.update(DATABASE_TABLE, values, _ID + " = ?", new String[]{id});
}
public int deleteById(String id) {
return database.delete(DATABASE_TABLE, _ID + " = ?", new String[]{id});
}
}
| [
"[email protected]@gmail.com"
] | [email protected]@gmail.com |
0b528b6b1dd6ecb5d0bbe30e57ba8fc9605acfb4 | 04403f16adb8fb34bddc91ce98f545e0fb0e982b | /unsagamod/hinasch/mods/unlsaga/item/etc/ItemArmorUnsaga.java | a1c9d2f4422f3ac1ca6094f31bc8462cbe67ef68 | [] | no_license | damofujiki/minecraftmod | 9afde5759f98c42d9d8f7a245d59e7661aebc61c | 9970b384ffba39fb7dfb3ab3492fc8c7ce9785a8 | refs/heads/master | 2021-01-15T13:11:16.071722 | 2014-04-08T16:38:46 | 2014-04-08T16:38:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,337 | java | package hinasch.mods.unlsaga.item.etc;
import hinasch.mods.unlsaga.Unsaga;
import hinasch.mods.unlsaga.client.model.ModelArmorColored;
import hinasch.mods.unlsaga.core.init.MaterialList;
import hinasch.mods.unlsaga.core.init.UnsagaItems;
import hinasch.mods.unlsaga.core.init.UnsagaMaterial;
import hinasch.mods.unlsaga.misc.ability.IGainAbility;
import hinasch.mods.unlsaga.misc.translation.Translation;
import hinasch.mods.unlsaga.misc.util.EnumUnsagaWeapon;
import hinasch.mods.unlsaga.misc.util.HelperUnsagaWeapon;
import hinasch.mods.unlsaga.misc.util.IUnsagaMaterial;
import java.util.List;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
public class ItemArmorUnsaga extends ItemArmor implements IUnsagaMaterial,IGainAbility{
//必要なのかよくわからない
public static int getRenderIndex(UnsagaMaterial mat){
if(mat.isChild){
if(mat.getParentMaterial()==MaterialList.cloth){
return 0;
}
}
if(mat==MaterialList.liveSilk){
return 0;
}
return 1;
}
protected String[] armorTextureFiles;
protected EnumUnsagaWeapon armorType;
protected HelperUnsagaWeapon helper;
protected UnsagaMaterial material;
protected ModelArmorColored modelBiped;
protected int armorTypeInt;
protected String path = Unsaga.domain+":textures/models/armor/";
public ItemArmorUnsaga(int par1, EnumArmorMaterial par2EnumArmorMaterial,
EnumUnsagaWeapon armorType, int armortypeint,UnsagaMaterial material) {
super(par1, par2EnumArmorMaterial, getRenderIndex(material), armortypeint);
this.material = material;
this.armorType = armorType;
this.armorTypeInt = armortypeint;
this.armorTextureFiles = new String[2];
this.armorTextureFiles[0] = path+getArmorTextureFilename(material)+".png";
this.armorTextureFiles[1] = path+getArmorTextureFilename(material)+"2.png";
this.helper = new HelperUnsagaWeapon(material, this.itemIcon, armorType);
if(this.material == MaterialList.crocodileLeather){
modelBiped = new ModelArmorColored(1.001F);
}else{
modelBiped = new ModelArmorColored(1.08F);
}
UnsagaItems.putItemMap(this.itemID, this.armorType.toString()+"."+material.name);
// TODO 自動生成されたコンストラクター・スタブ
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
helper.addInformation(par1ItemStack, par2EntityPlayer, par3List, par4);
}
//染める
@Override
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
{
modelBiped.bipedHead.showModel = armorSlot == 0;
modelBiped.bipedHeadwear.showModel = armorSlot == 0;
modelBiped.bipedBody.showModel = armorSlot == 1;
modelBiped.bipedCloak.showModel = armorSlot == 1;
modelBiped.bipedLeftArm.showModel = armorSlot == 1;
modelBiped.bipedRightArm.showModel = armorSlot == 1;
modelBiped.bipedRightLeg.showModel = (armorSlot == 3)||(armorSlot == 2);
modelBiped.bipedLeftLeg.showModel = (armorSlot == 3)||(armorSlot == 2);
modelBiped.setItemStack(itemStack);
return modelBiped;
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, int layer){
// TODO 自動生成されたメソッド・スタブ
ItemArmorUnsaga armorunsaga = (ItemArmorUnsaga)stack.getItem();
EnumUnsagaWeapon type = armorunsaga.armorType;
UnsagaMaterial mate = HelperUnsagaWeapon.getMaterial(stack);
for(int i=0;i<2;i++){
if(mate.getSpecialArmorTexture(type, 0).isPresent()){
this.armorTextureFiles[i] = path+mate.getSpecialArmorTexture(type, i).get()+".png";
}
}
if(type==EnumUnsagaWeapon.HELMET || type==EnumUnsagaWeapon.BOOTS || type==EnumUnsagaWeapon.ARMOR)
{
return armorTextureFiles[0];
}
if(type==EnumUnsagaWeapon.LEGGINS)
{
return armorTextureFiles[1];
}
Unsaga.debug("Unknown ArmorType???");
return armorTextureFiles[0];
}
public String getArmorTextureFilename(UnsagaMaterial mat){
// if(getRenderIndex(mat)==0 && armorType.equals("boots")){
// return "socks";
// }
return "armor";
}
@Override
public int getColor(ItemStack par1ItemStack)
{
return helper.getColorFromItemStack(par1ItemStack, 0);
}
@Override
public int getColorFromItemStack(ItemStack par1ItemStack, int par2)
{
return helper.getColorFromItemStack(par1ItemStack, par2);
}
@Override
public Icon getIconFromDamageForRenderPass(int par1, int par2)
{
return this.itemIcon;
}
@Override
public String getItemDisplayName(ItemStack par1ItemStack)
{
if(HelperUnsagaWeapon.getMaterial(par1ItemStack).getSpecialName(this.armorType, 0).isPresent()){
if(Translation.isJapanese()){
return HelperUnsagaWeapon.getMaterial(par1ItemStack).getSpecialName(this.armorType, 1).get();
}else{
if(!HelperUnsagaWeapon.getMaterial(par1ItemStack).getSpecialName(this.armorType, 0).get().equals("*")){
return HelperUnsagaWeapon.getMaterial(par1ItemStack).getSpecialName(this.armorType, 0).get();
}
}
}
return super.getItemDisplayName(par1ItemStack);
}
@Override
public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
helper.getSubItems(par1, par2CreativeTabs, par3List);
}
//無理矢理頭にかぶる
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
//int i = EntityLiving.getArmorPosition(par1ItemStack) - 1;
ItemStack itemstack1 = par3EntityPlayer.getCurrentArmor(0);
if(par3EntityPlayer.isSneaking()){
if (itemstack1 == null)
{
par3EntityPlayer.inventory.armorInventory[1] = par1ItemStack.copy();
//par3EntityPlayer.setCurrentItemOrArmor(1, par1ItemStack.copy()); //Forge: Vanilla bug fix associated with fixed setCurrentItemOrArmor indexs for players.
par1ItemStack.stackSize = 0;
}
return par1ItemStack;
}
return super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
if(this.material.getSpecialIcon(this.armorType).isPresent()){
this.itemIcon = par1IconRegister.registerIcon(Unsaga.domain+":"+this.material.getSpecialIcon(armorType).get());
return;
}
this.itemIcon = par1IconRegister.registerIcon(Unsaga.domain+":"+this.armorType);
}
@Override
public boolean requiresMultipleRenderPasses()
{
return false;
}
@Override
public EnumUnsagaWeapon getCategory() {
// TODO 自動生成されたメソッド・スタブ
return this.armorType;
}
@Override
public int getMaxAbility() {
// TODO 自動生成されたメソッド・スタブ
return 2;
}
}
| [
"[email protected]"
] | |
11800012ace6efaf5a5634703214bd03992ad8ef | fb0c760d3eab2a1895b6698a07f4e524c6e23e99 | /shop-web/shop-back-web/src/main/java/com/qf/shop/back/web/controller/BackController.java | 3789cb5fe598dfa4125ad1825f2779261d7d8c4f | [] | no_license | LuoShanHui/myteam-shop | 8157c53d4c403447c3d22895e9ff44f80ee5561b | 3eba4458fca9b2b2ae77ccf38785d9a7a4bff365 | refs/heads/master | 2022-07-10T00:40:02.544266 | 2020-03-20T14:20:44 | 2020-03-20T14:20:44 | 245,993,623 | 1 | 0 | null | 2022-06-21T02:57:00 | 2020-03-09T09:28:50 | CSS | UTF-8 | Java | false | false | 1,834 | java | package com.qf.shop.back.web.controller;
import com.qf.dto.ResultBean;
import com.qf.entity.TProduct;
import com.qf.shop.back.web.service.IBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
/**
* @Author Administrator
* @PACKAGE myteam-shop
*/
@Controller
@RequestMapping("back")
public class BackController {
@Autowired
private IBackService service;
@RequestMapping("index")
public String goBack(){
return "backIndex";
}
@RequestMapping("selectAllProduct")
public String selectAllProduct(Model model) {
ResultBean resultBean = service.selectAllProduct();
List<TProduct> productList = (List<TProduct>) resultBean.getData();
model.addAttribute("productList",productList);
return "productList";
}
@RequestMapping("toAddProduct")
public String toAddProduct(){
return "addProduct";
}
@RequestMapping("add")
public String addProduct(TProduct product) {
System.out.println(service.addProduct(product));
return "backIndex";
}
@RequestMapping("toUpdateProduct")
public String toUpdateProduct(Long pid,Model model){
ResultBean resultBean = service.findProductById(pid);
TProduct product= (TProduct) resultBean.getData();
model.addAttribute("product", product);
return "updateProduct";
}
@RequestMapping("updateProduct")
public ResultBean updateProduct(TProduct product) {
return service.updateProduct(product);
}
@RequestMapping("deleteProduct")
public ResultBean deleteProduct(Long id) {
return service.deleteProduct(id);
}
}
| [
"[email protected]"
] | |
9f8fb03376caa04b08f3ed241897c6f2865ab021 | 26303477746f00b9002c08f2de771c44a0395f8d | /src/aio/AIOClient.java | f4a9a1b3176c6253eeee03aced1b7d9fd11f0064 | [] | no_license | wujiazhong/chat-service | 47b2a0be18644482f11c55178b13e8b9c23148ae | 2c7011058782977a40219bf8f282c6baddd8660d | refs/heads/master | 2020-05-27T14:11:06.605476 | 2019-05-26T07:42:58 | 2019-05-26T07:42:58 | 188,653,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,131 | java | package aio;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousChannelGroup;
import java.nio.channels.AsynchronousSocketChannel;
import java.util.Scanner;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class AIOClient {
private static String DEFAULT_HOST = "127.0.0.1";
private static int DEFAULT_PORT = 7777;
ExecutorService executor = Executors.newFixedThreadPool(1);
AsynchronousSocketChannel aSyncChannel;
public AIOClient() {
// 以指定线程池来创建一个AsynchronousChannelGroup
AsynchronousChannelGroup channelGroup =
null;
try {
channelGroup = AsynchronousChannelGroup.withThreadPool(executor);
aSyncChannel = AsynchronousSocketChannel.open(channelGroup);
aSyncChannel.connect(new InetSocketAddress(DEFAULT_HOST, DEFAULT_PORT)).get();
System.out.println("--- 与服务器连接成功 ---");
} catch (IOException | InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
public void start(){
final ByteBuffer buff = ByteBuffer.allocate(1024);
buff.clear();
aSyncChannel.read(buff, buff, new AIOClientReader(aSyncChannel));
}
//向服务器发送消息
public void sendMsg(String msg) {
ByteBuffer writeBuf = ByteBuffer.wrap(msg.getBytes());
aSyncChannel.write(writeBuf, null, new AIOClientWriter(writeBuf));
}
@SuppressWarnings("resource")
public static void main(String[] args) throws Exception{
AIOClient client = new AIOClient();
client.start();
System.out.println("请输入请求消息:");
Scanner scanner = new Scanner(System.in);
while(scanner.hasNext()) {
String nextLine = scanner.nextLine();
if (nextLine.equals("")) {
continue;
}
client.sendMsg(nextLine);
}
scanner.close();
}
}
| [
"[email protected]"
] | |
1ef5b8028e5b53a4ccc883dba69eac79a75a69fc | 3cd227e25f52423c78862ae1594c9188dddfbabc | /backend/src/main/java/Clinica/backend/model/Consultorio.java | a8047e58b0714d1d1103d18464cf6dba07459367 | [] | no_license | douglasboza/crud-apirest-angular-spring | 7b661f3957c4e893c00e3887689d74f6bd6e2c41 | 0f448d203eb02bafcc047b43dc04be84d6a8eb21 | refs/heads/main | 2023-07-13T03:06:27.578770 | 2021-08-19T02:26:51 | 2021-08-19T02:26:51 | 397,734,795 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,413 | java | package Clinica.backend.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@Entity
@Table(name = "consultorio")
public class Consultorio {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@OneToOne
private Paciente paciente;
@Column(name = "especialidade_medica")
private String especialidadeMedica;
@OneToOne
private Medico medico;
@OneToOne
private Consultorio consultorio;
@Column(name = "data")
private Date data;
public Paciente getPaciente() {
return paciente;
}
public void setPaciente(Paciente paciente) {
this.paciente = paciente;
}
public String getEspecialidadeMedica() {
return especialidadeMedica;
}
public void setEspecialidadeMedica(String especialidadeMedica) {
this.especialidadeMedica = especialidadeMedica;
}
public Medico getMedico() {
return medico;
}
public void setMedico(Medico medico) {
this.medico = medico;
}
public Consultorio getConsultorio() {
return consultorio;
}
public void setConsultorio(Consultorio consultorio) {
this.consultorio = consultorio;
}
public Date getData() {
return data;
}
public void setData(Date data) {
this.data = data;
}
}
| [
"[email protected]"
] | |
b75a36494a763457d5a01acae9c15ce646b73448 | e372bd92d852054629819b5af786689beb27ee03 | /src/main/java/com/tensquare/articlecrawler/mapper/ArticleRepository.java | 0b46850c617588d1fd055178eef33e257b345a73 | [] | no_license | saylong/article_crawler | b130a8e1754929040f7876e7f3f3134f83ed7c0b | 57d7a1fd5f045822493cfc1f9276c520bc4f5c39 | refs/heads/master | 2023-01-09T15:57:40.730348 | 2020-11-09T10:31:01 | 2020-11-09T10:31:01 | 311,244,100 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 303 | java | package com.tensquare.articlecrawler.mapper;
import com.tensquare.articlecrawler.dao.Article;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
/**
* @author lsl
* @date 2020/11/9
*/
@Repository
public interface ArticleRepository extends Mapper<Article> {
}
| [
"sailong.li@meinergy"
] | sailong.li@meinergy |
4df559f978c90e24961cdda3caee709e4907f68b | ebbb8f3835d4ca677d4826f6ff3038adf72bcdf9 | /java-tetris/Tetris/src/co/cz/tetris/model/Board.java | 1f3f4cd8230b5c75c984505d54cba2cb474c83b6 | [] | no_license | gaguevaras/java-tetris | b9bc9d4b3041936d4e2df57234874a2cd1c5e469 | b19acca05ca684867c0d5b6d079bee46bce75db2 | refs/heads/master | 2020-04-10T19:06:59.025712 | 2015-09-05T15:06:37 | 2015-09-05T15:06:37 | 7,295,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,219 | java | package co.cz.tetris.model;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.Timer;
import co.cz.tetris.view.Shape;
import co.cz.tetris.view.Tetris;
import co.cz.tetris.view.Shape.Tetrominoes;
public class Board extends JPanel implements ActionListener {
final int BoardWidth = 10;
final int BoardHeight = 22;
Timer timer;
boolean isFallingFinished = false;
boolean isStarted = false;
boolean isPaused = false;
int numLinesRemoved = 0;
int curX = 0;
int curY = 0;
JLabel statusBar;
Shape curPiece;
Tetrominoes[] board;
public Board(Tetris tetris) {
setFocusable(true);
curPiece = new Shape();
timer = new Timer(400, this);
timer.start();
statusBar = tetris.getStatusBar();
board = new Tetrominoes[BoardWidth * BoardHeight];
addKeyListener(new TAdapter());
clearBoard();
}
private void clearBoard() {
for (int i = 0; i < BoardHeight * BoardWidth; ++i)
board[i] = Tetrominoes.NoShape;
}
public void start() {
if (isPaused) {
return;
}
isStarted = true;
isFallingFinished = false;
numLinesRemoved = 0;
clearBoard();
newPiece();
timer.start();
}
private void pause() {
if (!isStarted)
return;
isPaused = !isPaused;
if (isPaused) {
timer.stop();
statusBar.setText("paused");
} else {
timer.start();
statusBar.setText(String.valueOf(numLinesRemoved));
}
repaint();
}
public void paint(Graphics g) {
super.paint(g);
Dimension size = getSize();
int boardTop = (int) size.getHeight() - BoardHeight * squareHeight();
for (int i = 0; i < BoardHeight; ++i) {
for (int j = 0; j < BoardWidth; ++j) {
Tetrominoes shape = shapeAt(j, BoardHeight - i - 1);
if (shape != Tetrominoes.NoShape) {
drawSquare(g, 0 + j * squareWidth(), boardTop + i
* squareHeight(), shape);
}
}
}
if (curPiece.getShape() != Tetrominoes.NoShape) {
for (int i = 0; i < 4; ++i) {
int x = curX + curPiece.x(i);
int y = curY - curPiece.y(i);
drawSquare(g, 0 + x * squareWidth(), boardTop
+ (BoardHeight - y - 1) * squareHeight(),
curPiece.getShape());
}
}
}
private void dropDown() {
int newY = curY;
while (newY > 0) {
if (!tryMove(curPiece, curX, newY - 1))
break;
--newY;
}
pieceDropped();
}
private void oneLineDown() {
if (!tryMove(curPiece, curX, curY - 1))
pieceDropped();
}
private void pieceDropped() {
for (int i = 0; i < 4; ++i) {
int x = curX + curPiece.x(i);
int y = curY - curPiece.y(i);
board[(y * BoardWidth) + x] = curPiece.getShape();
}
removeFullLines();
if (!isFallingFinished)
newPiece();
}
private void removeFullLines() {
int numFullLines = 0;
for (int i = BoardHeight - 1; i >= 0; --i) {
boolean lineIsFull = true;
for (int j = 0; j < BoardWidth; ++j) {
if (shapeAt(j, i) == Tetrominoes.NoShape) {
lineIsFull = false;
break;
}
}
if (lineIsFull) {
++numFullLines;
for (int k = i; k < BoardHeight - 1; ++k) {
for (int j = 0; j < BoardWidth; ++j) {
board[(k * BoardWidth) + j] = shapeAt(j, k + 1);
}
}
}
}
if (numFullLines > 0) {
numLinesRemoved += numFullLines;
statusBar.setText(String.valueOf(numLinesRemoved));
isFallingFinished = true;
curPiece.setShape(Tetrominoes.NoShape);
repaint();
}
}
private boolean tryMove(Shape newPiece, int newX, int newY) {
for (int i = 0; i < 4; ++i) {
int x = newX + newPiece.x(i);
int y = newY - newPiece.y(i);
if (x < 0 || x >= BoardWidth || y < 0 || y >= BoardHeight)
return false;
if (shapeAt(x, y) != Tetrominoes.NoShape)
return false;
}
curPiece = newPiece;
curX = newX;
curY = newY;
repaint();
return true;
}
private void drawSquare(Graphics g, int x, int y, Tetrominoes shape) {
Color colors[] = { new Color(0, 0, 0), new Color(204, 102, 102),
new Color(102, 204, 102), new Color(102, 102, 204),
new Color(204, 204, 102), new Color(204, 102, 204),
new Color(102, 204, 204), new Color(218, 170, 0) };
Color color = colors[shape.ordinal()];
g.setColor(color);
g.fillRect(x + 1, y + 1, squareWidth() - 2, squareHeight() - 2);
g.setColor(color.brighter());
g.drawLine(x, y + squareHeight() - 1, x, y);
g.drawLine(x, y, x + squareWidth() - 1, y);
g.setColor(color.darker());
g.drawLine(x + 1, y + squareHeight() - 1, x + squareWidth() - 1, y
+ squareHeight() - 1);
g.drawLine(x + squareWidth() - 1, y + squareHeight() - 1, x
+ squareWidth() - 1, y + 1);
}
public void actionPerformed(ActionEvent e) {
if (isFallingFinished) {
isFallingFinished = false;
newPiece();
} else {
oneLineDown();
}
}
int squareWidth() {
return (int) getSize().getWidth() / BoardWidth;
}
int squareHeight() {
return (int) getSize().getHeight() / BoardHeight;
}
Tetrominoes shapeAt(int x, int y) {
return board[(y * BoardWidth) + x];
}
private void newPiece() {
curPiece.setRandomShape();
curX = BoardWidth / 2 + 1;
curY = BoardHeight - 1 + curPiece.minY();
if (!tryMove(curPiece, curX, curY)) {
curPiece.setShape(Tetrominoes.NoShape);
timer.stop();
isStarted = false;
statusBar.setText("Game Over!!!");
}
}
class TAdapter extends KeyAdapter {
public void keyPressed(KeyEvent e) {
if (!isStarted || curPiece.getShape() == Tetrominoes.NoShape) {
return;
}
int keycode = e.getKeyCode();
if (keycode == 'p' || keycode == 'P') {
pause();
return;
}
if (isPaused)
return;
switch (keycode) {
case KeyEvent.VK_LEFT:
tryMove(curPiece, curX - 1, curY);
break;
case KeyEvent.VK_RIGHT:
tryMove(curPiece, curX + 1, curY);
break;
case KeyEvent.VK_DOWN:
tryMove(curPiece.rotateRight(), curX, curY);
break;
case KeyEvent.VK_UP:
tryMove(curPiece.rotateLeft(), curX, curY);
break;
case KeyEvent.VK_SPACE:
dropDown();
break;
case 'd':
oneLineDown();
break;
case 'D':
oneLineDown();
break;
}
}
}
}
| [
"[email protected]"
] | |
0c98391aeb2186481871ac6b45d9cdc2f4af91df | c56714c16207c9fe402c07da17b43c3a76593b79 | /Frontend/Android files/main/java/nest/angel/smd/angelnest/data/network/Constants.java | 73cefd04fb37def98c26b2e58b2c827127dd0713 | [] | no_license | abdkhan01/Life360 | 31cce62d3f0b5174ae686a1f8ae02c0044fcdba6 | ca43cb4ef109c6dbe64f663cca03e449df7e5271 | refs/heads/master | 2020-05-16T13:34:04.671273 | 2019-07-24T10:51:29 | 2019-07-24T10:51:29 | 183,078,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java | package nest.angel.smd.angelnest.data.network;
public class Constants {
public static String AppPreferences = "AngelNest";
}
| [
"[email protected]"
] | |
07def2ff5649708dc2334fe8d4c7f3d344eec054 | 1c938fd6453c91ea76fe6926e533f3ddc2255089 | /Unit5/Lab04/Driver04.java | 9f134d41eccc1c4d94aed5d09c9c6a1727b23d5d | [] | no_license | 20awl00/MyLabs | 571e88c3715d60394cfee72d41f4f03264a101a0 | d1f5167e8b1a10af7f878a518bbbea6a152f2e05 | refs/heads/master | 2016-09-06T14:16:08.102234 | 2015-08-06T17:16:10 | 2015-08-06T17:16:10 | 39,632,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,804 | java | //Name______________________________ Date_____________
import java.io.*; //the File class
import java.util.*; //the Scanner class
public class Driver04
{
public static void main(String[] args) throws Exception
{
Comparable[] array = input("data.txt");
sort(array);
output(array, "output.txt");
}
public static Comparable[] input(String filename) throws Exception
{
Scanner infile = new Scanner( new File(filename) );
int numitems = infile.nextInt();
Comparable[] array = new Weight[numitems];
for(int k = 0; k < numitems; k++)
{
Weight a = new Weight();
a.setPounds(infile.nextInt());
a.setOunces(infile.nextInt());
array[k] = a;
}
infile.close();
return array;
}
public static void output(Object[]array, String filename) throws Exception
{
System.setOut(new PrintStream(new FileOutputStream(filename)));
for(int k = 0; k < array.length; k++)
System.out.println(array[k].toString());
}
public static void sort(Comparable[] array)
{
int maxPos;
for(int k = 0; k < array.length; k++)
{
maxPos = findMax(array, array.length - k);
swap(array, maxPos, array.length - k - 1);
}
}
public static void swap(Comparable[] array, int a, int b)
{
Comparable temp = array[a];
array[a] = array[b];
array[b] = temp;
}
public static int findMax(Comparable[] array, int upper)
{
Comparable max = array[0];
int maxIndex = 0;
for(int index = 0; index < upper; index++)
{
if(array[index].compareTo(max) > 0)
{
maxIndex = index;
max = array[index];
}
}
return maxIndex;
}
} | [
"[email protected]"
] | |
e036a707476529230fea09f3c7d1ca524b55928a | 2c6a3d4d9da8170e67a0285e574f1beced13b6d9 | /剑指offer/src/Q16_翻转链表/ReverseLinkedList.java | 375efee05402da3dbfdad7260bc229679921ef6e | [] | no_license | zhengruyi/PracticingCode | 08b80455d4df7041565b87b9fbff33c5b34c1e0e | 0a2c5a33d487c9e2588d7956d46a578cf4716374 | refs/heads/master | 2023-04-12T12:32:20.192159 | 2021-04-25T14:38:19 | 2021-04-25T14:38:19 | 302,980,051 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,352 | java | package Q16_翻转链表;
/**
* @author Ruyi ZHENG
* @version 1.00
* @time 23/04/2020 22:57
**/
public class ReverseLinkedList {
public static Node reverse(Node head) {
print(head);
if (head == null)
return null;
else if (head.next == null)
return head;
else {
Node front = head;
Node mid = head.next;
Node back = mid.next;
front.next = null;
while (mid != null) {
mid.next = front;
front = mid;
mid = back;
if(back != null)
back = back.next;
}
print(front);
return front;
}
}
public static void print(Node head) {
while (head != null) {
System.out.print(head.value);
head = head.next;
}
System.out.println();
}
public static void main(String[] args) {
Node n4 = new Node(4, null);
Node n3 = new Node(3, n4);
Node n2 = new Node(2, n3);
Node n1 = new Node(1, n2);
reverse(n1);
reverse(n1);
reverse(null);
}
}
class Node {
public Node next;
public int value;
public Node(int value, Node next) {
this.next = next;
this.value = value;
}
}
| [
"[email protected]"
] | |
76dbfa5efabd2fb292007f0da8dfd1317bdf5ba5 | 520a8769955c8fe2450309389c4fbfcaede6d035 | /src/main/java/edu/fatec/Application.java | 3862f89a057a98bf1214707272302e43cd8d0f06 | [] | no_license | KelvinVCosta/labEngSoftware | f0cb442b4c546b72f89e9908cc4d720cd7ddcbeb | ec59ec020eb9e7822e2455181c89e937e4512888 | refs/heads/master | 2020-04-22T17:22:31.769052 | 2019-02-28T17:37:04 | 2019-02-28T17:37:04 | 170,539,067 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 341 | java | package edu.fatec;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
* @author KelvinVicenteCosta
*/
@SpringBootApplication
public class Application{
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"[email protected]"
] | |
eb8866d4b30ea95ebe285bcd62953ce75822be98 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/jdbi/learning/3220/ColonPrefixSqlParser.java | 282f78a90aafa86dfb995d3e7cfba092fa2245fa | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,310 | java | /*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jdbi.v3.core.statement;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import org.antlr.runtime.ANTLRStringStream;
import org.antlr.runtime.Token;
import org.jdbi.v3.core.internal.lexer.ColonStatementLexer;
import static org.jdbi.v3.core.internal.lexer.ColonStatementLexer.COMMENT;
import static org.jdbi.v3.core.internal.lexer.ColonStatementLexer.DOUBLE_QUOTED_TEXT;
import static org.jdbi.v3.core.internal.lexer.ColonStatementLexer.EOF;
import static org.jdbi.v3.core.internal.lexer.ColonStatementLexer.ESCAPED_TEXT;
import static org.jdbi.v3.core.internal.lexer.ColonStatementLexer.LITERAL;
import static org.jdbi.v3.core.internal.lexer.ColonStatementLexer.NAMED_PARAM;
import static org.jdbi.v3.core.internal.lexer.ColonStatementLexer.POSITIONAL_PARAM;
import static org.jdbi.v3.core.internal.lexer.ColonStatementLexer.QUOTED_TEXT;
/**
* SQL parser which recognizes named parameter tokens of the form
* <code>:tokenName</code>
* <p>
* This is the default SQL parser
* </p>
*/
public class ColonPrefixSqlParser implements SqlParser {
private final Map<String, ParsedSql> cache = Collections.synchronizedMap(new WeakHashMap<>());
@Override
public ParsedSql parse(String sql, StatementContext ctx) {
try {
return cache.computeIfAbsent(sql, this::internalParse);
} catch (IllegalArgumentException e) {
throw new UnableToCreateStatementException("Exception parsing for named parameter replacement", e, ctx);
}
}
@Override
public String nameParameter(String rawName, StatementContext ctx) {
return ":" + rawName;
}
private ParsedSql internalParse(String sql) throws IllegalArgumentException {
ParsedSql.Builder parsedSql = ParsedSql.builder();
ColonStatementLexer lexer = new ColonStatementLexer(new ANTLRStringStream(sql ));
Token t = lexer.nextToken();
while (t.getType() != EOF) {
switch (t.getType()) {
case COMMENT:
case LITERAL:
case QUOTED_TEXT:
case DOUBLE_QUOTED_TEXT:
parsedSql.append(t.getText());
break;
case NAMED_PARAM:
parsedSql.appendNamedParameter(t.getText().substring(1));
break;
case POSITIONAL_PARAM:
parsedSql.appendPositionalParameter();
break;
case ESCAPED_TEXT:
parsedSql.append(t.getText().substring(1));
break;
default:
break;
}
t = lexer.nextToken();
}
return parsedSql.build();
}
}
| [
"[email protected]"
] | |
46da40cd34e4bd7dec3c5851c98baf8d1b20c9a6 | 815d640f58bd19a8e1cf93b1beecb707fbd326b1 | /spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/mapping/event/ApplicationContextEventTests.java | 3ce8502f964668b0cdba6534405ca3e5f7795eef | [] | no_license | smipo/spring-data-mongodb-2.1.18.RELEASE | 5ebc35841039e4135ade81b7f05490c76f716354 | 36b32e7f67e7d31caea6d3169da902934821cbb5 | refs/heads/main | 2023-05-03T08:06:58.949879 | 2021-05-08T11:01:30 | 2021-05-08T11:01:30 | 365,442,705 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,207 | java | /*
* Copyright 2011-2020 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.mongodb.core.mapping.event;
import static org.assertj.core.api.Assertions.*;
import static org.springframework.data.mongodb.core.DocumentTestUtils.*;
import static org.springframework.data.mongodb.core.query.Criteria.*;
import static org.springframework.data.mongodb.core.query.Query.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.PersonPojoStringId;
import org.springframework.data.mongodb.repository.Person;
import org.springframework.data.mongodb.repository.QPerson;
import org.springframework.data.mongodb.repository.query.MongoEntityInformation;
import org.springframework.data.mongodb.repository.support.MongoRepositoryFactory;
import org.springframework.data.mongodb.repository.support.QuerydslMongoPredicateExecutor;
import com.mongodb.MongoClient;
import com.mongodb.WriteConcern;
import com.mongodb.client.MongoDatabase;
/**
* Integration test for Mapping Events.
*
* @author Mark Pollack
* @author Christoph Strobl
* @author Jordi Llach
* @author Mark Paluch
*/
public class ApplicationContextEventTests {
private static final String COLLECTION_NAME = "personPojoStringId";
private static final String ROOT_COLLECTION_NAME = "root";
private static final String RELATED_COLLECTION_NAME = "related";
private final String[] collectionsToDrop = new String[] { COLLECTION_NAME, ROOT_COLLECTION_NAME,
RELATED_COLLECTION_NAME };
private static MongoClient mongo;
private ApplicationContext applicationContext;
private MongoTemplate template;
private SimpleMappingEventListener listener;
@BeforeClass
public static void beforeClass() {
mongo = new MongoClient();
}
@AfterClass
public static void afterClass() {
mongo.close();
}
@Before
public void setUp() {
cleanDb();
applicationContext = new AnnotationConfigApplicationContext(ApplicationContextEventTestsAppConfig.class);
template = applicationContext.getBean(MongoTemplate.class);
template.setWriteConcern(WriteConcern.FSYNC_SAFE);
listener = applicationContext.getBean(SimpleMappingEventListener.class);
}
@After
public void cleanUp() {
cleanDb();
}
private void cleanDb() {
MongoDatabase db = mongo.getDatabase("database");
for (String coll : collectionsToDrop) {
db.getCollection(coll).drop();
}
}
@Test
@SuppressWarnings("unchecked")
public void beforeSaveEvent() {
PersonBeforeSaveListener personBeforeSaveListener = applicationContext.getBean(PersonBeforeSaveListener.class);
AfterSaveListener afterSaveListener = applicationContext.getBean(AfterSaveListener.class);
assertThat(personBeforeSaveListener.seenEvents).isEmpty();
assertThat(afterSaveListener.seenEvents).isEmpty();
assertThat(listener.onBeforeSaveEvents).isEmpty();
assertThat(listener.onAfterSaveEvents).isEmpty();
PersonPojoStringId p = new PersonPojoStringId("1", "Text");
template.insert(p);
assertThat(personBeforeSaveListener.seenEvents).hasSize(1);
assertThat(afterSaveListener.seenEvents).hasSize(1);
assertThat(listener.onBeforeSaveEvents).hasSize(1);
assertThat(listener.onAfterSaveEvents).hasSize(1);
assertThat(listener.onBeforeSaveEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
assertThat(listener.onAfterSaveEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
Assert.assertTrue(personBeforeSaveListener.seenEvents.get(0) instanceof BeforeSaveEvent<?>);
Assert.assertTrue(afterSaveListener.seenEvents.get(0) instanceof AfterSaveEvent<?>);
BeforeSaveEvent<PersonPojoStringId> beforeSaveEvent = (BeforeSaveEvent<PersonPojoStringId>) personBeforeSaveListener.seenEvents
.get(0);
PersonPojoStringId p2 = beforeSaveEvent.getSource();
org.bson.Document document = beforeSaveEvent.getDocument();
comparePersonAndDocument(p, p2, document);
AfterSaveEvent<Object> afterSaveEvent = (AfterSaveEvent<Object>) afterSaveListener.seenEvents.get(0);
Assert.assertTrue(afterSaveEvent.getSource() instanceof PersonPojoStringId);
p2 = (PersonPojoStringId) afterSaveEvent.getSource();
document = beforeSaveEvent.getDocument();
comparePersonAndDocument(p, p2, document);
}
@Test // DATAMONGO-1256
public void loadAndConvertEvents() {
PersonPojoStringId entity = new PersonPojoStringId("1", "Text");
template.insert(entity);
template.findOne(query(where("id").is(entity.getId())), PersonPojoStringId.class);
assertThat(listener.onAfterLoadEvents).hasSize(1);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
assertThat(listener.onBeforeConvertEvents).hasSize(1);
assertThat(listener.onBeforeConvertEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(1);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
}
@Test // DATAMONGO-1256
public void loadEventsOnAggregation() {
template.insert(new PersonPojoStringId("1", "Text"));
template.aggregate(Aggregation.newAggregation(Aggregation.project("text")), PersonPojoStringId.class,
PersonPojoStringId.class);
assertThat(listener.onAfterLoadEvents).hasSize(1);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
assertThat(listener.onBeforeConvertEvents).hasSize(1);
assertThat(listener.onBeforeConvertEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(1);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
}
@Test // DATAMONGO-1256
public void deleteEvents() {
PersonPojoStringId entity = new PersonPojoStringId("1", "Text");
template.insert(entity);
template.remove(entity);
assertThat(listener.onBeforeDeleteEvents).hasSize(1);
assertThat(listener.onBeforeDeleteEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
assertThat(listener.onAfterDeleteEvents).hasSize(1);
assertThat(listener.onAfterDeleteEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
}
@Test // DATAMONGO-1271
public void publishesAfterLoadAndAfterConvertEventsForDBRef() {
Related ref1 = new Related(2L, "related desc1");
template.insert(ref1);
Root source = new Root();
source.id = 1L;
source.reference = ref1;
template.insert(source);
template.findOne(query(where("id").is(source.getId())), Root.class);
assertThat(listener.onAfterLoadEvents).hasSize(2);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
assertThat(listener.onAfterLoadEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(2);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents.get(1).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
}
@Test // DATAMONGO-1271
public void publishesAfterLoadAndAfterConvertEventsForLazyLoadingDBRef() {
Related ref1 = new Related(2L, "related desc1");
template.insert(ref1);
Root source = new Root();
source.id = 1L;
source.lazyReference = ref1;
template.insert(source);
Root target = template.findOne(query(where("id").is(source.getId())), Root.class);
assertThat(listener.onAfterLoadEvents).hasSize(1);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(1);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
target.getLazyReference().getDescription();
assertThat(listener.onAfterLoadEvents).hasSize(2);
assertThat(listener.onAfterLoadEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(2);
assertThat(listener.onAfterConvertEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
}
@Test // DATAMONGO-1271
public void publishesAfterLoadAndAfterConvertEventsForListOfDBRef() {
List<Related> references = Arrays.asList(new Related(20L, "ref 1"), new Related(30L, "ref 2"));
template.insert(references, Related.class);
Root source = new Root();
source.id = 1L;
source.listOfReferences = references;
template.insert(source);
template.findOne(query(where("id").is(source.getId())), Root.class);
assertThat(listener.onAfterLoadEvents).hasSize(3);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
assertThat(listener.onAfterLoadEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterLoadEvents.get(2).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(3);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents.get(2).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
}
@Test // DATAMONGO-1271
public void publishesAfterLoadAndAfterConvertEventsForLazyLoadingListOfDBRef() {
List<Related> references = Arrays.asList(new Related(20L, "ref 1"), new Related(30L, "ref 2"));
template.insert(references, Related.class);
Root source = new Root();
source.id = 1L;
source.lazyListOfReferences = references;
template.insert(source);
Root target = template.findOne(query(where("id").is(source.getId())), Root.class);
assertThat(listener.onAfterLoadEvents).hasSize(1);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(1);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
target.getLazyListOfReferences().size();
assertThat(listener.onAfterLoadEvents).hasSize(3);
assertThat(listener.onAfterConvertEvents).hasSize(3);
assertThat(listener.onAfterLoadEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterLoadEvents.get(2).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents.get(2).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
}
@Test // DATAMONGO-1271
public void publishesAfterLoadAndAfterConvertEventsForMapOfDBRef() {
Map<String, Related> references = new LinkedHashMap<String, Related>();
references.put("ref-1", new Related(20L, "ref 1"));
references.put("ref-2", new Related(30L, "ref 2"));
template.insert(references.values(), Related.class);
Root source = new Root();
source.id = 1L;
source.mapOfReferences = references;
template.insert(source);
template.findOne(query(where("id").is(source.getId())), Root.class);
assertThat(listener.onAfterLoadEvents).hasSize(3);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
assertThat(listener.onAfterLoadEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterLoadEvents.get(2).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(3);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents.get(2).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
}
@Test // DATAMONGO-1271
public void publishesAfterLoadAndAfterConvertEventsForLazyLoadingMapOfDBRef() {
Map<String, Related> references = new LinkedHashMap<String, Related>();
references.put("ref-1", new Related(20L, "ref 1"));
references.put("ref-2", new Related(30L, "ref 2"));
template.insert(references.values(), Related.class);
Root source = new Root();
source.id = 1L;
source.lazyMapOfReferences = references;
template.insert(source);
Root target = template.findOne(query(where("id").is(source.getId())), Root.class);
assertThat(listener.onAfterLoadEvents).hasSize(1);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(1);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(ROOT_COLLECTION_NAME);
target.getLazyMapOfReferences().size();
assertThat(listener.onAfterLoadEvents).hasSize(3);
assertThat(listener.onAfterLoadEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterLoadEvents.get(2).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(3);
assertThat(listener.onAfterConvertEvents.get(1).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents.get(2).getCollectionName()).isEqualTo(RELATED_COLLECTION_NAME);
}
@Test // DATAMONGO-1823
public void publishesAfterConvertEventForFindQueriesUsingProjections() {
PersonPojoStringId entity = new PersonPojoStringId("1", "Text");
template.insert(entity);
template.query(PersonPojoStringId.class).matching(query(where("id").is(entity.getId()))).all();
assertThat(listener.onAfterLoadEvents).hasSize(1);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
assertThat(listener.onBeforeConvertEvents).hasSize(1);
assertThat(listener.onBeforeConvertEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
assertThat(listener.onAfterConvertEvents).hasSize(1);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo(COLLECTION_NAME);
}
@Test // DATAMONGO-700, DATAMONGO-1185, DATAMONGO-1848
public void publishesEventsForQuerydslFindQueries() {
template.dropCollection(Person.class);
template.save(new Person("Boba", "Fett", 40));
MongoRepositoryFactory factory = new MongoRepositoryFactory(template);
MongoEntityInformation<Person, String> entityInformation = factory.getEntityInformation(Person.class);
QuerydslMongoPredicateExecutor executor = new QuerydslMongoPredicateExecutor<>(entityInformation, template);
executor.findOne(QPerson.person.lastname.startsWith("Fe"));
assertThat(listener.onAfterLoadEvents).hasSize(1);
assertThat(listener.onAfterLoadEvents.get(0).getCollectionName()).isEqualTo("person");
assertThat(listener.onBeforeConvertEvents).hasSize(1);
assertThat(listener.onBeforeConvertEvents.get(0).getCollectionName()).isEqualTo("person");
assertThat(listener.onAfterConvertEvents).hasSize(1);
assertThat(listener.onAfterConvertEvents.get(0).getCollectionName()).isEqualTo("person");
}
private void comparePersonAndDocument(PersonPojoStringId p, PersonPojoStringId p2, org.bson.Document document) {
assertThat(p2.getId()).isEqualTo(p.getId());
assertThat(p2.getText()).isEqualTo(p.getText());
assertThat(document.get("_id")).isEqualTo("1");
assertThat(document.get("text")).isEqualTo("Text");
assertTypeHint(document, PersonPojoStringId.class);
}
@Data
@org.springframework.data.mongodb.core.mapping.Document
public static class Root {
@Id Long id;
@DBRef Related reference;
@DBRef(lazy = true) Related lazyReference;
@DBRef List<Related> listOfReferences;
@DBRef(lazy = true) List<Related> lazyListOfReferences;
@DBRef Map<String, Related> mapOfReferences;
@DBRef(lazy = true) Map<String, Related> lazyMapOfReferences;
}
@Data
@AllArgsConstructor
@org.springframework.data.mongodb.core.mapping.Document
public static class Related {
@Id Long id;
String description;
}
}
| [
"[email protected]"
] | |
43214f1af5d1905b4d838e20ffd935507cfe44bb | eb12237b758fffea2e05cf003d0f327987b8b669 | /src/test/java/com/springboot/demo/config/DBConfig.java | 1c4695dc02323f4ff46c5d38874e1cef4d2f89b5 | [] | no_license | akshay575/java-springboot-app | f91e3f8090b84a2163f11e643b7bf6eaf8cf059f | f8eee3227578f91ad60f118abb7435116fda20d4 | refs/heads/master | 2022-08-19T13:57:16.366789 | 2020-05-26T13:08:39 | 2020-05-26T13:08:39 | 266,616,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 730 | java | package com.springboot.demo.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
import javax.sql.DataSource;
@Configuration
public class DBConfig {
@Bean
public DataSource getDataSource() {
return new EmbeddedDatabaseBuilder()
.ignoreFailedDrops(true)
.addScript("databaseTestScript.sql")
.generateUniqueName(true)
.setType(EmbeddedDatabaseType.H2)
.setScriptEncoding("UTF-8")
.build();
}
}
| [
"[email protected]"
] | |
6739f0de95561a4ae061a685cd46654b43f3b150 | 634ccafde33c3afd2b2ad09d5c9d49d3f3472f2d | /src/main/java/restapitest/Links.java | fcc669db94f11270e75b45d40f9b9359b0b1fe21 | [] | no_license | rajeevsinghAD/restapitest | 75306d6e8d4cbd04966bc01a16e4260d4da173a1 | 60737e113d294156904caf94ed4a2aedadcdec2e | refs/heads/master | 2021-01-15T22:51:55.455626 | 2017-08-13T12:04:28 | 2017-08-13T12:04:28 | 99,921,393 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 555 | java | package restapitest;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@JsonIgnoreProperties(ignoreUnknown = true)
public class Links {
private String self;
private String teaching;
public String getSelf() {
return self;
}
public void setSelf(String self) {
this.self = self;
}
public String getTeaching() {
return teaching;
}
public void setTeaching(String teaching) {
this.teaching = teaching;
}
@Override
public String toString() {
return "Links [self=" + self + ", teaching=" + teaching + "]";
}
}
| [
"[email protected]"
] | |
f2b4bdb915a438dd63f152f3e6e13a8db304f240 | 872095f6ca1d7f252a1a3cb90ad73e84f01345a2 | /mediatek/proprietary/packages/apps/Camera/src/com/mediatek/camera/v2/detection/gesturedetection/GdPresenterImpl.java | 9ea16e680b59b7a81db056155a117b6daaed1cbe | [
"Apache-2.0"
] | permissive | colinovski/mt8163-vendor | 724c49a47e1fa64540efe210d26e72c883ee591d | 2006b5183be2fac6a82eff7d9ed09c2633acafcc | refs/heads/master | 2020-07-04T12:39:09.679221 | 2018-01-20T09:11:52 | 2018-01-20T09:11:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,219 | 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) 2015. 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.camera.v2.detection.gesturedetection;
import com.mediatek.camera.debug.LogHelper;
import com.mediatek.camera.debug.LogHelper.Tag;
import com.mediatek.camera.v2.detection.IDetectionCaptureObserver;
import com.mediatek.camera.v2.detection.IDetectionManager.IDetectionListener;
import com.mediatek.camera.v2.detection.IDetectionPresenter;
/**
*
* Gesture detection presenter which interact face detection device with face view.
*
*/
public class GdPresenterImpl implements IGdPresenterListener, IDetectionPresenter {
private static final Tag TAG = new Tag(GdPresenterImpl.class.getSimpleName());
private IGdView mGdView;
private GdDeviceImpl mGdDeviceImpl;
private boolean mIsGdStarted = false;
/**
* Gesture detection presenter constructor.
* @param view Gesture detection view.
* @param detectionListener Listener used for get capture callback from detection manager.
*/
public GdPresenterImpl(IGdView view, IDetectionListener detectionListener) {
mGdView = view;
mGdDeviceImpl = new GdDeviceImpl(detectionListener);
mGdDeviceImpl.setListener(this);
}
@Override
public IDetectionCaptureObserver getCaptureObserver() {
return mGdDeviceImpl.getCaptureObserver();
}
@Override
public void startDetection() {
if (mIsGdStarted) {
LogHelper.i(TAG, "gesture detection has been stared so return");
return;
}
mGdView.showGestureView();
mGdDeviceImpl.requestStartDetection();
mIsGdStarted = true;
}
@Override
public void stopDetection() {
if (!mIsGdStarted) {
LogHelper.i(TAG, "gesture detection has been stopped or not open so return");
return;
}
mGdView.hideGestureView();
mGdDeviceImpl.requestStopDetection();
mIsGdStarted = false;
}
@Override
public void updateGestureView() {
mGdView.updateGestureView();
}
} | [
"[email protected]"
] | |
bc8aa5ff98c193e1f74467044d4b48fc866045ff | 905012900a5500967f7ff5cad46a7980a4689256 | /src/ModSharpnet/Block/SharpnetCobblestoneWalls1.java | 0ca6fb5eb0f68396b40f077b30699be8b82e669d | [] | no_license | Sharpik/SharpnetMod_1.6.4 | d42effaecc7973b7dcd36f987d47e2f346c87cf2 | 56716d9f1f2aa1955bdf118b7aa3dfb6bb548005 | refs/heads/master | 2020-06-02T04:17:34.088525 | 2019-04-21T20:10:01 | 2019-04-21T20:10:01 | 28,051,365 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,139 | java | package ModSharpnet.Block;
import static ModSharpnet.ModSharpnet.modid;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWall;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
public class SharpnetCobblestoneWalls1 extends BlockWall
{
public SharpnetCobblestoneWalls1(int par1, Block ExtendedBlock)
{
super(par1, ExtendedBlock);
this.setHardness(ExtendedBlock.blockHardness);
this.setResistance(ExtendedBlock.blockResistance / 3.0F);
this.setStepSound(ExtendedBlock.stepSound);
this.setCreativeTab(CreativeTabs.tabBlock);
}
// TADY ZMENIT POCET VARIANT 1 - 16
public int pocet = 4;
@Override
public int idDropped (int par1, Random par2Random, int par3)
{
return this.blockID;
}
@Override
public int damageDropped (int metadata)
{
return metadata;
}
@Override
public int quantityDropped(Random par1Random)
{
return 1;
}
@SideOnly(Side.CLIENT)
public static Icon[] topIcon;
@SideOnly(Side.CLIENT)
public static Icon[] bottomIcon;
@SideOnly(Side.CLIENT)
public static Icon[] sideIcon;
@SideOnly(Side.CLIENT)
public static Icon[] icons;
@SideOnly(Side.CLIENT)
public static boolean[] isSided;
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister par1)
{
icons = new Icon[pocet];
topIcon = new Icon[pocet];
bottomIcon = new Icon[pocet];
sideIcon = new Icon[pocet];
isSided = new boolean[pocet];
for (int i = 0; i < icons.length; i++)
{
switch(i)
{
case 0:{icons[i] = par1.registerIcon(modid+":cobblestone/cobblestone1");isSided[i]=false;break;}
case 1:{icons[i] = par1.registerIcon(modid+":cobblestone/cobblestone2");isSided[i]=false;break;}
case 2:{icons[i] = par1.registerIcon(modid+":cobblestone/cobblestone3");isSided[i]=false;break;}
case 3:{icons[i] = par1.registerIcon(modid+":cobblestone/cobblestone4");isSided[i]=false;break;}
/*
case 4:{icons[i] = par1.registerIcon(modid+":cobblestone/cubes1");isSided[i]=false;break;}
case 5:{icons[i] = par1.registerIcon(modid+":cobblestone/cubes2");isSided[i]=false;break;}
case 6:{icons[i] = par1.registerIcon(modid+":cobblestone/cubes3");isSided[i]=false;break;}
case 7:{icons[i] = par1.registerIcon(modid+":cobblestone/cubes4");isSided[i]=false;break;}
case 8:{icons[i] = par1.registerIcon(modid+":cobblestone/cubes5");isSided[i]=false;break;}
case 9:{icons[i] = par1.registerIcon(modid+":cobblestone/cubes6");isSided[i]=false;break;}
case 10:{icons[i] = par1.registerIcon(modid+":cobblestone/cubes7");isSided[i]=false;break;}
case 11:{icons[i] = par1.registerIcon(modid+":cobblestone/blockWall.blue");isSided[i]=false;break;}
case 12:{icons[i] = par1.registerIcon(modid+":cobblestone/blockWall.brown");isSided[i]=false;break;}
case 13:{icons[i] = par1.registerIcon(modid+":cobblestone/blockWall.green");isSided[i]=false;break;}
case 14:{icons[i] = par1.registerIcon(modid+":cobblestone/blockWall.red");isSided[i]=false;break;}
case 15:{icons[i] = par1.registerIcon(modid+":cobblestone/blockWall.black");isSided[i]=false;break;}
*/
default:{icons[i] = par1.registerIcon(modid+":error");break;}
// Sided block
/*case 12:
{
isSided[i] = true;
// TOP
topIcon[i] = par1.registerIcon(modid+":walls/wall_1.1");
// BOTTOM
bottomIcon[i] = par1.registerIcon(modid+":walls/wall_1.2");
// SIDES
sideIcon[i] = par1.registerIcon(modid+":walls/wall_1");
break;
}*/
}
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side,int meta)
{
if (isSided[meta] == true )
{
switch(side)
{
case 0:
return bottomIcon[meta];
case 1:
return topIcon[meta];
default:
return sideIcon[meta];
}
}
else
{
return icons[meta];
}
}
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
{
for(int i = 0; i < pocet; i++)
{
par3List.add(new ItemStack(par1, 1, i));
}
}
}
| [
"[email protected]"
] | |
8c4ff55b411150adea6fef03e18e9f3db740b14e | d74214ef7b7efbb82b8d9a5e3d9e44b27b74f4bd | /Outer.java | e1e9bd09e6a27a56c49a9d8e897df5f4d8670b07 | [] | no_license | DES2RT/JAVA | 51ebda0bf92e3d78f5c6cb6a9e65d1a343a6e183 | 34719a8fbf2f44b5aba7a029af8c7935c853b0d2 | refs/heads/master | 2020-04-08T09:27:39.853126 | 2018-12-04T22:34:20 | 2018-12-04T22:34:20 | 159,224,675 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package prac;
public class Outer {
private int x;
private int y;
class Inner {
protected int x;
public Inner(int x) {
this.x = x;
}
}
public Outer(int x, int z, int y) {
this.y = y;
x = z;
}
private Outer(int x, int y) {
this.x = x;
this.y = y;
}
public static void main(String[] args) {
Outer outer = new Outer(1, 2);
Outer.Inner inner = new Outer(10, 20).new Inner(30);
System.out.println(outer.x);
System.out.println(inner.x);
System.out.println(outer.y);
System.out.println(outer.x + inner.x + outer.y);
}
}
| [
"[email protected]"
] | |
4fd7b1509c513bfdbe45993fc7b1e445553d3534 | c69b94bbdd6c97c042dad2dc5b1626735f4c53b9 | /app/src/main/java/yuanguandziyuezhou/cs301/cs/wm/edu/amazebyyuanguandziyuezhou/gui/BasicRobot.java | e1ee261e4fc69c1a16eb1a5d4bb52eeef118c0de | [] | no_license | jason424217/AMaze | ad0624bcdd67747e8dabf30c829394c01224ae02 | 44299706811a71b3f8df627a5c08ca1caa64ab93 | refs/heads/master | 2023-06-16T11:35:31.569324 | 2021-07-11T13:40:51 | 2021-07-11T13:40:51 | 259,143,035 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,403 | java | package yuanguandziyuezhou.cs301.cs.wm.edu.amazebyyuanguandziyuezhou.gui;
import android.util.Log;
import android.os.Handler;
import yuanguandziyuezhou.cs301.cs.wm.edu.amazebyyuanguandziyuezhou.generation.CardinalDirection;
import yuanguandziyuezhou.cs301.cs.wm.edu.amazebyyuanguandziyuezhou.gui.Constants.UserInput;
import yuanguandziyuezhou.cs301.cs.wm.edu.amazebyyuanguandziyuezhou.gui.Robot.Direction;
import yuanguandziyuezhou.cs301.cs.wm.edu.amazebyyuanguandziyuezhou.gui.Robot.Turn;
/**@author Yuan Gu/Ziyue Zhou
*
* Class Responsibility:
* To operate a robot that is inside a maze at a particular location and
* looking in a particular direction.This will support a robot with certain sensors.
* A robot is given an existing maze (a controller) to be operational.
* It provides an operating platform for a robot driver that experiences a maze (the real world)
* through the sensors and actuators of this robot interface.
*
* A robot comes with a battery level that is depleted during operations
* such that a robot may actually stop if it runs out of energy.
* This interface supports energy consideration.
* A robot may also stop when hitting an obstacle.
*
*/
public class BasicRobot implements Robot{
Controller controller;
static float energy;
static int meter;
static boolean stopped;
static boolean winning = false;
static boolean manualfault = true;
// This is for test purpose
private int energyMove;
public BasicRobot() {
super();
Log.v("BasicRobot", "created");
this.stopped = false;
this.winning = false;
this.controller = null;
this.setBatteryLevel(3000);
this.setMoveEnergy(5);
this.resetOdometer();
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Turn robot on the spot for amount of degrees.
* @param direction to turn and relative to current forward direction.
*/
public void rotate(Turn turn) {
Log.v("BasicRobot", "rotated");
if(this.hasStopped()) {
return;
}
switch(turn) {
case LEFT:
if(energy >= 3) {
this.controller.keydown(UserInput.Left);
energy -= 3;
}else {
stopped = true;
}
break;
case RIGHT:
if(energy >= 3) {
this.controller.keydown(UserInput.Right);
energy -= 3;
}else {
stopped = true;
}
break;
case AROUND:
if(energy >= 6) {
this.controller.keydown(UserInput.Left);
this.controller.keydown(UserInput.Left);
energy -= 6;
}else {
stopped = true;
}
break;
default:
break;
}
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Moves robot forward a given number of steps.
* @param distance is the number of cells to move in the robot's current forward direction
* @param manual is true if robot is operated manually by user, false otherwise
*/
public void move(int distance, boolean manual) {
Log.v("BasicRobot", "moved");
if(this.hasStopped()) {
return;
}
if(energy < energyMove) {
stopped = true;
return;
}
CardinalDirection cdd = this.controller.getCurrentDirection();
int x = this.controller.getCurrentPosition()[0];
int y = this.controller.getCurrentPosition()[1];
while(distance > 0) {
if(this.controller.getMazeConfiguration().hasWall(x, y, cdd)) {
if(!manual) {
stopped = true;
this.manualfault = false;
System.out.println("This message indicates that the automated driver fails (crashed the wall)!");
return;
}
return;
}else if(energy < energyMove){
stopped = true;
return;
}else {
this.controller.keydown(UserInput.Up);
meter ++;
distance --;
energy -= energyMove;
}
}
}
/**@author Ziyue Zhou/Yuan Gu
* get the boolean value if this is manually operated or not
* @return true if it is manually operate else otherwise
*/
public boolean getmanualfault() {
return this.manualfault;
}
/**@author Yuan Gu/Ziyue Zhou
* Go down a given number of steps.
* @param distance is the number of cells to move in the robot's current forward direction
* @param manual is true if robot is operated manually by user, false otherwise
*/
public void goDown(int distance, boolean manual) {
if(this.hasStopped()) {
return;
}
if(energy < energyMove) {
stopped = true;
return;
}
CardinalDirection cdd = this.controller.getCurrentDirection();
int x = this.controller.getCurrentPosition()[0];
int y = this.controller.getCurrentPosition()[1];
cdd = cdd.oppositeDirection();
while(distance > 0) {
if(this.controller.getMazeConfiguration().hasWall(x, y, cdd)) {
if(!manual) {
stopped = true;
this.manualfault = false;
return;
}
return;
}else if(energy < energyMove){
stopped = true;
return;
}else {
this.controller.keydown(UserInput.Down);
meter ++;
distance --;
energy -= energyMove;
}
}
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Provides the current position as (x,y) coordinates
* @throws Exception if position is outside of the maze
*/
public int[] getCurrentPosition() throws Exception {
int[] current = this.controller.getCurrentPosition();
if(!this.controller.getMazeConfiguration().isValidPosition(current[0], current[1])) {
throw new Exception();
}else return current;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Provides the robot with a reference to the controller to cooperate with.
*/
public void setMaze(Controller controller) {
this.controller = controller;
}
/**@author Yuan Gu/Ziyue Zhou
* Get controller
* @return return controller
*/
public Controller getMaze() {
return this.controller;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Tells if current position (x,y) is right at the exit but still inside the maze.
*/
public boolean isAtExit() {
if(this.controller.getMazeConfiguration().getDistanceToExit(
this.controller.getCurrentPosition()[0], this.controller.getCurrentPosition()[1])==1) {
return true;
}else return false;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Tells if a sensor can identify the exit in given direction
*/
public boolean canSeeExit(Direction direction) throws UnsupportedOperationException {
if(this.hasDistanceSensor(direction)) {
if(this.distanceToObstacle(direction) == Integer.MAX_VALUE) {
return true;
}else return false;
}else {
throw new UnsupportedOperationException();
}
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Tells if current position is inside a room.
* @throws UnsupportedOperationException if not supported by robot
*/
public boolean isInsideRoom() throws UnsupportedOperationException {
try{
return this.controller.getMazeConfiguration().getMazecells().isInRoom(this.controller.getCurrentPosition()[0], this.controller.getCurrentPosition()[1]);
}catch(Exception e) {
throw new UnsupportedOperationException();
}
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Tells if the robot has a room sensor.
*/
public boolean hasRoomSensor() {
return true;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* return Cardinal Direction now
*/
public CardinalDirection getCurrentDirection() {
return this.controller.getCurrentDirection();
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Get battery level now
*/
public float getBatteryLevel() {
return energy;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Sets the current battery level.
* @param level is the current battery level
*/
public void setBatteryLevel(float level) {
energy = level;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Gets the distance traveled by the robot.
*/
public int getOdometerReading() {
return meter;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Resets the odomoter counter to zero.
*/
public void resetOdometer() {
meter = 0;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Gives the energy consumption for a full 360 degree rotation.
*/
public float getEnergyForFullRotation() {
return 12;
}
/**@author Yuan Gu/Ziyue Zhou
* Gives the energy consumption for a 90 degree rotation.
*/
public float getEnergyForOneTurn() {
return 3;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Gives the energy consumption for moving forward for a distance of 1 step.
*/
public float getEnergyForStepForward() {
return energyMove;
}
/**@author Yuan Gu/Ziyue Zhou
* Gives the energy consumption for sensing distance.
*/
public float getEnergyForSensing() {
return 1;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Tells if the robot has stopped.
*/
public boolean hasStopped() {
if(energy <= 0) {
stopped = true;
}
return stopped;
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Tells the distance to an obstacle. Use assert()
* @param direction the direction we want to check
* @throws UnsupportedOperationException if not supported by robot
*/
public int distanceToObstacle(Direction direction) throws UnsupportedOperationException {
if(this.hasDistanceSensor(direction)) {
if(energy >= 1) {
energy -= 1;
}else {
stopped = true;
}
if(!stopped) {
CardinalDirection cdd = null;
CardinalDirection cd = this.controller.getCurrentDirection();
switch(direction) {
case LEFT:
cdd = cd.rotateClockwise();
break;
case RIGHT:
cdd = cd.rotateCounterClockwise();
break;
case FORWARD:
cdd = cd;
break;
case BACKWARD:
cdd = cd.oppositeDirection();
break;
}
int count = 0;
int x = this.controller.getCurrentPosition()[0];
int y = this.controller.getCurrentPosition()[1];
while(true) {
// If outside of maze, the robot faces forwards the exit
if (!this.controller.getMazeConfiguration().isValidPosition(x, y)) {
return Integer.MAX_VALUE;
}
switch(cdd) {
case North:
if(this.controller.getMazeConfiguration().hasWall(x, y, cdd))return count;
y--;
break;
case South:
if(this.controller.getMazeConfiguration().hasWall(x, y, cdd))return count;
y++;
break;
case East:
if(this.controller.getMazeConfiguration().hasWall(x, y, cdd))return count;
x++;
break;
case West:
if(this.controller.getMazeConfiguration().hasWall(x, y, cdd))return count;
x--;
break;
default:
assert false : "Oops, Unknown Cardinal direction!";
break;
//assert method use here
}
count++;
}
}else{
throw new UnsupportedOperationException();
}
}else throw new UnsupportedOperationException();
}
@Override
/**@author Yuan Gu/Ziyue Zhou
* Tells if the robot has a distance sensor for the given direction.
*/
public boolean hasDistanceSensor(Direction direction) {
return true;
}
/**
* This is responsible for performing the last step move at the exit.
* This will be called in all driver algorithm.
* Refactored by Yuan Gu
* @author Yuan Gu/Ziyue Zhou
*/
public void lastStepMove() {
if (this.canSeeExit(Direction.RIGHT)) {
this.rotate(Turn.RIGHT);
}
if (this.canSeeExit(Direction.LEFT)) {
this.rotate(Turn.LEFT);
}
if (this.canSeeExit(Direction.BACKWARD)) {
this.rotate(Turn.AROUND);
}
this.move(1, false);
}
////////////////////////////Setter and getter for testing purpose/////////////////////////////////
/**
* Set the energy consumed for move 1 step
* @author Yuan Gu/Ziyue Zhou
*/
public void setMoveEnergy(int move) {
energyMove = move;
}
/**
* Get the energy consumed for move 1 step
* @return energyMove
* @author Yuan Gu/Ziyue Zhou
*/
public int getMoveEnergy() {
return energyMove;
}
} | [
"[email protected]"
] | |
bdb13513ce66e9cfe8e96daa96b4426e8093d3f6 | 79a38b09f1483149fbd814f204155a3fe8bb92b4 | /app/src/main/java/com/greenbit/MultiscanJNIGuiJavaAndroid/GbExampleGrayScaleBitmapClassRough.java | adbc683d5115497bff8565655f9812726a038588 | [] | no_license | radtek/MultiscanJNIExample_GUI_JavaAndroid | b5d583c6f237fcb07087dac608b400c610db5ea1 | a7264c3b8149769ddd8dc52c3efd1089e25ec632 | refs/heads/master | 2023-01-10T12:42:26.829595 | 2020-11-13T23:36:18 | 2020-11-13T23:36:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 64,959 | java | package com.greenbit.MultiscanJNIGuiJavaAndroid;
import android.graphics.Bitmap;
import android.os.Environment;
import android.util.Log;
import com.greenbit.MultiscanJNIGuiJavaAndroid.utils.LfsJavaWrapperDefinesMinutiaN;
import com.greenbit.ansinistitl.GBANJavaWrapperDefinesANStruct;
import com.greenbit.ansinistitl.GBANJavaWrapperDefinesAnsinistVersions;
import com.greenbit.ansinistitl.GBANJavaWrapperDefinesCompressionAlgorithmsStrings;
import com.greenbit.ansinistitl.GBANJavaWrapperDefinesFingerPositions;
import com.greenbit.ansinistitl.GBANJavaWrapperDefinesImpressionCodes;
import com.greenbit.ansinistitl.GBANJavaWrapperDefinesRecordStruct;
import com.greenbit.ansinistitl.GBANJavaWrapperDefinesReturnCodes;
import com.greenbit.bozorth.BozorthJavaWrapperLibrary;
import com.greenbit.gbfir.GbfirJavaWrapperDefinesCompressionAlgorithm;
import com.greenbit.gbfir.GbfirJavaWrapperDefinesFingerPositions;
import com.greenbit.gbfir.GbfirJavaWrapperDefinesFirFormats;
import com.greenbit.gbfir.GbfirJavaWrapperDefinesImpressionTypes;
import com.greenbit.gbfir.GbfirJavaWrapperDefinesReturnCodes;
import com.greenbit.gbfir.GbfirJavaWrapperDefinesScaleUnits;
import com.greenbit.gbfrsw.GbfrswJavaWrapperDefinesCodingOptions;
import com.greenbit.gbfrsw.GbfrswJavaWrapperDefinesISOFMRFingerPositions;
import com.greenbit.gbfrsw.GbfrswJavaWrapperDefinesISOFMRFormat;
import com.greenbit.gbfrsw.GbfrswJavaWrapperDefinesISOFMRGBProprietaryData;
import com.greenbit.gbfrsw.GbfrswJavaWrapperDefinesRequestedOperations;
import com.greenbit.gbfrsw.GbfrswJavaWrapperDefinesReturnCodes;
import com.greenbit.gbfrsw.GbfrswJavaWrapperDefinesUnmatchedDataFactorInfluenceRecommended;
import com.greenbit.gbnfiq.GbNfiqJavaWrapperDefineMinutiaeDescriptor;
import com.greenbit.gbnfiq.GbNfiqJavaWrapperDefineReturnCodes;
import com.greenbit.gbnfiq.GbNfiqJavaWrapperLibrary;
import com.greenbit.gbnfiq2.GbNfiq2JavaWrapperDefineReturnCodes;
import com.greenbit.jpeg.GbjpegJavaWrapperDefinesReturnCodes;
import com.greenbit.lfs.LfsJavaWrapperDefinesMinutia;
import com.greenbit.lfs.LfsJavaWrapperLibrary;
import com.greenbit.usbPermission.IGreenbitLogger;
import com.greenbit.utils.GBJavaWrapperUtilByteArrayForJavaToCExchange;
import com.greenbit.utils.GBJavaWrapperUtilDoubleForJavaToCExchange;
import com.greenbit.utils.GBJavaWrapperUtilIntForJavaToCExchange;
import com.greenbit.wsq.WsqJavaWrapperDefinesReturnCodes;
import org.apache.commons.lang3.SerializationUtils;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
public class GbExampleGrayScaleBitmapClassRough {
//-------------------------------------------------------------
// FIELDS
//-------------------------------------------------------------
public byte[] bytes;
public int sx;
public int sy;
public boolean hasToBeSaved;
public boolean isAcquisitionResult;
//-------------------------------------------------------------
// CONSTRUCTORS
//-------------------------------------------------------------
public GbExampleGrayScaleBitmapClassRough() {
bytes = null;
sx = sy = 0;
isAcquisitionResult = false;
hasToBeSaved = false;
}
public GbExampleGrayScaleBitmapClassRough(byte[] B, int width, int height, boolean save, boolean isAcqRes, IGreenbitLogger act) {
this.Build(B, width, height, save, isAcqRes, act);
}
public void Build(byte[] B, int width, int height, boolean save, boolean isAcqRes, IGreenbitLogger act) {
//act.LogAcquisitionPhaseOnScreen("Build: B.length = " + B.length + ", width = " + width + ", height = " + height);
if (B.length < (width * height)) {
//act.LogAcquisitionPhaseOnScreen("Build: B.length = " + B.length + ", less than width * height = :" + width + " * " + height + " = " + (width * height));
return;
}
bytes = new byte[width * height];
bytes = Arrays.copyOf(B, width * height);
sx = width;
sy = height;
hasToBeSaved = save;
isAcquisitionResult = isAcqRes;
}
public void Build(byte[] B, int width, int height) {
this.Build(B, width, height, false, false, null);
}
//-------------------------------------------------------------
// UTILITIES
//-------------------------------------------------------------
public Bitmap GetBmp() {
if (bytes != null && sx > 0 && sy > 0) {
Bitmap ValToRet;
byte[] pixels = new byte[sx * sy * 4];
for (int i = 0; i < bytes.length; i++) {
pixels[i * 4] =
pixels[i * 4 + 1] =
pixels[i * 4 + 2] = bytes[i]; //Invert the source bits
pixels[i * 4 + 3] = (byte) 0xff; // the alpha.
}
ValToRet = Bitmap.createBitmap(sx, sy, Bitmap.Config.ARGB_8888);
ValToRet.copyPixelsFromBuffer(ByteBuffer.wrap(pixels));
return ValToRet;
}
return null;
}
public void ClipImage(int ClipOrigX, int ClipOrigY, int ClipSx, int ClipSy) {
if (ClipOrigX >= this.sx) return;
if (ClipOrigY >= this.sy) return;
if (ClipOrigX < 0 || ClipOrigY < 0 || ClipSx < 0 || ClipSy < 0) return;
if (ClipSx > (this.sx - ClipOrigX)) ClipSx = (this.sx - ClipOrigX);
if (ClipSy > (this.sy - ClipOrigY)) ClipSy = (this.sy - ClipOrigY);
byte[] Clipped = new byte[ClipSx * ClipSy];
int offsetSource = ClipOrigX + (ClipOrigY * this.sx);
int offsetDestination = 0;
for (int i = 0; i < ClipSy; i++) {
System.arraycopy(this.bytes, offsetSource, Clipped, offsetDestination, ClipSx);
offsetSource += this.sx;
offsetDestination += ClipSx;
}
this.bytes = Clipped;
this.sx = ClipSx;
this.sy = ClipSy;
}
public static String GetGreenbitDirectoryName() {
String path = Environment.getExternalStorageDirectory().toString();
File file = new File(path, "Greenbit");
boolean success = true;
if (!file.exists()) {
success = file.mkdir();
}
path = file.getPath();
return path;
}
public static ArrayList<String> GbBmpLoadListOfImages(String extensionVal, boolean includeExtensionInName) {
File file = new File(GetGreenbitDirectoryName());
String[] paths = file.list();
ArrayList<String> ValToRet = new ArrayList<String>();
for (String fname :
paths) {
String[] filenameArray = fname.split("\\.");
String extension = filenameArray[filenameArray.length - 1];
if (extension.equals(extensionVal)) {
if (includeExtensionInName) ValToRet.add(fname);
else ValToRet.add(filenameArray[filenameArray.length - 2]);
}
}
return ValToRet;
}
//-------------------------------------------------------------
// RAW
//-------------------------------------------------------------
public void SaveToRaw(String fileName, IGreenbitLogger act) {
try {
// Assume block needs to be inside a Try/Catch block.
File file = new File(GetGreenbitDirectoryName(),
fileName + "_" + sx + "_" + sy + ".raw"); // the File to save , append increasing numeric counter to prevent files from getting overwritten.
OutputStream fOut = null;
fOut = new FileOutputStream(file);
fOut.write(bytes);
fOut.close(); // do not forget to close the stream
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveToRaw exception: " + e.getMessage());
}
}
public static int[] GbBmpGetSizeFromRawFileName(String rawFName) {
String[] filenameArray = rawFName.split("_");
if (filenameArray.length >= 3) {
String imgWS = filenameArray[filenameArray.length - 2], imgHS = filenameArray[filenameArray.length - 1];
try {
int[] imgSize = new int[2];
imgSize[0] = Integer.parseInt(imgWS);
imgSize[1] = Integer.parseInt(imgHS);
return imgSize;
} catch (NumberFormatException ex) {
return null;
}
} else {
return null;
}
}
public static ArrayList<String> GbBmpLoadListOfRawImagesWithSize() {
ArrayList<String> DummyList = GbBmpLoadListOfImages("raw", false),
ValToRet = new ArrayList<String>();
for (String item : DummyList) {
if (GbBmpGetSizeFromRawFileName(item) != null) ValToRet.add(item);
}
return ValToRet;
}
public boolean GbBmpFromRawFileWithSize(String rawFName, IGreenbitLogger act) throws Exception {
try {
////////////////////////////
// Load file
////////////////////////////
int[] imgSize = GbBmpGetSizeFromRawFileName(rawFName);
if (imgSize == null)
throw new Exception("GbBmpFromRawFileWithSize: file name does not contain size");
File file = new File(GetGreenbitDirectoryName(),
rawFName + ".raw");
InputStream fIn = null;
fIn = new FileInputStream(file);
byte[] rawStream = new byte[fIn.available()];
fIn.read(rawStream);
fIn.close(); // do not forget to close the stream
this.Build(rawStream, imgSize[0], imgSize[1]);
return true;
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
if (act != null) act.LogAsDialog(e.getMessage());
return false;
}
}
//-------------------------------------------------------------
// WSQ
//-------------------------------------------------------------
public void SaveToWsq(String fileName, IGreenbitLogger act) {
try {
// Assume block needs to be inside a Try/Catch block.
GBJavaWrapperUtilIntForJavaToCExchange compressedFileSize = new GBJavaWrapperUtilIntForJavaToCExchange();
int RetVal;
RetVal = GB_AcquisitionOptionsGlobals.WSQ_Jw.GetCompressedFileSize(
0.75, bytes, sx, sy, 8, 500, "MyComment", compressedFileSize
);
if (RetVal == WsqJavaWrapperDefinesReturnCodes.WSQPACK_FAIL) {
throw new Exception("SaveToWsq WsqlibError: " + GB_AcquisitionOptionsGlobals.WSQ_Jw.GetLastErrorString());
}
byte[] WsqStream = new byte[compressedFileSize.Get()];
RetVal = GB_AcquisitionOptionsGlobals.WSQ_Jw.Compress(WsqStream, 0.75, bytes, sx, sy, 8, 500, "MyComment");
if (RetVal == WsqJavaWrapperDefinesReturnCodes.WSQPACK_FAIL) {
throw new Exception("SaveToWsq WsqlibError: " + GB_AcquisitionOptionsGlobals.WSQ_Jw.GetLastErrorString());
}
File file = new File(GetGreenbitDirectoryName(),
fileName + ".wsq");
act.LogOnScreen("Saving image as wsq; Storage dir: " + GetGreenbitDirectoryName() +
", len = " + bytes.length);
OutputStream fOut = null;
fOut = new FileOutputStream(file);
fOut.write(WsqStream);
fOut.close(); // do not forget to close the stream
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveToWsq exception: " + e.getMessage());
}
}
public boolean GBBmpFromWsqBuffer(byte[] wsqSource, boolean save, boolean isAcqRes, IGreenbitLogger act) throws Exception {
try {
///////////////////////////////
// convert from wsq to binary
///////////////////////////////
GBJavaWrapperUtilIntForJavaToCExchange width = new GBJavaWrapperUtilIntForJavaToCExchange(),
height = new GBJavaWrapperUtilIntForJavaToCExchange(),
bitsPerPixel = new GBJavaWrapperUtilIntForJavaToCExchange(),
ppi = new GBJavaWrapperUtilIntForJavaToCExchange(),
lossy = new GBJavaWrapperUtilIntForJavaToCExchange();
int RetVal = GB_AcquisitionOptionsGlobals.WSQ_Jw.GetUncompressedOutputParameters(
width, height, bitsPerPixel, ppi, lossy, wsqSource);
if (RetVal == WsqJavaWrapperDefinesReturnCodes.WSQPACK_FAIL) {
throw new Exception("GBBmpFromWsqBuffer " +
", WsqlibError: " + GB_AcquisitionOptionsGlobals.WSQ_Jw.GetLastErrorString());
}
byte[] destination = new byte[width.Get() * height.Get() * (bitsPerPixel.Get() / 8)];
RetVal = GB_AcquisitionOptionsGlobals.WSQ_Jw.Uncompress(destination,
width, height, bitsPerPixel, ppi, lossy, wsqSource);
if (RetVal == WsqJavaWrapperDefinesReturnCodes.WSQPACK_FAIL) {
throw new Exception("GBBmpFromWsqBuffer " +
", WsqlibError: " + GB_AcquisitionOptionsGlobals.WSQ_Jw.GetLastErrorString());
}
this.Build(destination, width.Get(), height.Get(), save, isAcqRes, act);
return true;
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
act.LogAsDialog(e.getMessage());
return false;
}
}
public boolean GbBmpFromWsqFile(String wsqFileName, boolean save, boolean isAcqRes, IGreenbitLogger act) throws Exception {
try {
////////////////////////////
// Load file
////////////////////////////
if (act != null) act.LogOnScreen("Storage dir: " + GetGreenbitDirectoryName());
File file = new File(GetGreenbitDirectoryName(),
wsqFileName + ".wsq");
InputStream fIn = null;
fIn = new FileInputStream(file);
byte[] wsqStream = new byte[fIn.available()];
fIn.read(wsqStream);
fIn.close(); // do not forget to close the stream
String fInfo = GetGreenbitDirectoryName() + "/" + wsqFileName + " size: " + wsqStream.length;
if (act != null) act.LogOnScreen(fInfo);
///////////////////////////////
// convert from wsq to binary
///////////////////////////////
return GBBmpFromWsqBuffer(wsqStream, save, isAcqRes, act);
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
act.LogAsDialog(e.getMessage());
return false;
}
}
public static ArrayList<String> GbBmpLoadListOfWsqImages(boolean withExtension) {
return GbBmpLoadListOfImages("wsq", withExtension);
}
//-------------------------------------------------------------
// JPEG
//-------------------------------------------------------------
public void SaveToJpeg(String fileName, IGreenbitLogger act) {
try {
// Assume block needs to be inside a Try/Catch block.
GBJavaWrapperUtilIntForJavaToCExchange compressedFileSize = new GBJavaWrapperUtilIntForJavaToCExchange();
int RetVal;
RetVal = GB_AcquisitionOptionsGlobals.Jpeg_Jw.JpegGetParamsOfEncodedBuffer(
bytes, sx, sy, 8, 500, 100, compressedFileSize
);
if (RetVal != GbjpegJavaWrapperDefinesReturnCodes.GBJPEG_OK) {
throw new Exception("SaveToJpeg JpeglibError: " + GB_AcquisitionOptionsGlobals.Jpeg_Jw.GetLastErrorString());
}
byte[] JpegStream = new byte[compressedFileSize.Get()];
RetVal = GB_AcquisitionOptionsGlobals.Jpeg_Jw.JpegEncode(bytes, sx, sy, 8, 500, 100, JpegStream);
if (RetVal != GbjpegJavaWrapperDefinesReturnCodes.GBJPEG_OK) {
throw new Exception("SaveToJpeg " +
", JpeglibError: " + GB_AcquisitionOptionsGlobals.Jpeg_Jw.GetLastErrorString());
}
File file = new File(GetGreenbitDirectoryName(),
fileName + ".jpeg");
act.LogOnScreen("Saving image as jpeg; Storage dir: " + GetGreenbitDirectoryName() +
", len = " + bytes.length);
OutputStream fOut = null;
fOut = new FileOutputStream(file);
fOut.write(JpegStream);
fOut.close(); // do not forget to close the stream
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveToJpeg exception: " + e.getMessage());
}
}
public boolean GBBmpFromJpegBuffer(byte[] jpegSource, boolean save, boolean isAcqRes, IGreenbitLogger act) throws Exception {
try {
///////////////////////////////
// convert from wsq to binary
///////////////////////////////
GBJavaWrapperUtilIntForJavaToCExchange width = new GBJavaWrapperUtilIntForJavaToCExchange(),
height = new GBJavaWrapperUtilIntForJavaToCExchange(),
bitsPerPixel = new GBJavaWrapperUtilIntForJavaToCExchange();
int RetVal = GB_AcquisitionOptionsGlobals.Jpeg_Jw.JpegGetParametersOfDecodedBuffer(
jpegSource,
width, height, bitsPerPixel);
if (RetVal != GbjpegJavaWrapperDefinesReturnCodes.GBJPEG_OK) {
throw new Exception("GBBmpFromJpegBuffer " +
", JpeglibError: " + GB_AcquisitionOptionsGlobals.Jpeg_Jw.GetLastErrorString());
}
byte[] destination = new byte[width.Get() * height.Get() * (bitsPerPixel.Get() / 8)];
RetVal = GB_AcquisitionOptionsGlobals.Jpeg_Jw.JpegDecode(
jpegSource,
destination,
width, height, bitsPerPixel);
if (RetVal != GbjpegJavaWrapperDefinesReturnCodes.GBJPEG_OK) {
throw new Exception("GBBmpFromJpegBuffer " +
", JpeglibError: " + GB_AcquisitionOptionsGlobals.Jpeg_Jw.GetLastErrorString());
}
this.Build(destination, width.Get(), height.Get(), save, isAcqRes, act);
return true;
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
act.LogAsDialog(e.getMessage());
return false;
}
}
public boolean GbBmpFromJpegFile(String jpegFileName, boolean save, boolean isAcqRes, IGreenbitLogger act) throws Exception {
try {
////////////////////////////
// Load file
////////////////////////////
act.LogOnScreen("Storage dir: " + GetGreenbitDirectoryName());
File file = new File(GetGreenbitDirectoryName(),
jpegFileName + ".jpeg");
InputStream fIn = null;
fIn = new FileInputStream(file);
byte[] stream = new byte[fIn.available()];
fIn.read(stream);
fIn.close(); // do not forget to close the stream
String fInfo = GetGreenbitDirectoryName() + "/" + jpegFileName + " size: " + stream.length;
act.LogOnScreen(fInfo);
///////////////////////////////
// convert from wsq to binary
///////////////////////////////
return GBBmpFromJpegBuffer(stream, save, isAcqRes, act);
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
act.LogAsDialog(e.getMessage());
return false;
}
}
//-------------------------------------------------------------
// JPEG2
//-------------------------------------------------------------
public void SaveToJpeg2(String fileName, IGreenbitLogger act) {
try {
// Assume block needs to be inside a Try/Catch block.
GBJavaWrapperUtilIntForJavaToCExchange compressedFileSize = new GBJavaWrapperUtilIntForJavaToCExchange();
int RetVal;
RetVal = GB_AcquisitionOptionsGlobals.Jpeg_Jw.Jp2GetParamsOfEncodedBuffer(
bytes, sx, sy, 8, 1, compressedFileSize
);
if (RetVal != GbjpegJavaWrapperDefinesReturnCodes.GBJPEG_OK) {
throw new Exception("SaveToJpeg2 JpeglibError: " + GB_AcquisitionOptionsGlobals.Jpeg_Jw.GetLastErrorString());
}
byte[] Jp2Stream = new byte[compressedFileSize.Get()];
RetVal = GB_AcquisitionOptionsGlobals.Jpeg_Jw.Jp2Encode(bytes, sx, sy, 8, 1, Jp2Stream);
if (RetVal != GbjpegJavaWrapperDefinesReturnCodes.GBJPEG_OK) {
throw new Exception("SaveToJpeg2 " +
", JpeglibError: " + GB_AcquisitionOptionsGlobals.Jpeg_Jw.GetLastErrorString());
}
File file = new File(GetGreenbitDirectoryName(),
fileName + ".jp2");
act.LogOnScreen("Saving image as jp2; Storage dir: " + GetGreenbitDirectoryName() +
", len = " + bytes.length);
OutputStream fOut = null;
fOut = new FileOutputStream(file);
fOut.write(Jp2Stream);
fOut.close(); // do not forget to close the stream
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveToJpeg exception: " + e.getMessage());
}
}
public boolean GBBmpFromJpeg2Buffer(byte[] jpeg2Source, boolean save, boolean isAcqRes, IGreenbitLogger act) throws Exception {
try {
///////////////////////////////
// convert from wsq to binary
///////////////////////////////
GBJavaWrapperUtilIntForJavaToCExchange width = new GBJavaWrapperUtilIntForJavaToCExchange(),
height = new GBJavaWrapperUtilIntForJavaToCExchange(),
bitsPerPixel = new GBJavaWrapperUtilIntForJavaToCExchange();
int RetVal = GB_AcquisitionOptionsGlobals.Jpeg_Jw.JpegGetParametersOfDecodedBuffer(
jpeg2Source,
width, height, bitsPerPixel);
if (RetVal != GbjpegJavaWrapperDefinesReturnCodes.GBJPEG_OK) {
throw new Exception("GBBmpFromJpegBuffer " +
", JpeglibError: " + GB_AcquisitionOptionsGlobals.Jpeg_Jw.GetLastErrorString());
}
byte[] destination = new byte[width.Get() * height.Get() * (bitsPerPixel.Get() / 8)];
RetVal = GB_AcquisitionOptionsGlobals.Jpeg_Jw.JpegDecode(
jpeg2Source,
destination,
width, height, bitsPerPixel);
if (RetVal != GbjpegJavaWrapperDefinesReturnCodes.GBJPEG_OK) {
throw new Exception("GBBmpFromJpegBuffer " +
", JpeglibError: " + GB_AcquisitionOptionsGlobals.Jpeg_Jw.GetLastErrorString());
}
this.Build(destination, width.Get(), height.Get(), save, isAcqRes, act);
return true;
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
act.LogAsDialog(e.getMessage());
return false;
}
}
public boolean GbBmpFromJpeg2File(String jpeg2FileName, boolean save, boolean isAcqRes, IGreenbitLogger act) throws Exception {
try {
////////////////////////////
// Load file
////////////////////////////
act.LogOnScreen("Storage dir: " + GetGreenbitDirectoryName());
File file = new File(GetGreenbitDirectoryName(),
jpeg2FileName + ".jp2");
InputStream fIn = null;
fIn = new FileInputStream(file);
byte[] stream = new byte[fIn.available()];
fIn.read(stream);
fIn.close(); // do not forget to close the stream
String fInfo = GetGreenbitDirectoryName() + "/" + jpeg2FileName + " size: " + stream.length;
act.LogOnScreen(fInfo);
///////////////////////////////
// convert from wsq to binary
///////////////////////////////
return GBBmpFromJpegBuffer(stream, save, isAcqRes, act);
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
act.LogAsDialog(e.getMessage());
return false;
}
}
public static ArrayList<String> GbBmpLoadListOfJp2Images(boolean withExtension) {
return GbBmpLoadListOfImages("jp2", withExtension);
}
//-------------------------------------------------------------
// DACTYMATCH
//-------------------------------------------------------------
private boolean InitGbfrswLibraryAndGetCodeSizeForCurrentBmp(
GBJavaWrapperUtilIntForJavaToCExchange SampleCodeSize,
GBJavaWrapperUtilIntForJavaToCExchange PackedSampleCodeSize,
GBJavaWrapperUtilIntForJavaToCExchange TemplateCodeSize,
GBJavaWrapperUtilIntForJavaToCExchange CompactTemplateCodeSize,
IGreenbitLogger act
) {
int RetVal;
try {
GBJavaWrapperUtilIntForJavaToCExchange VersionField1 = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange VersionField2 = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange VersionField3 = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange VersionField4 = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange MaxImageSizeX = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange MaxImageSizeY = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange MinImageSizeX = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange MinImageSizeY = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange MemoryBufferSize = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetVersionInfo(
GbfrswJavaWrapperDefinesRequestedOperations.GBFRSW_MEMORY_REQUEST_ALL,
VersionField1, VersionField2, VersionField3, VersionField4,
MaxImageSizeX, MaxImageSizeY, MinImageSizeX, MinImageSizeY,
MemoryBufferSize
);
System.out.println("InitGbfrsw: Mx = " + MaxImageSizeX.Get() +
", My = " + MaxImageSizeY.Get() + ", mx = " + MinImageSizeX.Get() + ", my = " + MinImageSizeY.Get());
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib GetVersionInfo Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
// check image size
if (this.sx > MaxImageSizeX.Get()) {
throw new Exception("GbfrswlibError: current image size x is more than allowed, that is " + MaxImageSizeX.Get());
}
if (this.sy > MaxImageSizeY.Get()) {
throw new Exception("GbfrswlibError: current image size y is more than allowed, that is " + MaxImageSizeY.Get());
}
if (this.sx < MinImageSizeX.Get()) {
throw new Exception("GbfrswlibError: current image size x is less than minimum allowed, that is " + MinImageSizeX.Get());
}
if (this.sy < MinImageSizeY.Get()) {
throw new Exception("GbfrswlibError: current image size y is less than minimum allowed, that is " + MinImageSizeY.Get());
}
// now get code max size
RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetCodeMaxSize(this.sx, this.sy,
SampleCodeSize, PackedSampleCodeSize, TemplateCodeSize, CompactTemplateCodeSize);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib GetCodeMaxSize Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("InitGbfrsw exception: " + e.getMessage());
return false;
}
return true;
}
public void EncodeToTemplate(String fileName, int ImageFlags, IGreenbitLogger act) {
try {
/******************
Get Code max size
*****************/
GBJavaWrapperUtilIntForJavaToCExchange SampleCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange PackedSampleCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange TemplateCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange CompactTemplateCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
if (!InitGbfrswLibraryAndGetCodeSizeForCurrentBmp(SampleCodeSize, PackedSampleCodeSize, TemplateCodeSize, CompactTemplateCodeSize, act)) {
throw new Exception("EncodeToTemplate Error: InitGbfrswLibraryAndGetCodeSizeForCurrentBmp returned false");
}
/******************
Encode
*****************/
byte[] SampleCode = new byte[SampleCodeSize.Get()];
int RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.Coding(
this.sx, this.sy, bytes, ImageFlags,
GbfrswJavaWrapperDefinesCodingOptions.GBFRSW_OPTION_FINGERPRINT_PATTERN_CHECK,
SampleCode
);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib Coding Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
/***********************
* Enroll
**********************/
byte[] TemplateCode = new byte[TemplateCodeSize.Get()];
RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.Enroll(this.sx, this.sy,
SampleCode, TemplateCode);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib Enroll Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
/*******************
* Save To File
******************/
act.LogOnScreen("Saving image as gbfrsw template; Storage dir: " + GetGreenbitDirectoryName() +
", len = " + bytes.length);
File file = new File(GetGreenbitDirectoryName(),
fileName + ".gbfrsw");
OutputStream fOut = null;
fOut = new FileOutputStream(file);
fOut.write(TemplateCode);
fOut.close(); // do not forget to close the stream
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("EncodeToTemplate exception: " + e.getMessage());
}
}
public boolean MatchWithTemplate(String TemplateFName, int ImageFlagsForCoding,
int UnmatchedDataFactor,
boolean AddExtension, IGreenbitLogger act) {
try {
////////////////////////////
// Load file
////////////////////////////
if (AddExtension) TemplateFName += ".gbfrsw";
act.LogOnScreen("Storage dir: " + GetGreenbitDirectoryName());
File file = new File(GetGreenbitDirectoryName(),
TemplateFName);
InputStream fIn = null;
fIn = new FileInputStream(file);
byte[] templateStream = new byte[fIn.available()];
fIn.read(templateStream);
fIn.close(); // do not forget to close the stream
/////////////////////////////
// ENCODE THIS
/////////////////////////////
/******************
Get Code max size
*****************/
GBJavaWrapperUtilIntForJavaToCExchange SampleCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange PackedSampleCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange TemplateCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange CompactTemplateCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
if (!InitGbfrswLibraryAndGetCodeSizeForCurrentBmp(SampleCodeSize, PackedSampleCodeSize, TemplateCodeSize, CompactTemplateCodeSize, act)) {
throw new Exception("EncodeToTemplate Error: InitGbfrswLibraryAndGetCodeSizeForCurrentBmp returned false");
}
/******************
Encode
*****************/
byte[] SampleCode = new byte[SampleCodeSize.Get()];
int RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.Coding(
this.sx, this.sy, bytes, ImageFlagsForCoding,
GbfrswJavaWrapperDefinesCodingOptions.GBFRSW_OPTION_FINGERPRINT_PATTERN_CHECK,
SampleCode
);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib Coding Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
///////////////////////////////////
// MATCH
///////////////////////////////////
GBJavaWrapperUtilDoubleForJavaToCExchange MatchingScore = new GBJavaWrapperUtilDoubleForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.Match(SampleCode, templateStream,
GB_AcquisitionOptionsGlobals.SpeedVsPrecisionTradeoff,
UnmatchedDataFactor,
0, GB_AcquisitionOptionsGlobals.MatchRotationAngle, MatchingScore);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib Match Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
if (MatchingScore.Get() < GB_AcquisitionOptionsGlobals.MatchingThreshold) return false;
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveBinaryData exception: " + e.getMessage());
return false;
}
return true;
}
public boolean Identify(int ImageFlagsForCoding, IGreenbitLogger act) {
File file = new File(GetGreenbitDirectoryName());
String[] paths = file.list();
for (String fname :
paths) {
String[] filenameArray = fname.split("\\.");
String extension = filenameArray[filenameArray.length - 1];
if (extension.equals("gbfrsw")) {
boolean res = MatchWithTemplate(fname, ImageFlagsForCoding,
GbfrswJavaWrapperDefinesUnmatchedDataFactorInfluenceRecommended.RECOMMENDED_FOR_IDENTIFICATION,
false, act);
if (res) {
act.LogAsDialog("Identify found with file: " + fname);
return true;
}
}
}
act.LogAsDialog("Identify not found");
return false;
}
//-------------------------------------------------------------
// PNG
//-------------------------------------------------------------
/**
* @param fileName with no extension
*/
public void SaveToGallery(String fileName, IGreenbitLogger act) {
try {
// Assume block needs to be inside a Try/Catch block.
act.LogOnScreen("Storage dir: " + GetGreenbitDirectoryName());
File file = new File(GetGreenbitDirectoryName(),
fileName + ".png"); // the File to save , append increasing numeric counter to prevent files from getting overwritten.
OutputStream fOut = null;
fOut = new FileOutputStream(file);
Bitmap pictureBitmap = this.GetBmp(); // obtaining the Bitmap
pictureBitmap.compress(Bitmap.CompressFormat.PNG, 85, fOut); // saving the Bitmap to a file compressed as a JPEG with 85% compression rate
fOut.flush(); // Not really required
fOut.close(); // do not forget to close the stream
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveToGallery" + e.getMessage());
}
}
public void SaveIntoAnsiNistFile(String fileName, IGreenbitLogger act, int ImageType) {
try {
GBANJavaWrapperDefinesANStruct AnsiNistStruct;
AnsiNistStruct = new GBANJavaWrapperDefinesANStruct();
int RetVal;
/*****************************
* create ansi nist struct
*/
RetVal = GB_AcquisitionOptionsGlobals.AN2000_Jw.CreateAnsiNist(
AnsiNistStruct,
GBANJavaWrapperDefinesAnsinistVersions.VERSION_0300,
"TransType",
1,
"DestAgency",
"OrigAgency",
"TransContID0001",
"TransContRef0001",
90, 90,
"GreenbitDomain"
);
if (RetVal != GBANJavaWrapperDefinesReturnCodes.AN2K_DLL_NO_ERROR) {
throw new Exception("CreateAnsiNist: " + GB_AcquisitionOptionsGlobals.AN2000_Jw.GetLastErrorString());
}
/*******************************
* create type-14 record
*/
GBANJavaWrapperDefinesRecordStruct Record = new GBANJavaWrapperDefinesRecordStruct();
RetVal = GB_AcquisitionOptionsGlobals.AN2000_Jw.ImageToType14Record(
Record,
bytes, sx, sy,
19.5,
GBANJavaWrapperDefinesCompressionAlgorithmsStrings.COMP_NONE,
GBANJavaWrapperDefinesImpressionCodes.EFTS_14_LIVE_SCAN_PLAN,
"GreenBit Scanner", "No comment",
GBANJavaWrapperDefinesFingerPositions.EFTS_14_FGP_LEFT_INDEX,
null, null, null, null, null
);
if (RetVal != GBANJavaWrapperDefinesReturnCodes.AN2K_DLL_NO_ERROR) {
GB_AcquisitionOptionsGlobals.AN2000_Jw.FreeAnsiNistAllocatedMemory(AnsiNistStruct);
throw new Exception("ImageToType14Record: " + GB_AcquisitionOptionsGlobals.AN2000_Jw.GetLastErrorString());
}
/******************************************
* insert record into struct
*/
RetVal = GB_AcquisitionOptionsGlobals.AN2000_Jw.InsertRecordIntoAnsiNistStruct(AnsiNistStruct, Record, 1);
if (RetVal != GBANJavaWrapperDefinesReturnCodes.AN2K_DLL_NO_ERROR) {
GB_AcquisitionOptionsGlobals.AN2000_Jw.FreeAnsiNistAllocatedMemory(AnsiNistStruct);
throw new Exception("InsertRecordIntoAnsiNistStruct: " + GB_AcquisitionOptionsGlobals.AN2000_Jw.GetLastErrorString());
}
/***********************************
* Save into file
*/
GBJavaWrapperUtilByteArrayForJavaToCExchange OutBuffer = new GBJavaWrapperUtilByteArrayForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.AN2000_Jw.WriteAnsiNistToBuffer(
AnsiNistStruct,
OutBuffer
);
GB_AcquisitionOptionsGlobals.AN2000_Jw.FreeAnsiNistAllocatedMemory(AnsiNistStruct);
if (RetVal != GBANJavaWrapperDefinesReturnCodes.AN2K_DLL_NO_ERROR) {
throw new Exception("WriteAnsiNistToBuffer: " + GB_AcquisitionOptionsGlobals.AN2000_Jw.GetLastErrorString());
}
GbExampleGrayScaleBitmapClassRough.SaveGenericBinaryFile(fileName,
act, "An2000", OutBuffer.Get());
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveIntoAnsiNistFile" + e.getMessage());
}
}
public static void SaveGenericBinaryFile(String fileName, IGreenbitLogger act, String extension, byte[] BufferToSave) {
try {
// Assume block needs to be inside a Try/Catch block.
act.LogOnScreen("Storage dir: " + GetGreenbitDirectoryName());
File file = new File(GetGreenbitDirectoryName(),
fileName + "." + extension);
OutputStream fOut = null;
fOut = new FileOutputStream(file);
fOut.write(BufferToSave);
fOut.close(); // do not forget to close the stream
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveGenericBinaryFile" + e.getMessage());
}
}
//-------------------------------------------------------------
// FIR
//-------------------------------------------------------------
public void SaveToFIR(String fileName, IGreenbitLogger act) {
int RetVal;
try {
// Assume block needs to be inside a Try/Catch block.
// Create FIR record
RetVal = GB_AcquisitionOptionsGlobals.GBFIR_Jw.CreateFIR(GbfirJavaWrapperDefinesFirFormats.GBFIR_FORMAT_ISO,
31,
null, // CBEFF Product ID
0, // Capture Device ID
GbfirJavaWrapperDefinesScaleUnits.GBFIR_SU_PIXEL_PER_INCH,
500, // ScanResolutionH
500, // ScanResolutionV
500, // ImageResolutionH
500, // ImageResolutionV
8, // PixelDepth
GbfirJavaWrapperDefinesCompressionAlgorithm.GBFIR_CA_UNCOMPRESSED_NO_BIT_PACKING);
if (RetVal != GbfirJavaWrapperDefinesReturnCodes.GBFIR_RET_SUCCESS) {
throw new Exception("SaveToFIR: " + GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetLastErrorString());
}
// add Image to record
RetVal = GB_AcquisitionOptionsGlobals.GBFIR_Jw.AddImageToFIR(bytes, bytes.length, sx, sy,
1, 1, 100,
GbfirJavaWrapperDefinesFingerPositions.GBFIR_FP_UNKNOWN,
GbfirJavaWrapperDefinesImpressionTypes.GBFIR_IT_LIVE_SCAN_PLAIN);
if (RetVal != GbfirJavaWrapperDefinesReturnCodes.GBFIR_RET_SUCCESS) {
throw new Exception("SaveToFIR: " + GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetLastErrorString());
}
// write FIR to buffer
int FIRLenght = GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetFIRLen();
byte[] FIRBuffer = new byte[FIRLenght];
RetVal = GB_AcquisitionOptionsGlobals.GBFIR_Jw.WriteFIRToBuffer(FIRBuffer);
if (RetVal != GbfirJavaWrapperDefinesReturnCodes.GBFIR_RET_SUCCESS) {
throw new Exception("SaveToFIR: " + GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetLastErrorString());
}
// save FIR buffer to file
SaveGenericBinaryFile(fileName, act, "fir-iso", FIRBuffer);
// Free internal resources
GB_AcquisitionOptionsGlobals.GBFIR_Jw.FreeFIR();
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("SaveToFIR" + e.getMessage());
}
}
public boolean GBBmpFromFIRBuffer(byte[] firBuffer, boolean save, boolean isAcqRes, IGreenbitLogger act) throws Exception {
try {
///////////////////////////////
// read FIR buffer
///////////////////////////////
int RetVal = GB_AcquisitionOptionsGlobals.GBFIR_Jw.ReadFIRFromBuffer(
firBuffer, firBuffer.length, GbfirJavaWrapperDefinesFirFormats.GBFIR_FORMAT_ISO);
if (RetVal != GbfirJavaWrapperDefinesReturnCodes.GBFIR_RET_SUCCESS) {
throw new Exception("GBBmpFromFIRBuffer " +
", ReadFIRFromBuffer: " + GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetLastErrorString());
}
///////////////////////////////
// read header fields
///////////////////////////////
GBJavaWrapperUtilIntForJavaToCExchange ImageAcquisitionLevel = new GBJavaWrapperUtilIntForJavaToCExchange();
byte[] CBEFFProductId = new byte[4];
GBJavaWrapperUtilIntForJavaToCExchange CaptureDeviceID = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ScaleUnits = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ScanResolutionH = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ScanResolutionV = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ImageResolutionH = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ImageResolutionV = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange PixelDepth = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ImageCompressionAlgorithm = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetFIRHeaderFields(ImageAcquisitionLevel,
CBEFFProductId, CaptureDeviceID,
ScaleUnits, ScanResolutionH,
ScanResolutionV, ImageResolutionH,
ImageResolutionV, PixelDepth,
ImageCompressionAlgorithm);
if (RetVal != GbfirJavaWrapperDefinesReturnCodes.GBFIR_RET_SUCCESS) {
throw new Exception("GBBmpFromFIRBuffer " +
", GetFIRHeaderFields: " + GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetLastErrorString());
}
///////////////////////////////
// get number of fingers
///////////////////////////////
int NumFingers = GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetNumberOfFingers();
if (NumFingers != 0) {
// load only the first one
int Index = 0;
GBJavaWrapperUtilIntForJavaToCExchange CountView = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ViewNumber = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ImageQuality = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange FingerPosition = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ImpressionType = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetFingerRecordHeaderFields(Index, CountView,
ViewNumber, ImageQuality, FingerPosition, ImpressionType);
if (RetVal != GbfirJavaWrapperDefinesReturnCodes.GBFIR_RET_SUCCESS) {
throw new Exception("GBBmpFromFIRBuffer " +
", GetFingerRecordHeaderFields: " + GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetLastErrorString());
}
// get image size
GBJavaWrapperUtilIntForJavaToCExchange ImageBufferSize = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetFingerImageSize(Index, ImageBufferSize);
if (RetVal != GbfirJavaWrapperDefinesReturnCodes.GBFIR_RET_SUCCESS) {
throw new Exception("GBBmpFromFIRBuffer " +
", GetFingerImageSize: " + GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetLastErrorString());
}
// allocate image buffer
byte[] ImageBuffer = new byte[ImageBufferSize.Get() * (PixelDepth.Get() / 8)];
// get image buffer
GBJavaWrapperUtilIntForJavaToCExchange ImageWidth = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange ImageHeight = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetFingerImage(Index, ImageBuffer,
ImageWidth, ImageHeight);
if (RetVal != GbfirJavaWrapperDefinesReturnCodes.GBFIR_RET_SUCCESS) {
throw new Exception("GBBmpFromFIRBuffer " +
", GetFingerImage: " + GB_AcquisitionOptionsGlobals.GBFIR_Jw.GetLastErrorString());
}
// build the bitmap
this.Build(ImageBuffer, ImageWidth.Get(), ImageHeight.Get(), save, isAcqRes, act);
}
// Free internal resources
GB_AcquisitionOptionsGlobals.GBFIR_Jw.FreeFIR();
return true;
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
act.LogAsDialog(e.getMessage());
return false;
}
}
public boolean GbBmpFromFIRFile(String FIRFileName, boolean save, boolean isAcqRes, IGreenbitLogger act) throws Exception {
try {
////////////////////////////
// Load file
////////////////////////////
if (act != null) act.LogOnScreen("Storage dir: " + GetGreenbitDirectoryName());
File file = new File(GetGreenbitDirectoryName(),
FIRFileName + ".fir");
InputStream fIn = null;
fIn = new FileInputStream(file);
byte[] firStream = new byte[fIn.available()];
fIn.read(firStream);
fIn.close(); // do not forget to close the stream
String fInfo = GetGreenbitDirectoryName() + "/" + FIRFileName + " size: " + firStream.length;
if (act != null) act.LogOnScreen(fInfo);
///////////////////////////////
// convert from wsq to binary
///////////////////////////////
return GBBmpFromFIRBuffer(firStream, save, isAcqRes, act);
} catch (Exception e) {
byte[] whiteImage = {(byte) 255, (byte) 255, (byte) 255, (byte) 255};
this.Build(whiteImage, 2, 2, false, false, act);
e.printStackTrace();
act.LogAsDialog(e.getMessage());
return false;
}
}
// NFIQ
public void GetNFIQQuality(IGreenbitLogger act) {
try {
GBJavaWrapperUtilIntForJavaToCExchange V1 = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange V2 = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange V3 = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange V4 = new GBJavaWrapperUtilIntForJavaToCExchange();
int RetVal = GB_AcquisitionOptionsGlobals.GBNFIQ_Jw.GetVersion(V1, V2, V3, V4);
GBJavaWrapperUtilIntForJavaToCExchange NFIQQuality = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange MinutiaeNumber = new GBJavaWrapperUtilIntForJavaToCExchange();
// if needed, allocate minutiae array; otherwise, pass null
GbNfiqJavaWrapperDefineMinutiaeDescriptor[] MinutiaeList = new GbNfiqJavaWrapperDefineMinutiaeDescriptor[GbNfiqJavaWrapperLibrary.GBNFIQ_MAX_MINUTIAE];
for (int i = 0; i < GbNfiqJavaWrapperLibrary.GBNFIQ_MAX_MINUTIAE; i++)
MinutiaeList[i] = new GbNfiqJavaWrapperDefineMinutiaeDescriptor();
RetVal = GB_AcquisitionOptionsGlobals.GBNFIQ_Jw.GetImageQuality(bytes, sx, sy, NFIQQuality, MinutiaeNumber, MinutiaeList);
if (RetVal != GbNfiqJavaWrapperDefineReturnCodes.GBNFIQ_NO_ERROR) {
throw new Exception("GetNFIQQuality " +
", GetImageQuality: " + GB_AcquisitionOptionsGlobals.GBNFIQ_Jw.GetLastErrorString());
}
//act.LogOnScreen("NFIQ RetVal: " + RetVal );
} catch (Exception e) {
e.printStackTrace();
}
}
// NFIQ2
public void GetNFIQ2Quality(IGreenbitLogger act) {
try {
int RetVal;
Log.d("NFIQ2", "Inside GetNFIQ2Quality");
GBJavaWrapperUtilIntForJavaToCExchange NFIQ2Quality = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBNFIQ2_Jw.GetImageQuality(bytes, sx, sy, NFIQ2Quality);
if (RetVal != GbNfiq2JavaWrapperDefineReturnCodes.GBNFIQ2_NO_ERROR) {
throw new Exception("GetNFIQ2Quality " +
", GetImageQuality: " + GB_AcquisitionOptionsGlobals.GBNFIQ2_Jw.GetLastErrorString());
}
//act.LogOnScreen("NFIQ2: " + NFIQ2Quality.Value + " fine->RetVal: " + RetVal );
} catch (Exception e) {
e.printStackTrace();
}
}
// // Lfs Bozorth
// public void TestLfsBozorth(IGreenbitLogger act) {
// try {
//
// int RetVal;
//
// LfsJavaWrapperDefinesMinutiaN[] Probe = new LfsJavaWrapperDefinesMinutiaN[BozorthJavaWrapperLibrary.BOZORTH_MAX_MINUTIAE];
//
// for (int i = 0; i < BozorthJavaWrapperLibrary.BOZORTH_MAX_MINUTIAE; i++)
// Probe[i] = new LfsJavaWrapperDefinesMinutiaN();
//
// GBJavaWrapperUtilIntForJavaToCExchange MinutiaeNum = new GBJavaWrapperUtilIntForJavaToCExchange();
//
// RetVal = GB_AcquisitionOptionsGlobals.LFS_Jw.GetMinutiae(bytes, sx, sy, 8, 19.68, Probe, MinutiaeNum);
//
// if (RetVal != LfsJavaWrapperLibrary.LFS_SUCCESS) {
// throw new Exception("TestLfs" +
// ", TestLfsBozorth: " + GB_AcquisitionOptionsGlobals.LFS_Jw.GetLastErrorString());
// }
//
// GBJavaWrapperUtilIntForJavaToCExchange score = new GBJavaWrapperUtilIntForJavaToCExchange();
//
// RetVal = GB_AcquisitionOptionsGlobals.BOZORTH_Jw.bozDirectCall(200, Probe, MinutiaeNum.Value, Probe, MinutiaeNum.Value, score);
//
// if (RetVal != BozorthJavaWrapperLibrary.BOZORTH_NO_ERROR) {
// throw new Exception("TestBozorth" +
// ", TestLfsBozorth: " + GB_AcquisitionOptionsGlobals.BOZORTH_Jw.GetLastErrorString());
// }
//
// act.LogOnScreen("TestLfsBozorth: " + score.Value + " fine->RetVal: " + RetVal);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
public void EncodeToAnsi378Template(String fileName, int ImageFlags, IGreenbitLogger act) {
try {
/******************
Get Code max size
*****************/
GBJavaWrapperUtilIntForJavaToCExchange SampleCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange PackedSampleCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange TemplateCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
GBJavaWrapperUtilIntForJavaToCExchange CompactTemplateCodeSize = new GBJavaWrapperUtilIntForJavaToCExchange();
if (!InitGbfrswLibraryAndGetCodeSizeForCurrentBmp(SampleCodeSize, PackedSampleCodeSize, TemplateCodeSize, CompactTemplateCodeSize, act)) {
throw new Exception("EncodeToTemplate Error: InitGbfrswLibraryAndGetCodeSizeForCurrentBmp returned false");
}
/******************
Encode
*****************/
byte[] SampleCode = new byte[SampleCodeSize.Get()];
int RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.Coding(
this.sx, this.sy, bytes, ImageFlags,
GbfrswJavaWrapperDefinesCodingOptions.GBFRSW_OPTION_FINGERPRINT_PATTERN_CHECK,
SampleCode
);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib Coding Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
/***********************
* Enroll
**********************/
byte[] TemplateCode = new byte[TemplateCodeSize.Get()];
RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.Enroll(this.sx, this.sy,
SampleCode, TemplateCode);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib Enroll Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
/***********************
* Convert
**********************/
GBJavaWrapperUtilIntForJavaToCExchange MaxFRMLength = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.ISOGetMaxFMRLength(
this.sx, this.sy,
GbfrswJavaWrapperDefinesISOFMRFormat.GBFRSW_ISO_FMR_FORMAT_INCITS,
GbfrswJavaWrapperDefinesISOFMRGBProprietaryData.GBFRSW_ISO_FMR_GB_PROPR_DATA_NONE,
MaxFRMLength);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib ISOGetMaxFMRLength Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
byte[] FMRIsoBuffer = new byte[(MaxFRMLength.Get())];
GBJavaWrapperUtilIntForJavaToCExchange FMRBufferLen = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.GBFRSW_Jw.ISOGBTemplateToFMR(
// INPUT
TemplateCode,
this.sx, this.sy,
GbfrswJavaWrapperDefinesISOFMRFingerPositions.GBFRSW_ISO_FMR_FINGER_POS_UNKNOWN,
GbfrswJavaWrapperDefinesISOFMRFormat.GBFRSW_ISO_FMR_FORMAT_INCITS,
GbfrswJavaWrapperDefinesISOFMRGBProprietaryData.GBFRSW_ISO_FMR_GB_PROPR_DATA_NONE,
// OUTPUT
FMRIsoBuffer,
FMRBufferLen
);
if (RetVal == GbfrswJavaWrapperDefinesReturnCodes.GBFRSW_ERROR) {
throw new Exception("Gbfrswlib ISOGBTemplateToFMR Error : " + GB_AcquisitionOptionsGlobals.GBFRSW_Jw.GetLastErrorString());
}
/*******************
* Save To File
******************/
act.LogOnScreen("Saving image as ANSI 378 template; Storage dir: " + GetGreenbitDirectoryName() +
", len = " + bytes.length);
File file = new File(GetGreenbitDirectoryName(),
fileName + ".ansi378");
OutputStream fOut = null;
fOut = new FileOutputStream(file);
fOut.write(FMRIsoBuffer);
fOut.close(); // do not forget to close the stream
} catch (Exception e) {
e.printStackTrace();
act.LogAsDialog("EncodeToAnsi378Template exception: " + e.getMessage());
}
}
public void EncodeToLFSMinutiae(String fileName, int ImageFlags, IGreenbitLogger act) throws Exception {
int RetVal;
/******************
Get minutiae
*****************/
LfsJavaWrapperDefinesMinutiaN[] Probe = new LfsJavaWrapperDefinesMinutiaN[BozorthJavaWrapperLibrary.BOZORTH_MAX_MINUTIAE];
LfsJavaWrapperDefinesMinutia[] Probe1 = new LfsJavaWrapperDefinesMinutia[BozorthJavaWrapperLibrary.BOZORTH_MAX_MINUTIAE];
for (int i = 0; i < BozorthJavaWrapperLibrary.BOZORTH_MAX_MINUTIAE; i++)
Probe[i] = new LfsJavaWrapperDefinesMinutiaN();
GBJavaWrapperUtilIntForJavaToCExchange MinutiaeNum = new GBJavaWrapperUtilIntForJavaToCExchange();
RetVal = GB_AcquisitionOptionsGlobals.LFS_Jw.GetMinutiae(bytes, sx, sy, 8, 19.68, Probe1, MinutiaeNum);
if (RetVal != LfsJavaWrapperLibrary.LFS_SUCCESS) {
throw new Exception("EncodeToLfsMinutiae" +
", EncodeToLfsMinutiae: " + GB_AcquisitionOptionsGlobals.LFS_Jw.GetLastErrorString());
}
/*******************
* Save To File
******************/
act.LogOnScreen("Saving image as ANSI 378 template; Storage dir: " + GetGreenbitDirectoryName() +
", len = " + bytes.length);
File file = new File(GetGreenbitDirectoryName(),
fileName + ".lfs");
OutputStream fOut = new FileOutputStream(file);
Log.d("Fingerprint", "Probe size = " + Probe.length);
// fOut.write(serializeMinutiaeBuffer(Probe)); // check this line out
fOut.write(serializeMinutiaeBuffer(Probe)); // check this line out
fOut.flush();
fOut.close(); // do not forget to close the stream
Log.d("Fingerprint", "Closed successfully");
}
private byte[] serializeMinutiaeBuffer(LfsJavaWrapperDefinesMinutiaN[] MinutiaeArrayToSerialize) throws IOException, ClassNotFoundException {
byte[] serializedMBuffer;
byte[] deSerializedMBuffer = new byte[1024];
ObjectOutputStream out = null;
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
out = new ObjectOutputStream(bos);
for (LfsJavaWrapperDefinesMinutiaN lfsJavaWrapperDefinesMinutiaN : MinutiaeArrayToSerialize) {
out.writeObject(lfsJavaWrapperDefinesMinutiaN);
}
//out.flush();
serializedMBuffer = bos.toByteArray();
// serializedMBuffer = bos.toByteArray();
bos.write(serializedMBuffer);
//deserialize
//LfsJavaWrapperDefinesMinutiaN lfsJavaWrapperDefinesMinutiaN = new LfsJavaWrapperDefinesMinutiaN();
Object obj;
// Reading the object from a file
FileInputStream file = new FileInputStream("Template_a0_0.lfs");
ObjectInputStream in = new ObjectInputStream(file);
// Method for deserialization of object
obj = in.readObject();
in.close();
file.close();
// compare
if (serializedMBuffer.equals(obj)) {
Log.d("Fingerprint", "It is the same");
} else {
Log.d("Fingerprint", "NOT the same");
}
}
return serializedMBuffer;
}
private byte[] SerializeMinutiaeBuffer(LfsJavaWrapperDefinesMinutiaN[] MinutiaeArrayToSerialize) {
// //deserialize
Log.d("Fingerprint", "Starts here");
LfsJavaWrapperDefinesMinutiaN[] minutiaeArrayToSerialize = SerializationUtils.deserialize(SerializationUtils.serialize(MinutiaeArrayToSerialize));
Log.d("Fingerprint", "Reached here");
//
// // compare
if (Arrays.equals(minutiaeArrayToSerialize, MinutiaeArrayToSerialize)) {
Log.d("Fingerprint", "It is the same");
} else {
Log.d("Fingerprint", "NOT the same");
}
return SerializationUtils.serialize(MinutiaeArrayToSerialize);
}
} | [
"[email protected]"
] | |
41805b78cae03bc4eb265b9be4c9b75186c8bb22 | dd7d5c97e11107345aece2daa4f6da4a2d289b20 | /src/main/java/com/springbootdemo/service/UserService.java | 9ae3567103577b67b7f09a598086c8a2bf8653ff | [] | no_license | jb-stephenson/spring-boot-tutorial | b05ac248aaae84dd84005311afed8e714af3344d | 19b8f694ea35e110ed3bd6aefe01b6b6eb46eca7 | refs/heads/master | 2022-12-08T18:06:47.221751 | 2020-08-27T21:14:30 | 2020-08-27T21:14:30 | 287,362,555 | 0 | 0 | null | 2020-08-31T20:31:42 | 2020-08-13T19:21:31 | Java | UTF-8 | Java | false | false | 2,543 | java | package com.springbootdemo.service;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import com.springbootdemo.model.dto.SpringUser;
import com.springbootdemo.model.entity.SiteUser;
import com.springbootdemo.model.entity.TokenType;
import com.springbootdemo.model.entity.VerificationToken;
import com.springbootdemo.model.repository.UserServiceDao;
import com.springbootdemo.model.repository.VerificationDao;
@Service
public class UserService implements UserDetailsService{
@Autowired
private UserServiceDao userDao;
@Autowired
private VerificationDao verificationDao;
public void register(SiteUser user)
{
user.setRole("ROLE_USER");
userDao.save(user);
}
public void save(SiteUser user)
{
userDao.save(user);
}
@Override
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException
{
SiteUser user = userDao.findByEmail(email);
if(user == null) {
return null;
}
List<GrantedAuthority> auth = AuthorityUtils.commaSeparatedStringToAuthorityList(user.getRole());
String password = user.getPassword();
String firstname = user.getFirstname();
Boolean enabled = user.getEnabled();
return new SpringUser(firstname, email, password, enabled, true, true, true, auth);
}
public String createEmailVerificationToken(SiteUser user)
{
VerificationToken token = new VerificationToken(UUID.randomUUID().toString(), user, TokenType.REGISTRATION);
verificationDao.save(token);
return token.getToken();
}
public VerificationToken getVerificationToken(String token)
{
return verificationDao.findByToken(token);
}
public void deleteToken(VerificationToken token) {
verificationDao.delete(token);
}
public SiteUser get(String email) {
return userDao.findByEmail(email);
}
public Optional<SiteUser> get(Long id) {
return userDao.findById(id);
}
public String getUserName(Long chatWithUserId) {
Optional<SiteUser> userOptional = userDao.findById(chatWithUserId);
SiteUser user = userOptional.get();
return user.getFirstname() + " " + user.getSurname();
}
}
| [
"[email protected]"
] | |
bf88d80f3aafe57b2bdb4eed0077220b62348209 | 6da3e449ca48ce0bb90d1d95d74f34f65620f0c2 | /src/test/java/com/dongdong/spring/test/sort3/test/unit04/MaxOneBorderSize.java | 20fd3945afee862b90626a85b3227a3869ccd3a7 | [] | no_license | PangDongdon/spring-study | 44ae036f6bc1b948ffdd45f9f49590476f439597 | 8b504669da85b9be6c8c18548a05cb86174c3da8 | refs/heads/master | 2023-04-13T23:33:28.869563 | 2023-04-09T08:09:00 | 2023-04-09T08:09:00 | 207,733,588 | 0 | 0 | null | 2022-06-29T17:38:27 | 2019-09-11T05:52:20 | Java | UTF-8 | Java | false | false | 1,921 | java | package com.dongdong.spring.test.sort3.test.unit04;
public class MaxOneBorderSize {
public static int getMaxSize(int[][] m){
if(m==null){
return 0;
}
int[][] right=new int[m.length][m[0].length];
int[][] down=new int[m.length][m[0].length];
sortBoderMap(m,right,down);
for(int size=Math.min(m.length,m[0].length);size>-1;size--){
if(hasSizeOfBorder(size,right,down)){
return size;
}
}
return 0;
}
private static boolean hasSizeOfBorder(int size, int[][] right, int[][] down) {
for(int i=0;i<right.length;i++){
for(int j=0;j<right[0].length;j++){
if(right[i][j]>=size && down[i][j]>=size
&& right[i+size-1][j]>=size && down[i][j+size-1]>=size){
return true;
}
}
}
return false;
}
private static void sortBoderMap(int[][] m, int[][] right, int[][] down) {
int r=m.length;
int c=m[0].length;
if(m[r-1][c-1]==1){
right[r-1][c-1]=1;
down[r-1][c-1]=1;
}
for(int i=r-2;i>-1;i--){
if(m[i][c-1]==1){
right[i][c-1]=1;
down[i][c-1]=down[i+1][c-1]+1;
}
}
for(int i=c-2;i>-1;i--){
if(m[r-1][i]==1){
down[r-1][i]=1;
right[r-1][i]=right[i+1][c-1]+1;
}
}
for(int i=r-2;i>-1;i--){
for(int j=c-2;j>-1;j--){
if(m[i][j]==1){
down[i][j]=down[i+1][j]+1;
right[i][j]=right[i][j+1]+1;
}
}
}
}
public static void main(String[] args) {
int[][] matrix = {{1, 1 ,1},{0 ,1 ,0 },{0, 0 ,1}};
System.out.println(getMaxSize(matrix));
}
}
| [
"pdd123456"
] | pdd123456 |
2087f43af9435e42227add07b93c9b821ed5efb7 | f9779e3a81028cc29b9e25e336bbfe3aec59e80a | /Field.java | 803450ba92be6f598b892c36e567314e91caee2a | [] | no_license | TianweiOwenLi/Calculator_1 | a4129a939117c20bd4efd7fa97b899073f4f2706 | f8989cfd43d9b1a3a1c83f728276e8f19790bd7a | refs/heads/master | 2021-07-08T03:33:51.831668 | 2017-10-03T20:35:30 | 2017-10-03T20:35:30 | 105,579,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,385 | java | package calculator;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import acm.graphics.*;
public class Field extends JFrame{
private static Field f = new Field();
private static GCanvas c = new GCanvas();
private static JLabel lbl = new JLabel(), xt = new JLabel("< x <"), yt = new JLabel("< y <");
private static JTextField txt = new JTextField(), val = new JTextField(), xt1 = new JTextField(), xt2 = new JTextField(), yt1 = new JTextField(), yt2 = new JTextField();
private static String t, v;
private static GRect paper = new GRect(0, 0, 399, 400), bar = new GRect(0, 400, 400, 50);
private static JButton clear = new JButton("REL"), refresh = new JButton("GPH");
private static GLine x_axis = new GLine(0, 200, 399, 200), y_axis = new GLine(200, 0, 200, 399);
private static double low_x = -6, high_x = 6, low_y = -6, high_y = 6;
//For initializing the calculator.
private static void init(){
//Initializing an object of Field. Note that it is extended to JFrame so following operations are valid.
f.setVisible(true);
f.setBounds(600, 200, 400, 620);
f.setDefaultCloseOperation(EXIT_ON_CLOSE);
f.setTitle("CALCULATOR");
f.setResizable(false);
//Add the "<x<", "<y<" to canvas.
xt.setBounds(160, 412, 50, 25);
c.add(xt);
yt.setBounds(300, 412, 50, 25);
c.add(yt);
//Add canvas to Field object f.
c.setBackground(Color.GRAY);
f.add(c);
//Add an output label to canvas.
lbl.setOpaque(true);
lbl.setBackground(Color.getHSBColor(0.5f, 0.3f, 0.95f)); //I like this color very much. Don't change it.
lbl.setBounds(20, 470, 360, 25);
c.add(lbl);
//Add all text-fields to canvas. Initial text is automatically generated.
add(txt, 16, 510, 368, 32, "//Insert a function.");
add(val, 16, 550, 368, 32, "//Insert a value.");
add(xt1, 110, 410, 50, 32, low_x);
add(xt2, 200, 410, 50, 32, high_x);
add(yt1, 250, 410, 50, 32, low_y);
add(yt2, 340, 410, 50, 32, high_y);
//Initializing the GRect object "paper". This works as a small "canvas" within the calculator.
paper.setFilled(true);
paper.setFillColor(Color.WHITE);
paper.setColor(Color.WHITE);
c.add(paper);
//In order to make the calculator look awesome, I added a colored bar on the upper edge of input sections.
bar.setFilled(true);
bar.setFillColor(Color.LIGHT_GRAY);
bar.setColor(Color.LIGHT_GRAY);
c.add(bar);
//Add x and y axis to canvas.
x_axis.setColor(Color.RED);
y_axis.setColor(Color.RED);
c.add(x_axis);
c.add(y_axis);
//Set locations of two buttons.
clear.setBounds(5, 409, 45, 35);
refresh.setBounds(55, 409, 45, 35);
//Add action listener for one button.
clear.addActionListener(new ActionListener(){
//This will remove all components on the canvas and reload them back, but function graphs will disappear.s
public void actionPerformed(ActionEvent e){
c.removeAll();
reload();
}
});
//Add action listener for another button.
refresh.addActionListener(new ActionListener(){
//This will update the bounds of graph, re-generate x and y axis according to this, and repaint the graph according to new bounds.
public void actionPerformed(ActionEvent e) {
//If no bounds are empty, they'll be updated.
if(!(xt1.getText().trim().equals("") || xt2.getText().trim().equals("") || yt1.getText().trim().equals("") || yt2.getText().trim().equals(""))){
low_x = new Double(xt1.getText()).doubleValue();
high_x = new Double(xt2.getText()).doubleValue();
low_y = new Double(yt1.getText()).doubleValue();
high_y = new Double(yt2.getText()).doubleValue();
}
//Reload all components and re-graph the function.
reload();
graph(txt.getText());
}
});
//Add two buttons to canvas.
c.add(clear);
c.add(refresh);
}
//Reloading the components in calculator.
private static void reload(){
f.add(c);
c.add(xt);
c.add(yt);
c.add(paper);
c.add(bar);
c.add(clear);
c.add(refresh);
c.add(lbl);
c.add(x_axis);
c.add(y_axis);
add(txt, 16, 510, 368, 32, txt.getText());
add(val, 16, 550, 368, 32, val.getText());
add(xt1, 110, 410, 50, 32);
add(xt2, 200, 410, 50, 32);
add(yt1, 250, 410, 50, 32);
add(yt2, 340, 410, 50, 32);
set_XY();
}
//Add a text-field to canvas.
private static void add(JTextField txt, int a, int b, int w, int h, String str){
txt.setBounds(a, b, w, h);
txt.setText(str);
c.add(txt);
}
//Add a text-field to canvas.
private static void add(JTextField txt, int a, int b, int w, int h, double d){
txt.setBounds(a, b, w, h);
txt.setText(new Double(d).toString());
c.add(txt);
}
//Add a text-field to canvas.
private static void add(JTextField txt, int a, int b, int w, int h){
txt.setBounds(a, b, w, h);
c.add(txt);
}
//Sets the location of X and Y axis.
private static void set_XY(){
//If x-axis should appear, draw x-axis.
if(low_y*high_y <= 0){
x_axis.setVisible(true);
x_axis.setStartPoint(0, high_y*(400/(high_y-low_y)));
x_axis.setEndPoint(399, high_y*(400/(high_y-low_y)));
}else
x_axis.setVisible(false); //Else, x-axis will not appear.
//If y-axis should appear, draw y-axis.
if(low_x*high_x <= 0){
y_axis.setVisible(true);
y_axis.setStartPoint(-low_x*(400/(high_x-low_x)),0);
y_axis.setEndPoint(-low_x*(400/(high_x-low_x)),399);
}else
y_axis.setVisible(false); //Else, y-axis will not appear.
}
//Graphs a function according to input string. It is drawn by connecting a large number of straight lines.
private static void graph(String f){
//Get rid of notation parts in f(x).
if(f.indexOf("//") != -1)
f = f.substring(0, f.indexOf("//"));
//Will not graph if f(x) is invalid.
if(!f.equals("")){
//Draw lines that have locations ranging from 0 to 400.
for(int i=0;i<399;i++){
//Calculate x values.
double a = Fx.evaluate(f, low_x+(high_x-low_x)*i/400), b = Fx.evaluate(f, low_x+(high_x-low_x)*(i+1)/400);
//This shows if a section of the function is completely out of bounds.
boolean no = (a >= high_y|| a <= low_y)&&(b >= high_y|| b <= low_y);
//If one line is partially out of bounds, it is drawn to the bounds.
if(a >= high_y)
a = high_y;
if(a <= low_y)
a = low_y;
if(b >= high_y)
b = high_y;
if(b <= low_y)
b = low_y;
//Convert y value into actual position.
a = (high_y-a)*400/(high_y-low_y);
b = (high_y-b)*400/(high_y-low_y);
GLine l = new GLine(i, a, i+1, b);
l.setColor(Color.BLUE);
//If one line is completely out of bounds, it will not appear.
if(no)
l.setVisible(false);
//Draw the line.
c.add(l);
}
}
}
public static void main(String[] args) {
//initialize.
init();
while(true){
//Get the input text of two text-fields.
t = txt.getText();
v = val.getText();
//For getting rid of non-executive notations, such as this sentence.
if(t.indexOf("//") != -1)
t = t.substring(0, t.indexOf("//"));
if(v.indexOf("//") != -1)
v = v.substring(0, v.indexOf("//"));
//Evaluate according to x.
if(!(txt.hasFocus()||val.hasFocus()||t.equals("")||v.equals("")||refresh.hasFocus())){
lbl.setText("f(x) = "+m.round((Fx.evaluate(t, Fx.evaluate(v, 0))),6));
}
}
}
}
| [
"[email protected]"
] | |
899669344c4fea5b656b5f844c9d5815690b28d6 | ca316c288946e18e17ca4d2d3358431b9c038a5e | /Java-Basics/Java-Basics-Homeworks/Java-Syntax-Homework/src/CountOfBitPairs.java | 72c7abd05ee40224f32ca5847f03f07b4bc11e7c | [] | no_license | vnnikolov/SoftUni | ffd8825d57eb6c62e356c902800ab49ec1197467 | 4433585157da1e3275e220847ec9b96b0806d6ee | refs/heads/master | 2021-05-27T07:08:33.805736 | 2014-10-02T09:14:07 | 2014-10-02T09:14:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 547 | java | import java.util.Scanner;
public class CountOfBitPairs {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
char[] bits = Integer.toBinaryString(n).toCharArray();
int equalBitsCounter = 0;
while (n != 0) {
int twoBitsValue = n & 3;
if (twoBitsValue == 0 || twoBitsValue == 3) {
equalBitsCounter++;
}
n >>>= 1;
}
System.out.println(equalBitsCounter);
}
}
| [
"[email protected]"
] | |
89e71d6ddc636867f1f609bfc42acb5d377ac51f | c51e0e82ebc20126cb3ed95129c2eb46568870db | /Angiev1/src/modelo/omeOperacionMonedaExtranjera/datos/CDCambioDia.java | 9034af0efee3ec0b41840964100285e368df3c5d | [] | no_license | lu1sm1gu3l/SysSilvestre | 98cee22df0047ec203759e1126af121c1a6794be | 6304458adc28670b9f2947ef7a83be448f2fe1fe | refs/heads/master | 2021-01-16T23:19:34.708621 | 2016-06-23T03:57:24 | 2016-06-23T03:57:24 | 61,769,001 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,480 | java | package modelo.omeOperacionMonedaExtranjera.datos;
import controller.acceso.ConexionBD;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import modelo.omeOperacionMonedaExtranjera.entidad.CECambioDia;
public class CDCambioDia
{
public static List<CECambioDia> consultarListaTipoCambioDia(int pcns,String pFecha,int IdMoneda)
{
Connection conexion = ConexionBD.obtenerConexion();
try
{
List<CECambioDia> oLstTipoCambioDia = new ArrayList<CECambioDia>();
String sql="{call OMESPRCNSCambioDia("+pcns+",'"+pFecha+"',"+IdMoneda+")}";
Statement sentencia=conexion.createStatement();
ResultSet rs=sentencia.executeQuery(sql);
if (rs!=null)
{
while(rs.next())
{
CECambioDia oCECambioDia=new CECambioDia();
oCECambioDia.setIdCambioDia(rs.getInt(1));
oCECambioDia.setIdMoneda(rs.getInt(2));
oCECambioDia.setMontoCompraMN(rs.getFloat(3));
oCECambioDia.setMontoVentaMN(rs.getFloat(4));
oCECambioDia.setMontoCompraDolar(rs.getFloat(5));
oCECambioDia.setMontoVentaDolar(rs.getFloat(6));
oCECambioDia.setFecha(rs.getString(7));
oCECambioDia.setIdUsuario(rs.getInt(8));
oCECambioDia.setMoneda(rs.getString(9));
oLstTipoCambioDia.add(oCECambioDia);
}
return oLstTipoCambioDia;
}
return null;
}
catch (SQLException e)
{
System.out.print(e);
return null;
}
catch (Exception e)
{
System.out.print(e);
return null;
}
finally
{
try
{
conexion.close();
}
catch (SQLException ex)
{
System.out.print("No se puede cerrar la conexion");
}
}
}
public static int INSUPDTipoCambioDia(CECambioDia oCETipoCambioDia ,int accioabm )
{
Connection conexion;
conexion = ConexionBD.obtenerConexion();
try
{
CallableStatement sentenciaABM;
conexion.setAutoCommit(false);
conexion.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
String sql= "{call OMESPRINSUPDCambioDia(?,?,?,?,?,?,?,?)}";
sentenciaABM = conexion.prepareCall(sql);
sentenciaABM.setFloat(1, oCETipoCambioDia.getMontoCompraMN());
sentenciaABM.setFloat(2, oCETipoCambioDia.getMontoVentaMN());
sentenciaABM.setFloat(3, oCETipoCambioDia.getMontoCompraDolar());
sentenciaABM.setFloat(4, oCETipoCambioDia.getMontoVentaDolar());
sentenciaABM.setInt(5, oCETipoCambioDia.getIdMoneda());
sentenciaABM.setInt(6, oCETipoCambioDia.getIdUsuario());
sentenciaABM.setInt(7, accioabm);
sentenciaABM.setLong(8, oCETipoCambioDia.getIdCambioDia());
sentenciaABM.executeUpdate();
conexion.commit();
return 1;
}
catch (Exception e)
{
System.out.print(e);
try
{
conexion.rollback();
}
catch(SQLException sqlExcep)
{
sqlExcep.printStackTrace();
}
return 0;
}
finally
{
try
{
conexion.close();
}
catch(SQLException e)
{
System.out.print(e);
}
}
}
public static int DELCambioDia(long idCambioDia)
{
Connection conexion;
conexion = ConexionBD.obtenerConexion();
try
{
CallableStatement sentenciaABM;
conexion.setAutoCommit(false);
conexion.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
String sql= "{call OMESPRDELCambioDia(?)}";
sentenciaABM = conexion.prepareCall(sql);
sentenciaABM.setLong(1, idCambioDia);
sentenciaABM.executeUpdate();
conexion.commit();
return 1;
}
catch (Exception e)
{
System.out.print(e);
try
{
conexion.rollback();
}
catch(SQLException sqlExcep)
{
sqlExcep.printStackTrace();
}
return 0;
}
finally
{
try
{
conexion.close();
}
catch(SQLException e)
{
System.out.print(e);
}
}
}
}
| [
"[email protected]"
] | |
540acfa28f7df847164a910406828debcf8bc191 | 51aaf794ce94491a53724371290786f15abb29b0 | /mall-manager-web/src/main/java/com/lwhtarena/taotaomall/controller/ContentController.java | 955b3d57efa818201e45f53b586c9af9b1f3a9e6 | [] | no_license | weslywang/taotaomall | df91a922ac3d94cf6710ac663a680082aedebaf7 | e40ca5e50eab991725a3da2c6eb1e766b1bfcb27 | refs/heads/master | 2020-12-26T19:52:42.109825 | 2019-07-10T15:32:09 | 2019-07-10T15:32:09 | 237,622,345 | 1 | 0 | null | 2020-02-01T13:56:28 | 2020-02-01T13:56:27 | null | UTF-8 | Java | false | false | 962 | java | package com.lwhtarena.taotaomall.controller;
import com.lwhtarena.taotaomall.pojo.TbContent;
import com.lwhtarena.taotaomall.common.pojo.TaotaoResult;
import com.lwhtarena.taotaomall.service.ContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @author lwh
* @folder com.lwhtarena.taotaomall.controller
* @date 2016/12/8.
* @版权 Copyright (c) 2016 lwhtarena.com. All Rights Reserved.
* <p>内容管理</p>
*/
@Controller
@RequestMapping("/content")
public class ContentController {
@Autowired
private ContentService contentService;
@RequestMapping("/save")
@ResponseBody
public TaotaoResult insertContent(TbContent content){
TaotaoResult result =contentService.insertContent(content);
return result;
}
}
| [
"[email protected]"
] | |
1cff22c35ad781cabfa57c67b34df9e2a5883bea | cd9a2f19fe97dfebdc646becdf7ae7e5ce476123 | /spring-jms/src/main/java/org/springframework/jms/listener/DefaultMessageListenerContainer.java | 103555490d286ca1325220ea93f05cf61fa1b7fd | [] | no_license | nicky-chen/spring-framework-3.2.x | d5f0fae80847da4f303f94443ce46cd92352979a | e33e9639d82aa9395509227567aa714d41ac2a2b | refs/heads/master | 2021-08-29T00:54:28.870499 | 2021-08-17T11:28:08 | 2021-08-17T11:28:08 | 125,344,623 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44,580 | java | /*
* Copyright 2002-2015 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.jms.listener;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Executor;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.Session;
import org.springframework.core.Constants;
import org.springframework.core.task.SimpleAsyncTaskExecutor;
import org.springframework.core.task.TaskExecutor;
import org.springframework.jms.JmsException;
import org.springframework.jms.support.JmsUtils;
import org.springframework.jms.support.destination.CachingDestinationResolver;
import org.springframework.jms.support.destination.DestinationResolver;
import org.springframework.scheduling.SchedulingAwareRunnable;
import org.springframework.scheduling.SchedulingTaskExecutor;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
/**
* Message listener container variant that uses plain JMS client APIs, specifically
* a loop of {@code MessageConsumer.receive()} calls that also allow for
* transactional reception of messages (registering them with XA transactions).
* Designed to work in a native JMS environment as well as in a J2EE environment,
* with only minimal differences in configuration.
*
* <p>This is a simple but nevertheless powerful form of message listener container.
* On startup, it obtains a fixed number of JMS Sessions to invoke the listener,
* and optionally allows for dynamic adaptation at runtime (up to a maximum number).
* Like {@link SimpleMessageListenerContainer}, its main advantage is its low level
* of runtime complexity, in particular the minimal requirements on the JMS provider:
* not even the JMS {@code ServerSessionPool} facility is required. Beyond that, it is
* fully self-recovering in case the broker is temporarily unavailable, and allows
* for stops/restarts as well as runtime changes to its configuration.
*
* <p>Actual {@code MessageListener} execution happens in asynchronous work units which are
* created through Spring's {@link org.springframework.core.task.TaskExecutor TaskExecutor}
* abstraction. By default, the specified number of invoker tasks will be created
* on startup, according to the {@link #setConcurrentConsumers "concurrentConsumers"}
* setting. Specify an alternative {@code TaskExecutor} to integrate with an existing
* thread pool facility (such as a J2EE server's), for example using a
* {@link org.springframework.scheduling.commonj.WorkManagerTaskExecutor CommonJ WorkManager}.
* With a native JMS setup, each of those listener threads is going to use a
* cached JMS {@code Session} and {@code MessageConsumer} (only refreshed in case
* of failure), using the JMS provider's resources as efficiently as possible.
*
* <p>Message reception and listener execution can automatically be wrapped
* in transactions by passing a Spring
* {@link org.springframework.transaction.PlatformTransactionManager} into the
* {@link #setTransactionManager "transactionManager"} property. This will usually
* be a {@link org.springframework.transaction.jta.JtaTransactionManager} in a
* J2EE environment, in combination with a JTA-aware JMS {@code ConnectionFactory}
* obtained from JNDI (check your J2EE server's documentation). Note that this
* listener container will automatically reobtain all JMS handles for each transaction
* in case an external transaction manager is specified, for compatibility with
* all J2EE servers (in particular JBoss). This non-caching behavior can be
* overridden through the {@link #setCacheLevel "cacheLevel"} /
* {@link #setCacheLevelName "cacheLevelName"} property, enforcing caching of
* the {@code Connection} (or also {@code Session} and {@code MessageConsumer})
* even if an external transaction manager is involved.
*
* <p>Dynamic scaling of the number of concurrent invokers can be activated
* by specifying a {@link #setMaxConcurrentConsumers "maxConcurrentConsumers"}
* value that is higher than the {@link #setConcurrentConsumers "concurrentConsumers"}
* value. Since the latter's default is 1, you can also simply specify a
* "maxConcurrentConsumers" of e.g. 5, which will lead to dynamic scaling up to
* 5 concurrent consumers in case of increasing message load, as well as dynamic
* shrinking back to the standard number of consumers once the load decreases.
* Consider adapting the {@link #setIdleTaskExecutionLimit "idleTaskExecutionLimit"}
* setting to control the lifespan of each new task, to avoid frequent scaling up
* and down, in particular if the {@code ConnectionFactory} does not pool JMS
* {@code Sessions} and/or the {@code TaskExecutor} does not pool threads (check
* your configuration!). Note that dynamic scaling only really makes sense for a
* queue in the first place; for a topic, you will typically stick with the default
* number of 1 consumer, otherwise you'd receive the same message multiple times on
* the same node.
*
* <p><b>Note: Don't use Spring's {@link org.springframework.jms.connection.CachingConnectionFactory}
* in combination with dynamic scaling.</b> Ideally, don't use it with a message
* listener container at all, since it is generally preferable to let the
* listener container itself handle appropriate caching within its lifecycle.
* Also, stopping and restarting a listener container will only work with an
* independent, locally cached Connection - not with an externally cached one.
*
* <p><b>It is strongly recommended to either set {@link #setSessionTransacted
* "sessionTransacted"} to "true" or specify an external {@link #setTransactionManager
* "transactionManager"}.</b> See the {@link AbstractMessageListenerContainer}
* javadoc for details on acknowledge modes and native transaction options, as
* well as the {@link AbstractPollingMessageListenerContainer} javadoc for details
* on configuring an external transaction manager. Note that for the default
* "AUTO_ACKNOWLEDGE" mode, this container applies automatic message acknowledgment
* before listener execution, with no redelivery in case of an exception.
*
* @author Juergen Hoeller
* @since 2.0
* @see #setTransactionManager
* @see #setCacheLevel
* @see javax.jms.MessageConsumer#receive(long)
* @see SimpleMessageListenerContainer
* @see org.springframework.jms.listener.endpoint.JmsMessageEndpointManager
*/
public class DefaultMessageListenerContainer extends AbstractPollingMessageListenerContainer {
/**
* Default thread name prefix: "DefaultMessageListenerContainer-".
*/
public static final String DEFAULT_THREAD_NAME_PREFIX =
ClassUtils.getShortName(DefaultMessageListenerContainer.class) + "-";
/**
* The default recovery interval: 5000 ms = 5 seconds.
*/
public static final long DEFAULT_RECOVERY_INTERVAL = 5000;
/**
* Constant that indicates to cache no JMS resources at all.
* @see #setCacheLevel
*/
public static final int CACHE_NONE = 0;
/**
* Constant that indicates to cache a shared JMS {@code Connection} for each
* listener thread.
* @see #setCacheLevel
*/
public static final int CACHE_CONNECTION = 1;
/**
* Constant that indicates to cache a shared JMS {@code Connection} and a JMS
* {@code Session} for each listener thread.
* @see #setCacheLevel
*/
public static final int CACHE_SESSION = 2;
/**
* Constant that indicates to cache a shared JMS {@code Connection}, a JMS
* {@code Session}, and a JMS MessageConsumer for each listener thread.
* @see #setCacheLevel
*/
public static final int CACHE_CONSUMER = 3;
/**
* Constant that indicates automatic choice of an appropriate caching level
* (depending on the transaction management strategy).
* @see #setCacheLevel
*/
public static final int CACHE_AUTO = 4;
private static final Constants constants = new Constants(DefaultMessageListenerContainer.class);
private Executor taskExecutor;
private long recoveryInterval = DEFAULT_RECOVERY_INTERVAL;
private int cacheLevel = CACHE_AUTO;
private int concurrentConsumers = 1;
private int maxConcurrentConsumers = 1;
private int maxMessagesPerTask = Integer.MIN_VALUE;
private int idleConsumerLimit = 1;
private int idleTaskExecutionLimit = 1;
private final Set<AsyncMessageListenerInvoker> scheduledInvokers = new HashSet<AsyncMessageListenerInvoker>();
private int activeInvokerCount = 0;
private int registeredWithDestination = 0;
private volatile boolean recovering = false;
private Runnable stopCallback;
private Object currentRecoveryMarker = new Object();
private final Object recoveryMonitor = new Object();
/**
* Set the Spring {@code TaskExecutor} to use for running the listener threads.
* <p>Default is a {@link org.springframework.core.task.SimpleAsyncTaskExecutor},
* starting up a number of new threads, according to the specified number
* of concurrent consumers.
* <p>Specify an alternative {@code TaskExecutor} for integration with an existing
* thread pool. Note that this really only adds value if the threads are
* managed in a specific fashion, for example within a J2EE environment.
* A plain thread pool does not add much value, as this listener container
* will occupy a number of threads for its entire lifetime.
* @see #setConcurrentConsumers
* @see org.springframework.core.task.SimpleAsyncTaskExecutor
* @see org.springframework.scheduling.commonj.WorkManagerTaskExecutor
*/
public void setTaskExecutor(Executor taskExecutor) {
this.taskExecutor = taskExecutor;
}
/**
* Specify the interval between recovery attempts, in <b>milliseconds</b>.
* The default is 5000 ms, that is, 5 seconds.
* @see #handleListenerSetupFailure
*/
public void setRecoveryInterval(long recoveryInterval) {
this.recoveryInterval = recoveryInterval;
}
/**
* Specify the level of caching that this listener container is allowed to apply,
* in the form of the name of the corresponding constant: e.g. "CACHE_CONNECTION".
* @see #setCacheLevel
*/
public void setCacheLevelName(String constantName) throws IllegalArgumentException {
if (constantName == null || !constantName.startsWith("CACHE_")) {
throw new IllegalArgumentException("Only cache constants allowed");
}
setCacheLevel(constants.asNumber(constantName).intValue());
}
/**
* Specify the level of caching that this listener container is allowed to apply.
* <p>Default is {@link #CACHE_NONE} if an external transaction manager has been specified
* (to reobtain all resources freshly within the scope of the external transaction),
* and {@link #CACHE_CONSUMER} otherwise (operating with local JMS resources).
* <p>Some J2EE servers only register their JMS resources with an ongoing XA
* transaction in case of a freshly obtained JMS {@code Connection} and {@code Session},
* which is why this listener container by default does not cache any of those.
* However, if you want to optimize for a specific server, consider switching
* this setting to at least {@link #CACHE_CONNECTION} or {@link #CACHE_SESSION}
* even in conjunction with an external transaction manager.
* @see #CACHE_NONE
* @see #CACHE_CONNECTION
* @see #CACHE_SESSION
* @see #CACHE_CONSUMER
* @see #setCacheLevelName
* @see #setTransactionManager
*/
public void setCacheLevel(int cacheLevel) {
this.cacheLevel = cacheLevel;
}
/**
* Return the level of caching that this listener container is allowed to apply.
*/
public int getCacheLevel() {
return this.cacheLevel;
}
/**
* Specify concurrency limits via a "lower-upper" String, e.g. "5-10", or a simple
* upper limit String, e.g. "10" (the lower limit will be 1 in this case).
* <p>This listener container will always hold on to the minimum number of consumers
* ({@link #setConcurrentConsumers}) and will slowly scale up to the maximum number
* of consumers {@link #setMaxConcurrentConsumers} in case of increasing load.
*/
public void setConcurrency(String concurrency) {
try {
int separatorIndex = concurrency.indexOf('-');
if (separatorIndex != -1) {
setConcurrentConsumers(Integer.parseInt(concurrency.substring(0, separatorIndex)));
setMaxConcurrentConsumers(Integer.parseInt(concurrency.substring(separatorIndex + 1, concurrency.length())));
}
else {
setConcurrentConsumers(1);
setMaxConcurrentConsumers(Integer.parseInt(concurrency));
}
}
catch (NumberFormatException ex) {
throw new IllegalArgumentException("Invalid concurrency value [" + concurrency + "]: only " +
"single maximum integer (e.g. \"5\") and minimum-maximum combo (e.g. \"3-5\") supported.");
}
}
/**
* Specify the number of concurrent consumers to create. Default is 1.
* <p>Specifying a higher value for this setting will increase the standard
* level of scheduled concurrent consumers at runtime: This is effectively
* the minimum number of concurrent consumers which will be scheduled
* at any given time. This is a static setting; for dynamic scaling,
* consider specifying the "maxConcurrentConsumers" setting instead.
* <p>Raising the number of concurrent consumers is recommendable in order
* to scale the consumption of messages coming in from a queue. However,
* note that any ordering guarantees are lost once multiple consumers are
* registered. In general, stick with 1 consumer for low-volume queues.
* <p><b>Do not raise the number of concurrent consumers for a topic,
* unless vendor-specific setup measures clearly allow for it.</b>
* With regular setup, this would lead to concurrent consumption
* of the same message, which is hardly ever desirable.
* <p><b>This setting can be modified at runtime, for example through JMX.</b>
* @see #setMaxConcurrentConsumers
*/
public void setConcurrentConsumers(int concurrentConsumers) {
Assert.isTrue(concurrentConsumers > 0, "'concurrentConsumers' value must be at least 1 (one)");
synchronized (this.lifecycleMonitor) {
this.concurrentConsumers = concurrentConsumers;
if (this.maxConcurrentConsumers < concurrentConsumers) {
this.maxConcurrentConsumers = concurrentConsumers;
}
}
}
/**
* Return the "concurrentConsumer" setting.
* <p>This returns the currently configured "concurrentConsumers" value;
* the number of currently scheduled/active consumers might differ.
* @see #getScheduledConsumerCount()
* @see #getActiveConsumerCount()
*/
public final int getConcurrentConsumers() {
synchronized (this.lifecycleMonitor) {
return this.concurrentConsumers;
}
}
/**
* Specify the maximum number of concurrent consumers to create. Default is 1.
* <p>If this setting is higher than "concurrentConsumers", the listener container
* will dynamically schedule new consumers at runtime, provided that enough
* incoming messages are encountered. Once the load goes down again, the number of
* consumers will be reduced to the standard level ("concurrentConsumers") again.
* <p>Raising the number of concurrent consumers is recommendable in order
* to scale the consumption of messages coming in from a queue. However,
* note that any ordering guarantees are lost once multiple consumers are
* registered. In general, stick with 1 consumer for low-volume queues.
* <p><b>Do not raise the number of concurrent consumers for a topic,
* unless vendor-specific setup measures clearly allow for it.</b>
* With regular setup, this would lead to concurrent consumption
* of the same message, which is hardly ever desirable.
* <p><b>This setting can be modified at runtime, for example through JMX.</b>
* @see #setConcurrentConsumers
*/
public void setMaxConcurrentConsumers(int maxConcurrentConsumers) {
Assert.isTrue(maxConcurrentConsumers > 0, "'maxConcurrentConsumers' value must be at least 1 (one)");
synchronized (this.lifecycleMonitor) {
this.maxConcurrentConsumers =
(maxConcurrentConsumers > this.concurrentConsumers ? maxConcurrentConsumers : this.concurrentConsumers);
}
}
/**
* Return the "maxConcurrentConsumer" setting.
* <p>This returns the currently configured "maxConcurrentConsumers" value;
* the number of currently scheduled/active consumers might differ.
* @see #getScheduledConsumerCount()
* @see #getActiveConsumerCount()
*/
public final int getMaxConcurrentConsumers() {
synchronized (this.lifecycleMonitor) {
return this.maxConcurrentConsumers;
}
}
/**
* Specify the maximum number of messages to process in one task.
* More concretely, this limits the number of message reception attempts
* per task, which includes receive iterations that did not actually
* pick up a message until they hit their timeout (see the
* {@link #setReceiveTimeout "receiveTimeout"} property).
* <p>Default is unlimited (-1) in case of a standard TaskExecutor,
* reusing the original invoker threads until shutdown (at the
* expense of limited dynamic scheduling).
* <p>In case of a SchedulingTaskExecutor indicating a preference for
* short-lived tasks, the default is 10 instead. Specify a number
* of 10 to 100 messages to balance between rather long-lived and
* rather short-lived tasks here.
* <p>Long-lived tasks avoid frequent thread context switches through
* sticking with the same thread all the way through, while short-lived
* tasks allow thread pools to control the scheduling. Hence, thread
* pools will usually prefer short-lived tasks.
* <p><b>This setting can be modified at runtime, for example through JMX.</b>
* @see #setTaskExecutor
* @see #setReceiveTimeout
* @see org.springframework.scheduling.SchedulingTaskExecutor#prefersShortLivedTasks()
*/
public void setMaxMessagesPerTask(int maxMessagesPerTask) {
Assert.isTrue(maxMessagesPerTask != 0, "'maxMessagesPerTask' must not be 0");
synchronized (this.lifecycleMonitor) {
this.maxMessagesPerTask = maxMessagesPerTask;
}
}
/**
* Return the maximum number of messages to process in one task.
*/
public final int getMaxMessagesPerTask() {
synchronized (this.lifecycleMonitor) {
return this.maxMessagesPerTask;
}
}
/**
* Specify the limit for the number of consumers that are allowed to be idle
* at any given time.
* <p>This limit is used by the {@link #scheduleNewInvokerIfAppropriate} method
* to determine if a new invoker should be created. Increasing the limit causes
* invokers to be created more aggressively. This can be useful to ramp up the
* number of invokers faster.
* <p>The default is 1, only scheduling a new invoker (which is likely to
* be idle initially) if none of the existing invokers is currently idle.
*/
public void setIdleConsumerLimit(int idleConsumerLimit) {
Assert.isTrue(idleConsumerLimit > 0, "'idleConsumerLimit' must be 1 or higher");
synchronized (this.lifecycleMonitor) {
this.idleConsumerLimit = idleConsumerLimit;
}
}
/**
* Return the limit for the number of idle consumers.
*/
public final int getIdleConsumerLimit() {
synchronized (this.lifecycleMonitor) {
return this.idleConsumerLimit;
}
}
/**
* Specify the limit for idle executions of a consumer task, not having
* received any message within its execution. If this limit is reached,
* the task will shut down and leave receiving to other executing tasks.
* <p>The default is 1, closing idle resources early once a task didn't
* receive a message. This applies to dynamic scheduling only; see the
* {@link #setMaxConcurrentConsumers "maxConcurrentConsumers"} setting.
* The minimum number of consumers
* (see {@link #setConcurrentConsumers "concurrentConsumers"})
* will be kept around until shutdown in any case.
* <p>Within each task execution, a number of message reception attempts
* (according to the "maxMessagesPerTask" setting) will each wait for an incoming
* message (according to the "receiveTimeout" setting). If all of those receive
* attempts in a given task return without a message, the task is considered
* idle with respect to received messages. Such a task may still be rescheduled;
* however, once it reached the specified "idleTaskExecutionLimit", it will
* shut down (in case of dynamic scaling).
* <p>Raise this limit if you encounter too frequent scaling up and down.
* With this limit being higher, an idle consumer will be kept around longer,
* avoiding the restart of a consumer once a new load of messages comes in.
* Alternatively, specify a higher "maxMessagesPerTask" and/or "receiveTimeout" value,
* which will also lead to idle consumers being kept around for a longer time
* (while also increasing the average execution time of each scheduled task).
* <p><b>This setting can be modified at runtime, for example through JMX.</b>
* @see #setMaxMessagesPerTask
* @see #setReceiveTimeout
*/
public void setIdleTaskExecutionLimit(int idleTaskExecutionLimit) {
Assert.isTrue(idleTaskExecutionLimit > 0, "'idleTaskExecutionLimit' must be 1 or higher");
synchronized (this.lifecycleMonitor) {
this.idleTaskExecutionLimit = idleTaskExecutionLimit;
}
}
/**
* Return the limit for idle executions of a consumer task.
*/
public final int getIdleTaskExecutionLimit() {
synchronized (this.lifecycleMonitor) {
return this.idleTaskExecutionLimit;
}
}
//-------------------------------------------------------------------------
// Implementation of AbstractMessageListenerContainer's template methods
//-------------------------------------------------------------------------
@Override
public void initialize() {
// Adapt default cache level.
if (this.cacheLevel == CACHE_AUTO) {
this.cacheLevel = (getTransactionManager() != null ? CACHE_NONE : CACHE_CONSUMER);
}
// Prepare taskExecutor and maxMessagesPerTask.
synchronized (this.lifecycleMonitor) {
if (this.taskExecutor == null) {
this.taskExecutor = createDefaultTaskExecutor();
}
else if (this.taskExecutor instanceof SchedulingTaskExecutor &&
((SchedulingTaskExecutor) this.taskExecutor).prefersShortLivedTasks() &&
this.maxMessagesPerTask == Integer.MIN_VALUE) {
// TaskExecutor indicated a preference for short-lived tasks. According to
// setMaxMessagesPerTask javadoc, we'll use 10 message per task in this case
// unless the user specified a custom value.
this.maxMessagesPerTask = 10;
}
}
// Proceed with actual listener initialization.
super.initialize();
}
/**
* Creates the specified number of concurrent consumers,
* in the form of a JMS Session plus associated MessageConsumer
* running in a separate thread.
* @see #scheduleNewInvoker
* @see #setTaskExecutor
*/
@Override
protected void doInitialize() throws JMSException {
synchronized (this.lifecycleMonitor) {
for (int i = 0; i < this.concurrentConsumers; i++) {
scheduleNewInvoker();
}
}
}
/**
* Destroy the registered JMS Sessions and associated MessageConsumers.
*/
@Override
protected void doShutdown() throws JMSException {
logger.debug("Waiting for shutdown of message listener invokers");
try {
synchronized (this.lifecycleMonitor) {
// Waiting for AsyncMessageListenerInvokers to deactivate themselves...
while (this.activeInvokerCount > 0) {
if (logger.isDebugEnabled()) {
logger.debug("Still waiting for shutdown of " + this.activeInvokerCount +
" message listener invokers");
}
this.lifecycleMonitor.wait();
}
// Clear remaining scheduled invokers, possibly left over as paused tasks...
for (AsyncMessageListenerInvoker scheduledInvoker : this.scheduledInvokers) {
scheduledInvoker.clearResources();
}
this.scheduledInvokers.clear();
}
}
catch (InterruptedException ex) {
// Re-interrupt current thread, to allow other threads to react.
Thread.currentThread().interrupt();
}
}
/**
* Overridden to reset the stop callback, if any.
*/
@Override
public void start() throws JmsException {
synchronized (this.lifecycleMonitor) {
this.stopCallback = null;
}
super.start();
}
/**
* Stop this listener container, invoking the specific callback
* once all listener processing has actually stopped.
* <p>Note: Further {@code stop(runnable)} calls (before processing
* has actually stopped) will override the specified callback. Only the
* latest specified callback will be invoked.
* <p>If a subsequent {@link #start()} call restarts the listener container
* before it has fully stopped, the callback will not get invoked at all.
* @param callback the callback to invoke once listener processing
* has fully stopped
* @throws JmsException if stopping failed
* @see #stop()
*/
@Override
public void stop(Runnable callback) throws JmsException {
synchronized (this.lifecycleMonitor) {
this.stopCallback = callback;
}
stop();
}
/**
* Return the number of currently scheduled consumers.
* <p>This number will always be between "concurrentConsumers" and
* "maxConcurrentConsumers", but might be higher than "activeConsumerCount"
* (in case some consumers are scheduled but not executing at the moment).
* @see #getConcurrentConsumers()
* @see #getMaxConcurrentConsumers()
* @see #getActiveConsumerCount()
*/
public final int getScheduledConsumerCount() {
synchronized (this.lifecycleMonitor) {
return this.scheduledInvokers.size();
}
}
/**
* Return the number of currently active consumers.
* <p>This number will always be between "concurrentConsumers" and
* "maxConcurrentConsumers", but might be lower than "scheduledConsumerCount"
* (in case some consumers are scheduled but not executing at the moment).
* @see #getConcurrentConsumers()
* @see #getMaxConcurrentConsumers()
* @see #getActiveConsumerCount()
*/
public final int getActiveConsumerCount() {
synchronized (this.lifecycleMonitor) {
return this.activeInvokerCount;
}
}
/**
* Return whether at least one consumer has entered a fixed registration with the
* target destination. This is particularly interesting for the pub-sub case where
* it might be important to have an actual consumer registered that is guaranteed
* not to miss any messages that are just about to be published.
* <p>This method may be polled after a {@link #start()} call, until asynchronous
* registration of consumers has happened which is when the method will start returning
* {@code true} – provided that the listener container ever actually establishes
* a fixed registration. It will then keep returning {@code true} until shutdown,
* since the container will hold on to at least one consumer registration thereafter.
* <p>Note that a listener container is not bound to having a fixed registration in
* the first place. It may also keep recreating consumers for every invoker execution.
* This particularly depends on the {@link #setCacheLevel cache level} setting:
* only {@link #CACHE_CONSUMER} will lead to a fixed registration.
*/
public boolean isRegisteredWithDestination() {
synchronized (this.lifecycleMonitor) {
return (this.registeredWithDestination > 0);
}
}
/**
* Create a default TaskExecutor. Called if no explicit TaskExecutor has been specified.
* <p>The default implementation builds a {@link org.springframework.core.task.SimpleAsyncTaskExecutor}
* with the specified bean name (or the class name, if no bean name specified) as thread name prefix.
* @see org.springframework.core.task.SimpleAsyncTaskExecutor#SimpleAsyncTaskExecutor(String)
*/
protected TaskExecutor createDefaultTaskExecutor() {
String beanName = getBeanName();
String threadNamePrefix = (beanName != null ? beanName + "-" : DEFAULT_THREAD_NAME_PREFIX);
return new SimpleAsyncTaskExecutor(threadNamePrefix);
}
/**
* Schedule a new invoker, increasing the total number of scheduled
* invokers for this listener container.
*/
private void scheduleNewInvoker() {
AsyncMessageListenerInvoker invoker = new AsyncMessageListenerInvoker();
if (rescheduleTaskIfNecessary(invoker)) {
// This should always be true, since we're only calling this when active.
this.scheduledInvokers.add(invoker);
}
}
/**
* Use a shared JMS Connection depending on the "cacheLevel" setting.
* @see #setCacheLevel
* @see #CACHE_CONNECTION
*/
@Override
protected final boolean sharedConnectionEnabled() {
return (getCacheLevel() >= CACHE_CONNECTION);
}
/**
* Re-executes the given task via this listener container's TaskExecutor.
* @see #setTaskExecutor
*/
@Override
protected void doRescheduleTask(Object task) {
this.taskExecutor.execute((Runnable) task);
}
/**
* Tries scheduling a new invoker, since we know messages are coming in...
* @see #scheduleNewInvokerIfAppropriate()
*/
@Override
protected void messageReceived(Object invoker, Session session) {
((AsyncMessageListenerInvoker) invoker).setIdle(false);
scheduleNewInvokerIfAppropriate();
}
/**
* Marks the affected invoker as idle.
*/
@Override
protected void noMessageReceived(Object invoker, Session session) {
((AsyncMessageListenerInvoker) invoker).setIdle(true);
}
/**
* Schedule a new invoker, increasing the total number of scheduled
* invokers for this listener container, but only if the specified
* "maxConcurrentConsumers" limit has not been reached yet, and only
* if the specified "idleConsumerLimit" has not been reached either.
* <p>Called once a message has been received, in order to scale up while
* processing the message in the invoker that originally received it.
* @see #setTaskExecutor
* @see #getMaxConcurrentConsumers()
* @see #getIdleConsumerLimit()
*/
protected void scheduleNewInvokerIfAppropriate() {
if (isRunning()) {
resumePausedTasks();
synchronized (this.lifecycleMonitor) {
if (this.scheduledInvokers.size() < this.maxConcurrentConsumers &&
getIdleInvokerCount() < this.idleConsumerLimit) {
scheduleNewInvoker();
if (logger.isDebugEnabled()) {
logger.debug("Raised scheduled invoker count: " + this.scheduledInvokers.size());
}
}
}
}
}
/**
* Determine whether the current invoker should be rescheduled,
* given that it might not have received a message in a while.
* @param idleTaskExecutionCount the number of idle executions
* that this invoker task has already accumulated (in a row)
*/
private boolean shouldRescheduleInvoker(int idleTaskExecutionCount) {
boolean superfluous =
(idleTaskExecutionCount >= this.idleTaskExecutionLimit && getIdleInvokerCount() > 1);
return (this.scheduledInvokers.size() <=
(superfluous ? this.concurrentConsumers : this.maxConcurrentConsumers));
}
/**
* Determine whether this listener container currently has more
* than one idle instance among its scheduled invokers.
*/
private int getIdleInvokerCount() {
int count = 0;
for (AsyncMessageListenerInvoker invoker : this.scheduledInvokers) {
if (invoker.isIdle()) {
count++;
}
}
return count;
}
/**
* Overridden to accept a failure in the initial setup - leaving it up to the
* asynchronous invokers to establish the shared Connection on first access.
* @see #refreshConnectionUntilSuccessful()
*/
@Override
protected void establishSharedConnection() {
try {
super.establishSharedConnection();
}
catch (Exception ex) {
if (ex instanceof JMSException) {
invokeExceptionListener((JMSException) ex);
}
logger.debug("Could not establish shared JMS Connection - " +
"leaving it up to asynchronous invokers to establish a Connection as soon as possible", ex);
}
}
/**
* This implementations proceeds even after an exception thrown from
* {@code Connection.start()}, relying on listeners to perform
* appropriate recovery.
*/
@Override
protected void startSharedConnection() {
try {
super.startSharedConnection();
}
catch (Exception ex) {
logger.debug("Connection start failed - relying on listeners to perform recovery", ex);
}
}
/**
* This implementations proceeds even after an exception thrown from
* {@code Connection.stop()}, relying on listeners to perform
* appropriate recovery after a restart.
*/
@Override
protected void stopSharedConnection() {
try {
super.stopSharedConnection();
}
catch (Exception ex) {
logger.debug("Connection stop failed - relying on listeners to perform recovery after restart", ex);
}
}
/**
* Handle the given exception that arose during setup of a listener.
* Called for every such exception in every concurrent listener.
* <p>The default implementation logs the exception at warn level
* if not recovered yet, and at debug level if already recovered.
* Can be overridden in subclasses.
* @param ex the exception to handle
* @param alreadyRecovered whether a previously executing listener
* already recovered from the present listener setup failure
* (this usually indicates a follow-up failure than can be ignored
* other than for debug log purposes)
* @see #recoverAfterListenerSetupFailure()
*/
protected void handleListenerSetupFailure(Throwable ex, boolean alreadyRecovered) {
if (ex instanceof JMSException) {
invokeExceptionListener((JMSException) ex);
}
if (ex instanceof SharedConnectionNotInitializedException) {
if (!alreadyRecovered) {
logger.info("JMS message listener invoker needs to establish shared Connection");
}
}
else {
// Recovery during active operation..
if (alreadyRecovered) {
logger.debug("Setup of JMS message listener invoker failed - already recovered by other invoker", ex);
}
else {
StringBuilder msg = new StringBuilder();
msg.append("Setup of JMS message listener invoker failed for destination '");
msg.append(getDestinationDescription()).append("' - trying to recover. Cause: ");
msg.append(ex instanceof JMSException ? JmsUtils.buildExceptionMessage((JMSException) ex) : ex.getMessage());
if (logger.isDebugEnabled()) {
logger.warn(msg, ex);
}
else {
logger.warn(msg);
}
}
}
}
/**
* Recover this listener container after a listener failed to set itself up,
* for example re-establishing the underlying Connection.
* <p>The default implementation delegates to DefaultMessageListenerContainer's
* recovery-capable {@link #refreshConnectionUntilSuccessful()} method, which will
* try to re-establish a Connection to the JMS provider both for the shared
* and the non-shared Connection case.
* @see #refreshConnectionUntilSuccessful()
* @see #refreshDestination()
*/
protected void recoverAfterListenerSetupFailure() {
this.recovering = true;
try {
refreshConnectionUntilSuccessful();
refreshDestination();
}
finally {
this.recovering = false;
}
}
/**
* Refresh the underlying Connection, not returning before an attempt has been
* successful. Called in case of a shared Connection as well as without shared
* Connection, so either needs to operate on the shared Connection or on a
* temporary Connection that just gets established for validation purposes.
* <p>The default implementation retries until it successfully established a
* Connection, for as long as this message listener container is running.
* Applies the specified recovery interval between retries.
* @see #setRecoveryInterval
* @see #start()
* @see #stop()
*/
protected void refreshConnectionUntilSuccessful() {
while (isRunning()) {
try {
if (sharedConnectionEnabled()) {
refreshSharedConnection();
}
else {
Connection con = createConnection();
JmsUtils.closeConnection(con);
}
logger.info("Successfully refreshed JMS Connection");
break;
}
catch (Exception ex) {
if (ex instanceof JMSException) {
invokeExceptionListener((JMSException) ex);
}
StringBuilder msg = new StringBuilder();
msg.append("Could not refresh JMS Connection for destination '");
msg.append(getDestinationDescription()).append("' - retrying in ");
msg.append(this.recoveryInterval).append(" ms. Cause: ");
msg.append(ex instanceof JMSException ? JmsUtils.buildExceptionMessage((JMSException) ex) : ex.getMessage());
if (logger.isDebugEnabled()) {
logger.error(msg, ex);
}
else {
logger.error(msg);
}
}
sleepInbetweenRecoveryAttempts();
}
}
/**
* Refresh the JMS destination that this listener container operates on.
* <p>Called after listener setup failure, assuming that a cached Destination
* object might have become invalid (a typical case on WebLogic JMS).
* <p>The default implementation removes the destination from a
* DestinationResolver's cache, in case of a CachingDestinationResolver.
* @see #setDestinationName
* @see org.springframework.jms.support.destination.CachingDestinationResolver
*/
protected void refreshDestination() {
String destName = getDestinationName();
if (destName != null) {
DestinationResolver destResolver = getDestinationResolver();
if (destResolver instanceof CachingDestinationResolver) {
((CachingDestinationResolver) destResolver).removeFromCache(destName);
}
}
}
/**
* Sleep according to the specified recovery interval.
* Called between recovery attempts.
*/
protected void sleepInbetweenRecoveryAttempts() {
if (this.recoveryInterval > 0) {
try {
Thread.sleep(this.recoveryInterval);
}
catch (InterruptedException interEx) {
// Re-interrupt current thread, to allow other threads to react.
Thread.currentThread().interrupt();
}
}
}
/**
* Return whether this listener container is currently in a recovery attempt.
* <p>May be used to detect recovery phases but also the end of a recovery phase,
* with {@code isRecovering()} switching to {@code false} after having been found
* to return {@code true} before.
* @see #recoverAfterListenerSetupFailure()
*/
public final boolean isRecovering() {
return this.recovering;
}
//-------------------------------------------------------------------------
// Inner classes used as internal adapters
//-------------------------------------------------------------------------
/**
* Runnable that performs looped {@code MessageConsumer.receive()} calls.
*/
private class AsyncMessageListenerInvoker implements SchedulingAwareRunnable {
private Session session;
private MessageConsumer consumer;
private Object lastRecoveryMarker;
private boolean lastMessageSucceeded;
private int idleTaskExecutionCount = 0;
private volatile boolean idle = true;
public void run() {
synchronized (lifecycleMonitor) {
activeInvokerCount++;
lifecycleMonitor.notifyAll();
}
boolean messageReceived = false;
try {
if (maxMessagesPerTask < 0) {
messageReceived = executeOngoingLoop();
}
else {
int messageCount = 0;
while (isRunning() && messageCount < maxMessagesPerTask) {
messageReceived = (invokeListener() || messageReceived);
messageCount++;
}
}
}
catch (Throwable ex) {
clearResources();
if (!this.lastMessageSucceeded) {
// We failed more than once in a row - sleep for recovery interval
// even before first recovery attempt.
sleepInbetweenRecoveryAttempts();
}
this.lastMessageSucceeded = false;
boolean alreadyRecovered = false;
synchronized (recoveryMonitor) {
if (this.lastRecoveryMarker == currentRecoveryMarker) {
handleListenerSetupFailure(ex, false);
recoverAfterListenerSetupFailure();
currentRecoveryMarker = new Object();
}
else {
alreadyRecovered = true;
}
}
if (alreadyRecovered) {
handleListenerSetupFailure(ex, true);
}
}
finally {
synchronized (lifecycleMonitor) {
decreaseActiveInvokerCount();
lifecycleMonitor.notifyAll();
}
if (!messageReceived) {
this.idleTaskExecutionCount++;
}
else {
this.idleTaskExecutionCount = 0;
}
synchronized (lifecycleMonitor) {
if (!shouldRescheduleInvoker(this.idleTaskExecutionCount) || !rescheduleTaskIfNecessary(this)) {
// We're shutting down completely.
scheduledInvokers.remove(this);
if (logger.isDebugEnabled()) {
logger.debug("Lowered scheduled invoker count: " + scheduledInvokers.size());
}
lifecycleMonitor.notifyAll();
clearResources();
}
else if (isRunning()) {
int nonPausedConsumers = getScheduledConsumerCount() - getPausedTaskCount();
if (nonPausedConsumers < 1) {
logger.error("All scheduled consumers have been paused, probably due to tasks having been rejected. " +
"Check your thread pool configuration! Manual recovery necessary through a start() call.");
}
else if (nonPausedConsumers < getConcurrentConsumers()) {
logger.warn("Number of scheduled consumers has dropped below concurrentConsumers limit, probably " +
"due to tasks having been rejected. Check your thread pool configuration! Automatic recovery " +
"to be triggered by remaining consumers.");
}
}
}
}
}
private boolean executeOngoingLoop() throws JMSException {
boolean messageReceived = false;
boolean active = true;
while (active) {
synchronized (lifecycleMonitor) {
boolean interrupted = false;
boolean wasWaiting = false;
while ((active = isActive()) && !isRunning()) {
if (interrupted) {
throw new IllegalStateException("Thread was interrupted while waiting for " +
"a restart of the listener container, but container is still stopped");
}
if (!wasWaiting) {
decreaseActiveInvokerCount();
}
wasWaiting = true;
try {
lifecycleMonitor.wait();
}
catch (InterruptedException ex) {
// Re-interrupt current thread, to allow other threads to react.
Thread.currentThread().interrupt();
interrupted = true;
}
}
if (wasWaiting) {
activeInvokerCount++;
}
if (scheduledInvokers.size() > maxConcurrentConsumers) {
active = false;
}
}
if (active) {
messageReceived = (invokeListener() || messageReceived);
}
}
return messageReceived;
}
private boolean invokeListener() throws JMSException {
initResourcesIfNecessary();
boolean messageReceived = receiveAndExecute(this, this.session, this.consumer);
this.lastMessageSucceeded = true;
return messageReceived;
}
private void decreaseActiveInvokerCount() {
activeInvokerCount--;
if (stopCallback != null && activeInvokerCount == 0) {
stopCallback.run();
stopCallback = null;
}
}
private void initResourcesIfNecessary() throws JMSException {
if (getCacheLevel() <= CACHE_CONNECTION) {
updateRecoveryMarker();
}
else {
if (this.session == null && getCacheLevel() >= CACHE_SESSION) {
updateRecoveryMarker();
this.session = createSession(getSharedConnection());
}
if (this.consumer == null && getCacheLevel() >= CACHE_CONSUMER) {
this.consumer = createListenerConsumer(this.session);
synchronized (lifecycleMonitor) {
registeredWithDestination++;
}
}
}
}
private void updateRecoveryMarker() {
synchronized (recoveryMonitor) {
this.lastRecoveryMarker = currentRecoveryMarker;
}
}
private void clearResources() {
if (sharedConnectionEnabled()) {
synchronized (sharedConnectionMonitor) {
JmsUtils.closeMessageConsumer(this.consumer);
JmsUtils.closeSession(this.session);
}
}
else {
JmsUtils.closeMessageConsumer(this.consumer);
JmsUtils.closeSession(this.session);
}
if (this.consumer != null) {
synchronized (lifecycleMonitor) {
registeredWithDestination--;
}
}
this.consumer = null;
this.session = null;
}
public boolean isLongLived() {
return (maxMessagesPerTask < 0);
}
public void setIdle(boolean idle) {
this.idle = idle;
}
public boolean isIdle() {
return this.idle;
}
}
}
| [
"[email protected]"
] | |
b35584c88bdcbac7a8cc546290525fe3f0222103 | e3838244dc563331497a54e53fb5945939f6e555 | /src/main/java/com/security/config/ResourceServerConfig.java | 842110ced57c102351a62cdffe53f5b85c59d745 | [] | no_license | T-Davis/travel-api_springboot_oauth2 | d951cab5f8d618f1fae7a260948a7ccdb1631249 | 29b804afdb810f8322854d5499daa360441ed2dc | refs/heads/master | 2021-01-17T16:12:12.770327 | 2017-06-26T17:27:32 | 2017-06-26T17:27:32 | 95,470,378 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 943 | java | package com.security.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
/**
*The @EnableResourceServer annotation adds a filter of type OAuth2AuthenticationProcessingFilter automatically
*to the Spring Security filter chain.
*/
@Configuration
@EnableResourceServer
public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.headers().frameOptions().disable().and()
.authorizeRequests()
.antMatchers("/").permitAll()
.antMatchers("/users/**").authenticated();
}
}
| [
"[email protected]"
] | |
f95acee1e787d1cd147b5d37af4fb278c4a7ce1c | 8b39568422f723f1c95342e790a95fdae7d9d8b8 | /src/main/java/com/laioffer/jupiter/servlet/LogoutServlet.java | 1f034b50231c339efddb550fda24bfcaeccf2205 | [] | no_license | jing5wu/Jupiter | 28960ce714dd0374a225be2ec93a605d595e5e22 | 0995c1854858a906f8ee83a6a8766a31fa16b618 | refs/heads/master | 2023-06-27T14:53:45.914190 | 2021-07-25T19:51:09 | 2021-07-25T19:51:09 | 389,428,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 720 | java | package com.laioffer.jupiter.servlet;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
@WebServlet(name = "LogoutServlet", value = "/logout")
public class LogoutServlet extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Destroy the session
HttpSession session = request.getSession(false);
if (session != null) {
session.invalidate();
}
Cookie cookie = new Cookie("JSESSIONID", null);
cookie.setPath("/");
cookie.setMaxAge(0);
response.addCookie(cookie);
}
}
| [
"[email protected]"
] | |
fe93e1b893daf01bb1d47bdcb2de9cc92d272d31 | 11dfc4a8ddcf26d790cfb4840e3a3c86177bcd57 | /src/test/java/com/github/lulewiczg/contentserver/selenium/pl/ToolbarSeleniumTestPL.java | 963efbcd6ffb06e7742216d4ea2d9c3fa087468a | [] | no_license | lulewiczg/ContentServer | 9b4c75b4bbfde7118836134bfd4ffb185c509ea9 | 731678c646de7fb2e0b672c5a7e26d4c413b40c6 | refs/heads/master | 2020-03-22T21:37:43.386567 | 2019-03-27T20:28:50 | 2019-03-27T20:28:50 | 140,701,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 523 | java | package com.github.lulewiczg.contentserver.selenium.pl;
import com.github.lulewiczg.contentserver.selenium.ExpectedMsg;
import com.github.lulewiczg.contentserver.selenium.ExpectedMsgPL;
import com.github.lulewiczg.contentserver.selenium.en.ToolbarSeleniumTest;
/**
* Selenium tests for plain toolbar actions.
*
* @author lulewiczg
*/
public class ToolbarSeleniumTestPL extends ToolbarSeleniumTest {
@Override
protected ExpectedMsg getMsgs() {
return new ExpectedMsgPL();
}
}
| [
"[email protected]"
] | |
190a8e9101dc16ca143d199f5d100053fc54da05 | e0fd4fe2abbd862e62349d553d1069e5b8102980 | /src/com/edu/bupt/mr/KafkaSpoutTest.java | 58fb305bd704d4d1371cab802b8c98b07a1f5d3b | [] | no_license | margase/Storm | cde9b46e7e1a0e1f5c316a7256ddfd67f90cbbec | c89e924acc34f9e3c75115b387d1c4b3b6762473 | refs/heads/master | 2021-01-10T22:10:30.864694 | 2013-08-24T05:17:53 | 2013-08-24T05:17:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,807 | java | package com.edu.bupt.mr;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import kafka.consumer.ConsumerConfig;
import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;
import kafka.javaapi.consumer.ConsumerConnector;
import backtype.storm.spout.SpoutOutputCollector;
import backtype.storm.task.TopologyContext;
import backtype.storm.topology.IRichSpout;
import backtype.storm.topology.OutputFieldsDeclarer;
import backtype.storm.tuple.Fields;
import backtype.storm.tuple.Values;
import backtype.storm.utils.Utils;
public class KafkaSpoutTest implements IRichSpout{
private ConsumerConnector consumerConnector;
private ConsumerIterator<byte[], byte[]> it;
SpoutOutputCollector _collector;
public KafkaSpoutTest(final Properties kafkaProperties, final String topic) {
}
@Override
public void open(Map conf, TopologyContext context,
SpoutOutputCollector collector) {
_collector = collector;
Properties props = new Properties();
props.put("zookeeper.connect", "192.168.2.253:2181");
props.put("zookeeper.session.timeout.ms", "400");
props.put("zookeeper.sync.time.ms", "200");
props.put("auto.commit.interval.ms", "1000");
props.put("group.id", "test_group");
ConsumerConfig consumerConfig = new ConsumerConfig(props);
ConsumerConnector consumer = kafka.consumer.Consumer.createJavaConsumerConnector(consumerConfig);
Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
topicCountMap.put("test", new Integer(2));
Map<String, List<KafkaStream<byte[], byte[]>>> consumerMap = consumer.createMessageStreams(topicCountMap);
List<KafkaStream<byte[], byte[]>> streams = consumerMap.get("test");
KafkaStream stream = streams.get(0);
it = stream.iterator();
}
@Override
public void close() {
if (consumerConnector != null) {
consumerConnector.shutdown();
}
}
@Override
public void activate() {
// TODO Auto-generated method stub
}
@Override
public void deactivate() {
// TODO Auto-generated method stub
}
@Override
public void nextTuple() {
Utils.sleep(100);
while (it.hasNext()){
String msg = new String(it.next().message());
System.out.println(msg);
_collector.emit(new Values(msg));
}
}
@Override
public void ack(Object msgId) {
// TODO Auto-generated method stub
}
@Override
public void fail(Object msgId) {
// TODO Auto-generated method stub
}
@Override
public void declareOutputFields(OutputFieldsDeclarer declarer) {
// TODO Auto-generated method stub
declarer.declare(new Fields("kafka"));
}
@Override
public Map<String, Object> getComponentConfiguration() {
// TODO Auto-generated method stub
return null;
}
}
| [
"[email protected]"
] | |
e71397386ad5c567fa6443a1638ce20880ff2165 | abb46fb506f4827ddbb910b75889ba8f15b250d2 | /src/main/java/com/tripcaddie/frontend/itinerary/dto/RoundScoreDto.java | d135e385d9515511b72fc3530515b5c02a402065 | [] | no_license | jeevanmysore/tripacaddie | 023f13a5e3f0e2a54971816a649c7e3f04897121 | abab7bfc8baf8f45467c335ecf0bcca6c171674c | refs/heads/master | 2021-01-10T08:57:58.479801 | 2015-10-28T11:59:28 | 2015-10-28T11:59:28 | 45,109,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,099 | java | package com.tripcaddie.frontend.itinerary.dto;
import java.io.Serializable;
import com.tripcaddie.backend.itinerary.model.RoundScore;
import com.tripcaddie.frontend.trip.dto.TripMemberDto;
public class RoundScoreDto implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private int id;
private ActivityDto activity;
private TripMemberDto member;
private int front9;
private int back9;
private int total;
private int memberId;
private String membername;
public int getMemberId() {
return memberId;
}
public void setMemberId(int memberId) {
this.memberId = memberId;
}
public String getMembername() {
return membername;
}
public void setMembername(String membername) {
this.membername = membername;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public ActivityDto getActivity() {
return activity;
}
public void setActivity(ActivityDto activity) {
this.activity = activity;
}
public TripMemberDto getMember() {
return member;
}
public void setMember(TripMemberDto member) {
this.member = member;
}
public int getFront9() {
return front9;
}
public void setFront9(int front9) {
this.front9 = front9;
}
public int getBack9() {
return back9;
}
public void setBack9(int back9) {
this.back9 = back9;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public static RoundScoreDto instantiate(RoundScore roundScore) {
RoundScoreDto roundScoreDto = new RoundScoreDto();
populate(roundScoreDto, roundScore);
return roundScoreDto;
}
private static void populate(RoundScoreDto roundScoreDto,
RoundScore roundScore) {
roundScoreDto.setId(roundScore.getId());
roundScoreDto.setActivity(ActivityDto.instantiate(roundScore.getActivity()));
roundScoreDto.setMember(TripMemberDto.instantiate(roundScore.getMember()));
roundScoreDto.setBack9(roundScore.getBack9());
roundScoreDto.setFront9(roundScore.getFront9());
roundScoreDto.setTotal(roundScore.getTotal());
}
}
| [
"[email protected]"
] | |
63fa4f8456b44a6a0a3f9e5b2c797d3924c5a7f8 | 0857e94d17e6e0a01ec82530761fd73dc5be11e5 | /views/src/main/java/org/solovyev/android/view/sidebar/SideBarLayout.java | 556053a852703812ba78f853cfe5e3fc5901dcb7 | [
"Apache-2.0"
] | permissive | FlakyTestDetection/android-common | 634195e98de7d6cd3b938daa532c0be2ab4ee3aa | 8bc7bc5af88d36f9af488ca8e01391df3299d92b | refs/heads/master | 2021-01-20T06:38:32.480599 | 2017-09-11T12:34:05 | 2017-09-11T12:34:05 | 89,903,660 | 0 | 0 | null | 2017-05-01T06:46:29 | 2017-05-01T06:46:29 | null | UTF-8 | Java | false | false | 19,005 | java | package org.solovyev.android.view.sidebar;
import android.content.Context;
import android.graphics.*;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.widget.FrameLayout;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.concurrent.atomic.AtomicInteger;
public final class SideBarLayout extends FrameLayout implements OnSlideListener {
/*
**********************************************************************
*
* CONSTANTS
*
**********************************************************************
*/
// count of frames to be skipped in drawing of main view in case of opening/closing the sliding view
private static final int DRAW_FRAMES_SKIP_COUNT = 5;
private static final int MIN_Z_DIFF = 50;
/*
**********************************************************************
*
* FIELDS
*
**********************************************************************
*/
// cached values
private Bitmap cachedBitmap;
private Canvas cachedCanvas;
private Paint cachedPaint;
/**
* Used to avoid heavy drawing of main view in case of opening/closing the sliding view
*/
@Nonnull
private final AtomicInteger drawCounter = new AtomicInteger(0);
// NOTE: use getter as this field is lazily set and might be null in some cases
private View mainView;
// NOTE: use getter as this field is lazily set and might be null in some cases
private View slidingView;
@Nonnull
private SideBarAttributes attributes;
@Nonnull
private SlidingViewState slidingViewState = SlidingViewState.Closed;
@Nonnull
private SideBarSlider slider;
private boolean alwaysOpened = false;
@Nullable
private OnSlideListener listener;
/*
**********************************************************************
*
* CONSTRUCTORS
*
**********************************************************************
*/
public SideBarLayout(Context context, int mainViewId, int slidingViewId) {
super(context);
attributes = SideBarAttributes.newAttributes(mainViewId, slidingViewId, 0, SideBarSlidingViewPosition.left);
init(context, null);
}
public SideBarLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public SideBarLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs);
}
private void init(@Nonnull Context context, @Nullable AttributeSet attrs) {
if (attrs != null) {
attributes = SideBarAttributes.newAttributes(context, attrs);
}
slider = new SideBarSlider(this, attributes, this);
cachedPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG | Paint.DITHER_FLAG);
}
/*
**********************************************************************
*
* METHODS
*
**********************************************************************
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final View slidingView = getSlidingView();
if (attributes.isSlideMainView()) {
final int slidingViewLedge = attributes.getSlidingViewLedge();
if (alwaysOpened || slidingViewLedge > 0) {
final View mainView = getMainView();
// margin for main view = width of sliding view
final LayoutParams lp = (LayoutParams) mainView.getLayoutParams();
if (alwaysOpened) {
measureChild(slidingView, widthMeasureSpec, heightMeasureSpec);
switch (attributes.getSlidingViewPosition()) {
case left:
lp.leftMargin = slidingView.getMeasuredWidth();
break;
case top:
lp.topMargin = slidingView.getMeasuredWidth();
break;
case right:
lp.rightMargin = slidingView.getMeasuredWidth();
break;
case bottom:
lp.bottomMargin = slidingView.getMeasuredWidth();
break;
}
} else {
switch (attributes.getSlidingViewPosition()) {
case left:
measureChild(slidingView, slidingViewLedge, heightMeasureSpec);
lp.leftMargin = slidingViewLedge;
break;
case top:
measureChild(slidingView, widthMeasureSpec, slidingViewLedge);
lp.topMargin = slidingViewLedge;
break;
case right:
measureChild(slidingView, slidingViewLedge, heightMeasureSpec);
lp.rightMargin = slidingViewLedge;
break;
case bottom:
measureChild(slidingView, widthMeasureSpec, slidingViewLedge);
lp.bottomMargin = slidingViewLedge;
break;
}
}
}
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
final int height = bottom - top;
final int width = right - left;
final View slidingView = getSlidingView();
final View mainView = getMainView();
final int slidingViewWidth = slidingView.getMeasuredWidth();
final int slidingViewHeight = slidingView.getMeasuredHeight();
final int offset;
if (alwaysOpened || slidingViewState == SlidingViewState.Opened) {
switch (attributes.getSlidingViewPosition()) {
case left:
case right:
offset = slidingViewWidth;
break;
case top:
case bottom:
offset = slidingViewHeight;
break;
default:
throw new UnsupportedOperationException();
}
} else if (slidingViewState == SlidingViewState.Closed) {
offset = attributes.getSlidingViewLedge();
} else {
offset = slider.getOffset();
// in transition => offset is already set
}
switch (attributes.getSlidingViewStyle()) {
case hover:
mainView.layout(0, 0, width, height);
break;
case push:
switch (attributes.getSlidingViewPosition()) {
case left:
mainView.layout(offset, 0, width + offset, height);
break;
case top:
mainView.layout(0, offset, width, height + offset);
break;
case right:
mainView.layout(-offset, 0, width - offset, height);
break;
case bottom:
mainView.layout(0, -offset, width, height - offset);
break;
}
break;
}
switch (attributes.getSlidingViewPosition()) {
case left:
slidingView.layout(-slidingViewWidth + offset, 0, offset, height);
break;
case top:
slidingView.layout(0, offset - slidingViewHeight, width, offset);
break;
case right:
slidingView.layout(width - offset, 0, width - offset + slidingViewWidth, height);
break;
case bottom:
slidingView.layout(0, height - offset, width, height - offset + slidingViewHeight);
break;
}
invalidate();
}
@Override
protected void dispatchDraw(Canvas canvas) {
try {
if (slidingViewState.isTransition()) {
if (drawCounter.getAndIncrement() > DRAW_FRAMES_SKIP_COUNT) {
updateCachedCanvas();
// reset counter to start over
drawCounter.set(0);
}
canvas.save();
switch (attributes.getSlidingViewStyle()) {
case push:
switch (attributes.getSlidingViewPosition()) {
case left:
canvas.translate(slider.getOffset(), 0);
break;
case top:
canvas.translate(0, slider.getOffset());
break;
case right:
canvas.translate(-slider.getOffset(), 0);
break;
case bottom:
canvas.translate(0, -slider.getOffset());
break;
}
break;
}
canvas.drawBitmap(cachedBitmap, 0, 0, cachedPaint);
canvas.restore();
/*
* Draw only visible part of sliding view
*/
final View slidingView = getSlidingView();
final int scrollX = slidingView.getScrollX();
final int scrollY = slidingView.getScrollY();
canvas.save();
final int width = canvas.getWidth();
final int height = canvas.getHeight();
switch (attributes.getSlidingViewPosition()) {
case left:
canvas.clipRect(0, 0, slider.getOffsetOnScreen(), height, Region.Op.REPLACE);
canvas.translate(-scrollX - (slidingView.getMeasuredWidth() - slider.getOffset()), -scrollY);
break;
case top:
canvas.clipRect(0, 0, width, slider.getOffsetOnScreen(), Region.Op.REPLACE);
canvas.translate(-scrollX, -scrollY - slidingView.getMeasuredHeight() + slider.getOffsetOnScreen());
break;
case right:
canvas.clipRect(slider.getOffsetOnScreen(), 0, width, height, Region.Op.REPLACE);
canvas.translate(-scrollX + slider.getOffsetOnScreen(), -scrollY);
break;
case bottom:
canvas.clipRect(0, slider.getOffsetOnScreen(), width, height, Region.Op.REPLACE);
canvas.translate(-scrollX, -scrollY + slider.getOffsetOnScreen());
break;
default:
throw new UnsupportedOperationException();
}
slidingView.draw(canvas);
canvas.restore();
} else {
if (!alwaysOpened) {
if (!attributes.isSlidingViewLedgeExists()) {
if (slidingViewState == SlidingViewState.Closed) {
getSlidingView().setVisibility(View.GONE);
}
}
}
super.dispatchDraw(canvas);
}
} catch (IndexOutOfBoundsException e) {
/*
* Possibility of crashes on some devices (especially on Samsung).
* Usually, when ListView is empty.
*/
}
}
private void updateCachedCanvas() {
final View mainView = getMainView();
// we must clear canvas before drawing
cachedCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
cachedCanvas.translate(-mainView.getScrollX(), -mainView.getScrollY());
mainView.draw(cachedCanvas);
}
@Override
protected Parcelable onSaveInstanceState() {
boolean opened;
if (slidingViewState == SlidingViewState.Opened) {
opened = true;
} else if (slidingViewState.isTransition()) {
opened = slider.isOpening();
} else {
opened = false;
}
return new ViewState(super.onSaveInstanceState(), opened);
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
if (state instanceof ViewState) {
final ViewState viewState = (ViewState) state;
super.onRestoreInstanceState(viewState.getSuperState());
if (viewState.mOpened) {
openImmediately();
} else {
closeImmediately();
}
} else {
super.onRestoreInstanceState(state);
}
}
/**
* @return child view which is slided, in contrast to main view this view may be not shown initially and may appear only after user actions
*/
@Nonnull
private View getSlidingView() {
if (slidingView == null) {
slidingView = findViewById(attributes.getSlidingViewId());
}
return slidingView;
}
@Nonnull
private View getMainView() {
if (mainView == null) {
mainView = findViewById(attributes.getMainViewId());
}
return mainView;
}
public void setAlwaysOpened(boolean opened) {
alwaysOpened = opened;
requestLayout();
}
public void setOnSlideListener(OnSlideListener lis) {
listener = lis;
}
public boolean isOpened() {
return slidingViewState == SlidingViewState.Opened;
}
public void toggle(boolean immediately) {
if (immediately) {
toggleImmediately();
} else {
toggle();
}
}
public void toggle() {
if (isOpened()) {
close();
} else {
open();
}
}
public void toggleImmediately() {
if (isOpened()) {
closeImmediately();
} else {
openImmediately();
}
}
public boolean open() {
if (isOpened() || alwaysOpened || slidingViewState.isTransition()) {
return false;
}
initSlideMode();
startAnimation(slider.newOpenAnimation());
invalidate();
return true;
}
public boolean openImmediately() {
if (isOpened() || alwaysOpened || slidingViewState.isTransition()) {
return false;
}
getSlidingView().setVisibility(View.VISIBLE);
slidingViewState = SlidingViewState.Opened;
requestLayout();
if (listener != null) {
listener.onSlideCompleted(true);
}
return true;
}
public boolean close() {
if (!isOpened() || alwaysOpened || slidingViewState.isTransition()) {
return false;
}
initSlideMode();
startAnimation(slider.newCloseAnimation());
invalidate();
return true;
}
public boolean closeImmediately() {
if (!isOpened() || alwaysOpened || slidingViewState.isTransition()) {
return false;
}
if (!attributes.isSlidingViewLedgeExists()) {
getSlidingView().setVisibility(View.GONE);
}
slidingViewState = SlidingViewState.Closed;
requestLayout();
if (listener != null) {
listener.onSlideCompleted(false);
}
return true;
}
private int mHistoricalZ = 0;
@Override
public boolean dispatchTouchEvent(MotionEvent e) {
if (alwaysOpened) {
return super.dispatchTouchEvent(e);
} else if (!isEnabled() && slidingViewState == SlidingViewState.Closed) {
return super.dispatchTouchEvent(e);
}
if (slidingViewState != SlidingViewState.Opened) {
onTouchEvent(e);
if (slidingViewState.isEndState()) {
super.dispatchTouchEvent(e);
} else {
final MotionEvent cancelEvent = MotionEvent.obtain(e);
cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
super.dispatchTouchEvent(cancelEvent);
}
return true;
} else {
final View slidingView = getSlidingView();
final View mainView = getMainView();
final Rect slidingRect = new Rect();
slidingView.getHitRect(slidingRect);
if (!slidingRect.contains((int) e.getX(), (int) e.getY())) {
// set main view coordinates
e.offsetLocation(-mainView.getLeft(), -mainView.getTop());
mainView.dispatchTouchEvent(e);
// revert real view coordinates
e.offsetLocation(mainView.getLeft(), mainView.getTop());
onTouchEvent(e);
return true;
} else {
onTouchEvent(e);
e.offsetLocation(-slidingView.getLeft(), -slidingView.getTop());
slidingView.dispatchTouchEvent(e);
return true;
}
}
}
private boolean handleTouchEvent(@Nonnull MotionEvent e) {
if (!isEnabled()) {
return false;
}
final float z;
switch (attributes.getSlidingViewPosition()) {
case left:
case right:
z = e.getX();
break;
case top:
case bottom:
z = e.getY();
break;
default:
throw new UnsupportedOperationException();
}
switch (e.getAction()) {
case MotionEvent.ACTION_DOWN:
mHistoricalZ = (int) z;
return true;
case MotionEvent.ACTION_MOVE:
return handleTouchMove(z);
case MotionEvent.ACTION_UP:
if (slidingViewState == SlidingViewState.InTransition) {
slider.finishSlide();
}
return false;
}
return slidingViewState.isTransition();
}
private boolean handleTouchMove(float z) {
final float diff = z - mHistoricalZ;
final float prevHistoricalZ = mHistoricalZ;
mHistoricalZ = (int) z;
if (slidingViewState.isTransition()) {
if (slidingViewState == SlidingViewState.InTransition) {
// in case of animation we do not need to update offset
slider.addOffsetDelta((int) diff);
}
return true;
} else {
final boolean openingAllowed;
final boolean closingAllowed;
switch (attributes.getSlidingViewPosition()) {
case left:
case top:
openingAllowed = diff > MIN_Z_DIFF && slidingViewState == SlidingViewState.Closed;
closingAllowed = diff < -MIN_Z_DIFF && slidingViewState == SlidingViewState.Opened;
break;
case right:
case bottom:
openingAllowed = diff < -MIN_Z_DIFF && slidingViewState == SlidingViewState.Closed;
closingAllowed = diff > MIN_Z_DIFF && slidingViewState == SlidingViewState.Opened;
break;
default:
throw new UnsupportedOperationException();
}
if (openingAllowed || closingAllowed) {
if (slider.canStartSlide(prevHistoricalZ)) {
initSlideMode();
slider.addOffsetDelta((int) diff);
}
}
return false;
}
}
@Override
public void startAnimation(Animation animation) {
slidingViewState = SlidingViewState.InAnimation;
super.startAnimation(animation);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
boolean handled = handleTouchEvent(ev);
invalidate();
return handled;
}
private void initSlideMode() {
final View mainView = getMainView();
// offsets for closed view state
final int openedOffset;
final int width = getWidth();
final int height = getHeight();
switch (attributes.getSlidingViewPosition()) {
case left:
case right:
openedOffset = getSlidingView().getMeasuredWidth();
break;
case bottom:
case top:
openedOffset = getSlidingView().getMeasuredHeight();
break;
default:
throw new UnsupportedOperationException("");
}
slider.init(attributes.getSlidingViewLedge(), openedOffset, slidingViewState == SlidingViewState.Closed);
if (cachedBitmap == null || cachedBitmap.isRecycled() || cachedBitmap.getWidth() != width) {
cachedBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
cachedCanvas = new Canvas(cachedBitmap);
}
mainView.setVisibility(View.VISIBLE);
updateCachedCanvas();
slidingViewState = SlidingViewState.InTransition;
getSlidingView().setVisibility(View.VISIBLE);
}
@Override
public void onSlideCompleted(final boolean opened) {
requestLayout();
post(new Runnable() {
@Override
public void run() {
if (opened) {
slidingViewState = SlidingViewState.Opened;
if (!attributes.isSlidingViewLedgeExists()) {
getSlidingView().setVisibility(View.VISIBLE);
}
} else {
slidingViewState = SlidingViewState.Closed;
if (!attributes.isSlidingViewLedgeExists()) {
getSlidingView().setVisibility(View.GONE);
}
}
}
});
if (listener != null) {
listener.onSlideCompleted(opened);
}
}
/*
**********************************************************************
*
* STATIC/INNER CLASSES
*
**********************************************************************
*/
private static enum SlidingViewState {
Closed(true),
InTransition(false),
InAnimation(false),
Opened(true);
private final boolean mEndState;
SlidingViewState(boolean endState) {
mEndState = endState;
}
public boolean isEndState() {
return mEndState;
}
public boolean isTransition() {
return !isEndState();
}
}
public static class ViewState extends BaseSavedState {
@Nonnull
public static final Parcelable.Creator<ViewState> CREATOR = new Parcelable.Creator<ViewState>() {
public ViewState createFromParcel(Parcel in) {
return new ViewState(in);
}
public ViewState[] newArray(int size) {
return new ViewState[size];
}
};
private final boolean mOpened;
public ViewState(Parcel in) {
super(in);
mOpened = in.readInt() == 1;
}
public ViewState(Parcelable state, boolean opened) {
super(state);
mOpened = opened;
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeInt(this.mOpened ? 1 : 0);
}
}
}
| [
"[email protected]"
] | |
fdde8f7a9842fdc86d87a0425a6e7d1fb21710c0 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/spring-framework/2015/4/AbstractTyrusRequestUpgradeStrategy.java | 9a871e3dded067974db078a107abee35e8d580d6 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 10,429 | java | /*
* Copyright 2002-2014 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.web.socket.server.standard;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.websocket.DeploymentException;
import javax.websocket.Endpoint;
import javax.websocket.EndpointConfig;
import javax.websocket.Extension;
import javax.websocket.WebSocketContainer;
import org.glassfish.tyrus.core.ComponentProviderService;
import org.glassfish.tyrus.core.RequestContext;
import org.glassfish.tyrus.core.TyrusEndpoint;
import org.glassfish.tyrus.core.TyrusEndpointWrapper;
import org.glassfish.tyrus.core.TyrusUpgradeResponse;
import org.glassfish.tyrus.core.TyrusWebSocketEngine;
import org.glassfish.tyrus.core.Version;
import org.glassfish.tyrus.core.WebSocketApplication;
import org.glassfish.tyrus.server.TyrusServerContainer;
import org.glassfish.tyrus.spi.WebSocketEngine.UpgradeInfo;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.http.HttpHeaders;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.socket.WebSocketExtension;
import org.springframework.web.socket.server.HandshakeFailureException;
/**
* An base class for WebSocket servers using Tyrus.
*
* <p>Works with Tyrus 1.3.5 (WebLogic 12.1.3) and Tyrus 1.7 (GlassFish 4.0.1).
*
* @author Rossen Stoyanchev
* @since 4.1
* @see <a href="https://tyrus.java.net/">Project Tyrus</a>
*/
public abstract class AbstractTyrusRequestUpgradeStrategy extends AbstractStandardUpgradeStrategy {
private static final Random random = new Random();
private final ComponentProviderService componentProvider = ComponentProviderService.create();
@Override
public String[] getSupportedVersions() {
return StringUtils.commaDelimitedListToStringArray(Version.getSupportedWireProtocolVersions());
}
protected List<WebSocketExtension> getInstalledExtensions(WebSocketContainer container) {
try {
return super.getInstalledExtensions(container);
}
catch (UnsupportedOperationException ex) {
return new ArrayList<WebSocketExtension>(0);
}
}
@Override
public void upgradeInternal(ServerHttpRequest request, ServerHttpResponse response,
String selectedProtocol, List<Extension> extensions, Endpoint endpoint)
throws HandshakeFailureException {
HttpServletRequest servletRequest = getHttpServletRequest(request);
HttpServletResponse servletResponse = getHttpServletResponse(response);
TyrusServerContainer serverContainer = (TyrusServerContainer) getContainer(servletRequest);
TyrusWebSocketEngine engine = (TyrusWebSocketEngine) serverContainer.getWebSocketEngine();
Object tyrusEndpoint = null;
try {
// Shouldn't matter for processing but must be unique
String path = "/" + random.nextLong();
tyrusEndpoint = createTyrusEndpoint(endpoint, path, selectedProtocol, extensions, serverContainer, engine);
getEndpointHelper().register(engine, tyrusEndpoint);
HttpHeaders headers = request.getHeaders();
RequestContext requestContext = createRequestContext(servletRequest, path, headers);
TyrusUpgradeResponse upgradeResponse = new TyrusUpgradeResponse();
UpgradeInfo upgradeInfo = engine.upgrade(requestContext, upgradeResponse);
switch (upgradeInfo.getStatus()) {
case SUCCESS:
if (logger.isTraceEnabled()) {
logger.trace("Successful upgrade: " + upgradeResponse.getHeaders());
}
handleSuccess(servletRequest, servletResponse, upgradeInfo, upgradeResponse);
break;
case HANDSHAKE_FAILED:
// Should never happen
throw new HandshakeFailureException("Unexpected handshake failure: " + request.getURI());
case NOT_APPLICABLE:
// Should never happen
throw new HandshakeFailureException("Unexpected handshake mapping failure: " + request.getURI());
}
}
catch (Exception ex) {
throw new HandshakeFailureException("Error during handshake: " + request.getURI(), ex);
}
finally {
if (tyrusEndpoint != null) {
getEndpointHelper().unregister(engine, tyrusEndpoint);
}
}
}
private Object createTyrusEndpoint(Endpoint endpoint, String endpointPath, String protocol,
List<Extension> extensions, WebSocketContainer container, TyrusWebSocketEngine engine)
throws DeploymentException {
ServerEndpointRegistration endpointConfig = new ServerEndpointRegistration(endpointPath, endpoint);
endpointConfig.setSubprotocols(Arrays.asList(protocol));
endpointConfig.setExtensions(extensions);
return getEndpointHelper().createdEndpoint(endpointConfig, this.componentProvider, container, engine);
}
private RequestContext createRequestContext(HttpServletRequest request, String endpointPath, HttpHeaders headers) {
RequestContext context =
RequestContext.Builder.create()
.requestURI(URI.create(endpointPath))
.userPrincipal(request.getUserPrincipal())
.secure(request.isSecure())
// .remoteAddr(request.getRemoteAddr()) # Not available in 1.3.5
.build();
for (String header : headers.keySet()) {
context.getHeaders().put(header, headers.get(header));
}
return context;
}
protected abstract TyrusEndpointHelper getEndpointHelper();
protected abstract void handleSuccess(HttpServletRequest request, HttpServletResponse response,
UpgradeInfo upgradeInfo, TyrusUpgradeResponse upgradeResponse) throws IOException, ServletException;
/**
* Helps with the creation, registration, and un-registration of endpoints.
*/
protected interface TyrusEndpointHelper {
Object createdEndpoint(ServerEndpointRegistration registration, ComponentProviderService provider,
WebSocketContainer container, TyrusWebSocketEngine engine) throws DeploymentException;
void register(TyrusWebSocketEngine engine, Object endpoint);
void unregister(TyrusWebSocketEngine engine, Object endpoint);
}
protected static class Tyrus17EndpointHelper implements TyrusEndpointHelper {
private static final Constructor<?> constructor;
private static final Method registerMethod;
private static final Method unRegisterMethod;
static {
try {
constructor = getEndpointConstructor();
registerMethod = TyrusWebSocketEngine.class.getDeclaredMethod("register", TyrusEndpointWrapper.class);
unRegisterMethod = TyrusWebSocketEngine.class.getDeclaredMethod("unregister", TyrusEndpointWrapper.class);
ReflectionUtils.makeAccessible(registerMethod);
}
catch (Exception ex) {
throw new IllegalStateException("No compatible Tyrus version found", ex);
}
}
private static Constructor<?> getEndpointConstructor() {
for (Constructor<?> current : TyrusEndpointWrapper.class.getConstructors()) {
Class<?>[] types = current.getParameterTypes();
if (types[0].equals(Endpoint.class) && types[1].equals(EndpointConfig.class)) {
return current;
}
}
throw new IllegalStateException("No compatible Tyrus version found");
}
@Override
public Object createdEndpoint(ServerEndpointRegistration registration, ComponentProviderService provider,
WebSocketContainer container, TyrusWebSocketEngine engine) throws DeploymentException {
DirectFieldAccessor accessor = new DirectFieldAccessor(engine);
Object sessionListener = accessor.getPropertyValue("sessionListener");
Object clusterContext = accessor.getPropertyValue("clusterContext");
try {
return constructor.newInstance(registration.getEndpoint(), registration, provider, container,
"/", registration.getConfigurator(), sessionListener, clusterContext, null);
}
catch (Exception ex) {
throw new HandshakeFailureException("Failed to register " + registration, ex);
}
}
@Override
public void register(TyrusWebSocketEngine engine, Object endpoint) {
try {
registerMethod.invoke(engine, endpoint);
}
catch (Exception ex) {
throw new HandshakeFailureException("Failed to register " + endpoint, ex);
}
}
@Override
public void unregister(TyrusWebSocketEngine engine, Object endpoint) {
try {
unRegisterMethod.invoke(engine, endpoint);
}
catch (Exception ex) {
throw new HandshakeFailureException("Failed to unregister " + endpoint, ex);
}
}
}
protected static class Tyrus135EndpointHelper implements TyrusEndpointHelper {
private static final Method registerMethod;
static {
try {
registerMethod = TyrusWebSocketEngine.class.getDeclaredMethod("register", WebSocketApplication.class);
ReflectionUtils.makeAccessible(registerMethod);
}
catch (Exception ex) {
throw new IllegalStateException("No compatible Tyrus version found", ex);
}
}
@Override
public Object createdEndpoint(ServerEndpointRegistration registration, ComponentProviderService provider,
WebSocketContainer container, TyrusWebSocketEngine engine) throws DeploymentException {
TyrusEndpointWrapper endpointWrapper = new TyrusEndpointWrapper(registration.getEndpoint(),
registration, provider, container, "/", registration.getConfigurator());
return new TyrusEndpoint(endpointWrapper);
}
@Override
public void register(TyrusWebSocketEngine engine, Object endpoint) {
try {
registerMethod.invoke(engine, endpoint);
}
catch (Exception ex) {
throw new HandshakeFailureException("Failed to register " + endpoint, ex);
}
}
@Override
public void unregister(TyrusWebSocketEngine engine, Object endpoint) {
engine.unregister((TyrusEndpoint) endpoint);
}
}
}
| [
"[email protected]"
] | |
3fd04478048931ce9ca730cb77dda973d3c3fc3f | bd656696c0f770e099bf68363cb15e5c1ae37958 | /src/main/java/cn/tzy/app/baidubaike/dao/DatabaseConnection.java | 3620249522b47c03bb9335b3b929df4e91892205 | [] | no_license | zhenyutu/JSpider | a81d2fe58442a295974bfdf768d3f18a26b635ba | 1db9bf87b78538153cce033b65ba9b715ed803f4 | refs/heads/master | 2021-01-21T06:33:24.964720 | 2017-03-08T02:23:15 | 2017-03-08T02:23:15 | 83,255,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,430 | java | package cn.tzy.app.baidubaike.dao;
import cn.tzy.app.baidubaike.entity.Config;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import java.beans.PropertyVetoException;
import java.sql.Connection;
/**
* Created by tuzhenyu on 17-2-28.
* @author tuzhenyu
*/
public class DatabaseConnection {
private static DatabaseConnection instance = null;
private static ComboPooledDataSource dataSource = null;
private DatabaseConnection() throws PropertyVetoException {
dataSource = new ComboPooledDataSource();
dataSource.setUser(Config.username);
dataSource.setPassword(Config.password);
dataSource.setJdbcUrl(Config.url);
dataSource.setDriverClass(Config.driver);
dataSource.setInitialPoolSize(5);
dataSource.setMinPoolSize(1);
dataSource.setMaxPoolSize(10);
dataSource.setMaxStatements(50);
dataSource.setMaxIdleTime(60);
}
public static DatabaseConnection getInstance(){
try {
if (instance == null){
instance = new DatabaseConnection();
}
}catch (Exception e){
e.printStackTrace();
}
return instance;
}
public Connection getConnection(){
Connection conn = null;
try {
conn = dataSource.getConnection();
}catch (Exception e){
e.printStackTrace();
}
return conn;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.