hexsha
stringlengths 40
40
| size
int64 8
1.04M
| content
stringlengths 8
1.04M
| avg_line_length
float64 2.24
100
| max_line_length
int64 4
1k
| alphanum_fraction
float64 0.25
0.97
|
---|---|---|---|---|---|
ea599a6b5cc1211bde3137cc8b4f437f962228e1 | 776 | package com.rhymes.app.companyadmin.model;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@SuppressWarnings("serial")
@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class AdminPaymentVbankDTO implements Serializable {
private int seq; // rhy_payment의 seq
private String payment_code; // 주문번호
private String userid; // 주문한 사람 아이디
private String send_name; // 주문한 사람 이름
private String payment_status; // 결제상태
private int add_point; // 추가 적립금
private int totalprice; // 총 결제금액
private String rdate; // 주문일
private String vbank_num; // 무통장 계좌번호
private String vbank_date; // 입금기한
} | 27.714286 | 59 | 0.740979 |
8fb257158137fbb3ca6c00d5c02f72c1d98ce7b3 | 606 | package org.hongxi.java.util.concurrent;
/**
* @author shenhongxi 2019/8/10
*
* @see InterruptedTest
*/
public class InterruptTest {
public static void main(String[] args) {
Thread t = new Thread(() -> {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().isInterrupted()); // false
});
t.start();
t.interrupt(); // Just to set the interrupt flag
System.out.println(t.isInterrupted()); // true
}
}
| 25.25 | 80 | 0.549505 |
241d8b41e4bc725fc145dd4d1f3c68643e66524d | 2,138 | // Copyright (c) 2020 Mobanisto UG (haftungsbeschränkt)
//
// This file is part of covid-plz.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
package de.mobanisto.covidplz.brandenburg.kkm;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
public class KkmTesting
{
public static void assertSums(Map<String, KkmData> nameToData)
{
String nameTotal = "Brandenburg gesamt";
KkmData total = nameToData.get(nameTotal);
List<KkmData> entries = new ArrayList<>();
for (String key : nameToData.keySet()) {
if (key.equals(nameTotal)) {
continue;
}
entries.add(nameToData.get(key));
}
int newCases24 = 0;
int casesTotal = 0;
int deathsTotal = 0;
for (KkmData data : entries) {
newCases24 += data.getNewCases24();
casesTotal += data.getCasesTotal();
deathsTotal += data.getDeathsTotal();
}
Assert.assertEquals("new cases", total.getNewCases24(), newCases24);
Assert.assertEquals("total cases", total.getCasesTotal(), casesTotal);
Assert.assertEquals("deaths total", total.getDeathsTotal(),
deathsTotal);
}
}
| 32.892308 | 81 | 0.738073 |
3bf7a9611519f90fad15b7c2d322d6cc8a8cd870 | 12,504 | /*
* Copyright (C) 2013 Google Inc.
* Copyright (C) 2013 Square Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dagger.tests.integration.codegen;
import com.google.common.base.Joiner;
import com.google.testing.compile.JavaFileObjects;
import javax.tools.JavaFileObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import static com.google.testing.compile.JavaSourceSubjectFactory.javaSource;
import static com.google.testing.compile.JavaSourcesSubjectFactory.javaSources;
import static dagger.tests.integration.ProcessorTestUtils.daggerProcessors;
import static java.util.Arrays.asList;
import static org.truth0.Truth.ASSERT;
@RunWith(JUnit4.class)
public final class ModuleAdapterGenerationTest {
/**
* Shows current behavior for a {@link dagger.Provides provides method}
* used to supply an injected ctor parameter.
*
* <ul>
* <li>{@code ProvidesAdapter} invokes the module's provides method on
* {@code get}</li>
* <li>On {@code getBindings}, the above is newed up and linked to its type
* key.
* <li>{@code InjectAdapter} contains a field for the parameter binding,
* referenced in {@code getDependencies} and set on {@code attach}</li>
* <li>On {@code get}, the injected constructor is called with the value of
* {@link dagger.internal.Binding#get}</li>
* </ul>
*/
@Test public void providerForCtorInjection() {
JavaFileObject sourceFile = JavaFileObjects.forSourceString("Field", Joiner.on("\n").join(
"import dagger.Module;",
"import dagger.Provides;",
"import javax.inject.Inject;",
"class Field {",
" static class A { final String name; @Inject A(String name) { this.name = name; }}",
" @Module(injects = { A.class, String.class })",
" static class AModule { @Provides String name() { return \"foo\"; }}",
"}"));
JavaFileObject expectedModuleAdapter =
JavaFileObjects.forSourceString("Field$AModule$$ModuleAdapter", Joiner.on("\n").join(
"import dagger.internal.BindingsGroup;",
"import dagger.internal.ModuleAdapter;",
"import dagger.internal.ProvidesBinding;",
"import javax.inject.Provider;",
"public final class Field$AModule$$ModuleAdapter",
" extends ModuleAdapter<Field.AModule> {",
" private static final String[] INJECTS = ",
" {\"members/Field$A\", \"members/java.lang.String\"};",
" private static final Class<?>[] STATIC_INJECTIONS = {};",
" private static final Class<?>[] INCLUDES = {};",
" public Field$AModule$$ModuleAdapter() {",
" super(Field.AModule.class, INJECTS, STATIC_INJECTIONS, false, INCLUDES, true, false);",
" }",
" @Override public Field.AModule newModule() {",
" return new Field.AModule();",
" }",
" @Override public void getBindings(BindingsGroup bindings, Field.AModule module) {",
" bindings.contributeProvidesBinding(\"java.lang.String\",",
" new NameProvidesAdapter(module));", // eager new!
" }",
" public static final class NameProvidesAdapter", // corresponds to method name
" extends ProvidesBinding<String> implements Provider<String> {",
" private final Field.AModule module;",
" public NameProvidesAdapter(Field.AModule module) {",
" super(\"java.lang.String\", NOT_SINGLETON, \"Field.AModule\", \"name\");",
" this.module = module;",
" setLibrary(false);",
" }",
" @Override public String get() {",
" return module.name();", // corresponds to @Provides method
" }",
" }",
"}"));
JavaFileObject expectedInjectAdapter =
JavaFileObjects.forSourceString("Field$A$$InjectAdapter", Joiner.on("\n").join(
"import dagger.internal.Binding;",
"import dagger.internal.Linker;",
"import java.util.Set;",
"import javax.inject.Provider;",
"public final class Field$A$$InjectAdapter",
" extends Binding<Field.A> implements Provider<Field.A> {",
" private Binding<String> name;", // for ctor
" public Field$A$$InjectAdapter() {",
" super(\"Field$A\", \"members/Field$A\", NOT_SINGLETON, Field.A.class);",
" }",
" @Override @SuppressWarnings(\"unchecked\")",
" public void attach(Linker linker) {",
" name = (Binding<String>)linker.requestBinding(", // binding key is not a class
" \"java.lang.String\", Field.A.class, getClass().getClassLoader());",
" }",
" @Override public void getDependencies(",
" Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings) {",
" getBindings.add(name);", // name is added to dependencies
" }",
" @Override public Field.A get() {",
" Field.A result = new Field.A(name.get());", // adds ctor param
" return result;",
" }",
"}"));
ASSERT.about(javaSource()).that(sourceFile).processedWith(daggerProcessors())
.compilesWithoutError()
.and()
.generatesSources(expectedModuleAdapter, expectedInjectAdapter);
}
@Test public void injectsMembersInjectedAndProvidedAndConstructedTypes() {
JavaFileObject sourceFile = JavaFileObjects.forSourceString("Field", Joiner.on("\n").join(
"import dagger.Module;",
"import dagger.Provides;",
"import javax.inject.Inject;",
"class Field {",
" static class A { final String name; @Inject A(String name) { this.name = name; }}",
" static class B { @Inject String name; }",
" @Module(injects = { A.class, String.class, B.class })",
" static class AModule { @Provides String name() { return \"foo\"; }}",
"}"));
JavaFileObject expectedModuleAdapter =
JavaFileObjects.forSourceString("Field$AModule$$ModuleAdapter", Joiner.on("\n").join(
"import dagger.internal.BindingsGroup;",
"import dagger.internal.ModuleAdapter;",
"import dagger.internal.ProvidesBinding;",
"import javax.inject.Provider;",
"public final class Field$AModule$$ModuleAdapter extends ModuleAdapter<Field.AModule> {",
" private static final String[] INJECTS = ",
" {\"members/Field$A\", \"members/java.lang.String\", \"members/Field$B\"};",
" private static final Class<?>[] STATIC_INJECTIONS = {};",
" private static final Class<?>[] INCLUDES = {};",
" public Field$AModule$$ModuleAdapter() {",
" super(Field.AModule.class, INJECTS, STATIC_INJECTIONS, false, INCLUDES, true, false);",
" }",
" @Override public Field.AModule newModule() {",
" return new Field.AModule();",
" }",
" @Override public void getBindings(BindingsGroup bindings, Field.AModule module) {",
" bindings.contributeProvidesBinding(\"java.lang.String\",",
" new NameProvidesAdapter(module));", // eager new!
" }",
" public static final class NameProvidesAdapter", // corresponds to method name
" extends ProvidesBinding<String> implements Provider<String> {",
" private final Field.AModule module;",
" public NameProvidesAdapter(Field.AModule module) {",
" super(\"java.lang.String\", NOT_SINGLETON, \"Field.AModule\", \"name\");",
" this.module = module;",
" setLibrary(false);",
" }",
" @Override public String get() {",
" return module.name();", // corresponds to @Provides method
" }",
" }",
"}"));
JavaFileObject expectedInjectAdapterA =
JavaFileObjects.forSourceString("Field$A$$InjectAdapter", Joiner.on("\n").join(
"import dagger.internal.Binding;",
"import dagger.internal.Linker;",
"import java.util.Set;",
"import javax.inject.Provider;",
"public final class Field$A$$InjectAdapter",
" extends Binding<Field.A> implements Provider<Field.A> {",
" private Binding<String> name;", // For Constructor.
" public Field$A$$InjectAdapter() {",
" super(\"Field$A\", \"members/Field$A\", NOT_SINGLETON, Field.A.class);",
" }",
" @Override @SuppressWarnings(\"unchecked\")",
" public void attach(Linker linker) {",
" name = (Binding<String>)linker.requestBinding(",
" \"java.lang.String\", Field.A.class, getClass().getClassLoader());",
" }",
" @Override public void getDependencies(",
" Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings) {",
" getBindings.add(name);", // Name is added to dependencies.
" }",
" @Override public Field.A get() {",
" Field.A result = new Field.A(name.get());", // Adds constructor parameter.
" return result;",
" }",
"}"));
JavaFileObject expectedInjectAdapterB =
JavaFileObjects.forSourceString("Field$B$$InjectAdapter", Joiner.on("\n").join(
"import dagger.MembersInjector;",
"import dagger.internal.Binding;",
"import dagger.internal.Linker;",
"import java.util.Set;",
"import javax.inject.Provider;",
"public final class Field$B$$InjectAdapter",
" extends Binding<Field.B> implements Provider<Field.B>, MembersInjector<Field.B> {",
" private Binding<String> name;", // For field.
" public Field$B$$InjectAdapter() {",
" super(\"Field$B\", \"members/Field$B\", NOT_SINGLETON, Field.B.class);",
" }",
" @Override @SuppressWarnings(\"unchecked\")",
" public void attach(Linker linker) {",
" name = (Binding<String>)linker.requestBinding(",
" \"java.lang.String\", Field.B.class, getClass().getClassLoader());",
" }",
" @Override public void getDependencies(",
" Set<Binding<?>> getBindings, Set<Binding<?>> injectMembersBindings) {",
" injectMembersBindings.add(name);", // Name is added to dependencies.
" }",
" @Override public Field.B get() {",
" Field.B result = new Field.B();",
" injectMembers(result);",
" return result;",
" }",
" @Override public void injectMembers(Field.B object) {",
" object.name = name.get();", // Inject field.
" }",
"}"));
ASSERT.about(javaSource()).that(sourceFile).processedWith(daggerProcessors())
.compilesWithoutError()
.and()
.generatesSources(expectedModuleAdapter, expectedInjectAdapterA, expectedInjectAdapterB);
}
@Test public void providesHasParameterNamedModule() {
JavaFileObject a = JavaFileObjects.forSourceString("A", Joiner.on("\n").join(
"import javax.inject.Inject;",
"class A { @Inject A(){ }}"));
JavaFileObject b = JavaFileObjects.forSourceString("B", Joiner.on("\n").join(
"import javax.inject.Inject;",
"class B { @Inject B(){ }}"));
JavaFileObject module = JavaFileObjects.forSourceString("BModule", Joiner.on("\n").join(
"import dagger.Module;",
"import dagger.Provides;",
"import javax.inject.Inject;",
"@Module(injects = B.class)",
"class BModule { @Provides B b(A module) { return new B(); }}"));
ASSERT.about(javaSources()).that(asList(a, b, module)).processedWith(daggerProcessors())
.compilesWithoutError();
}
}
| 47.725191 | 100 | 0.59477 |
54fcfef1f7b9f94abce45930c7c5cfca1c966867 | 1,175 | package com.itgacl.magic4j.common.bean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* 分页参数
*
*/
@Data
@ApiModel("分页参数对象")
public class PageParam {
/**
* 当前页,最小值为1
*/
@ApiModelProperty(value = "当前页,从1开始",required = true)
@NotNull(message = "当前页不能为空")
@Min(value = 1,message = "分页页码不正确,最小值为1")
private Integer pageNum;
/**
* 每页显示记录数,最小值为1
*/
@ApiModelProperty(value = "每页显示记录数,最小值为1",required = true)
@NotNull(message = "每页显示记录数不能为空")
@Min(value = 1,message = "每页显示记录数不正确,最小值为1")
private Integer pageSize;
/**
* 排序列
*
*/
@ApiModelProperty("排序列")
private String orderByColumn;
/**
* 排序的方向 "desc" 或者 "asc".
*
*/
@ApiModelProperty("排序的方向 desc或者asc")
private String sortDirection;
public String getOrderBy() {
if (StringUtils.isEmpty(orderByColumn)) {
return "";
}
return orderByColumn + " " + sortDirection;
}
}
| 20.982143 | 62 | 0.63234 |
ff324577f5092591dc3e2baa1f2c274540dadba5 | 5,256 | package com.builtbroken.mc.test.grid;
import com.builtbroken.mc.api.tile.ITileModuleProvider;
import com.builtbroken.mc.testing.junit.AbstractTest;
import com.builtbroken.mc.testing.junit.VoltzTestRunner;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import com.builtbroken.mc.lib.grid.branch.NodeBranchPart;
import com.builtbroken.mc.prefab.tile.TileConductor;
import com.builtbroken.mc.testing.junit.world.FakeWorld;
import com.builtbroken.mc.lib.transform.vector.Location;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Map;
/**
* Created by robert on 11/20/2014.
*/
@RunWith(VoltzTestRunner.class)
public class NodeConnectionTest extends AbstractTest
{
private FakeWorld world;
Location center;
@Test
public void testWireExists()
{
assertNotNull("Test can't continue without wire being created", WireMap.wire());
assertNotNull("Wire is not in the block registry", Block.blockRegistry.getObject("wire"));
}
public void testForNodes()
{
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
//Build
buildWireInDir(ForgeDirection.UNKNOWN);
buildWireInDir(side);
//Test
Location vec = center.add(side);
TileEntity tile = vec.getTileEntity();
if(tile instanceof ITileModuleProvider)
{
NodeBranchPart part = ((ITileModuleProvider) tile).getModule(NodeBranchPart.class, side.getOpposite());
if(part == null)
fail("Failed to get NodeBranchPart from tile at " + vec + " from side " + side.getOpposite());
}
else
{
fail("Something failed good as the wire is not an instance of INodeProvider");
}
//Cleanup
center.setBlockToAir();
center.add(side).setBlockToAir();
}
}
public void testSingleConnections()
{
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
//Build
buildWireInDir(ForgeDirection.UNKNOWN);
buildWireInDir(side);
centerNode().buildConnections();
//Test
checkForOnlyConnection(side);
//Cleanup
center.setBlockToAir();
center.add(side).setBlockToAir();
}
}
//Full all side connection test
public void testAllSides()
{
buildFullWireSet();
//Trigger connection building in the wire
TileEntity tile = center.getTileEntity();
if(tile instanceof TileConductor)
{
((TileConductor) tile).getNode().buildConnections();
}
//Test connections
assertNotNull("There should be a tile at Vec(8,8,8)", tile);
if(tile instanceof TileConductor)
{
NodeBranchPart node = ((TileConductor) tile).getNode();
assertNotNull("There should be a node at Vec(8,8,8)", node);
if (node.getConnections().size() == 0)
fail("Should be at least one connection");
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{
boolean found = false;
for(Map.Entry<NodeBranchPart, ForgeDirection> entry : node.getConnections().entrySet())
{
if(entry.getValue() == dir.getOpposite())
{
found = true;
}
}
if(!found)
fail("No " + dir + " connection found");
}
}
//Clean up
world.clear();
}
private void checkForOnlyConnection(ForgeDirection dir)
{
assertEquals("Should only have one connection", centerNode().getConnections().size(), 1, 0);
for(Map.Entry<NodeBranchPart, ForgeDirection> entry : centerNode().getConnections().entrySet())
{
if(entry.getValue() != dir)
fail("Should only contain connection on the " + dir + " side\nFound a connection on side " + entry.getValue());
}
}
private void buildFullWireSet()
{
//Surround wire with wires
for(ForgeDirection dir : ForgeDirection.values())
{
buildWireInDir(dir);
}
}
private void buildWireInDir(ForgeDirection dir)
{
Location vec = center.add(dir);
vec.setBlock(WireMap.wire());
assertNotNull("Failed to place wire at " + vec, vec.getBlock());
assertNotNull("Failed to place tile at " + vec, vec.getTileEntity());
}
private NodeBranchPart centerNode()
{
TileEntity tile = center.getTileEntity();
if(tile instanceof TileConductor)
{
return ((TileConductor) tile).getNode();
}
return null;
}
@Override
public void setUpForTest(String name)
{
world = new FakeWorld();
center = new Location(world, 8, 8, 8);
}
@Override
public void tearDownForTest(String name)
{
world.clear();
center = null;
world = null;
}
}
| 30.55814 | 127 | 0.590563 |
bc0a9cfd404d9f86f19d0a681778671794e48049 | 918 | package fr.pturpin.hackathon.iceandfire.strategy.comparator.train;
import fr.pturpin.hackathon.iceandfire.cell.GameCell;
import fr.pturpin.hackathon.iceandfire.command.TrainCommand;
import fr.pturpin.hackathon.iceandfire.game.GameRepository;
import fr.pturpin.hackathon.iceandfire.strategy.comparator.BeatableOpponentComparator;
import fr.pturpin.hackathon.iceandfire.strategy.comparator.OpponentCount;
public class BeatableOpponentTrainComparator extends BeatableOpponentComparator<TrainCommand> {
public BeatableOpponentTrainComparator(GameRepository gameRepository) {
super(gameRepository);
}
@Override
protected GameCell getCell(TrainCommand command) {
return command.getCell();
}
@Override
protected int evaluateScore(TrainCommand command, OpponentCount count) {
int level = command.getTrainedUnit().getLevel();
return count.score(level);
}
}
| 34 | 95 | 0.786492 |
65f51ef8c7134bb0f09ef066f71d13dbc9bc8c6a | 319 | package com.github.bgalek.utils.devicedetect;
class KindleTablet implements Detector {
@Override
public boolean test(String userAgent) {
return userAgent.toLowerCase().contains("kindle");
}
@Override
public DefaultDevices getDevice() {
return DefaultDevices.TABLET_KINDLE;
}
}
| 22.785714 | 58 | 0.702194 |
144829e934a7497063e23e0b0083e9d5111cea2a | 359 | package com.skeqi.mes.service.yp.oa;
/**
* 加签
*
* @author yinp
* @data 2021年6月29日
*/
public interface CountersignService {
/**
* 加签提交
*
* @param listNo
* @param userId
* @param countersignUser
* @param dis
*/
public void sub(String listNo, Integer userId, String countersignUser,String signatureMethod, String dis) throws Exception;
}
| 16.318182 | 124 | 0.685237 |
c82a7d8f4f968c9bf9da133ce37e8c741303c3d3 | 2,040 | package ru.assisttech.sdk.network;
import android.text.TextUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* HTTP request parameters include:
* - request method GET or POST
* - HTTP header fields (added with addProperty() method)
* - request data (payload)
*/
class HttpRequest {
private String method;
private String data;
private Map<String, String> properties;
public HttpRequest() {
properties = new HashMap<>();
}
public void setMethod(String value) {
method = value;
}
public String getMethod() {
return method;
}
public void setData(String value) {
data = value;
}
public String getData() {
return data;
}
public boolean hasData() {
return !TextUtils.isEmpty(data);
}
public void addProperty(String name, String value) {
properties.put(name, value);
}
public Map<String, String> getProperties() {
return properties;
}
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("HttpRequest:\n[\n");
builder.append("Request method: ").append(method).append("\n");
builder.append("Request headers:\n");
if (properties != null && !properties.isEmpty()) {
Set<Map.Entry<String, String>> entrySet = properties.entrySet();
for (Map.Entry<String, String> entry : entrySet) {
builder.append(" ")
.append(entry.getKey())
.append(" : ")
.append(entry.getValue())
.append("\n");
}
} else {
builder.append(" no headers\n");
}
builder.append("Request data:\n");
if (TextUtils.isEmpty(data)) {
builder.append(" no data\n");
} else {
builder.append(data).append("\n");
}
builder.append("]");
return builder.toString();
}
}
| 25.185185 | 76 | 0.554902 |
82cc14bb80b22fafb98b4acab5fb24efedda2701 | 2,039 | package example.rxbus;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.zsp.util.R;
import com.zsp.utilone.rxbus.RxBus;
import com.zsp.utilone.rxbus.annotation.Subscribe;
import com.zsp.utilone.rxbus.annotation.Tag;
import com.zsp.utilone.rxbus.thread.EventThread;
import com.zsp.utilone.toast.ToastUtils;
import butterknife.ButterKnife;
import butterknife.OnClick;
import value.UtilRxBusConstant;
/**
* @decs: RxBus页
* @author: 郑少鹏
* @date: 2019/8/28 14:05
*/
public class RxBusActivity extends AppCompatActivity {
@Override
protected void onDestroy() {
super.onDestroy();
RxBus.get().unregister(this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rx_bus);
ButterKnife.bind(this);
RxBus.get().register(this);
}
@SuppressLint("NonConstantResourceId")
@OnClick({R.id.rxBusActivityRxBusTestOne, R.id.rxBusActivityRxBusTestTwo})
public void onViewClicked(View view) {
switch (view.getId()) {
// RxBus测试一
case R.id.rxBusActivityRxBusTestOne:
RxBus.get().post(UtilRxBusConstant.RXBUS_TEST_$_ONE, "1");
break;
// RxBus测试二
case R.id.rxBusActivityRxBusTestTwo:
RxBus.get().post(UtilRxBusConstant.RXBUS_TEST_$_TWO, 2);
break;
default:
break;
}
}
@Subscribe(thread = EventThread.MAIN_THREAD, tags = {@Tag(UtilRxBusConstant.RXBUS_TEST_$_ONE)})
public void rxBusTestOne(String string) {
// RxBus测试一
ToastUtils.shortShow(this, string);
}
@Subscribe(thread = EventThread.MAIN_THREAD, tags = {@Tag(UtilRxBusConstant.RXBUS_TEST_$_TWO)})
public void rxBusTestTwo(Integer integer) {
// RxBus测试二
ToastUtils.shortShow(this, String.valueOf(integer));
}
}
| 29.550725 | 99 | 0.672388 |
3061b42cbc76b41b707d31709eee09d26425e165 | 1,978 | package com.shoufeng.threadlocal;
/**
* 线程局部 (thread-local) 变量
*
* @author shoufeng
*/
public class Demo {
ThreadLocal<String> threadLocal = new ThreadLocal<String>() {
/**
* 返回此线程局部变量的当前线程的“初始值”。线程第一次使用 get() 方法访问变量时将调用此方法,但如果线程之前调用了 set(T) 方法,则不会对该线程再调用 initialValue 方法。通常,此方法对每个线程最多调用一次,但如果在调用 get() 后又调用了 remove(),则可能再次调用此方法。
* 该实现返回 null;如果程序员希望线程局部变量具有 null 以外的值,则必须为 ThreadLocal 创建子类,并重写此方法。通常将使用匿名内部类完成此操作。
*
* 返回:
* 返回此线程局部变量的初始值
* @return 初始值
*/
@Override
protected String initialValue() {
return super.initialValue();
}
};
public static void main(String[] args) {
Demo demo = new Demo();
new Thread(() -> {
System.out.println(Thread.currentThread().getName() + "获取初始值" + demo.getThreadLocalValue());
demo.setThreadLocalA();
System.out.println(Thread.currentThread().getName() + "获取设置A后的值" + demo.getThreadLocalValue());
try {
Thread.sleep(5000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}).start();
new Thread(() -> {
System.out.println(Thread.currentThread().getName() + "获取初始值" + demo.getThreadLocalValue());
try {
Thread.sleep(2000L);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(Thread.currentThread().getName() + "获取未设置时候的值" + demo.getThreadLocalValue());
demo.setThreadLocalB();
System.out.println(Thread.currentThread().getName() + "获取设置B后的值" + demo.getThreadLocalValue());
}).start();
}
public void setThreadLocalA() {
threadLocal.set("A");
}
public void setThreadLocalB() {
threadLocal.set("B");
}
public String getThreadLocalValue() {
return threadLocal.get();
}
}
| 31.396825 | 165 | 0.570273 |
5bfc4527c2c2fe40b78c44ec54d6b0ce3e227b37 | 3,434 | /*
* Copyright 2017 ~ 2025 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.wl4g.devops.scm.config;
import java.lang.annotation.Annotation;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import com.wl4g.devops.common.config.AbstractOptionalControllerConfiguration;
import com.wl4g.devops.scm.annotation.ScmEndpoint;
import com.wl4g.devops.scm.context.ConfigContextHandler;
import com.wl4g.devops.scm.context.GuideConfigSourceHandler;
import com.wl4g.devops.scm.endpoint.ScmServerEndpoint;
import com.wl4g.devops.scm.publish.ConfigSourcePublisher;
import com.wl4g.devops.scm.publish.DefaultRedisConfigSourcePublisher;
import com.wl4g.devops.support.cache.JedisService;
import static com.wl4g.devops.common.constants.SCMDevOpsConstants.*;
/**
* SCM auto configuration
*
* @author Wangl.sir <[email protected]>
* @version v1.0 2019年5月27日
* @since
*/
public class ScmAutoConfiguration extends AbstractOptionalControllerConfiguration {
final public static String BEAN_MVC_EXECUTOR = "mvcTaskExecutor";
@Bean
@ConfigurationProperties(prefix = "spring.cloud.devops.scm")
public ScmProperties scmProperties() {
return new ScmProperties();
}
@Bean
@ConditionalOnMissingBean
public ConfigContextHandler configContextHandler() {
return new GuideConfigSourceHandler();
}
@Bean
public ConfigSourcePublisher configSourcePublisher(JedisService jedisService) {
return new DefaultRedisConfigSourcePublisher(scmProperties(), jedisService);
}
@Bean(BEAN_MVC_EXECUTOR)
public ThreadPoolTaskExecutor mvcTaskExecutor(ScmProperties config) {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(config.getCorePoolSize());
executor.setQueueCapacity(config.getQueueCapacity());
executor.setMaxPoolSize(config.getMaxPoolSize());
return executor;
}
@Bean
public ScmWebMvcConfigurer scmWebMvcConfigurer(ScmProperties config,
@Qualifier(BEAN_MVC_EXECUTOR) ThreadPoolTaskExecutor executor) {
return new ScmWebMvcConfigurer(config, executor);
}
//
// Endpoint's
//
@Bean
public ScmServerEndpoint scmServerEnndpoint(ConfigContextHandler contextHandler) {
return new ScmServerEndpoint(contextHandler);
}
@Bean
public PrefixHandlerMapping scmServerEndpointPrefixHandlerMapping() {
return createPrefixHandlerMapping();
}
@Override
protected String getMappingPrefix() {
return URI_S_BASE;
}
@Override
protected Class<? extends Annotation> annotationClass() {
return ScmEndpoint.class;
}
} | 33.019231 | 84 | 0.778684 |
b296552deedaf9f3f884cdd6005051733e9f7cca | 1,077 | /*
* Copyright (C) 2016 Frank Hossfeld <[email protected]>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package de.gishmo.gwt.example.mvp4g2.simpleapplication.client.ui;
import com.github.mvp4g.mvp4g2.core.eventbus.IsEventBus;
import de.gishmo.gwt.mvp4g2.core.ui.AbstractPresenter;
import de.gishmo.gwt.mvp4g2.core.ui.IsLazyReverseView;
public class AbstractSimpleApplicationPresenter<E extends IsEventBus, V extends IsLazyReverseView<?>>
extends AbstractPresenter<E, V> {
public AbstractSimpleApplicationPresenter() {
super();
}
}
| 33.65625 | 101 | 0.765088 |
16c0bb3e49ba0de03808c0527eb2fcd500ec65f2 | 3,404 | package object;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import org.opencv.core.Mat;
import org.opencv.core.MatOfPoint;
import org.opencv.core.MatOfPoint2f;
import org.opencv.highgui.HighGui;
import org.opencv.imgproc.Imgproc;
/**
*
* @author Pedro
*/
public class Component {
private double area;
private double perimeter;
private double circularity;
private boolean isSample = false;
private HaralickFeatures haralick;
private Mat image, original;
public int x, y;
public Component(Mat image, double area) {
this.image = image;
this.area = area;
}
public Component(Mat image, double area, int x, int y) {
this.image = image;
this.area = area;
this.x = x;
this.y = y;
}
public double getArea() {
return area;
}
public double getCircularity() {
return circularity;
}
public HaralickFeatures getHaralick() {
return haralick;
}
public Mat getImage() {
return image;
}
public void setPerimeter(double perimeter) {
this.perimeter = perimeter;
}
public void setOriginal(Mat og) {
this.original = og.clone();
}
public Mat getOriginal(){
return this.original;
}
public boolean compareFeatures(Component c) {
int matches = 0;
System.out.println("Energia: " + this.haralick.getEnergia() + " x " + c.haralick.getEnergia());
if( Math.abs(this.haralick.getEnergia() - c.haralick.getEnergia()) < 1){
matches++;
}
System.out.println("Contrasete: " + this.haralick.getContraste() + " x " + c.haralick.getContraste());
if( Math.abs(this.haralick.getContraste() - c.haralick.getContraste()) < 2){
matches++;
}
System.out.println("Variância: " + this.haralick.getVariancia() + " x " + c.haralick.getVariancia());
if( Math.abs(this.haralick.getVariancia() - c.haralick.getVariancia()) < 1){
matches++;
}
System.out.println("Entropia: " + this.haralick.getEntropia() + " x " + c.haralick.getEntropia());
if( Math.abs(this.haralick.getEntropia() - c.haralick.getEntropia()) < 1){
matches++;
}
if (matches >= 3) return true;
else return false;
}
public void calculateFeatures(){
// finds contour of object to find its arc length
ArrayList<MatOfPoint> contours = new ArrayList<>();
Mat hierarchy = new Mat();
Imgproc.findContours(this.getImage(), contours, hierarchy, Imgproc.RETR_EXTERNAL, Imgproc.CHAIN_APPROX_SIMPLE);
// each object only has 1 contour so we fetch it
MatOfPoint objContour = contours.get(0);
// perimeter
double cont_perimeter = Imgproc.arcLength(new MatOfPoint2f(contours.get(0).toArray()), true);
this.perimeter = cont_perimeter;
// circularity
double circularity = (Math.pow(this.perimeter, 2) / (4 * Math.PI * this.area));
this.circularity = circularity;
// haralick
this.haralick = new HaralickFeatures((BufferedImage) HighGui.toBufferedImage(this.original));
}
}
| 30.123894 | 120 | 0.585194 |
a4c29e8a5c535dc82ba26294bf13991d89641f67 | 2,037 | /*
* Copyright (C) 2012 The Android Open Source Project
*
* 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 info.ipeanut.youngsamples.supportv4.app;
import info.ipeanut.youngsamples.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTabHost;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class FragmentTabsFragmentSupport extends Fragment {
private FragmentTabHost mTabHost;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mTabHost = new FragmentTabHost(getActivity());
mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.fragment1);
mTabHost.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"),
FragmentStackSupport.CountingFragment.class, null);
mTabHost.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"),
LoaderCursorSupport.CursorLoaderListFragment.class, null);
mTabHost.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"),
LoaderCustomSupport.AppListFragment.class, null);
mTabHost.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"),
LoaderThrottleSupport.ThrottledLoaderListFragment.class, null);
return mTabHost;
}
@Override
public void onDestroyView() {
super.onDestroyView();
mTabHost = null;
}
}
| 36.375 | 81 | 0.725577 |
4e33e90281f8a89efcd9c7ced92be309553ec560 | 1,840 | /*
* Copyright 2021 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thoughtworks.go.apiv1.webhook.request.payload.pr;
import com.google.gson.annotations.SerializedName;
import com.thoughtworks.go.apiv1.webhook.request.json.HostedBitbucketRepository;
import static com.thoughtworks.go.apiv1.webhook.request.payload.pr.PrPayload.State.CLOSED;
import static com.thoughtworks.go.apiv1.webhook.request.payload.pr.PrPayload.State.OPEN;
import static java.lang.String.format;
@SuppressWarnings({"unused", "RedundantSuppression"})
public class HostedBitbucketPR implements PrPayload {
@SerializedName("pullRequest")
private PR pr;
@Override
public String identifier() {
return format("#%s", pr.number);
}
@Override
public State state() {
return pr.open ? OPEN : CLOSED;
}
@Override
public String hostname() {
return pr.dest.repository.hostname();
}
@Override
public String fullName() {
return pr.dest.repository.fullName();
}
private static class PR {
@SerializedName("toRef")
private Ref dest;
private boolean open;
@SerializedName("id")
private int number;
}
private static class Ref {
private HostedBitbucketRepository repository;
}
}
| 28.307692 | 90 | 0.705978 |
7142141a9661cee6618c1e0837658aa2ee065786 | 5,830 | package org.bouncycastle.openpgp.examples;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.security.Security;
import java.util.Iterator;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.bcpg.BCPGOutputStream;
import org.bouncycastle.bcpg.sig.NotationData;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openpgp.PGPPrivateKey;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.PGPSignatureGenerator;
import org.bouncycastle.openpgp.PGPSignatureSubpacketGenerator;
import org.bouncycastle.openpgp.PGPSignatureSubpacketVector;
import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator;
import org.bouncycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder;
import org.bouncycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
/**
* A simple utility class that directly signs a public key and writes the signed key to "SignedKey.asc" in
* the current working directory.
* <p>
* To sign a key: DirectKeySignature secretKeyFile secretKeyPass publicKeyFile(key to be signed) NotationName NotationValue.<br/>
* </p><p>
* To display a NotationData packet from a publicKey previously signed: DirectKeySignature signedPublicKeyFile.<br/>
* </p><p>
* <b>Note</b>: this example will silently overwrite files, nor does it pay any attention to
* the specification of "_CONSOLE" in the filename. It also expects that a single pass phrase
* will have been used.
* </p>
*/
public class DirectKeySignature
{
public static void main(
String[] args)
throws Exception
{
Security.addProvider(new BouncyCastleProvider());
if (args.length == 1)
{
PGPPublicKeyRing ring = new PGPPublicKeyRing(PGPUtil.getDecoderStream(new FileInputStream(args[0])), new JcaKeyFingerprintCalculator());
PGPPublicKey key = ring.getPublicKey();
// iterate through all direct key signautures and look for NotationData subpackets
Iterator iter = key.getSignaturesOfType(PGPSignature.DIRECT_KEY);
while(iter.hasNext())
{
PGPSignature sig = (PGPSignature)iter.next();
System.out.println("Signature date is: " + sig.getHashedSubPackets().getSignatureCreationTime());
NotationData[] data = sig.getHashedSubPackets().getNotationDataOccurences();//.getSubpacket(SignatureSubpacketTags.NOTATION_DATA);
for (int i = 0; i < data.length; i++)
{
System.out.println("Found Notaion named '"+data[i].getNotationName()+"' with content '"+data[i].getNotationValue()+"'.");
}
}
}
else if (args.length == 5)
{
// gather command line arguments
PGPSecretKeyRing secRing = new PGPSecretKeyRing(PGPUtil.getDecoderStream(new FileInputStream(args[0])), new JcaKeyFingerprintCalculator());
String secretKeyPass = args[1];
PGPPublicKeyRing ring = new PGPPublicKeyRing(PGPUtil.getDecoderStream(new FileInputStream(args[2])), new JcaKeyFingerprintCalculator());
String notationName = args[3];
String notationValue = args[4];
// create the signed keyRing
PGPPublicKeyRing sRing = new PGPPublicKeyRing(new ByteArrayInputStream(signPublicKey(secRing.getSecretKey(), secretKeyPass, ring.getPublicKey(), notationName, notationValue, true)), new JcaKeyFingerprintCalculator());
ring = sRing;
// write the created keyRing to file
ArmoredOutputStream out = new ArmoredOutputStream(new FileOutputStream("SignedKey.asc"));
sRing.encode(out);
out.flush();
out.close();
}
else
{
System.err.println("usage: DirectKeySignature secretKeyFile secretKeyPass publicKeyFile(key to be signed) NotationName NotationValue");
System.err.println("or: DirectKeySignature signedPublicKeyFile");
}
}
private static byte[] signPublicKey(PGPSecretKey secretKey, String secretKeyPass, PGPPublicKey keyToBeSigned, String notationName, String notationValue, boolean armor) throws Exception
{
OutputStream out = new ByteArrayOutputStream();
if (armor)
{
out = new ArmoredOutputStream(out);
}
PGPPrivateKey pgpPrivKey = secretKey.extractPrivateKey(new JcePBESecretKeyDecryptorBuilder().setProvider("BC").build(secretKeyPass.toCharArray()));
PGPSignatureGenerator sGen = new PGPSignatureGenerator(new JcaPGPContentSignerBuilder(secretKey.getPublicKey().getAlgorithm(), PGPUtil.SHA1).setProvider("BC"));
sGen.init(PGPSignature.DIRECT_KEY, pgpPrivKey);
BCPGOutputStream bOut = new BCPGOutputStream(out);
sGen.generateOnePassVersion(false).encode(bOut);
PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator();
boolean isHumanReadable = true;
spGen.setNotationData(true, isHumanReadable, notationName, notationValue);
PGPSignatureSubpacketVector packetVector = spGen.generate();
sGen.setHashedSubpackets(packetVector);
bOut.flush();
if (armor)
{
out.close();
}
return PGPPublicKey.addCertification(keyToBeSigned, sGen.generate()).getEncoded();
}
}
| 42.867647 | 229 | 0.704117 |
ba41ab4ed46e73524f523fb06ee6e35925bd404b | 599 | package com.pj.squashrestapp.repository;
import com.pj.squashrestapp.model.League;
import com.pj.squashrestapp.model.LeagueRole;
import com.pj.squashrestapp.model.RoleForLeague;
import java.util.List;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;
/** */
public interface RoleForLeagueRepository extends JpaRepository<RoleForLeague, Long> {
@EntityGraph(attributePaths = {"players"})
RoleForLeague findByLeagueAndLeagueRole(League league, LeagueRole leagueRole);
List<RoleForLeague> findByLeague(League league);
}
| 33.277778 | 85 | 0.823038 |
cc7382e7154d9178e7226edd15a687e40698dbd4 | 9,916 | package de.ipvs.as.mbp.web.rest;
import de.ipvs.as.mbp.RestConfiguration;
import de.ipvs.as.mbp.constants.Constants;
import de.ipvs.as.mbp.domain.user.User;
import de.ipvs.as.mbp.domain.user.UserLoginData;
import de.ipvs.as.mbp.error.*;
import de.ipvs.as.mbp.repository.UserRepository;
import de.ipvs.as.mbp.repository.projection.UserExcerpt;
import de.ipvs.as.mbp.service.user.UserService;
import de.ipvs.as.mbp.service.user.UserSessionService;
import de.ipvs.as.mbp.util.Pages;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.hateoas.EntityModel;
import org.springframework.hateoas.PagedModel;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo;
/**
* REST Controller for managing users.
*/
@RestController
@RequestMapping(RestConfiguration.BASE_PATH + "/users")
@Api(tags = {"Users"})
public class RestUserController {
@Autowired
private UserRepository userRepository;
@Autowired
private UserService userService;
@Autowired
private UserSessionService userSessionService;
@GetMapping(produces = "application/hal+json")
@ApiOperation(value = "Retrieves all existing users.", notes = "Requires admin privileges.", produces = "application/hal+json")
@ApiResponses({@ApiResponse(code = 200, message = "Success!"),
@ApiResponse(code = 401, message = "Not authorized to access users (admin privileges required)!")})
public ResponseEntity<PagedModel<EntityModel<User>>> all(@ApiParam(value = "Page parameters", required = true) Pageable pageable) throws MissingAdminPrivilegesException, EntityNotFoundException {
// Check whether the requesting user has admin privileges
userService.requireAdmin();
//Retrieve all users and create entity models for them
List<EntityModel<User>> entityModels = userService.getAll(pageable).toList().stream().map(user -> new EntityModel<User>(user, linkTo(getClass()).slash(user.getId()).withSelfRel())).collect(Collectors.toList());
//Create paged model from users
PagedModel<EntityModel<User>> pagedModel = new PagedModel<>(entityModels, Pages.metaDataOf(pageable, entityModels.size()));
//Create and return response
return ResponseEntity.ok(pagedModel);
}
@GetMapping(value = "/{username:" + Constants.USERNAME_REGEX + "}", produces = "application/hal+json")
@ApiOperation(value = "Returns an user entity by its username", notes = "Requires admin privileges.", produces = "application/hal+json")
@ApiResponses({@ApiResponse(code = 200, message = "Success!"),
@ApiResponse(code = 401, message = "Not authorized to access users (admin privileges required)!"),
@ApiResponse(code = 404, message = "User or requesting user not found!")})
public ResponseEntity<User> oneForUsername(@PathVariable @ApiParam(value = "Username of the user", example = "MyUser", required = true) String username) throws EntityNotFoundException, MissingAdminPrivilegesException {
// Check whether the requesting user has admin privileges
userService.requireAdmin();
// Retrieve user from database
return ResponseEntity.ok(userService.getForUsername(username));
}
@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE, produces = "application/hal+json")
@ApiOperation(value = "Creates a new user.", produces = "application/hal+json")
@ApiResponses({@ApiResponse(code = 201, message = "User successfully created!"),
@ApiResponse(code = 409, message = "Username is already in use!")})
public ResponseEntity<User> create(@Valid @RequestBody @ApiParam(value = "The user to create", required = true) User user) {
return ResponseEntity.status(HttpStatus.CREATED).body(userService.create(user));
}
@GetMapping(value = "/searchByUsername", produces = "application/hal+json")
@ApiOperation(value = "Searches and returns all users whose username contain a given query string.", notes = "Returns an empty list in case the query is empty.", produces = "application/hal+json")
@ApiResponses({@ApiResponse(code = 200, message = "Query result.")})
public ResponseEntity<List<UserExcerpt>> searchByUsername(@RequestParam("query") @ApiParam(value = "Query string", example = "admin", required = true) String query) {
// If query is empty -> return an empty result list, otherwise search for matching users
return query.isEmpty() ? ResponseEntity.ok(new ArrayList<>()) : ResponseEntity.ok(userRepository.findByUsernameContains(query.trim()));
}
@PostMapping(value = "/login")
@ApiOperation(value = "Performs login for a user", produces = "application/hal+json")
@ApiResponses({@ApiResponse(code = 200, message = "Success"),
@ApiResponse(code = 403, message = "Invalid password!"),
@ApiResponse(code = 404, message = "User or requesting user not found!")})
public ResponseEntity<User> login(@RequestBody @ApiParam(value = "Login data", required = true) UserLoginData loginData) throws InvalidPasswordException, UserNotLoginableException {
// Retrieve user from database
User user = userService.getForUsername(loginData.getUsername().toLowerCase(Locale.ENGLISH));
//Check if login into user is possible
if (!user.isLoginable()) {
throw new UserNotLoginableException("This user is a system user and thus login is impossible.");
}
// Check password
if (!userService.checkPassword(user.getId(), loginData.getPassword())) {
throw new InvalidPasswordException();
}
//Create new session and retrieve corresponding cookie
ResponseCookie sessionCookie = userSessionService.createSessionCookie(user);
//Build response from cookie
return ResponseEntity.ok().header(HttpHeaders.SET_COOKIE, sessionCookie.toString()).body(user);
}
@DeleteMapping(path = "/{userId}")
@ApiOperation(value = "Deletes an existing user identified by its ID.")
@ApiResponses({@ApiResponse(code = 204, message = "Success!"),
@ApiResponse(code = 401, message = "Not authorized to delete the user!"),
@ApiResponse(code = 404, message = "User not found!")})
public ResponseEntity<Void> delete(@PathVariable("userId") String userId) throws MissingAdminPrivilegesException, EntityNotFoundException {
// Check whether the requesting user has admin privileges
userService.requireAdmin();
// Try to delete the user
userService.deleteUser(userId);
return ResponseEntity.noContent().build();
}
@PostMapping(path = "/{userId}/promote")
@ApiOperation(value = "Promotes an existing user to an administrator.")
@ApiResponses({@ApiResponse(code = 200, message = "Success!"), @ApiResponse(code = 401, message = "Not authorized to promote users (admin privileges required)!")})
public ResponseEntity<EntityModel<User>> promoteUser(@PathVariable("userId") String userId) throws MissingAdminPrivilegesException, EntityNotFoundException {
// Check whether the requesting user has admin privileges
userService.requireAdmin();
// Update user
User updatedUser = userService.promoteUser(userId);
//Return entity model of the updated user
return ResponseEntity.ok(new EntityModel<User>(updatedUser, linkTo(getClass()).slash(updatedUser.getId()).withSelfRel()));
}
@PostMapping(path = "/{userId}/degrade")
@ApiOperation(value = "Degrades an existing administrator to a non-administrator.")
@ApiResponses({@ApiResponse(code = 200, message = "Success!"), @ApiResponse(code = 401, message = "Not authorized to degrade users (admin privileges required)!"), @ApiResponse(code = 403, message = "Cannot degrade yourself.")})
public ResponseEntity<EntityModel<User>> degradeUser(@PathVariable("userId") String userId) throws MissingAdminPrivilegesException, EntityNotFoundException {
// Check whether the requesting user has admin privileges
userService.requireAdmin();
//Check if current user is the same as the affected user
if (userService.getLoggedInUser().getId().equals(userId)) {
throw new MBPException(HttpStatus.FORBIDDEN, "To prevent lock-outs, you cannot degrade yourself.");
}
// Update user
User updatedUser = userService.degradeUser(userId);
//Return entity model of the updated user
return ResponseEntity.ok(new EntityModel<User>(updatedUser, linkTo(getClass()).slash(updatedUser.getId()).withSelfRel()));
}
@PostMapping(path = "/{userId}/change_password")
@ApiOperation(value = "Updates the password of an existing user.")
@ApiResponses({@ApiResponse(code = 200, message = "Success!"), @ApiResponse(code = 401, message = "Not authorized to change the password (admin privileges required)!")})
public ResponseEntity<EntityModel<User>> changePassword(@PathVariable("userId") String userId, @RequestBody @ApiParam(value = "The new password to set (plain text)", required = true) User newPassword) throws MissingAdminPrivilegesException, EntityNotFoundException {
// Check whether the requesting user has admin privileges
userService.requireAdmin();
// Update user
User updatedUser = userService.changePassword(userId, newPassword.getPassword());
//Return entity model of the updated user
return ResponseEntity.ok(new EntityModel<User>(updatedUser, linkTo(getClass()).slash(updatedUser.getId()).withSelfRel()));
}
}
| 54.483516 | 270 | 0.718334 |
68ac1be69162cde89bc7806badd46e0f435cb380 | 3,847 | package com.nextfaze.poweradapters;
import android.widget.TextView;
import com.nextfaze.poweradapters.binding.Binder;
import com.nextfaze.poweradapters.binding.Mapper;
import com.nextfaze.poweradapters.binding.MapperBuilder;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import static com.google.common.truth.Truth.assertThat;
@RunWith(RobolectricTestRunner.class)
public final class MapperBuilderTest {
private static final Predicate<Object> ALWAYS = new Predicate<Object>() {
@Override
public boolean apply(Object o) {
return true;
}
};
private static final Predicate<Object> NEVER = new Predicate<Object>() {
@Override
public boolean apply(Object o) {
return false;
}
};
@Rule
public MockitoRule mMockito = MockitoJUnit.rule();
@Mock
private Binder<A, TextView> mBinder1;
@Mock
private Binder<A, TextView> mBinder2;
@Mock
private Binder<B, TextView> mBinder3;
@Mock
private Binder<B, TextView> mBinder4;
@Mock
private Binder<C, TextView> mBinder5;
@Mock
private Binder<C, TextView> mBinder6;
private Mapper<A> mMapper;
@Before
public void setUp() throws Exception {
mMapper = new MapperBuilder<A>()
.bind(C.class, mBinder5)
.bind(A.class, mBinder1, new Predicate<A>() {
@Override
public boolean apply(A a) {
return a.get() == 2;
}
})
.bind(A.class, mBinder2)
.build();
}
@Test
public void derivedItemResolvesToFirstAssignableBinding() {
assertThat(mMapper.getBinder(new D(0), 0)).isEqualTo(mBinder2);
}
@Test
public void derivedItemResolvesToFirstAssignableBindingThatMatchesPredicate() {
assertThat(mMapper.getBinder(new D(2), 0)).isEqualTo(mBinder1);
}
@Test
public void nonBoundItemResolvesToNull() {
Mapper<A> mapper = new MapperBuilder<A>()
.bind(C.class, mBinder5)
.bind(A.class, mBinder1, new Predicate<A>() {
@Override
public boolean apply(A a) {
return a.get() == 2;
}
})
.build();
assertThat(mapper.getBinder(new D(3), 0)).isNull();
}
@Test
public void absentPredicateEquivalentToAlwaysTrue() {
Mapper<B> mapper1 = new MapperBuilder<B>()
.bind(B.class, mBinder3)
.build();
Mapper<B> mapper2 = new MapperBuilder<B>()
.bind(B.class, mBinder3, ALWAYS)
.build();
assertThat(mapper1.getBinder(new D(3), 0)).isEqualTo(mBinder3);
assertThat(mapper2.getBinder(new D(3), 0)).isEqualTo(mBinder3);
}
@Test
public void alwaysFalsePredicateNeverPasses() {
Mapper<? super C> mapper = new MapperBuilder<C>()
.bind(C.class, mBinder5, NEVER)
.build();
assertThat(mapper.getBinder(new C(7), 0)).isNull();
}
class A {
final int value;
A(int value) {
this.value = value;
}
int get() {
return value;
}
}
class B extends A {
B(int value) {
super(value);
}
}
class C extends A {
C(int value) {
super(value);
}
}
class D extends B {
D(int value) {
super(value);
}
}
class E {
}
}
| 25.646667 | 83 | 0.571094 |
8b396ac2286841a0898896c8529293afccf48be2 | 336 | package com.polaris.common.utils;
/**
* @author CNPolaris
* @version 1.0
*/
public interface CallBack {
/**
* 回调执行方法
*/
void executor();
/**
* 本回调任务名称
* @return /
*/
default String getCallBackName() {
return Thread.currentThread().getId() + ":" + this.getClass().getName();
}
}
| 16 | 80 | 0.544643 |
3bb5f69fca27c5be2946d0778b25019627c551b5 | 5,217 | package singlePlayer;
import java.util.Map;
import java.awt.Font;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JFrame;
import java.awt.EventQueue;
import javax.swing.JButton;
import java.awt.SystemColor;
import java.awt.event.ActionEvent;
import javax.swing.SwingConstants;
import java.awt.event.ActionListener;
public class SummeryView {
// Create Objects :
private JFrame frame;
// Create VARIABLES :
private static String username, correctAnswers, allAnswers, correctLetter, allLetter;
public static void main(String[] args, Map<String, String> values) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
correctAnswers = values.get("correctAnswers");
allAnswers = values.get("allAnswers");
correctLetter = values.get("correctLetter");
allLetter = values.get("allLetter");
username = values.get("username");
SummeryView window = new SummeryView();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public SummeryView() {
frame = new JFrame();
JLabel labelUser = new JLabel(""),
lblUser = new JLabel("User : "),
AllLetter = new JLabel(allLetter),
lblLetters = new JLabel("Letters"),
lblAnswers = new JLabel("Answers"),
ALlAnswers = new JLabel(allAnswers),
CorrectLetter = new JLabel(correctLetter),
CorrectAnswer = new JLabel(correctAnswers),
lblCorrecyAnswerFrom = new JLabel("Correct letter from "),
lblCorrectAnswertfrom = new JLabel("Correct answer from ");
JButton btnExit = new JButton("Exit"), btnTryAgain = new JButton("try again");
// ser att to objects :
btnExit.setBounds(448, 373, 97, 25);
btnExit.setForeground(new Color(0, 0, 128));
btnExit.setFont(new Font("Tahoma", Font.BOLD, 20));
lblCorrecyAnswerFrom.setBounds(143, 121, 235, 16);
lblCorrecyAnswerFrom.setForeground(new Color(105, 105, 105));
lblCorrecyAnswerFrom.setFont(new Font("Tahoma", Font.BOLD, 20));
lblCorrecyAnswerFrom.setHorizontalAlignment(SwingConstants.CENTER);
CorrectLetter.setBounds(75, 112, 56, 31);
CorrectLetter.setForeground(new Color(0, 128, 0));
CorrectLetter.setFont(new Font("Tahoma", Font.BOLD, 25));
CorrectLetter.setHorizontalAlignment(SwingConstants.CENTER);
AllLetter.setBounds(390, 121, 41, 19);
AllLetter.setForeground(new Color(0, 0, 0));
AllLetter.setFont(new Font("Tahoma", Font.BOLD, 25));
lblLetters.setBounds(351, 121, 235, 16);
lblLetters.setFont(new Font("Tahoma", Font.BOLD, 20));
lblLetters.setForeground(SystemColor.controlDkShadow);
lblLetters.setHorizontalAlignment(SwingConstants.CENTER);
lblCorrectAnswertfrom.setBounds(143, 179, 235, 16);
lblCorrectAnswertfrom.setForeground(SystemColor.controlDkShadow);
lblCorrectAnswertfrom.setFont(new Font("Tahoma", Font.BOLD, 20));
lblCorrectAnswertfrom.setHorizontalAlignment(SwingConstants.CENTER);
lblAnswers.setBounds(413, 185, 132, 16);
lblAnswers.setFont(new Font("Tahoma", Font.BOLD, 20));
lblAnswers.setForeground(SystemColor.controlDkShadow);
lblAnswers.setHorizontalAlignment(SwingConstants.CENTER);
CorrectAnswer.setBounds(75, 170, 56, 31);
CorrectAnswer.setForeground(new Color(0, 128, 0));
CorrectAnswer.setFont(new Font("Tahoma", Font.BOLD, 25));
CorrectAnswer.setHorizontalAlignment(SwingConstants.CENTER);
ALlAnswers.setForeground(Color.BLACK);
ALlAnswers.setBounds(390, 182, 41, 19);
ALlAnswers.setFont(new Font("Tahoma", Font.BOLD, 25));
lblUser.setBounds(110, 29, 156, 25);
lblUser.setForeground(new Color(0, 255, 127));
lblUser.setFont(new Font("Tahoma", Font.BOLD, 25));
lblUser.setHorizontalAlignment(SwingConstants.CENTER);
labelUser.setText(username);
labelUser.setBounds(278, 29, 156, 25);
labelUser.setForeground(new Color(0, 255, 127));
labelUser.setFont(new Font("Tahoma", Font.BOLD, 25));
labelUser.setHorizontalAlignment(SwingConstants.CENTER);
btnTryAgain.setBounds(429, 312, 132, 31);
btnTryAgain.setForeground(new Color(0, 0, 128));
btnTryAgain.setFont(new Font("Tahoma", Font.BOLD, 20));
frame.setResizable(false);
frame.setBounds(620, 250, 616, 490);
frame.getContentPane().setBackground(new Color(255, 165, 0));
// add objects to form :
frame.getContentPane().add(lblUser);
frame.getContentPane().add(labelUser);
frame.getContentPane().add(btnExit);
frame.getContentPane().add(AllLetter);
frame.getContentPane().add(lblLetters);
frame.getContentPane().add(lblAnswers);
frame.getContentPane().add(ALlAnswers);
frame.getContentPane().setLayout(null);
frame.getContentPane().add(btnTryAgain);
frame.getContentPane().add(CorrectAnswer);
frame.getContentPane().add(CorrectLetter);
frame.getContentPane().add(lblCorrecyAnswerFrom);
frame.getContentPane().add(lblCorrectAnswertfrom);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Events :
btnTryAgain.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
LoginView.main(new String[] {});
}
});
btnExit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
}
} | 34.78 | 86 | 0.734713 |
8129b330d1a644bd9051c582f29a9c9eb37a89f0 | 5,229 | package org.infinispan.notifications.cachelistener;
import static org.infinispan.test.TestingUtil.k;
import static org.infinispan.test.TestingUtil.v;
import static org.testng.AssertJUnit.assertTrue;
import static org.testng.AssertJUnit.fail;
import java.lang.reflect.Method;
import javax.transaction.RollbackException;
import org.infinispan.Cache;
import org.infinispan.commons.CacheException;
import org.infinispan.configuration.cache.CacheMode;
import org.infinispan.configuration.cache.ConfigurationBuilder;
import org.infinispan.notifications.Listener;
import org.infinispan.notifications.cachelistener.annotation.CacheEntryCreated;
import org.infinispan.notifications.cachelistener.annotation.CacheEntryModified;
import org.infinispan.notifications.cachelistener.event.CacheEntryEvent;
import org.infinispan.remoting.transport.jgroups.SuspectException;
import org.infinispan.test.MultipleCacheManagersTest;
import org.testng.annotations.Test;
/**
* Tests listener exception behaivour when caches are configured with
* synchronization instead of XA.
*
* @author Galder Zamarreño
* @since 5.2
*/
@Test(groups = "functional", testName = "notifications.cachelistener.ListenerExceptionWithSynchronizationTest")
public class ListenerExceptionWithSynchronizationTest
extends MultipleCacheManagersTest {
@Override
protected void createCacheManagers() throws Throwable {
ConfigurationBuilder builder = getDefaultClusteredCacheConfig(
CacheMode.REPL_SYNC, true);
builder.transaction().useSynchronization(true);
createClusteredCaches(2, builder);
}
public void testPreOpExceptionListenerOnCreate(Method m) {
doCallsWithExcepList(m, true, FailureLocation.ON_CREATE);
}
public void testPostOpExceptionListenerOnCreate(Method m) {
// Post listener events now happen after commit, so failures there
// don't have an impact on the operation outcome with synchronization
doCallsNormal(m, false, FailureLocation.ON_CREATE);
}
public void testPreOpExceptionListenerOnPut(Method m) {
manager(0).getCache().put(k(m), "init");
doCallsWithExcepList(m, true, FailureLocation.ON_MODIFIED);
}
public void testPostOpExceptionListenerOnPut(Method m) {
manager(0).getCache().put(k(m), "init");
// Post listener events now happen after commit, so failures there
// don't have an impact on the operation outcome with synchronization
doCallsNormal(m, false, FailureLocation.ON_MODIFIED);
}
private void doCallsNormal(Method m,
boolean isInjectInPre, FailureLocation failLoc) {
Cache<String, String> cache = manager(0).getCache();
ErrorInducingListener listener =
new ErrorInducingListener(isInjectInPre, failLoc);
cache.addListener(listener);
cache.put(k(m), v(m));
}
private void doCallsWithExcepList(Method m,
boolean isInjectInPre, FailureLocation failLoc) {
Cache<String, String> cache = manager(0).getCache();
ErrorInducingListener listener =
new ErrorInducingListener(isInjectInPre, failLoc);
cache.addListener(listener);
try {
cache.put(k(m), v(m));
} catch (CacheException e) {
Throwable cause = e.getCause();
if (isInjectInPre)
assertExpectedException(cause, cause instanceof SuspectException);
else
assertExpectedException(cause, cause instanceof RollbackException);
// Expected, now try to simulate a failover
listener.injectFailure = false;
manager(1).getCache().put(k(m), v(m, 2));
return;
}
fail("Should have failed");
}
private void assertExpectedException(Throwable cause, boolean condition) {
assertTrue("Unexpected exception cause " + cause, condition);
}
@Listener
public static class ErrorInducingListener {
boolean injectFailure = true;
boolean isInjectInPre;
FailureLocation failureLocation;
public ErrorInducingListener(boolean injectInPre, FailureLocation failLoc) {
this.isInjectInPre = injectInPre;
this.failureLocation = failLoc;
}
@CacheEntryCreated
@SuppressWarnings("unused")
public void entryCreated(CacheEntryEvent event) throws Exception {
if (failureLocation == FailureLocation.ON_CREATE)
injectFailure(event);
}
@CacheEntryModified
@SuppressWarnings("unused")
public void entryModified(CacheEntryEvent event) throws Exception {
if (failureLocation == FailureLocation.ON_MODIFIED)
injectFailure(event);
}
private void injectFailure(CacheEntryEvent event) {
if (injectFailure) {
if (isInjectInPre && event.isPre())
throwSuspectException();
else if (!isInjectInPre && !event.isPre())
throwSuspectException();
}
}
private void throwSuspectException() {
throw new SuspectException(String.format(
"Simulated suspicion when isPre=%b and in %s",
isInjectInPre, failureLocation));
}
}
private static enum FailureLocation {
ON_CREATE, ON_MODIFIED
}
}
| 35.331081 | 111 | 0.711035 |
24a3b34bbf1632c02538433b4127e7879cb321bd | 802 | package com.atguigu.springcloud.controller;
import cn.hutool.core.util.StrUtil;
import com.oracle.tools.packager.Log;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
@RestController
@Slf4j
public class OrderZkController {
public static final String INVOKE_URL = "http://cloud-payment-service";
@Resource
private RestTemplate restTemplate;
@GetMapping("/consumer/payment/zk")
public Response getInfo(@PathVariable("id") Long id){
return restTemplate.getForObject(INVOKE_URL + "/payment/zk",Response.class);
}
}
| 30.846154 | 84 | 0.786783 |
2bdcad224d210411c414272c0e4519e586608682 | 5,932 | package com.github.k24.prefsovensample;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import com.github.k24.prefsoven.store.Pid;
import com.github.k24.prefsovensample.viewmodel.LastUpdated;
import com.github.k24.prefsovensample.prefs.LastUpdatedOven;
import com.github.k24.prefsovensample.viewmodel.Memo;
import com.github.k24.prefsovensample.prefs.MemoStore;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
private ListView memoList;
private List<Map<String, Object>> data;
private SimpleAdapter adapter;
private boolean paused;
private Pid modifiedPid;
private List<Pid> pids;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Header
final LastUpdatedOven lastUpdatedOven = App.lastUpdatedOven();
updateHeader(lastUpdatedOven);
// List
final MemoStore memoStore = App.memoStore();
String[] from = {memoStore.subject().name(), memoStore.body().name()};
int[] to = {android.R.id.text1, android.R.id.text2};
data = new ArrayList<>();
addAll(memoStore);
adapter = new SimpleAdapter(this, data, android.R.layout.simple_list_item_2, from, to);
memoList = (ListView) findViewById(R.id.list);
memoList.setAdapter(adapter);
memoList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
PrefsEditActivity.startActivity(MainActivity.this, 0, pids.get(position).index());
}
});
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Memo memo = new Memo();
memo.subject = "New " + (memoStore.getControlPanel().pids().size() + 1);
memo.body = "Edit this!";
Pid pid = memoStore.getControlPanel().preheat(memo);
data.add(pid.valuesAsMapWithName());
adapter.notifyDataSetChanged();
pids.add(pid);
lastUpdatedOven.getControlPanel().preheat(LastUpdated.newInstance(memo));
updateHeader(lastUpdatedOven);
}
});
}
private void addAll(MemoStore memoStore) {
pids = new ArrayList<>(memoStore.getControlPanel().pids());
Collections.sort(pids, Pid.comparator());
for (Pid pid : pids) {
data.add(pid.valuesAsMapWithName());
}
}
void updateHeader(LastUpdatedOven lastUpdatedOven) {
TextView summary = (TextView) findViewById(R.id.summary);
TextView lastUpdatedAt = (TextView) findViewById(R.id.last_updated_at);
if (lastUpdatedOven.summary().exists()) {
summary.setText(lastUpdatedOven.summary().get());
lastUpdatedAt.setText(LastUpdated.formatDatetime(lastUpdatedOven.updatedAt().get()));
} else {
summary.setText("Add new memo!");
lastUpdatedAt.setText("");
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_clear) {
App.memoStore().getControlPanel().clear();
data.clear();
pids.clear();
adapter.notifyDataSetChanged();
LastUpdatedOven lastUpdatedOven = App.lastUpdatedOven();
lastUpdatedOven.getControlPanel().clear();
updateHeader(lastUpdatedOven);
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onResume() {
super.onResume();
paused = false;
if (modifiedPid != null) {
updateList(modifiedPid);
modifiedPid = null;
}
}
@Override
protected void onPause() {
super.onPause();
paused = true;
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (isFinishing()) return;
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
Pid pid = PrefsEditActivity.getPidFromResult(data);
if (paused) {
modifiedPid = pid;
} else {
updateList(pid);
}
}
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
private void updateList(Pid pid) {
// Tired... lol
data.clear();
addAll(App.memoStore());
adapter.notifyDataSetChanged();
updateHeader(App.lastUpdatedOven());
}
}
| 34.488372 | 98 | 0.630984 |
29c37e65055c10314e5afe32ad9ea97cb539dbcc | 667 | package cz.kulicka.util;
import com.sun.jna.platform.win32.Kernel32;
import com.sun.jna.platform.win32.WinBase;
import org.springframework.stereotype.Component;
@Component
public class WindowsSetSystemTime {
public boolean SetLocalTime(int wYear, int wMonth, int wDay, int wHour, int wMinute, int wSecond) {
Kernel32 kernel = Kernel32.INSTANCE;
WinBase.SYSTEMTIME newTime = new WinBase.SYSTEMTIME();
newTime.wYear = (short) wYear;
newTime.wMonth = (short) wMonth;
newTime.wDay = (short) wDay;
newTime.wHour = (short) wHour;
newTime.wMinute = (short) wMinute;
newTime.wSecond = (short) wSecond;
kernel.SetSystemTime(newTime);
return true;
}
}
| 29 | 100 | 0.751124 |
0a86b6aa12de7a038eeb32f51678625602596a34 | 1,046 | package com.example.entities;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Device {
@Id
private String deviceId;
private String deviceType;
private String deviceStatus;
private String bedId;
public Device(){}
public Device(String deviceId, String deviceType, String deviceStatus, String bedId) {
this.deviceId = deviceId;
this.deviceType = deviceType;
this.deviceStatus = deviceStatus;
this.bedId = bedId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public String getDeviceStatus() {
return deviceStatus;
}
public void setDeviceStatus(String deviceStatus) {
this.deviceStatus = deviceStatus;
}
public String getBedId() {
return bedId;
}
public void setBedId(String bedId) {
this.bedId = bedId;
}
}
| 21.791667 | 88 | 0.711281 |
ebcc942d2f21e6072a7dd380069de45b3dd5b4fc | 771 | //,temp,JmsConsumer.java,125,135,temp,SjmsProducer.java,216,232
//,3
public class xxx {
protected void testConnectionOnStartup() throws FailedToCreateConsumerException {
try {
LOG.debug("Testing JMS Connection on startup for destination: {}", getDestinationName());
Connection con = listenerContainer.getConnectionFactory().createConnection();
JmsUtils.closeConnection(con);
LOG.debug("Successfully tested JMS Connection on startup for destination: {}", getDestinationName());
} catch (Exception e) {
String msg = "Cannot get JMS Connection on startup for destination " + getDestinationName();
throw new FailedToCreateConsumerException(getEndpoint(), msg, e);
}
}
}; | 48.1875 | 113 | 0.679637 |
9626d82e32709c4e927191fa636fe7451fa11489 | 484 | package extrabiomes.core;
import java.util.Locale;
import extrabiomes.lib.Const;
public abstract class Version {
public static final String MOD_ID = Const.API_MOD_ID;
public static final String MOD_NAME = "Extrabiomes Core";
public static final String VERSION = "@VERSION@";
public static final String API_VERSION = Const.API_VERSION;
public static final String CHANNEL = MOD_ID;
public static final String TEXTURE_PATH = MOD_ID.toLowerCase(Locale.ENGLISH) + ":";
}
| 30.25 | 84 | 0.766529 |
09544ab3f35ab62067b1b743056cf4f89091d021 | 1,198 | package com.github.zhgxun.leetcode.thread;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.Semaphore;
public class H2O {
private final Semaphore semaphoreH = new Semaphore(2);
private final Semaphore semaphoreO = new Semaphore(1);
private final CyclicBarrier barrier = new CyclicBarrier(3, () -> {
semaphoreH.release(2);
semaphoreO.release();
});
public H2O() {
}
public void hydrogen(Runnable releaseHydrogen) throws InterruptedException {
semaphoreH.acquire();
// releaseHydrogen.run() outputs "H". Do not change or remove this line.
releaseHydrogen.run();
try {
barrier.await();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
public void oxygen(Runnable releaseOxygen) throws InterruptedException {
semaphoreO.acquire();
// releaseOxygen.run() outputs "O". Do not change or remove this line.
releaseOxygen.run();
try {
barrier.await();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
}
| 29.95 | 80 | 0.640234 |
1ecc7367fcf070f4675fc3672e63049b4609b6c0 | 398 | package ro.rasel.spring.microservices.component.ssl.server;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.PropertySource;
@ConditionalOnProperty(name = "server.ssl.enabled", havingValue = "true", matchIfMissing = true)
@PropertySource("classpath:application-serverSsl.properties")
public class SslClientComponent {
}
| 39.8 | 96 | 0.836683 |
252c1d9020b2c04b79d18c3d05badcb5e15b1c02 | 4,060 | package io.jans.as.client.ws.rs;
import io.jans.as.client.*;
import io.jans.as.client.client.AssertBuilder;
import io.jans.as.model.common.ResponseType;
import io.jans.as.model.common.SubjectType;
import io.jans.as.model.crypto.signature.SignatureAlgorithm;
import io.jans.as.model.jwt.JwtClaimName;
import io.jans.as.model.register.ApplicationType;
import io.jans.as.model.util.StringUtils;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
/**
* Turn off consent for pairwise / openid-only scope
*
* @author Javier Rojas Blum
* @version January 24, 2022
*/
public class TurnOffConsentForPairwiseOpenIdOnlyConsentTest extends BaseTest {
/**
* If a client is configured for pairwise identifiers, and the openid scope is the only scope requested,
* there is no need to present the consent page, because the AS is not releasing any PII.
*/
@Parameters({"redirectUris", "redirectUri", "userId", "userSecret", "sectorIdentifierUri"})
@Test
public void turnOffConsentForPairwiseOpenIdOnlyConsentTest(
final String redirectUris, final String redirectUri, final String userId, final String userSecret,
final String sectorIdentifierUri) {
showTitle("turnOffConsentForPairwiseOpenIdOnlyConsentTest");
List<ResponseType> responseTypes = Arrays.asList(
ResponseType.TOKEN,
ResponseType.ID_TOKEN);
// 1. Dynamic Registration
RegisterRequest registerRequest = new RegisterRequest(ApplicationType.WEB, "jans test app",
StringUtils.spaceSeparatedToList(redirectUris));
registerRequest.setResponseTypes(responseTypes);
registerRequest.setUserInfoSignedResponseAlg(SignatureAlgorithm.RS256);
registerRequest.setSubjectType(SubjectType.PAIRWISE);
registerRequest.setSectorIdentifierUri(sectorIdentifierUri);
RegisterClient registerClient = new RegisterClient(registrationEndpoint);
registerClient.setRequest(registerRequest);
RegisterResponse registerResponse = registerClient.exec();
showClient(registerClient);
AssertBuilder.registerResponse(registerResponse).created().check();
String clientId = registerResponse.getClientId();
// 2. Request Authorization
List<String> scopes = Arrays.asList("openid");
String nonce = UUID.randomUUID().toString();
String state = UUID.randomUUID().toString();
AuthorizationRequest authorizationRequest = new AuthorizationRequest(
responseTypes, clientId, scopes, redirectUri, nonce);
authorizationRequest.setState(state);
AuthorizationResponse authorizationResponse = authenticateResourceOwner(
authorizationEndpoint, authorizationRequest, userId, userSecret, false);
assertNotNull(authorizationResponse.getLocation());
assertNotNull(authorizationResponse.getAccessToken());
assertNotNull(authorizationResponse.getState());
assertNotNull(authorizationResponse.getTokenType());
assertNotNull(authorizationResponse.getExpiresIn());
assertNotNull(authorizationResponse.getScope());
assertNotNull(authorizationResponse.getIdToken());
String accessToken = authorizationResponse.getAccessToken();
// 3. Request user info
UserInfoClient userInfoClient = new UserInfoClient(userInfoEndpoint);
userInfoClient.setJwksUri(jwksUri);
UserInfoResponse userInfoResponse = userInfoClient.execUserInfo(accessToken);
showClient(userInfoClient);
assertEquals(userInfoResponse.getStatus(), 200);
assertNotNull(userInfoResponse.getClaim(JwtClaimName.SUBJECT_IDENTIFIER));
assertNotNull(userInfoResponse.getClaim(JwtClaimName.ISSUER));
assertNotNull(userInfoResponse.getClaim(JwtClaimName.AUDIENCE));
}
}
| 41.85567 | 110 | 0.739409 |
e30b3acf9b49bdbcc5c1586c773ed0ebbec4e26a | 494 | package Chapter_2;
public class Example_02 {
public static void main(String[] args) {
// Declare some variables
float sum = 0.1f + 0.1f + 0.1f + 0.1f + 0.1f + 0.1f + 0.1f + 0.1f + 0.1f + 0.1f;
float num = 1.0f;
// Is sum equal to num
boolean equal = (num == sum);
// Print the result on the console
System.out.println("num = " + num + " sum = " + sum + " equal = " + equal);
}
}
// Output: num = 1.0 sum = 1.0000001 equal = false | 35.285714 | 88 | 0.536437 |
413404bea61217d0dcbd81244b5d8186748ddc5e | 252 | // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
package com.microsoft.signalr;
public enum TransferFormat {
TEXT,
BINARY
}
| 25.2 | 111 | 0.746032 |
d90e60b3dbe759dac78e683a51382093ca0ac0f9 | 7,220 | /*
* Copyright (c) 2008-2013 EMC Corporation
* All Rights Reserved
*/
package com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.processor.detailedDiscovery;
import com.emc.storageos.db.client.DbClient;
import com.emc.storageos.db.client.model.StringSet;
import com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume;
import com.emc.storageos.db.client.model.Volume;
import com.emc.storageos.plugins.BaseCollectionException;
import com.emc.storageos.plugins.common.Constants;
import com.emc.storageos.plugins.common.domainmodel.Operation;
import com.emc.storageos.volumecontroller.impl.plugins.SMICommunicationInterface;
import com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.processor.StorageProcessor;
import com.emc.storageos.volumecontroller.impl.smis.SmisConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.cim.CIMArgument;
import javax.cim.CIMInstance;
import javax.cim.CIMObjectPath;
import javax.cim.CIMProperty;
import javax.wbem.client.WBEMClient;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
*
* StorageProcessor class to process data about meta members for a meta volume and set this data
* in volume instance.
* This class is used in storage volume rediscovery and ummanaged volume discovery contexts.
*/
public class MetaVolumeMembersProcessor extends StorageProcessor {
private Logger _logger = LoggerFactory.getLogger(MetaVolumeMembersProcessor.class);
private static final String[] META_MEMBER_SIZE_INFO = new String[] { SmisConstants.CP_CONSUMABLE_BLOCKS, SmisConstants.CP_BLOCK_SIZE };
private List<Object> _args;
@Override
public void processResult(
Operation operation, Object resultObj, Map<String, Object> keyMap)
throws BaseCollectionException {
try {
DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
CIMObjectPath[] metaMembersPaths = (CIMObjectPath[]) getFromOutputArgs((CIMArgument[]) resultObj, "OutElements");
if (metaMembersPaths == null || (metaMembersPaths.length == 0)) {
_logger.info(String.format("There are no meta members to process"));
} else {
_logger.debug(String.format("Processing meta members: %s", Arrays.toString(metaMembersPaths)));
// Get volume from db
_logger.debug(String.format("Args size: %s", _args.size()));
Object[] arguments = (Object[]) _args.get(0);
CIMArgument theElement = ((CIMArgument[]) arguments[2])[1];
_logger.info(String.format("TheElement: %s, type %s", theElement.getValue().toString(), theElement.getValue().getClass()
.toString()));
CIMObjectPath theElementPath = (CIMObjectPath) theElement.getValue();
UnManagedVolume preExistingVolume = null;
String isMetaVolume = "true";
String nativeGuid;
// Check if storage volume exists in db (the method is called from re-discovery context).
nativeGuid = getVolumeNativeGuid(theElementPath);
Volume storageVolume = checkStorageVolumeExistsInDB(nativeGuid, dbClient);
if (null == storageVolume || storageVolume.getInactive()) {
// Check if unmanaged volume exists in db (the method is called from unmanaged volumes discovery context).
nativeGuid = getUnManagedVolumeNativeGuidFromVolumePath(theElementPath);
_logger.debug("Volume nativeguid :" + nativeGuid);
preExistingVolume = checkUnManagedVolumeExistsInDB(nativeGuid, dbClient);
if (null == preExistingVolume) {
_logger.debug("Volume Info Object not found :" + nativeGuid);
return;
}
isMetaVolume = preExistingVolume.getVolumeCharacterstics()
.get(UnManagedVolume.SupportedVolumeCharacterstics.IS_METAVOLUME.toString());
} else {
_logger.debug("Volume managed by Bourne :" + storageVolume.getNativeGuid());
isMetaVolume = storageVolume.getIsComposite().toString();
}
if (isMetaVolume.equalsIgnoreCase("false")) {
_logger.error(String.format("MetaVolumeMembersProcessor called for regular volume: %s", nativeGuid));
return;
}
Integer membersCount = metaMembersPaths.length;
// get meta member size. use second member --- the first member will show size of meta volume itself.
CIMObjectPath metaMemberPath = metaMembersPaths[1];
CIMInstance cimVolume = client.getInstance(metaMemberPath, false,
false, META_MEMBER_SIZE_INFO);
CIMProperty consumableBlocks = cimVolume.getProperty(SmisConstants.CP_CONSUMABLE_BLOCKS);
CIMProperty blockSize = cimVolume.getProperty(SmisConstants.CP_BLOCK_SIZE);
// calculate size = consumableBlocks * block size
Long size = Long.valueOf(consumableBlocks.getValue().toString()) * Long.valueOf(blockSize.getValue().toString());
// set meta member count and meta members size for meta volume (required for volume expansion)
if (null != preExistingVolume) {
StringSet metaMembersCount = new StringSet();
metaMembersCount.add(membersCount.toString());
preExistingVolume.putVolumeInfo(UnManagedVolume.SupportedVolumeInformation.META_MEMBER_COUNT.toString(),
metaMembersCount);
StringSet metaMemberSize = new StringSet();
metaMemberSize.add(size.toString());
preExistingVolume.putVolumeInfo(UnManagedVolume.SupportedVolumeInformation.META_MEMBER_SIZE.toString(), metaMemberSize);
// persist unmanaged volume in db
dbClient.persistObject(preExistingVolume);
} else {
storageVolume.setMetaMemberCount(membersCount);
storageVolume.setMetaMemberSize(size);
storageVolume.setTotalMetaMemberCapacity(membersCount * size);
// persist volume in db
dbClient.persistObject(storageVolume);
}
_logger.info(String.format("Meta member info: meta member count --- %s, blocks --- %s, block size --- %s, size --- %s .",
membersCount,
consumableBlocks.getValue().toString(),
blockSize.getValue().toString(), size));
}
} catch (Exception e) {
_logger.error("Processing meta volume information failed :", e);
}
}
@Override
protected void setPrerequisiteObjects(List<Object> inputArgs) throws BaseCollectionException {
_args = inputArgs;
}
} | 50.84507 | 140 | 0.646814 |
12f89952538c04611740d7c93199ddef8b9777e0 | 1,411 | package org.noear.weed.generator.entity;
public final class Names {
public static final String tag_source = "source";
public static final String tag_entity = "entityGenerator";
public static final String tag_table = "table";
public static final String att_schema = "schema";
public static final String att_url = "url";
public static final String att_username = "username";
public static final String att_password = "password";
public static final String att_driverClassName = "driverClassName";
public static final String att_namingStyle = "namingStyle";
public static final String att_typeStyle = "typeStyle";
public static final String att_targetPackage = "targetPackage";
public static final String att_entityName = "entityName";
public static final String att_tableName = "tableName";
public static final String att_domainName = "domainName";
public static final String val_camel="camel";
public static final String sym_entityName="${entityName}";
public static final String sym_domainName="${domainName}";
public static final String sym_tableName="${tableName}";
public static final String sym_fields="${fields}";
public static final String sym_fields_public="${fields_public}";
public static final String sym_fields_getter="${fields_getter}";
public static final String sym_fields_setter="${fields_setter}";
}
| 42.757576 | 71 | 0.746988 |
ef36d98b243461154188c4f712cec25d6ad3b54b | 7,463 | /* Copyright (C) 2017-2019 Andreas Shimokawa, Aniruddha Adhikary, Daniele
Gobbetti, ivanovlev, kalaee, lazarosfs, McSym28, M. Hadi, Roi Greenberg,
Ted Stein, Thomas, Yaron Shahrabani
This file is part of Gadgetbridge.
Gadgetbridge is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gadgetbridge is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.util;
import org.apache.commons.lang3.text.WordUtils;
import java.text.Normalizer;
import java.util.HashMap;
import java.util.Map;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
public class LanguageUtils {
//transliteration map with english equivalent for unsupported chars
private static Map<Character, String> transliterateMap = new HashMap<Character, String>(){
{
//extended ASCII characters
put('œ', "oe"); put('ª', "a"); put('º', "o"); put('«',"\""); put('»',"\"");
// Scandinavian characters
put('Æ',"Ae"); put('æ',"ae");
put('Ø',"Oe"); put('ø',"oe");
put('Å',"Aa"); put('å',"aa");
//german characters
put('ä',"ae"); put('ö',"oe"); put('ü',"ue");
put('Ä',"Ae"); put('Ö',"Oe"); put('Ü',"Üe");
put('ß',"ss"); put('ẞ',"SS");
//russian chars
put('а', "a"); put('б', "b"); put('в', "v"); put('г', "g"); put('д', "d"); put('е', "e"); put('ё', "jo"); put('ж', "zh");
put('з', "z"); put('и', "i"); put('й', "jj"); put('к', "k"); put('л', "l"); put('м', "m"); put('н', "n"); put('о', "o");
put('п', "p"); put('р', "r"); put('с', "s"); put('т', "t"); put('у', "u"); put('ф', "f"); put('х', "kh"); put('ц', "c");
put('ч', "ch");put('ш', "sh");put('щ', "shh");put('ъ', "\"");put('ы', "y"); put('ь', "'"); put('э', "eh"); put('ю', "ju");
put('я', "ja");
//hebrew chars
put('א', "a"); put('ב', "b"); put('ג', "g"); put('ד', "d"); put('ה', "h"); put('ו', "u"); put('ז', "z"); put('ח', "kh");
put('ט', "t"); put('י', "y"); put('כ', "c"); put('ל', "l"); put('מ', "m"); put('נ', "n"); put('ס', "s"); put('ע', "'");
put('פ', "p"); put('צ', "ts"); put('ק', "k"); put('ר', "r"); put('ש', "sh"); put('ת', "th"); put('ף', "f"); put('ץ', "ts");
put('ך', "ch");put('ם', "m");put('ן', "n");
// greek chars
put('α',"a");put('ά',"a");put('β',"v");put('γ',"g");put('δ',"d");put('ε',"e");put('έ',"e");put('ζ',"z");put('η',"i");
put('ή',"i");put('θ',"th");put('ι',"i");put('ί',"i");put('ϊ',"i");put('ΐ',"i");put('κ',"k");put('λ',"l");put('μ',"m");
put('ν',"n");put('ξ',"ks");put('ο',"o");put('ό',"o");put('π',"p");put('ρ',"r");put('σ',"s");put('ς',"s");put('τ',"t");
put('υ',"y");put('ύ',"y");put('ϋ',"y");put('ΰ',"y");put('φ',"f");put('χ',"ch");put('ψ',"ps");put('ω',"o");put('ώ',"o");
put('Α',"A");put('Ά',"A");put('Β',"B");put('Γ',"G");put('Δ',"D");put('Ε',"E");put('Έ',"E");put('Ζ',"Z");put('Η',"I");
put('Ή',"I");put('Θ',"TH");put('Ι',"I");put('Ί',"I");put('Ϊ',"I");put('Κ',"K");put('Λ',"L");put('Μ',"M");put('Ν',"N");
put('Ξ',"KS");put('Ο',"O");put('Ό',"O");put('Π',"P");put('Ρ',"R");put('Σ',"S");put('Τ',"T");put('Υ',"Y");put('Ύ',"Y");
put('Ϋ',"Y");put('Φ',"F");put('Χ',"CH");put('Ψ',"PS");put('Ω',"O");put('Ώ',"O");
//ukrainian characters
put('ґ', "gh"); put('є', "je"); put('і', "i"); put('ї', "ji"); put('Ґ', "GH"); put('Є', "JE"); put('І', "I"); put('Ї', "JI");
// Arabic
put('ا', "a"); put('ب', "b"); put('ت', "t"); put('ث', "th"); put('ج', "j"); put('ح', "7"); put('خ', "5");
put('د', "d"); put('ذ', "th"); put('ر', "r"); put('ز', "z"); put('س', "s"); put('ش', "sh"); put('ص', "9");
put('ض', "9'"); put('ط', "6"); put('ظ', "6'"); put('ع', "3"); put('غ', "3'"); put('ف', "f");
put('ق', "q"); put('ك', "k"); put('ل', "l"); put('م', "m"); put('ن', "n"); put('ه', "h");
put('و', "w"); put('ي', "y"); put('ى', "a"); put('ﺓ', "");
put('آ', "2"); put('ئ', "2"); put('إ', "2"); put('ؤ', "2"); put('أ', "2"); put('ء', "2");
// Persian(Farsi)
put('پ', "p"); put('چ', "ch"); put('ژ', "zh"); put('ک', "k"); put('گ', "g"); put('ی', "y"); put('', " ");
put('؟', "?"); put('٪', "%"); put('؛', ";"); put('،', ","); put('۱', "1"); put('۲', "2"); put('۳', "3");
put('۴', "4"); put('۵', "5"); put('۶', "6"); put('۷', "7"); put('۸', "8"); put('۹', "9"); put('۰', "0");
put('»', "<"); put('«', ">"); put('ِ', "e"); put('َ', "a"); put('ُ', "o"); put('ّ', "");
// Polish
put('Ł', "L"); put('ł', "l");
//Lithuanian
put('ą', "a"); put('č', "c"); put('ę', "e"); put('ė', "e"); put('į', "i"); put('š', "s"); put('ų', "u"); put('ū', "u"); put('ž', "z");
//TODO: these must be configurable. If someone wants to transliterate cyrillic it does not mean his device has no German umlauts
//all or nothing is really bad here
}
};
/**
* Checks the status of transliteration option
* @return true if transliterate option is On, and false, if Off or not exist
*/
public static boolean transliterate()
{
return GBApplication.getPrefs().getBoolean("transliteration", false);
}
/**
* Replaces unsupported symbols to english
* @param txt input text
* @return transliterated text
*/
public static String transliterate(String txt){
if (txt == null || txt.isEmpty()) {
return txt;
}
StringBuilder message = new StringBuilder();
char[] chars = txt.toCharArray();
for (char c : chars)
{
message.append(transliterate(c));
}
String messageString = BengaliLanguageUtils.transliterate(message.toString());
return flattenToAscii(messageString);
}
/**
* Replaces unsupported symbol to english by {@code transliterateMap}
* @param c input char
* @return replacement text
*/
private static String transliterate(char c){
char lowerChar = Character.toLowerCase(c);
if (transliterateMap.containsKey(lowerChar)) {
String replace = transliterateMap.get(lowerChar);
if (lowerChar != c)
{
return WordUtils.capitalize(replace);
}
return replace;
}
return String.valueOf(c);
}
/**
* Converts the diacritics
* @param string input text
* @return converted text
*/
private static String flattenToAscii(String string) {
string = Normalizer.normalize(string, Normalizer.Form.NFD);
return string.replaceAll("\\p{M}", "");
}
}
| 45.785276 | 146 | 0.469918 |
b4f541301564046caf469a994ef2659b7d16e7a0 | 2,652 | package io.github.anantharajuc.rc.infra.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.BeanIds;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import lombok.AllArgsConstructor;
@EnableWebSecurity
@AllArgsConstructor
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class ApplicationSecurityConfiguration extends WebSecurityConfigurerAdapter
{
private final UserDetailsService userDetailsService;
private final JwtAuthenticationFilter jwtAuthenticationFilter;
@Bean(BeanIds.AUTHENTICATION_MANAGER)
@Override
public AuthenticationManager authenticationManagerBean() throws Exception
{
return super.authenticationManagerBean();
}
private static final String[] SWAGGER_MATCHERS =
{
"/v2/api-docs",
"/configuration/ui",
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/webjars/**"
};
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception
{
httpSecurity
.csrf()
.disable()
.authorizeRequests()
.antMatchers("/api/v1/auth/**").permitAll()
.antMatchers("/actuator/**").permitAll()
.antMatchers(SWAGGER_MATCHERS).permitAll()
.anyRequest().authenticated();
httpSecurity.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder authenticationManagerBuilder) throws Exception
{
authenticationManagerBuilder
.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoder());
}
@Bean
PasswordEncoder passwordEncoder()
{
return new BCryptPasswordEncoder(10);
}
}
| 36.328767 | 108 | 0.793363 |
1ddcc2689ce5e436965772b6d8c69d68e8c979c8 | 354 | package es.code.urjc.BiblioBookingService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BiblioBookingServiceApplication {
public static void main(String[] args) {
SpringApplication.run(BiblioBookingServiceApplication.class, args);
}
}
| 25.285714 | 69 | 0.838983 |
2152d0aad9b829b27cc37027eddd3a5e69803683 | 2,440 | package de.dm.intellij.liferay.schema;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider;
import com.jetbrains.jsonSchema.extension.SchemaType;
import com.jetbrains.jsonSchema.impl.JsonSchemaVersion;
import de.dm.intellij.liferay.util.LiferayFileUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.net.URL;
public class LiferayJournalStructureJsonSchema_2_0_FileProvider implements JsonSchemaFileProvider {
@NotNull private final Project project;
@Nullable private final VirtualFile schemaFile;
public LiferayJournalStructureJsonSchema_2_0_FileProvider(@NotNull Project project) {
this.project = project;
this.schemaFile = getResourceFile();
}
private static VirtualFile getResourceFile() {
URL url = LiferayJournalStructureJsonSchema_2_0_FileProvider.class.getResource("/com/liferay/schema/journal-structure-schema-2-0.json");
if (url != null) {
return VfsUtil.findFileByURL(url);
}
return null;
}
@Override
public boolean isAvailable(@NotNull VirtualFile file) {
return ReadAction.compute(
() -> {
PsiManager psiManager = PsiManager.getInstance(project);
PsiFile psiFile = psiManager.findFile(file);
if (psiFile != null) {
if (LiferayFileUtil.isJournalStructureFile(psiFile)) {
String definitionSchemaVersion = LiferayFileUtil.getJournalStructureJsonFileDefinitionSchemaVersion(psiFile);
return ("2.0".equals(definitionSchemaVersion));
}
}
return false;
}
);
}
@NotNull
@Override
public String getName() {
return "Liferay Journal Structure Schema 2.0";
}
@Nullable
@Override
public VirtualFile getSchemaFile() {
return schemaFile;
}
@NotNull
@Override
public SchemaType getSchemaType() {
return SchemaType.schema;
}
@Override
public JsonSchemaVersion getSchemaVersion() {
return JsonSchemaVersion.SCHEMA_7;
}
}
| 31.282051 | 144 | 0.685246 |
fd92a891fe5f571222ef553c7df316e34007c804 | 1,133 | import javafx.collections.ObservableList;
public interface ICard{
// @ ensures \result.length() > 0
public /*@ pure @*/ String getName();
// @ ensures \result.length() > 0
public /*@ pure @*/ String getDescription();
// @ ensures \result > 0
public /*@ pure @*/ Integer getAbility();
// @ ensures \result >= 0
public /*@ pure @*/ Integer getPower();
// @ ensures \result >= 0
public /*@ pure @*/ Integer getSpeed();
// @ ensures \result >= 0
public /*@ pure @*/ Integer getProtection();
// @ ensures \result.size() > 0
public /*@ pure @*/ ObservableList<Integer> getProperties();
public /*@ pure @*/ String getType();
// @ requires ability >= 0
// @ ensures getAbility() >= 0
public void setAbility(Integer ability);
// @ requires power >= 0
// @ ensures getPower() >= 0
public void setPower(Integer power);
// @ requires speed >= 0
// @ ensures getSpeed() >= 0
public void setSpeed(Integer speed);
// @ requires protection >= 0
// @ ensures getProtection() >= 0
public void setProtection(Integer protection);
}
| 25.75 | 64 | 0.58782 |
fd2873aad19c0f4994856d5a77e47aba5db14cfb | 270 | package com.homebrew.io.observers;
import java.util.Observable;
import java.util.Observer;
public class ObserverTest implements Observer {
@Override
public void update(Observable arg0, Object arg1) {
System.out.println("Observer1 notified");
}
}
| 19.285714 | 54 | 0.72963 |
b6c92be94482a30ade0eda1f9a0442f7ac2e0fca | 27,595 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hive.service;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
public class HiveClusterStatus implements
org.apache.thrift.TBase<HiveClusterStatus, HiveClusterStatus._Fields>,
java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct(
"HiveClusterStatus");
private static final org.apache.thrift.protocol.TField TASK_TRACKERS_FIELD_DESC = new org.apache.thrift.protocol.TField(
"taskTrackers", org.apache.thrift.protocol.TType.I32, (short) 1);
private static final org.apache.thrift.protocol.TField MAP_TASKS_FIELD_DESC = new org.apache.thrift.protocol.TField(
"mapTasks", org.apache.thrift.protocol.TType.I32, (short) 2);
private static final org.apache.thrift.protocol.TField REDUCE_TASKS_FIELD_DESC = new org.apache.thrift.protocol.TField(
"reduceTasks", org.apache.thrift.protocol.TType.I32, (short) 3);
private static final org.apache.thrift.protocol.TField MAX_MAP_TASKS_FIELD_DESC = new org.apache.thrift.protocol.TField(
"maxMapTasks", org.apache.thrift.protocol.TType.I32, (short) 4);
private static final org.apache.thrift.protocol.TField MAX_REDUCE_TASKS_FIELD_DESC = new org.apache.thrift.protocol.TField(
"maxReduceTasks", org.apache.thrift.protocol.TType.I32, (short) 5);
private static final org.apache.thrift.protocol.TField STATE_FIELD_DESC = new org.apache.thrift.protocol.TField(
"state", org.apache.thrift.protocol.TType.I32, (short) 6);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class,
new HiveClusterStatusStandardSchemeFactory());
schemes.put(TupleScheme.class, new HiveClusterStatusTupleSchemeFactory());
}
private int taskTrackers;
private int mapTasks;
private int reduceTasks;
private int maxMapTasks;
private int maxReduceTasks;
private JobTrackerState state;
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
TASK_TRACKERS((short) 1, "taskTrackers"), MAP_TASKS((short) 2, "mapTasks"), REDUCE_TASKS(
(short) 3, "reduceTasks"), MAX_MAP_TASKS((short) 4, "maxMapTasks"), MAX_REDUCE_TASKS(
(short) 5, "maxReduceTasks"),
STATE((short) 6, "state");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
public static _Fields findByThriftId(int fieldId) {
switch (fieldId) {
case 1:
return TASK_TRACKERS;
case 2:
return MAP_TASKS;
case 3:
return REDUCE_TASKS;
case 4:
return MAX_MAP_TASKS;
case 5:
return MAX_REDUCE_TASKS;
case 6:
return STATE;
default:
return null;
}
}
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null)
throw new IllegalArgumentException("Field " + fieldId
+ " doesn't exist!");
return fields;
}
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
private static final int __TASKTRACKERS_ISSET_ID = 0;
private static final int __MAPTASKS_ISSET_ID = 1;
private static final int __REDUCETASKS_ISSET_ID = 2;
private static final int __MAXMAPTASKS_ISSET_ID = 3;
private static final int __MAXREDUCETASKS_ISSET_ID = 4;
private BitSet __isset_bit_vector = new BitSet(5);
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(
_Fields.class);
tmpMap.put(_Fields.TASK_TRACKERS,
new org.apache.thrift.meta_data.FieldMetaData("taskTrackers",
org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.MAP_TASKS,
new org.apache.thrift.meta_data.FieldMetaData("mapTasks",
org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.REDUCE_TASKS,
new org.apache.thrift.meta_data.FieldMetaData("reduceTasks",
org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.MAX_MAP_TASKS,
new org.apache.thrift.meta_data.FieldMetaData("maxMapTasks",
org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.MAX_REDUCE_TASKS,
new org.apache.thrift.meta_data.FieldMetaData("maxReduceTasks",
org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(
org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.STATE, new org.apache.thrift.meta_data.FieldMetaData(
"state", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.EnumMetaData(
org.apache.thrift.protocol.TType.ENUM, JobTrackerState.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(
HiveClusterStatus.class, metaDataMap);
}
public HiveClusterStatus() {
}
public HiveClusterStatus(int taskTrackers, int mapTasks, int reduceTasks,
int maxMapTasks, int maxReduceTasks, JobTrackerState state) {
this();
this.taskTrackers = taskTrackers;
setTaskTrackersIsSet(true);
this.mapTasks = mapTasks;
setMapTasksIsSet(true);
this.reduceTasks = reduceTasks;
setReduceTasksIsSet(true);
this.maxMapTasks = maxMapTasks;
setMaxMapTasksIsSet(true);
this.maxReduceTasks = maxReduceTasks;
setMaxReduceTasksIsSet(true);
this.state = state;
}
public HiveClusterStatus(HiveClusterStatus other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
this.taskTrackers = other.taskTrackers;
this.mapTasks = other.mapTasks;
this.reduceTasks = other.reduceTasks;
this.maxMapTasks = other.maxMapTasks;
this.maxReduceTasks = other.maxReduceTasks;
if (other.isSetState()) {
this.state = other.state;
}
}
public HiveClusterStatus deepCopy() {
return new HiveClusterStatus(this);
}
@Override
public void clear() {
setTaskTrackersIsSet(false);
this.taskTrackers = 0;
setMapTasksIsSet(false);
this.mapTasks = 0;
setReduceTasksIsSet(false);
this.reduceTasks = 0;
setMaxMapTasksIsSet(false);
this.maxMapTasks = 0;
setMaxReduceTasksIsSet(false);
this.maxReduceTasks = 0;
this.state = null;
}
public int getTaskTrackers() {
return this.taskTrackers;
}
public void setTaskTrackers(int taskTrackers) {
this.taskTrackers = taskTrackers;
setTaskTrackersIsSet(true);
}
public void unsetTaskTrackers() {
__isset_bit_vector.clear(__TASKTRACKERS_ISSET_ID);
}
public boolean isSetTaskTrackers() {
return __isset_bit_vector.get(__TASKTRACKERS_ISSET_ID);
}
public void setTaskTrackersIsSet(boolean value) {
__isset_bit_vector.set(__TASKTRACKERS_ISSET_ID, value);
}
public int getMapTasks() {
return this.mapTasks;
}
public void setMapTasks(int mapTasks) {
this.mapTasks = mapTasks;
setMapTasksIsSet(true);
}
public void unsetMapTasks() {
__isset_bit_vector.clear(__MAPTASKS_ISSET_ID);
}
public boolean isSetMapTasks() {
return __isset_bit_vector.get(__MAPTASKS_ISSET_ID);
}
public void setMapTasksIsSet(boolean value) {
__isset_bit_vector.set(__MAPTASKS_ISSET_ID, value);
}
public int getReduceTasks() {
return this.reduceTasks;
}
public void setReduceTasks(int reduceTasks) {
this.reduceTasks = reduceTasks;
setReduceTasksIsSet(true);
}
public void unsetReduceTasks() {
__isset_bit_vector.clear(__REDUCETASKS_ISSET_ID);
}
public boolean isSetReduceTasks() {
return __isset_bit_vector.get(__REDUCETASKS_ISSET_ID);
}
public void setReduceTasksIsSet(boolean value) {
__isset_bit_vector.set(__REDUCETASKS_ISSET_ID, value);
}
public int getMaxMapTasks() {
return this.maxMapTasks;
}
public void setMaxMapTasks(int maxMapTasks) {
this.maxMapTasks = maxMapTasks;
setMaxMapTasksIsSet(true);
}
public void unsetMaxMapTasks() {
__isset_bit_vector.clear(__MAXMAPTASKS_ISSET_ID);
}
public boolean isSetMaxMapTasks() {
return __isset_bit_vector.get(__MAXMAPTASKS_ISSET_ID);
}
public void setMaxMapTasksIsSet(boolean value) {
__isset_bit_vector.set(__MAXMAPTASKS_ISSET_ID, value);
}
public int getMaxReduceTasks() {
return this.maxReduceTasks;
}
public void setMaxReduceTasks(int maxReduceTasks) {
this.maxReduceTasks = maxReduceTasks;
setMaxReduceTasksIsSet(true);
}
public void unsetMaxReduceTasks() {
__isset_bit_vector.clear(__MAXREDUCETASKS_ISSET_ID);
}
public boolean isSetMaxReduceTasks() {
return __isset_bit_vector.get(__MAXREDUCETASKS_ISSET_ID);
}
public void setMaxReduceTasksIsSet(boolean value) {
__isset_bit_vector.set(__MAXREDUCETASKS_ISSET_ID, value);
}
public JobTrackerState getState() {
return this.state;
}
public void setState(JobTrackerState state) {
this.state = state;
}
public void unsetState() {
this.state = null;
}
public boolean isSetState() {
return this.state != null;
}
public void setStateIsSet(boolean value) {
if (!value) {
this.state = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case TASK_TRACKERS:
if (value == null) {
unsetTaskTrackers();
} else {
setTaskTrackers((Integer) value);
}
break;
case MAP_TASKS:
if (value == null) {
unsetMapTasks();
} else {
setMapTasks((Integer) value);
}
break;
case REDUCE_TASKS:
if (value == null) {
unsetReduceTasks();
} else {
setReduceTasks((Integer) value);
}
break;
case MAX_MAP_TASKS:
if (value == null) {
unsetMaxMapTasks();
} else {
setMaxMapTasks((Integer) value);
}
break;
case MAX_REDUCE_TASKS:
if (value == null) {
unsetMaxReduceTasks();
} else {
setMaxReduceTasks((Integer) value);
}
break;
case STATE:
if (value == null) {
unsetState();
} else {
setState((JobTrackerState) value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case TASK_TRACKERS:
return Integer.valueOf(getTaskTrackers());
case MAP_TASKS:
return Integer.valueOf(getMapTasks());
case REDUCE_TASKS:
return Integer.valueOf(getReduceTasks());
case MAX_MAP_TASKS:
return Integer.valueOf(getMaxMapTasks());
case MAX_REDUCE_TASKS:
return Integer.valueOf(getMaxReduceTasks());
case STATE:
return getState();
}
throw new IllegalStateException();
}
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case TASK_TRACKERS:
return isSetTaskTrackers();
case MAP_TASKS:
return isSetMapTasks();
case REDUCE_TASKS:
return isSetReduceTasks();
case MAX_MAP_TASKS:
return isSetMaxMapTasks();
case MAX_REDUCE_TASKS:
return isSetMaxReduceTasks();
case STATE:
return isSetState();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof HiveClusterStatus)
return this.equals((HiveClusterStatus) that);
return false;
}
public boolean equals(HiveClusterStatus that) {
if (that == null)
return false;
boolean this_present_taskTrackers = true;
boolean that_present_taskTrackers = true;
if (this_present_taskTrackers || that_present_taskTrackers) {
if (!(this_present_taskTrackers && that_present_taskTrackers))
return false;
if (this.taskTrackers != that.taskTrackers)
return false;
}
boolean this_present_mapTasks = true;
boolean that_present_mapTasks = true;
if (this_present_mapTasks || that_present_mapTasks) {
if (!(this_present_mapTasks && that_present_mapTasks))
return false;
if (this.mapTasks != that.mapTasks)
return false;
}
boolean this_present_reduceTasks = true;
boolean that_present_reduceTasks = true;
if (this_present_reduceTasks || that_present_reduceTasks) {
if (!(this_present_reduceTasks && that_present_reduceTasks))
return false;
if (this.reduceTasks != that.reduceTasks)
return false;
}
boolean this_present_maxMapTasks = true;
boolean that_present_maxMapTasks = true;
if (this_present_maxMapTasks || that_present_maxMapTasks) {
if (!(this_present_maxMapTasks && that_present_maxMapTasks))
return false;
if (this.maxMapTasks != that.maxMapTasks)
return false;
}
boolean this_present_maxReduceTasks = true;
boolean that_present_maxReduceTasks = true;
if (this_present_maxReduceTasks || that_present_maxReduceTasks) {
if (!(this_present_maxReduceTasks && that_present_maxReduceTasks))
return false;
if (this.maxReduceTasks != that.maxReduceTasks)
return false;
}
boolean this_present_state = true && this.isSetState();
boolean that_present_state = true && that.isSetState();
if (this_present_state || that_present_state) {
if (!(this_present_state && that_present_state))
return false;
if (!this.state.equals(that.state))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(HiveClusterStatus other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
HiveClusterStatus typedOther = (HiveClusterStatus) other;
lastComparison = Boolean.valueOf(isSetTaskTrackers()).compareTo(
typedOther.isSetTaskTrackers());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTaskTrackers()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(
this.taskTrackers, typedOther.taskTrackers);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMapTasks()).compareTo(
typedOther.isSetMapTasks());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMapTasks()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mapTasks,
typedOther.mapTasks);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetReduceTasks()).compareTo(
typedOther.isSetReduceTasks());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetReduceTasks()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(
this.reduceTasks, typedOther.reduceTasks);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMaxMapTasks()).compareTo(
typedOther.isSetMaxMapTasks());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMaxMapTasks()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(
this.maxMapTasks, typedOther.maxMapTasks);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMaxReduceTasks()).compareTo(
typedOther.isSetMaxReduceTasks());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMaxReduceTasks()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(
this.maxReduceTasks, typedOther.maxReduceTasks);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetState()).compareTo(
typedOther.isSetState());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetState()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.state,
typedOther.state);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot)
throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot)
throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("HiveClusterStatus(");
boolean first = true;
sb.append("taskTrackers:");
sb.append(this.taskTrackers);
first = false;
if (!first)
sb.append(", ");
sb.append("mapTasks:");
sb.append(this.mapTasks);
first = false;
if (!first)
sb.append(", ");
sb.append("reduceTasks:");
sb.append(this.reduceTasks);
first = false;
if (!first)
sb.append(", ");
sb.append("maxMapTasks:");
sb.append(this.maxMapTasks);
first = false;
if (!first)
sb.append(", ");
sb.append("maxReduceTasks:");
sb.append(this.maxReduceTasks);
first = false;
if (!first)
sb.append(", ");
sb.append("state:");
if (this.state == null) {
sb.append("null");
} else {
sb.append(this.state);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
}
private void writeObject(java.io.ObjectOutputStream out)
throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(
new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in)
throws java.io.IOException, ClassNotFoundException {
try {
__isset_bit_vector = new BitSet(1);
read(new org.apache.thrift.protocol.TCompactProtocol(
new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class HiveClusterStatusStandardSchemeFactory implements
SchemeFactory {
public HiveClusterStatusStandardScheme getScheme() {
return new HiveClusterStatusStandardScheme();
}
}
private static class HiveClusterStatusStandardScheme extends
StandardScheme<HiveClusterStatus> {
public void read(org.apache.thrift.protocol.TProtocol iprot,
HiveClusterStatus struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true) {
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1:
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.taskTrackers = iprot.readI32();
struct.setTaskTrackersIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
break;
case 2:
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.mapTasks = iprot.readI32();
struct.setMapTasksIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
break;
case 3:
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.reduceTasks = iprot.readI32();
struct.setReduceTasksIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
break;
case 4:
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.maxMapTasks = iprot.readI32();
struct.setMaxMapTasksIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
break;
case 5:
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.maxReduceTasks = iprot.readI32();
struct.setMaxReduceTasksIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
break;
case 6:
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.state = JobTrackerState.findByValue(iprot.readI32());
struct.setStateIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot,
schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil
.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot,
HiveClusterStatus struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(TASK_TRACKERS_FIELD_DESC);
oprot.writeI32(struct.taskTrackers);
oprot.writeFieldEnd();
oprot.writeFieldBegin(MAP_TASKS_FIELD_DESC);
oprot.writeI32(struct.mapTasks);
oprot.writeFieldEnd();
oprot.writeFieldBegin(REDUCE_TASKS_FIELD_DESC);
oprot.writeI32(struct.reduceTasks);
oprot.writeFieldEnd();
oprot.writeFieldBegin(MAX_MAP_TASKS_FIELD_DESC);
oprot.writeI32(struct.maxMapTasks);
oprot.writeFieldEnd();
oprot.writeFieldBegin(MAX_REDUCE_TASKS_FIELD_DESC);
oprot.writeI32(struct.maxReduceTasks);
oprot.writeFieldEnd();
if (struct.state != null) {
oprot.writeFieldBegin(STATE_FIELD_DESC);
oprot.writeI32(struct.state.getValue());
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class HiveClusterStatusTupleSchemeFactory implements
SchemeFactory {
public HiveClusterStatusTupleScheme getScheme() {
return new HiveClusterStatusTupleScheme();
}
}
private static class HiveClusterStatusTupleScheme extends
TupleScheme<HiveClusterStatus> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot,
HiveClusterStatus struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetTaskTrackers()) {
optionals.set(0);
}
if (struct.isSetMapTasks()) {
optionals.set(1);
}
if (struct.isSetReduceTasks()) {
optionals.set(2);
}
if (struct.isSetMaxMapTasks()) {
optionals.set(3);
}
if (struct.isSetMaxReduceTasks()) {
optionals.set(4);
}
if (struct.isSetState()) {
optionals.set(5);
}
oprot.writeBitSet(optionals, 6);
if (struct.isSetTaskTrackers()) {
oprot.writeI32(struct.taskTrackers);
}
if (struct.isSetMapTasks()) {
oprot.writeI32(struct.mapTasks);
}
if (struct.isSetReduceTasks()) {
oprot.writeI32(struct.reduceTasks);
}
if (struct.isSetMaxMapTasks()) {
oprot.writeI32(struct.maxMapTasks);
}
if (struct.isSetMaxReduceTasks()) {
oprot.writeI32(struct.maxReduceTasks);
}
if (struct.isSetState()) {
oprot.writeI32(struct.state.getValue());
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot,
HiveClusterStatus struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(6);
if (incoming.get(0)) {
struct.taskTrackers = iprot.readI32();
struct.setTaskTrackersIsSet(true);
}
if (incoming.get(1)) {
struct.mapTasks = iprot.readI32();
struct.setMapTasksIsSet(true);
}
if (incoming.get(2)) {
struct.reduceTasks = iprot.readI32();
struct.setReduceTasksIsSet(true);
}
if (incoming.get(3)) {
struct.maxMapTasks = iprot.readI32();
struct.setMaxMapTasksIsSet(true);
}
if (incoming.get(4)) {
struct.maxReduceTasks = iprot.readI32();
struct.setMaxReduceTasksIsSet(true);
}
if (incoming.get(5)) {
struct.state = JobTrackerState.findByValue(iprot.readI32());
struct.setStateIsSet(true);
}
}
}
}
| 30.832402 | 133 | 0.668309 |
147f5b370f73ca2df60e47c3352f69569f0c767e | 2,980 | /**
* The MIT License
* Copyright (c) 2011 Kuali Mobility Team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.kuali.mobility.news.entity;
import java.util.List;
public interface NewsSource {
public Long getId();
public void setId(Long id);
/**
* @return the URL of the feed
*/
public String getUrl();
/**
* @param url the URL of the feed
*/
public void setUrl(String url);
/**
* @return whether the feed is active or not
*/
public boolean isActive();
/**
* @param active set this feed active or inactive
*/
public void setActive(boolean active);
/**
* @return the name assigned to this feed
*/
public String getName();
/**
* @param name the name to set for this feed. It is not displayed to end users.
*/
public void setName(String name);
/**
* @return the title
*/
public String getTitle();
/**
* @param title the title to set
*/
public void setTitle(String title);
/**
* @return the author
*/
public String getAuthor();
/**
* @param author the author to set
*/
public void setAuthor(String author);
/**
* @return the description of the feed
*/
public String getDescription();
/**
* @param description the description of the feed
*/
public void setDescription(String description);
/**
* @return the articles
*/
public List<? extends NewsArticle> getArticles();
/**
* @param articles the articles to set
*/
public void setArticles(List<? extends NewsArticle> articles);
/**
* @return the display order
*/
public int getOrder();
/**
* @param order the display order
*/
public void setOrder(int order);
public void setParentId(Long parentId);
public Long getParentId();
public void setChildren(List<? extends NewsSource> children);
public List<? extends NewsSource> getChildren();
public void addChild(NewsSource child);
public boolean hasChildren();
public void setHasChildren(boolean hasChildren);
}
| 23.28125 | 81 | 0.707047 |
945d7ddbe7872e627311cbe97530f24d3dfa2148 | 3,612 | package com.telecominfraproject.wlan.core.model.pagination;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
import com.telecominfraproject.wlan.core.model.pair.PairIntString;
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
import com.telecominfraproject.wlan.core.model.pair.PairStringLong;
public class PaginationContextTest {
@Test
public void testSerialization() {
PaginationContext<PairLongLong> pll = new PaginationContext<>(10);
pll.setStartAfterItem(new PairLongLong());
PaginationContext<PairStringLong> psl = new PaginationContext<>(10);
psl.setStartAfterItem(new PairStringLong("str1", 42L));
pll.getChildren().getChildren().put("psl", psl);
assertEquals("{\"model_type\":\"PaginationContext\","
+ "\"cursor\":\"eyJtb2RlbF90eXBlIjoiUGFpclN0cmluZ0xvbmciLCJ2YWx1ZTEiOiJzdHIxIiwidmFsdWUyIjo0Mn1AQEB7Im1vZGVsX3R5cGUiOiJDb250ZXh0Q2hpbGRyZW4iLCJjaGlsZHJlbiI6e319QEBAbnVsbA==\","
+ "\"lastPage\":false,\"lastReturnedPageNumber\":0,\"maxItemsPerPage\":10,\"totalItemsReturned\":0}", psl.toString());
assertEquals("{\"model_type\":\"PaginationContext\",\"cursor\":\"eyJtb2RlbF90eXBlIjoiUGFpckxvbmdMb25nIiwidmFsdWUxIjpudWxsLCJ2YWx1ZTIiOm51bGx9QEBAeyJtb2RlbF90eXBlIjoiQ29udGV4dENoaWxkcmVuIiwiY2hpbGRyZW4iOnsicHNsIjp7Im1vZGVsX3R5cGUiOiJQYWdpbmF0aW9uQ29udGV4dCIsImN1cnNvciI6ImV5SnRiMlJsYkY5MGVYQmxJam9pVUdGcGNsTjBjbWx1WjB4dmJtY2lMQ0oyWVd4MVpURWlPaUp6ZEhJeElpd2lkbUZzZFdVeUlqbzBNbjFBUUVCN0ltMXZaR1ZzWDNSNWNHVWlPaUpEYjI1MFpYaDBRMmhwYkdSeVpXNGlMQ0pqYUdsc1pISmxiaUk2ZTMxOVFFQkFiblZzYkE9PSIsImxhc3RQYWdlIjpmYWxzZSwibGFzdFJldHVybmVkUGFnZU51bWJlciI6MCwibWF4SXRlbXNQZXJQYWdlIjoxMCwidG90YWxJdGVtc1JldHVybmVkIjowfX19QEBAbnVsbA==\","
+ "\"lastPage\":false,\"lastReturnedPageNumber\":0,\"maxItemsPerPage\":10,\"totalItemsReturned\":0}", pll.toString());
}
@Test
public void testCursorSerialization() {
PaginationContext<PairIntString> context = new PaginationContext<>(10);
assertEquals(context.toString(), BaseJsonModel.fromString(context.toString(), BaseJsonModel.class).toString());
// System.out.println("-1-" + context);
// System.out.println("-2-" + BaseJsonModel.fromString(context.toString(), BaseJsonModel.class));
context.setStartAfterItem(new PairIntString(42,"myValue"));
assertEquals(context.toString(), BaseJsonModel.fromString(context.toString(), BaseJsonModel.class).toString());
PaginationContext<PairIntString> childContext = new PaginationContext<>(10);
childContext.setStartAfterItem(new PairIntString(43,"myValueChild"));
context.getChildren().getChildren().put("child", childContext);
assertEquals(context.toString(), BaseJsonModel.fromString(context.toString(), BaseJsonModel.class).toString());
PaginationContext<PairIntString> contextWithThirdParty = new PaginationContext<>(10);
assertEquals(contextWithThirdParty.toString(), BaseJsonModel.fromString(contextWithThirdParty.toString(), BaseJsonModel.class).toString());
contextWithThirdParty.setStartAfterItem(new PairIntString(42,"myValue"));
contextWithThirdParty.setThirdPartyPagingState(new byte[] {0,1,42});
assertEquals(contextWithThirdParty.toString(), BaseJsonModel.fromString(contextWithThirdParty.toString(), BaseJsonModel.class).toString());
}
}
| 61.220339 | 625 | 0.766058 |
c6b12e900a2cd37f178b74d72bef758777407860 | 493 | package edu.bits.wilp.ir_assignment.index;
import java.util.ArrayList;
import java.util.List;
/**
* Wrapper for List<{@link Document}> for Kryo
*/
public class Documents {
private final List<Document> documentOlds;
// for kryo
private Documents() {
this(new ArrayList<>());
}
public Documents(List<Document> documentOlds) {
this.documentOlds = documentOlds;
}
public List<Document> getDocuments() {
return documentOlds;
}
}
| 19.72 | 52 | 0.657201 |
5857dd644aef3b1e7d75a7a83b6cbc175362e122 | 1,952 | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package mygame;
import com.jme3.input.controls.ActionListener;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.CameraNode;
import com.jme3.scene.Node;
import com.jme3.scene.control.AbstractControl;
import mygame.common.Log;
/**
*
* @author db-141205
*/
public class CameraControl extends AbstractControl implements ActionListener {
private final float speed = 3.0f;
boolean left, right, up, down;
Node cameraNode;
CameraControl(Node cameraNode) {
this.cameraNode = cameraNode;
}
@Override
public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals("moveLeft") && isPressed) {
left = true;
} else if (name.equals("moveLeft") && !isPressed) {
left = false;
}
if (name.equals("moveUp") && isPressed) {
up = true;
} else if (name.equals("moveUp") && !isPressed) {
up = false;
}
if (name.equals("moveRight") && isPressed) {
right = true;
} else if (name.equals("moveRight") && !isPressed) {
right = false;
}
if (name.equals("moveDown") && isPressed) {
down = true;
} else if (name.equals("moveDown") && !isPressed) {
down = false;
}
}
@Override
protected void controlUpdate(float tpf) {
if (left) {
cameraNode.move(-tpf * speed, 0f, 0f);
}
if (right) {
cameraNode.move(tpf * speed, 0f, 0f);
}
if (up) {
cameraNode.move(0f, tpf * speed, 0f);
}
if (down) {
cameraNode.move(0f, -tpf * speed, 0f);
}
}
@Override
protected void controlRender(RenderManager rm, ViewPort vp) {
}
}
| 26.378378 | 78 | 0.573258 |
6ea79360cc4fcbf9d3bec6e059839bf1a9883996 | 10,005 | /*
* The MIT License
*
==================================================================================
* Copyright 2016 SIPHYC SYSTEMS Sdn Bhd All Rights Reserved.
*
* project reference code contributed by Moaz Korena <[email protected],[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.siphyc.test.endpoints;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.siphyc.model.Android;
import com.siphyc.test.app.CdiEnabled;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
import static org.hamcrest.CoreMatchers.containsString;
import org.junit.Test;
import static org.junit.Assert.*;
import org.slf4j.LoggerFactory;
/**
*
* @author moaz korena ([email protected]/[email protected])
*
* This class is intended to test the Endpoints of your web service, meaning you
* should provide mockups for all needed code stack that does not directly
* belong to jersey registered resources. This example test class only tests
* android endpoint ... iphone is ignored ...
*
* NOTE: Injection points in the tested resources are handled by HK2, To enabled
* CDI Injected resources (including qualifier annotated injection points),
* AbstractBinder was extended (checkout
* {@link com.siphyc.test.app.InternalsBinder internalsBinder} class)
*
*/
public class EndpointExampleTest extends CdiEnabled {
/**
*
*/
public static final org.slf4j.Logger logger = LoggerFactory.getLogger(EndpointExampleTest.class);
/**
* A test method for GET requests (Not very thorough).
*/
@Test
public void AndroidResourceGETTest() {
int limit = 2;
Response response = target().path("resource/android").queryParam("limit", limit).request().get();
/**
* test 200 response code
*/
assertEquals(response.getStatus(), 200);
String responseText = response.readEntity(String.class);
Gson builder = new Gson();
Type androidArrayListType = new TypeToken<ArrayList<Android>>() {
}.getType();
List responseObj = (List<Android>) builder.fromJson(responseText, androidArrayListType);
/**
* test limited response objects count
*/
assertEquals(limit, responseObj.size());
Response error404Response = target().path("resoorce/android").request().get();
/**
* test 404 error
*/
assertEquals(error404Response.getStatus(), 404);
Response error501Response = target().path("resource/androids").request().get();
/**
* test 501 error
*/
assertEquals(error501Response.getStatus(), 501);
assertThat(error501Response.readEntity(String.class), containsString("unsupported request"));
/**
* TODO: other relevant GET tests ...
*/
}
/**
* A test method for POST requests (Not very thorough)... NOTE: the default
* client of jersey test framework had to be configured to handle
* FormDataMultipart, checkout the overridden
* {@link com.siphyc.test.app.CdiEnabled#configureClient(ClientConfig) configureClient}
* method. The server side also added support for MultiPartFeature,
* checkout: {@link com.siphyc.test.app.TestApp#TestApp() TestApp}
* Constructor. In both cases, you're looking at
* register(MultiPartFeature.class);
*/
@Test
public void AndroidResourcePOSTTest() {
FormDataMultiPart badNewAndroidFormData = new FormDataMultiPart();
badNewAndroidFormData.field("shouldBeCustomer", "new customer");
badNewAndroidFormData.field("model", "Android M");
Entity<FormDataMultiPart> badRequestDataEntity = Entity.entity(badNewAndroidFormData, MediaType.MULTIPART_FORM_DATA);
Response postBadResponse = target().path("resource/android").request().post(badRequestDataEntity, Response.class);
/**
* test 400 response code (post)
*/
assertEquals(postBadResponse.getStatus(), 400);
FormDataMultiPart newAndroidFormData = new FormDataMultiPart();
newAndroidFormData.field("customer", "jessy");
newAndroidFormData.field("model", "Android N");
Entity<FormDataMultiPart> dataEntity = Entity.entity(newAndroidFormData, MediaType.MULTIPART_FORM_DATA);
Response postSuccessResponse = target().path("resource/android").request().post(dataEntity, Response.class);
/**
* test 201 response code (post)
*/
assertEquals(postSuccessResponse.getStatus(), 201);
newAndroidFormData = new FormDataMultiPart();
newAndroidFormData.field("customer", "jessy");
newAndroidFormData.field("model", "Iphone");
Entity<FormDataMultiPart> exceptionWorthyDataEntity = Entity.entity(newAndroidFormData, MediaType.MULTIPART_FORM_DATA);
Response postExceptionResponse = target().path("resource/android").request().post(exceptionWorthyDataEntity, Response.class);
/**
* test 500 response code (post)
*/
assertEquals(postExceptionResponse.getStatus(), 500);
FormDataMultiPart updateAndroidFormData = new FormDataMultiPart();
updateAndroidFormData.field("id", "1");
updateAndroidFormData.field("customer", "john");
updateAndroidFormData.field("model", "Android O");
updateAndroidFormData.field("status", "true");
Entity<FormDataMultiPart> anotherDataEntity = Entity.entity(updateAndroidFormData, MediaType.MULTIPART_FORM_DATA);
Response updateSuccessResponse = target().path("resource/android").request().post(anotherDataEntity, Response.class);
/**
* test 200 response code (update)
*/
assertEquals(updateSuccessResponse.getStatus(), 200);
FormDataMultiPart failedNonExistentUpdateAndroidFormData = new FormDataMultiPart();
failedNonExistentUpdateAndroidFormData.field("id", "2"); // Note that the mockup service will not recognize id=2 ...
failedNonExistentUpdateAndroidFormData.field("customer", "john");
failedNonExistentUpdateAndroidFormData.field("model", "Android O");
failedNonExistentUpdateAndroidFormData.field("status", "true");
/**
* Note: NonExistent should never happen because of the check (look at the code) ...
*/
Entity<FormDataMultiPart> badDataEntity = Entity.entity(failedNonExistentUpdateAndroidFormData, MediaType.MULTIPART_FORM_DATA);
Response nonExistentUpdateFailedResponse = target().path("resource/android").request().post(badDataEntity, Response.class);
/**
* test 404 response code (update)
*/
assertEquals(nonExistentUpdateFailedResponse.getStatus(), 404);
/**
* Rollback should not happen .. but if it does for some datasource issue ,
* we can still catch it, but the response would be an ugly 500 ...
*/
FormDataMultiPart failedRollbackUpdateAndroidFormData = new FormDataMultiPart();
failedRollbackUpdateAndroidFormData.field("id", "3");
failedRollbackUpdateAndroidFormData.field("customer", "john");
failedRollbackUpdateAndroidFormData.field("model", "Android O");
failedRollbackUpdateAndroidFormData.field("status", "true");
Entity<FormDataMultiPart> badDataEntity2 = Entity.entity(failedRollbackUpdateAndroidFormData, MediaType.MULTIPART_FORM_DATA);
Response rollbackupdateFailedResponse = target().path("resource/android").request().post(badDataEntity2, Response.class);
/**
* test 404 response code (update)
*/
assertEquals(rollbackupdateFailedResponse.getStatus(), 404);
}
@Test
public void AndroidResourceDeleteTest() {
Response successfullDelete = target().path("resource/android").queryParam("id", 1).request().delete();
/**
* test 200 response code (delete)
*/
assertEquals(successfullDelete.getStatus(), 200);
Response badRequestDelete = target().path("resource/android").request().delete();
/**
* test 400 response code (delete)
*/
assertEquals(badRequestDelete.getStatus(), 400);
Response failedDelete = target().path("resource/android").queryParam("id", 2).request().delete();
/**
* test 404 response code (delete)
*/
assertEquals(failedDelete.getStatus(), 404);
Response failedDelete2 = target().path("resource/android").queryParam("id", 3).request().delete();
/**
* test 500 response code (delete)
*/
assertEquals(failedDelete2.getStatus(), 500);
}
}
| 41.004098 | 135 | 0.68036 |
552ca60930cc1d3864198700c5e3e7ef4d0a0a83 | 58,491 | /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
package sun.nio.cs.ext;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
public class JIS_X_0208_Decoder extends DoubleByteDecoder
{
public JIS_X_0208_Decoder(Charset cs) {
super(cs,
index1,
index2,
0x21,
0x7E);
}
private final static String innerIndex0=
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u3000\u3001"+
"\u3002\uFF0C\uFF0E\u30FB\uFF1A\uFF1B\uFF1F\uFF01"+
"\u309B\u309C\u00B4\uFF40\u00A8\uFF3E\uFFE3\uFF3F"+
"\u30FD\u30FE\u309D\u309E\u3003\u4EDD\u3005\u3006"+
"\u3007\u30FC\u2014\u2010\uFF0F\uFF3C\u301C\u2016"+
"\uFF5C\u2026\u2025\u2018\u2019\u201C\u201D\uFF08"+
"\uFF09\u3014\u3015\uFF3B\uFF3D\uFF5B\uFF5D\u3008"+
"\u3009\u300A\u300B\u300C\u300D\u300E\u300F\u3010"+
"\u3011\uFF0B\u2212\u00B1\u00D7\u00F7\uFF1D\u2260"+
"\uFF1C\uFF1E\u2266\u2267\u221E\u2234\u2642\u2640"+
"\u00B0\u2032\u2033\u2103\uFFE5\uFF04\u00A2\u00A3"+
"\uFF05\uFF03\uFF06\uFF0A\uFF20\u00A7\u2606\u2605"+
"\u25CB\u25CF\u25CE\u25C7\u25C6\u25A1\u25A0\u25B3"+
"\u25B2\u25BD\u25BC\u203B\u3012\u2192\u2190\u2191"+
"\u2193\u3013\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2208\u220B\u2286"+
"\u2287\u2282\u2283\u222A\u2229\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2227\u2228\u00AC"+
"\u21D2\u21D4\u2200\u2203\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u2220"+
"\u22A5\u2312\u2202\u2207\u2261\u2252\u226A\u226B"+
"\u221A\u223D\u221D\u2235\u222B\u222C\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u212B\u2030\u266F"+
"\u266D\u266A\u2020\u2021\u00B6\uFFFD\uFFFD\uFFFD"+
"\uFFFD\u25EF\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFF10\uFF11\uFF12\uFF13\uFF14\uFF15\uFF16"+
"\uFF17\uFF18\uFF19\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFF21\uFF22\uFF23\uFF24\uFF25\uFF26"+
"\uFF27\uFF28\uFF29\uFF2A\uFF2B\uFF2C\uFF2D\uFF2E"+
"\uFF2F\uFF30\uFF31\uFF32\uFF33\uFF34\uFF35\uFF36"+
"\uFF37\uFF38\uFF39\uFF3A\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFF41\uFF42\uFF43\uFF44\uFF45\uFF46"+
"\uFF47\uFF48\uFF49\uFF4A\uFF4B\uFF4C\uFF4D\uFF4E"+
"\uFF4F\uFF50\uFF51\uFF52\uFF53\uFF54\uFF55\uFF56"+
"\uFF57\uFF58\uFF59\uFF5A\uFFFD\uFFFD\uFFFD\uFFFD"+
"\u3041\u3042\u3043\u3044\u3045\u3046\u3047\u3048"+
"\u3049\u304A\u304B\u304C\u304D\u304E\u304F\u3050"+
"\u3051\u3052\u3053\u3054\u3055\u3056\u3057\u3058"+
"\u3059\u305A\u305B\u305C\u305D\u305E\u305F\u3060"+
"\u3061\u3062\u3063\u3064\u3065\u3066\u3067\u3068"+
"\u3069\u306A\u306B\u306C\u306D\u306E\u306F\u3070"+
"\u3071\u3072\u3073\u3074\u3075\u3076\u3077\u3078"+
"\u3079\u307A\u307B\u307C\u307D\u307E\u307F\u3080"+
"\u3081\u3082\u3083\u3084\u3085\u3086\u3087\u3088"+
"\u3089\u308A\u308B\u308C\u308D\u308E\u308F\u3090"+
"\u3091\u3092\u3093\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u30A1\u30A2"+
"\u30A3\u30A4\u30A5\u30A6\u30A7\u30A8\u30A9\u30AA"+
"\u30AB\u30AC\u30AD\u30AE\u30AF\u30B0\u30B1\u30B2"+
"\u30B3\u30B4\u30B5\u30B6\u30B7\u30B8\u30B9\u30BA"+
"\u30BB\u30BC\u30BD\u30BE\u30BF\u30C0\u30C1\u30C2"+
"\u30C3\u30C4\u30C5\u30C6\u30C7\u30C8\u30C9\u30CA"+
"\u30CB\u30CC\u30CD\u30CE\u30CF\u30D0\u30D1\u30D2"+
"\u30D3\u30D4\u30D5\u30D6\u30D7\u30D8\u30D9\u30DA"+
"\u30DB\u30DC\u30DD\u30DE\u30DF\u30E0\u30E1\u30E2"+
"\u30E3\u30E4\u30E5\u30E6\u30E7\u30E8\u30E9\u30EA"+
"\u30EB\u30EC\u30ED\u30EE\u30EF\u30F0\u30F1\u30F2"+
"\u30F3\u30F4\u30F5\u30F6\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\u0391\u0392\u0393\u0394"+
"\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C"+
"\u039D\u039E\u039F\u03A0\u03A1\u03A3\u03A4\u03A5"+
"\u03A6\u03A7\u03A8\u03A9\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\u03B1\u03B2\u03B3\u03B4"+
"\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC"+
"\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C4\u03C5"+
"\u03C6\u03C7\u03C8\u03C9\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\u0410\u0411\u0412\u0413\u0414\u0415"+
"\u0401\u0416\u0417\u0418\u0419\u041A\u041B\u041C"+
"\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424"+
"\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C"+
"\u042D\u042E\u042F\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\u0430\u0431\u0432\u0433\u0434\u0435"+
"\u0451\u0436\u0437\u0438\u0439\u043A\u043B\u043C"+
"\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444"+
"\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C"+
"\u044D\u044E\u044F\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\u2500\u2502\u250C\u2510\u2518\u2514\u251C\u252C"+
"\u2524\u2534\u253C\u2501\u2503\u250F\u2513\u251B"+
"\u2517\u2523\u2533\u252B\u253B\u254B\u2520\u252F"+
"\u2528\u2537\u253F\u251D\u2530\u2525\u2538\u2542"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u4E9C\u5516"+
"\u5A03\u963F\u54C0\u611B\u6328\u59F6\u9022\u8475"+
"\u831C\u7A50\u60AA\u63E1\u6E25\u65ED\u8466\u82A6"+
"\u9BF5\u6893\u5727\u65A1\u6271\u5B9B\u59D0\u867B"+
"\u98F4\u7D62\u7DBE\u9B8E\u6216\u7C9F\u88B7\u5B89"+
"\u5EB5\u6309\u6697\u6848\u95C7\u978D\u674F\u4EE5"+
"\u4F0A\u4F4D\u4F9D\u5049\u56F2\u5937\u59D4\u5A01"+
"\u5C09\u60DF\u610F\u6170\u6613\u6905\u70BA\u754F"+
"\u7570\u79FB\u7DAD\u7DEF\u80C3\u840E\u8863\u8B02"+
"\u9055\u907A\u533B\u4E95\u4EA5\u57DF\u80B2\u90C1"+
"\u78EF\u4E00\u58F1\u6EA2\u9038\u7A32\u8328\u828B"+
"\u9C2F\u5141\u5370\u54BD\u54E1\u56E0\u59FB\u5F15"+
"\u98F2\u6DEB\u80E4\u852D\u9662\u9670\u96A0\u97FB"+
"\u540B\u53F3\u5B87\u70CF\u7FBD\u8FC2\u96E8\u536F"+
"\u9D5C\u7ABA\u4E11\u7893\u81FC\u6E26\u5618\u5504"+
"\u6B1D\u851A\u9C3B\u59E5\u53A9\u6D66\u74DC\u958F"+
"\u5642\u4E91\u904B\u96F2\u834F\u990C\u53E1\u55B6"+
"\u5B30\u5F71\u6620\u66F3\u6804\u6C38\u6CF3\u6D29"+
"\u745B\u76C8\u7A4E\u9834\u82F1\u885B\u8A60\u92ED"+
"\u6DB2\u75AB\u76CA\u99C5\u60A6\u8B01\u8D8A\u95B2"+
"\u698E\u53AD\u5186\u5712\u5830\u5944\u5BB4\u5EF6"+
"\u6028\u63A9\u63F4\u6CBF\u6F14\u708E\u7114\u7159"+
"\u71D5\u733F\u7E01\u8276\u82D1\u8597\u9060\u925B"+
"\u9D1B\u5869\u65BC\u6C5A\u7525\u51F9\u592E\u5965"+
"\u5F80\u5FDC\u62BC\u65FA\u6A2A\u6B27\u6BB4\u738B"+
"\u7FC1\u8956\u9D2C\u9D0E\u9EC4\u5CA1\u6C96\u837B"+
"\u5104\u5C4B\u61B6\u81C6\u6876\u7261\u4E59\u4FFA"+
"\u5378\u6069\u6E29\u7A4F\u97F3\u4E0B\u5316\u4EEE"+
"\u4F55\u4F3D\u4FA1\u4F73\u52A0\u53EF\u5609\u590F"+
"\u5AC1\u5BB6\u5BE1\u79D1\u6687\u679C\u67B6\u6B4C"+
"\u6CB3\u706B\u73C2\u798D\u79BE\u7A3C\u7B87\u82B1"+
"\u82DB\u8304\u8377\u83EF\u83D3\u8766\u8AB2\u5629"+
"\u8CA8\u8FE6\u904E\u971E\u868A\u4FC4\u5CE8\u6211"+
"\u7259\u753B\u81E5\u82BD\u86FE\u8CC0\u96C5\u9913"+
"\u99D5\u4ECB\u4F1A\u89E3\u56DE\u584A\u58CA\u5EFB"+
"\u5FEB\u602A\u6094\u6062\u61D0\u6212\u62D0\u6539"+
"\u9B41\u6666\u68B0\u6D77\u7070\u754C\u7686\u7D75"+
"\u82A5\u87F9\u958B\u968E\u8C9D\u51F1\u52BE\u5916"+
"\u54B3\u5BB3\u5D16\u6168\u6982\u6DAF\u788D\u84CB"+
"\u8857\u8A72\u93A7\u9AB8\u6D6C\u99A8\u86D9\u57A3"+
"\u67FF\u86CE\u920E\u5283\u5687\u5404\u5ED3\u62E1"+
"\u64B9\u683C\u6838\u6BBB\u7372\u78BA\u7A6B\u899A"+
"\u89D2\u8D6B\u8F03\u90ED\u95A3\u9694\u9769\u5B66"+
"\u5CB3\u697D\u984D\u984E\u639B\u7B20\u6A2B\u6A7F"+
"\u68B6\u9C0D\u6F5F\u5272\u559D\u6070\u62EC\u6D3B"+
"\u6E07\u6ED1\u845B\u8910\u8F44\u4E14\u9C39\u53F6"+
"\u691B\u6A3A\u9784\u682A\u515C\u7AC3\u84B2\u91DC"+
"\u938C\u565B\u9D28\u6822\u8305\u8431\u7CA5\u5208"+
"\u82C5\u74E6\u4E7E\u4F83\u51A0\u5BD2\u520A\u52D8"+
"\u52E7\u5DFB\u559A\u582A\u59E6\u5B8C\u5B98\u5BDB"+
"\u5E72\u5E79\u60A3\u611F\u6163\u61BE\u63DB\u6562"+
"\u67D1\u6853\u68FA\u6B3E\u6B53\u6C57\u6F22\u6F97"+
"\u6F45\u74B0\u7518\u76E3\u770B\u7AFF\u7BA1\u7C21"+
"\u7DE9\u7F36\u7FF0\u809D\u8266\u839E\u89B3\u8ACC"+
"\u8CAB\u9084\u9451\u9593\u9591\u95A2\u9665\u97D3"+
"\u9928\u8218\u4E38\u542B\u5CB8\u5DCC\u73A9\u764C"+
"\u773C\u5CA9\u7FEB\u8D0B\u96C1\u9811\u9854\u9858"+
"\u4F01\u4F0E\u5371\u559C\u5668\u57FA\u5947\u5B09"+
"\u5BC4\u5C90\u5E0C\u5E7E\u5FCC\u63EE\u673A\u65D7"+
"\u65E2\u671F\u68CB\u68C4\u6A5F\u5E30\u6BC5\u6C17"+
"\u6C7D\u757F\u7948\u5B63\u7A00\u7D00\u5FBD\u898F"+
"\u8A18\u8CB4\u8D77\u8ECC\u8F1D\u98E2\u9A0E\u9B3C"+
"\u4E80\u507D\u5100\u5993\u5B9C\u622F\u6280\u64EC"+
"\u6B3A\u72A0\u7591\u7947\u7FA9\u87FB\u8ABC\u8B70"+
"\u63AC\u83CA\u97A0\u5409\u5403\u55AB\u6854\u6A58"+
"\u8A70\u7827\u6775\u9ECD\u5374\u5BA2\u811A\u8650"+
"\u9006\u4E18\u4E45\u4EC7\u4F11\u53CA\u5438\u5BAE"+
"\u5F13\u6025\u6551\u673D\u6C42\u6C72\u6CE3\u7078"+
"\u7403\u7A76\u7AAE\u7B08\u7D1A\u7CFE\u7D66\u65E7"+
"\u725B\u53BB\u5C45\u5DE8\u62D2\u62E0\u6319\u6E20"+
"\u865A\u8A31\u8DDD\u92F8\u6F01\u79A6\u9B5A\u4EA8"+
"\u4EAB\u4EAC\u4F9B\u4FA0\u50D1\u5147\u7AF6\u5171"+
"\u51F6\u5354\u5321\u537F\u53EB\u55AC\u5883\u5CE1"+
"\u5F37\u5F4A\u602F\u6050\u606D\u631F\u6559\u6A4B"+
"\u6CC1\u72C2\u72ED\u77EF\u80F8\u8105\u8208\u854E"+
"\u90F7\u93E1\u97FF\u9957\u9A5A\u4EF0\u51DD\u5C2D"+
"\u6681\u696D\u5C40\u66F2\u6975\u7389\u6850\u7C81"+
"\u50C5\u52E4\u5747\u5DFE\u9326\u65A4\u6B23\u6B3D"+
"\u7434\u7981\u79BD\u7B4B\u7DCA\u82B9\u83CC\u887F"+
"\u895F\u8B39\u8FD1\u91D1\u541F\u9280\u4E5D\u5036"+
"\u53E5\u533A\u72D7\u7396\u77E9\u82E6\u8EAF\u99C6"+
"\u99C8\u99D2\u5177\u611A\u865E\u55B0\u7A7A\u5076"+
"\u5BD3\u9047\u9685\u4E32\u6ADB\u91E7\u5C51\u5C48";
private final static String innerIndex1=
"\u6398\u7A9F\u6C93\u9774\u8F61\u7AAA\u718A\u9688"+
"\u7C82\u6817\u7E70\u6851\u936C\u52F2\u541B\u85AB"+
"\u8A13\u7FA4\u8ECD\u90E1\u5366\u8888\u7941\u4FC2"+
"\u50BE\u5211\u5144\u5553\u572D\u73EA\u578B\u5951"+
"\u5F62\u5F84\u6075\u6176\u6167\u61A9\u63B2\u643A"+
"\u656C\u666F\u6842\u6E13\u7566\u7A3D\u7CFB\u7D4C"+
"\u7D99\u7E4B\u7F6B\u830E\u834A\u86CD\u8A08\u8A63"+
"\u8B66\u8EFD\u981A\u9D8F\u82B8\u8FCE\u9BE8\u5287"+
"\u621F\u6483\u6FC0\u9699\u6841\u5091\u6B20\u6C7A"+
"\u6F54\u7A74\u7D50\u8840\u8A23\u6708\u4EF6\u5039"+
"\u5026\u5065\u517C\u5238\u5263\u55A7\u570F\u5805"+
"\u5ACC\u5EFA\u61B2\u61F8\u62F3\u6372\u691C\u6A29"+
"\u727D\u72AC\u732E\u7814\u786F\u7D79\u770C\u80A9"+
"\u898B\u8B19\u8CE2\u8ED2\u9063\u9375\u967A\u9855"+
"\u9A13\u9E78\u5143\u539F\u53B3\u5E7B\u5F26\u6E1B"+
"\u6E90\u7384\u73FE\u7D43\u8237\u8A00\u8AFA\u9650"+
"\u4E4E\u500B\u53E4\u547C\u56FA\u59D1\u5B64\u5DF1"+
"\u5EAB\u5F27\u6238\u6545\u67AF\u6E56\u72D0\u7CCA"+
"\u88B4\u80A1\u80E1\u83F0\u864E\u8A87\u8DE8\u9237"+
"\u96C7\u9867\u9F13\u4E94\u4E92\u4F0D\u5348\u5449"+
"\u543E\u5A2F\u5F8C\u5FA1\u609F\u68A7\u6A8E\u745A"+
"\u7881\u8A9E\u8AA4\u8B77\u9190\u4E5E\u9BC9\u4EA4"+
"\u4F7C\u4FAF\u5019\u5016\u5149\u516C\u529F\u52B9"+
"\u52FE\u539A\u53E3\u5411\u540E\u5589\u5751\u57A2"+
"\u597D\u5B54\u5B5D\u5B8F\u5DE5\u5DE7\u5DF7\u5E78"+
"\u5E83\u5E9A\u5EB7\u5F18\u6052\u614C\u6297\u62D8"+
"\u63A7\u653B\u6602\u6643\u66F4\u676D\u6821\u6897"+
"\u69CB\u6C5F\u6D2A\u6D69\u6E2F\u6E9D\u7532\u7687"+
"\u786C\u7A3F\u7CE0\u7D05\u7D18\u7D5E\u7DB1\u8015"+
"\u8003\u80AF\u80B1\u8154\u818F\u822A\u8352\u884C"+
"\u8861\u8B1B\u8CA2\u8CFC\u90CA\u9175\u9271\u783F"+
"\u92FC\u95A4\u964D\u9805\u9999\u9AD8\u9D3B\u525B"+
"\u52AB\u53F7\u5408\u58D5\u62F7\u6FE0\u8C6A\u8F5F"+
"\u9EB9\u514B\u523B\u544A\u56FD\u7A40\u9177\u9D60"+
"\u9ED2\u7344\u6F09\u8170\u7511\u5FFD\u60DA\u9AA8"+
"\u72DB\u8FBC\u6B64\u9803\u4ECA\u56F0\u5764\u58BE"+
"\u5A5A\u6068\u61C7\u660F\u6606\u6839\u68B1\u6DF7"+
"\u75D5\u7D3A\u826E\u9B42\u4E9B\u4F50\u53C9\u5506"+
"\u5D6F\u5DE6\u5DEE\u67FB\u6C99\u7473\u7802\u8A50"+
"\u9396\u88DF\u5750\u5EA7\u632B\u50B5\u50AC\u518D"+
"\u6700\u54C9\u585E\u59BB\u5BB0\u5F69\u624D\u63A1"+
"\u683D\u6B73\u6E08\u707D\u91C7\u7280\u7815\u7826"+
"\u796D\u658E\u7D30\u83DC\u88C1\u8F09\u969B\u5264"+
"\u5728\u6750\u7F6A\u8CA1\u51B4\u5742\u962A\u583A"+
"\u698A\u80B4\u54B2\u5D0E\u57FC\u7895\u9DFA\u4F5C"+
"\u524A\u548B\u643E\u6628\u6714\u67F5\u7A84\u7B56"+
"\u7D22\u932F\u685C\u9BAD\u7B39\u5319\u518A\u5237"+
"\u5BDF\u62F6\u64AE\u64E6\u672D\u6BBA\u85A9\u96D1"+
"\u7690\u9BD6\u634C\u9306\u9BAB\u76BF\u6652\u4E09"+
"\u5098\u53C2\u5C71\u60E8\u6492\u6563\u685F\u71E6"+
"\u73CA\u7523\u7B97\u7E82\u8695\u8B83\u8CDB\u9178"+
"\u9910\u65AC\u66AB\u6B8B\u4ED5\u4ED4\u4F3A\u4F7F"+
"\u523A\u53F8\u53F2\u55E3\u56DB\u58EB\u59CB\u59C9"+
"\u59FF\u5B50\u5C4D\u5E02\u5E2B\u5FD7\u601D\u6307"+
"\u652F\u5B5C\u65AF\u65BD\u65E8\u679D\u6B62\u6B7B"+
"\u6C0F\u7345\u7949\u79C1\u7CF8\u7D19\u7D2B\u80A2"+
"\u8102\u81F3\u8996\u8A5E\u8A69\u8A66\u8A8C\u8AEE"+
"\u8CC7\u8CDC\u96CC\u98FC\u6B6F\u4E8B\u4F3C\u4F8D"+
"\u5150\u5B57\u5BFA\u6148\u6301\u6642\u6B21\u6ECB"+
"\u6CBB\u723E\u74BD\u75D4\u78C1\u793A\u800C\u8033"+
"\u81EA\u8494\u8F9E\u6C50\u9E7F\u5F0F\u8B58\u9D2B"+
"\u7AFA\u8EF8\u5B8D\u96EB\u4E03\u53F1\u57F7\u5931"+
"\u5AC9\u5BA4\u6089\u6E7F\u6F06\u75BE\u8CEA\u5B9F"+
"\u8500\u7BE0\u5072\u67F4\u829D\u5C61\u854A\u7E1E"+
"\u820E\u5199\u5C04\u6368\u8D66\u659C\u716E\u793E"+
"\u7D17\u8005\u8B1D\u8ECA\u906E\u86C7\u90AA\u501F"+
"\u52FA\u5C3A\u6753\u707C\u7235\u914C\u91C8\u932B"+
"\u82E5\u5BC2\u5F31\u60F9\u4E3B\u53D6\u5B88\u624B"+
"\u6731\u6B8A\u72E9\u73E0\u7A2E\u816B\u8DA3\u9152"+
"\u9996\u5112\u53D7\u546A\u5BFF\u6388\u6A39\u7DAC"+
"\u9700\u56DA\u53CE\u5468\u5B97\u5C31\u5DDE\u4FEE"+
"\u6101\u62FE\u6D32\u79C0\u79CB\u7D42\u7E4D\u7FD2"+
"\u81ED\u821F\u8490\u8846\u8972\u8B90\u8E74\u8F2F"+
"\u9031\u914B\u916C\u96C6\u919C\u4EC0\u4F4F\u5145"+
"\u5341\u5F93\u620E\u67D4\u6C41\u6E0B\u7363\u7E26"+
"\u91CD\u9283\u53D4\u5919\u5BBF\u6DD1\u795D\u7E2E"+
"\u7C9B\u587E\u719F\u51FA\u8853\u8FF0\u4FCA\u5CFB"+
"\u6625\u77AC\u7AE3\u821C\u99FF\u51C6\u5FAA\u65EC"+
"\u696F\u6B89\u6DF3\u6E96\u6F64\u76FE\u7D14\u5DE1"+
"\u9075\u9187\u9806\u51E6\u521D\u6240\u6691\u66D9"+
"\u6E1A\u5EB6\u7DD2\u7F72\u66F8\u85AF\u85F7\u8AF8"+
"\u52A9\u53D9\u5973\u5E8F\u5F90\u6055\u92E4\u9664"+
"\u50B7\u511F\u52DD\u5320\u5347\u53EC\u54E8\u5546"+
"\u5531\u5617\u5968\u59BE\u5A3C\u5BB5\u5C06\u5C0F"+
"\u5C11\u5C1A\u5E84\u5E8A\u5EE0\u5F70\u627F\u6284"+
"\u62DB\u638C\u6377\u6607\u660C\u662D\u6676\u677E"+
"\u68A2\u6A1F\u6A35\u6CBC\u6D88\u6E09\u6E58\u713C"+
"\u7126\u7167\u75C7\u7701\u785D\u7901\u7965\u79F0"+
"\u7AE0\u7B11\u7CA7\u7D39\u8096\u83D6\u848B\u8549"+
"\u885D\u88F3\u8A1F\u8A3C\u8A54\u8A73\u8C61\u8CDE"+
"\u91A4\u9266\u937E\u9418\u969C\u9798\u4E0A\u4E08"+
"\u4E1E\u4E57\u5197\u5270\u57CE\u5834\u58CC\u5B22"+
"\u5E38\u60C5\u64FE\u6761\u6756\u6D44\u72B6\u7573"+
"\u7A63\u84B8\u8B72\u91B8\u9320\u5631\u57F4\u98FE"+
"\u62ED\u690D\u6B96\u71ED\u7E54\u8077\u8272\u89E6"+
"\u98DF\u8755\u8FB1\u5C3B\u4F38\u4FE1\u4FB5\u5507"+
"\u5A20\u5BDD\u5BE9\u5FC3\u614E\u632F\u65B0\u664B"+
"\u68EE\u699B\u6D78\u6DF1\u7533\u75B9\u771F\u795E"+
"\u79E6\u7D33\u81E3\u82AF\u85AA\u89AA\u8A3A\u8EAB"+
"\u8F9B\u9032\u91DD\u9707\u4EBA\u4EC1\u5203\u5875"+
"\u58EC\u5C0B\u751A\u5C3D\u814E\u8A0A\u8FC5\u9663"+
"\u976D\u7B25\u8ACF\u9808\u9162\u56F3\u53A8\u9017"+
"\u5439\u5782\u5E25\u63A8\u6C34\u708A\u7761\u7C8B"+
"\u7FE0\u8870\u9042\u9154\u9310\u9318\u968F\u745E"+
"\u9AC4\u5D07\u5D69\u6570\u67A2\u8DA8\u96DB\u636E"+
"\u6749\u6919\u83C5\u9817\u96C0\u88FE\u6F84\u647A"+
"\u5BF8\u4E16\u702C\u755D\u662F\u51C4\u5236\u52E2"+
"\u59D3\u5F81\u6027\u6210\u653F\u6574\u661F\u6674"+
"\u68F2\u6816\u6B63\u6E05\u7272\u751F\u76DB\u7CBE"+
"\u8056\u58F0\u88FD\u897F\u8AA0\u8A93\u8ACB\u901D"+
"\u9192\u9752\u9759\u6589\u7A0E\u8106\u96BB\u5E2D"+
"\u60DC\u621A\u65A5\u6614\u6790\u77F3\u7A4D\u7C4D"+
"\u7E3E\u810A\u8CAC\u8D64\u8DE1\u8E5F\u78A9\u5207"+
"\u62D9\u63A5\u6442\u6298\u8A2D\u7A83\u7BC0\u8AAC"+
"\u96EA\u7D76\u820C\u8749\u4ED9\u5148\u5343\u5360"+
"\u5BA3\u5C02\u5C16\u5DDD\u6226\u6247\u64B0\u6813"+
"\u6834\u6CC9\u6D45\u6D17\u67D3\u6F5C\u714E\u717D"+
"\u65CB\u7A7F\u7BAD\u7DDA\u7E4A\u7FA8\u817A\u821B"+
"\u8239\u85A6\u8A6E\u8CCE\u8DF5\u9078\u9077\u92AD"+
"\u9291\u9583\u9BAE\u524D\u5584\u6F38\u7136\u5168"+
"\u7985\u7E55\u81B3\u7CCE\u564C\u5851\u5CA8\u63AA"+
"\u66FE\u66FD\u695A\u72D9\u758F\u758E\u790E\u7956"+
"\u79DF\u7C97\u7D20\u7D44\u8607\u8A34\u963B\u9061"+
"\u9F20\u50E7\u5275\u53CC\u53E2\u5009\u55AA\u58EE"+
"\u594F\u723D\u5B8B\u5C64\u531D\u60E3\u60F3\u635C"+
"\u6383\u633F\u63BB\u64CD\u65E9\u66F9\u5DE3\u69CD"+
"\u69FD\u6F15\u71E5\u4E89\u75E9\u76F8\u7A93\u7CDF"+
"\u7DCF\u7D9C\u8061\u8349\u8358\u846C\u84BC\u85FB"+
"\u88C5\u8D70\u9001\u906D\u9397\u971C\u9A12\u50CF"+
"\u5897\u618E\u81D3\u8535\u8D08\u9020\u4FC3\u5074"+
"\u5247\u5373\u606F\u6349\u675F\u6E2C\u8DB3\u901F"+
"\u4FD7\u5C5E\u8CCA\u65CF\u7D9A\u5352\u8896\u5176"+
"\u63C3\u5B58\u5B6B\u5C0A\u640D\u6751\u905C\u4ED6"+
"\u591A\u592A\u6C70\u8A51\u553E\u5815\u59A5\u60F0"+
"\u6253\u67C1\u8235\u6955\u9640\u99C4\u9A28\u4F53"+
"\u5806\u5BFE\u8010\u5CB1\u5E2F\u5F85\u6020\u614B"+
"\u6234\u66FF\u6CF0\u6EDE\u80CE\u817F\u82D4\u888B"+
"\u8CB8\u9000\u902E\u968A\u9EDB\u9BDB\u4EE3\u53F0"+
"\u5927\u7B2C\u918D\u984C\u9DF9\u6EDD\u7027\u5353"+
"\u5544\u5B85\u6258\u629E\u62D3\u6CA2\u6FEF\u7422"+
"\u8A17\u9438\u6FC1\u8AFE\u8338\u51E7\u86F8\u53EA"+
"\u53E9\u4F46\u9054\u8FB0\u596A\u8131\u5DFD\u7AEA"+
"\u8FBF\u68DA\u8C37\u72F8\u9C48\u6A3D\u8AB0\u4E39"+
"\u5358\u5606\u5766\u62C5\u63A2\u65E6\u6B4E\u6DE1"+
"\u6E5B\u70AD\u77ED\u7AEF\u7BAA\u7DBB\u803D\u80C6"+
"\u86CB\u8A95\u935B\u56E3\u58C7\u5F3E\u65AD\u6696"+
"\u6A80\u6BB5\u7537\u8AC7\u5024\u77E5\u5730\u5F1B"+
"\u6065\u667A\u6C60\u75F4\u7A1A\u7F6E\u81F4\u8718"+
"\u9045\u99B3\u7BC9\u755C\u7AF9\u7B51\u84C4\u9010"+
"\u79E9\u7A92\u8336\u5AE1\u7740\u4E2D\u4EF2\u5B99"+
"\u5FE0\u62BD\u663C\u67F1\u6CE8\u866B\u8877\u8A3B"+
"\u914E\u92F3\u99D0\u6A17\u7026\u732A\u82E7\u8457"+
"\u8CAF\u4E01\u5146\u51CB\u558B\u5BF5\u5E16\u5E33"+
"\u5E81\u5F14\u5F35\u5F6B\u5FB4\u61F2\u6311\u66A2"+
"\u671D\u6F6E\u7252\u753A\u773A\u8074\u8139\u8178"+
"\u8776\u8ABF\u8ADC\u8D85\u8DF3\u929A\u9577\u9802"+
"\u9CE5\u52C5\u6357\u76F4\u6715\u6C88\u73CD\u8CC3"+
"\u93AE\u9673\u6D25\u589C\u690E\u69CC\u8FFD\u939A"+
"\u75DB\u901A\u585A\u6802\u63B4\u69FB\u4F43\u6F2C"+
"\u67D8\u8FBB\u8526\u7DB4\u9354\u693F\u6F70\u576A"+
"\u58F7\u5B2C\u7D2C\u722A\u540A\u91E3\u9DB4\u4EAD"+
"\u4F4E\u505C\u5075\u5243\u8C9E\u5448\u5824\u5B9A"+
"\u5E1D\u5E95\u5EAD\u5EF7\u5F1F\u608C\u62B5\u633A"+
"\u63D0\u68AF\u6C40\u7887\u798E\u7A0B\u7DE0\u8247"+
"\u8A02\u8AE6\u8E44\u9013\u90B8\u912D\u91D8\u9F0E"+
"\u6CE5\u6458\u64E2\u6575\u6EF4\u7684\u7B1B\u9069"+
"\u93D1\u6EBA\u54F2\u5FB9\u64A4\u8F4D\u8FED\u9244"+
"\u5178\u586B\u5929\u5C55\u5E97\u6DFB\u7E8F\u751C"+
"\u8CBC\u8EE2\u985B\u70B9\u4F1D\u6BBF\u6FB1\u7530"+
"\u96FB\u514E\u5410\u5835\u5857\u59AC\u5C60\u5F92"+
"\u6597\u675C\u6E21\u767B\u83DF\u8CED\u9014\u90FD"+
"\u934D\u7825\u783A\u52AA\u5EA6\u571F\u5974\u6012"+
"\u5012\u515A\u51AC\u51CD\u5200\u5510\u5854\u5858"+
"\u5957\u5B95\u5CF6\u5D8B\u60BC\u6295\u642D\u6771"+
"\u6843\u68BC\u68DF\u76D7\u6DD8\u6E6F\u6D9B\u706F"+
"\u71C8\u5F53\u75D8\u7977\u7B49\u7B54\u7B52\u7CD6"+
"\u7D71\u5230\u8463\u8569\u85E4\u8A0E\u8B04\u8C46"+
"\u8E0F\u9003\u900F\u9419\u9676\u982D\u9A30\u95D8"+
"\u50CD\u52D5\u540C\u5802\u5C0E\u61A7\u649E\u6D1E"+
"\u77B3\u7AE5\u80F4\u8404\u9053\u9285\u5CE0\u9D07"+
"\u533F\u5F97\u5FB3\u6D9C\u7279\u7763\u79BF\u7BE4"+
"\u6BD2\u72EC\u8AAD\u6803\u6A61\u51F8\u7A81\u6934"+
"\u5C4A\u9CF6\u82EB\u5BC5\u9149\u701E\u5678\u5C6F"+
"\u60C7\u6566\u6C8C\u8C5A\u9041\u9813\u5451\u66C7"+
"\u920D\u5948\u90A3\u5185\u4E4D\u51EA\u8599\u8B0E"+
"\u7058\u637A\u934B\u6962\u99B4\u7E04\u7577\u5357"+
"\u6960\u8EDF\u96E3\u6C5D\u4E8C\u5C3C\u5F10\u8FE9"+
"\u5302\u8CD1\u8089\u8679\u5EFF\u65E5\u4E73\u5165";
private final static String innerIndex2=
"\u5982\u5C3F\u97EE\u4EFB\u598A\u5FCD\u8A8D\u6FE1"+
"\u79B0\u7962\u5BE7\u8471\u732B\u71B1\u5E74\u5FF5"+
"\u637B\u649A\u71C3\u7C98\u4E43\u5EFC\u4E4B\u57DC"+
"\u56A2\u60A9\u6FC3\u7D0D\u80FD\u8133\u81BF\u8FB2"+
"\u8997\u86A4\u5DF4\u628A\u64AD\u8987\u6777\u6CE2"+
"\u6D3E\u7436\u7834\u5A46\u7F75\u82AD\u99AC\u4FF3"+
"\u5EC3\u62DD\u6392\u6557\u676F\u76C3\u724C\u80CC"+
"\u80BA\u8F29\u914D\u500D\u57F9\u5A92\u6885\u6973"+
"\u7164\u72FD\u8CB7\u58F2\u8CE0\u966A\u9019\u877F"+
"\u79E4\u77E7\u8429\u4F2F\u5265\u535A\u62CD\u67CF"+
"\u6CCA\u767D\u7B94\u7C95\u8236\u8584\u8FEB\u66DD"+
"\u6F20\u7206\u7E1B\u83AB\u99C1\u9EA6\u51FD\u7BB1"+
"\u7872\u7BB8\u8087\u7B48\u6AE8\u5E61\u808C\u7551"+
"\u7560\u516B\u9262\u6E8C\u767A\u9197\u9AEA\u4F10"+
"\u7F70\u629C\u7B4F\u95A5\u9CE9\u567A\u5859\u86E4"+
"\u96BC\u4F34\u5224\u534A\u53CD\u53DB\u5E06\u642C"+
"\u6591\u677F\u6C3E\u6C4E\u7248\u72AF\u73ED\u7554"+
"\u7E41\u822C\u85E9\u8CA9\u7BC4\u91C6\u7169\u9812"+
"\u98EF\u633D\u6669\u756A\u76E4\u78D0\u8543\u86EE"+
"\u532A\u5351\u5426\u5983\u5E87\u5F7C\u60B2\u6249"+
"\u6279\u62AB\u6590\u6BD4\u6CCC\u75B2\u76AE\u7891"+
"\u79D8\u7DCB\u7F77\u80A5\u88AB\u8AB9\u8CBB\u907F"+
"\u975E\u98DB\u6A0B\u7C38\u5099\u5C3E\u5FAE\u6787"+
"\u6BD8\u7435\u7709\u7F8E\u9F3B\u67CA\u7A17\u5339"+
"\u758B\u9AED\u5F66\u819D\u83F1\u8098\u5F3C\u5FC5"+
"\u7562\u7B46\u903C\u6867\u59EB\u5A9B\u7D10\u767E"+
"\u8B2C\u4FF5\u5F6A\u6A19\u6C37\u6F02\u74E2\u7968"+
"\u8868\u8A55\u8C79\u5EDF\u63CF\u75C5\u79D2\u82D7"+
"\u9328\u92F2\u849C\u86ED\u9C2D\u54C1\u5F6C\u658C"+
"\u6D5C\u7015\u8CA7\u8CD3\u983B\u654F\u74F6\u4E0D"+
"\u4ED8\u57E0\u592B\u5A66\u5BCC\u51A8\u5E03\u5E9C"+
"\u6016\u6276\u6577\u65A7\u666E\u6D6E\u7236\u7B26"+
"\u8150\u819A\u8299\u8B5C\u8CA0\u8CE6\u8D74\u961C"+
"\u9644\u4FAE\u64AB\u6B66\u821E\u8461\u856A\u90E8"+
"\u5C01\u6953\u98A8\u847A\u8557\u4F0F\u526F\u5FA9"+
"\u5E45\u670D\u798F\u8179\u8907\u8986\u6DF5\u5F17"+
"\u6255\u6CB8\u4ECF\u7269\u9B92\u5206\u543B\u5674"+
"\u58B3\u61A4\u626E\u711A\u596E\u7C89\u7CDE\u7D1B"+
"\u96F0\u6587\u805E\u4E19\u4F75\u5175\u5840\u5E63"+
"\u5E73\u5F0A\u67C4\u4E26\u853D\u9589\u965B\u7C73"+
"\u9801\u50FB\u58C1\u7656\u78A7\u5225\u77A5\u8511"+
"\u7B86\u504F\u5909\u7247\u7BC7\u7DE8\u8FBA\u8FD4"+
"\u904D\u4FBF\u52C9\u5A29\u5F01\u97AD\u4FDD\u8217"+
"\u92EA\u5703\u6355\u6B69\u752B\u88DC\u8F14\u7A42"+
"\u52DF\u5893\u6155\u620A\u66AE\u6BCD\u7C3F\u83E9"+
"\u5023\u4FF8\u5305\u5446\u5831\u5949\u5B9D\u5CF0"+
"\u5CEF\u5D29\u5E96\u62B1\u6367\u653E\u65B9\u670B"+
"\u6CD5\u6CE1\u70F9\u7832\u7E2B\u80DE\u82B3\u840C"+
"\u84EC\u8702\u8912\u8A2A\u8C4A\u90A6\u92D2\u98FD"+
"\u9CF3\u9D6C\u4E4F\u4EA1\u508D\u5256\u574A\u59A8"+
"\u5E3D\u5FD8\u5FD9\u623F\u66B4\u671B\u67D0\u68D2"+
"\u5192\u7D21\u80AA\u81A8\u8B00\u8C8C\u8CBF\u927E"+
"\u9632\u5420\u982C\u5317\u50D5\u535C\u58A8\u64B2"+
"\u6734\u7267\u7766\u7A46\u91E6\u52C3\u6CA1\u6B86"+
"\u5800\u5E4C\u5954\u672C\u7FFB\u51E1\u76C6\u6469"+
"\u78E8\u9B54\u9EBB\u57CB\u59B9\u6627\u679A\u6BCE"+
"\u54E9\u69D9\u5E55\u819C\u6795\u9BAA\u67FE\u9C52"+
"\u685D\u4EA6\u4FE3\u53C8\u62B9\u672B\u6CAB\u8FC4"+
"\u4FAD\u7E6D\u9EBF\u4E07\u6162\u6E80\u6F2B\u8513"+
"\u5473\u672A\u9B45\u5DF3\u7B95\u5CAC\u5BC6\u871C"+
"\u6E4A\u84D1\u7A14\u8108\u5999\u7C8D\u6C11\u7720"+
"\u52D9\u5922\u7121\u725F\u77DB\u9727\u9D61\u690B"+
"\u5A7F\u5A18\u51A5\u540D\u547D\u660E\u76DF\u8FF7"+
"\u9298\u9CF4\u59EA\u725D\u6EC5\u514D\u68C9\u7DBF"+
"\u7DEC\u9762\u9EBA\u6478\u6A21\u8302\u5984\u5B5F"+
"\u6BDB\u731B\u76F2\u7DB2\u8017\u8499\u5132\u6728"+
"\u9ED9\u76EE\u6762\u52FF\u9905\u5C24\u623B\u7C7E"+
"\u8CB0\u554F\u60B6\u7D0B\u9580\u5301\u4E5F\u51B6"+
"\u591C\u723A\u8036\u91CE\u5F25\u77E2\u5384\u5F79"+
"\u7D04\u85AC\u8A33\u8E8D\u9756\u67F3\u85AE\u9453"+
"\u6109\u6108\u6CB9\u7652\u8AED\u8F38\u552F\u4F51"+
"\u512A\u52C7\u53CB\u5BA5\u5E7D\u60A0\u6182\u63D6"+
"\u6709\u67DA\u6E67\u6D8C\u7336\u7337\u7531\u7950"+
"\u88D5\u8A98\u904A\u9091\u90F5\u96C4\u878D\u5915"+
"\u4E88\u4F59\u4E0E\u8A89\u8F3F\u9810\u50AD\u5E7C"+
"\u5996\u5BB9\u5EB8\u63DA\u63FA\u64C1\u66DC\u694A"+
"\u69D8\u6D0B\u6EB6\u7194\u7528\u7AAF\u7F8A\u8000"+
"\u8449\u84C9\u8981\u8B21\u8E0A\u9065\u967D\u990A"+
"\u617E\u6291\u6B32\u6C83\u6D74\u7FCC\u7FFC\u6DC0"+
"\u7F85\u87BA\u88F8\u6765\u83B1\u983C\u96F7\u6D1B"+
"\u7D61\u843D\u916A\u4E71\u5375\u5D50\u6B04\u6FEB"+
"\u85CD\u862D\u89A7\u5229\u540F\u5C65\u674E\u68A8"+
"\u7406\u7483\u75E2\u88CF\u88E1\u91CC\u96E2\u9678"+
"\u5F8B\u7387\u7ACB\u844E\u63A0\u7565\u5289\u6D41"+
"\u6E9C\u7409\u7559\u786B\u7C92\u9686\u7ADC\u9F8D"+
"\u4FB6\u616E\u65C5\u865C\u4E86\u4EAE\u50DA\u4E21"+
"\u51CC\u5BEE\u6599\u6881\u6DBC\u731F\u7642\u77AD"+
"\u7A1C\u7CE7\u826F\u8AD2\u907C\u91CF\u9675\u9818"+
"\u529B\u7DD1\u502B\u5398\u6797\u6DCB\u71D0\u7433"+
"\u81E8\u8F2A\u96A3\u9C57\u9E9F\u7460\u5841\u6D99"+
"\u7D2F\u985E\u4EE4\u4F36\u4F8B\u51B7\u52B1\u5DBA"+
"\u601C\u73B2\u793C\u82D3\u9234\u96B7\u96F6\u970A"+
"\u9E97\u9F62\u66A6\u6B74\u5217\u52A3\u70C8\u88C2"+
"\u5EC9\u604B\u6190\u6F23\u7149\u7C3E\u7DF4\u806F"+
"\u84EE\u9023\u932C\u5442\u9B6F\u6AD3\u7089\u8CC2"+
"\u8DEF\u9732\u52B4\u5A41\u5ECA\u5F04\u6717\u697C"+
"\u6994\u6D6A\u6F0F\u7262\u72FC\u7BED\u8001\u807E"+
"\u874B\u90CE\u516D\u9E93\u7984\u808B\u9332\u8AD6"+
"\u502D\u548C\u8A71\u6B6A\u8CC4\u8107\u60D1\u67A0"+
"\u9DF2\u4E99\u4E98\u9C10\u8A6B\u85C1\u8568\u6900"+
"\u6E7E\u7897\u8155\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u5F0C\u4E10"+
"\u4E15\u4E2A\u4E31\u4E36\u4E3C\u4E3F\u4E42\u4E56"+
"\u4E58\u4E82\u4E85\u8C6B\u4E8A\u8212\u5F0D\u4E8E"+
"\u4E9E\u4E9F\u4EA0\u4EA2\u4EB0\u4EB3\u4EB6\u4ECE"+
"\u4ECD\u4EC4\u4EC6\u4EC2\u4ED7\u4EDE\u4EED\u4EDF"+
"\u4EF7\u4F09\u4F5A\u4F30\u4F5B\u4F5D\u4F57\u4F47"+
"\u4F76\u4F88\u4F8F\u4F98\u4F7B\u4F69\u4F70\u4F91"+
"\u4F6F\u4F86\u4F96\u5118\u4FD4\u4FDF\u4FCE\u4FD8"+
"\u4FDB\u4FD1\u4FDA\u4FD0\u4FE4\u4FE5\u501A\u5028"+
"\u5014\u502A\u5025\u5005\u4F1C\u4FF6\u5021\u5029"+
"\u502C\u4FFE\u4FEF\u5011\u5006\u5043\u5047\u6703"+
"\u5055\u5050\u5048\u505A\u5056\u506C\u5078\u5080"+
"\u509A\u5085\u50B4\u50B2\u50C9\u50CA\u50B3\u50C2"+
"\u50D6\u50DE\u50E5\u50ED\u50E3\u50EE\u50F9\u50F5"+
"\u5109\u5101\u5102\u5116\u5115\u5114\u511A\u5121"+
"\u513A\u5137\u513C\u513B\u513F\u5140\u5152\u514C"+
"\u5154\u5162\u7AF8\u5169\u516A\u516E\u5180\u5182"+
"\u56D8\u518C\u5189\u518F\u5191\u5193\u5195\u5196"+
"\u51A4\u51A6\u51A2\u51A9\u51AA\u51AB\u51B3\u51B1"+
"\u51B2\u51B0\u51B5\u51BD\u51C5\u51C9\u51DB\u51E0"+
"\u8655\u51E9\u51ED\u51F0\u51F5\u51FE\u5204\u520B"+
"\u5214\u520E\u5227\u522A\u522E\u5233\u5239\u524F"+
"\u5244\u524B\u524C\u525E\u5254\u526A\u5274\u5269"+
"\u5273\u527F\u527D\u528D\u5294\u5292\u5271\u5288"+
"\u5291\u8FA8\u8FA7\u52AC\u52AD\u52BC\u52B5\u52C1"+
"\u52CD\u52D7\u52DE\u52E3\u52E6\u98ED\u52E0\u52F3"+
"\u52F5\u52F8\u52F9\u5306\u5308\u7538\u530D\u5310"+
"\u530F\u5315\u531A\u5323\u532F\u5331\u5333\u5338"+
"\u5340\u5346\u5345\u4E17\u5349\u534D\u51D6\u535E"+
"\u5369\u536E\u5918\u537B\u5377\u5382\u5396\u53A0"+
"\u53A6\u53A5\u53AE\u53B0\u53B6\u53C3\u7C12\u96D9"+
"\u53DF\u66FC\u71EE\u53EE\u53E8\u53ED\u53FA\u5401"+
"\u543D\u5440\u542C\u542D\u543C\u542E\u5436\u5429"+
"\u541D\u544E\u548F\u5475\u548E\u545F\u5471\u5477"+
"\u5470\u5492\u547B\u5480\u5476\u5484\u5490\u5486"+
"\u54C7\u54A2\u54B8\u54A5\u54AC\u54C4\u54C8\u54A8"+
"\u54AB\u54C2\u54A4\u54BE\u54BC\u54D8\u54E5\u54E6"+
"\u550F\u5514\u54FD\u54EE\u54ED\u54FA\u54E2\u5539"+
"\u5540\u5563\u554C\u552E\u555C\u5545\u5556\u5557"+
"\u5538\u5533\u555D\u5599\u5580\u54AF\u558A\u559F"+
"\u557B\u557E\u5598\u559E\u55AE\u557C\u5583\u55A9"+
"\u5587\u55A8\u55DA\u55C5\u55DF\u55C4\u55DC\u55E4"+
"\u55D4\u5614\u55F7\u5616\u55FE\u55FD\u561B\u55F9"+
"\u564E\u5650\u71DF\u5634\u5636\u5632\u5638\u566B"+
"\u5664\u562F\u566C\u566A\u5686\u5680\u568A\u56A0"+
"\u5694\u568F\u56A5\u56AE\u56B6\u56B4\u56C2\u56BC"+
"\u56C1\u56C3\u56C0\u56C8\u56CE\u56D1\u56D3\u56D7"+
"\u56EE\u56F9\u5700\u56FF\u5704\u5709\u5708\u570B"+
"\u570D\u5713\u5718\u5716\u55C7\u571C\u5726\u5737"+
"\u5738\u574E\u573B\u5740\u574F\u5769\u57C0\u5788"+
"\u5761\u577F\u5789\u5793\u57A0\u57B3\u57A4\u57AA"+
"\u57B0\u57C3\u57C6\u57D4\u57D2\u57D3\u580A\u57D6"+
"\u57E3\u580B\u5819\u581D\u5872\u5821\u5862\u584B"+
"\u5870\u6BC0\u5852\u583D\u5879\u5885\u58B9\u589F"+
"\u58AB\u58BA\u58DE\u58BB\u58B8\u58AE\u58C5\u58D3"+
"\u58D1\u58D7\u58D9\u58D8\u58E5\u58DC\u58E4\u58DF"+
"\u58EF\u58FA\u58F9\u58FB\u58FC\u58FD\u5902\u590A"+
"\u5910\u591B\u68A6\u5925\u592C\u592D\u5932\u5938"+
"\u593E\u7AD2\u5955\u5950\u594E\u595A\u5958\u5962"+
"\u5960\u5967\u596C\u5969\u5978\u5981\u599D\u4F5E"+
"\u4FAB\u59A3\u59B2\u59C6\u59E8\u59DC\u598D\u59D9"+
"\u59DA\u5A25\u5A1F\u5A11\u5A1C\u5A09\u5A1A\u5A40"+
"\u5A6C\u5A49\u5A35\u5A36\u5A62\u5A6A\u5A9A\u5ABC"+
"\u5ABE\u5ACB\u5AC2\u5ABD\u5AE3\u5AD7\u5AE6\u5AE9"+
"\u5AD6\u5AFA\u5AFB\u5B0C\u5B0B\u5B16\u5B32\u5AD0"+
"\u5B2A\u5B36\u5B3E\u5B43\u5B45\u5B40\u5B51\u5B55"+
"\u5B5A\u5B5B\u5B65\u5B69\u5B70\u5B73\u5B75\u5B78"+
"\u6588\u5B7A\u5B80\u5B83\u5BA6\u5BB8\u5BC3\u5BC7"+
"\u5BC9\u5BD4\u5BD0\u5BE4\u5BE6\u5BE2\u5BDE\u5BE5"+
"\u5BEB\u5BF0\u5BF6\u5BF3\u5C05\u5C07\u5C08\u5C0D"+
"\u5C13\u5C20\u5C22\u5C28\u5C38\u5C39\u5C41\u5C46"+
"\u5C4E\u5C53\u5C50\u5C4F\u5B71\u5C6C\u5C6E\u4E62"+
"\u5C76\u5C79\u5C8C\u5C91\u5C94\u599B\u5CAB\u5CBB"+
"\u5CB6\u5CBC\u5CB7\u5CC5\u5CBE\u5CC7\u5CD9\u5CE9"+
"\u5CFD\u5CFA\u5CED\u5D8C\u5CEA\u5D0B\u5D15\u5D17"+
"\u5D5C\u5D1F\u5D1B\u5D11\u5D14\u5D22\u5D1A\u5D19"+
"\u5D18\u5D4C\u5D52\u5D4E\u5D4B\u5D6C\u5D73\u5D76"+
"\u5D87\u5D84\u5D82\u5DA2\u5D9D\u5DAC\u5DAE\u5DBD"+
"\u5D90\u5DB7\u5DBC\u5DC9\u5DCD\u5DD3\u5DD2\u5DD6"+
"\u5DDB\u5DEB\u5DF2\u5DF5\u5E0B\u5E1A\u5E19\u5E11"+
"\u5E1B\u5E36\u5E37\u5E44\u5E43\u5E40\u5E4E\u5E57"+
"\u5E54\u5E5F\u5E62\u5E64\u5E47\u5E75\u5E76\u5E7A"+
"\u9EBC\u5E7F\u5EA0\u5EC1\u5EC2\u5EC8\u5ED0\u5ECF";
private final static String innerIndex3=
"\u5ED6\u5EE3\u5EDD\u5EDA\u5EDB\u5EE2\u5EE1\u5EE8"+
"\u5EE9\u5EEC\u5EF1\u5EF3\u5EF0\u5EF4\u5EF8\u5EFE"+
"\u5F03\u5F09\u5F5D\u5F5C\u5F0B\u5F11\u5F16\u5F29"+
"\u5F2D\u5F38\u5F41\u5F48\u5F4C\u5F4E\u5F2F\u5F51"+
"\u5F56\u5F57\u5F59\u5F61\u5F6D\u5F73\u5F77\u5F83"+
"\u5F82\u5F7F\u5F8A\u5F88\u5F91\u5F87\u5F9E\u5F99"+
"\u5F98\u5FA0\u5FA8\u5FAD\u5FBC\u5FD6\u5FFB\u5FE4"+
"\u5FF8\u5FF1\u5FDD\u60B3\u5FFF\u6021\u6060\u6019"+
"\u6010\u6029\u600E\u6031\u601B\u6015\u602B\u6026"+
"\u600F\u603A\u605A\u6041\u606A\u6077\u605F\u604A"+
"\u6046\u604D\u6063\u6043\u6064\u6042\u606C\u606B"+
"\u6059\u6081\u608D\u60E7\u6083\u609A\u6084\u609B"+
"\u6096\u6097\u6092\u60A7\u608B\u60E1\u60B8\u60E0"+
"\u60D3\u60B4\u5FF0\u60BD\u60C6\u60B5\u60D8\u614D"+
"\u6115\u6106\u60F6\u60F7\u6100\u60F4\u60FA\u6103"+
"\u6121\u60FB\u60F1\u610D\u610E\u6147\u613E\u6128"+
"\u6127\u614A\u613F\u613C\u612C\u6134\u613D\u6142"+
"\u6144\u6173\u6177\u6158\u6159\u615A\u616B\u6174"+
"\u616F\u6165\u6171\u615F\u615D\u6153\u6175\u6199"+
"\u6196\u6187\u61AC\u6194\u619A\u618A\u6191\u61AB"+
"\u61AE\u61CC\u61CA\u61C9\u61F7\u61C8\u61C3\u61C6"+
"\u61BA\u61CB\u7F79\u61CD\u61E6\u61E3\u61F6\u61FA"+
"\u61F4\u61FF\u61FD\u61FC\u61FE\u6200\u6208\u6209"+
"\u620D\u620C\u6214\u621B\u621E\u6221\u622A\u622E"+
"\u6230\u6232\u6233\u6241\u624E\u625E\u6263\u625B"+
"\u6260\u6268\u627C\u6282\u6289\u627E\u6292\u6293"+
"\u6296\u62D4\u6283\u6294\u62D7\u62D1\u62BB\u62CF"+
"\u62FF\u62C6\u64D4\u62C8\u62DC\u62CC\u62CA\u62C2"+
"\u62C7\u629B\u62C9\u630C\u62EE\u62F1\u6327\u6302"+
"\u6308\u62EF\u62F5\u6350\u633E\u634D\u641C\u634F"+
"\u6396\u638E\u6380\u63AB\u6376\u63A3\u638F\u6389"+
"\u639F\u63B5\u636B\u6369\u63BE\u63E9\u63C0\u63C6"+
"\u63E3\u63C9\u63D2\u63F6\u63C4\u6416\u6434\u6406"+
"\u6413\u6426\u6436\u651D\u6417\u6428\u640F\u6467"+
"\u646F\u6476\u644E\u652A\u6495\u6493\u64A5\u64A9"+
"\u6488\u64BC\u64DA\u64D2\u64C5\u64C7\u64BB\u64D8"+
"\u64C2\u64F1\u64E7\u8209\u64E0\u64E1\u62AC\u64E3"+
"\u64EF\u652C\u64F6\u64F4\u64F2\u64FA\u6500\u64FD"+
"\u6518\u651C\u6505\u6524\u6523\u652B\u6534\u6535"+
"\u6537\u6536\u6538\u754B\u6548\u6556\u6555\u654D"+
"\u6558\u655E\u655D\u6572\u6578\u6582\u6583\u8B8A"+
"\u659B\u659F\u65AB\u65B7\u65C3\u65C6\u65C1\u65C4"+
"\u65CC\u65D2\u65DB\u65D9\u65E0\u65E1\u65F1\u6772"+
"\u660A\u6603\u65FB\u6773\u6635\u6636\u6634\u661C"+
"\u664F\u6644\u6649\u6641\u665E\u665D\u6664\u6667"+
"\u6668\u665F\u6662\u6670\u6683\u6688\u668E\u6689"+
"\u6684\u6698\u669D\u66C1\u66B9\u66C9\u66BE\u66BC"+
"\u66C4\u66B8\u66D6\u66DA\u66E0\u663F\u66E6\u66E9"+
"\u66F0\u66F5\u66F7\u670F\u6716\u671E\u6726\u6727"+
"\u9738\u672E\u673F\u6736\u6741\u6738\u6737\u6746"+
"\u675E\u6760\u6759\u6763\u6764\u6789\u6770\u67A9"+
"\u677C\u676A\u678C\u678B\u67A6\u67A1\u6785\u67B7"+
"\u67EF\u67B4\u67EC\u67B3\u67E9\u67B8\u67E4\u67DE"+
"\u67DD\u67E2\u67EE\u67B9\u67CE\u67C6\u67E7\u6A9C"+
"\u681E\u6846\u6829\u6840\u684D\u6832\u684E\u68B3"+
"\u682B\u6859\u6863\u6877\u687F\u689F\u688F\u68AD"+
"\u6894\u689D\u689B\u6883\u6AAE\u68B9\u6874\u68B5"+
"\u68A0\u68BA\u690F\u688D\u687E\u6901\u68CA\u6908"+
"\u68D8\u6922\u6926\u68E1\u690C\u68CD\u68D4\u68E7"+
"\u68D5\u6936\u6912\u6904\u68D7\u68E3\u6925\u68F9"+
"\u68E0\u68EF\u6928\u692A\u691A\u6923\u6921\u68C6"+
"\u6979\u6977\u695C\u6978\u696B\u6954\u697E\u696E"+
"\u6939\u6974\u693D\u6959\u6930\u6961\u695E\u695D"+
"\u6981\u696A\u69B2\u69AE\u69D0\u69BF\u69C1\u69D3"+
"\u69BE\u69CE\u5BE8\u69CA\u69DD\u69BB\u69C3\u69A7"+
"\u6A2E\u6991\u69A0\u699C\u6995\u69B4\u69DE\u69E8"+
"\u6A02\u6A1B\u69FF\u6B0A\u69F9\u69F2\u69E7\u6A05"+
"\u69B1\u6A1E\u69ED\u6A14\u69EB\u6A0A\u6A12\u6AC1"+
"\u6A23\u6A13\u6A44\u6A0C\u6A72\u6A36\u6A78\u6A47"+
"\u6A62\u6A59\u6A66\u6A48\u6A38\u6A22\u6A90\u6A8D"+
"\u6AA0\u6A84\u6AA2\u6AA3\u6A97\u8617\u6ABB\u6AC3"+
"\u6AC2\u6AB8\u6AB3\u6AAC\u6ADE\u6AD1\u6ADF\u6AAA"+
"\u6ADA\u6AEA\u6AFB\u6B05\u8616\u6AFA\u6B12\u6B16"+
"\u9B31\u6B1F\u6B38\u6B37\u76DC\u6B39\u98EE\u6B47"+
"\u6B43\u6B49\u6B50\u6B59\u6B54\u6B5B\u6B5F\u6B61"+
"\u6B78\u6B79\u6B7F\u6B80\u6B84\u6B83\u6B8D\u6B98"+
"\u6B95\u6B9E\u6BA4\u6BAA\u6BAB\u6BAF\u6BB2\u6BB1"+
"\u6BB3\u6BB7\u6BBC\u6BC6\u6BCB\u6BD3\u6BDF\u6BEC"+
"\u6BEB\u6BF3\u6BEF\u9EBE\u6C08\u6C13\u6C14\u6C1B"+
"\u6C24\u6C23\u6C5E\u6C55\u6C62\u6C6A\u6C82\u6C8D"+
"\u6C9A\u6C81\u6C9B\u6C7E\u6C68\u6C73\u6C92\u6C90"+
"\u6CC4\u6CF1\u6CD3\u6CBD\u6CD7\u6CC5\u6CDD\u6CAE"+
"\u6CB1\u6CBE\u6CBA\u6CDB\u6CEF\u6CD9\u6CEA\u6D1F"+
"\u884D\u6D36\u6D2B\u6D3D\u6D38\u6D19\u6D35\u6D33"+
"\u6D12\u6D0C\u6D63\u6D93\u6D64\u6D5A\u6D79\u6D59"+
"\u6D8E\u6D95\u6FE4\u6D85\u6DF9\u6E15\u6E0A\u6DB5"+
"\u6DC7\u6DE6\u6DB8\u6DC6\u6DEC\u6DDE\u6DCC\u6DE8"+
"\u6DD2\u6DC5\u6DFA\u6DD9\u6DE4\u6DD5\u6DEA\u6DEE"+
"\u6E2D\u6E6E\u6E2E\u6E19\u6E72\u6E5F\u6E3E\u6E23"+
"\u6E6B\u6E2B\u6E76\u6E4D\u6E1F\u6E43\u6E3A\u6E4E"+
"\u6E24\u6EFF\u6E1D\u6E38\u6E82\u6EAA\u6E98\u6EC9"+
"\u6EB7\u6ED3\u6EBD\u6EAF\u6EC4\u6EB2\u6ED4\u6ED5"+
"\u6E8F\u6EA5\u6EC2\u6E9F\u6F41\u6F11\u704C\u6EEC"+
"\u6EF8\u6EFE\u6F3F\u6EF2\u6F31\u6EEF\u6F32\u6ECC"+
"\u6F3E\u6F13\u6EF7\u6F86\u6F7A\u6F78\u6F81\u6F80"+
"\u6F6F\u6F5B\u6FF3\u6F6D\u6F82\u6F7C\u6F58\u6F8E"+
"\u6F91\u6FC2\u6F66\u6FB3\u6FA3\u6FA1\u6FA4\u6FB9"+
"\u6FC6\u6FAA\u6FDF\u6FD5\u6FEC\u6FD4\u6FD8\u6FF1"+
"\u6FEE\u6FDB\u7009\u700B\u6FFA\u7011\u7001\u700F"+
"\u6FFE\u701B\u701A\u6F74\u701D\u7018\u701F\u7030"+
"\u703E\u7032\u7051\u7063\u7099\u7092\u70AF\u70F1"+
"\u70AC\u70B8\u70B3\u70AE\u70DF\u70CB\u70DD\u70D9"+
"\u7109\u70FD\u711C\u7119\u7165\u7155\u7188\u7166"+
"\u7162\u714C\u7156\u716C\u718F\u71FB\u7184\u7195"+
"\u71A8\u71AC\u71D7\u71B9\u71BE\u71D2\u71C9\u71D4"+
"\u71CE\u71E0\u71EC\u71E7\u71F5\u71FC\u71F9\u71FF"+
"\u720D\u7210\u721B\u7228\u722D\u722C\u7230\u7232"+
"\u723B\u723C\u723F\u7240\u7246\u724B\u7258\u7274"+
"\u727E\u7282\u7281\u7287\u7292\u7296\u72A2\u72A7"+
"\u72B9\u72B2\u72C3\u72C6\u72C4\u72CE\u72D2\u72E2"+
"\u72E0\u72E1\u72F9\u72F7\u500F\u7317\u730A\u731C"+
"\u7316\u731D\u7334\u732F\u7329\u7325\u733E\u734E"+
"\u734F\u9ED8\u7357\u736A\u7368\u7370\u7378\u7375"+
"\u737B\u737A\u73C8\u73B3\u73CE\u73BB\u73C0\u73E5"+
"\u73EE\u73DE\u74A2\u7405\u746F\u7425\u73F8\u7432"+
"\u743A\u7455\u743F\u745F\u7459\u7441\u745C\u7469"+
"\u7470\u7463\u746A\u7476\u747E\u748B\u749E\u74A7"+
"\u74CA\u74CF\u74D4\u73F1\u74E0\u74E3\u74E7\u74E9"+
"\u74EE\u74F2\u74F0\u74F1\u74F8\u74F7\u7504\u7503"+
"\u7505\u750C\u750E\u750D\u7515\u7513\u751E\u7526"+
"\u752C\u753C\u7544\u754D\u754A\u7549\u755B\u7546"+
"\u755A\u7569\u7564\u7567\u756B\u756D\u7578\u7576"+
"\u7586\u7587\u7574\u758A\u7589\u7582\u7594\u759A"+
"\u759D\u75A5\u75A3\u75C2\u75B3\u75C3\u75B5\u75BD"+
"\u75B8\u75BC\u75B1\u75CD\u75CA\u75D2\u75D9\u75E3"+
"\u75DE\u75FE\u75FF\u75FC\u7601\u75F0\u75FA\u75F2"+
"\u75F3\u760B\u760D\u7609\u761F\u7627\u7620\u7621"+
"\u7622\u7624\u7634\u7630\u763B\u7647\u7648\u7646"+
"\u765C\u7658\u7661\u7662\u7668\u7669\u766A\u7667"+
"\u766C\u7670\u7672\u7676\u7678\u767C\u7680\u7683"+
"\u7688\u768B\u768E\u7696\u7693\u7699\u769A\u76B0"+
"\u76B4\u76B8\u76B9\u76BA\u76C2\u76CD\u76D6\u76D2"+
"\u76DE\u76E1\u76E5\u76E7\u76EA\u862F\u76FB\u7708"+
"\u7707\u7704\u7729\u7724\u771E\u7725\u7726\u771B"+
"\u7737\u7738\u7747\u775A\u7768\u776B\u775B\u7765"+
"\u777F\u777E\u7779\u778E\u778B\u7791\u77A0\u779E"+
"\u77B0\u77B6\u77B9\u77BF\u77BC\u77BD\u77BB\u77C7"+
"\u77CD\u77D7\u77DA\u77DC\u77E3\u77EE\u77FC\u780C"+
"\u7812\u7926\u7820\u792A\u7845\u788E\u7874\u7886"+
"\u787C\u789A\u788C\u78A3\u78B5\u78AA\u78AF\u78D1"+
"\u78C6\u78CB\u78D4\u78BE\u78BC\u78C5\u78CA\u78EC"+
"\u78E7\u78DA\u78FD\u78F4\u7907\u7912\u7911\u7919"+
"\u792C\u792B\u7940\u7960\u7957\u795F\u795A\u7955"+
"\u7953\u797A\u797F\u798A\u799D\u79A7\u9F4B\u79AA"+
"\u79AE\u79B3\u79B9\u79BA\u79C9\u79D5\u79E7\u79EC"+
"\u79E1\u79E3\u7A08\u7A0D\u7A18\u7A19\u7A20\u7A1F"+
"\u7980\u7A31\u7A3B\u7A3E\u7A37\u7A43\u7A57\u7A49"+
"\u7A61\u7A62\u7A69\u9F9D\u7A70\u7A79\u7A7D\u7A88"+
"\u7A97\u7A95\u7A98\u7A96\u7AA9\u7AC8\u7AB0\u7AB6"+
"\u7AC5\u7AC4\u7ABF\u9083\u7AC7\u7ACA\u7ACD\u7ACF"+
"\u7AD5\u7AD3\u7AD9\u7ADA\u7ADD\u7AE1\u7AE2\u7AE6"+
"\u7AED\u7AF0\u7B02\u7B0F\u7B0A\u7B06\u7B33\u7B18"+
"\u7B19\u7B1E\u7B35\u7B28\u7B36\u7B50\u7B7A\u7B04"+
"\u7B4D\u7B0B\u7B4C\u7B45\u7B75\u7B65\u7B74\u7B67"+
"\u7B70\u7B71\u7B6C\u7B6E\u7B9D\u7B98\u7B9F\u7B8D"+
"\u7B9C\u7B9A\u7B8B\u7B92\u7B8F\u7B5D\u7B99\u7BCB"+
"\u7BC1\u7BCC\u7BCF\u7BB4\u7BC6\u7BDD\u7BE9\u7C11"+
"\u7C14\u7BE6\u7BE5\u7C60\u7C00\u7C07\u7C13\u7BF3"+
"\u7BF7\u7C17\u7C0D\u7BF6\u7C23\u7C27\u7C2A\u7C1F"+
"\u7C37\u7C2B\u7C3D\u7C4C\u7C43\u7C54\u7C4F\u7C40"+
"\u7C50\u7C58\u7C5F\u7C64\u7C56\u7C65\u7C6C\u7C75"+
"\u7C83\u7C90\u7CA4\u7CAD\u7CA2\u7CAB\u7CA1\u7CA8"+
"\u7CB3\u7CB2\u7CB1\u7CAE\u7CB9\u7CBD\u7CC0\u7CC5"+
"\u7CC2\u7CD8\u7CD2\u7CDC\u7CE2\u9B3B\u7CEF\u7CF2"+
"\u7CF4\u7CF6\u7CFA\u7D06\u7D02\u7D1C\u7D15\u7D0A"+
"\u7D45\u7D4B\u7D2E\u7D32\u7D3F\u7D35\u7D46\u7D73"+
"\u7D56\u7D4E\u7D72\u7D68\u7D6E\u7D4F\u7D63\u7D93"+
"\u7D89\u7D5B\u7D8F\u7D7D\u7D9B\u7DBA\u7DAE\u7DA3"+
"\u7DB5\u7DC7\u7DBD\u7DAB\u7E3D\u7DA2\u7DAF\u7DDC"+
"\u7DB8\u7D9F\u7DB0\u7DD8\u7DDD\u7DE4\u7DDE\u7DFB"+
"\u7DF2\u7DE1\u7E05\u7E0A\u7E23\u7E21\u7E12\u7E31"+
"\u7E1F\u7E09\u7E0B\u7E22\u7E46\u7E66\u7E3B\u7E35"+
"\u7E39\u7E43\u7E37\u7E32\u7E3A\u7E67\u7E5D\u7E56"+
"\u7E5E\u7E59\u7E5A\u7E79\u7E6A\u7E69\u7E7C\u7E7B"+
"\u7E83\u7DD5\u7E7D\u8FAE\u7E7F\u7E88\u7E89\u7E8C"+
"\u7E92\u7E90\u7E93\u7E94\u7E96\u7E8E\u7E9B\u7E9C"+
"\u7F38\u7F3A\u7F45\u7F4C\u7F4D\u7F4E\u7F50\u7F51"+
"\u7F55\u7F54\u7F58\u7F5F\u7F60\u7F68\u7F69\u7F67"+
"\u7F78\u7F82\u7F86\u7F83\u7F88\u7F87\u7F8C\u7F94"+
"\u7F9E\u7F9D\u7F9A\u7FA3\u7FAF\u7FB2\u7FB9\u7FAE"+
"\u7FB6\u7FB8\u8B71\u7FC5\u7FC6\u7FCA\u7FD5\u7FD4"+
"\u7FE1\u7FE6\u7FE9\u7FF3\u7FF9\u98DC\u8006\u8004"+
"\u800B\u8012\u8018\u8019\u801C\u8021\u8028\u803F"+
"\u803B\u804A\u8046\u8052\u8058\u805A\u805F\u8062"+
"\u8068\u8073\u8072\u8070\u8076\u8079\u807D\u807F"+
"\u8084\u8086\u8085\u809B\u8093\u809A\u80AD\u5190"+
"\u80AC\u80DB\u80E5\u80D9\u80DD\u80C4\u80DA\u80D6"+
"\u8109\u80EF\u80F1\u811B\u8129\u8123\u812F\u814B";
private final static String innerIndex4=
"\u968B\u8146\u813E\u8153\u8151\u80FC\u8171\u816E"+
"\u8165\u8166\u8174\u8183\u8188\u818A\u8180\u8182"+
"\u81A0\u8195\u81A4\u81A3\u815F\u8193\u81A9\u81B0"+
"\u81B5\u81BE\u81B8\u81BD\u81C0\u81C2\u81BA\u81C9"+
"\u81CD\u81D1\u81D9\u81D8\u81C8\u81DA\u81DF\u81E0"+
"\u81E7\u81FA\u81FB\u81FE\u8201\u8202\u8205\u8207"+
"\u820A\u820D\u8210\u8216\u8229\u822B\u8238\u8233"+
"\u8240\u8259\u8258\u825D\u825A\u825F\u8264\u8262"+
"\u8268\u826A\u826B\u822E\u8271\u8277\u8278\u827E"+
"\u828D\u8292\u82AB\u829F\u82BB\u82AC\u82E1\u82E3"+
"\u82DF\u82D2\u82F4\u82F3\u82FA\u8393\u8303\u82FB"+
"\u82F9\u82DE\u8306\u82DC\u8309\u82D9\u8335\u8334"+
"\u8316\u8332\u8331\u8340\u8339\u8350\u8345\u832F"+
"\u832B\u8317\u8318\u8385\u839A\u83AA\u839F\u83A2"+
"\u8396\u8323\u838E\u8387\u838A\u837C\u83B5\u8373"+
"\u8375\u83A0\u8389\u83A8\u83F4\u8413\u83EB\u83CE"+
"\u83FD\u8403\u83D8\u840B\u83C1\u83F7\u8407\u83E0"+
"\u83F2\u840D\u8422\u8420\u83BD\u8438\u8506\u83FB"+
"\u846D\u842A\u843C\u855A\u8484\u8477\u846B\u84AD"+
"\u846E\u8482\u8469\u8446\u842C\u846F\u8479\u8435"+
"\u84CA\u8462\u84B9\u84BF\u849F\u84D9\u84CD\u84BB"+
"\u84DA\u84D0\u84C1\u84C6\u84D6\u84A1\u8521\u84FF"+
"\u84F4\u8517\u8518\u852C\u851F\u8515\u8514\u84FC"+
"\u8540\u8563\u8558\u8548\u8541\u8602\u854B\u8555"+
"\u8580\u85A4\u8588\u8591\u858A\u85A8\u856D\u8594"+
"\u859B\u85EA\u8587\u859C\u8577\u857E\u8590\u85C9"+
"\u85BA\u85CF\u85B9\u85D0\u85D5\u85DD\u85E5\u85DC"+
"\u85F9\u860A\u8613\u860B\u85FE\u85FA\u8606\u8622"+
"\u861A\u8630\u863F\u864D\u4E55\u8654\u865F\u8667"+
"\u8671\u8693\u86A3\u86A9\u86AA\u868B\u868C\u86B6"+
"\u86AF\u86C4\u86C6\u86B0\u86C9\u8823\u86AB\u86D4"+
"\u86DE\u86E9\u86EC\u86DF\u86DB\u86EF\u8712\u8706"+
"\u8708\u8700\u8703\u86FB\u8711\u8709\u870D\u86F9"+
"\u870A\u8734\u873F\u8737\u873B\u8725\u8729\u871A"+
"\u8760\u875F\u8778\u874C\u874E\u8774\u8757\u8768"+
"\u876E\u8759\u8753\u8763\u876A\u8805\u87A2\u879F"+
"\u8782\u87AF\u87CB\u87BD\u87C0\u87D0\u96D6\u87AB"+
"\u87C4\u87B3\u87C7\u87C6\u87BB\u87EF\u87F2\u87E0"+
"\u880F\u880D\u87FE\u87F6\u87F7\u880E\u87D2\u8811"+
"\u8816\u8815\u8822\u8821\u8831\u8836\u8839\u8827"+
"\u883B\u8844\u8842\u8852\u8859\u885E\u8862\u886B"+
"\u8881\u887E\u889E\u8875\u887D\u88B5\u8872\u8882"+
"\u8897\u8892\u88AE\u8899\u88A2\u888D\u88A4\u88B0"+
"\u88BF\u88B1\u88C3\u88C4\u88D4\u88D8\u88D9\u88DD"+
"\u88F9\u8902\u88FC\u88F4\u88E8\u88F2\u8904\u890C"+
"\u890A\u8913\u8943\u891E\u8925\u892A\u892B\u8941"+
"\u8944\u893B\u8936\u8938\u894C\u891D\u8960\u895E"+
"\u8966\u8964\u896D\u896A\u896F\u8974\u8977\u897E"+
"\u8983\u8988\u898A\u8993\u8998\u89A1\u89A9\u89A6"+
"\u89AC\u89AF\u89B2\u89BA\u89BD\u89BF\u89C0\u89DA"+
"\u89DC\u89DD\u89E7\u89F4\u89F8\u8A03\u8A16\u8A10"+
"\u8A0C\u8A1B\u8A1D\u8A25\u8A36\u8A41\u8A5B\u8A52"+
"\u8A46\u8A48\u8A7C\u8A6D\u8A6C\u8A62\u8A85\u8A82"+
"\u8A84\u8AA8\u8AA1\u8A91\u8AA5\u8AA6\u8A9A\u8AA3"+
"\u8AC4\u8ACD\u8AC2\u8ADA\u8AEB\u8AF3\u8AE7\u8AE4"+
"\u8AF1\u8B14\u8AE0\u8AE2\u8AF7\u8ADE\u8ADB\u8B0C"+
"\u8B07\u8B1A\u8AE1\u8B16\u8B10\u8B17\u8B20\u8B33"+
"\u97AB\u8B26\u8B2B\u8B3E\u8B28\u8B41\u8B4C\u8B4F"+
"\u8B4E\u8B49\u8B56\u8B5B\u8B5A\u8B6B\u8B5F\u8B6C"+
"\u8B6F\u8B74\u8B7D\u8B80\u8B8C\u8B8E\u8B92\u8B93"+
"\u8B96\u8B99\u8B9A\u8C3A\u8C41\u8C3F\u8C48\u8C4C"+
"\u8C4E\u8C50\u8C55\u8C62\u8C6C\u8C78\u8C7A\u8C82"+
"\u8C89\u8C85\u8C8A\u8C8D\u8C8E\u8C94\u8C7C\u8C98"+
"\u621D\u8CAD\u8CAA\u8CBD\u8CB2\u8CB3\u8CAE\u8CB6"+
"\u8CC8\u8CC1\u8CE4\u8CE3\u8CDA\u8CFD\u8CFA\u8CFB"+
"\u8D04\u8D05\u8D0A\u8D07\u8D0F\u8D0D\u8D10\u9F4E"+
"\u8D13\u8CCD\u8D14\u8D16\u8D67\u8D6D\u8D71\u8D73"+
"\u8D81\u8D99\u8DC2\u8DBE\u8DBA\u8DCF\u8DDA\u8DD6"+
"\u8DCC\u8DDB\u8DCB\u8DEA\u8DEB\u8DDF\u8DE3\u8DFC"+
"\u8E08\u8E09\u8DFF\u8E1D\u8E1E\u8E10\u8E1F\u8E42"+
"\u8E35\u8E30\u8E34\u8E4A\u8E47\u8E49\u8E4C\u8E50"+
"\u8E48\u8E59\u8E64\u8E60\u8E2A\u8E63\u8E55\u8E76"+
"\u8E72\u8E7C\u8E81\u8E87\u8E85\u8E84\u8E8B\u8E8A"+
"\u8E93\u8E91\u8E94\u8E99\u8EAA\u8EA1\u8EAC\u8EB0"+
"\u8EC6\u8EB1\u8EBE\u8EC5\u8EC8\u8ECB\u8EDB\u8EE3"+
"\u8EFC\u8EFB\u8EEB\u8EFE\u8F0A\u8F05\u8F15\u8F12"+
"\u8F19\u8F13\u8F1C\u8F1F\u8F1B\u8F0C\u8F26\u8F33"+
"\u8F3B\u8F39\u8F45\u8F42\u8F3E\u8F4C\u8F49\u8F46"+
"\u8F4E\u8F57\u8F5C\u8F62\u8F63\u8F64\u8F9C\u8F9F"+
"\u8FA3\u8FAD\u8FAF\u8FB7\u8FDA\u8FE5\u8FE2\u8FEA"+
"\u8FEF\u9087\u8FF4\u9005\u8FF9\u8FFA\u9011\u9015"+
"\u9021\u900D\u901E\u9016\u900B\u9027\u9036\u9035"+
"\u9039\u8FF8\u904F\u9050\u9051\u9052\u900E\u9049"+
"\u903E\u9056\u9058\u905E\u9068\u906F\u9076\u96A8"+
"\u9072\u9082\u907D\u9081\u9080\u908A\u9089\u908F"+
"\u90A8\u90AF\u90B1\u90B5\u90E2\u90E4\u6248\u90DB"+
"\u9102\u9112\u9119\u9132\u9130\u914A\u9156\u9158"+
"\u9163\u9165\u9169\u9173\u9172\u918B\u9189\u9182"+
"\u91A2\u91AB\u91AF\u91AA\u91B5\u91B4\u91BA\u91C0"+
"\u91C1\u91C9\u91CB\u91D0\u91D6\u91DF\u91E1\u91DB"+
"\u91FC\u91F5\u91F6\u921E\u91FF\u9214\u922C\u9215"+
"\u9211\u925E\u9257\u9245\u9249\u9264\u9248\u9295"+
"\u923F\u924B\u9250\u929C\u9296\u9293\u929B\u925A"+
"\u92CF\u92B9\u92B7\u92E9\u930F\u92FA\u9344\u932E"+
"\u9319\u9322\u931A\u9323\u933A\u9335\u933B\u935C"+
"\u9360\u937C\u936E\u9356\u93B0\u93AC\u93AD\u9394"+
"\u93B9\u93D6\u93D7\u93E8\u93E5\u93D8\u93C3\u93DD"+
"\u93D0\u93C8\u93E4\u941A\u9414\u9413\u9403\u9407"+
"\u9410\u9436\u942B\u9435\u9421\u943A\u9441\u9452"+
"\u9444\u945B\u9460\u9462\u945E\u946A\u9229\u9470"+
"\u9475\u9477\u947D\u945A\u947C\u947E\u9481\u947F"+
"\u9582\u9587\u958A\u9594\u9596\u9598\u9599\u95A0"+
"\u95A8\u95A7\u95AD\u95BC\u95BB\u95B9\u95BE\u95CA"+
"\u6FF6\u95C3\u95CD\u95CC\u95D5\u95D4\u95D6\u95DC"+
"\u95E1\u95E5\u95E2\u9621\u9628\u962E\u962F\u9642"+
"\u964C\u964F\u964B\u9677\u965C\u965E\u965D\u965F"+
"\u9666\u9672\u966C\u968D\u9698\u9695\u9697\u96AA"+
"\u96A7\u96B1\u96B2\u96B0\u96B4\u96B6\u96B8\u96B9"+
"\u96CE\u96CB\u96C9\u96CD\u894D\u96DC\u970D\u96D5"+
"\u96F9\u9704\u9706\u9708\u9713\u970E\u9711\u970F"+
"\u9716\u9719\u9724\u972A\u9730\u9739\u973D\u973E"+
"\u9744\u9746\u9748\u9742\u9749\u975C\u9760\u9764"+
"\u9766\u9768\u52D2\u976B\u9771\u9779\u9785\u977C"+
"\u9781\u977A\u9786\u978B\u978F\u9790\u979C\u97A8"+
"\u97A6\u97A3\u97B3\u97B4\u97C3\u97C6\u97C8\u97CB"+
"\u97DC\u97ED\u9F4F\u97F2\u7ADF\u97F6\u97F5\u980F"+
"\u980C\u9838\u9824\u9821\u9837\u983D\u9846\u984F"+
"\u984B\u986B\u986F\u9870\u9871\u9874\u9873\u98AA"+
"\u98AF\u98B1\u98B6\u98C4\u98C3\u98C6\u98E9\u98EB"+
"\u9903\u9909\u9912\u9914\u9918\u9921\u991D\u991E"+
"\u9924\u9920\u992C\u992E\u993D\u993E\u9942\u9949"+
"\u9945\u9950\u994B\u9951\u9952\u994C\u9955\u9997"+
"\u9998\u99A5\u99AD\u99AE\u99BC\u99DF\u99DB\u99DD"+
"\u99D8\u99D1\u99ED\u99EE\u99F1\u99F2\u99FB\u99F8"+
"\u9A01\u9A0F\u9A05\u99E2\u9A19\u9A2B\u9A37\u9A45"+
"\u9A42\u9A40\u9A43\u9A3E\u9A55\u9A4D\u9A5B\u9A57"+
"\u9A5F\u9A62\u9A65\u9A64\u9A69\u9A6B\u9A6A\u9AAD"+
"\u9AB0\u9ABC\u9AC0\u9ACF\u9AD1\u9AD3\u9AD4\u9ADE"+
"\u9ADF\u9AE2\u9AE3\u9AE6\u9AEF\u9AEB\u9AEE\u9AF4"+
"\u9AF1\u9AF7\u9AFB\u9B06\u9B18\u9B1A\u9B1F\u9B22"+
"\u9B23\u9B25\u9B27\u9B28\u9B29\u9B2A\u9B2E\u9B2F"+
"\u9B32\u9B44\u9B43\u9B4F\u9B4D\u9B4E\u9B51\u9B58"+
"\u9B74\u9B93\u9B83\u9B91\u9B96\u9B97\u9B9F\u9BA0"+
"\u9BA8\u9BB4\u9BC0\u9BCA\u9BB9\u9BC6\u9BCF\u9BD1"+
"\u9BD2\u9BE3\u9BE2\u9BE4\u9BD4\u9BE1\u9C3A\u9BF2"+
"\u9BF1\u9BF0\u9C15\u9C14\u9C09\u9C13\u9C0C\u9C06"+
"\u9C08\u9C12\u9C0A\u9C04\u9C2E\u9C1B\u9C25\u9C24"+
"\u9C21\u9C30\u9C47\u9C32\u9C46\u9C3E\u9C5A\u9C60"+
"\u9C67\u9C76\u9C78\u9CE7\u9CEC\u9CF0\u9D09\u9D08"+
"\u9CEB\u9D03\u9D06\u9D2A\u9D26\u9DAF\u9D23\u9D1F"+
"\u9D44\u9D15\u9D12\u9D41\u9D3F\u9D3E\u9D46\u9D48"+
"\u9D5D\u9D5E\u9D64\u9D51\u9D50\u9D59\u9D72\u9D89"+
"\u9D87\u9DAB\u9D6F\u9D7A\u9D9A\u9DA4\u9DA9\u9DB2"+
"\u9DC4\u9DC1\u9DBB\u9DB8\u9DBA\u9DC6\u9DCF\u9DC2"+
"\u9DD9\u9DD3\u9DF8\u9DE6\u9DED\u9DEF\u9DFD\u9E1A"+
"\u9E1B\u9E1E\u9E75\u9E79\u9E7D\u9E81\u9E88\u9E8B"+
"\u9E8C\u9E92\u9E95\u9E91\u9E9D\u9EA5\u9EA9\u9EB8"+
"\u9EAA\u9EAD\u9761\u9ECC\u9ECE\u9ECF\u9ED0\u9ED4"+
"\u9EDC\u9EDE\u9EDD\u9EE0\u9EE5\u9EE8\u9EEF\u9EF4"+
"\u9EF6\u9EF7\u9EF9\u9EFB\u9EFC\u9EFD\u9F07\u9F08"+
"\u76B7\u9F15\u9F21\u9F2C\u9F3E\u9F4A\u9F52\u9F54"+
"\u9F63\u9F5F\u9F60\u9F61\u9F66\u9F67\u9F6C\u9F6A"+
"\u9F77\u9F72\u9F76\u9F95\u9F9C\u9FA0\u582F\u69C7"+
"\u9059\u7464\u51DC\u7199\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD"+
"\uFFFD\uFFFD\uFFFD\uFFFD";
private final static short index1[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0, 0, 0, 0,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
73, 74, 75, 76, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
private final static String index2[] = {
innerIndex0,
innerIndex1,
innerIndex2,
innerIndex3,
innerIndex4
};
protected char convSingleByte(int b) {
return REPLACE_CHAR;
}
/**
* These accessors are temporarily supplied while sun.io
* converters co-exist with the sun.nio.cs.{ext} charset coders
* These facilitate sharing of conversion tables between the
* two co-existing implementations. When sun.io converters
* are made extinct these will be unncessary and should be removed
*/
public static short[] getIndex1() {
return index1;
}
public static String[] getIndex2() {
return index2;
}
}
| 57.456778 | 76 | 0.66241 |
cc17fa66114831a9cff9b043d53481a80b04928f | 2,087 | package org.tron.core.services.http;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.tron.api.GrpcAPI;
import org.tron.api.GrpcAPI.OvkDecryptParameters;
import org.tron.common.utils.ByteArray;
import org.tron.core.Wallet;
@Component
@Slf4j(topic = "API")
public class ScanNoteByOvkServlet extends RateLimiterServlet {
@Autowired
private Wallet wallet;
protected void doPost(HttpServletRequest request, HttpServletResponse response) {
try {
String input = request.getReader().lines()
.collect(Collectors.joining(System.lineSeparator()));
Util.checkBodySize(input);
boolean visible = Util.getVisiblePost(input);
OvkDecryptParameters.Builder ovkDecryptParameters = OvkDecryptParameters.newBuilder();
JsonFormat.merge(input, ovkDecryptParameters);
GrpcAPI.DecryptNotes notes = wallet
.scanNoteByOvk(ovkDecryptParameters.getStartBlockIndex(),
ovkDecryptParameters.getEndBlockIndex(),
ovkDecryptParameters.getOvk().toByteArray());
response.getWriter().println(ScanNoteByIvkServlet.convertOutput(notes, visible));
} catch (Exception e) {
Util.processError(e, response);
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) {
try {
boolean visible = Util.getVisible(request);
long startBlockIndex = Long.parseLong(request.getParameter("start_block_index"));
long endBlockIndex = Long.parseLong(request.getParameter("end_block_index"));
String ovk = request.getParameter("ovk");
GrpcAPI.DecryptNotes notes = wallet
.scanNoteByOvk(startBlockIndex, endBlockIndex, ByteArray.fromHexString(ovk));
response.getWriter().println(ScanNoteByIvkServlet.convertOutput(notes, visible));
} catch (Exception e) {
Util.processError(e, response);
}
}
}
| 37.945455 | 92 | 0.747005 |
f4a522bc65d11c292bd60e4ff3a0fdf5ac516874 | 6,100 | /*
* Copyright 2008, Unitils.org
* 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.unitils.core.util;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import org.junit.Test;
import org.unitils.UnitilsJUnit4;
import org.unitils.core.UnitilsException;
import org.unitils.inject.annotation.TestedObject;
import org.unitils.thirdparty.org.apache.commons.io.FileUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowableOfType;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* @author Fabian Krueger
* Test for {@link PropertiesReader}
*/
public class PropertiesReaderTest
extends UnitilsJUnit4 {
/**
* System under Test
*/
@TestedObject
private PropertiesReader sut = new PropertiesReader();
private static final String TEST_FILE = "propertiesReaderTest.properties";
@Test
public void loadPropertiesFileFromUserHome_withNullArgument_shouldThrowUnitilsException() {
String configurationFile = null;
String expectedMessage = "Unable to load configuration file: " + configurationFile + " from user home";
try {
sut.loadPropertiesFileFromUserHome(configurationFile);
fail("UnitilsExcepton expected");
} catch (UnitilsException ue) {
assertEquals(expectedMessage, ue.getMessage());
}
}
@Test
public void loadPropertiesFileFromUserHome_withEmptyStringFile_shouldThrowUnitilsException() {
String configurationFile = "";
String expectedMessage = "Unable to load configuration file: " + configurationFile + " from user home";
try {
sut.loadPropertiesFileFromUserHome(configurationFile);
fail("UnitilsExcepton expected");
} catch (UnitilsException ue) {
assertEquals(expectedMessage, ue.getMessage());
}
}
@Test
public void loadPropertiesFileFromUserHome_withMissingFile_shouldReturnNull() {
String configurationFile = "nofilefound.foo";
Properties returnedProperties = sut.loadPropertiesFileFromUserHome(configurationFile);
assertNull(returnedProperties);
}
@Test
public void loadPropertiesFileFromUserHome_withExistingFile_shouldReturnProperties()
throws IOException {
copyDummyPropertiesFileToUserHome();
Properties returnedProperties = sut.loadPropertiesFileFromUserHome(TEST_FILE);
assertNotNull(returnedProperties);
assertEquals("some value", returnedProperties.getProperty("testprop"));
deleteDummyPropertiesFileFromUserHome();
}
// loadPropertiesFileFromClasspath
@Test
public void loadPropertiesFileFromClasspath_withNullArgument_shouldThrowUnitilsException() {
String configurationFile = null;
String expectedMessage = "Unable to load configuration file: " + configurationFile;
try {
sut.loadPropertiesFileFromClasspath(configurationFile);
fail("UnitilsExcepton expected");
} catch (UnitilsException ue) {
assertEquals(expectedMessage, ue.getMessage());
}
}
@Test
public void loadPropertiesFileFromClasspath_withEmptyStringFile_shouldThrowUnitilsException() {
String configurationFile = "";
String expectedMessage = "Unable to load configuration file: " + configurationFile;
UnitilsException exception = catchThrowableOfType(() -> sut.loadPropertiesFileFromClasspath(configurationFile), UnitilsException.class);
assertThat(exception).as("UnitilsExcepton expected").isNotNull();
assertThat(exception).hasMessage(expectedMessage);
}
@Test
public void loadPropertiesFileFromClasspath_withMissingFile_shouldReturnNull() {
String configurationFile = "nofilefound.foo";
Properties returnedProperties;
returnedProperties = sut.loadPropertiesFileFromClasspath(configurationFile);
assertNull(returnedProperties);
}
@Test
public void loadPropertiesFileFromClasspath_withExistingFile_shouldReturnProperties() {
Properties returnedProperties = sut.loadPropertiesFileFromClasspath(TEST_FILE);
assertNotNull(returnedProperties);
assertEquals("some value", returnedProperties.getProperty("testprop"));
}
// -----------------------------------------------------------------------------------
// Helper
// -----------------------------------------------------------------------------------
private void copyDummyPropertiesFileToUserHome()
throws IOException {
String userHome = System.getProperty("user.home");
String classPath = this.getClass().getClassLoader().getResource(".").getPath();
File fileToCopy = new File(classPath + "/" + TEST_FILE);
FileUtils.copyFileToDirectory(fileToCopy, new File(userHome));
File copiedFile = new File(userHome + "/" + TEST_FILE);
assertTrue("File " + TEST_FILE + " should be in user home.", copiedFile.exists());
}
private void deleteDummyPropertiesFileFromUserHome() {
String userHome = System.getProperty("user.home");
File targetFile = new File(userHome + "/" + TEST_FILE);
targetFile.delete();
assertFalse("File " + TEST_FILE + " should be deleted from user home.", targetFile.exists());
}
}
| 41.496599 | 144 | 0.702623 |
667fba0034a80bccfa1960cf07ac2e39df1a943a | 6,369 | package com.github.mygreen.sqlmapper.core.meta;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.NoSuchElementException;
import java.util.Optional;
import org.springframework.util.LinkedCaseInsensitiveMap;
import com.github.mygreen.sqlmapper.core.annotation.CreatedAt;
import com.github.mygreen.sqlmapper.core.annotation.CreatedBy;
import com.github.mygreen.sqlmapper.core.annotation.EmbeddedId;
import com.github.mygreen.sqlmapper.core.annotation.GeneratedValue;
import com.github.mygreen.sqlmapper.core.annotation.Id;
import com.github.mygreen.sqlmapper.core.annotation.Lob;
import com.github.mygreen.sqlmapper.core.annotation.Transient;
import com.github.mygreen.sqlmapper.core.annotation.UpdatedAt;
import com.github.mygreen.sqlmapper.core.annotation.UpdatedBy;
import com.github.mygreen.sqlmapper.core.annotation.Version;
import com.github.mygreen.sqlmapper.core.id.IdGenerationContext;
import com.github.mygreen.sqlmapper.core.id.IdGenerator;
import com.github.mygreen.sqlmapper.core.type.ValueType;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
/**
* プロパティのメタ情報です。
*
* @author T.TSUCHIE
* @version 0.3
*
*/
public class PropertyMeta extends PropertyBase {
/**
* 埋め込み型の主キーの子プロパティかどうか。
*/
@Setter
private boolean embeddedableId = false;
/**
* 埋め込みプロパティの情報
* <p>key=プロパティ名</p>
*/
private LinkedCaseInsensitiveMap<PropertyMeta> embeddedablePropertyMetaMap = new LinkedCaseInsensitiveMap<>();
/**
* 埋め込みのときの親のプロパティ情報
*/
private Optional<PropertyMeta> parent = Optional.empty();
/**
* カラムのメタ情報
*/
@Getter
@Setter
private ColumnMeta columnMeta;
/**
* 値の変換処理
*/
@Getter
@Setter
private ValueType<?> valueType;
/**
* IDの生成タイプ
*/
@Getter
private Optional<GeneratedValue.GenerationType> idGenerationType = Optional.empty();
/**
* IDの生成処理
*/
@Getter
private Optional<IdGenerator> idGenerator = Optional.empty();
/**
* 生成対象の識別子の情報。
* <p>ID生成時に渡す際の情報として使用するので、効率化のためにここで事前に作成して保持しておく。
*/
@Getter
private Optional<IdGenerationContext> idGenerationContext = Optional.empty();
/**
* プロパティのインスタンス情報を作成します。
* @param name プロパティ名
* @param propertyType プロパティのクラスタイプ
*/
public PropertyMeta(String name, Class<?> propertyType) {
super(name, propertyType);
}
/**
* カラム用のプロパティかどうか判定する。
* @return カラム情報を持つときtrueを返す。
*/
public boolean isColumn() {
return columnMeta != null;
}
/**
* 埋め込みプロパティ情報を追加する
* @param embeddedablePropertyMeta 埋め込みプロパティ
*/
public void addEmbeddedablePropertyMeta(@NonNull PropertyMeta embeddedablePropertyMeta) {
embeddedablePropertyMeta.parent = Optional.of(this);
// 親が埋め込み主キーの時
if(hasAnnotation(EmbeddedId.class) && !isTransient()) {
embeddedablePropertyMeta.embeddedableId = true;
}
this.embeddedablePropertyMetaMap.put(embeddedablePropertyMeta.getName(), embeddedablePropertyMeta);
}
/**
* 埋め込み用のクラスのプロパティかどか判定する。
* @return 埋め込み用のクラスのプロパティの場合trueを変す。
*/
public boolean hasParent() {
return parent.isPresent();
}
/**
* 埋め込み用のクラスのプロパティの親情報を取得する。
* @return 親情のプロパティ情報
* @throws NoSuchElementException 親が存在しないときにスローされます。
*/
public PropertyMeta getParent() {
return parent.get();
}
/**
* 埋め込みプロパティの一覧を取得する。
* @return
*/
public Collection<PropertyMeta> getEmbeddedablePopertyMetaList() {
return embeddedablePropertyMetaMap.values();
}
/**
* 主キーかどうか判定する。
* <p>アノテーション {@link Id}を付与されているかどうかで判定する。</p>
* <p>また、親が{@link EmbeddedId} を付与された埋め込みIDの場合は、子も主キーとなるためtrueを返す。</p>
*
* @return 主キーの場合は {@literal true} を返す。
*/
public boolean isId() {
return hasAnnotation(Id.class) || embeddedableId;
}
/**
* 埋め込み用のプロパティかどうか判定する。
* <p>埋め込みプロパティの子の場合は、falseを返す。
* @return 埋め込みの場合trueを返す。
*/
public boolean isEmbedded() {
return hasAnnotation(EmbeddedId.class);
}
/**
* 識別子の生成タイプを設定する。
* @param generationType IDの生成タイプ
*/
public void setIdGeneratonType(GeneratedValue.GenerationType generationType) {
this.idGenerationType = Optional.ofNullable(generationType);
}
/**
* 識別子の生成処理を設定する。
* @param idGenerator 識別子の生成処理。
*/
public void setIdGenerator(IdGenerator idGenerator) {
this.idGenerator = Optional.ofNullable(idGenerator);
}
/**
* 生成対象の識別子の情報を設定する。
* @param idGenerationContext 生成対象の識別子の情報
*/
public void setIdGenerationContext(IdGenerationContext idGenerationContext) {
this.idGenerationContext = Optional.ofNullable(idGenerationContext);
}
/**
* 永続化対象外かどうか判定する。
* <p>永続化対象外とは、アノテーション {@link Transient}が付与されているか、
* または、フィールドに修飾子 {@literal transient} が付与されているかどうかで判定します。
* @return 永続化対象外のとき {@literal true} を返す。
*/
public boolean isTransient() {
return hasAnnotation(Transient.class)
|| field.map(f -> Modifier.isTransient(f.getModifiers())).orElse(false);
}
/**
* バージョンキーかどうか判定する。
* @return バージョンキーのとき {@literal true} を返す。
*/
public boolean isVersion() {
return hasAnnotation(Version.class);
}
/**
* SQLのカラムがLOB(CLOB/BLOC)かどうか判定する。
* <p>アノテーション {@link Lob} が付与されているかで判定する。</p>
* @return LOBの場合はtrueを返す。
*/
public boolean isLob() {
return hasAnnotation(Lob.class);
}
/**
* 作成日時用のプロパティがかどうか判定する。
* @return 作成日時用のプロパティのとき {@literal true} を返す。
*/
public boolean isCreatedAt() {
return hasAnnotation(CreatedAt.class);
}
/**
* 作成者用のプロパティがかどうか判定する。
* @return 作成者用のプロパティのとき {@literal true} を返す。
*/
public boolean isCreatedBy() {
return hasAnnotation(CreatedBy.class);
}
/**
* 修正日時用のプロパティがかどうか判定する。
* @return 修正日時用のプロパティのとき {@literal true} を返す。
*/
public boolean isUpdatedAt() {
return hasAnnotation(UpdatedAt.class);
}
/**
* 修正者用のプロパティがかどうか判定する。
* @return 修正者用のプロパティのとき {@literal true} を返す。
*/
public boolean isUpdatedBy() {
return hasAnnotation(UpdatedBy.class);
}
}
| 25.173913 | 114 | 0.661014 |
c9bb837d0d796595e825c7b922f4c92c57e03e5d | 7,724 | /*****************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
****************************************************************/
package org.apache.cayenne.enhancer;
import org.apache.cayenne.ObjectContext;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodAdapter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
/**
* @since 3.0
*/
public class SetterVisitor extends MethodAdapter {
private EnhancementHelper helper;
private String propertyName;
private Type propertyType;
public SetterVisitor(MethodVisitor mv, EnhancementHelper helper, String propertyName,
Type propertyType) {
super(mv);
this.helper = helper;
this.propertyName = propertyName;
this.propertyType = propertyType;
}
@Override
public void visitCode() {
super.visitCode();
String field = helper.getPropertyField("objectContext");
Type objectContextType = Type.getType(ObjectContext.class);
String propertyDescriptor = propertyType.getDescriptor();
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitFieldInsn(
Opcodes.GETFIELD,
helper.getCurrentClass().getInternalName(),
field,
objectContextType.getDescriptor());
Label l1 = new Label();
mv.visitJumpInsn(Opcodes.IFNULL, l1);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitFieldInsn(
Opcodes.GETFIELD,
helper.getCurrentClass().getInternalName(),
field,
objectContextType.getDescriptor());
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitLdcInsn(propertyName);
mv.visitVarInsn(Opcodes.ALOAD, 0);
mv.visitFieldInsn(
Opcodes.GETFIELD,
helper.getCurrentClass().getInternalName(),
propertyName,
propertyDescriptor);
if (!visitPrimitiveConversion(propertyDescriptor)) {
mv.visitVarInsn(Opcodes.ALOAD, 1);
}
mv
.visitMethodInsn(
Opcodes.INVOKEINTERFACE,
objectContextType.getInternalName(),
"propertyChanged",
"(Lorg/apache/cayenne/Persistent;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V");
mv.visitLabel(l1);
}
protected boolean visitPrimitiveConversion(String propertyDescriptor) {
if (propertyDescriptor.length() != 1) {
return false;
}
switch (propertyDescriptor.charAt(0)) {
case 'I':
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Integer",
"valueOf",
"(I)Ljava/lang/Integer;");
mv.visitVarInsn(Opcodes.ILOAD, 1);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Integer",
"valueOf",
"(I)Ljava/lang/Integer;");
return true;
case 'D':
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Double",
"valueOf",
"(D)Ljava/lang/Double;");
mv.visitVarInsn(Opcodes.DLOAD, 1);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Double",
"valueOf",
"(D)Ljava/lang/Double;");
return true;
case 'F':
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Float",
"valueOf",
"(F)Ljava/lang/Float;");
mv.visitVarInsn(Opcodes.FLOAD, 1);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Float",
"valueOf",
"(F)Ljava/lang/Float;");
return true;
case 'Z':
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Boolean",
"valueOf",
"(Z)Ljava/lang/Boolean;");
mv.visitVarInsn(Opcodes.ILOAD, 1);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Boolean",
"valueOf",
"(Z)Ljava/lang/Boolean;");
return true;
case 'J':
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Long",
"valueOf",
"(J)Ljava/lang/Long;");
mv.visitVarInsn(Opcodes.LLOAD, 1);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Long",
"valueOf",
"(J)Ljava/lang/Long;");
return true;
case 'B':
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Byte",
"valueOf",
"(B)Ljava/lang/Byte;");
mv.visitVarInsn(Opcodes.ILOAD, 1);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Byte",
"valueOf",
"(B)Ljava/lang/Byte;");
return true;
case 'C':
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Character",
"valueOf",
"(C)Ljava/lang/Character;");
mv.visitVarInsn(Opcodes.ILOAD, 1);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Character",
"valueOf",
"(C)Ljava/lang/Character;");
return true;
case 'S':
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Short",
"valueOf",
"(S)Ljava/lang/Short;");
mv.visitVarInsn(Opcodes.ILOAD, 1);
mv.visitMethodInsn(
Opcodes.INVOKESTATIC,
"java/lang/Short",
"valueOf",
"(S)Ljava/lang/Short;");
return true;
default:
return false;
}
}
}
| 37.678049 | 116 | 0.476437 |
0c09cc9b8f4a32e52a69d1438f74a027374c93d8 | 9,561 | /*
* Copyright 2014 Red Hat, Inc. and/or its affiliates.
*
* 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.dashbuilder.dataprovider.backend.elasticsearch;
import org.dashbuilder.dataset.*;
import org.dashbuilder.dataset.sort.SortOrder;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* <p>Data test for ElasticSearchDataSet column definitions.</p>
*
* <p>Test dataset: <code>org/dashbuilder/dataprovider/backend/elasticsearch/expensereports.dset</code></p>
* <ul>
* <li>Uses column provided from EL index mapping (allColumns flag is set to true)</li>
* </ul>
*
* <p>Test dataset: <code>org/dashbuilder/dataprovider/backend/elasticsearch/expensereports-custom-columns.dset</code></p>
* <ul>
* <li>Modify column type for city column as TEXT (not as LABEL, by default, allColumns flag is set to true)</li>
* </ul>
*
* <p>Test dataset: <code>org/dashbuilder/dataprovider/backend/elasticsearch/expensereports-custom-columns2.dset</code></p>
* <ul>
* <li>Defined custom columns: id (NUMBER), employee (TEXT), city (TEXT), amount (NUMBER)</li>
* </ul>
*
* <p>Test dataset: <code>org/dashbuilder/dataprovider/backend/elasticsearch/expensereports-custom-columns-error.dset</code></p>
* <ul>
* <li>Try to override employee column type to label and it's not allowed (as employee field is type analyzed string)</li>
* </ul>
*
* @since 0.3.0
*/
public class ElasticSearchDataSetCustomColumnsTest extends ElasticSearchDataSetTestBase {
protected static final String EL_EXAMPLE_ALL_COLUMNS_DATASET_DEF = "org/dashbuilder/dataprovider/backend/elasticsearch/expensereports-allcolumns.dset";
protected static final String EL_DATASET_ALL_COLUMNS_UUID = "expense_reports_allcolumns";
protected static final String EL_EXAMPLE_CUSTOM_COLUMNS_DATASET_DEF = "org/dashbuilder/dataprovider/backend/elasticsearch/expensereports-custom-columns.dset";
protected static final String EL_DATASET_CUSTOM_COLUMNS_UUID = "expense_reports_custom_columns";
protected static final String EL_EXAMPLE_CUSTOM_COLUMNS2_DATASET_DEF = "org/dashbuilder/dataprovider/backend/elasticsearch/expensereports-custom-columns2.dset";
protected static final String EL_DATASET_CUSTOM_COLUMNS2_UUID = "expense_reports_custom_columns2";
protected static final String EL_EXAMPLE_BAD_COLUMNS_DATASET_DEF = "org/dashbuilder/dataprovider/backend/elasticsearch/expensereports-custom-columns-error.dset";
protected static final String EL_DATASET_BAD_COLUMNS_UUID = "expense_reports_custom_columns_error";
/**
* Register the dataset used for this test case.
*/
@Before
public void registerDataSet() throws Exception {
super.setUp();
// Register the data sets.
_registerDataSet(EL_EXAMPLE_ALL_COLUMNS_DATASET_DEF);
_registerDataSet(EL_EXAMPLE_CUSTOM_COLUMNS_DATASET_DEF);
_registerDataSet(EL_EXAMPLE_CUSTOM_COLUMNS2_DATASET_DEF);
_registerDataSet(EL_EXAMPLE_BAD_COLUMNS_DATASET_DEF);
}
/**
* **********************************************************************************************************************************************************************************************
* COLUMNS TESING.
* **********************************************************************************************************************************************************************************************
*/
/**
* Test retrieving all columns from index mapping (no columns defined in def and allColumns flag is set to true)
*/
@Test
public void testAllColumns() throws Exception {
DataSet result = dataSetManager.lookupDataSet(
DataSetFactory.newDataSetLookupBuilder()
.dataset(EL_DATASET_ALL_COLUMNS_UUID)
.buildLookup());
// Columns size assertion.
Assert.assertNotNull(result.getColumns());
Assert.assertTrue(result.getColumns().size() == 6);
// Columns id & type assertion.
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_AMOUNT, ColumnType.NUMBER);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_CITY, ColumnType.LABEL);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_DATE, ColumnType.DATE);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_DEPARTMENT, ColumnType.LABEL);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_EMPLOYEE, ColumnType.TEXT);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_ID, ColumnType.NUMBER);
}
/**
* Test retrieving all columns from index mapping and overriding one (a column is defined in def and allColumns flag is set to true)
*/
@Test
public void testCustomColumns() throws Exception {
DataSet result = dataSetManager.lookupDataSet(
DataSetFactory.newDataSetLookupBuilder()
.dataset(EL_DATASET_CUSTOM_COLUMNS_UUID)
.sort(ExpenseReportsData.COLUMN_ID, SortOrder.ASCENDING)
.buildLookup());
// Columns size assertion.
Assert.assertNotNull(result.getColumns());
Assert.assertTrue(result.getColumns().size() == 6);
// Columns id & type assertion.
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_AMOUNT, ColumnType.NUMBER);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_CITY, ColumnType.TEXT);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_DATE, ColumnType.DATE);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_DEPARTMENT, ColumnType.LABEL);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_EMPLOYEE, ColumnType.TEXT);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_ID, ColumnType.NUMBER);
}
/**
* Test using column defined in def (allColumns flag is set to false)
*/
@Test
public void testGivenColumns() throws Exception {
DataSet result = dataSetManager.lookupDataSet(
DataSetFactory.newDataSetLookupBuilder()
.dataset(EL_DATASET_CUSTOM_COLUMNS2_UUID)
.sort(ExpenseReportsData.COLUMN_ID, SortOrder.ASCENDING)
.buildLookup());
// Columns size assertion.
Assert.assertNotNull(result.getColumns());
Assert.assertTrue(result.getColumns().size() == 4);
// Columns id & type assertion.
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_ID, ColumnType.NUMBER);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_EMPLOYEE, ColumnType.TEXT);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_CITY, ColumnType.TEXT);
assertColumnIdAndType(result, ExpenseReportsData.COLUMN_AMOUNT, ColumnType.NUMBER);
}
private void assertColumnIdAndType(DataSet result, String columnId, ColumnType columnType) {
DataColumn amountCol = result.getColumnById(columnId);
Assert.assertNotNull(amountCol);
Assert.assertEquals(amountCol.getColumnType(), columnType);
}
/**
* **********************************************************************************************************************************************************************************************
* LOOKUP TESTING.
* **********************************************************************************************************************************************************************************************
*/
@Test(expected = RuntimeException.class)
public void testSortingWithNonExstingColumn() throws Exception {
DataSet result = dataSetManager.lookupDataSet(
DataSetFactory.newDataSetLookupBuilder()
.dataset(EL_DATASET_CUSTOM_COLUMNS_UUID)
.sort("mycolumn", SortOrder.DESCENDING)
.buildLookup());
}
@Test(expected = RuntimeException.class)
public void testSortingWithNonDefinedColumn() throws Exception {
DataSet result = dataSetManager.lookupDataSet(
DataSetFactory.newDataSetLookupBuilder()
.dataset(EL_DATASET_CUSTOM_COLUMNS2_UUID)
.sort(ExpenseReportsData.COLUMN_DEPARTMENT, SortOrder.DESCENDING)
.buildLookup());
}
/**
* Test columns as this dataset defintion contains custom definitions.
* An exception must be thrown due to cannot change employee column type to label, as it's an anaylzed string in the EL index mapping.
*/
@Test(expected = RuntimeException.class)
public void testColumnsBadDefined() throws Exception {
dataSetManager.lookupDataSet(
DataSetFactory.newDataSetLookupBuilder()
.dataset(EL_DATASET_BAD_COLUMNS_UUID)
.sort(ExpenseReportsData.COLUMN_ID, SortOrder.ASCENDING)
.buildLookup());
}
}
| 49.283505 | 197 | 0.648468 |
ae6b2e48e45a5d847f03c4dee2415c84880813e2 | 362 | /** Read code block.
*/
Code readCode(Symbol owner) {
nextChar(); // max_stack
nextChar(); // max_locals
final int code_length = nextInt();
bp += code_length;
final char exception_table_length = nextChar();
bp += exception_table_length * 8;
readMemberAttrs(owner);
return null;
}
| 27.846154 | 55 | 0.563536 |
c99e9cfce6868606e9c7b7fc4b7cb86faf59650d | 1,823 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.ai.formrecognizer.models;
import com.azure.core.annotation.Immutable;
import java.util.Collections;
import java.util.List;
/**
* The FieldData model.
*/
@Immutable
public final class FieldData extends FormElement {
/**
* The list of element references for the field value.
*/
private final List<FormElement> fieldElements;
/**
* Creates raw OCR FieldData item.
*
* @param text The text content of this form element.
* @param boundingBox The Bounding Box of the recognized field.
* @param pageNumber the 1 based page number.
* @param fieldElements The list of element references when includeFieldElements is set to true.
*/
public FieldData(String text, FieldBoundingBox boundingBox, int pageNumber,
final List<FormElement> fieldElements) {
super(text, boundingBox, pageNumber);
this.fieldElements = fieldElements == null ? null : Collections.unmodifiableList(fieldElements);
}
/**
* {@inheritDoc}
*/
@Override
public FieldBoundingBox getBoundingBox() {
return super.getBoundingBox();
}
/**
* {@inheritDoc}
*/
@Override
public String getText() {
return super.getText();
}
/**
* {@inheritDoc}
*/
@Override
public int getPageNumber() {
return super.getPageNumber();
}
/**
* When `includeFieldElements` is set to true, gets a list of reference elements constituting
* this {@code FieldData}.
*
* @return The unmodifiable list of reference elements constituting this {@code FieldData}.
*/
public List<FormElement> getFieldElements() {
return this.fieldElements;
}
}
| 26.042857 | 104 | 0.657707 |
cdc0ca78fbaf3dec546a65f6e74c30b8903dca96 | 2,459 | package aries.codegen.util;
import nam.model.Field;
import nam.model.util.TypeUtil;
import org.aries.util.NameUtil;
import aries.generation.model.ModelField;
public class MethodUtil {
public static String toGetMethod(Field field) {
return toGetMethod(field, true);
}
public static String toGetMethod(Field field, boolean enforceBooleanVersion) {
String className = TypeUtil.getClassName(field.getType());
String fieldName = NameUtil.capName(field.getName());
return toGetMethod(field.getStructure(), className, fieldName);
}
public static String toGetMethod(ModelField modelField) {
return toGetMethod(modelField, true);
}
public static String toGetMethod(ModelField modelField, boolean enforceBooleanVersion) {
return toGetMethod(modelField.getStructure(), modelField.getClassName(), modelField.getCappedName(), enforceBooleanVersion);
}
public static String toGetMethod(String structure, String className, String fieldName) {
return toGetMethod(structure, className, fieldName, true);
}
/**
* Returns the name of the get method for this attribute. The returned string
* does not contain the type of this attribute and does not end in brackets.
* For example <code>isInitialized</code> or <code>getAddress</code>.
*
* @return the name of the get method for this attribute
*/
public static String toGetMethod(String structure, String className, String fieldName, boolean enforceBooleanVersion) {
if (structure == null)
throw new RuntimeException("CODE PROBLEM");
if (structure.equals("map"))
return "get" + fieldName;
if (className == null)
throw new RuntimeException("CODE PROBLEM");
if (className.toLowerCase().equals("boolean") && enforceBooleanVersion)
return "is" + fieldName;
return "get" + fieldName;
}
public static String toSetMethod(ModelField modelField) {
return "set" + modelField.getCappedName();
}
public static String toUnsetMethod(ModelField modelField) {
return "unset" + modelField.getCappedName();
}
public static String toAddMethod(ModelField modelField) {
return "addTo" + modelField.getCappedName();
}
public static String toPutMethod(ModelField modelField) {
return "put" + modelField.getCappedName();
}
public static String toRemoveMethod(ModelField modelField) {
return "removeFrom" + modelField.getCappedName();
}
public static String toClearMethod(ModelField modelField) {
return "clear" + modelField.getCappedName();
}
}
| 31.126582 | 126 | 0.755998 |
dc55f4f7da75a551074bf223957451aa6521980b | 930 | package com.github.andrewapj.todoapi.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
/**
* Entity representing a Todo within the system.
*/
@Data
@Entity
@Table(name = "TODO")
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode(exclude = {"id"})
public class Todo {
@Id
@GeneratedValue
private Long id;
private String text;
private boolean completed;
/**
* Merges in the supplied {@link Todo} with this one.
*
* @param newTodo the todo to merge in.
* @return this modified todo.
*/
public Todo merge(final Todo newTodo) {
return this
.setText(newTodo.getText())
.setCompleted(newTodo.isCompleted());
}
}
| 22.142857 | 57 | 0.694624 |
36c0c828070a7becd8c853307f0767b317ca9a21 | 792 | package model;
import java.util.ArrayList;
import java.util.List;
public class ExpressionNode {
private String myExpression;
private String myCommand;
private List<ExpressionNode> myChildren;
public ExpressionNode() {
myChildren = new ArrayList<ExpressionNode>();
}
public ExpressionNode(String s, String p) {
myExpression = s;
myCommand = p;
myChildren = new ArrayList<ExpressionNode>();
}
public String getExpression() {
return myExpression;
}
public String getCommand() {
return myCommand;
}
public List<ExpressionNode> getChildren() {
return myChildren;
}
public void addChild(ExpressionNode child) {
if (child != null) {
myChildren.add(child);
}
}
public void setChildren(List<ExpressionNode> children) {
myChildren = children;
}
}
| 18.418605 | 57 | 0.72096 |
0fdcdab47dd27db8adfc6f85dc73293503fe1b08 | 10,821 | package com.slxy.www.domain.po;
public class Registration {
private String registrationFaculty;
private String registrationMajor;
private String registrationName;
private long registrationNumber;
private String registrationTitle;
private String registrationTeacher;
private String registrationTime;
private String registrationLocation;
private String registrationMember_1_name;
private String registrationMember_1_title;
private String registrationMember_1_research;
private float registrationMember_1_score;
private String registrationMember_2_name;
private String registrationMember_2_title;
private String registrationMember_2_research;
private float registrationMember_2_score;
private String registrationMember_3_name;
private String registrationMember_3_title;
private String registrationMember_3_research;
private float registrationMember_3_score;
private String registrationMember_4_name;
private String registrationMember_4_title;
private String registrationMember_4_research;
private float registrationMember_4_score;
private String registrationMember_5_name;
private String registrationMember_5_title;
private String registrationMember_5_research;
private float registrationMember_5_score;
private float registrationTotal_score;
private String registrationJudgement;
private float registrationMentor_score;
private float registrationJudge_score;
private float registrationScore;
private float registrationThesis_score;
private float registrationThesis_score1;
private String registrationThesis_scale;
private String registrationRecord;
public float getRegistrationMember_1_score() {
return registrationMember_1_score;
}
public void setRegistrationMember_1_score(float registrationMember_1_score) {
this.registrationMember_1_score = registrationMember_1_score;
}
public float getRegistrationMember_2_score() {
return registrationMember_2_score;
}
public void setRegistrationMember_2_score(float registrationMember_2_score) {
this.registrationMember_2_score = registrationMember_2_score;
}
public float getRegistrationMember_3_score() {
return registrationMember_3_score;
}
public void setRegistrationMember_3_score(float registrationMember_3_score) {
this.registrationMember_3_score = registrationMember_3_score;
}
public float getRegistrationMember_4_score() {
return registrationMember_4_score;
}
public void setRegistrationMember_4_score(float registrationMember_4_score) {
this.registrationMember_4_score = registrationMember_4_score;
}
public float getRegistrationMember_5_score() {
return registrationMember_5_score;
}
public void setRegistrationMember_5_score(float registrationMember_5_score) {
this.registrationMember_5_score = registrationMember_5_score;
}
public float getRegistrationTotal_score() {
return registrationTotal_score;
}
public void setRegistrationTotal_score(float registrationTotal_score) {
this.registrationTotal_score = registrationTotal_score;
}
public float getRegistrationMentor_score() {
return registrationMentor_score;
}
public void setRegistrationMentor_score(float registrationMentor_score) {
this.registrationMentor_score = registrationMentor_score;
}
public float getRegistrationJudge_score() {
return registrationJudge_score;
}
public void setRegistrationJudge_score(float registrationJudge_score) {
this.registrationJudge_score = registrationJudge_score;
}
public float getRegistrationScore() {
return registrationScore;
}
public void setRegistrationScore(float registrationScore) {
this.registrationScore = registrationScore;
}
public float getRegistrationThesis_score() {
return registrationThesis_score;
}
public void setRegistrationThesis_score(float registrationThesis_score) {
this.registrationThesis_score = registrationThesis_score;
}
public float getRegistrationThesis_score1() {
return registrationThesis_score1;
}
public void setRegistrationThesis_score1(float registrationThesis_score1) {
this.registrationThesis_score1 = registrationThesis_score1;
}
public String getRegistrationThesis_scale() {
return registrationThesis_scale;
}
public void setRegistrationThesis_scale(String registrationThesis_scale) {
this.registrationThesis_scale = registrationThesis_scale;
}
public String getRegistrationFaculty() {
return registrationFaculty;
}
public void setRegistrationFaculty(String registrationFaculty) {
this.registrationFaculty = registrationFaculty;
}
public String getRegistrationMajor() {
return registrationMajor;
}
public void setRegistrationMajor(String registrationMajor) {
this.registrationMajor = registrationMajor;
}
public String getRegistrationName() {
return registrationName;
}
public void setRegistrationName(String registrationName) {
this.registrationName = registrationName;
}
public long getRegistrationNumber() {
return registrationNumber;
}
public void setRegistrationNumber(long registrationNumber) {
this.registrationNumber = registrationNumber;
}
public String getRegistrationTitle() {
return registrationTitle;
}
public void setRegistrationTitle(String registrationTitle) {
this.registrationTitle = registrationTitle;
}
public String getRegistrationTeacher() {
return registrationTeacher;
}
public void setRegistrationTeacher(String registrationTeacher) {
this.registrationTeacher = registrationTeacher;
}
public String getRegistrationTime() {
return registrationTime;
}
public void setRegistrationTime(String registrationTime) {
this.registrationTime = registrationTime;
}
public String getRegistrationLocation() {
return registrationLocation;
}
public void setRegistrationLocation(String registrationLocation) {
this.registrationLocation = registrationLocation;
}
public String getRegistrationMember_1_name() {
return registrationMember_1_name;
}
public void setRegistrationMember_1_name(String registrationMember_1_name) {
this.registrationMember_1_name = registrationMember_1_name;
}
public String getRegistrationMember_1_title() {
return registrationMember_1_title;
}
public void setRegistrationMember_1_title(String registrationMember_1_title) {
this.registrationMember_1_title = registrationMember_1_title;
}
public String getRegistrationMember_1_research() {
return registrationMember_1_research;
}
public void setRegistrationMember_1_research(String registrationMember_1_research) {
this.registrationMember_1_research = registrationMember_1_research;
}
public String getRegistrationMember_2_name() {
return registrationMember_2_name;
}
public void setRegistrationMember_2_name(String registrationMember_2_name) {
this.registrationMember_2_name = registrationMember_2_name;
}
public String getRegistrationMember_2_title() {
return registrationMember_2_title;
}
public void setRegistrationMember_2_title(String registrationMember_2_title) {
this.registrationMember_2_title = registrationMember_2_title;
}
public String getRegistrationMember_2_research() {
return registrationMember_2_research;
}
public void setRegistrationMember_2_research(String registrationMember_2_research) {
this.registrationMember_2_research = registrationMember_2_research;
}
public String getRegistrationMember_3_name() {
return registrationMember_3_name;
}
public void setRegistrationMember_3_name(String registrationMember_3_name) {
this.registrationMember_3_name = registrationMember_3_name;
}
public String getRegistrationMember_3_title() {
return registrationMember_3_title;
}
public void setRegistrationMember_3_title(String registrationMember_3_title) {
this.registrationMember_3_title = registrationMember_3_title;
}
public String getRegistrationMember_3_research() {
return registrationMember_3_research;
}
public void setRegistrationMember_3_research(String registrationMember_3_research) {
this.registrationMember_3_research = registrationMember_3_research;
}
public String getRegistrationMember_4_name() {
return registrationMember_4_name;
}
public void setRegistrationMember_4_name(String registrationMember_4_name) {
this.registrationMember_4_name = registrationMember_4_name;
}
public String getRegistrationMember_4_title() {
return registrationMember_4_title;
}
public void setRegistrationMember_4_title(String registrationMember_4_title) {
this.registrationMember_4_title = registrationMember_4_title;
}
public String getRegistrationMember_4_research() {
return registrationMember_4_research;
}
public void setRegistrationMember_4_research(String registrationMember_4_research) {
this.registrationMember_4_research = registrationMember_4_research;
}
public String getRegistrationMember_5_name() {
return registrationMember_5_name;
}
public void setRegistrationMember_5_name(String registrationMember_5_name) {
this.registrationMember_5_name = registrationMember_5_name;
}
public String getRegistrationMember_5_title() {
return registrationMember_5_title;
}
public void setRegistrationMember_5_title(String registrationMember_5_title) {
this.registrationMember_5_title = registrationMember_5_title;
}
public String getRegistrationMember_5_research() {
return registrationMember_5_research;
}
public void setRegistrationMember_5_research(String registrationMember_5_research) {
this.registrationMember_5_research = registrationMember_5_research;
}
public String getRegistrationJudgement() {
return registrationJudgement;
}
public void setRegistrationJudgement(String registrationJudgement) {
this.registrationJudgement = registrationJudgement;
}
public String getRegistrationRecord() {
return registrationRecord;
}
public void setRegistrationRecord(String registrationRecord) {
this.registrationRecord = registrationRecord;
}
}
| 31.920354 | 88 | 0.759172 |
a832d86c8566cbca0d366805fa81b8c981874536 | 711 | package sn.analytics.sets.type;
import java.util.Iterator;
/**
* String based offheap sets using Chronicle map
* Created by sumanth
*/
public class StringOffHeapSet implements IdSet<String> {
@Override
public void addElement(String elem) {
}
@Override
public boolean contains(String elem) {
return false;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public int size() {
return 0;
}
@Override
public Iterator<String> iterator() {
return null;
}
@Override
public boolean hasNext() {
return false;
}
@Override
public String next() {
return null;
}
}
| 15.8 | 56 | 0.59775 |
26fb77e49365a745a5e4fa6ea76538e8f6ac9565 | 1,434 | package uk.gov.hmcts.ccd.domain.model.definition;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
public class SearchResultField implements Serializable {
@JsonProperty("case_type_id")
private String caseTypeId;
@JsonProperty("case_field_id")
private String caseFieldId;
private String label;
@JsonProperty("order")
private Integer displayOrder;
private boolean metadata;
@JsonProperty("role")
private String role;
public String getCaseTypeId() {
return caseTypeId;
}
public void setCaseTypeId(String caseTypeId) {
this.caseTypeId = caseTypeId;
}
public String getCaseFieldId() {
return caseFieldId;
}
public void setCaseFieldId(String caseFieldId) {
this.caseFieldId = caseFieldId;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Integer getDisplayOrder() {
return displayOrder;
}
public void setDisplayOrder(Integer displayOrder) {
this.displayOrder = displayOrder;
}
public boolean isMetadata() {
return metadata;
}
public void setMetadata(boolean metadata) {
this.metadata = metadata;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
}
| 21.402985 | 56 | 0.656206 |
0dd6c143412b0e9c49b9eb4ff65eb9387b383527 | 177 | package net36px.passport.app.task.qna;
public interface Asker {
void commit(Asking asking);
void close(Asking asking);
void reject(Asking asking);
}
| 14.75 | 39 | 0.661017 |
ba82b95f2293edcc6df4d40dc89e2d8321b2ef78 | 293 | package com.neo.service;
import com.neo.model.User;
import java.util.List;
public interface UserService {
public List<User> getUserList();
public User findUserById(long id);
public void save(User user);
public void edit(User user);
public void delete(long id);
}
| 13.952381 | 38 | 0.696246 |
babb50a3dc707c6c2e76f0010b4f451c3a3a6df9 | 1,472 | package com.trunkrs.sdk;
import java.util.HashMap;
import java.util.Map;
import lombok.val;
public abstract class APICredentials {
/**
* Creates API credentials from your client id and client secret used in the V1 API.
*
* @param clientId The Trunkrs provided client id.
* @param clientSecret The Trunkrs provided client secret.
* @return The credentials usable within the SDK.
*/
public static APICredentials from(String clientId, String clientSecret) {
return new APICredentials() {
@Override
public Map<String, String> getAuthHeaders() {
val headers = new HashMap<String, String>();
headers.put("X-API-ClientId", clientId);
headers.put("X-API-ClientSecret", clientSecret);
return headers;
}
};
}
/**
* Creates API credentials from your API key used in the V2 API.
*
* @param apiKey The Trunkrs provided API key.
* @return The credentials usable within the SDK.
*/
public static APICredentials from(String apiKey) {
return new APICredentials() {
@Override
public Map<String, String> getAuthHeaders() {
val headers = new HashMap<String, String>();
headers.put("X-API-Key", apiKey);
return headers;
}
};
}
/**
* Returns the authentication headers for the credentials.
*
* @return A map containing representing the authentication headers.
*/
public abstract Map<String, String> getAuthHeaders();
}
| 27.773585 | 86 | 0.66712 |
5c7377a2db5ab5be8a94abf39d031a53a5b917b1 | 1,959 | package de.adorsys.opba.protocol.sandbox.hbci.config;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.adorsys.opba.protocol.sandbox.hbci.protocol.context.HbciSandboxContext;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.flowable.variable.api.types.ValueFields;
import org.flowable.variable.api.types.VariableType;
import java.util.Collections;
import java.util.Map;
/**
* JSON serializer for small classes (small resulting strings). Preserves the class name used, so deserialzation
* returns the class that was used to serialize data.
*/
@RequiredArgsConstructor
public class HbciJsonCustomSerializer implements VariableType {
static final String JSON = "as_hbci_sandbox_json";
private final ObjectMapper mapper;
@Override
public String getTypeName() {
return JSON;
}
@Override
public boolean isCachable() {
return true;
}
@Override
@SneakyThrows
public boolean isAbleToStore(Object o) {
return o instanceof HbciSandboxContext;
}
@Override
@SneakyThrows
public void setValue(Object o, ValueFields valueFields) {
if (o == null) {
valueFields.setBytes(null);
return;
}
Map<String, Object> objectAndClass = Collections.singletonMap(o.getClass().getCanonicalName(), o);
valueFields.setBytes(mapper.writeValueAsBytes(objectAndClass));
}
@Override
@SneakyThrows
public Object getValue(ValueFields valueFields) {
if (null == valueFields.getBytes()) {
return null;
}
JsonNode data = mapper.readTree(valueFields.getBytes());
Map.Entry<String, JsonNode> classNameAndValue = data.fields().next();
Class<?> dataClazz = Class.forName(classNameAndValue.getKey());
return mapper.readValue(classNameAndValue.getValue().traverse(), dataClazz);
}
}
| 30.138462 | 112 | 0.709035 |
b763b9ff01e57ade7548a9aef9e5301471c7defc | 330 | package br.com.romaninisistemas.repository.search;
import br.com.romaninisistemas.domain.Cor;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
/**
* Spring Data Elasticsearch repository for the Cor entity.
*/
public interface CorSearchRepository extends ElasticsearchRepository<Cor, Long> {
}
| 30 | 81 | 0.827273 |
9cde47b0a9f810bc2102792954400f7f9aa1bcd3 | 1,633 | package tw.gov.epa.taqmpredict.util;
import android.text.format.DateUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* Created by user on 2017/3/8.
*/
public class DateTimeUtil {
static String HEADLINE_DATE_PATTERN = "yyyy-MM-dd";
static String HEADLINE_TIME_PATTERN = "HH:mm:ss";
static String HEADLINE_DAY_PATTERN = "E";
static String PREDICT_DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm";
static String PREDICT_TIME_PATTERN = "HH:mm";
//headline current date time
public static String getCurrentHLDateTime(){
return getDateTime(HEADLINE_DATE_PATTERN) + " " +
getDateTime(HEADLINE_DAY_PATTERN) + " " +
getDateTime(HEADLINE_TIME_PATTERN);
}
public static String getPredictTime(String time){
Date dt = null;
try {
dt = getSdf(PREDICT_DATE_TIME_PATTERN).parse(time);
Calendar cal = Calendar.getInstance();
cal.setTime(dt);
cal.add(Calendar.HOUR_OF_DAY, 1);
dt = cal.getTime();
} catch (ParseException e) {
e.printStackTrace();
}
if(dt==null){
return "";
}
else {
return getSdf(PREDICT_TIME_PATTERN).format(dt);
}
}
public static String getDateTime(String pattern){
Calendar cal = Calendar.getInstance();
Date dt = cal.getTime();
return getSdf(pattern).format(dt);
}
public static SimpleDateFormat getSdf(String pattern){
return new SimpleDateFormat(pattern);
}
}
| 28.649123 | 65 | 0.630129 |
4b3f44cdb7af6c167b8d5dd7dffcc45cf231d17b | 378 | package com.github.thiagogarbazza.training.springangular.core.grupodocumento.impl;
import com.github.thiagogarbazza.training.springangular.core.grupodocumento.GrupoDocumento;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.UUID;
interface GrupoDocumentoRepository extends JpaRepository<GrupoDocumento, UUID>, GrupoDocumentoRepositoryCustom {
}
| 37.8 | 112 | 0.867725 |
eee2ba53ba422dbe6b926742f98dcfc976993b2c | 744 | // Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content.browser;
import android.content.Context;
import org.chromium.base.CommandLine;
import org.chromium.content_public.common.ContentSwitches;
import org.chromium.ui.base.DeviceFormFactor;
/**
* A utility class that has helper methods for device configuration.
*/
public class DeviceUtilsImpl {
private DeviceUtilsImpl() {}
public static void addDeviceSpecificUserAgentSwitch(Context context) {
if (!DeviceFormFactor.isTablet()) {
CommandLine.getInstance().appendSwitch(ContentSwitches.USE_MOBILE_UA);
}
}
}
| 29.76 | 82 | 0.752688 |
fc76bffad188d1f3094107ce8e7e8931f0cce1f3 | 422 | import java.util.Scanner;
public class Repeticao4 {
public static void main(String args[]){
Scanner input = new Scanner(System.in);
int number;
System.out.print("Digite um número: ");
number = input.nextInt();
int fatorial = 1;
for (int i = 1; i <= number; i++){
fatorial = fatorial * i;
}
System.out.println("Fatorial = "+fatorial);
}
} | 28.133333 | 51 | 0.554502 |
14db44b2554ad8465ba9dc60e20c5e3feb9eb29d | 1,043 | package com.gcplot.model.gc;
import com.fasterxml.jackson.annotation.JsonValue;
import com.gcplot.utils.enums.TypedEnum;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public enum Generation implements TypedEnum {
YOUNG(1),
TENURED(2),
/* Used before Java 8 */
PERM(3),
/* Used after Java 8 */
METASPACE(4),
OLD(5),
OTHER(6);
private int type;
private static Int2ObjectMap<Generation> types = new Int2ObjectOpenHashMap<>();
@Override
public int type() {
return type;
}
public static Generation get(int type) {
return types.get(type);
}
public static Int2ObjectMap<Generation> types() {
return types;
}
Generation(int type) {
this.type = type;
}
@Override
@JsonValue
public String toString() {
return Integer.toString(type);
}
static {
for (Generation g : Generation.values()) {
types.put(g.type, g);
}
}
}
| 20.45098 | 83 | 0.623202 |
5574e6af09040c675ae10ca6947bd6fbdb73ca7e | 243 | package lk.ijse.dep.pos.jpa.dao.custom;
import lk.ijse.dep.pos.jpa.dao.CrudDAO;
import lk.ijse.dep.pos.jpa.entity.Customer;
public interface CustomerDAO extends CrudDAO<Customer,String> {
String getLastCustomerId() throws Exception;
}
| 22.090909 | 63 | 0.777778 |
6c4a70898f0d8e8bcdbf493b100a6b3dcb1b5920 | 513 | import SelfDrivingCar.Car;
import org.junit.Assert;
import org.junit.Test;
/**
* Created by awilczek on 4/8/14.
*/
public class Tests {
@Test
public void testInit()
{
Car car = new Car();
System.out.println(car.getInfo());
car.populateUsers();
car.setZone1User(car.users.get(0));
Assert.assertEquals(car.getUser1().toString(),1 + " " +"Adam" + " " + true + " " + true + " " + 0 + " " + 0 + " " + 0 + " " + 0 + " " + 98 );
car.shutdown();
}
}
| 21.375 | 149 | 0.526316 |
1a660c29c04f8737d08f486bb9e10d88663dff20 | 428 | package com.home.commonManager.tool;
import com.home.commonManager.net.httpResponse.base.ManagerNormalClientHttpResponse;
import com.home.shine.net.httpResponse.BaseHttpResponse;
import com.home.shine.tool.IHttpResponseMaker;
public class ManagerClientHttpResponseMaker implements IHttpResponseMaker
{
@Override
public BaseHttpResponse getHttpResponseByID(String id)
{
return new ManagerNormalClientHttpResponse();
}
} | 28.533333 | 84 | 0.845794 |
8001f95d83860d7cba3680b6ae9ec13d60e7f8ac | 3,369 | /**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.gravitee.gateway.core.loadbalancer;
import io.gravitee.common.util.ChangeListener;
import io.gravitee.common.util.ObservableCollection;
import io.gravitee.gateway.api.endpoint.Endpoint;
import io.gravitee.gateway.api.endpoint.EndpointAvailabilityListener;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author David BRASSELY (david.brassely at graviteesource.com)
* @author GraviteeSource Team
*/
public abstract class LoadBalancer implements LoadBalancerStrategy, EndpointAvailabilityListener, ChangeListener<Endpoint> {
/**
* Primary endpoints
*/
protected final List<Endpoint> endpoints = new ArrayList<>();
/**
* Secondary (ie. backup) endpoints
* @param endpoints
*/
private final List<Endpoint> secondaryEndpoints = new ArrayList<>();
private final AtomicInteger secondaryCounter = new AtomicInteger(0);
LoadBalancer(Collection<Endpoint> endpoints) {
if (endpoints instanceof ObservableCollection) {
((ObservableCollection<Endpoint>) endpoints).addListener(this);
}
endpoints.forEach(this::postAdd);
}
@Override
public void onAvailabilityChange(Endpoint endpoint, boolean available) {
if (available && !endpoints.contains(endpoint)) {
endpoints.add(endpoint);
} else if (! available){
endpoints.remove(endpoint);
}
}
@Override
public Endpoint next() {
Endpoint endpoint = nextEndpoint();
return (endpoint != null) ? endpoint : nextSecondary();
}
private Endpoint nextSecondary() {
int size = secondaryEndpoints.size();
if (size == 0) {
return null;
}
return secondaryEndpoints.get(Math.abs(secondaryCounter.getAndIncrement() % size));
}
@Override
public boolean preAdd(Endpoint object) {
return false;
}
@Override
public boolean preRemove(Endpoint object) {
return false;
}
@Override
public boolean postAdd(Endpoint endpoint) {
if (endpoint.primary()) {
endpoint.addEndpointAvailabilityListener(LoadBalancer.this);
endpoints.add(endpoint);
} else {
secondaryEndpoints.add(endpoint);
}
return false;
}
@Override
public boolean postRemove(Endpoint endpoint) {
if (endpoint.primary()) {
endpoint.removeEndpointAvailabilityListener(LoadBalancer.this);
endpoints.remove(endpoint);
} else {
secondaryEndpoints.remove(endpoint);
}
return false;
}
abstract Endpoint nextEndpoint();
}
| 29.295652 | 124 | 0.672009 |
c807860a763e78258efdb7a060d38c49b84bfee8 | 93 | package com.pixcat.jellymonsters.input;
public enum KeyState {
PRESSED,
RELEASED
}
| 11.625 | 39 | 0.72043 |
1e8b3322e87c0b21e0cc55e35fe406dcb94ab26c | 2,122 | package org.jclouds.vi.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import java.util.Properties;
import org.jclouds.compute.BaseComputeServiceLiveTest;
import org.jclouds.compute.ComputeServiceContextFactory;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.jclouds.rest.RestContext;
import org.jclouds.ssh.jsch.config.JschSshClientModule;
import org.testng.annotations.Test;
import com.vmware.vim25.mo.ServiceInstance;
/**
* @author Adrian Cole
*/
@Test(groups = "live", enabled = true, sequential = true)
public class ViComputeServiceLiveTest extends BaseComputeServiceLiveTest {
public ViComputeServiceLiveTest() {
provider = "vi";
}
@Override
protected Properties getRestProperties() {
Properties restProperties = new Properties();
restProperties.setProperty("vi.contextbuilder", ViComputeServiceContextBuilder.class.getName());
restProperties.setProperty("vi.propertiesbuilder", ViPropertiesBuilder.class.getName());
restProperties.setProperty("vi.endpoint", "https://localhost/sdk");
return restProperties;
}
@Test
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "5.3");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
assertEquals(defaultTemplate.getLocation().getId(), "1");
assertEquals(getCores(defaultTemplate.getHardware()), 0.5d);
}
@Override
protected JschSshClientModule getSshModule() {
return new JschSshClientModule();
}
public void testAssignability() throws Exception {
@SuppressWarnings("unused")
RestContext<ServiceInstance, ServiceInstance> viContext = new ComputeServiceContextFactory().createContext(
provider, identity, credential).getProviderSpecificContext();
}
}
| 36.586207 | 113 | 0.758247 |
e1500c8d64c718d51837b7be305ebb2e2f211420 | 10,463 | /*
* Copyright © 2019-2022 Forb Yuan
*
* 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 win.doyto.query.service;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.reflect.ConstructorUtils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanInitializationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.NoOpCache;
import org.springframework.context.annotation.Lazy;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.*;
import win.doyto.query.cache.CacheInvoker;
import win.doyto.query.cache.CacheWrapper;
import win.doyto.query.core.DataAccess;
import win.doyto.query.core.DoytoQuery;
import win.doyto.query.core.IdWrapper;
import win.doyto.query.entity.EntityAspect;
import win.doyto.query.entity.MongoEntity;
import win.doyto.query.entity.Persistable;
import win.doyto.query.entity.UserIdProvider;
import win.doyto.query.memory.MemoryDataAccess;
import win.doyto.query.util.BeanUtil;
import java.io.Serializable;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.persistence.Table;
/**
* AbstractDynamicService
*
* @author f0rb on 2019-05-28
*/
public abstract class AbstractDynamicService<E extends Persistable<I>, I extends Serializable, Q extends DoytoQuery>
implements DynamicService<E, I, Q> {
protected DataAccess<E, I, Q> dataAccess;
protected final Class<E> entityClass;
protected final CacheWrapper<E> entityCacheWrapper = CacheWrapper.createInstance();
protected final CacheWrapper<List<E>> queryCacheWrapper = CacheWrapper.createInstance();
@Autowired(required = false)
private UserIdProvider<?> userIdProvider = () -> null;
@Setter
@Autowired(required = false)
private CacheManager cacheManager;
@Lazy
@Autowired(required = false)
protected List<EntityAspect<E>> entityAspects = new LinkedList<>();
protected TransactionOperations transactionOperations = NoneTransactionOperations.instance;
@SuppressWarnings("unchecked")
protected AbstractDynamicService() {
entityClass = (Class<E>) BeanUtil.getActualTypeArguments(getConcreteClass())[0];
dataAccess = new MemoryDataAccess<>(entityClass);
}
protected Class<?> getConcreteClass() {
return getClass();
}
@SuppressWarnings("unchecked")
@Resource
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
ClassLoader classLoader = beanFactory.getClass().getClassLoader();
try {
if (entityClass.isAnnotationPresent(Table.class)) {
Class<?> jdbcDataAccessClass = classLoader.loadClass("win.doyto.query.jdbc.JdbcDataAccess");
Object jdbcOperations = beanFactory.getBean("jdbcTemplate");
dataAccess = (DataAccess<E, I, Q>) ConstructorUtils.invokeConstructor(jdbcDataAccessClass, jdbcOperations, entityClass);
} else if (entityClass.isAnnotationPresent(MongoEntity.class)) {
Class<?> mongoDataAccessClass = classLoader.loadClass("win.doyto.query.mongodb.MongoDataAccess");
tryCreateEmbeddedMongoServerFirst(beanFactory);
Object mongoClient = beanFactory.getBean("mongo");
dataAccess = (DataAccess<E, I, Q>) ConstructorUtils.invokeConstructor(mongoDataAccessClass, mongoClient, entityClass);
}
} catch (Exception e) {
throw new BeanInitializationException("Failed to create DataAccess for " + entityClass.getName(), e);
}
}
private void tryCreateEmbeddedMongoServerFirst(BeanFactory beanFactory) {
try {
beanFactory.getBean("embeddedMongoServer");
} catch (BeansException e) {//just ignore when no embeddedMongoServer provided
}
}
@Autowired(required = false)
public void setTransactionManager(PlatformTransactionManager transactionManager) {
transactionOperations = new TransactionTemplate(transactionManager);
}
@SuppressWarnings("java:S4973")
@Value("${doyto.query.caches:}")
public void setCacheList(String caches) {
List<String> cacheList = Arrays.stream(caches.split("[,\\s]")).filter(s -> !s.isEmpty()).collect(Collectors.toList());
if (cacheManager != null) {
String cacheName = getCacheName();
if (cacheList.contains(cacheName) || cacheName != entityClass.getSimpleName().intern()) {
entityCacheWrapper.setCache(cacheManager.getCache(cacheName));
queryCacheWrapper.setCache(cacheManager.getCache(getQueryCacheName()));
}
}
}
protected String resolveCacheKey(IdWrapper<I> w) {
return w.toCacheKey();
}
protected String getCacheName() {
return entityClass.getSimpleName().intern();
}
private String getQueryCacheName() {
return getCacheName() + ":query";
}
protected void clearCache() {
entityCacheWrapper.clear();
queryCacheWrapper.clear();
}
protected void evictCache(String key) {
entityCacheWrapper.evict(key);
queryCacheWrapper.clear();
}
protected boolean cacheable() {
return !(entityCacheWrapper.getCache() instanceof NoOpCache);
}
@Override
public List<E> query(Q query) {
String key = generateCacheKey(query);
return queryCacheWrapper.execute(key, () -> dataAccess.query(query));
}
protected String generateCacheKey(Q query) {
String key = null;
if (cacheable() && !TransactionSynchronizationManager.isActualTransactionActive()) {
key = ToStringBuilder.reflectionToString(query, NonNullToStringStyle.NO_CLASS_NAME_NON_NULL_STYLE);
}
return key;
}
public long count(Q query) {
return dataAccess.count(query);
}
public List<I> queryIds(Q query) {
return dataAccess.queryIds(query);
}
public <V> List<V> queryColumns(Q query, Class<V> clazz, String... columns) {
return dataAccess.queryColumns(query, clazz, columns);
}
public void create(E e) {
userIdProvider.setupUserId(e);
if (!entityAspects.isEmpty()) {
transactionOperations.execute(s -> {
dataAccess.create(e);
entityAspects.forEach(entityAspect -> entityAspect.afterCreate(e));
return null;
});
} else {
dataAccess.create(e);
}
evictCache(resolveCacheKey(e.toIdWrapper()));
}
public int update(E e) {
return doUpdate(e, () -> dataAccess.update(e));
}
public int patch(E e) {
return doUpdate(e, () -> dataAccess.patch(e));
}
private int doUpdate(E e, CacheInvoker<Integer> cacheInvoker) {
userIdProvider.setupUserId(e);
E origin;
if (e == null || (origin = dataAccess.get(e.toIdWrapper())) == null) {
return 0;
}
if (!entityAspects.isEmpty()) {
transactionOperations.execute(s -> {
cacheInvoker.invoke();
E current = dataAccess.get(e.toIdWrapper());
entityAspects.forEach(entityAspect -> entityAspect.afterUpdate(origin, current));
return null;
});
} else {
cacheInvoker.invoke();
}
evictCache(resolveCacheKey(e.toIdWrapper()));
return 1;
}
@Override
public int create(Iterable<E> entities, String... columns) {
if (userIdProvider.getUserId() != null) {
for (E e : entities) {
userIdProvider.setupUserId(e);
}
}
int insert = dataAccess.batchInsert(entities, columns);
clearCache();
return insert;
}
public int patch(E e, Q q) {
userIdProvider.setupUserId(e);
int patch = dataAccess.patch(e, q);
clearCache();
return patch;
}
public int delete(Q query) {
int delete = dataAccess.delete(query);
clearCache();
return delete;
}
@Override
public E get(IdWrapper<I> w) {
if (TransactionSynchronizationManager.isActualTransactionActive()) {
return fetch(w);
}
return entityCacheWrapper.execute(resolveCacheKey(w), () -> fetch(w));
}
@Override
public E fetch(IdWrapper<I> w) {
return dataAccess.get(w);
}
@Override
public E delete(IdWrapper<I> w) {
E e = get(w);
if (e != null) {
if (!entityAspects.isEmpty()) {
transactionOperations.execute(s -> {
dataAccess.delete(w);
entityAspects.forEach(entityAspect -> entityAspect.afterDelete(e));
return null;
});
} else {
dataAccess.delete(w);
}
String key = resolveCacheKey(w);
evictCache(key);
entityCacheWrapper.execute(key, () -> null);
}
return e;
}
private static class NoneTransactionOperations implements TransactionOperations {
private static final TransactionOperations instance = new NoneTransactionOperations();
private static final TransactionStatus TRANSACTION_STATUS = new SimpleTransactionStatus();
@Override
public <T> T execute(TransactionCallback<T> transactionCallback) {
return transactionCallback.doInTransaction(TRANSACTION_STATUS);
}
}
}
| 35.110738 | 136 | 0.661856 |
1e43fbca9fe6198a8e8230ea7045a8bcda24c11c | 899 | package org.codecraftlabs.octo.service;
public class InvoicePatchVO {
private final String invoiceId;
private String name;
private double amount;
private String status;
private final long version;
public InvoicePatchVO(String invoiceId, long version) {
this.invoiceId = invoiceId;
this.version = version;
}
public String getInvoiceId() {
return invoiceId;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setAmount(double amount) {
this.amount = amount;
}
public double getAmount() {
return amount;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public long getVersion() {
return version;
}
}
| 19.12766 | 59 | 0.611791 |
4b688d8a3b00d97e8514dd833197a3b349ba2256 | 8,632 | package spins.promela.compiler.ltsmin.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import spins.promela.compiler.Specification;
import spins.promela.compiler.actions.Action;
import spins.promela.compiler.expression.Expression;
import spins.promela.compiler.ltsmin.matrix.LTSminGuard;
import spins.promela.compiler.ltsmin.matrix.RWMatrix;
import spins.promela.compiler.ltsmin.model.LTSminModelFeature.ModelFeature;
import spins.promela.compiler.ltsmin.state.LTSminSlot;
import spins.promela.compiler.ltsmin.state.LTSminStateVector;
import spins.promela.compiler.ltsmin.util.LTSminDebug;
import spins.promela.compiler.ltsmin.util.LTSminUtil.Pair;
import spins.promela.compiler.variable.Variable;
import spins.promela.compiler.variable.VariableType;
import spins.util.IndexedSet;
/**
* An LTSmin model consists is derived from a SpinJa Specification and
* encapsulates transitions (which are transition groups), a state vector
* consisting physically of slots and dependency information.
*
* Transitions of the model are mapped to transition groups (LTSminTransition)
* with guard and action expressions.
* Variables of the model are mapped to state vector slots.
* The dependency metric records the dependencies between transition groups
* state vector slots, where the action can be write dependencies and the guards
* represent only read dependencies.
* Finally, the guard info class stores dependencies amongst guards and between
* guards and transitions that are needed for partial-order reduction.
*
* @see LTSminStateVector
*
* @author Freark van der Berg, Alfons Laarman
*/
public class LTSminModel implements Iterable<LTSminTransition> {
private String name;
private RWMatrix depMatrix;
private RWMatrix atomicDepMatrix;
private RWMatrix actionDepMatrix;
private GuardInfo guardInfo;
private List<String> mtypes;
public boolean hasAtomicCycles = false;
// local variables
public final Variable index = new Variable(VariableType.INT, "i", -1);
public final Variable jndex = new Variable(VariableType.INT, "j", -1);
private List<Variable> locals = Arrays.asList(index, jndex);
// state vector
public LTSminStateVector sv = null;
// next-state assertions
public List<Pair<Expression,String>> assertions = new LinkedList<Pair<Expression,String>>();
// states and transitions
private List<LTSminTransition> transitions = new ArrayList<LTSminTransition>();
private Map<LTSminState, LTSminState> states = new HashMap<LTSminState, LTSminState>();
// types
private IndexedSet<String> types = new IndexedSet<String>();
private List<IndexedSet<String>> values = new ArrayList<IndexedSet<String>>();
// edge labels
private IndexedSet<String> edgeLabels = new IndexedSet<String>();
private List<String> edgeTypes = new ArrayList<String>();
// state labels
private Map<String, LTSminGuard> stateLabels = new HashMap<String, LTSminGuard>();
public LTSminModel(String name, Specification spec) {
this.name = name;
mtypes = spec.getMTypes();
}
public List<Variable> getLocals() {
return locals;
}
public List<String> getMTypes() {
return mtypes;
}
public String getName() {
return name;
}
public RWMatrix getDepMatrix() {
return depMatrix;
}
public void setDepMatrix(RWMatrix depMatrix) {
this.depMatrix = depMatrix;
}
public RWMatrix getActionDepMatrix() {
return actionDepMatrix;
}
public void setActionDepMatrix(RWMatrix depMatrix) {
this.actionDepMatrix = depMatrix;
}
public RWMatrix getAtomicDepMatrix() {
return atomicDepMatrix;
}
public void setAtomicDepMatrix(RWMatrix depMatrix) {
this.atomicDepMatrix = depMatrix;
}
public GuardInfo getGuardInfo() {
return guardInfo;
}
public void setGuardInfo(GuardInfo guardMatrix) {
this.guardInfo = guardMatrix;
}
public boolean hasAtomic() {
for (LTSminTransition t : this)
if (t.isAtomic()) return true;
return false;
}
public LTSminState getOrAddState(LTSminState state) {
LTSminState begin = states.get(state);
if (null != begin) {
return begin;
} else {
states.put(state, state);
return state;
}
}
public List<LTSminTransition> getTransitions() {
return transitions;
}
public Iterator<LTSminTransition> iterator() {
return transitions.iterator();
}
public void addTransition(LTSminTransition lt) {
lt.setGroup(transitions.size());
transitions.add(lt);
}
public void addType(String string) {
if (types.get(string) != null) throw new AssertionError("Adding type twice: "+ string);
types.add(string);
values.add(new IndexedSet<String>());
}
public void addTypeValue(String string, String value) {
getType(string).add(value);
}
public int getTypeIndex(String string) {
return types.get(string);
}
public IndexedSet<String> getType(String string) {
Integer index = types.get(string);
if (index == null) return null;
return values.get(index);
}
public String getType(int index) {
return types.get(index);
}
public IndexedSet<String> getTypeValues(int index) {
return values.get(index);
}
public int getTypeValueIndex(String type, String string) {
Integer typeno = types.get(type);
IndexedSet<String> values = this.values.get(typeno);
return values.get(string);
}
public IndexedSet<String> getTypes() {
return types;
}
public List<IndexedSet<String>> getTypeValues() {
return values;
}
public void addEdgeLabel(String name, String type) {
edgeLabels.add(name);
edgeTypes.add(type);
}
public IndexedSet<String> getEdges() {
return edgeLabels;
}
public String getEdgeType(String string) {
int index = edgeLabels.get(string);
return edgeTypes.get(index);
}
public String getEdgeType(int index) {
return edgeTypes.get(index);
}
public void addStateLabel(String string, LTSminGuard g) {
stateLabels.put(string, g);
}
public LTSminGuard getStateLabel(String string) {
return stateLabels.get(string);
}
public Set<Entry<String, LTSminGuard>> getLabels() {
return stateLabels.entrySet();
}
public void addTypeValue(String name2, String string, int i) {
if (i != getType(name2).size()) throw new AssertionError("Out of order adding type value "+ name2 +"."+ string +" at "+ i);
addTypeValue(name2, string);
}
public int getEdgeIndex(String edge) {
return edgeLabels.get(edge);
}
private List<Action> actions = null;
public List<Action> getActions() {
if (actions == null) {
// Number actions (filters duplicates and establishes count)
int nActions = 0;
actions = new ArrayList<Action>();
for(LTSminTransition t : getTransitions()) {
for (Action a : t.getActions()) {
if (a.getIndex() == -1) {
a.setIndex(nActions++);
a.setTransition(t);
actions.add(a);
}
}
}
}
return actions;
}
public final ModelFeature<LTSminGuard> GUARDS =
new ModelFeature<LTSminGuard>("Guard") {
public List<LTSminGuard> getInstances() {
return guardInfo.getLabels();
}
};
public final ModelFeature<LTSminTransition> TRANSITIONS =
new ModelFeature<LTSminTransition>("Transition") {
public List<LTSminTransition> getInstances() {
return getTransitions();
}
};
public final ModelFeature<LTSminSlot> SLOTS =
new ModelFeature<LTSminSlot>("Slot") {
public List<LTSminSlot> getInstances() {
return sv.getSlots();
}
};
public final ModelFeature<Action> ACTIONS =
new ModelFeature<Action>("Action") {
public List<Action> getInstances() {
return getActions();
}
};
public void createStateVector(Specification spec, LTSminDebug debug) {
sv = new LTSminStateVector();
sv.createVectorStructs(spec, debug);
}
}
| 29.460751 | 131 | 0.666126 |
d6001fcb13b46a01ec70ede1a18234a62a58baba | 1,896 | package com.savor.operation.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.common.api.utils.DensityUtil;
import com.savor.operation.R;
import java.util.List;
/**
* 首页信息列表
* Created by hezd on 2017/9/5.
*/
public class IndexInfoAdapter extends RecyclerView.Adapter<IndexInfoAdapter.IndexHolder> {
private final Context mContext;
private List<String> mData;
public IndexInfoAdapter(Context context) {
this.mContext = context;
}
public void setData(List<String> data) {
this.mData = data;
notifyDataSetChanged();
}
@Override
public IndexHolder onCreateViewHolder(ViewGroup parent, int viewType) {
IndexHolder holder = new IndexHolder(new TextView(parent.getContext()));
return holder;
}
@Override
public void onBindViewHolder(IndexHolder holder, int position) {
String content = mData.get(position);
holder.textView.setText(content);
int padding15 = DensityUtil.dip2px(mContext, 15);
int padding10 = DensityUtil.dip2px(mContext, 10);
holder.textView.setPadding(padding15,padding10,padding15,padding10);
holder.textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mContext.getResources().getDimensionPixelSize(R.dimen.text_size));
}
@Override
public int getItemCount() {
return mData == null?0:mData.size();
}
public class IndexHolder extends RecyclerView.ViewHolder {
public TextView textView;
public IndexHolder(View itemView) {
super(itemView);
textView = (TextView) itemView;
int padding = DensityUtil.dip2px(mContext,5);
textView.setPadding(padding,0,padding,padding);
}
}
}
| 29.169231 | 130 | 0.69673 |
70bb667e99156d628d879dc1c1b99c655dae803f | 5,225 | package com.jn.kiku.utils.manager;
import android.app.Activity;
import android.app.Application;
import android.content.ComponentCallbacks;
import android.content.res.Configuration;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.DisplayMetrics;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.DecimalFormat;
/**
* @version V1.0
* @ClassName: ${CLASS_NAME}
* @Description: (屏幕适配, 每个界面只能以一个维度来进行适配 - 宽或高)
* @create by: chenwei
* @date 2018/6/29 14:24
*/
public class DensityManager {
public static final int WIDTH = 1;//宽
public static final int HEIGHT = 2;//高
private int DESIGN_WIDTH = 375;//对应设计图屏幕宽度为750px
private int DESIGN_HEIGHT = 667;//对应设计图屏幕高度为1334px
private static DensityManager instance;
private float appDensity;//像素密度比例
private float appScaledDensity;//缩放因子
private DisplayMetrics appDisplayMetrics;//屏幕密度尺寸转换类
@IntDef({WIDTH, HEIGHT})
@Retention(RetentionPolicy.SOURCE)
@interface Orientation {
}
private DensityManager() {
}
public static synchronized DensityManager getInstance() {
if (instance == null)
instance = new DensityManager();
return instance;
}
/**
* 初始化Density
* 默认以750 x 1334的设计图来
*
* @param application Application
*/
public void initDensity(@NonNull final Application application) {
initDensity(application, 0, 0);
}
/**
* 初始化Density
*
* @param application Application
* @param designWidth 设计图宽度(单位:dp)
* @param designHeight 设计图高度(单位:dp)
*/
public void initDensity(@NonNull final Application application, int designWidth, int designHeight) {
//获取application的DisplayMetrics
appDisplayMetrics = application.getResources().getDisplayMetrics();
if (appDensity == 0) {
//初始化的时候赋值
appDensity = appDisplayMetrics.density;
appScaledDensity = appDisplayMetrics.scaledDensity;
//添加字体变化的监听
application.registerComponentCallbacks(new ComponentCallbacks() {
@Override
public void onConfigurationChanged(Configuration newConfig) {
//字体改变后,将appScaledDensity重新赋值
if (newConfig != null && newConfig.fontScale > 0) {
appScaledDensity = application.getResources().getDisplayMetrics().scaledDensity;
}
}
@Override
public void onLowMemory() {
}
});
}
if (designWidth > 0)
DESIGN_WIDTH = designWidth;
if (designHeight > 0)
DESIGN_HEIGHT = designHeight;
}
/**
* 设置Activity默认的适配(基于屏幕宽度)
*
* @param activity Activity
*/
public void setDensity(Activity activity) {
setAppOrientation(activity, WIDTH);
}
/**
* 设置Activity基于某个方向的适配
*
* @param activity Activity
* @param orientation Orientation
*/
public void setDensity(Activity activity, @Orientation int orientation) {
setAppOrientation(activity, orientation);
}
/**
* 设置Activity中的独立像素比、缩放因子及像素比例
*
* @param activity Activity
* @param orientation Orientation(WIDTH | HEIGHT)
*/
private void setAppOrientation(@Nullable Activity activity, @Orientation int orientation) {
float targetDensity = getTargetDensity(orientation);
float targetScaledDensity = targetDensity * (appScaledDensity / appDensity);
int targetDensityDpi = (int) (160 * targetDensity);
/**
*
* 最后在这里将修改过后的值赋给系统参数
*
* 只修改Activity的density值
*/
DisplayMetrics activityDisplayMetrics = activity.getResources().getDisplayMetrics();
activityDisplayMetrics.density = targetDensity;
activityDisplayMetrics.scaledDensity = targetScaledDensity;
activityDisplayMetrics.densityDpi = targetDensityDpi;
}
/**
* 获取最终的像素比例
*
* @param orientation Orientation(WIDTH | HEIGHT)
* @return Float
*/
private float getTargetDensity(@Orientation int orientation) {
float targetDensity = 0;
try {
Double division;
//根据带入参数选择不同的适配方向
if (orientation == WIDTH) {
division = division(appDisplayMetrics.widthPixels, DESIGN_WIDTH);
} else {
division = division(appDisplayMetrics.heightPixels, DESIGN_HEIGHT);
}
//由于手机的长宽不尽相同,肯定会有除不尽的情况,有失精度,所以在这里把所得结果做了一个保留两位小数的操作
DecimalFormat df = new DecimalFormat("0.00");
String s = df.format(division);
targetDensity = Float.parseFloat(s);
} catch (NumberFormatException e) {
e.printStackTrace();
}
return targetDensity;
}
/**
* 获取两个数的商
*
* @param a 除数
* @param b 被除数
* @return
*/
private double division(int a, int b) {
double div = 0;
if (b != 0) {
div = a / b;
}
return div;
}
}
| 29.027778 | 104 | 0.618756 |
0d74a8a95c032e8023408a0f3c6dd2eaceb5117c | 1,330 | package org.fugerit.java.ext.doc;
public class DocPhrase extends DocElement implements DocStyle {
public DocPhrase() {
this.text = "";
}
private int style;
private int size;
private String text;
private String foreColor;
private String backColor;
private String fontName;
private Float leading;
public Float getLeading() {
return leading;
}
public void setLeading(Float leading) {
this.leading = leading;
}
public String getFontName() {
return fontName;
}
public void setFontName(String fontName) {
this.fontName = fontName;
}
@Override
public String getForeColor() {
return foreColor;
}
@Override
public void setForeColor(String foreColor) {
this.foreColor = foreColor;
}
@Override
public String getBackColor() {
return backColor;
}
@Override
public void setBackColor(String backColor) {
this.backColor = backColor;
}
public int getStyle() {
return style;
}
public void setStyle(int style) {
this.style = style;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public String toString() {
return super.toString()+"[text:"+this.getText()+"]";
}
}
| 12.090909 | 63 | 0.67594 |
1053766b2257368865c4486709849cc42aa47933 | 2,563 | package com.medlinker.track.sourcepath.fragment;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import com.heaven7.core.util.BundleHelper;
import com.medlinker.track.sourcepath.TagNode;
import com.medlinker.track.sourcepath.TrackFactory;
import com.medlinker.track.sourcepath.TrackTestUtil;
import com.medlinker.track.sourcepath.demo.R;
import com.medlinker.track.sourcepath.demo.ShowTextActivity;
/**
* Created by heaven7 on 2016/4/28.
*/
public abstract class BaseTrackTestFragment extends BaseFragment{
@Override
protected int getlayoutId() {
return R.layout.frag_track_test;
}
@Override
protected void initView(Context context) {
getViewHelper().setOnClickListener(R.id.bt, new View.OnClickListener() {
public void onClick(View v) {
onClickBt(v);
}
}).setText(R.id.bt, getButtonName())
.setText(R.id.bt_tag , getSmallTagName())
.setOnClickListener(R.id.bt_tag, new View.OnClickListener() {
public void onClick(View v) {
onClickTag(v);
}
});
}
@Override
protected void initData(Context context, Bundle savedInstanceState) {
}
/**
* 进入下一个界面后自动track and untrack.
*/
protected void launchShowTextActivity(String text){
getActivity2().getIntentExecutor().launchActivity(ShowTextActivity.class, new BundleHelper()
.putString(ShowTextActivity.KEY_TEXT, text)
.putInt(ShowTextActivity.KEY_LEVEL, getLevel() + 1)
.getBundle());
}
public void onClickBt(View v){
launchShowTextActivity(getButtonName());
}
public void onClickTag(View v){
// Logger.w(getPageName(),"onClickTag_before_event", TrackFactory.getDefaultTagTracker().mNodes.toString());
TrackFactory.getDefaultTagTracker().trackEvent(TagNode.obtain(
getLevel() + 1 , getSmallTagName()));
}
//----------------------------------
public String getPageName(){
return TrackTestUtil.getName(getClass());
}
protected String getButtonName(){
return TrackTestUtil.getButtonName(getClass());
}
protected String getSmallTagName(){
return TrackTestUtil.getSmallTagName(getClass());
}
protected abstract int getLevel();
//----------------------------------------------------
public void trackThisFragment(){
TrackFactory.getDefaultTagTracker().track(getLevel(), getPageName());
}
}
| 30.152941 | 115 | 0.641046 |
13cfeeb7f1c97a69a2a028836140c0074cca25c6 | 3,599 | package be.nicolasdelp.quoridor.gui;
import java.io.File;
import java.net.URL;
import java.util.ResourceBundle;
import be.nicolasdelp.quoridor.saveload.LoadGame;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
/**
* La class FXMLControllerMenu est le controlleur du menu d'accueil
*
* @author Delplanque Nicolas
*/
public class FXMLControllerMenu implements Initializable {
public static boolean resumeParty = false;
@FXML
private VBox menuWindow;
@FXML
private Button resumeButton, newPartyButton, optionsButton, creditsButton;
@Override
public void initialize(URL location, ResourceBundle resources) {
File f = new File("board.dat");
if(f.exists()){
resumeButton.setVisible(true);
}else{
resumeButton.setVisible(false);
}
}
@FXML
void resumeButtonClicked(MouseEvent event) {
LoadGame.loadGame();
resumeParty = true;
try{
FXMLLoader fxmloader = new FXMLLoader(getClass().getResource("../fxml/quoridorBoard.fxml"));
Parent root = (Parent) fxmloader.load();
Stage secondStage = new Stage();
secondStage.setScene(new Scene(root, 1075, 1000));
secondStage.setResizable(false);
secondStage.setTitle("QUORIDOR");
secondStage.centerOnScreen();
menuWindow.getScene().getWindow().hide();
secondStage.show();
} catch(Exception exception){
System.out.println(exception);
}
}
@FXML
void newPartyButtonClicked(MouseEvent event) {
try{
FXMLLoader fxmloader = new FXMLLoader(getClass().getResource("../fxml/quoridorMenuPlayers.fxml"));
Parent root = (Parent) fxmloader.load();
Stage secondStage = new Stage();
secondStage.setScene(new Scene(root, 835, 450));
secondStage.setResizable(false);
secondStage.setTitle("NOUVELLE PARTIE");
secondStage.centerOnScreen();
menuWindow.getScene().getWindow().hide();
secondStage.show();
} catch(Exception e){
System.out.println(e);
}
}
@FXML
void optionsButtonClicked(MouseEvent event) {
try{
FXMLLoader fxmloader = new FXMLLoader(getClass().getResource("../fxml/quoridorOptions.fxml"));
Parent root = (Parent) fxmloader.load();
Stage secondStage = new Stage();
secondStage.setScene(new Scene(root, 600, 340));
secondStage.setResizable(false);
secondStage.setTitle("CREDITS");
secondStage.centerOnScreen();
secondStage.show();
} catch(Exception e){
System.out.println(e);
}
}
@FXML
void creditsButtonClicked(MouseEvent event) {
try{
FXMLLoader fxmloader = new FXMLLoader(getClass().getResource("../fxml/quoridorCredits.fxml"));
Parent root = (Parent) fxmloader.load();
Stage secondStage = new Stage();
secondStage.setScene(new Scene(root, 600, 340));
secondStage.setResizable(false);
secondStage.setTitle("CREDITS");
secondStage.centerOnScreen();
secondStage.show();
} catch(Exception e){
System.out.println(e);
}
}
} | 32.718182 | 110 | 0.621562 |
24892237447f7eaf772085ebb611dd3b4b3450b5 | 1,131 | package com.ThoughtWorks.DDD.Inventory.interfaces.facade;
import com.ThoughtWorks.DDD.Inventory.domain.shop.Shop;
import com.ThoughtWorks.DDD.Inventory.domain.shop.ShopRepository;
import com.ThoughtWorks.DDD.Inventory.interfaces.DTO.ShopResponse;
import com.ThoughtWorks.DDD.Inventory.interfaces.assembler.ShopAssembler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/api/shops")
public class ShopFacade {
private final ShopRepository shopRepository;
private final ShopAssembler shopAssembler;
@Autowired
public ShopFacade(ShopRepository shopRepository, ShopAssembler shopAssembler) {
this.shopRepository = shopRepository;
this.shopAssembler = shopAssembler;
}
@GetMapping
public final List<ShopResponse> GetShops() {
List<Shop> shops = shopRepository.findAll();
return shopAssembler.toDTO(shops);
}
}
| 33.264706 | 83 | 0.791335 |
5894e226b977df34caaa7fa2c302ebabf6035234 | 1,209 | package br.com.zup.MercadoLivre.integration.util;
import javax.persistence.EntityManager;
import javax.persistence.Query;
public class Persistence<T> {
private final EntityManager em;
private final Class<?> domain;
public Persistence(Class<?> domain, EntityManager em) {
this.domain = domain;
this.em = em;
}
public T getBy(String field, String value) {
Query query = em.createQuery(String.format(
"select c from %s c where c.%s = :value", domain.getName(), field
));
query.setParameter("value", value);
return (T) query.getSingleResult();
}
public T getBy(String field, Integer value) {
Query query = em.createQuery(String.format(
"select c from %s c where c.%s = :value", domain.getName(), field
));
query.setParameter("value", value);
return (T) query.getSingleResult();
}
public T getBy(String field, Enum value) {
Query query = em.createQuery(String.format(
"select c from %s c where c.%s = :value", domain.getName(), field
));
query.setParameter("value", value);
return (T) query.getSingleResult();
}
}
| 26.866667 | 77 | 0.612903 |
944a6be6edf57f52cd8c9ea5e63f8408b0450a98 | 34,343 | /*
* Copyright 2019 Miroslav Pokorny (github.com/mP1)
*
* 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 walkingkooka.spreadsheet;
import org.junit.jupiter.api.Test;
import walkingkooka.HashCodeEqualsDefinedTesting2;
import walkingkooka.ToStringTesting;
import walkingkooka.collect.list.Lists;
import walkingkooka.reflect.ClassTesting2;
import walkingkooka.reflect.JavaVisibility;
import walkingkooka.spreadsheet.parser.SpreadsheetParserToken;
import walkingkooka.text.CharSequences;
import walkingkooka.text.printer.TreePrintableTesting;
import walkingkooka.tree.expression.Expression;
import walkingkooka.tree.expression.ExpressionNumberContexts;
import walkingkooka.tree.expression.ExpressionNumberKind;
import walkingkooka.tree.json.JsonNode;
import walkingkooka.tree.json.JsonPropertyName;
import walkingkooka.tree.json.marshall.JsonNodeMarshallingTesting;
import walkingkooka.tree.json.marshall.JsonNodeUnmarshallContext;
import walkingkooka.tree.json.marshall.JsonNodeUnmarshallContexts;
import walkingkooka.tree.json.patch.PatchableTesting;
import java.math.MathContext;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertNotSame;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertThrows;
public final class SpreadsheetFormulaTest implements ClassTesting2<SpreadsheetFormula>,
HashCodeEqualsDefinedTesting2<SpreadsheetFormula>,
JsonNodeMarshallingTesting<SpreadsheetFormula>,
PatchableTesting<SpreadsheetFormula>,
ToStringTesting<SpreadsheetFormula>,
TreePrintableTesting {
private final static String TEXT = "a+2";
private final static String EXPRESSION = "1+2";
private final static Double VALUE = 3.0;
private final static String ERROR = "Message #1";
private final static String DIFFERENT_TEXT = "99+99";
@Test
public void testWithNullExpressionFails() {
assertThrows(NullPointerException.class, () -> formula(null));
}
@Test
public void testWithNullMaxTextLengthFails() {
assertThrows(IllegalArgumentException.class, () -> formula(CharSequences.repeating(' ', 8192).toString()));
}
@Test
public void testEmpty() {
final SpreadsheetFormula formula = this.createObject();
this.checkText(formula);
this.checkExpressionAbsent(formula);
this.checkValueAbsent(formula);
this.checkErrorAbsent(formula);
}
@Test
public void testWithEmpty() {
final String text = "";
final SpreadsheetFormula formula = formula(text);
this.checkText(formula, text);
}
// SetText..........................................................................................................
@Test
public void testSetTextNullFails() {
assertThrows(NullPointerException.class, () -> this.createObject().setText(null));
}
@Test
public void testSetTextMaxTextLengthFails() {
assertThrows(IllegalArgumentException.class, () -> this.createObject().setText(CharSequences.repeating(' ', 8192).toString()));
}
@Test
public void testSetTextSame() {
final SpreadsheetFormula formula = this.createObject();
assertSame(formula, formula.setText(TEXT));
}
@Test
public void testSetTextDifferent() {
this.setTextAndCheck("different");
}
private void setTextAndCheck(final String differentText) {
final SpreadsheetFormula formula = this.createObject();
final SpreadsheetFormula different = formula.setText(differentText);
assertNotSame(formula, different);
this.checkText(different, differentText);
}
@Test
public void testSetTextDifferent2() {
final SpreadsheetFormula formula = this.createObject();
final String differentText = "different";
final SpreadsheetFormula different = formula.setText(differentText);
assertNotSame(formula, different);
this.checkText(different, differentText);
this.checkTokenAbsent(different);
this.checkExpressionAbsent(different);
this.checkValueAbsent(different);
this.checkErrorAbsent(different);
}
@Test
public void testSetTextDifferentEmpty() {
final SpreadsheetFormula formula = this.createObject();
final String differentText = "different";
final SpreadsheetFormula different = formula.setText(differentText);
assertSame(SpreadsheetFormula.EMPTY, different.setText(""));
}
@Test
public void testSetTextAfterSetExpression() {
final SpreadsheetFormula formula = this.createObject()
.setExpression(this.expression());
final SpreadsheetFormula different = formula.setText(DIFFERENT_TEXT);
assertNotSame(formula, different);
this.checkText(different, DIFFERENT_TEXT);
this.checkTokenAbsent(different);
this.checkExpressionAbsent(different);
this.checkValueAbsent(different);
this.checkErrorAbsent(different);
}
@Test
public void testSetTextAfterSetExpressionSetValue() {
final SpreadsheetFormula formula = this.createObject()
.setExpression(this.expression())
.setValue(this.value());
final SpreadsheetFormula different = formula.setText(DIFFERENT_TEXT);
assertNotSame(formula, different);
this.checkText(different, DIFFERENT_TEXT);
this.checkTokenAbsent(different);
this.checkExpressionAbsent(different);
this.checkValueAbsent(different);
this.checkErrorAbsent(different);
}
// SetToken.....................................................................................................
@SuppressWarnings("OptionalAssignedToNull")
@Test
public void testSetTokenNullFails() {
assertThrows(NullPointerException.class, () -> this.createObject().setToken(null));
}
@Test
public void testSetTokenSame() {
final SpreadsheetFormula formula = this.createObject();
assertSame(formula, formula.setToken(formula.token()));
}
@Test
public void testSetTokenDifferent() {
final SpreadsheetFormula formula = this.createObject();
final Optional<SpreadsheetParserToken> differentToken = this.token("different!");
final SpreadsheetFormula different = formula.setToken(differentToken);
assertNotSame(formula, different);
this.checkText(different, TEXT);
this.checkToken(different, differentToken);
this.checkExpressionAbsent(different); // should also clear expression, value, error
this.checkValueAbsent(different);
this.checkErrorAbsent(different);
}
// SetExpression.....................................................................................................
@SuppressWarnings("OptionalAssignedToNull")
@Test
public void testSetExpressionNullFails() {
assertThrows(NullPointerException.class, () -> this.createObject().setExpression(null));
}
@Test
public void testSetExpressionSame() {
final SpreadsheetFormula formula = this.createObject();
assertSame(formula, formula.setExpression(formula.expression()));
}
@Test
public void testSetExpressionDifferent() {
final SpreadsheetFormula formula = this.createObject()
.setToken(this.token());
final Optional<Expression> differentExpression = Optional.of(Expression.string("different!"));
final SpreadsheetFormula different = formula.setExpression(differentExpression);
assertNotSame(formula, different);
this.checkText(different, TEXT);
this.checkToken(different);
this.checkExpression(different, differentExpression);
this.checkValueAbsent(different);
this.checkErrorAbsent(different);
}
@Test
public void testSetExpressionDifferentAndClear() {
final SpreadsheetFormula formula = this.createObject()
.setToken(this.token())
.setExpression(this.expression());
final Optional<Expression> differentExpression = SpreadsheetFormula.NO_EXPRESSION;
final SpreadsheetFormula different = formula.setExpression(differentExpression);
assertNotSame(formula, different);
this.checkText(different, TEXT);
this.checkToken(different);
this.checkExpressionAbsent(different);
this.checkValueAbsent(different);
this.checkErrorAbsent(different);
}
@Test
public void testSetExpressionDifferentAfterSetValue() {
final SpreadsheetFormula formula = this.createObject()
.setToken(this.token())
.setExpression(this.expression())
.setValue(this.value());
final Optional<Expression> differentExpression = Optional.of(Expression.string("different!"));
final SpreadsheetFormula different = formula.setExpression(differentExpression);
assertNotSame(formula, different);
this.checkText(different, TEXT);
this.checkToken(different);
this.checkExpression(different, differentExpression);
this.checkValueAbsent(different);
this.checkErrorAbsent(different);
}
// SetError..........................................................................................................
@SuppressWarnings("OptionalAssignedToNull")
@Test
public void testSetErrorNullFails() {
assertThrows(NullPointerException.class, () -> this.createObject().setError(null));
}
@Test
public void testSetErrorSame() {
final SpreadsheetFormula formula = this.createObject();
assertSame(formula, formula.setError(formula.error()));
}
@Test
public void testSetErrorDifferent() {
final SpreadsheetFormula formula = this.createObject()
.setToken(this.token());
final Optional<SpreadsheetError> differentError = this.error("different");
final SpreadsheetFormula different = formula.setError(differentError);
assertNotSame(formula, different);
this.checkText(different, TEXT);
this.checkToken(different);
this.checkExpressionAbsent(different);
this.checkValueAbsent(different);
this.checkError(different, differentError);
}
@Test
public void testSetErrorDifferent2() {
final SpreadsheetFormula formula = this.createObject()
.setToken(this.token())
.setError(this.error());
final Optional<SpreadsheetError> differentError = this.error("different");
final SpreadsheetFormula different = formula.setError(differentError);
assertNotSame(formula, different);
this.checkText(different, TEXT);
this.checkToken(different);
this.checkExpressionAbsent(different);
this.checkValueAbsent(different);
this.checkError(different, differentError);
}
@Test
public void testSetErrorDifferentAfterSetValue() {
final SpreadsheetFormula formula = this.createObject()
.setToken(this.token())
.setValue(this.value());
final Optional<SpreadsheetError> differentError = this.error("different");
final SpreadsheetFormula different = formula.setError(differentError);
assertNotSame(formula, different);
this.checkText(different, TEXT);
this.checkToken(different);
this.checkExpressionAbsent(different);
this.checkValueAbsent(different);
this.checkError(different, differentError);
}
// clear.......................................................................................................
@Test
public void testClearText() {
final SpreadsheetFormula formula = formula("1+99");
final SpreadsheetFormula cleared = formula.clear();
assertSame(formula, cleared);
this.checkClear(cleared);
}
@Test
public void testClearTextAndToken() {
final SpreadsheetFormula formula = formula("1+99")
.setToken(this.token());
final SpreadsheetFormula cleared = formula.clear();
assertSame(formula, cleared);
this.checkClear(cleared);
}
@Test
public void testClearTextTokenExpression() {
final SpreadsheetFormula formula = formula("1+99")
.setToken(this.token())
.setExpression(this.expression());
final SpreadsheetFormula cleared = formula.clear();
assertNotSame(formula, cleared);
this.checkClear(cleared);
}
@Test
public void testClearTextTokenExpressionValue() {
final SpreadsheetFormula formula = formula("1+99")
.setToken(this.token())
.setExpression(this.expression())
.setValue(this.value());
final SpreadsheetFormula cleared = formula.clear();
assertNotSame(formula, cleared);
this.checkClear(cleared);
}
@Test
public void testClearTextTokenExpressionError() {
final SpreadsheetFormula formula = formula("1+99")
.setToken(this.token())
.setExpression(this.expression())
.setError(this.error());
final SpreadsheetFormula cleared = formula.clear();
assertNotSame(formula, cleared);
this.checkClear(cleared);
}
private void checkClear(final SpreadsheetFormula formula) {
this.checkExpressionAbsent(formula);
this.checkValueAbsent(formula);
this.checkErrorAbsent(formula);
}
// TreePrintable.....................................................................................................
@Test
public void testTreePrintText() {
this.treePrintAndCheck(
formula("1+2"),
"Formula\n" +
" text: \"1+2\"\n"
);
}
@Test
public void testTreePrintTextToken() {
this.treePrintAndCheck(
formula("1+2")
.setToken(this.token()),
"Formula\n" +
" text: \"1+2\"\n" +
" token:\n" +
" SpreadsheetText\n" +
" SpreadsheetTextLiteral \"1+2\" \"1+2\" (java.lang.String)\n"
);
}
@Test
public void testTreePrintTextTokenExpression() {
this.treePrintAndCheck(
formula("1+2")
.setToken(this.token())
.setExpression(this.expression()),
"Formula\n" +
" text: \"1+2\"\n" +
" token:\n" +
" SpreadsheetText\n" +
" SpreadsheetTextLiteral \"1+2\" \"1+2\" (java.lang.String)\n" +
" expression:\n" +
" StringExpression \"1+2\"\n"
);
}
@Test
public void testTreePrintTextTokenExpressionValue() {
this.treePrintAndCheck(
formula("1+2")
.setToken(this.token())
.setExpression(this.expression())
.setValue(this.value()),
"Formula\n" +
" text: \"1+2\"\n" +
" token:\n" +
" SpreadsheetText\n" +
" SpreadsheetTextLiteral \"1+2\" \"1+2\" (java.lang.String)\n" +
" expression:\n" +
" StringExpression \"1+2\"\n" +
" value: 3.0 (java.lang.Double)\n"
);
}
@Test
public void testTreePrintTextTokenExpressionError() {
this.treePrintAndCheck(
formula("1+2")
.setToken(this.token())
.setExpression(this.expression())
.setError(this.error()),
"Formula\n" +
" text: \"1+2\"\n" +
" token:\n" +
" SpreadsheetText\n" +
" SpreadsheetTextLiteral \"1+2\" \"1+2\" (java.lang.String)\n" +
" expression:\n" +
" StringExpression \"1+2\"\n" +
" error: \"Message #1\"\n"
);
}
// equals.......................................................................................................
@Test
public void testEqualsDifferentText() {
checkNotEquals(
this.createFormula(
"99+88",
this.token(),
this.expression(),
this.value(),
this.error()
)
);
}
@Test
public void testEqualsDifferentToken() {
checkNotEquals(
this.createFormula(
TEXT,
this.token("different"),
this.expression(),
this.value(),
this.error()
)
);
}
@Test
public void testEqualsDifferentExpression() {
checkNotEquals(
this.createFormula(
TEXT,
this.token(),
this.expression("44"),
this.value(),
this.error()
)
);
}
@Test
public void testEqualsDifferentValue() {
checkNotEquals(
this.createFormula(
TEXT,
this.token(),
this.expression(),
this.value(),
SpreadsheetFormula.NO_ERROR
),
this.createFormula(
TEXT,
this.token(),
this.expression(),
this.value("different-value"),
SpreadsheetFormula.NO_ERROR
)
);
}
@Test
public void testEqualsDifferentError() {
checkNotEquals(
this.createFormula(TEXT,
this.token(),
this.expression(),
this.value(),
this.error("different error message"))
);
}
@Test
public void testEqualsDifferentSpreadsheetFormula() {
this.checkNotEquals(formula("different"));
}
private SpreadsheetFormula createFormula(final String formula,
final Optional<SpreadsheetParserToken> token,
final Optional<Expression> expression,
final Optional<Object> value,
final Optional<SpreadsheetError> error) {
return formula(formula)
.setToken(token)
.setExpression(expression)
.setValue(value)
.setError(error);
}
// JsonNodeMarshallingTesting...........................................................................................
@Test
public void testJsonNodeUnmarshallBooleanFails() {
this.unmarshallFails(JsonNode.booleanNode(true));
}
@Test
public void testJsonNodeUnmarshallNumberFails() {
this.unmarshallFails(JsonNode.number(12));
}
@Test
public void testJsonNodeUnmarshallArrayFails() {
this.unmarshallFails(JsonNode.array());
}
@Test
public void testJsonNodeUnmarshallStringFails() {
this.unmarshallFails(JsonNode.string("fails"));
}
@Test
public void testJsonNodeUnmarshallObjectEmptyFails() {
this.unmarshallFails(JsonNode.object());
}
@Test
public void testJsonNodeUnmarshallText() {
this.unmarshallAndCheck(JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string(TEXT)),
formula(TEXT));
}
@Test
public void testJsonNodeUnmarshallTextAndToken() {
final Optional<SpreadsheetParserToken> token = this.token();
this.unmarshallAndCheck(JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string(TEXT))
.set(SpreadsheetFormula.TOKEN_PROPERTY, this.marshallContext().marshallWithType(token.get())),
formula(TEXT)
.setToken(token)
);
}
@Test
public void testJsonNodeUnmarshallTextAndExpression() {
final Optional<Expression> expression = this.expression();
this.unmarshallAndCheck(JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string(TEXT))
.set(SpreadsheetFormula.EXPRESSION_PROPERTY, this.marshallContext().marshallWithType(expression.get())),
formula(TEXT)
.setExpression(expression)
);
}
@Test
public void testJsonNodeUnmarshallTextTokenAndExpression() {
final Optional<SpreadsheetParserToken> token = this.token();
final Optional<Expression> expression = this.expression();
this.unmarshallAndCheck(JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string(TEXT))
.set(SpreadsheetFormula.TOKEN_PROPERTY, this.marshallContext().marshallWithType(token.get()))
.set(SpreadsheetFormula.EXPRESSION_PROPERTY, this.marshallContext().marshallWithType(expression.get())),
formula(TEXT)
.setToken(token)
.setExpression(expression)
);
}
@Test
public void testJsonNodeUnmarshallTextAndError() {
final SpreadsheetError error = SpreadsheetError.with(ERROR);
this.unmarshallAndCheck(JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string(TEXT))
.set(SpreadsheetFormula.ERROR_PROPERTY, this.marshallContext().marshall(error)),
formula(TEXT).setError(Optional.of(error)));
}
@Test
public void testJsonNodeUnmarshallTextAndValue() {
this.unmarshallAndCheck(JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string(TEXT))
.set(SpreadsheetFormula.VALUE_PROPERTY, JsonNode.number(VALUE)),
formula(TEXT).setValue(Optional.of(VALUE)));
}
@Test
public void testJsonNodeUnmarshallTextAndErrorAndValueFails() {
this.unmarshallFails(JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string(TEXT))
.set(SpreadsheetFormula.VALUE_PROPERTY, JsonNode.string("1"))
.set(SpreadsheetFormula.ERROR_PROPERTY, this.marshallContext().marshall(SpreadsheetError.with(ERROR))));
}
// marshall.......................................................................................................
@Test
public void testJsonNodeMarshallText() {
this.marshallAndCheck(formula(TEXT),
"{ \"text\": \"a+2\"}");
}
@Test
public void testJsonNodeMarshallTextAndToken() {
this.marshallAndCheck(formula(TEXT)
.setToken(this.token()),
"{\n" +
" \"text\": \"a+2\",\n" +
" \"token\": {\n" +
" \"type\": \"spreadsheet-text-parser-token\",\n" +
" \"value\": {\n" +
" \"value\": [{\n" +
" \"type\": \"spreadsheet-text-literal-parser-token\",\n" +
" \"value\": {\n" +
" \"value\": \"1+2\",\n" +
" \"text\": \"1+2\"\n" +
" }\n" +
" }],\n" +
" \"text\": \"1+2\"\n" +
" }\n" +
" }\n" +
"}");
}
@Test
public void testJsonNodeMarshallTextAndExpression() {
this.marshallAndCheck(formula(TEXT)
.setExpression(this.expression()),
"{\n" +
" \"text\": \"a+2\",\n" +
" \"expression\": {\n" +
" \"type\": \"string-expression\",\n" +
" \"value\": \"1+2\"\n" +
" }\n" +
"}");
}
@Test
public void testJsonNodeMarshallTextTokenAndExpression() {
this.marshallAndCheck(formula(TEXT)
.setToken(this.token())
.setExpression(this.expression()),
"{\n" +
" \"text\": \"a+2\",\n" +
" \"token\": {\n" +
" \"type\": \"spreadsheet-text-parser-token\",\n" +
" \"value\": {\n" +
" \"value\": [{\n" +
" \"type\": \"spreadsheet-text-literal-parser-token\",\n" +
" \"value\": {\n" +
" \"value\": \"1+2\",\n" +
" \"text\": \"1+2\"\n" +
" }\n" +
" }],\n" +
" \"text\": \"1+2\"\n" +
" }\n" +
" },\n" +
" \"expression\": {\n" +
" \"type\": \"string-expression\",\n" +
" \"value\": \"1+2\"\n" +
" }\n" +
"}");
}
@Test
public void testJsonNodeMarshallTextAndValue() {
this.marshallAndCheck(formula(TEXT)
.setValue(Optional.of(123L)),
JsonNode.object()
.set(JsonPropertyName.with("text"), JsonNode.string("a+2"))
.set(JsonPropertyName.with("value"), this.marshallContext().marshallWithType(123L)));
}
@Test
public void testJsonNodeMarshallTextAndValue2() {
this.marshallAndCheck(formula(TEXT)
.setValue(Optional.of("abc123")),
"{ \"text\": \"a+2\", \"value\": \"abc123\"}");
}
@Test
public void testJsonNodeMarshallTextAndError() {
this.marshallAndCheck(formula(TEXT)
.setError(Optional.of(SpreadsheetError.with("error123"))),
"{ \"text\": \"a+2\", \"error\": \"error123\"}");
}
@Test
public void testJsonNodeMarshallRoundtripTwice() {
this.marshallRoundTripTwiceAndCheck(this.createObject());
}
@Test
public void testJsonNodeMarshallRoundtripTextAndValue() {
this.marshallRoundTripTwiceAndCheck(formula(TEXT)
.setValue(Optional.of(123L)));
}
@Test
public void testJsonNodeMarshallRoundtripTextValueAndExpression() {
this.marshallRoundTripTwiceAndCheck(formula(TEXT)
.setValue(Optional.of(123L))
.setExpression(this.expression()));
}
@Test
public void testJsonNodeMarshallRoundtripTextAndError() {
this.marshallRoundTripTwiceAndCheck(formula(TEXT)
.setError(Optional.of(SpreadsheetError.with("error message #1"))));
}
// patch............................................................................................................
@Test
public void testPatchEmptyObject() {
this.patchAndCheck(
this.createPatchable(),
JsonNode.object()
);
}
@Test
public void testPatchSameText() {
this.patchAndCheck(
formula("=1"),
JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string("=1"))
);
}
@Test
public void testPatchDifferentText() {
this.patchAndCheck(
formula("=1"),
JsonNode.object()
.set(SpreadsheetFormula.TEXT_PROPERTY, JsonNode.string("=2")),
formula("=2")
);
}
@Test
public void testPatchSetInvalidProperty() {
this.patchInvalidPropertyFails(
formula("=1"),
JsonNode.object()
.set(SpreadsheetFormula.VALUE_PROPERTY, JsonNode.nullNode()),
SpreadsheetFormula.VALUE_PROPERTY,
JsonNode.nullNode()
);
}
// PatchableTesting.................................................................................................
@Override
public SpreadsheetFormula createPatchable() {
return this.createObject();
}
@Override
public JsonNode createPatch() {
return JsonNode.object();
}
@Override
public JsonNodeUnmarshallContext createPatchContext() {
return JsonNodeUnmarshallContexts.basic(
ExpressionNumberContexts.basic(ExpressionNumberKind.BIG_DECIMAL, MathContext.UNLIMITED)
);
}
// toString...............................................................................................
@Test
public void testToStringWithValue() {
this.toStringAndCheck(this.createObject().setValue(this.value(VALUE)),
TEXT + " (=" + VALUE + ")");
}
@Test
public void testToStringWithError() {
this.toStringAndCheck(this.createObject().setError(this.error(ERROR)),
TEXT + " (" + ERROR + ")");
}
@Test
public void testToStringWithoutError() {
this.toStringAndCheck(this.createObject(), TEXT);
}
@Override
public SpreadsheetFormula createObject() {
return formula(TEXT);
}
private SpreadsheetFormula formula(final String text) {
return SpreadsheetFormula.EMPTY
.setText(text);
}
private void checkText(final SpreadsheetFormula formula) {
checkText(formula, TEXT);
}
private void checkText(final SpreadsheetFormula formula,
final String text) {
this.checkEquals(text, formula.text(), "text(Expression)");
}
private Optional<SpreadsheetParserToken> token() {
return this.token(EXPRESSION);
}
private Optional<SpreadsheetParserToken> token(final String text) {
return Optional.of(
SpreadsheetParserToken.text(
Lists.of(
SpreadsheetParserToken.textLiteral(text, text)
),
text
)
);
}
private void checkToken(final SpreadsheetFormula formula) {
this.checkToken(formula, this.token());
}
private void checkTokenAbsent(final SpreadsheetFormula formula) {
this.checkToken(formula, SpreadsheetFormula.NO_TOKEN);
}
private void checkToken(final SpreadsheetFormula formula, final Optional<SpreadsheetParserToken> token) {
this.checkEquals(token, formula.token(), "token");
}
private Optional<Expression> expression() {
return this.expression(EXPRESSION);
}
private Optional<Expression> expression(final String text) {
return Optional.of(Expression.string(text));
}
private void checkExpression(final SpreadsheetFormula formula, final Optional<Expression> expression) {
this.checkEquals(expression, formula.expression(), "expression");
}
private void checkExpressionAbsent(final SpreadsheetFormula formula) {
this.checkExpression(formula, SpreadsheetFormula.NO_EXPRESSION);
}
private Optional<Object> value() {
return this.value(VALUE);
}
private Optional<Object> value(final Object value) {
return Optional.of(value);
}
private void checkValue(final SpreadsheetFormula formula, final Optional<Object> value) {
this.checkEquals(value, formula.value(), "value");
}
private void checkValueAbsent(final SpreadsheetFormula formula) {
this.checkValue(formula, SpreadsheetFormula.NO_VALUE);
}
private Optional<SpreadsheetError> error() {
return this.error(ERROR);
}
private Optional<SpreadsheetError> error(final String error) {
return Optional.of(SpreadsheetError.with(error));
}
private void checkErrorAbsent(final SpreadsheetFormula formula) {
this.checkError(formula, SpreadsheetFormula.NO_ERROR);
}
private void checkError(final SpreadsheetFormula formula, final Optional<SpreadsheetError> error) {
this.checkEquals(error, formula.error(), "formula");
}
@Override
public Class<SpreadsheetFormula> type() {
return SpreadsheetFormula.class;
}
@Override
public JavaVisibility typeVisibility() {
return JavaVisibility.PUBLIC;
}
// JsonNodeMarshallingTesting...........................................................................................
@Override
public SpreadsheetFormula createJsonNodeMarshallingValue() {
return this.createObject();
}
@Override
public SpreadsheetFormula unmarshall(final JsonNode jsonNode,
final JsonNodeUnmarshallContext context) {
return SpreadsheetFormula.unmarshall(jsonNode, context);
}
}
| 35.811262 | 135 | 0.560231 |
eb9c81f666ad9663d7d8b8fca14f2beebdfd8f4f | 1,897 | package com.github.dzieciou.testing.curl;
import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.MatcherAssert.assertThat;
import com.github.valfirst.slf4jtest.LoggingEvent;
import com.github.valfirst.slf4jtest.TestLoggerFactory;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.testng.annotations.Test;
public class UsingWithHttpClientTest {
@Test(groups = "end-to-end-samples")
public void testHttp() throws IOException {
TestLoggerFactory.clearAll();
HttpGet getRequest = new HttpGet("http://google.com");
createHttpClient().execute(getRequest);
assertThat(
getAllLoggedMessages(),
hasItem("curl 'http://google.com/' --compressed --insecure --verbose"));
}
@Test(groups = "end-to-end-samples")
public void testHttps() throws IOException {
TestLoggerFactory.clearAll();
HttpGet getRequest = new HttpGet("https://google.com");
createHttpClient().execute(getRequest);
assertThat(
getAllLoggedMessages(),
hasItem("curl 'https://google.com/' --compressed --insecure --verbose"));
}
private static HttpClient createHttpClient() {
return HttpClientBuilder.create()
.addInterceptorFirst(
new CurlGeneratingInterceptor(
Options.builder()
.targetPlatform(Platform.UNIX) // TO ease verifying output curl
.build(),
Collections.singletonList(new CurlLogger())))
.build();
}
private static List<String> getAllLoggedMessages() {
return TestLoggerFactory.getAllLoggingEvents().stream()
.map(LoggingEvent::getMessage)
.collect(Collectors.toList());
}
}
| 33.875 | 83 | 0.705851 |
0eb82e30603a5108517f9e987c7d30f45d0d5fcb | 1,722 | package com.google.pubsublite.kafka.sink;
import com.google.cloud.pubsublite.CloudZone;
import com.google.cloud.pubsublite.ProjectPath;
import com.google.cloud.pubsublite.PublishMetadata;
import com.google.cloud.pubsublite.TopicName;
import com.google.cloud.pubsublite.TopicPath;
import com.google.cloud.pubsublite.internal.Publisher;
import com.google.cloud.pubsublite.internal.wire.PubsubContext;
import com.google.cloud.pubsublite.internal.wire.PubsubContext.Framework;
import com.google.cloud.pubsublite.internal.wire.RoutingPublisherBuilder;
import com.google.cloud.pubsublite.internal.wire.SinglePartitionPublisherBuilder;
import java.util.Map;
import org.apache.kafka.common.config.ConfigValue;
class PublisherFactoryImpl implements PublisherFactory {
private static final Framework FRAMEWORK = Framework.of("KAFKA_CONNECT");
@Override
public Publisher<PublishMetadata> newPublisher(Map<String, String> params) {
Map<String, ConfigValue> config = ConfigDefs.config().validateAll(params);
RoutingPublisherBuilder.Builder builder = RoutingPublisherBuilder.newBuilder();
TopicPath topic = TopicPath.newBuilder()
.setProject(ProjectPath.parse("projects/" + config.get(ConfigDefs.PROJECT_FLAG).value()).project())
.setLocation(CloudZone.parse(config.get(ConfigDefs.LOCATION_FLAG).value().toString()))
.setName(TopicName.of(config.get(ConfigDefs.TOPIC_NAME_FLAG).value().toString())).build();
builder.setTopic(topic);
builder.setPublisherFactory(
partition -> SinglePartitionPublisherBuilder.newBuilder().setTopic(topic)
.setPartition(partition).setContext(
PubsubContext.of(FRAMEWORK)).build());
return builder.build();
}
}
| 47.833333 | 107 | 0.783972 |
300f565bbfd45a0225db13899b01d5fe1502d66f | 3,367 | package joshie.enchiridion.wiki.gui;
import static joshie.enchiridion.wiki.WikiHelper.drawScaledText;
import static joshie.enchiridion.wiki.WikiHelper.getPage;
import static joshie.enchiridion.wiki.WikiHelper.horizontalGradient;
import static joshie.enchiridion.wiki.WikiHelper.mouseX;
import static joshie.enchiridion.wiki.WikiHelper.mouseY;
import static joshie.enchiridion.wiki.WikiHelper.verticalGradient;
import java.util.ArrayList;
import joshie.enchiridion.ETranslate;
import joshie.enchiridion.helpers.ClientHelper;
import joshie.enchiridion.wiki.WikiHelper;
import joshie.enchiridion.wiki.elements.Element;
public class GuiLayers extends GuiExtension {
private static boolean SHOW_LAYERS = false;
private static int layerPosition = 0;
public static void clear() {
GuiLayers.SHOW_LAYERS = false;
}
public static void setActive(boolean isEditMode) {
GuiLayers.SHOW_LAYERS = isEditMode;
}
@Override
public void draw() {
if (SHOW_LAYERS) {
if (getPage().getSelected() == null) {
verticalGradient(5, 44, 270, 75, 0xFF1A2738, 0xFF255174);
horizontalGradient(5, 75, 270, 78, 0xFFC2C29C, 0xFFC2C29C);
verticalGradient(5, 78, 270, 80, 0xFF172A39, 0xFF091D28);
drawScaledText(2F, ETranslate.translate("layers"), 15, 53, 0xFFC2C29C);
int pageY = -40;
ArrayList<Element> elements = getPage().getData().getComponents();
for (int i = layerPosition; i < Math.min(elements.size(), layerPosition + ((WikiHelper.getHeight() - 220) / 40)); i++) {
int[] colors = getContentBGColors(pageY);
drawContentBox(elements.get(i).getTitle(), pageY, colors[0], colors[1]);
pageY += 40;
}
pageY += 40;
}
}
}
@Override
public void clicked(int button) {
if (SHOW_LAYERS) {
if (mouseX >= 5 && mouseX <= 245) {
if (getPage().getSelected() == null) {
int pageY = -40;
ArrayList<Element> elements = getPage().getData().getComponents();
for (int i = layerPosition; i < Math.min(elements.size(), layerPosition + ((WikiHelper.getHeight() - 220) / 40)); i++) {
if (mouseY >= pageY + 80 + 38 && mouseY <= 80 + pageY + 80) {
if (ClientHelper.isShiftPressed()) {
getPage().getData().moveDown(elements.get(i));
} else getPage().getData().moveUp(elements.get(i));
break;
}
pageY += 40;
}
pageY += 40;
}
}
}
}
@Override
public void scroll(boolean scrolledDown) {
if (SHOW_LAYERS) {
if (mouseX >= 5 && mouseX <= 245) {
if (scrolledDown) {
this.layerPosition++;
this.layerPosition = Math.min(layerPosition, getPage().getData().getComponents().size() - 1);
} else {
this.layerPosition--;
this.layerPosition = Math.max(layerPosition, 0);
}
}
}
}
}
| 37.411111 | 140 | 0.550045 |
300afba83cc5e28c8ca4ff277a826b9a8b876cd6 | 3,046 | package cz.metacentrum.perun.webgui.json.registrarManager;
import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import cz.metacentrum.perun.webgui.client.PerunWebSession;
import cz.metacentrum.perun.webgui.client.resources.PerunEntity;
import cz.metacentrum.perun.webgui.json.JsonCallbackEvents;
import cz.metacentrum.perun.webgui.json.JsonPostClient;
import cz.metacentrum.perun.webgui.model.PerunError;
/**
* Request, which copy application form from VO to VO
*
* @author Pavel Zlamal <[email protected]>
*/
public class CopyForm {
// web session
private PerunWebSession session = PerunWebSession.getInstance();
// URL to call
final String JSON_URL = "registrarManager/copyForm";
// custom events
private JsonCallbackEvents events = new JsonCallbackEvents();
private int fromId;
private int toId;
private PerunEntity entityFrom;
private PerunEntity entityTo;
/**
* Creates a new request
*
* @param fromId
* @param toId
*/
public CopyForm(PerunEntity entityFrom, int fromId, PerunEntity entityTo, int toId) {
this.entityFrom = entityFrom;
this.entityTo = entityTo;
this.fromId = fromId;
this.toId = toId;
}
/**
* Creates a new request with custom events
*
* @param fromId
* @param toId
* @param events Custom events
*/
public CopyForm(PerunEntity entityFrom, int fromId, PerunEntity entityTo, int toId, JsonCallbackEvents events) {
this.entityFrom = entityFrom;
this.fromId = fromId;
this.entityTo = entityTo;
this.toId = toId;
this.events = events;
}
/**
* Send request to copy form
*/
public void copyForm() {
// test arguments
if(!this.testCreating()){
return;
}
// new events
JsonCallbackEvents newEvents = new JsonCallbackEvents(){
public void onError(PerunError error) {
session.getUiElements().setLogErrorText("Copying form failed.");
events.onError(error);
};
public void onFinished(JavaScriptObject jso) {
session.getUiElements().setLogSuccessText("Form successfully copied.");
events.onFinished(jso);
};
public void onLoadingStart() {
events.onLoadingStart();
};
};
// sending data
JsonPostClient jspc = new JsonPostClient(newEvents);
jspc.sendData(JSON_URL, prepareJSONObject());
}
private boolean testCreating() {
// TODO Auto-generated method stub
return true;
}
/**
* Prepares a JSON object.
* @return JSONObject - the whole query
*/
private JSONObject prepareJSONObject() {
// query
JSONObject query = new JSONObject();
if (PerunEntity.VIRTUAL_ORGANIZATION.equals(entityFrom)) {
query.put("fromVo", new JSONNumber(fromId));
} else if (PerunEntity.GROUP.equals(entityFrom)) {
query.put("fromGroup", new JSONNumber(fromId));
}
if (PerunEntity.VIRTUAL_ORGANIZATION.equals(entityTo)) {
query.put("toVo", new JSONNumber(toId));
} else if (PerunEntity.GROUP.equals(entityTo)) {
query.put("toGroup", new JSONNumber(toId));
}
return query;
}
} | 23.075758 | 113 | 0.721274 |
6b2cb21aae1607c4cf6648b9f9bb67664b573c8b | 760 | package cvut.fit.borrowsystem;
import com.mongodb.Mongo;
import com.mongodb.MongoClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
/**
* Mongo DB configuration class.
* Created by Jakub Tuček on 3.4.2016.
*/
@Configuration
@EnableMongoRepositories
public class SpringMongoConfig extends AbstractMongoConfiguration {
@Override
public String getDatabaseName() {
return "librarydb";
}
@Override
@Bean
public Mongo mongo() throws Exception {
return new MongoClient("127.0.0.1");
}
}
| 25.333333 | 82 | 0.765789 |
02eb5ab47548b64b07209ce67c6c6d9f591e3bf1 | 966 | package cn.liuawen.service;
import cn.liuawen.PindongdongApplicationTests;
import cn.liuawen.enums.ResponseEnum;
import cn.liuawen.vo.CategoryVo;
import cn.liuawen.vo.ResponseVo;
import lombok.extern.slf4j.Slf4j;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author : Liu Awen Email:[email protected]
* @create : 2020-03-04
*/
@Slf4j
public class CategoryServiceTest extends PindongdongApplicationTests {
@Autowired
private ICategoryService categoryService;
@Test
public void selectAll() {
ResponseVo<List<CategoryVo>> responseVo = categoryService.selectAll();
Assert.assertEquals(ResponseEnum.SUCCESS.getCode(), responseVo.getStatus());
}
@Test
public void findSubCategoryId() {
Set<Integer> set = new HashSet<>();
categoryService.findSubCategoryId(100001, set);
log.info("set={}", set);
}
} | 24.769231 | 78 | 0.772257 |
dd88236dfbe4c69232d1f4df59fb7c9ff5160c2d | 1,535 | package org.tcsaroundtheworld.admin.server;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.cache.Cache;
import javax.cache.CacheException;
import javax.cache.CacheManager;
import org.tcsaroundtheworld.admin.client.AdminService;
import org.tcsaroundtheworld.admin.shared.FamilyFull;
import org.tcsaroundtheworld.common.server.db.DAO;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* The server side implementation of the RPC service.
*/
@SuppressWarnings("serial")
public class AdminServiceImpl extends RemoteServiceServlet implements AdminService {
DAO dao = new DAO();
Logger log = Logger.getLogger(AdminServiceImpl.class.getName());
public void clearMemcache() {
try {
final Cache cache = CacheManager.getInstance().getCacheFactory().createCache(Collections.emptyMap());
cache.clear();
} catch (final CacheException e) {
log.log(Level.WARNING, "Failed to clear memcache", e);
throw new RuntimeException(e);
}
}
public List<FamilyFull> getFamilies() {
return dao.getFamiliesForAdmin();
}
public void enablePerson(final long familyId, final long id, final Boolean value) {
dao.enablePerson(familyId, id, value);
}
public void approveFamily(final long id) {
dao.approveFamily(id);
}
public void deletePerson(final long id) {
dao.deletePerson(id);
}
public void deleteFamily(final long id) {
dao.deleteFamily(id);
}
}
| 25.583333 | 105 | 0.732248 |
4362eed4ee73f0f5356c4d120eeb377d38db114d | 1,466 | package instantcoffee.cinemaxx.dto;
import instantcoffee.cinemaxx.entities.Movie;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.modelmapper.ModelMapper;
import java.util.List;
import java.util.stream.Collectors;
@NoArgsConstructor
@Getter
@Setter
public class MovieDTOCustomer {
private String title;
private String description;
private int ageRestriction;
private int rating;
List<ActorDTO> actors;
private String image;
private String poster;
private String trailer;
public MovieDTOCustomer(Movie movie) {
this.title = movie.getTitle();
this.description = movie.getDescription();
this.ageRestriction = movie.getAgeRestriction();
this.rating = movie.getRating();
actors = movie.getActors().stream().map(actor -> new ActorDTO(actor.getFirstName(), actor.getLastName())).collect(Collectors.toList());
this.image = movie.getImage();
this.poster = movie.getPoster();
this.trailer = movie.getTrailer();
}
private static ModelMapper modelMapper = new ModelMapper();
public static MovieDTOCustomer entityToDTO(Movie movie) {
MovieDTOCustomer movieDTO = modelMapper.map(movie, MovieDTOCustomer.class);
return movieDTO;
}
public static List<MovieDTOCustomer> entityToDTO(List<Movie> movies) {
return movies.stream().map(x -> entityToDTO(x)).collect(Collectors.toList());
}
}
| 29.918367 | 143 | 0.712142 |
c6cf341cfd19e9a9612716266ab1ed4055059718 | 12,959 | package com.webleader.appms.util.image;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.stream.ImageOutputStream;
public class ImageUtils {
private File srcFile;
private File destFile;
private double angle;
private float quality;
private double scale;
private int width;
private int height;
private int givenWidth;
private int givenHeight;
private boolean fixedGivenSize;
private Color bgcolor;
private boolean keepRatio;
private ArrayList<Watermark> watermarkArr;
public ImageUtils(File srcFile) {
this.srcFile = srcFile;
}
/**
* 初始化图片属性
*/
private void init() {
this.destFile = null;
this.angle = 0d;
this.quality = 0.75f;
this.scale = 0d;
this.width = 0;
this.height = 0;
this.fixedGivenSize = false;
this.keepRatio = false;
this.bgcolor = Color.BLACK;
this.watermarkArr = new ArrayList<Watermark>();
}
public ImageUtils keepRatio(boolean keepRatio) {
this.keepRatio = keepRatio;
return this;
}
/**
* 指定一个水印文件
*
* @param watermark
* {@link Watermark}
* @return {@link ImageUtils}
*/
public ImageUtils watermark(Watermark watermark) {
this.watermarkArr.add(watermark);
return this;
}
/**
* 指定多个水印文件
*
* @param watermarkArr
* {@link ArrayList}
* @return {@link ImageUtils}
*/
public ImageUtils watermarkArray(ArrayList<Watermark> watermarkArr) {
this.watermarkArr.addAll(watermarkArr);
return this;
}
/**
* 指定源文件图片
*
* @param srcImage
* {@link File}
* @return {@link ImageUtils}
*/
public static ImageUtils fromFile(File srcImage) {
ImageUtils image = new ImageUtils(srcImage);
image.init();
return image;
}
/**
* 定义伸缩比例
*
* @param scale
* 伸缩比例
* @return {@link ImageUtils}
*/
public ImageUtils scale(double scale) {
if (scale <= 0) {
throw new IllegalStateException("scale value error!");
}
this.scale = scale;
return this;
}
/**
* 生成的图片是否以给定的大小不变
*
* @param fixedGivenSize
* {@link Boolean}
* @return {@link ImageUtils}
*/
public ImageUtils fixedGivenSize(boolean fixedGivenSize) {
this.fixedGivenSize = fixedGivenSize;
return this;
}
/**
* 指定生成图片的宽度
*
* @param width
* {@link Integer} 宽度
* @return {@link ImageUtils}
*/
public ImageUtils width(int width) {
if (width <= 1) {
throw new IllegalStateException("width value error!");
}
this.width = width;
return this;
}
/**
* 指定生成图片的高度
*
* @param height
* {@link Integer} 高度
* @return {@link ImageUtils}
*/
public ImageUtils height(int height) {
if (height <= 1) {
throw new IllegalStateException("height value error!");
}
this.height = height;
return this;
}
/**
* 指定生成图片的宽度和高度
*
* @param width
* {@link Integer} 宽度
* @param height
* {@link Integer} 高度
* @return {@link ImageUtils}
*/
public ImageUtils size(int width, int height) {
if (width <= 1 || height <= 1) {
throw new IllegalStateException("width or height value error!");
}
this.width = width;
this.height = height;
return this;
}
/**
* 指定旋转图片角度
*
* @param angle
* {@link Double} 旋转图片的角度
* @return {@link ImageUtils}
*/
public ImageUtils rotate(double angle) {
this.angle = angle;
return this;
}
/**
* 压缩图片的质量
*
* @param quality
* {@link Float}
* @return
*/
public ImageUtils quality(float quality) {
this.quality = quality;
return this;
}
/**
* 设置背景颜色
*
* @param bgcolor
* @return
*/
public ImageUtils bgcolor(Color bgcolor) {
this.bgcolor = bgcolor;
return this;
}
/**
* 指定生成图片的文件
*
* @param destFile
* {@link File}
*/
public void toFile(File destFile) {
this.destFile = destFile;
BufferedImage srcImage = null;
try {
srcImage = ImageIO.read(this.srcFile);
if (this.scale > 0 && this.width == 0 && this.height == 0) {
this.width = (int) (srcImage.getWidth() * this.scale);
this.height = (int) (srcImage.getHeight() * this.scale);
}
if (this.angle != 0) {
try {
srcImage = this.rotateImage(srcImage);
} catch (IOException e) {
e.printStackTrace();
System.out.println("rotate error!");
return;
}
}
} catch (IOException e1) {
e1.printStackTrace();
System.out.println("read image error!");
return;
}
BufferedImage destImage = this.resize(srcImage);
if (this.keepRatio) {
destImage = this.keepImageRatio(destImage, this.givenWidth, this.givenHeight);
}
if (this.watermarkArr != null) {
for (Watermark watermark : watermarkArr) {
destImage = watermark.apply(destImage);
}
}
try {
this.makeImage(destImage);
} catch (IOException e) {
e.printStackTrace();
System.out.println("create image error!");
}
}
/**
* 保存图片的原比例,并计算原图片
*
* @param img
* {@link BufferedImage} 原图片
* @param targetWidth
* {@link Integer} 目标宽度
* @param targetHeight
* {@link Integer} 目标高度
* @return 返回计算结果数组
*/
private BufferedImage keepImageRatio(BufferedImage img, int targetWidth, int targetHeight) {
int sourceWidth = img.getWidth();
int sourceHeight = img.getHeight();
int x = 0;
int y = 0;
int drawWidth = targetWidth;
int drawHeight = targetHeight;
double sourceRatio = (double) sourceWidth / (double) sourceHeight;
double targetRatio = (double) targetWidth / (double) targetHeight;
/*
* If the ratios are not the same, then the appropriate width and height
* must be picked.
*/
if (Double.compare(sourceRatio, targetRatio) != 0) {
if (sourceRatio > targetRatio) {
drawHeight = (int) Math.round(targetWidth / sourceRatio);
} else {
drawWidth = (int) Math.round(targetHeight * sourceRatio);
}
}
x = (targetWidth - drawWidth) / 2;
y = (targetHeight - drawHeight) / 2;
targetWidth = (targetWidth == 0) ? 1 : targetWidth;
targetHeight = (targetHeight == 0) ? 1 : targetHeight;
/*
* BufferedImage resizedImage = Utils.createImage(img, targetWidth,
* targetHeight, this.bgcolor);
*/
int type = BufferedImage.TYPE_INT_ARGB;
BufferedImage resizedImage = new BufferedImage(targetWidth, targetHeight, type);
Graphics2D g = resizedImage.createGraphics();
Utils.setRenderingHint(g);
if (this.bgcolor != null) {
g.setPaint(this.bgcolor);
g.fillRect(0, 0, targetWidth, targetHeight);
}
g.drawImage(img, x, y, drawWidth, drawHeight, null);
g.dispose();
return resizedImage;
}
/**
* 重新设置图片大小
*
* @param srcImage
* @return
*/
private BufferedImage resize(BufferedImage srcImage) {
int width = srcImage.getWidth();
int height = srcImage.getHeight();
if (this.width > 0 && this.height > 0) {
if (this.fixedGivenSize) {
this.givenWidth = this.width;
this.givenHeight = this.height;
if (!this.keepRatio) {
width = this.width;
height = this.height;
}
}
if (this.keepRatio) {
int drawWidth = this.width;
int drawHeight = this.height;
double sourceRatio = (double) width / (double) height;
double targetRatio = (double) this.width / (double) this.height;
if (Double.compare(sourceRatio, targetRatio) != 0) {
if (sourceRatio > targetRatio) {
drawHeight = (int) Math.round(this.width / sourceRatio);
} else {
drawWidth = (int) Math.round(this.height * sourceRatio);
}
}
if (!this.fixedGivenSize) {
this.givenWidth = drawWidth;
this.givenHeight = drawHeight;
}
width = drawWidth;
height = drawHeight;
}
} else if (this.scale > 0) {
width = (int) (width * this.scale);
height = (int) (height * this.scale);
} else if (this.width > 0 && this.height == 0) {
height = this.width * height / width;
width = this.width;
} else if (this.width == 0 && this.height > 0) {
width = this.height * width / height;
height = this.height;
}
if (width <= 1 || height <= 1) {
throw new IllegalStateException("width or height value error!");
}
this.width = width;
this.height = height;
this.givenWidth = (this.givenWidth == 0 ? width : this.givenWidth);
this.givenHeight = (this.givenHeight == 0 ? height : this.givenHeight);
return Utils.createImage(srcImage, width, height, this.bgcolor);
}
/**
* Returns a {@link BufferedImage} with the specified image type, where the
* graphical content is a copy of the specified image.
*
* @param img
* The image to copy.
* @param imageType
* The image type for the image to return.
* @return A copy of the specified image.
*/
public BufferedImage copy(BufferedImage img, int imageType) {
int width = img.getWidth();
int height = img.getHeight();
BufferedImage newImage = new BufferedImage(width, height, imageType);
Graphics g = newImage.createGraphics();
g.drawImage(img, 0, 0, null);
g.dispose();
return newImage;
}
public void makeImage(BufferedImage newImage) throws IOException {
String fileExtension = getExtension(destFile);
if (fileExtension.equalsIgnoreCase("jpg") || fileExtension.equalsIgnoreCase("jpeg")
|| fileExtension.equalsIgnoreCase("bmp")) {
newImage = this.copy(newImage, BufferedImage.TYPE_INT_RGB);
}
ImageWriter imgWriter = ImageIO.getImageWritersByFormatName(fileExtension).next();
ImageWriteParam imgWriteParam = imgWriter.getDefaultWriteParam();
if (imgWriteParam.canWriteCompressed()) {
if (fileExtension.equalsIgnoreCase("bmp")) {
imgWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
imgWriteParam.setCompressionType("BI_RGB");
} else if (fileExtension.equalsIgnoreCase("gif")) {
imgWriteParam.setCompressionMode(ImageWriteParam.MODE_COPY_FROM_METADATA);
} else {
imgWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
imgWriteParam.setCompressionQuality(this.quality);
}
}
ImageOutputStream outputStream = ImageIO.createImageOutputStream(destFile);
imgWriter.setOutput(outputStream);
IIOImage outputImage = new IIOImage(newImage, null, null);
imgWriter.write(null, outputImage, imgWriteParam);
imgWriter.dispose();
outputStream.close();
}
private BufferedImage rotateImage(BufferedImage img) throws IOException {
int width = img.getWidth();
int height = img.getHeight();
BufferedImage newImage;
double[][] newPositions = new double[4][];
newPositions[0] = this.calculatePosition(0, 0);
newPositions[1] = this.calculatePosition(width, 0);
newPositions[2] = this.calculatePosition(0, height);
newPositions[3] = this.calculatePosition(width, height);
double minX = Math.min(Math.min(newPositions[0][0], newPositions[1][0]),
Math.min(newPositions[2][0], newPositions[3][0]));
double maxX = Math.max(Math.max(newPositions[0][0], newPositions[1][0]),
Math.max(newPositions[2][0], newPositions[3][0]));
double minY = Math.min(Math.min(newPositions[0][1], newPositions[1][1]),
Math.min(newPositions[2][1], newPositions[3][1]));
double maxY = Math.max(Math.max(newPositions[0][1], newPositions[1][1]),
Math.max(newPositions[2][1], newPositions[3][1]));
int newWidth = (int) Math.round(maxX - minX);
int newHeight = (int) Math.round(maxY - minY);
// newImage = new BufferedImageBuilder(newWidth, newHeight).build();
newImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = newImage.createGraphics();
Utils.setRenderingHint(g);
if (this.bgcolor != null) {
g.setPaint(this.bgcolor);
g.fillRect(0, 0, newWidth, newHeight);
}
/*
* TODO consider RenderingHints to use. The following are hints which
* have been chosen to give decent image quality. In the future, there
* may be a need to have a way to change these settings.
*/
double w = newWidth / 2.0;
double h = newHeight / 2.0;
int centerX = (int) Math.round((newWidth - width) / 2.0);
int centerY = (int) Math.round((newHeight - height) / 2.0);
g.rotate(Math.toRadians(angle), w, h);
g.drawImage(img, centerX, centerY, null);
g.dispose();
return newImage;
}
private double[] calculatePosition(double x, double y) {
double angle = this.angle;
angle = Math.toRadians(angle);
double nx = (Math.cos(angle) * x) - (Math.sin(angle) * y);
double ny = (Math.sin(angle) * x) + (Math.cos(angle) * y);
return new double[] { nx, ny };
}
/**
* 返回文件格式
*
* @param f
* {@link File} 文件
* @return 返回文件格式
*/
private static String getExtension(File f) {
String fileName = f.getName();
if (fileName.indexOf('.') != -1 && fileName.lastIndexOf('.') != fileName.length() - 1) {
int lastIndex = fileName.lastIndexOf('.');
return fileName.substring(lastIndex + 1);
}
return null;
}
} | 26.555328 | 93 | 0.661702 |
bd8507607818a28b3bb72c0e7a64e085a4754363 | 2,010 | package com.aiit.byh.service.common.redis;
import com.aiit.byh.service.common.redis.entity.UpdateInfo;
import com.aiit.byh.service.common.redis.entity.UpdateType;
import com.aiit.byh.service.common.utils.CommonUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import redis.clients.jedis.Pipeline;
import java.util.List;
/**
* redis操作父类
*
* @author dsqin
*/
public class RedisBatchUpdateService implements IRedisBatchProcess {
/**
* 批量操作ids
*/
private List<UpdateInfo> list;
private UpdateType updateType;
public RedisBatchUpdateService() {
super();
}
public RedisBatchUpdateService(List<UpdateInfo> list, UpdateType updatedType) {
this.list = list;
this.updateType = updatedType;
}
public void process(Pipeline pipe) {
if (CommonUtils.isEmpty(list)) {
return;
}
updateBatch(pipe);
}
/**
* 批量更新
* @param pipe
*/
private void updateBatch(Pipeline pipe) {
for (int i = 0; i < list.size(); i++) {
UpdateInfo updateInfo = list.get(i);
String key = updateInfo.getKey();
String field = updateInfo.getField();
String value = updateInfo.getValue();
if (StringUtils.isNotBlank(field)) {
switch (updateType) {
case HASH:
pipe.hset(key, field, value);
break;
case SORTEDSET:
pipe.zadd(key, NumberUtils.toLong(value), field);
break;
}
}
}
}
public List<UpdateInfo> getList() {
return list;
}
public void setList(List<UpdateInfo> list) {
this.list = list;
}
public UpdateType getUpdateType() {
return updateType;
}
public void setUpdateType(UpdateType updateType) {
this.updateType = updateType;
}
}
| 24.216867 | 83 | 0.581592 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.