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
|
|---|---|---|---|---|---|
22fc236f5c49c389ea5b92391901aedc739cee6d
| 3,966
|
/*
* Copyright (c) 2020 Temporal Technologies, Inc. All Rights Reserved
*
* Copyright 2012-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Modifications copyright (C) 2017 Uber Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package io.temporal.samples.peractivityoptions;
import com.google.common.collect.ImmutableMap;
import io.temporal.activity.ActivityOptions;
import io.temporal.client.WorkflowClient;
import io.temporal.client.WorkflowOptions;
import io.temporal.common.RetryOptions;
import io.temporal.serviceclient.WorkflowServiceStubs;
import io.temporal.worker.Worker;
import io.temporal.worker.WorkerFactory;
import io.temporal.worker.WorkflowImplementationOptions;
import java.time.Duration;
public class Starter {
public static final String TASK_QUEUE = "perActivityTaskQueue";
private static final WorkflowServiceStubs service = WorkflowServiceStubs.newInstance();
private static final WorkflowClient client = WorkflowClient.newInstance(service);
private static final WorkerFactory factory = WorkerFactory.newInstance(client);
public static void main(String[] args) {
// Create Worker
Worker worker = factory.newWorker(TASK_QUEUE);
// Register workflow impl and set the per-activity options
WorkflowImplementationOptions options =
WorkflowImplementationOptions.newBuilder()
// setActivityOptions allows you to set different ActivityOption per activity type
// By default activity type is the name of activity method (with first letter upper
// cased)
.setActivityOptions(
ImmutableMap.of(
"ActivityTypeA",
ActivityOptions.newBuilder()
// Set activity exec timeout (including retries)
.setScheduleToCloseTimeout(Duration.ofSeconds(5))
// Set activity type specific retries if needed
.build(),
"ActivityTypeB",
ActivityOptions.newBuilder()
// Set activity exec timeout (single run)
.setStartToCloseTimeout(Duration.ofSeconds(2))
.setRetryOptions(
RetryOptions.newBuilder()
// ActivityTypeB activity type shouldn't retry on NPE
.setDoNotRetry(NullPointerException.class.getName())
.build())
.build()))
.build();
// Register our workflow impl and give the per-activity options
// Note you can register multiple workflow impls with worker using these activity options
worker.registerWorkflowImplementationTypes(options, PerActivityOptionsWorkflowImpl.class);
// Register activity impl with worker
worker.registerActivitiesImplementations(new FailingActivitiesImpl());
factory.start();
// Create typed workflow stub
PerActivityOptionsWorkflow workflow =
client.newWorkflowStub(
PerActivityOptionsWorkflow.class,
WorkflowOptions.newBuilder()
// set business level id
.setWorkflowId("PerActivityOptionsWorkflow")
// set same task queue as our worker
.setTaskQueue(TASK_QUEUE)
.build());
// Call our workflow method sync (wait for results)
workflow.execute();
System.exit(0);
}
}
| 41.747368
| 95
| 0.66465
|
4961641aadcd1920009aa68ce7710e38bcb16af0
| 1,265
|
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.sleuth.sampler.AlwaysSampler;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Description;
@EnableBinding(Sink.class)
@EnableEurekaClient
@SpringBootApplication
public class ReservationServiceApplication {
public static void main(String[] args) {
SpringApplication.run(ReservationServiceApplication.class, args);
}
@Bean
@Description("Used with Spring Cloud Sleuth/Zipkin")
AlwaysSampler alwaysSampler() {
return new AlwaysSampler();
}
// @Bean
// @Description("Seed H2 database with records")
// CommandLineRunner runner(ReservationRepository rr) {
// return args -> {
// Arrays.asList("John,Mary,Mike,Doug,Susan,Amit".split(","))
// .forEach(x -> rr.save(new Reservation(x)));
// rr.findAll().forEach(System.out::println);
// };
// }
}
| 33.289474
| 73
| 0.730435
|
7a5713c134fbbbcecdf11326f26912a4094fd12e
| 2,127
|
/*
* Copyright 2017-2021 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.alilitech.mybatis.jpa.criteria.specification;
import com.alilitech.mybatis.jpa.criteria.Specification;
import com.alilitech.mybatis.jpa.criteria.expression.CompoundPredicateExpression;
import com.alilitech.mybatis.jpa.criteria.expression.PredicateExpression;
import org.springframework.util.CollectionUtils;
/**
* @author Zhou Xiaoxiang
* @since 1.1
*/
public class CompoundPredicateBuilder<T> extends PredicateBuilder<T> {
public CompoundPredicateBuilder<T> and() {
this.operator = PredicateExpression.BooleanOperator.AND;
return this;
}
public CompoundPredicateBuilder<T> or() {
this.operator = PredicateExpression.BooleanOperator.OR;
return this;
}
public CompoundPredicateBuilder() {
super(new EmptySpecificationBuilder<>());
this.operator = PredicateExpression.BooleanOperator.AND;
}
@Override
public Specification<T> build() {
return (cb, query) -> {
for (Specification<T> specification : specifications) {
PredicateExpression<T> predicateExpression = specification.toPredicate(cb, query);
if (predicateExpression != null) {
this.predicates.add(predicateExpression);
}
}
if (!CollectionUtils.isEmpty(predicates)) {
return new CompoundPredicateExpression<>(this.operator, predicates);
}
return null;
};
}
}
| 34.868852
| 98
| 0.67889
|
c573d4b5aaa84d7f4c021931d52567a728ee3f2a
| 948
|
package com.dpforge.essy.proxy.decoder;
import spark.utils.IOUtils;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringWriter;
import java.util.Base64;
import java.util.zip.GZIPInputStream;
public class ScriptDecoder {
public String decode(final String encodedScript) throws ScriptDecoderException {
final byte[] compressed = Base64.getDecoder().decode(encodedScript);
try {
return decompress(compressed);
} catch (IOException e) {
throw new ScriptDecoderException(e);
}
}
private static String decompress(final byte[] compressed) throws IOException {
try (final GZIPInputStream gzipInput = new GZIPInputStream(new ByteArrayInputStream(compressed));
final StringWriter stringWriter = new StringWriter()) {
IOUtils.copy(gzipInput, stringWriter);
return stringWriter.toString();
}
}
}
| 31.6
| 105
| 0.698312
|
fd7aa72632f04be0dd13677577b426a1480c1acb
| 474
|
package mariculture.api.util;
public class CachedCoords {
public int x;
public int y;
public int z;
public CachedCoords(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
@Override
public boolean equals(Object o) {
if (o instanceof CachedCoords) {
CachedCoords cache = (CachedCoords) o;
return cache.x == x && cache.y == y && cache.z == z;
} else return false;
}
}
| 21.545455
| 64
| 0.542194
|
8b48f99bed202fa3bf0b6eb9126c63de4f7e3f46
| 4,096
|
/**
* Copyright (c) 2011, The University of Southampton and the individual contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the University of Southampton nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
*
*/
package org.openimaj.image.typography.general;
import org.openimaj.image.renderer.ImageRenderer;
import org.openimaj.image.typography.Font;
import org.openimaj.image.typography.FontRenderer;
import org.openimaj.image.typography.FontStyle;
/**
* This is a wrapper for the Java AWT Font in the OpenIMAJ system.
* To use this font, use something like the following:
* <pre>{@code
* MBFImage img = new MBFImage( 400, 400, 3 );
* GeneralFont f = new GeneralFont( "Times New Roman", Font.PLAIN, 72 );
* img.drawText( "Hello World", new Point2dImpl(10,500),
* new GeneralFontStyle( f, r, true ) );
* }</pre>
*
* @author David Dupplaw (dpd@ecs.soton.ac.uk)
* @created 18 Aug 2011
*
*/
public class GeneralFont implements Font<GeneralFont>
{
private final String name;
private int type;
// private float size;
/**
* Create a font with the given name, type and size. The name
* should be the name of the font on your system. The type should
* be Font.PLAIN, Font.BOLD or other Font attributes.
* This is the same as the constructor
* for the java.awt.Font class.
*
* @param name Name of the font
* @param type Font attributes
*/
public GeneralFont( final String name, final int type )
{
this.name = name;
this.setType( type );
}
/**
* {@inheritDoc}
* @see org.openimaj.image.typography.Font#getRenderer(org.openimaj.image.renderer.ImageRenderer)
*/
@SuppressWarnings( "unchecked" )
@Override
public <T, Q extends FontStyle<T>> FontRenderer<T, Q>
getRenderer( final ImageRenderer<T, ?> renderer )
{
return (FontRenderer<T, Q>)(Object)new GeneralFontRenderer<T>();
}
/**
* {@inheritDoc}
* @see org.openimaj.image.typography.Font#createStyle(org.openimaj.image.renderer.ImageRenderer)
*/
@Override
public <T> FontStyle< T>
createStyle( final ImageRenderer<T, ?> renderer )
{
return new GeneralFontStyle<T>( this, renderer );
}
/**
* {@inheritDoc}
* @see org.openimaj.image.typography.Font#getName()
*/
@Override
public String getName()
{
return this.name;
}
/**
* Set the type of the font.
*
* @param type the type of the font.
*/
public void setType( final int type )
{
this.type = type;
}
/**
* Get the font attributes
* @return the font attributes
*/
public int getType()
{
return this.type;
}
}
| 32
| 100
| 0.695313
|
d7d2abf57843e944749f47958dbe44a30680fa3b
| 1,766
|
package com.ibercivis.interfungi.clases;
import android.content.Context;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.ibercivis.interfungi.R;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.List;
public class AdaptadorSetas extends RecyclerView.Adapter<ViewHolderSetas> {
List<Marcador> ListaObjeto;
public AdaptadorSetas(List<Marcador> listaObjeto) {
ListaObjeto = listaObjeto;
}
@NonNull
@Override
public ViewHolderSetas onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View vista = LayoutInflater.from(parent.getContext()).inflate(R.layout.marcador_card, parent, false);
return new ViewHolderSetas(vista, ListaObjeto);
}
@Override
public void onBindViewHolder(@NonNull final ViewHolderSetas holder, int position) {
Log.d("AdaptadorSetas", "OnBindViewHolder");
holder.titulo.setText(ListaObjeto.get(position).getFechaCorte());
String photo_0 = ListaObjeto.get(position).photo_0;
String photo_1 = ListaObjeto.get(position).photo_1;
Picasso.with(holder.photo_0.getContext()).load(photo_0).into(holder.photo_0);
Picasso.with(holder.photo_1.getContext()).load(photo_1).into(holder.photo_1);
}
@Override
public int getItemCount() {
return ListaObjeto.size();
}
public void setFilter(ArrayList<Marcador> listaFiltrada){
this.ListaObjeto = new ArrayList<>();
this.ListaObjeto.addAll(listaFiltrada);
notifyDataSetChanged();
}
}
| 29.433333
| 109
| 0.732163
|
d79880b10142c989ab1a47397fa3c26bbd6863ab
| 1,099
|
package me.gaigeshen.wechat.pay;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;
import java.io.StringReader;
/**
* 通知结果帮助类
*
* @author gaigeshen
*/
public class NotifyBodyHelper {
/**
* 由通知结果响应体转换后的文档
*/
private final Document document;
/**
* 创建通知结果帮助类
*
* @param coontent 响应体内容
* @throws DocumentException 转换响应体为文档的时候失败
*/
private NotifyBodyHelper(String coontent) throws DocumentException {
this.document = new SAXReader().read(new StringReader(coontent));
}
/**
* 创建通知结果帮助类
*
* @param bodyContent 响应体内容
* @return 响应体帮助类
*/
public static NotifyBodyHelper create(String bodyContent) {
try {
return new NotifyBodyHelper(bodyContent);
} catch (DocumentException e) {
throw new IllegalStateException("Could not create notify body helper", e);
}
}
/**
* 转换为通知结果对象
*
* @param responseType 通知结果对象类型
* @return 通知结果对象
*/
public <R> R parseToObject(Class<R> responseType) {
return ResponseBodyXmlUtils.parseToObject(document, responseType);
}
}
| 20.351852
| 80
| 0.685168
|
7c8d54c5b472e8edbcbd99f3080ea072c3bb598f
| 2,615
|
/**
* Copyright 2016 YouVersion
*
* 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 nuclei.task;
import android.app.Application;
import android.content.Context;
import java.lang.ref.WeakReference;
/**
* One of the most common errors that I have noticed are caused by Contexts having lost scope
* when they are expected to still exist. As a result, work is executed when it doesn't need to be
* and Exceptions thrown due to null pointers.
* <br />
* This results in the need for lots of if (getActivity() != null) or if (getContext() != null).
* <br />
* The ContextHandle helps get around all of this when used with things like Results and Tasks.
* <br />
* You can also extend from the NeuronActivity and NeuronFragments to assist in the management
* of the ContextHandles.
* <br />
* You should also call ContextHandle.initialize in your main application class to provide a
* global, never released ContextHandle.
*/
public final class ContextHandle {
private static ContextHandle applicationHandle;
public static void initialize(Application application) {
applicationHandle = new ContextHandle(application);
}
public static ContextHandle getApplicationHandle() {
if (applicationHandle == null)
throw new RuntimeException("ContextHandle#initialize not called");
return applicationHandle;
}
public static ContextHandle obtain(Context context) {
return new ContextHandle(context);
}
private WeakReference<Context> mContext;
private ContextHandle(Context context) {
mContext = new WeakReference<>(context);
}
public Context get() {
return mContext.get();
}
public void attach(Context context) {
if (applicationHandle == this)
throw new RuntimeException("You cannot attach the application handle.");
mContext = new WeakReference<>(context);
}
public void release() {
if (applicationHandle == this)
throw new RuntimeException("You cannot release the application handle.");
mContext.clear();
}
}
| 33.101266
| 99
| 0.707839
|
a1bd3544ef379ff8046b01e10fb7dcf8fd501bc1
| 1,152
|
package org.divy.bo.demos.domain.cards.pages;
import org.divy.common.bo.database.jpa.AbstractJPABusinessObject;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
@Entity
public class Page extends AbstractJPABusinessObject {
private List<Section> sections;
public Page() {
//noop
}
public Page(UUID uuid) {
super(uuid);
}
@OneToMany(cascade = CascadeType.ALL)
public List<Section> getSections() {
return sections;
}
public void setSections(List<Section> sections) {
this.sections = sections;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
var page = (Page) o;
return Objects.equals(getSections(), page.getSections());
}
@Override
public int hashCode() {
return Objects.hash(super.hashCode(), getSections());
}
}
| 22.588235
| 65
| 0.632813
|
d7fe0418396b80f770fc1a4cd4e5bafcbbef8913
| 1,072
|
package com.demo.pagingwithnetwork.base;
import android.os.Bundle;
import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.lifecycle.ViewModel;
public abstract class BaseActivity<V extends ViewDataBinding,K extends ViewModel> extends AppCompatActivity {
private V binding = null;
private K viewModel = null;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
onCreate();
init();
}
public abstract void onCreate();
public abstract void init();
public void setView(@LayoutRes int layoutResID){
binding = DataBindingUtil.setContentView(this,layoutResID);
}
public V getBinding() {
return binding;
}
public K getViewModel() {
return viewModel;
}
public void setViewModel(K viewModel) {
this.viewModel = viewModel;
}
}
| 24.930233
| 109
| 0.720149
|
9043af58448fa62979614a28fa1533d621bfc6c3
| 414
|
package com.zizohanto.adoptapet.data;
import java.util.HashMap;
public class FormState {
private HashMap<String, String> mElementIdAndUserInputMap;
public FormState(HashMap<String, String> elementIdAndUserInputMap) {
mElementIdAndUserInputMap = elementIdAndUserInputMap;
}
public HashMap<String, String> getElementIdAndUserInputMap() {
return mElementIdAndUserInputMap;
}
}
| 25.875
| 72
| 0.758454
|
82879e7631c7c6b5763f83bbfcb641cee04237e0
| 1,927
|
package com.github.alexeylapin.ocp.g0_serialization;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamField;
import java.io.Serializable;
import static org.assertj.core.api.Assertions.assertThat;
class Sample07 implements Serializable {
String s1;
String s2;
public Sample07(String s1, String s2) {
this.s1 = s1;
this.s2 = s2;
}
public String getS1() {
return s1;
}
public String getS2() {
return s2;
}
@Override
public String toString() {
return "Sample07{s1=" + s1 + ", s2=" + s2 + "}";
}
private void writeObject(ObjectOutputStream oos) throws IOException {
System.out.println("writing...");
ObjectOutputStream.PutField fields = oos.putFields();
fields.put("s1", s1.toUpperCase());
oos.writeFields();
}
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
System.out.println("reading...");
ObjectInputStream.GetField fields = ois.readFields();
String s1 = (String) fields.get("s1", null);
this.s1 = s1 == null ? null : s1.toLowerCase();
String s2 = (String) fields.get("s2", null);
this.s2 = s2 == null ? null : s2.toLowerCase();
}
}
class T07 {
@Test
void name() throws IOException, ClassNotFoundException {
var baos = new ByteArrayOutputStream();
var oos = new ObjectOutputStream(baos);
oos.writeObject(new Sample07("test1", "test2"));
var ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
Sample07 o = (Sample07) ois.readObject();
assertThat(o.getS1()).isEqualTo("test1");
assertThat(o.getS2()).isNull();
}
}
| 27.528571
| 95
| 0.648677
|
4ef46e6c6619eef91d09de134f30b1ac87a5d740
| 1,431
|
package seedu.address.model.util.predicate;
import java.util.Set;
/**
* Predicate which contains multiple predicates for fields.
* To be used for filtering and sorting data by multiple parameters.
* Guarantees: Immutable
*/
public class CompositeFieldPredicate<U> extends FieldPredicate<U> {
private final Set<FieldPredicate<U>> fieldPredicateSet;
/**
* Initialize composite predicate with a set of predicates.
*/
public CompositeFieldPredicate(Set<FieldPredicate<U>> fieldPredicateSet) {
assert (fieldPredicateSet.size() > 0);
this.fieldPredicateSet = fieldPredicateSet;
}
public CompositeFieldPredicate(FieldPredicate<U> fieldPredicate) {
this(Set.of(fieldPredicate));
}
@Override
public double getSimilarityScore(U u) {
return fieldPredicateSet.stream().mapToDouble(x -> x.getSimilarityScore(u)).sum();
}
@Override
public boolean test(U u) {
return fieldPredicateSet.stream().allMatch(x -> x.test(u));
}
@Override
public boolean equals(Object other) {
return other == this // short circuit if same object
|| (other instanceof CompositeFieldPredicate // instanceof handles nulls
&& fieldPredicateSet.equals(((CompositeFieldPredicate<?>) other).fieldPredicateSet)); // state check
}
@Override
public int hashCode() {
return fieldPredicateSet.size();
}
}
| 29.204082
| 112
| 0.685535
|
ece9f776c4686da30cd5bb90d0f77f8b7eb90c63
| 2,011
|
/**
* 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.hbase.master.cleaner;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.master.procedure.MasterProcedureUtil;
import org.apache.yetus.audience.InterfaceAudience;
/**
* Procedure WAL cleaner that uses the timestamp of the Procedure WAL to determine if it should be
* deleted. By default they are allowed to live for {@value #DEFAULT_TTL}.
* @deprecated Since 2.3.0, will be removed in 4.0.0. We will not use the procedure wal to store
* procedure any more.
*/
@Deprecated
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.CONFIG)
public class TimeToLiveProcedureWALCleaner extends BaseTimeToLiveFileCleaner {
public static final String TTL_CONF_KEY = "hbase.master.procedurewalcleaner.ttl";
// default ttl = 7 days
public static final long DEFAULT_TTL = 604_800_000L;
@Override
protected long getTtlMs(Configuration conf) {
return conf.getLong(TTL_CONF_KEY, DEFAULT_TTL);
}
@Override
protected boolean valiateFilename(Path file) {
return MasterProcedureUtil.validateProcedureWALFilename(file.getName());
}
}
| 39.431373
| 98
| 0.770761
|
e0f1bd68a8efa722ff0bdf0196de55d8f95367b5
| 7,726
|
package com.pci.checker.service;
import com.pci.checker.model.CertAnalaysisResult;
import com.pci.checker.util.Utils;
import org.bouncycastle.jce.provider.JCEECPublicKey;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.security.cert.*;
import java.security.interfaces.DSAPublicKey;
import java.security.interfaces.ECPublicKey;
import java.security.interfaces.RSAPublicKey;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class CertAnalysisService {
private static final String[] WEAK_HASH = new String[]{"MD5, SHA, SHA1, SHA-1"};
private static final Map<String, Integer> PK_SIZE = new HashMap<>();
static {
PK_SIZE.put("RSA", 2048);
PK_SIZE.put("DSA", 2048);
PK_SIZE.put("EC", 224);
PK_SIZE.put("ECDSA", 224);
}
public CertAnalaysisResult analyzeCert(String domainName) throws Exception {
CertAnalaysisResult result = new CertAnalaysisResult();
String encodedCert = crawlCertificateWithServerName(domainName);
if (encodedCert.isEmpty()) {
return result;
}
CertificateFactory fact = CertificateFactory.getInstance("X.509");
InputStream stream = new ByteArrayInputStream(encodedCert.getBytes(StandardCharsets.UTF_8));
X509Certificate cert = (X509Certificate) fact.generateCertificate(stream);
result.setExpired(isExpired(cert)); // 1
result.setSelfsigned(isSelfSigned(cert)); // 2
// Get subject
Principal principal = cert.getSubjectDN();
String subjectDn = principal.toString();
result.setSubjectdn(subjectDn);
principal = cert.getIssuerDN();
String issuerDn = principal.getName();
result.setIssuerdn(issuerDn);
subjectDn = Utils.unStaredDn(subjectDn);
boolean matched = domainName.toLowerCase().contains(subjectDn.toLowerCase());
try {
if (!matched) {
for (String alt : getSubjectAlternativeNames(cert)) {
if (domainName.toLowerCase().contains(Utils.unStaredDn(alt).toLowerCase())) {
matched = true;
break;
}
}
}
} catch (Exception e) {
System.err.println("error handling domain: " + domainName);
e.printStackTrace(System.err);
}
result.setWrongHostName(!matched); // 3
for (String hash : WEAK_HASH) { // 4
if (cert.getSigAlgName().contains(hash)) {
result.setWeakHash(true);
}
}
result.setSignatureAlg(cert.getSigAlgName());
PublicKey pk = cert.getPublicKey();
result.setPkname(pk.getAlgorithm());
int pkSize = getKeyLength(pk);
result.setPkSize(pkSize);
for (String key : PK_SIZE.keySet()) { // 5
if (pk.getAlgorithm().contains(key) && pkSize < PK_SIZE.get(key)) {
result.setInsecureModulus(true);
}
}
return result;
}
/* @param certificate a certificate
* @return a list of subject alternative names; list is never null
* @throws CertificateParsingException if parsing the certificate failed
*/
public static List<String> getSubjectAlternativeNames(final X509Certificate certificate) throws CertificateParsingException {
final Collection<List<?>> altNames = certificate.getSubjectAlternativeNames();
if (altNames == null) {
return new ArrayList<>();
}
final List<String> result = new ArrayList<>();
for (final List<?> generalName : altNames) {
/**
* generalName has the name type as the first element a String or byte array for the second element. We return any general names that are String types.
*
* We don't inspect the numeric name type because some certificates incorrectly put IPs and DNS names under the wrong name types.
*/
final Object value = generalName.get(1);
if (value instanceof String) {
result.add(((String) value).toLowerCase());
}
}
return result;
}
private static String crawlCertificateWithServerName(String domainName) throws Exception {
ProcessBuilder pb = new
ProcessBuilder("/bin/sh", "-c",
String.format("timeout 2 openssl s_client -showcerts -connect %s:443 -servername %s </dev/null 2>/dev/null | openssl x509 -outform PEM", domainName, domainName));
final Process p = pb.start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
StringBuilder cert = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
cert.append(line)
.append('\n');
}
return cert.toString();
}
private static boolean isExpired(X509Certificate cert) {
try {
cert.checkValidity();
} catch (CertificateNotYetValidException | CertificateExpiredException e) {
return true;
}
return false;
}
private static boolean isSelfSigned(X509Certificate cert)
throws CertificateException, NoSuchAlgorithmException,
NoSuchProviderException {
try {
// Try to verify certificate signature with its own public key
PublicKey key = cert.getPublicKey();
cert.verify(key);
return true;
} catch (SignatureException sigEx) {
// Invalid signature --> not self-signed
return false;
} catch (InvalidKeyException keyEx) {
// Invalid key --> not self-signed
return false;
}
}
/**
* Gets the key length of supported keys
*
* @param pk PublicKey used to derive the keysize
* @return -1 if key is unsupported, otherwise a number >= 0. 0 usually means the length can not be calculated,
* for example if the key is an EC key and the "implicitlyCA" encoding is used.
*/
public static int getKeyLength(final PublicKey pk) {
int len = -1;
if (pk instanceof RSAPublicKey) {
final RSAPublicKey rsapub = (RSAPublicKey) pk;
len = rsapub.getModulus().bitLength();
} else if (pk instanceof JCEECPublicKey) {
final JCEECPublicKey ecpriv = (JCEECPublicKey) pk;
final org.bouncycastle.jce.spec.ECParameterSpec spec = ecpriv.getParameters();
if (spec != null) {
len = spec.getN().bitLength();
} else {
// We support the key, but we don't know the key length
len = 0;
}
} else if (pk instanceof ECPublicKey) {
final ECPublicKey ecpriv = (ECPublicKey) pk;
final java.security.spec.ECParameterSpec spec = ecpriv.getParams();
if (spec != null) {
len = spec.getOrder().bitLength(); // does this really return something we expect?
} else {
// We support the key, but we don't know the key length
len = 0;
}
} else if (pk instanceof DSAPublicKey) {
final DSAPublicKey dsapub = (DSAPublicKey) pk;
if (dsapub.getParams() != null) {
len = dsapub.getParams().getP().bitLength();
} else {
len = dsapub.getY().bitLength();
}
}
return len;
}
}
| 35.278539
| 178
| 0.603029
|
81fb441fd5b42853b2ac3c3bf2020d400e313ccd
| 22,517
|
/*
* File name: CalculatorViewController.java
* Author: Shubham Ujinwal, 040885893
* Course: CST8221 - JAP, Lab Section: 303
* Assignment: 1, Part-1
* Date: 18 oct 2018
* Professor: Daniel Cormier
* Purpose: This file is responsible for building and operating the calculator GUI.
* Class list: Controller
*/
package calculator;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
/**
* This class extends JPanel which creates a group of buttons like
* (radioButtons , checkBox and calculator numeric Keypad buttons).
* It also contains JTExtField which will display the text of the button pressed by the user.
* @author Shubham
* @version 1
* @see calculator.CalculatorViewController
* @since 1.8
*/
public class CalculatorViewController extends JPanel{
/** Swing components are serializable and require serialVersionUID */
private static final long serialVersionUID = 1L;
/**Create calculator display1 field reference*/
private JTextField display1;
/**Create calculator display2 field reference*/
private JTextField display2;
/**Create mode/error display label reference*/
private JLabel error;
/**Create button reference*/
private JButton dotButton;
private JButton dotButton2;
/** the radio button reference to help working on clicking multiple times checkBox */
@SuppressWarnings("unused")
private JRadioButton doubleJRadioButton;
/**Create an array of fixed names for buttons*/
private final String names[] = {"7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0", ".", "\u00B1", "+"};
/**Create an array of fixed colors for buttons*/
private final Color colors[]= {Color.BLUE, Color.CYAN, Color.PINK, Color.YELLOW};
/**Create an array of keyEvents*/
private static final int keyEvents[] = new int[] {KeyEvent.VK_7, KeyEvent.VK_8, KeyEvent.VK_9, KeyEvent.VK_SLASH,
KeyEvent.VK_4, KeyEvent.VK_5, KeyEvent.VK_6, KeyEvent.VK_COMMA, KeyEvent.VK_1, KeyEvent.VK_2, KeyEvent.VK_3,
KeyEvent.VK_MINUS, KeyEvent.VK_0, KeyEvent.VK_PERIOD, KeyEvent.VK_P, KeyEvent.VK_EQUALS};
/**create string str user input*/
private String str = "";
/**create object of class CalculatorModel*/
CalculatorModel calc = new CalculatorModel();
/**create JRadioButton rb2*/
private JRadioButton rb2= new JRadioButton(".00");
/**create object of controller class*/
Controller controller = new Controller();
/**This default constructor contains the creation of calculator*/
CalculatorViewController(){
/*sets the layout of main panel*/
setLayout(new BorderLayout());
/*create JPanel header*/
JPanel headerPanel = new JPanel();
/*create bottom JPanel which is calculator pad*/
JPanel bottomPanel = new JPanel();
/*create JPanel for number pad*/
JPanel numberPadPanel = new JPanel();
/*create JPanel which contains number pad panel and clear buttons*/
JPanel innerPanel = new JPanel();
/*create JPanel which contains innerPanel and Equal(Enter) buttons*/
JPanel outerPanel = new JPanel();
/*create JPanel which contains display1 and display2*/
JPanel textFieldPanel = new JPanel();
/*create JPanel for radioButtons*/
JPanel radioButtonPanel = new JPanel();
/*create JPanel which contains checkBox*/
JPanel checkBoxPanel = new JPanel();
/*create JPanel middle panel which contains checkBoxpanel and radioButtonPanel*/
JPanel middlePanel = new JPanel();
/*create Box container*/
Box modeContainer = Box.createHorizontalBox();
/*create group of buttons*/
ButtonGroup buttonGroup = new ButtonGroup();
/*initializes all the JButtons , JLabels and JTextFields */
display1 = new JTextField();
display2 = new JTextField("0.0");
error = new JLabel("F", SwingConstants.CENTER);
JButton leftEqualbutton = null;
JButton rightEqualButton = null;
JButton topClearButton = null;
JButton buttomClearButton = null;
JButton backSpaceButton = null;
JRadioButton rb1 = new JRadioButton(".0");
//JRadioButton rb2 = new JRadioButton(".00");
JRadioButton rb3 = new JRadioButton("Sci");
JCheckBox checkBox = new JCheckBox("Int");
JButton numberButton = new JButton();
/*set the layout for all the JPanels*/
headerPanel.setLayout(new BorderLayout());
bottomPanel.setLayout(new BorderLayout());
numberPadPanel.setLayout(new GridLayout(4,4,3,3));
innerPanel.setLayout(new BorderLayout());
outerPanel.setLayout(new BorderLayout());
textFieldPanel.setLayout(new GridLayout(2,1));
checkBoxPanel.setLayout(new BorderLayout());
radioButtonPanel.setLayout(new BorderLayout());
middlePanel.setLayout(new BorderLayout());
/*set the JPanel border*/
setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, Color.BLACK));
numberPadPanel.setBorder(BorderFactory.createMatteBorder(3, 3, 3, 3, Color.WHITE));
/*set the size of textField*/
display1.setPreferredSize(new Dimension(16,30));
/*set the backGround to white*/
display1.setBackground(Color.WHITE);
/*set the columns*/
display1.setColumns(20);
/*make the display1 unEditbale*/
display1.setEditable(false);
/*align the text to right side in textField*/
display1.setHorizontalAlignment(SwingConstants.RIGHT);
/*set the border of textField*/
display1.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.WHITE));
/*set the size of textField*/
display2.setPreferredSize(new Dimension(16,30));
/*set the backGround to white*/
display2.setBackground(Color.WHITE);
/*set the columns*/
display2.setColumns(20);
/*make the display1 unEditbale*/
display2.setEditable(false);
/*align the text to right side in textField*/
display2.setHorizontalAlignment(SwingConstants.RIGHT);
/*set the border of textField*/
display2.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.WHITE));
/*set keyBoard input for backspace*/
this.getActionMap().put("\u21Da", new KeyActions(backSpaceButton));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "\u21Da");
/*add display1 and display2 in textField panel*/
textFieldPanel.add(display1);
textFieldPanel.add(display2);
/*set the backGround color of error button to Yellow*/
error.setBackground(Color.YELLOW);
error.setOpaque(true);
/*set the size of error button*/
error.setPreferredSize(new Dimension(46,55));
/*set the font size of error button*/
error.setFont(new Font("Arial", Font.BOLD, 20));
/*set the border of error button*/
error.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 5, Color.BLACK));
/*initialize the backSpace button and set the text icon*/
backSpaceButton = new JButton("\u21Da");
/*set the size of backspace button*/
backSpaceButton.setPreferredSize(new Dimension (46,55));
/*set the font size of backspace button text*/
backSpaceButton.setFont(new Font(getFont().getName(), Font.BOLD, 20));
/*set the button transparent*/
backSpaceButton.setOpaque(false);
backSpaceButton.setContentAreaFilled(false);
/*add an action listener to backspace button*/
backSpaceButton.addActionListener(controller);
/*set the border of the backspace button*/
backSpaceButton.setBorder(BorderFactory.createMatteBorder(0, 5, 0, 1, Color.BLACK));
/*set the toolTipText text "Backspace Alt-B"*/
backSpaceButton.setToolTipText("Backspace (Alt-B)");
/*set the short key*/
backSpaceButton.setMnemonic(KeyEvent.VK_B);
/*set the backGround color, add actionListener to the radioButtons*/
rb1.setBackground(Color.YELLOW);
rb1.addActionListener(controller);
rb2.setBackground(Color.YELLOW);
/*set the radioButton 2 seleted*/
rb2.setSelected(true);
rb2.addActionListener(controller);
rb3.setBackground(Color.YELLOW);
rb3.addActionListener(controller);
/*set keyBoard input for radioButtons */
this.getActionMap().put(".0", new KeyActions(rb1));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, 0), ".0");
this.getActionMap().put(".0", new KeyActions(rb2));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, 0), ".00");
this.getActionMap().put(".0", new KeyActions(rb3));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, 0), "Sci");
/*add all the radio Button to radioButtonPanel*/
radioButtonPanel.add(rb1, BorderLayout.WEST);
radioButtonPanel.add(rb2, BorderLayout.CENTER);
radioButtonPanel.add(rb3, BorderLayout.EAST);
radioButtonPanel.setBorder(BorderFactory.createEmptyBorder());
/*set the border,backGround color , size and add actionListener to checkBox*/
checkBox.setSize(new Dimension(40,0));
checkBox.setBackground(Color.GREEN);
checkBox.addActionListener(controller);
checkBox.setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, Color.BLACK));
this.getActionMap().put("Int", new KeyActions(checkBox));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_I, 0), "Int");
/*add checkBox to checkBox panel*/
checkBoxPanel.add(checkBox);
/*Create button group which adds radioButtons and checkBox*/
buttonGroup.add(rb1);
buttonGroup.add(rb2);
buttonGroup.add(rb3);
buttonGroup.add(checkBox);
/*Box container add radioButton panel*/
modeContainer.add(radioButtonPanel);
middlePanel.add(modeContainer, BorderLayout.EAST);
middlePanel.add(checkBoxPanel, BorderLayout.WEST);
/*set the empty border, backGround color of the mode panel*/
middlePanel.setBackground(Color.BLACK);
middlePanel.setBorder(new EmptyBorder(10,0,10,0));
/*adding contents to header panel*/
headerPanel.add(textFieldPanel, BorderLayout.CENTER);
headerPanel.add(error, BorderLayout.WEST);
headerPanel.add(backSpaceButton, BorderLayout.EAST);
headerPanel.add(middlePanel, BorderLayout.SOUTH);
headerPanel.setBackground(Color.YELLOW);
/*create all the numberPad buttons using createButton method*/
for(int i=0; i<names.length; i++) {
/*if the button text is arithmetic then set CYAN color of the button*/
if(names[i] == "/" || names[i] == "*" || names[i] == "+" || names[i]=="-") {
numberButton =createButton(names[i], "a", Color.BLACK, colors[1], controller);
/*if the button text is +- then set PINK color of the button*/
}else if(names[i] == "\u00B1"){
numberButton = createButton(names[i], "a", Color.BLACK, colors[2], controller);
}
/*else sets all the button color to BLUE*/
else {
numberButton = createButton(names[i], "a", Color.BLACK, colors[0], controller);
}
if(names[i] == ".")
dotButton2 = numberButton;
/*set keyBoard input for numpad*/
this.getActionMap().put(names[i], new KeyActions(dotButton));
this.getInputMap().put(KeyStroke.getKeyStroke(keyEvents[i], 0), names[i]);
numberPadPanel.add(numberButton);
}
/*create equal and clear buttons of the number pad using createButton method*/
leftEqualbutton = createButton("=", "a", Color.BLACK, colors[3], controller);
rightEqualButton = createButton("=", "a", Color.BLACK, colors[3], controller);
topClearButton = createButton("C", "a", Color.BLACK, Color.RED,controller);
buttomClearButton = createButton("C", "a", Color.BLACK, Color.RED, controller);
/*set keyBoard input for equal and clear buttons*/
this.getActionMap().put("C", new KeyActions(topClearButton));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, 0), "C");
this.getActionMap().put("C", new KeyActions(buttomClearButton));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_C, 0), "C");
this.getActionMap().put("=", new KeyActions(leftEqualbutton));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "=");
this.getActionMap().put("=", new KeyActions(rightEqualButton));
this.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "=");
/*set the size of the equal and clear buttons*/
leftEqualbutton.setPreferredSize(new Dimension(46,55));
rightEqualButton.setPreferredSize(new Dimension(46,55));
topClearButton.setPreferredSize(new Dimension(0,45));
buttomClearButton.setPreferredSize(new Dimension(0,45));
/*set border of equal buttons*/
leftEqualbutton.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 5, Color.BLACK));
rightEqualButton.setBorder(BorderFactory.createMatteBorder(0, 5, 0, 0, Color.BLACK));
/*add clear buttons to inner panel*/
innerPanel.add(topClearButton, BorderLayout.NORTH);
innerPanel.add(buttomClearButton, BorderLayout.SOUTH);
/*add equal buttons to outer panel*/
outerPanel.add(leftEqualbutton,BorderLayout.WEST);
outerPanel.add(rightEqualButton,BorderLayout.EAST);
innerPanel.add(numberPadPanel, BorderLayout.CENTER);
outerPanel.add(innerPanel, BorderLayout.CENTER);
bottomPanel.add(outerPanel);
/*adding all the panels*/
add(headerPanel, BorderLayout.NORTH);
add(bottomPanel);
}
/**
* This method creates button with some basic properties and return a
* reference to dotButton.
* @param text - sets the text of the string
* @param ac - perform action according to the mode
* @param fg - sets the foreGround color of the button
* @param bg - sets the backGround color of the button
* @param handler - it takes ActionListener object
* @return dotButton - it will return JButton reference
*/
private JButton createButton (String text, String ac, Color fg, Color bg, ActionListener handler) {
dotButton = new JButton(text);
dotButton.setForeground(fg);
dotButton.setBackground(bg);
/*sets the size of the button*/
dotButton.setPreferredSize(new Dimension(46,65));
dotButton.addActionListener(handler);
/*sets the font size*/
dotButton.setFont(new Font(getFont().getName(), getFont().getStyle(), 20));
/*sets an empty border*/
dotButton.setBorder(BorderFactory.createEmptyBorder());
return dotButton;
}
/**
* This class implements ActionListener
* with actionPerformed method which is responsible for performing action
* when user press a button.
* @author Shubham
*
*/
private class Controller implements ActionListener{
/*
* this method will set the text of display2
* to the button text which is pressed by user.
*/
@Override
public void actionPerformed(ActionEvent e) {
String actionCommand = e.getActionCommand();
int number = -1;
/*checks if number is within range*/
try {
number = Integer.parseInt (actionCommand);
} catch (NumberFormatException e1) {
}
/*adds the string to actionCommand to have more than one digit numbers*/
if (number >= 0 && calc.getErrorState()== false ) {
display2.setText("");
str += actionCommand;
display2.setText(str);
}
/*if the .0 mode is selected */
if (".0".equals(actionCommand)&& calc.getErrorState()== false ){
/*if the mode changes to int*/
if (calc.getMode().equals("Int")){
str = "";
display2.setText("0.0");
}
calc.reset();
error.setText("F");
display2.setText("0.0");
calc.setMode(".0");
error.setBackground(Color.YELLOW);
/*enable . button*/
dotButton2.setEnabled(true);
dotButton2.setBackground(Color.BLUE);
/*checks for double point mode*/
} else if (".00".equals(actionCommand)&& calc.getErrorState()== false){
/*if the mode changes to int*/
if (calc.getMode().equals("Int")){
str = "";
display2.setText("0.0");
}
calc.reset();
error.setText("F");
display2.setText("0.0");
calc.setMode(".00");
error.setBackground(Color.YELLOW);
dotButton2.setEnabled(true); // disable dotButton
dotButton2.setBackground(Color.BLUE);;
/*checks for Int mode*/
} else if ("Int".equals(actionCommand)&& calc.getErrorState()== false){
if(error.getText().equals("I")) {
error.setText("F");
rb2.setSelected(true);
error.setBackground(Color.YELLOW);
error.setOpaque(true);
calc.setMode("F");
display1.setText("");
display2.setText("0.0");
/*enable . button*/
dotButton2.setEnabled(true);
dotButton2.setBackground(Color.BLUE);
}else {
str = "";
display2.setText("0");
display1.setText("");
calc.setMode("Int");
error.setText("I");
dotButton2.setEnabled(false);
/*it will disable . operation*/
error.setBackground(Color.green);
dotButton2.setBackground(new Color(178,156,250));
}
/*checks for Sci operation*/
} else if ("Sci".equals(actionCommand)&& calc.getErrorState()== false){
/*if the mode changes to Int*/
if (calc.getMode().equals("Int")){
str = "";
display2.setText("0.0");
}
calc.reset();
calc.setErrorState(false);
calc.setMode(actionCommand);
display2.setText("0.0");
display1.setText("");
error.setText("F");
error.setBackground(Color.YELLOW);
dotButton2.setEnabled(true);
dotButton2.setBackground(Color.BLUE);
}
/*checks for + operation*/
if ("+".equals(actionCommand) && calc.getErrorState()== false){
display1.setText(actionCommand);
calc.setArithmeticOp("+");
/*checks if the string is empty*/
if(!str.isEmpty()){
calc.setop1(str);
calc.setop2(str);
}
display1.setText(calc.getop1()+ "+");
str = "";
/*checks for - operation*/
} else if ("-".equals(actionCommand)&& calc.getErrorState()== false){
display1.setText(actionCommand);
calc.setArithmeticOp("-");
if(!str.isEmpty()){
calc.setop1(str);
calc.setop2(str);
}
display1.setText(calc.getop1()+ "-");
str = "";
/*checks for * operation*/
} else if ("*".equals(actionCommand)&& calc.getErrorState()== false){
display1.setText(actionCommand);
calc.setArithmeticOp("*");
if(!str.isEmpty()){
calc.setop1(str);
calc.setop2(str);
}
display1.setText(calc.getop1()+ "*");
str = "";
/*check for division operation*/
} else if ("/".equals(actionCommand) && calc.getErrorState()== false){
display1.setText(actionCommand);
calc.setArithmeticOp("/");
if(!str.isEmpty()){
calc.setop1(str);
calc.setop2(str);
}
display1.setText(calc.getop1()+ "/");
str = "";
/*checks for = operation*/
} else if ("=".equals(actionCommand)&& calc.getErrorState()== false){
/*if = button is clicked then it will do nothing*/
if ( calc.getTotal().equals("")){
str = "";
return;
}
/*if any number is divided by zero , generate error*/
if (calc.getTotal().equals("/") && str.equals("0")){
if (calc.getop1().equals("0")){
display2.setText("Result is undefined");
} else {
display2.setText("cannot divide by zero");
}
error.setText("E");
error.setBackground(Color.RED);
calc.setErrorState(true);
} else {
if (!str.isEmpty()){
calc.setop2(str);
}
display1.setText("");
display2.setText((calc.precesion()));
calc.setop1(calc.precesion());
str ="";
}
/*calls reset method*/
} else if ("C".equals(actionCommand)){
if (calc.getMode().equals("Int")){
display2.setText("0");
} else {
display2.setText("0.0");
}
calc.reset();
display1.setText("");
str = "";
error.setText("F");
error.setBackground(Color.YELLOW);
calc.setErrorState(false);
/*delete chars when backSpace is pressed*/
} else if ("\u21Da".equals(actionCommand)&& calc.getErrorState()== false){ /*backSpace*/
StringBuilder strB = new StringBuilder(str);
if (str.length() > 0) {
if(strB.toString().length()== 1 || strB.toString().length()== 2 && display2.getText().contains("-")){ // condition for the last digit if it was < 0
display2.setText("0.0");
if(error.getText().equals("I"))
display2.setText("0");
str = "";
}
else {
strB.deleteCharAt(str.length() - 1);
str = strB.toString();
display2.setText(str);
}
}
/*checks for . button*/
} else if (".".equals(actionCommand)&& calc.getErrorState()== false){
if (str.contains(".")){
return;
}
str += actionCommand;
display2.setText(str);
} else if ("\u00B1".equals(actionCommand)&& calc.getErrorState()== false){ /*plusMinus*/
if (str.length()==0){
display2.setText("0");
display1.setText("negate(0)");
}
if (str.length()> 0){
StringBuilder strB = new StringBuilder(str);
if (str.contains("-")){
strB.deleteCharAt(0);
str = strB.toString();
display2.setText(str);
} else {
str = "-" + str;
display2.setText(str);
}
}
}
}
}//end of inner class
/**
* Create KeyActions class that will accept keyBoard input
* @author Shubham
*/
private class KeyActions extends AbstractAction {
/**
*
*/
private static final long serialVersionUID = 1L;
/** the button to handle keyboard actions */
AbstractButton button;
/**
* Constructor to take the AbstractAction as a reference
* @param button - Abstraction type
*/
public KeyActions(AbstractButton button) {
this.button = button;
}
@Override
public void actionPerformed(ActionEvent e) {
button.doClick();
}
}
}
| 29.51114
| 153
| 0.662699
|
3823e1e21e0c06da61349582900e8e5efeab208d
| 1,717
|
package com.xeiam.xchange.hitbtc.service.polling;
import static org.junit.Assert.assertEquals;
import java.math.BigDecimal;
import org.junit.Test;
import com.xeiam.xchange.currency.CurrencyPair;
import com.xeiam.xchange.dto.Order;
import com.xeiam.xchange.dto.trade.LimitOrder;
public class HitbtcTradeServiceRawTest {
@Test
public void testReadSymbol() throws Exception {
String id = HitbtcTradeServiceRawPublic.createId(new LimitOrder(Order.OrderType.ASK, BigDecimal.ONE, CurrencyPair.BTC_EUR, null, null, BigDecimal.ONE), 0);
assertEquals("BTCEUR", HitbtcTradeServiceRawPublic.readSymbol(id));
assertEquals(Order.OrderType.ASK, HitbtcTradeServiceRawPublic.readOrderType(id));
}
@Test
public void testReadSymbolDoge() throws Exception {
String id = HitbtcTradeServiceRawPublic.createId(new LimitOrder(Order.OrderType.ASK, BigDecimal.ONE, CurrencyPair.DOGE_BTC, null, null, BigDecimal.ONE), 0);
assertEquals("DOGEBTC", HitbtcTradeServiceRawPublic.readSymbol(id));
assertEquals(Order.OrderType.ASK, HitbtcTradeServiceRawPublic.readOrderType(id));
}
}
class HitbtcTradeServiceRawPublic extends HitbtcTradeServiceRaw {
private HitbtcTradeServiceRawPublic() {
super(null, null);
}
public static String createSymbol(CurrencyPair pair) {
return HitbtcTradeServiceRaw.createSymbol(pair);
}
public static String createId(Order order, long nonce) {
return HitbtcTradeServiceRaw.createId(order, nonce);
}
public static Order.OrderType readOrderType(String orderId) {
return HitbtcTradeServiceRaw.readOrderType(orderId);
}
protected static String readSymbol(String orderId) {
return HitbtcTradeServiceRaw.readSymbol(orderId);
}
}
| 28.616667
| 160
| 0.781596
|
dbf6050e3eb9c117c80543a3b63b824421647898
| 1,055
|
package com.ruoyi.common.domain;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;
/**
* @author guozeqi
* @create 2020-11-02
*/
public class SessionContext {
private static SessionContext instance;
private Map<String, HttpSession> sessionMap;
private SessionContext() {
sessionMap = new HashMap<String, HttpSession>();
}
public static SessionContext getInstance() {
if (instance == null) {
instance = new SessionContext();
}
return instance;
}
public synchronized void addSession(HttpSession session) {
if (session != null) {
sessionMap.put(session.getId(), session);
}
}
public synchronized void delSession(HttpSession session) {
if (session != null) {
sessionMap.remove(session.getId());
}
}
public synchronized HttpSession getSession(String sessionId) {
if (sessionId == null)
return null;
return sessionMap.get(sessionId);
}
}
| 23.977273
| 66
| 0.628436
|
35e1b4fed1c9a549857157385c151609afb4138f
| 2,369
|
/* */
package slimebound.actions;
/* */
/* */
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.LoseHPAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.cards.CardGroup;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class SlimepotheosisAction extends com.megacrit.cardcrawl.actions.AbstractGameAction
/* */ {
public boolean upgraded;
/* */
public SlimepotheosisAction(boolean upgraded)
/* */ {
/* 14 */
this.duration = Settings.ACTION_DUR_MED;
/* 15 */
this.actionType = AbstractGameAction.ActionType.WAIT;
this.upgraded = upgraded;
/* */
}
/* */
/* */
public void update()
/* */ {
/* 20 */
if (this.duration == Settings.ACTION_DUR_MED) {
/* 21 */
AbstractPlayer p = com.megacrit.cardcrawl.dungeons.AbstractDungeon.player;
/* */
/* 23 */
upgradeAllCardsInGroup(p.hand, upgraded);
/* 28 */
this.isDone = true;
/* */
}
/* */
}
/* */
/* */
private void upgradeAllCardsInGroup(CardGroup cardGroup, boolean upgradedV) {
/* 33 */
for (AbstractCard c : cardGroup.group) {
/* 34 */
if (c.canUpgrade()) {
/* 35 */
if (cardGroup.type == CardGroup.CardGroupType.HAND) {
/* 36 */
c.superFlash();
/* */
}
/* 38 */
c.upgrade();
/* 39 */
c.applyPowers();
if (upgradedV) {
AbstractDungeon.actionManager.addToBottom(new LoseHPAction(AbstractDungeon.player, AbstractDungeon.player, 1));
} else {
AbstractDungeon.actionManager.addToBottom(new LoseHPAction(AbstractDungeon.player, AbstractDungeon.player, 2));
}
/* */
}
/* */
}
/* */
}
/* */
}
| 26.032967
| 131
| 0.494301
|
babbaec6942238365f11ef84c852c78187417169
| 1,351
|
package com.android.iam.whatsapp.helper;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.os.Build;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import java.util.ArrayList;
import java.util.List;
public class Permissao {
public static boolean validaPermissoes(int requestCode, Activity activity, String[] permissoes ){
if(Build.VERSION.SDK_INT >= 23 ){
List<String> listaPermissoes = new ArrayList<String>();
/*Percorre as permissões passadas, verificando uma a uma
* se já tem a permissao liberada */
for(String permissao : permissoes ){
Boolean validaPermissao = ContextCompat.checkSelfPermission(activity, permissao) == PackageManager.PERMISSION_GRANTED;
if( !validaPermissao ) listaPermissoes.add(permissao);
}
/*Caso a lista esteja vazia, não é necessário solicitar permissão*/
if( listaPermissoes.isEmpty() ) return true;
String[] novasPermissoes = new String[ listaPermissoes.size() ];
listaPermissoes.toArray( novasPermissoes );
//Solicita permissão
ActivityCompat.requestPermissions(activity, novasPermissoes, requestCode );
}
return true;
}
}
| 31.418605
| 134
| 0.677276
|
2800b24b99a2a7dd8f8038d52c9fbb8840da393a
| 2,533
|
/*
* Copyright 2019 Grabtaxi Holdings PTE LTE (GRAB), All rights reserved.
*
* Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
*
*/
package org.openstreetmap.josm.plugins.improveosm.argument;
import java.util.EnumSet;
import java.util.Set;
import org.openstreetmap.josm.plugins.improveosm.entity.Status;
import org.openstreetmap.josm.plugins.improveosm.entity.TileType;
import com.telenav.josm.common.entity.EntityUtil;
/**
* Defines the filters that can be applied to the MissingGeometryLayer.
*
* @author Beata
* @version $Revision$
*/
public class MissingGeometryFilter extends SearchFilter {
private final Set<TileType> types;
private final Integer count;
/** default search filter to be applied */
public static final MissingGeometryFilter DEFAULT =
new MissingGeometryFilter(SearchFilter.DEFAULT_SEARCH_FILTER.getStatus(), EnumSet.of(TileType.ROAD), null);
/**
* Builds a new filter with the given argument.
*
* @param status defines the tile/cluster status. Only tiles/clusters that has the specified status are displayed.
* @param types defines the tile type. Only tiles/clusters with the specified types are displayed.
* @param count defines the number of points/trips. Only clusters/tiles that has at least the given number of
* points/trips are displayed.
*/
public MissingGeometryFilter(final Status status, final Set<TileType> types, final Integer count) {
super(status);
this.types = types;
this.count = count;
}
public Set<TileType> getTypes() {
return types;
}
public Integer getCount() {
return count;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + EntityUtil.hashCode(count);
result = prime * result + EntityUtil.hashCode(types);
return result;
}
@Override
public boolean equals(final Object obj) {
boolean result = false;
if (this == obj) {
result = true;
} else if (obj != null && obj.getClass() == this.getClass()) {
final MissingGeometryFilter other = (MissingGeometryFilter) obj;
result = super.equals(other);
result = result && EntityUtil.bothNullOrEqual(count, other.getCount());
result = result && EntityUtil.bothNullOrEqual(types, other.getTypes());
}
return result;
}
}
| 32.896104
| 119
| 0.671931
|
9cbf67d1302dfc8eef6db959a80f00a04021f0b7
| 2,372
|
package com.thenetcircle.service.data.hive.udf.commons;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDFArgumentException;
import org.apache.hadoop.hive.ql.exec.UDFArgumentTypeException;
import org.apache.hadoop.hive.ql.metadata.HiveException;
import org.apache.hadoop.hive.ql.udf.UDFType;
import org.apache.hadoop.hive.ql.udf.generic.GenericUDF;
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
import org.apache.hadoop.hive.serde2.objectinspector.primitive.StringObjectInspector;
@Description(name = "mask_ip",
value = "_FUNC_(string) - Receives an IP address (v4 or v6) and returns a masked version of it")
@UDFType(deterministic = true, stateful = false, distinctLike = true)
public class UDFMaskIP extends GenericUDF {
private transient StringObjectInspector strInsp;
@Override
public ObjectInspector initialize(ObjectInspector[] args) throws UDFArgumentException {
checkArgsSize(args, 1, 1);
if (!(args[0] instanceof StringObjectInspector)) {
throw new UDFArgumentTypeException(0, "parameter must be string:\n\t" + args[0]);
}
this.strInsp = (StringObjectInspector) args[0];
return PrimitiveObjectInspectorFactory.javaStringObjectInspector;
}
@Override
public Object evaluate(DeferredObject[] args) throws HiveException {
if (args[0] == null || this.strInsp == null) return "null";
String ipValue = this.strInsp.getPrimitiveJavaObject(args[0].get());
if (StringUtils.isBlank(ipValue)) {
return "null";
}
String[] ipV4Split = ipValue.split("\\.");
if (ipV4Split.length == 4) {
return String.format("%s.%s.%s.0", ipV4Split[0], ipV4Split[1], ipV4Split[2]);
}
String[] ipV6Split = ipValue.split(":");
if (ipV6Split.length == 8) {
return String.format("%s:%s:%s:%s:%s:%s:0000:0000", ipV6Split[0], ipV6Split[1], ipV6Split[2], ipV6Split[3], ipV6Split[4], ipV6Split[5]);
}
return "null";
}
@Override
public String getDisplayString(String[] children) {
return String.format("mask_ip(%s)", StringUtils.join(children, ", "));
}
}
| 41.614035
| 148
| 0.695616
|
b4e849649ea97f2c16abd20d9f4c2454f7194de4
| 11,071
|
package com.ta.hyah;
import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProviders;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.ta.hyah.constants.Constants;
import com.ta.hyah.constants.DataSensorConstans;
import com.ta.hyah.model.DataBloodPresure;
import com.ta.hyah.socket.Pressure;
import org.w3c.dom.Text;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import io.netopen.hotbitmapgg.library.view.RingProgressBar;
public class StepBloodPresureActivity extends AppCompatActivity {
String deviceName;
String deviceMAC;
public static String systole;
public static String diastole;
public static String heartResult;
Pressure pressure;
String TAG = getClass().getSimpleName();
BluetoothModelView viewModel;
RingProgressBar ringProgressBar;
Button buttonS, btnConnect, btnNext;
int progress = 0;
TextView textViewResult, textViewSatuan, textViewResultH, textViewSatuanH;
LinearLayout linearLayoutBlood, linearLayoutHeart;
SharedPreferences sharedPreferences;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_step_blood_presure);
initView();
bluetoothArea();
ringHandler();
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
btnConnect.callOnClick();
}
}
}).start();
ringProgressBar.setOnProgressListener(new RingProgressBar.OnProgressListener() {
@Override
public void progressToComplete() {
Toast.makeText(getApplicationContext(), "Complete", Toast.LENGTH_LONG).show();
//btnNext.setEnabled(true);
}
});
}
public void initView() {
buttonS = findViewById(R.id.btnStartBlood);
ringProgressBar = findViewById(R.id.progress_bar_blood);
textViewResult = findViewById(R.id.tvResultBlood);
textViewSatuan = findViewById(R.id.tvSatuanBlood);
textViewResultH = findViewById(R.id.tvResultHeart);
textViewSatuanH = findViewById(R.id.tvSatuanHeart);
btnConnect = findViewById(R.id.btnConBlood);
btnNext = findViewById(R.id.btnNextStepBlood);
//btnNext.setEnabled(false);
linearLayoutBlood = findViewById(R.id.linearBlood);
linearLayoutHeart = findViewById(R.id.linearHeart);
linearLayoutBlood.setVisibility(View.INVISIBLE);
linearLayoutHeart.setVisibility(View.INVISIBLE);
textViewSatuan.setText(getResources().getString(R.string.mmhg));
textViewSatuanH.setText(getResources().getString(R.string.bpm));
}
public void ringHandler() {
@SuppressLint("HandlerLeak") Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 0) {
if (progress < 100) {
progress++;
ringProgressBar.setProgress(progress);
}
}
}
};
buttonS.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
viewModel.sendMessage("pressure,1#");
buttonS.setEnabled(false);
buttonS.setVisibility(View.GONE);
@SuppressLint("HandlerLeak") Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 0) {
if (progress < 85) {
progress++;
ringProgressBar.setProgress(progress);
}
}
}
};
new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
try {
Thread.sleep(500);
handler.sendEmptyMessage(0);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
});
}
public void bluetoothArea() {
viewModel = ViewModelProviders.of(this).get(BluetoothModelView.class);
if (!viewModel.setupViewModel(getIntent().getStringExtra("device_name"), getIntent().getStringExtra("device_mac"))) {
finish();
return;
}
viewModel.getConnectionStatus().observe(this, this::onConnectionStatus);
viewModel.getDeviceName().observe(this, name -> setTitle(getString(R.string.device_name_format, name)));
viewModel.getMessages().observe(this, message -> {
if (TextUtils.isEmpty(message)) {
message = "NO message";
}
Log.d(TAG, viewModel.getDataMessage());
String msg = viewModel.getDataMessage();
if (!msg.equals("no message")) {
if (msg.equals("ahay")) {
@SuppressLint("HandlerLeak") Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == 0) {
if (progress < 100) {
progress++;
ringProgressBar.setProgress(progress);
}
}
}
};
new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
try {
Thread.sleep(50);
handler.sendEmptyMessage(0);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
ArrayList<String> geee = new ArrayList<>();
for (int i = 0; i < DataSensorConstans.arrayListBloodPresures.size(); i++) {
geee.add(DataSensorConstans.arrayListBloodPresures.get(i).getsBloodPresure());
}
pressure = new Pressure(geee);
textViewResult.setText(pressure.getPressure());
textViewResultH.setText(pressure.getHeartRate());
linearLayoutBlood.setVisibility(View.VISIBLE);
linearLayoutHeart.setVisibility(View.VISIBLE);
systole = String.valueOf(pressure.systole);
diastole = String.valueOf(pressure.diastole);
heartResult = String.valueOf(pressure.getHeartRate());
Log.d(TAG, "bluetoothArea: " + systole + "/" + diastole);
return;
}
Pattern p = Pattern.compile("^[-+]?[0-9]*\\.?[0-9]+$");
Matcher m = p.matcher(msg);
if (m.find()) {
DataSensorConstans.arrayListBloodPresures.add(new DataBloodPresure(msg));
}
}
});
viewModel.getMessage().observe(this, message -> {
// Only update the message if the ViewModel is trying to reset it
if (TextUtils.isEmpty(message)) {
}
});
deviceName = getIntent().getStringExtra("device_name");
deviceMAC = getIntent().getStringExtra("device_mac");
Log.d(TAG, "bluetoothArea: " + deviceName + deviceMAC);
btnNext.setOnClickListener(View -> openBodyTempt(deviceName, deviceMAC));
}
public void openBodyTempt(String deviceName, String macAddress) {
Intent intent = new Intent(this, StepBodyTempretureActivity.class);
intent.putExtra("device_name", deviceName);
intent.putExtra("device_mac", macAddress);
startActivity(intent);
viewModel.disconnect();
}
private void onConnectionStatus(BluetoothModelView.ConnectionStatus connectionStatus) {
switch (connectionStatus) {
case CONNECTED:
Log.d(TAG, "onConnectionStatus: Connected");
Toast.makeText(getApplicationContext(), "connected", Toast.LENGTH_LONG).show();
Log.d(TAG, "onConnectionStatus: Connected " + deviceName + " " + deviceMAC);
buttonS.setEnabled(true);
btnConnect.setEnabled(true);
btnConnect.setText("Disconnect");
btnConnect.setOnClickListener(v -> viewModel.disconnect());
break;
case CONNECTING:
Log.d(TAG, "onConnectionStatus: Connecting");
Toast.makeText(getApplicationContext(), "Connecting", Toast.LENGTH_LONG).show();
Log.d(TAG, "onConnectionStatus: Connecting " + deviceName + " " + deviceMAC);
btnConnect.setEnabled(false);
btnConnect.setText("Connect");
break;
case DISCONNECTED:
Log.d(TAG, "onConnectionStatus: Disconnected");
Toast.makeText(getApplicationContext(), "Disconnected", Toast.LENGTH_LONG).show();
Log.d(TAG, "onConnectionStatus: Disconnected " + deviceName + " " + deviceMAC);
buttonS.setEnabled(false);
btnConnect.setEnabled(true);
btnConnect.setText("Connect");
btnConnect.setOnClickListener(v -> viewModel.connect());
break;
}
}
@Override
protected void onDestroy() {
super.onDestroy();
viewModel.disconnect();
Log.d(TAG, "onDestroy: " + deviceName + " " + deviceMAC);
}
/*@Override
public void onBackPressed() {
}*/
}
| 37.276094
| 125
| 0.541505
|
cb38b2785ddf218562215c4e5fa6a22f6e3f4f1b
| 6,125
|
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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 jenkins.plugins.office365connector;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import hudson.model.Cause;
import hudson.model.Run;
import hudson.model.User;
import hudson.scm.ChangeLogSet;
import hudson.tasks.test.AbstractTestResultAction;
import jenkins.plugins.office365connector.model.Fact;
import jenkins.plugins.office365connector.utils.TimeUtils;
import jenkins.scm.RunWithSCM;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
/**
* Collects helper methods that create instance of {@link jenkins.plugins.office365connector.model.Fact Fact} class.
*
* @author Damian Szczepanik (damianszczepanik@github)
*/
public class FactsBuilder {
final static String NAME_STATUS = "Status";
private final static String NAME_REMARKS = "Remarks";
final static String NAME_CULPRITS = "Culprits";
private final static String NAME_DEVELOPERS = "Developers";
final static String NAME_START_TIME = "Start time";
final static String NAME_COMPLETION_TIME = "Completion time";
final static String NAME_BACK_TO_NORMAL_TIME = "Back to normal time";
final static String NAME_FAILING_SINCE_TIME = "Failing since time";
final static String NAME_FAILING_SINCE_BUILD = "Failing since build";
private final static String NAME_TOTAL_TESTS = "Total tests";
private final static String NAME_FAILED_TESTS = "Failed tests";
private final static String NAME_SKIPPED_TESTS = "Skipped tests";
private final static String NAME_PASSED_TESTS = "Passed tests";
final static String VALUE_STATUS_STARTED = "Started";
final static String VALUE_STATUS_RUNNING = "Running";
private final List<Fact> facts = new ArrayList<>();
private final Run run;
public FactsBuilder(Run run) {
this.run = run;
}
public void addStatusStarted() {
addFact(NAME_STATUS, VALUE_STATUS_STARTED);
}
public void addStatusRunning() {
addFact(NAME_STATUS, VALUE_STATUS_RUNNING);
}
public static Fact buildStatus() {
return new Fact(NAME_STATUS);
}
public void addStartTime() {
addFact(NAME_START_TIME, TimeUtils.dateToString(run.getStartTimeInMillis()));
}
public void addBackToNormalTime(long duration) {
addFact(NAME_BACK_TO_NORMAL_TIME, TimeUtils.durationToString(duration / 1000));
}
public void addCompletionTime() {
long completionTime = TimeUtils.countCompletionTime(run.getStartTimeInMillis(), run.getDuration());
addFact(NAME_COMPLETION_TIME, TimeUtils.dateToString(completionTime));
}
public void addFailingSinceTime(long date) {
addFact(NAME_FAILING_SINCE_TIME, TimeUtils.dateToString(date));
}
public void addFailingSinceBuild(int buildNumber) {
addFact(NAME_FAILING_SINCE_BUILD, String.valueOf(buildNumber));
}
public void addRemarks() {
List<Cause> causes = run.getCauses();
if (CollectionUtils.isEmpty(causes)) {
return;
}
StringBuilder causesStr = new StringBuilder();
for (Cause cause : causes) {
causesStr.append(cause.getShortDescription()).append(". ");
}
addFact(NAME_REMARKS, causesStr.toString());
}
public void addCulprits() {
if (!(run instanceof RunWithSCM)) {
return;
}
RunWithSCM runWithSCM = (RunWithSCM) run;
Set<User> authors = runWithSCM.getCulprits();
if (CollectionUtils.isEmpty(authors)) {
return;
}
List<String> culprits = authors.stream().map(User::getFullName).collect(Collectors.toList());
if (!culprits.isEmpty()) {
addFact(NAME_CULPRITS, StringUtils.join(culprits, ", "));
}
}
public void addDevelopers() {
if (!(run instanceof RunWithSCM)) {
return;
}
RunWithSCM runWithSCM = (RunWithSCM) run;
List<ChangeLogSet<ChangeLogSet.Entry>> sets = runWithSCM.getChangeSets();
if (sets.isEmpty()) {
return;
}
Set<User> authors = new HashSet<>();
sets.stream().filter(
set -> set instanceof ChangeLogSet).forEach(
set -> set.forEach(entry -> authors.add(entry.getAuthor()))
);
if (CollectionUtils.isEmpty(authors)) {
return;
}
addFact(NAME_DEVELOPERS, StringUtils.join(authors, ", "));
}
public void addTests() {
AbstractTestResultAction<?> action = run.getAction(AbstractTestResultAction.class);
if (action == null) {
return;
}
addFact(NAME_TOTAL_TESTS, action.getTotalCount());
addFact(NAME_PASSED_TESTS, action.getTotalCount() - action.getFailCount() - action.getSkipCount());
addFact(NAME_FAILED_TESTS, action.getFailCount());
addFact(NAME_SKIPPED_TESTS, action.getSkipCount());
}
public void addFact(String name, int value) {
if (value != 0) {
addFact(name, String.valueOf(value));
}
}
public void addFact(String name, String value) {
if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) {
facts.add(new Fact(name, value));
}
}
public void addFact(Fact fact) {
facts.add(fact);
}
/**
* Returns collected facts.
*
* @return collected facts
*/
public List<Fact> collect() {
return facts;
}
}
| 32.754011
| 116
| 0.670694
|
a97565b2daaa7f7aec3de136b9fd82a4c72c12eb
| 65,391
|
/*
* Generated by the Jasper component of Apache Tomcat
* Version: Apache Tomcat/7.0.55
* Generated at: 2016-07-20 01:24:21 UTC
* Note: The last modified time of this file was set to
* the last modified time of the source file after
* generation to assist with modification tracking.
*/
package org.apache.jsp.secure.admin.views.permissions;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class deletepermission_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final javax.servlet.jsp.JspFactory _jspxFactory =
javax.servlet.jsp.JspFactory.getDefaultFactory();
private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
static {
_jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
_jspx_dependants.put("/WEB-INF/tld/webwork.tld", Long.valueOf(1467871584000L));
_jspx_dependants.put("/WEB-INF/tld/sitemesh-page.tld", Long.valueOf(1467871584000L));
}
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005furl_0026_005fpage;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005fparam_0026_005fvalue_005fname_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005ftext_0026_005fname;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005fparam_0026_005fname;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005fif_0026_005ftest;
private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fww_005felse;
private javax.el.ExpressionFactory _el_expressionfactory;
private org.apache.tomcat.InstanceManager _jsp_instancemanager;
public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
return _jspx_dependants;
}
public void _jspInit() {
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fww_005furl_0026_005fpage = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fww_005fparam_0026_005fvalue_005fname_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fww_005fparam_0026_005fname = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fww_005fif_0026_005ftest = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_005fjspx_005ftagPool_005fww_005felse = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
_el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
_jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
}
public void _jspDestroy() {
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.release();
_005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname.release();
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.release();
_005fjspx_005ftagPool_005fww_005furl_0026_005fpage.release();
_005fjspx_005ftagPool_005fww_005fparam_0026_005fvalue_005fname_005fnobody.release();
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.release();
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname.release();
_005fjspx_005ftagPool_005fww_005fparam_0026_005fname.release();
_005fjspx_005ftagPool_005fww_005fif_0026_005ftest.release();
_005fjspx_005ftagPool_005fww_005felse.release();
}
public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException {
final javax.servlet.jsp.PageContext pageContext;
javax.servlet.http.HttpSession session = null;
final javax.servlet.ServletContext application;
final javax.servlet.ServletConfig config;
javax.servlet.jsp.JspWriter out = null;
final java.lang.Object page = this;
javax.servlet.jsp.JspWriter _jspx_out = null;
javax.servlet.jsp.PageContext _jspx_page_context = null;
try {
response.setContentType("text/html");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("\n");
out.write("<html>\n");
out.write("<head>\n");
out.write("\t<title>");
if (_jspx_meth_ww_005ftext_005f0(_jspx_page_context))
return;
out.write("</title>\n");
out.write(" <meta name=\"admin.active.section\" content=\"admin_issues_menu/misc_schemes_section\"/>\n");
out.write(" <meta name=\"admin.active.tab\" content=\"permission_schemes\"/>\n");
out.write("</head>\n");
out.write("\n");
out.write("<body>\n");
out.write("\n");
out.write(" <p>\n");
out.write(" <table width=100% cellpadding=10 cellspacing=0 border=0>\n");
out.write(" ");
if (_jspx_meth_page_005fapplyDecorator_005f0(_jspx_page_context))
return;
out.write("\n");
out.write(" </table>\n");
out.write(" </p>\n");
out.write("\n");
out.write("</body>\n");
out.write("</html>\n");
} catch (java.lang.Throwable t) {
if (!(t instanceof javax.servlet.jsp.SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
try {
if (response.isCommitted()) {
out.flush();
} else {
out.clearBuffer();
}
} catch (java.io.IOException e) {}
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
else throw new ServletException(t);
}
} finally {
_jspxFactory.releasePageContext(_jspx_page_context);
}
}
private boolean _jspx_meth_ww_005ftext_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:text
com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f0 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class);
_jspx_th_ww_005ftext_005f0.setPageContext(_jspx_page_context);
_jspx_th_ww_005ftext_005f0.setParent(null);
// /secure/admin/views/permissions/deletepermission.jsp(8,8) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005ftext_005f0.setName("'admin.projects.editpermissions.delete.permission'");
int _jspx_eval_ww_005ftext_005f0 = _jspx_th_ww_005ftext_005f0.doStartTag();
if (_jspx_th_ww_005ftext_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f0);
return true;
}
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f0);
return false;
}
private boolean _jspx_meth_page_005fapplyDecorator_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:applyDecorator
com.atlassian.jira.web.tags.JiraApplyDecoratorTag _jspx_th_page_005fapplyDecorator_005f0 = (com.atlassian.jira.web.tags.JiraApplyDecoratorTag) _005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname.get(com.atlassian.jira.web.tags.JiraApplyDecoratorTag.class);
_jspx_th_page_005fapplyDecorator_005f0.setPageContext(_jspx_page_context);
_jspx_th_page_005fapplyDecorator_005f0.setParent(null);
// /secure/admin/views/permissions/deletepermission.jsp(17,4) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fapplyDecorator_005f0.setName("jiraform");
int _jspx_eval_page_005fapplyDecorator_005f0 = _jspx_th_page_005fapplyDecorator_005f0.doStartTag();
if (_jspx_eval_page_005fapplyDecorator_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fapplyDecorator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fapplyDecorator_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fapplyDecorator_005f0.doInitBody();
}
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_page_005fparam_005f0(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_page_005fparam_005f1(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_page_005fparam_005f2(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" \t");
if (_jspx_meth_page_005fparam_005f3(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_page_005fparam_005f4(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_page_005fparam_005f5(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_page_005fparam_005f6(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write("\t ");
if (_jspx_meth_page_005fparam_005f7(_jspx_th_page_005fapplyDecorator_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_page_005fapplyDecorator_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fapplyDecorator_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fapplyDecorator_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname.reuse(_jspx_th_page_005fapplyDecorator_005f0);
return true;
}
_005fjspx_005ftagPool_005fpage_005fapplyDecorator_0026_005fname.reuse(_jspx_th_page_005fapplyDecorator_005f0);
return false;
}
private boolean _jspx_meth_page_005fparam_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:param
com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f0 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class);
_jspx_th_page_005fparam_005f0.setPageContext(_jspx_page_context);
_jspx_th_page_005fparam_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(18,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fparam_005f0.setName("action");
int _jspx_eval_page_005fparam_005f0 = _jspx_th_page_005fparam_005f0.doStartTag();
if (_jspx_eval_page_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fparam_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fparam_005f0.doInitBody();
}
do {
out.write("DeletePermission.jspa");
int evalDoAfterBody = _jspx_th_page_005fparam_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fparam_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fparam_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f0);
return true;
}
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f0);
return false;
}
private boolean _jspx_meth_page_005fparam_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:param
com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f1 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class);
_jspx_th_page_005fparam_005f1.setPageContext(_jspx_page_context);
_jspx_th_page_005fparam_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(19,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fparam_005f1.setName("submitId");
int _jspx_eval_page_005fparam_005f1 = _jspx_th_page_005fparam_005f1.doStartTag();
if (_jspx_eval_page_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fparam_005f1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fparam_005f1.doInitBody();
}
do {
out.write("delete_submit");
int evalDoAfterBody = _jspx_th_page_005fparam_005f1.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fparam_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f1);
return true;
}
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f1);
return false;
}
private boolean _jspx_meth_page_005fparam_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:param
com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f2 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class);
_jspx_th_page_005fparam_005f2.setPageContext(_jspx_page_context);
_jspx_th_page_005fparam_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(20,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fparam_005f2.setName("submitName");
int _jspx_eval_page_005fparam_005f2 = _jspx_th_page_005fparam_005f2.doStartTag();
if (_jspx_eval_page_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fparam_005f2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fparam_005f2.doInitBody();
}
do {
if (_jspx_meth_ww_005ftext_005f1(_jspx_th_page_005fparam_005f2, _jspx_page_context))
return true;
int evalDoAfterBody = _jspx_th_page_005fparam_005f2.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fparam_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f2);
return true;
}
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f2);
return false;
}
private boolean _jspx_meth_ww_005ftext_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f2, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:text
com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f1 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class);
_jspx_th_ww_005ftext_005f1.setPageContext(_jspx_page_context);
_jspx_th_ww_005ftext_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f2);
// /secure/admin/views/permissions/deletepermission.jsp(20,38) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005ftext_005f1.setName("'common.words.delete'");
int _jspx_eval_ww_005ftext_005f1 = _jspx_th_ww_005ftext_005f1.doStartTag();
if (_jspx_th_ww_005ftext_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f1);
return true;
}
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f1);
return false;
}
private boolean _jspx_meth_page_005fparam_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:param
com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f3 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class);
_jspx_th_page_005fparam_005f3.setPageContext(_jspx_page_context);
_jspx_th_page_005fparam_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(21,5) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fparam_005f3.setName("cancelURI");
int _jspx_eval_page_005fparam_005f3 = _jspx_th_page_005fparam_005f3.doStartTag();
if (_jspx_eval_page_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fparam_005f3.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fparam_005f3.doInitBody();
}
do {
if (_jspx_meth_ww_005furl_005f0(_jspx_th_page_005fparam_005f3, _jspx_page_context))
return true;
int evalDoAfterBody = _jspx_th_page_005fparam_005f3.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fparam_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f3);
return true;
}
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f3);
return false;
}
private boolean _jspx_meth_ww_005furl_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f3, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:url
com.atlassian.jira.web.tags.URLTag _jspx_th_ww_005furl_005f0 = (com.atlassian.jira.web.tags.URLTag) _005fjspx_005ftagPool_005fww_005furl_0026_005fpage.get(com.atlassian.jira.web.tags.URLTag.class);
_jspx_th_ww_005furl_005f0.setPageContext(_jspx_page_context);
_jspx_th_ww_005furl_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f3);
// /secure/admin/views/permissions/deletepermission.jsp(21,34) name = page type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005furl_005f0.setPage("EditPermissions!default.jspa");
int _jspx_eval_ww_005furl_005f0 = _jspx_th_ww_005furl_005f0.doStartTag();
if (_jspx_eval_ww_005furl_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_ww_005furl_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_ww_005furl_005f0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_ww_005furl_005f0.doInitBody();
}
do {
if (_jspx_meth_ww_005fparam_005f0(_jspx_th_ww_005furl_005f0, _jspx_page_context))
return true;
int evalDoAfterBody = _jspx_th_ww_005furl_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_ww_005furl_005f0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_ww_005furl_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005furl_0026_005fpage.reuse(_jspx_th_ww_005furl_005f0);
return true;
}
_005fjspx_005ftagPool_005fww_005furl_0026_005fpage.reuse(_jspx_th_ww_005furl_005f0);
return false;
}
private boolean _jspx_meth_ww_005fparam_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005furl_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:param
webwork.view.taglib.ParamTag _jspx_th_ww_005fparam_005f0 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005fww_005fparam_0026_005fvalue_005fname_005fnobody.get(webwork.view.taglib.ParamTag.class);
_jspx_th_ww_005fparam_005f0.setPageContext(_jspx_page_context);
_jspx_th_ww_005fparam_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005furl_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(21,78) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fparam_005f0.setName("'schemeId'");
// /secure/admin/views/permissions/deletepermission.jsp(21,78) name = value type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fparam_005f0.setValue("schemeId");
int _jspx_eval_ww_005fparam_005f0 = _jspx_th_ww_005fparam_005f0.doStartTag();
if (_jspx_th_ww_005fparam_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fparam_0026_005fvalue_005fname_005fnobody.reuse(_jspx_th_ww_005fparam_005f0);
return true;
}
_005fjspx_005ftagPool_005fww_005fparam_0026_005fvalue_005fname_005fnobody.reuse(_jspx_th_ww_005fparam_005f0);
return false;
}
private boolean _jspx_meth_page_005fparam_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:param
com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f4 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class);
_jspx_th_page_005fparam_005f4.setPageContext(_jspx_page_context);
_jspx_th_page_005fparam_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(22,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fparam_005f4.setName("title");
int _jspx_eval_page_005fparam_005f4 = _jspx_th_page_005fparam_005f4.doStartTag();
if (_jspx_eval_page_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fparam_005f4.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fparam_005f4.doInitBody();
}
do {
if (_jspx_meth_ww_005ftext_005f2(_jspx_th_page_005fparam_005f4, _jspx_page_context))
return true;
int evalDoAfterBody = _jspx_th_page_005fparam_005f4.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fparam_005f4 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fparam_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f4);
return true;
}
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f4);
return false;
}
private boolean _jspx_meth_ww_005ftext_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f4, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:text
com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f2 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class);
_jspx_th_ww_005ftext_005f2.setPageContext(_jspx_page_context);
_jspx_th_ww_005ftext_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f4);
// /secure/admin/views/permissions/deletepermission.jsp(22,33) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005ftext_005f2.setName("'admin.projects.editpermissions.delete.permission'");
int _jspx_eval_ww_005ftext_005f2 = _jspx_th_ww_005ftext_005f2.doStartTag();
if (_jspx_th_ww_005ftext_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f2);
return true;
}
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f2);
return false;
}
private boolean _jspx_meth_page_005fparam_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:param
com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f5 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class);
_jspx_th_page_005fparam_005f5.setPageContext(_jspx_page_context);
_jspx_th_page_005fparam_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(23,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fparam_005f5.setName("width");
int _jspx_eval_page_005fparam_005f5 = _jspx_th_page_005fparam_005f5.doStartTag();
if (_jspx_eval_page_005fparam_005f5 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fparam_005f5 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fparam_005f5.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fparam_005f5.doInitBody();
}
do {
out.write("100%");
int evalDoAfterBody = _jspx_th_page_005fparam_005f5.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fparam_005f5 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fparam_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f5);
return true;
}
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f5);
return false;
}
private boolean _jspx_meth_page_005fparam_005f6(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:param
com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f6 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class);
_jspx_th_page_005fparam_005f6.setPageContext(_jspx_page_context);
_jspx_th_page_005fparam_005f6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(24,8) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fparam_005f6.setName("autoSelectFirst");
int _jspx_eval_page_005fparam_005f6 = _jspx_th_page_005fparam_005f6.doStartTag();
if (_jspx_eval_page_005fparam_005f6 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fparam_005f6 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fparam_005f6.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fparam_005f6.doInitBody();
}
do {
out.write("false");
int evalDoAfterBody = _jspx_th_page_005fparam_005f6.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fparam_005f6 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fparam_005f6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f6);
return true;
}
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f6);
return false;
}
private boolean _jspx_meth_page_005fparam_005f7(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fapplyDecorator_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// page:param
com.opensymphony.module.sitemesh.taglib.page.ParamTag _jspx_th_page_005fparam_005f7 = (com.opensymphony.module.sitemesh.taglib.page.ParamTag) _005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.get(com.opensymphony.module.sitemesh.taglib.page.ParamTag.class);
_jspx_th_page_005fparam_005f7.setPageContext(_jspx_page_context);
_jspx_th_page_005fparam_005f7.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fapplyDecorator_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(25,5) name = name type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_page_005fparam_005f7.setName("description");
int _jspx_eval_page_005fparam_005f7 = _jspx_th_page_005fparam_005f7.doStartTag();
if (_jspx_eval_page_005fparam_005f7 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_page_005fparam_005f7 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_page_005fparam_005f7.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_page_005fparam_005f7.doInitBody();
}
do {
out.write("\n");
out.write(" <input type=\"hidden\" name=\"schemeId\" value=\"");
if (_jspx_meth_ww_005fproperty_005f0(_jspx_th_page_005fparam_005f7, _jspx_page_context))
return true;
out.write("\">\n");
out.write(" <input type=\"hidden\" name=\"id\" value=\"");
if (_jspx_meth_ww_005fproperty_005f1(_jspx_th_page_005fparam_005f7, _jspx_page_context))
return true;
out.write("\">\n");
out.write(" <input type=\"hidden\" name=\"confirmed\" value=\"true\">\n");
out.write(" ");
if (_jspx_meth_ww_005ftext_005f3(_jspx_th_page_005fparam_005f7, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_page_005fparam_005f7.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_page_005fparam_005f7 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_page_005fparam_005f7.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f7);
return true;
}
_005fjspx_005ftagPool_005fpage_005fparam_0026_005fname.reuse(_jspx_th_page_005fparam_005f7);
return false;
}
private boolean _jspx_meth_ww_005fproperty_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f7, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:property
webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f0 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class);
_jspx_th_ww_005fproperty_005f0.setPageContext(_jspx_page_context);
_jspx_th_ww_005fproperty_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f7);
// /secure/admin/views/permissions/deletepermission.jsp(26,52) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fproperty_005f0.setValue("schemeId");
int _jspx_eval_ww_005fproperty_005f0 = _jspx_th_ww_005fproperty_005f0.doStartTag();
if (_jspx_th_ww_005fproperty_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f0);
return true;
}
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f0);
return false;
}
private boolean _jspx_meth_ww_005fproperty_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f7, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:property
webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f1 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class);
_jspx_th_ww_005fproperty_005f1.setPageContext(_jspx_page_context);
_jspx_th_ww_005fproperty_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f7);
// /secure/admin/views/permissions/deletepermission.jsp(27,46) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fproperty_005f1.setValue("id");
int _jspx_eval_ww_005fproperty_005f1 = _jspx_th_ww_005fproperty_005f1.doStartTag();
if (_jspx_th_ww_005fproperty_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f1);
return true;
}
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f1);
return false;
}
private boolean _jspx_meth_ww_005ftext_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_page_005fparam_005f7, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:text
com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f3 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname.get(com.atlassian.jira.web.tags.TextTag.class);
_jspx_th_ww_005ftext_005f3.setPageContext(_jspx_page_context);
_jspx_th_ww_005ftext_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_page_005fparam_005f7);
// /secure/admin/views/permissions/deletepermission.jsp(29,12) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005ftext_005f3.setName("'admin.permissions.deleting.confirmation'");
int _jspx_eval_ww_005ftext_005f3 = _jspx_th_ww_005ftext_005f3.doStartTag();
if (_jspx_eval_ww_005ftext_005f3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_ww_005ftext_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_ww_005ftext_005f3.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_ww_005ftext_005f3.doInitBody();
}
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_ww_005fparam_005f1(_jspx_th_ww_005ftext_005f3, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_ww_005fparam_005f2(_jspx_th_ww_005ftext_005f3, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_ww_005fparam_005f3(_jspx_th_ww_005ftext_005f3, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_ww_005ftext_005f3.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_ww_005ftext_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_ww_005ftext_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname.reuse(_jspx_th_ww_005ftext_005f3);
return true;
}
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname.reuse(_jspx_th_ww_005ftext_005f3);
return false;
}
private boolean _jspx_meth_ww_005fparam_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005ftext_005f3, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:param
webwork.view.taglib.ParamTag _jspx_th_ww_005fparam_005f1 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class);
_jspx_th_ww_005fparam_005f1.setPageContext(_jspx_page_context);
_jspx_th_ww_005fparam_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005ftext_005f3);
// /secure/admin/views/permissions/deletepermission.jsp(30,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fparam_005f1.setName("'value0'");
int _jspx_eval_ww_005fparam_005f1 = _jspx_th_ww_005fparam_005f1.doStartTag();
if (_jspx_eval_ww_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_ww_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_ww_005fparam_005f1.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_ww_005fparam_005f1.doInitBody();
}
do {
out.write("\n");
out.write(" <b>\n");
out.write(" ");
if (_jspx_meth_ww_005fif_005f0(_jspx_th_ww_005fparam_005f1, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_ww_005felse_005f0(_jspx_th_ww_005fparam_005f1, _jspx_page_context))
return true;
out.write("\n");
out.write(" </b>\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_ww_005fparam_005f1.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_ww_005fparam_005f1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_ww_005fparam_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f1);
return true;
}
_005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f1);
return false;
}
private boolean _jspx_meth_ww_005fif_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fparam_005f1, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:if
webwork.view.taglib.IfTag _jspx_th_ww_005fif_005f0 = (webwork.view.taglib.IfTag) _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.get(webwork.view.taglib.IfTag.class);
_jspx_th_ww_005fif_005f0.setPageContext(_jspx_page_context);
_jspx_th_ww_005fif_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fparam_005f1);
// /secure/admin/views/permissions/deletepermission.jsp(32,20) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fif_005f0.setTest("permissionDisplayName == 'Group' && permissionParameter == null");
int _jspx_eval_ww_005fif_005f0 = _jspx_th_ww_005fif_005f0.doStartTag();
if (_jspx_eval_ww_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_ww_005ftext_005f4(_jspx_th_ww_005fif_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_ww_005fif_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_ww_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f0);
return true;
}
_005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f0);
return false;
}
private boolean _jspx_meth_ww_005ftext_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fif_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:text
com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f4 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class);
_jspx_th_ww_005ftext_005f4.setPageContext(_jspx_page_context);
_jspx_th_ww_005ftext_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fif_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(33,24) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005ftext_005f4.setName("'common.words.anonymous'");
int _jspx_eval_ww_005ftext_005f4 = _jspx_th_ww_005ftext_005f4.doStartTag();
if (_jspx_th_ww_005ftext_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f4);
return true;
}
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f4);
return false;
}
private boolean _jspx_meth_ww_005felse_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fparam_005f1, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:else
webwork.view.taglib.ElseTag _jspx_th_ww_005felse_005f0 = (webwork.view.taglib.ElseTag) _005fjspx_005ftagPool_005fww_005felse.get(webwork.view.taglib.ElseTag.class);
_jspx_th_ww_005felse_005f0.setPageContext(_jspx_page_context);
_jspx_th_ww_005felse_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fparam_005f1);
int _jspx_eval_ww_005felse_005f0 = _jspx_th_ww_005felse_005f0.doStartTag();
if (_jspx_eval_ww_005felse_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_ww_005fproperty_005f2(_jspx_th_ww_005felse_005f0, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_ww_005felse_005f0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_ww_005felse_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005felse.reuse(_jspx_th_ww_005felse_005f0);
return true;
}
_005fjspx_005ftagPool_005fww_005felse.reuse(_jspx_th_ww_005felse_005f0);
return false;
}
private boolean _jspx_meth_ww_005fproperty_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005felse_005f0, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:property
webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f2 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class);
_jspx_th_ww_005fproperty_005f2.setPageContext(_jspx_page_context);
_jspx_th_ww_005fproperty_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005felse_005f0);
// /secure/admin/views/permissions/deletepermission.jsp(36,24) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fproperty_005f2.setValue("permissionDisplayName");
int _jspx_eval_ww_005fproperty_005f2 = _jspx_th_ww_005fproperty_005f2.doStartTag();
if (_jspx_th_ww_005fproperty_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f2);
return true;
}
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f2);
return false;
}
private boolean _jspx_meth_ww_005fparam_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005ftext_005f3, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:param
webwork.view.taglib.ParamTag _jspx_th_ww_005fparam_005f2 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class);
_jspx_th_ww_005fparam_005f2.setPageContext(_jspx_page_context);
_jspx_th_ww_005fparam_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005ftext_005f3);
// /secure/admin/views/permissions/deletepermission.jsp(40,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fparam_005f2.setName("'value1'");
int _jspx_eval_ww_005fparam_005f2 = _jspx_th_ww_005fparam_005f2.doStartTag();
if (_jspx_eval_ww_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_ww_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_ww_005fparam_005f2.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_ww_005fparam_005f2.doInitBody();
}
do {
out.write("\n");
out.write(" ");
if (_jspx_meth_ww_005fif_005f1(_jspx_th_ww_005fparam_005f2, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
if (_jspx_meth_ww_005felse_005f1(_jspx_th_ww_005fparam_005f2, _jspx_page_context))
return true;
out.write("\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_ww_005fparam_005f2.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_ww_005fparam_005f2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_ww_005fparam_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f2);
return true;
}
_005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f2);
return false;
}
private boolean _jspx_meth_ww_005fif_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fparam_005f2, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:if
webwork.view.taglib.IfTag _jspx_th_ww_005fif_005f1 = (webwork.view.taglib.IfTag) _005fjspx_005ftagPool_005fww_005fif_0026_005ftest.get(webwork.view.taglib.IfTag.class);
_jspx_th_ww_005fif_005f1.setPageContext(_jspx_page_context);
_jspx_th_ww_005fif_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fparam_005f2);
// /secure/admin/views/permissions/deletepermission.jsp(41,20) name = test type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fif_005f1.setTest("permissionParameter != null");
int _jspx_eval_ww_005fif_005f1 = _jspx_th_ww_005fif_005f1.doStartTag();
if (_jspx_eval_ww_005fif_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\n");
out.write(" (");
if (_jspx_meth_ww_005fproperty_005f3(_jspx_th_ww_005fif_005f1, _jspx_page_context))
return true;
out.write(")\n");
out.write(" ");
int evalDoAfterBody = _jspx_th_ww_005fif_005f1.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_ww_005fif_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f1);
return true;
}
_005fjspx_005ftagPool_005fww_005fif_0026_005ftest.reuse(_jspx_th_ww_005fif_005f1);
return false;
}
private boolean _jspx_meth_ww_005fproperty_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fif_005f1, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:property
webwork.view.taglib.PropertyTag _jspx_th_ww_005fproperty_005f3 = (webwork.view.taglib.PropertyTag) _005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.get(webwork.view.taglib.PropertyTag.class);
_jspx_th_ww_005fproperty_005f3.setPageContext(_jspx_page_context);
_jspx_th_ww_005fproperty_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fif_005f1);
// /secure/admin/views/permissions/deletepermission.jsp(42,31) name = value type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fproperty_005f3.setValue("permissionParameter");
int _jspx_eval_ww_005fproperty_005f3 = _jspx_th_ww_005fproperty_005f3.doStartTag();
if (_jspx_th_ww_005fproperty_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f3);
return true;
}
_005fjspx_005ftagPool_005fww_005fproperty_0026_005fvalue_005fnobody.reuse(_jspx_th_ww_005fproperty_005f3);
return false;
}
private boolean _jspx_meth_ww_005felse_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fparam_005f2, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:else
webwork.view.taglib.ElseTag _jspx_th_ww_005felse_005f1 = (webwork.view.taglib.ElseTag) _005fjspx_005ftagPool_005fww_005felse.get(webwork.view.taglib.ElseTag.class);
_jspx_th_ww_005felse_005f1.setPageContext(_jspx_page_context);
_jspx_th_ww_005felse_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fparam_005f2);
int _jspx_eval_ww_005felse_005f1 = _jspx_th_ww_005felse_005f1.doStartTag();
if (_jspx_eval_ww_005felse_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
do {
out.write("\n");
out.write(" \n");
out.write(" ");
int evalDoAfterBody = _jspx_th_ww_005felse_005f1.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
}
if (_jspx_th_ww_005felse_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005felse.reuse(_jspx_th_ww_005felse_005f1);
return true;
}
_005fjspx_005ftagPool_005fww_005felse.reuse(_jspx_th_ww_005felse_005f1);
return false;
}
private boolean _jspx_meth_ww_005fparam_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005ftext_005f3, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:param
webwork.view.taglib.ParamTag _jspx_th_ww_005fparam_005f3 = (webwork.view.taglib.ParamTag) _005fjspx_005ftagPool_005fww_005fparam_0026_005fname.get(webwork.view.taglib.ParamTag.class);
_jspx_th_ww_005fparam_005f3.setPageContext(_jspx_page_context);
_jspx_th_ww_005fparam_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005ftext_005f3);
// /secure/admin/views/permissions/deletepermission.jsp(48,16) name = name type = java.lang.String reqTime = false required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005fparam_005f3.setName("'value2'");
int _jspx_eval_ww_005fparam_005f3 = _jspx_th_ww_005fparam_005f3.doStartTag();
if (_jspx_eval_ww_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_ww_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.pushBody();
_jspx_th_ww_005fparam_005f3.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
_jspx_th_ww_005fparam_005f3.doInitBody();
}
do {
out.write('<');
out.write('b');
out.write('>');
if (_jspx_meth_ww_005ftext_005f5(_jspx_th_ww_005fparam_005f3, _jspx_page_context))
return true;
out.write("</b><br>");
int evalDoAfterBody = _jspx_th_ww_005fparam_005f3.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_ww_005fparam_005f3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
out = _jspx_page_context.popBody();
}
}
if (_jspx_th_ww_005fparam_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f3);
return true;
}
_005fjspx_005ftagPool_005fww_005fparam_0026_005fname.reuse(_jspx_th_ww_005fparam_005f3);
return false;
}
private boolean _jspx_meth_ww_005ftext_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_ww_005fparam_005f3, javax.servlet.jsp.PageContext _jspx_page_context)
throws java.lang.Throwable {
javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
// ww:text
com.atlassian.jira.web.tags.TextTag _jspx_th_ww_005ftext_005f5 = (com.atlassian.jira.web.tags.TextTag) _005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.get(com.atlassian.jira.web.tags.TextTag.class);
_jspx_th_ww_005ftext_005f5.setPageContext(_jspx_page_context);
_jspx_th_ww_005ftext_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_ww_005fparam_005f3);
// /secure/admin/views/permissions/deletepermission.jsp(48,45) name = name type = java.lang.String reqTime = false required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
_jspx_th_ww_005ftext_005f5.setName("permissionName");
int _jspx_eval_ww_005ftext_005f5 = _jspx_th_ww_005ftext_005f5.doStartTag();
if (_jspx_th_ww_005ftext_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f5);
return true;
}
_005fjspx_005ftagPool_005fww_005ftext_0026_005fname_005fnobody.reuse(_jspx_th_ww_005ftext_005f5);
return false;
}
}
| 62.99711
| 272
| 0.765151
|
f54fdd3d44016634e0486122644c2eec5d7117e2
| 167
|
package software.amazon.macie.session;
class Configuration extends BaseConfiguration {
public Configuration() {
super("aws-macie-session.json");
}
}
| 18.555556
| 47
| 0.706587
|
18a9c467df8be5bd84be37fdc3fb024c35572b62
| 68
|
package com.slowio.beaninfo;
/**
*
*/
public class EmptyBean {
}
| 8.5
| 28
| 0.647059
|
c17c0e3fd77d853d2abad3f29f2ae823bccbe3da
| 497
|
package com.chenjie.dao.model;
import lombok.Data;
@Data
public class CrawlTaskModel {
private Integer id;
private String name;
private String ruleJson;
private String createTime;
private String updateTime;
private Integer userId;
private User user;
@Override
public String toString() {
return "CrawlTaskModel [id=" + id + ", name=" + name + ", ruleJson=" + ruleJson + ", createTime=" + createTime
+ ", updateTime=" + updateTime + ", userId=" + userId + "]";
}
}
| 18.407407
| 112
| 0.67002
|
4e70e971c04346e0b9795d1a517f535afffa697c
| 470
|
package ro.msg.learning.shop.Entities;
import lombok.*;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
@Data @Builder
@NoArgsConstructor @AllArgsConstructor
@EqualsAndHashCode @ToString
public class ProductCategory {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String name;
private String description;
}
| 21.363636
| 59
| 0.795745
|
75e83ff28bcc548587c3c71de5ca4dde42ec5f73
| 12,738
|
/**
* Copyright (C) 2011 Brian Ferris <bdferris@onebusaway.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.onebusaway.transit_data_federation.impl.blocks;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.onebusaway.container.ConfigurationParameter;
import org.onebusaway.geospatial.model.CoordinateBounds;
import org.onebusaway.geospatial.model.CoordinatePoint;
import org.onebusaway.gtfs.model.AgencyAndId;
import org.onebusaway.transit_data_federation.model.TargetTime;
import org.onebusaway.transit_data_federation.services.ExtendedCalendarService;
import org.onebusaway.transit_data_federation.services.blocks.BlockCalendarService;
import org.onebusaway.transit_data_federation.services.blocks.BlockGeospatialService;
import org.onebusaway.transit_data_federation.services.blocks.BlockInstance;
import org.onebusaway.transit_data_federation.services.blocks.BlockSequenceIndex;
import org.onebusaway.transit_data_federation.services.blocks.BlockStatusService;
import org.onebusaway.transit_data_federation.services.blocks.InstanceState;
import org.onebusaway.transit_data_federation.services.blocks.ServiceIntervalBlock;
import org.onebusaway.transit_data_federation.services.realtime.BlockLocation;
import org.onebusaway.transit_data_federation.services.realtime.BlockLocationService;
import org.onebusaway.transit_data_federation.services.transit_graph.BlockConfigurationEntry;
import org.onebusaway.transit_data_federation.services.transit_graph.FrequencyEntry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class BlockStatusServiceImpl implements BlockStatusService {
private BlockCalendarService _blockCalendarService;
private BlockLocationService _blockLocationService;
private BlockGeospatialService _blockGeospatialService;
private ExtendedCalendarService _extendedCalendarService;
/**
* When searching for blocks to apply real-time information, we will look back
* the specified number of seconds for vehicles that are potentially running
* late.
*
* This let's us capture blocks that were scheduled to end X seconds before
* the left-most edge of the user's search window, but that might be running
* up to X seconds late.
*/
private int _runningLateWindow = 30 * 60;
/**
* When searching for blocks to apply real-time information, we will look
* ahead the specified number of seconds for vehicles that are potentially
* running early.
*
* This let's us capture trips that were scheduled to start X seconds after
* the right-most edge of the user's search window, but that might be running
* up to X seconds early.
*/
private int _runningEarlyWindow = 10 * 60;
@Autowired
public void setActive(BlockCalendarService activeCalendarService) {
_blockCalendarService = activeCalendarService;
}
@Autowired
public void setBlockLocationService(BlockLocationService blockLocationService) {
_blockLocationService = blockLocationService;
}
@Autowired
public void setBlockGeospatialService(
BlockGeospatialService blockGeospatialService) {
_blockGeospatialService = blockGeospatialService;
}
@Autowired
public void setExtendedCalendarService(
ExtendedCalendarService extendedCalendarSerivce) {
_extendedCalendarService = extendedCalendarSerivce;
}
/**
* When searching for blocks to apply real-time information, we will look back
* the specified number of seconds for vehicles that are potentially running
* late.
*
* @param runningLateWindowInSeconds
*/
@ConfigurationParameter
public void setRunningLateWindow(int runningLateWindowInSeconds) {
_runningLateWindow = runningLateWindowInSeconds;
}
public int getRunningLateWindow() {
return _runningLateWindow;
}
/**
* When searching for blocks to apply real-time information, we will look
* ahead the specified number of seconds for vehicles that are potentially
* running early.
*
* @param runningEarlyWindowInSeconds time in seconds
*/
@ConfigurationParameter
public void setRunningEarlyWindow(int runningEarlyWindowInSeconds) {
_runningEarlyWindow = runningEarlyWindowInSeconds;
}
public int getRunningEarlyWindow() {
return _runningEarlyWindow;
}
/****
* {@link BlockStatusService} Interface
****/
@Override
public Map<BlockInstance, List<BlockLocation>> getBlocks(AgencyAndId blockId,
long serviceDate, AgencyAndId vehicleId, long time) {
List<BlockInstance> blockInstances = getBlockInstances(blockId,
serviceDate, time);
Map<BlockInstance, List<BlockLocation>> results = new HashMap<BlockInstance, List<BlockLocation>>();
for (BlockInstance blockInstance : blockInstances) {
List<BlockLocation> locations = new ArrayList<BlockLocation>();
computeLocations(blockInstance, vehicleId, time, locations);
results.put(blockInstance, locations);
}
return results;
}
@Override
public BlockLocation getBlockForVehicle(AgencyAndId vehicleId, long time) {
TargetTime target = new TargetTime(time, time);
return _blockLocationService.getLocationForVehicleAndTime(vehicleId, target);
}
@Override
public List<BlockLocation> getAllActiveBlocks(long time) {
List<BlockInstance> instances = _blockCalendarService.getActiveBlocksInTimeRange(
time, time);
return getAsLocations(instances, time);
}
@Override
public List<BlockLocation> getActiveBlocksForAgency(String agencyId, long time) {
List<BlockInstance> instances = _blockCalendarService.getActiveBlocksForAgencyInTimeRange(
agencyId, time, time);
return getAsLocations(instances, time);
}
@Override
public List<BlockLocation> getBlocksForRoute(AgencyAndId routeId, long time) {
long timeFrom = time - _runningLateWindow * 1000;
long timeTo = time + _runningEarlyWindow * 1000;
List<BlockInstance> instances = _blockCalendarService.getActiveBlocksForRouteInTimeRange(
routeId, timeFrom, timeTo);
return getAsLocations(instances, time);
}
@Override
public List<BlockLocation> getBlocksForBounds(CoordinateBounds bounds,
long time) {
long timeFrom = time - _runningLateWindow * 1000;
long timeTo = time + _runningEarlyWindow * 1000;
List<BlockInstance> instances = _blockGeospatialService.getActiveScheduledBlocksPassingThroughBounds(
bounds, timeFrom, timeTo);
List<BlockLocation> locations = getAsLocations(instances, time);
List<BlockLocation> inRange = new ArrayList<BlockLocation>();
for (BlockLocation location : locations) {
CoordinatePoint p = location.getLocation();
if (bounds.contains(p))
inRange.add(location);
}
return inRange;
}
@Override
public Map<BlockInstance, List<List<BlockLocation>>> getBlocksForIndex(
BlockSequenceIndex index, List<Date> timestamps) {
List<BlockInstance> instances = getBlockInstancesForIndexAndTimestamps(
index, timestamps);
Map<BlockInstance, List<List<BlockLocation>>> results = new HashMap<BlockInstance, List<List<BlockLocation>>>();
for (BlockInstance instance : instances) {
getBlockLocationsForInstanceAndTimestamps(instance, timestamps, results);
}
return results;
}
/****
* Private Methods
****/
private List<BlockInstance> getBlockInstances(AgencyAndId blockId,
long serviceDate, long time) {
if (serviceDate != 0) {
BlockInstance blockInstance = _blockCalendarService.getBlockInstance(
blockId, serviceDate);
if (blockInstance == null)
return Collections.emptyList();
BlockConfigurationEntry blockConfig = blockInstance.getBlock();
if (blockConfig.getFrequencies() == null)
return Arrays.asList(blockInstance);
List<BlockInstance> instances = new ArrayList<BlockInstance>();
for (FrequencyEntry frequency : blockConfig.getFrequencies())
instances.add(new BlockInstance(blockConfig,
blockInstance.getServiceDate(), frequency));
return instances;
} else {
List<BlockInstance> instances = _blockCalendarService.getActiveBlocks(
blockId, time, time);
if (instances.isEmpty()) {
instances = _blockCalendarService.getClosestActiveBlocks(blockId, time);
}
return instances;
}
}
private List<BlockLocation> getAsLocations(Iterable<BlockInstance> instances,
long time) {
List<BlockLocation> locations = new ArrayList<BlockLocation>();
for (BlockInstance instance : instances)
computeLocations(instance, null, time, locations);
return locations;
}
/**
*
* @param instance
* @param vehicleId optional filter on location results. Can be null.
* @param time
* @param results
*/
private void computeLocations(BlockInstance instance, AgencyAndId vehicleId,
long time, List<BlockLocation> results) {
if (instance == null)
return;
TargetTime target = new TargetTime(time, time);
// Try real-time trips first
List<BlockLocation> locations = _blockLocationService.getLocationsForBlockInstance(
instance, target);
if (!locations.isEmpty()) {
if (vehicleId == null) {
results.addAll(locations);
} else {
for (BlockLocation location : locations)
if (vehicleId.equals(location.getVehicleId()))
results.add(location);
}
} else {
// If no real-time trips are available and no vehicle id was specified,
// use scheduled trips
if (vehicleId == null) {
BlockLocation location = _blockLocationService.getScheduledLocationForBlockInstance(
instance, time);
if (location != null && location.isInService())
results.add(location);
}
}
}
private List<BlockInstance> getBlockInstancesForIndexAndTimestamps(
BlockSequenceIndex index, List<Date> timestamps) {
Date tFrom = timestamps.get(0);
Date tTo = timestamps.get(timestamps.size() - 1);
ServiceIntervalBlock serviceIntervalBlock = index.getServiceIntervalBlock();
List<BlockSequence> sequences = index.getSequences();
Collection<Date> serviceDates = _extendedCalendarService.getServiceDatesWithinRange(
index.getServiceIds(), serviceIntervalBlock.getRange(), tFrom, tTo);
List<BlockInstance> instances = new ArrayList<BlockInstance>();
for (Date serviceDate : serviceDates) {
int effectiveFromTime = (int) ((tFrom.getTime() - serviceDate.getTime()) / 1000);
int effectiveToTime = (int) ((tTo.getTime() - serviceDate.getTime()) / 1000);
int indexFrom = Arrays.binarySearch(
serviceIntervalBlock.getMaxArrivals(), effectiveFromTime);
int indexTo = Arrays.binarySearch(
serviceIntervalBlock.getMinDepartures(), effectiveToTime);
if (indexFrom < 0)
indexFrom = -(indexFrom + 1);
if (indexTo < 0)
indexTo = -(indexTo + 1);
InstanceState state = new InstanceState(serviceDate.getTime());
for (int i = indexFrom; i < indexTo; i++) {
BlockSequence sequence = sequences.get(i);
BlockConfigurationEntry blockConfig = sequence.getBlockConfig();
BlockInstance instance = new BlockInstance(blockConfig, state);
instances.add(instance);
}
}
return instances;
}
private void getBlockLocationsForInstanceAndTimestamps(
BlockInstance instance, List<Date> timestamps,
Map<BlockInstance, List<List<BlockLocation>>> results) {
Map<AgencyAndId, List<BlockLocation>> locations = _blockLocationService.getLocationsForBlockInstance(
instance, timestamps, System.currentTimeMillis());
if (locations.isEmpty()) {
List<List<BlockLocation>> empty = Collections.emptyList();
results.put(instance, empty);
} else {
List<List<BlockLocation>> asList = new ArrayList<List<BlockLocation>>(
locations.values());
results.put(instance, asList);
}
}
}
| 34.334232
| 116
| 0.736693
|
1d51fe05cd05477da5b4ea47c0e21bd409916bda
| 1,011
|
package com.fbd.admin.security.am;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.UserDetailsService;
import com.fbd.admin.security.AbstractAdminAuthenticationProvider;
/**
* Copyright (C) 2016-2017 NBIChain SunCrowdfund System.
*
* Description: 如果有认证,可以使用本类
*
* @author dongzhongwei
* @version 1.0
*
*/
public class AuthenticationProvider extends AbstractAdminAuthenticationProvider {
public AuthenticationProvider() {
super();
}
public AuthenticationProvider(UserDetailsService userDetailsService) {
super(userDetailsService);
}
/** {@inheritDoc} */
protected void doLogin(Authentication authentication){
}
public boolean supports(Class<? extends Object> authentication) {
return (UsernamePasswordAuthenticationToken.class.isAssignableFrom(authentication));
}
}
| 25.923077
| 89
| 0.750742
|
e31791379798c92f54964410e075db9f952ffe04
| 4,022
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See License.txt in the repository root.
/*
* This file was automatically generated by com.microsoft.tfs.core.ws.generator.Generator
* from the /complexType.vm template.
*/
package ms.tfs.build.buildservice._03;
import com.microsoft.tfs.core.ws.runtime.*;
import com.microsoft.tfs.core.ws.runtime.serialization.*;
import com.microsoft.tfs.core.ws.runtime.types.*;
import com.microsoft.tfs.core.ws.runtime.util.*;
import com.microsoft.tfs.core.ws.runtime.xml.*;
import ms.tfs.build.buildservice._03._Schedule;
import ms.tfs.build.buildservice._03._ScheduleDays;
import java.lang.String;
import java.util.ArrayList;
import java.util.List;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
/**
* Automatically generated complex type class.
*/
public class _Schedule
implements ElementSerializable, ElementDeserializable
{
// Attributes
protected String timeZoneId;
protected int utcStartTime;
protected _ScheduleDays utcDaysToBuild;
// No elements
public _Schedule()
{
super();
}
public _Schedule(
final String timeZoneId,
final int utcStartTime,
final _ScheduleDays utcDaysToBuild)
{
// TODO : Call super() instead of setting all fields directly?
setTimeZoneId(timeZoneId);
setUtcStartTime(utcStartTime);
setUtcDaysToBuild(utcDaysToBuild);
}
public String getTimeZoneId()
{
return this.timeZoneId;
}
public void setTimeZoneId(final String value)
{
this.timeZoneId = value;
}
public int getUtcStartTime()
{
return this.utcStartTime;
}
public void setUtcStartTime(final int value)
{
this.utcStartTime = value;
}
public _ScheduleDays getUtcDaysToBuild()
{
return this.utcDaysToBuild;
}
public void setUtcDaysToBuild(final _ScheduleDays value)
{
if (value == null)
{
throw new IllegalArgumentException("'UtcDaysToBuild' is a required attribute, its value cannot be null");
}
this.utcDaysToBuild = value;
}
public void writeAsElement(
final XMLStreamWriter writer,
final String name)
throws XMLStreamException
{
writer.writeStartElement(name);
// Attributes
XMLStreamWriterHelper.writeAttribute(
writer,
"TimeZoneId",
this.timeZoneId);
XMLStreamWriterHelper.writeAttribute(
writer,
"UtcStartTime",
this.utcStartTime);
this.utcDaysToBuild.writeAsAttribute(
writer,
"UtcDaysToBuild");
writer.writeEndElement();
}
public void readFromElement(final XMLStreamReader reader)
throws XMLStreamException
{
String localName;
// Attributes
final int attributeCount = reader.getAttributeCount();
String attributeValue;
for (int i = 0; i < attributeCount; i++)
{
localName = reader.getAttributeLocalName(i);
attributeValue = reader.getAttributeValue(i);
if (localName.equalsIgnoreCase("TimeZoneId"))
{
this.timeZoneId = attributeValue;
}
else if (localName.equalsIgnoreCase("UtcStartTime"))
{
this.utcStartTime = XMLConvert.toInt(attributeValue);
}
else if (localName.equalsIgnoreCase("UtcDaysToBuild"))
{
this.utcDaysToBuild = new _ScheduleDays();
this.utcDaysToBuild.readFromAttribute(attributeValue);
}
// Ignore unknown attributes.
}
// This object uses no elements, so read until our element end
XMLStreamReaderHelper.readUntilElementEnd(reader);
}
}
| 26.813333
| 117
| 0.645699
|
40c6f25e9bc70e4a793ec63fd803d5c3921ed869
| 466
|
package me.ilnicki.bg.core.system;
import me.ilnicki.container.ComponentContainer;
import me.ilnicki.container.Container;
public class SystemManager extends ComponentContainer implements Kernel {
private final App app;
public SystemManager(App app) {
this.app = app;
share(this);
link(Container.class, getClass());
link(Kernel.class, getClass());
}
public void reset() {
app.reset();
}
public void stop() {
app.stop();
}
}
| 19.416667
| 73
| 0.693133
|
f318f4faac73d2426984080df76fda3281413a29
| 1,450
|
package com.eugene.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import com.eugene.service.AlbumService;
@Controller
public class AlbumController {
@Autowired
private AlbumService albumService;
@RequestMapping(value = "/deletealbum/{albumid}", method = RequestMethod.GET)
@ResponseStatus(value=HttpStatus.OK)
public String deleteAlbum(@PathVariable("albumid") Long albumID, Model model) {
albumService.deleteAlbum(albumID);
model.addAttribute("albums", albumService.getAllAlbums());
return "albumlist";
}
@RequestMapping(value = "/albumdetails/{albumid}", method = RequestMethod.GET)
@ResponseStatus(value=HttpStatus.OK)
public String getAlbum(@PathVariable("albumid") Long albumID, Model model) {
model.addAttribute("album", albumService.getAlbum(albumID));
return "albumshow";
}
@RequestMapping(value = "/showalbums", method = RequestMethod.GET)
@ResponseStatus(value=HttpStatus.OK)
public String getAllAlbums(Model model) {
model.addAttribute("albums", albumService.getAllAlbums());
return "albumlist";
}
}
| 33.72093
| 80
| 0.794483
|
846ef5f2a0b724acf1566de5c334218b367e555b
| 2,319
|
package Lists;
import AllExceptions.*;
/**
* LinkedOrderedList represents a singly linked implementation of an
* ordered list.
*/
public class LinkedOrderedList<T> extends LinkedList<T>
implements OrderedListADT<T>
{
/**
* Creates an empty list.
*/
public LinkedOrderedList()
{
super();
}
/**
* Adds the specified element to this list at the location determined by
* the element's natural ordering. Throws a NonComparableElementException
* if the element is not comparable.
*
* @param element the element to be added to this list
* @throws NonComparableElementException if the element is not comparable
*/
public void add(T element)
{
if (!(element instanceof Comparable))
throw new NonComparableElementException("LinkedOrderedList");
Comparable<T> comparableElement = (Comparable<T>)element;
LinearNode<T> current = head;
LinearNode<T> previous = null;
LinearNode<T> newNode = new LinearNode<T>(element);
boolean found = false;
if (isEmpty()) // list is empty
{
head = newNode;
tail = newNode;
}
else if (comparableElement.compareTo(head.getElement()) <= 0)
// element goes in front
{
newNode.setNext(head);
head = newNode;
}
else if (comparableElement.compareTo(tail.getElement()) >= 0)
// element goes at tail
{
tail.setNext(newNode);
tail = newNode;
}
else // element goes in the middle
{
while ((comparableElement.compareTo(current.getElement()) > 0))
{
previous = current;
current = current.getNext();
}
newNode.setNext(current);
previous.setNext(newNode);
}
count++;
modCount++;
}
/*
public String toString() {
LinearNode<T> current = head;
String result = " {LkdList";
if( this.isEmpty() ) {
result = result + ", is EMPTY";
}
while (current != null)
{
result = result + ", " + current.getElement();
current = current.getNext();
}
result = result + "}";
return result;
}
*/
}
| 24.15625
| 77
| 0.559724
|
e0f59e1cc2f26bc5a97dd88b8b8349066277470a
| 1,750
|
/*
*Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.testing.security.firingrange.tests.tags;
import com.google.common.base.Strings;
import com.google.testing.security.firingrange.utils.Responses;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* This servlet will filter any tag but will be pierced by multiline requests.
* Sample Payload: \r\n\r\n<script>alert(/1/)</script>
*/
public class Multiline extends HttpServlet {
private static final Pattern TAG_FILTER = Pattern.compile("^.*<.*>.*$");
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String query = Strings.nullToEmpty(request.getParameter("q"));
Matcher matcher = TAG_FILTER.matcher(query);
if (matcher.matches()) {
String error = "Invalid input, contains tags.";
response.sendError(400, error);
return;
}
String body = String.format("<html><body>%s</body></html>", query);
Responses.sendXssed(response, body);
}
}
| 36.458333
| 100
| 0.742286
|
6e2435637d0a4331fd4fcb0a05ad432b274f6783
| 1,278
|
/**
*
* Copyright © 2014-2015 Florian Schmaus
*
* 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.jivesoftware.smack.packet;
/**
* A Nonza, i.e everything that is <b>not a stanza</b> as defined
* RFC 6120 8. Stanzas are {@link Message}, {@link Presence} and {@link IQ}.
* Everything else should sublcass this class instead of {@link Stanza}.
* <p>
* It is important to cleanly distinguish between stanzas and non-stanzas. For
* example plain stream elements don't count into the stanza count of XEP-198
* Stream Management.
* </p>
*
* @author Florian Schmaus
* @see <a href="http://xmpp.org/extensions/xep-0360.html">XEP-0360: Nonzas (are not Stanzas)</a>
*/
public interface Nonza extends TopLevelStreamElement, FullyQualifiedElement {
}
| 35.5
| 97
| 0.726917
|
935411b64c6b6d68873145b954c04b6221fec859
| 464
|
package com.skytala.eCommerce.domain.product.relations.facility.event.groupRollup;
import com.skytala.eCommerce.framework.pubsub.Event;
import com.skytala.eCommerce.domain.product.relations.facility.model.groupRollup.FacilityGroupRollup;
public class FacilityGroupRollupUpdated implements Event{
private boolean success;
public FacilityGroupRollupUpdated(boolean success) {
this.success = success;
}
public boolean isSuccess() {
return success;
}
}
| 24.421053
| 101
| 0.81681
|
23fad73c38bfed241b45de1717079f139bca6d47
| 4,344
|
/*
* Copyright (c) 2007-2018 Siemens AG
*
* 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.siemens.ct.exi.core.values;
/**
*
* @author Daniel.Peintner.EXT@siemens.com
* @author Richard.Kuntschke@siemens.com
*
*/
// re-uses code from org.apache.xerces.impl.dv.util.HexBin;
public class BinaryHexValue extends AbstractBinaryValue {
private int lengthData;
public BinaryHexValue(byte[] bytes) {
super(ValueType.BINARY_HEX, bytes);
}
public static BinaryHexValue parse(String val) {
byte[] bytes = decode(val);
if (bytes == null) {
return null;
} else {
return new BinaryHexValue(bytes);
}
}
public int getCharactersLength() {
if (slen == -1) {
lengthData = bytes.length;
slen = lengthData * 2;
}
return slen;
}
public void getCharacters(char[] cbuffer, int offset) {
getCharactersLength();
int temp;
for (int i = 0; i < lengthData; i++) {
temp = bytes[i];
if (temp < 0)
temp += 256;
cbuffer[offset + i * 2] = lookUpHexAlphabet[temp >> 4];
cbuffer[offset + i * 2 + 1] = lookUpHexAlphabet[temp & 0xf];
}
// return cbuffer;
}
@Override
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (o instanceof BinaryHexValue) {
return _equals(((BinaryHexValue) o).bytes);
} else {
BinaryHexValue bv = BinaryHexValue.parse(o.toString());
return bv == null ? false : _equals(bv.bytes);
}
}
@Override
public int hashCode() {
//
int hc = 0;
for (int i = 0; i < bytes.length; i++) {
hc = (hc * 31) ^ bytes[i];
}
return hc;
}
/*
* ****************************************************************
* org.apache.xerces.impl.dv.util.HexBin
*/
static private final int BASELENGTH = 128;
static private final int LOOKUPLENGTH = 16;
static final private byte[] hexNumberTable = new byte[BASELENGTH];
static final private char[] lookUpHexAlphabet = new char[LOOKUPLENGTH];
static {
for (int i = 0; i < BASELENGTH; i++) {
hexNumberTable[i] = -1;
}
for (int i = '9'; i >= '0'; i--) {
hexNumberTable[i] = (byte) (i - '0');
}
for (int i = 'F'; i >= 'A'; i--) {
hexNumberTable[i] = (byte) (i - 'A' + 10);
}
for (int i = 'f'; i >= 'a'; i--) {
hexNumberTable[i] = (byte) (i - 'a' + 10);
}
for (int i = 0; i < 10; i++) {
lookUpHexAlphabet[i] = (char) ('0' + i);
}
for (int i = 10; i <= 15; i++) {
lookUpHexAlphabet[i] = (char) ('A' + i - 10);
}
}
/**
* Decode hex string to a byte array
*
* @param encoded
* encoded string
* @return return array of byte to encode
*/
static public byte[] decode(String encoded) {
if (encoded == null)
return null;
int lengthData = encoded.length();
if (lengthData % 2 != 0)
return null;
char[] binaryData = encoded.toCharArray();
int lengthDecode = lengthData / 2;
byte[] decodedData = new byte[lengthDecode];
byte temp1, temp2;
char tempChar;
for (int i = 0; i < lengthDecode; i++) {
tempChar = binaryData[i * 2];
temp1 = (tempChar < BASELENGTH) ? hexNumberTable[tempChar] : -1;
if (temp1 == -1)
return null;
tempChar = binaryData[i * 2 + 1];
temp2 = (tempChar < BASELENGTH) ? hexNumberTable[tempChar] : -1;
if (temp2 == -1)
return null;
decodedData[i] = (byte) ((temp1 << 4) | temp2);
}
return decodedData;
}
}
| 26.487805
| 80
| 0.633978
|
3e3a24cbc4c2c2e17070d31f537dfd1064750ada
| 2,927
|
/*
* Copyright 2015 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.
*
* 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.drools.core.command.runtime.rule;
import java.util.Arrays;
import java.util.List;
import org.drools.core.command.impl.NotTransactionalCommand;
import org.drools.core.fluent.impl.Batch;
import org.drools.core.fluent.impl.BatchImpl;
import org.drools.core.fluent.impl.InternalExecutable;
import org.junit.jupiter.api.Test;
import org.kie.api.command.ExecutableCommand;
import org.kie.api.runtime.Context;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class InternalExecutableTest {
@Test
public void notTransactionalCommandTest() {
final Batch batch = new BatchImpl();
batch.addCommand(new TransactionalCommandTest());
batch.addCommand(new NotTransactionalCommandTest());
final InternalExecutable internalExecutableImplTest = new InternalExecutableImplTest(batch);
assertFalse(internalExecutableImplTest.canRunInTransaction());
}
@Test
public void transactionalCommandTest() {
final Batch batch = new BatchImpl();
batch.addCommand(new TransactionalCommandTest());
batch.addCommand(new TransactionalCommandTest());
final InternalExecutable internalExecutableImplTest = new InternalExecutableImplTest(batch);
assertTrue(internalExecutableImplTest.canRunInTransaction());
}
@Test
public void emptyCommandTest() {
final Batch batch = new BatchImpl();
final InternalExecutable internalExecutableImplTest = new InternalExecutableImplTest(batch);
assertTrue(internalExecutableImplTest.canRunInTransaction());
}
class TransactionalCommandTest implements ExecutableCommand<Void> {
@Override
public Void execute(Context context) {
return null;
}
}
class NotTransactionalCommandTest implements NotTransactionalCommand<Void> {
@Override
public Void execute(Context context) {
return null;
}
}
class InternalExecutableImplTest implements InternalExecutable {
final private List<Batch> batches;
@Override
public List<Batch> getBatches() {
return batches;
}
InternalExecutableImplTest(Batch... batches) {
this.batches = Arrays.asList(batches);
}
}
}
| 32.88764
| 100
| 0.71985
|
c3035d194ae7dfc0bcc9417a39493ae8f5edb56a
| 525
|
package iot.project.distanceCalculation;
import java.io.File;
import org.kohsuke.args4j.Option;
public class CommandLineOptions {
@Option(name = "--osm-file", usage = "OSM file to load", required = true)
public File osmFile = null;
@Option(name = "-h", aliases = { "--help" }, usage = "This help message.", required = false)
public boolean help = false;
@Option(name = "-v", aliases = { "--verbose" }, usage = "Verbose (DEBUG) logging output (default: INFO).", required = false)
public boolean verbose = false;
}
| 29.166667
| 125
| 0.681905
|
9f85f226e6c9df00b08cfe3c1cb5af725bc117ab
| 2,688
|
/*
* MIT License
*
* Copyright (c) 2018, Tom Leemreize <t.leemreize@student.utwente.nl>
*
* 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 nl.utwente.mapper.util;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.ClassReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
public class JarLoader {
/**
* Loads the classes of the jar into a map. The keys of the map correspond to the name of the
* class, while the values correspond to the ClassNodes themselves.
*
* @param jar the File corresponding to the jar to load
* @return a map of all classes in the specified jar
* @throws IOException in case the file could not be loaded
*/
public static Map<String, ClassNode> readJar(File jar) throws IOException {
Map<String, ClassNode> classes = new HashMap<>();
JarFile jarFile = new JarFile(jar);
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (name.endsWith(".class")) {
try (InputStream inputStream = jarFile.getInputStream(entry)) {
ClassReader reader = new ClassReader(inputStream);
ClassNode node = new ClassNode();
reader.accept(node, ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
classes.put(node.name, node);
}
}
}
return classes;
}
}
| 39.529412
| 97
| 0.688244
|
15f09028a4ec35aba576f31e141fc0c5bf5b2e70
| 444
|
package net.flyingfishflash.ledger.accounts.unit;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import net.flyingfishflash.ledger.accounts.data.NormalBalance;
public class NormalBalanceTests {
@Test
public void testNormalBalanceInvert() {
assertEquals(NormalBalance.CREDIT, NormalBalance.DEBIT.invert());
assertEquals(NormalBalance.DEBIT, NormalBalance.CREDIT.invert());
}
}
| 26.117647
| 69
| 0.797297
|
693da09fd515be150bc7e8512851b2a5e0ab53ae
| 8,667
|
/* Copyright 2018 The OpenTracing 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 io.opentracing.contrib.specialagent;
import static net.bytebuddy.matcher.ElementMatchers.*;
import java.lang.reflect.Method;
import java.net.URL;
import java.security.ProtectionDomain;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.List;
import java.util.Set;
import io.opentracing.contrib.specialagent.BootLoaderAgent.Mutex;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.agent.builder.AgentBuilder.Identified.Extendable;
import net.bytebuddy.agent.builder.AgentBuilder.Identified.Narrowable;
import net.bytebuddy.agent.builder.AgentBuilder.Transformer;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType.Builder;
import net.bytebuddy.implementation.bytecode.assign.Assigner.Typing;
import net.bytebuddy.utility.JavaModule;
/**
* The {@code ClassLoaderAgent} instruments the {@code ClassLoader} class to
* achieve direct loading of bytecode into target class loaders, which is
* necessary for the SpecialAgent to be able to load instrumentation classes
* into class loaders.
*
* @author Seva Safris
*/
public class ClassLoaderAgentRule extends AgentRule {
public enum LocalLevel {
SEVERE,
FINE,
FINEST
}
public static Logger logger;
public static final ClassFileLocator locatorProxy = BootLoaderAgent.cachedLocator;
public static Boolean isAgentRunner;
public static void log(final String message, final Throwable thrown, final LocalLevel level) {
if (isAgentRunner == null ? isAgentRunner = SpecialAgent.isAgentRunner() : isAgentRunner) {
final String logLevel = System.getProperty("sa.log.level");
if (level == LocalLevel.SEVERE || logLevel != null && logLevel.startsWith("FINE")) {
System.err.println(message);
if (thrown != null)
thrown.printStackTrace(System.err);
}
}
else {
if (logger == null)
logger = Logger.getLogger(ClassLoaderAgentRule.class);
if (level == LocalLevel.SEVERE)
logger.log(Level.SEVERE, message, thrown);
else if (level == LocalLevel.FINE && logger.isLoggable(Level.FINE))
logger.log(Level.FINE, message, thrown);
else if (level == LocalLevel.FINEST && logger.isLoggable(Level.FINEST))
logger.log(Level.FINEST, message, thrown);
}
}
@Override
public Iterable<? extends AgentBuilder> buildAgent(final AgentBuilder builder) throws Exception {
log("\n<<<<<<<<<<<<<<<<< Installing ClassLoaderAgent >>>>>>>>>>>>>>>>>>\n", null, LocalLevel.FINE);
// final Narrowable narrowable = builder.type(isSubTypeOf(ClassLoader.class).and(not(nameStartsWith(RuleClassLoader.class.getName()))).and(not(nameStartsWith(PluginsClassLoader.class.getName()))));
final Narrowable narrowable = builder.type(isSubTypeOf(ClassLoader.class));
final List<Extendable> builders = Arrays.asList(
narrowable.transform(new Transformer() {
@Override
public Builder<?> transform(final Builder<?> builder, final TypeDescription typeDescription, final ClassLoader classLoader, final JavaModule module) {
return builder
.visit((locatorProxy != null ? Advice.to(DefineClass.class, locatorProxy) : Advice.to(DefineClass.class)).on(named("defineClass").and(returns(Class.class).and(takesArgument(0, String.class)))))
.visit((locatorProxy != null ? Advice.to(LoadClass.class, locatorProxy) : Advice.to(LoadClass.class)).on(named("loadClass").and(returns(Class.class).and(takesArguments(String.class)))))
.visit((locatorProxy != null ? Advice.to(FindResource.class, locatorProxy) : Advice.to(FindResource.class)).on(named("findResource").and(returns(URL.class).and(takesArguments(String.class)))))
.visit((locatorProxy != null ? Advice.to(FindResources.class, locatorProxy) : Advice.to(FindResources.class)).on(named("findResources").and(returns(Enumeration.class).and(takesArguments(String.class)))));
}}));
log("\n>>>>>>>>>>>>>>>>>> Installed ClassLoaderAgent <<<<<<<<<<<<<<<<<<\n", null, LocalLevel.FINE);
return builders;
}
public static boolean isExcluded(final ClassLoader thiz) {
final String className = thiz.getClass().getName();
return className.startsWith("io.opentracing.contrib.specialagent.RuleClassLoader") || className.startsWith("io.opentracing.contrib.specialagent.PluginsClassLoader");
}
public static class DefineClass {
@Advice.OnMethodExit
public static void exit(final @Advice.This ClassLoader thiz) {
if (!isExcluded(thiz))
SpecialAgent.preLoad(thiz);
}
}
public static class LoadClass {
public static final Mutex mutex = new Mutex();
public static Method defineClass;
@SuppressWarnings("unused")
@Advice.OnMethodExit(onThrowable = ClassNotFoundException.class)
public static void exit(final @Advice.This ClassLoader thiz, final @Advice.Argument(0) String name, @Advice.Return(readOnly=false, typing=Typing.DYNAMIC) Class<?> returned, @Advice.Thrown(readOnly = false, typing = Typing.DYNAMIC) ClassNotFoundException thrown) {
if (isExcluded(thiz))
return;
final Set<String> visited;
if (returned != null || !(visited = mutex.get()).add(name))
return;
try {
final Class<?> bootstrapClass = BootProxyClassLoader.INSTANCE.loadClassOrNull(name, false);
if (bootstrapClass != null) {
log(">>>>>>>> BootLoader#loadClassOrNull(\"" + name + "\"): " + bootstrapClass, null, LocalLevel.FINEST);
returned = bootstrapClass;
thrown = null;
return;
}
final byte[] bytecode = SpecialAgent.findClass(thiz, name);
if (bytecode == null)
return;
log("<<<<<<<< defineClass(\"" + name + "\")", null, LocalLevel.FINEST);
if (defineClass == null)
defineClass = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class, int.class, int.class, ProtectionDomain.class);
returned = (Class<?>)defineClass.invoke(thiz, name, bytecode, 0, bytecode.length, null);
thrown = null;
}
catch (final Throwable t) {
log("<><><><> ClassLoaderAgent.LoadClass#exit(\"" + name + "\")", t, LocalLevel.SEVERE);
}
finally {
visited.remove(name);
}
}
}
public static class FindResource {
public static final Mutex mutex = new Mutex();
@Advice.OnMethodExit
public static void exit(final @Advice.This ClassLoader thiz, final @Advice.Argument(0) String name, @Advice.Return(readOnly=false, typing=Typing.DYNAMIC) URL returned) {
if (isExcluded(thiz))
return;
final Set<String> visited;
if (returned != null || !(visited = mutex.get()).add(name))
return;
try {
final URL resource = SpecialAgent.findResource(thiz, name);
if (resource != null)
returned = resource;
}
catch (final Throwable t) {
log("<><><><> ClassLoaderAgent.FindResource#exit", t, LocalLevel.SEVERE);
}
finally {
visited.remove(name);
}
}
}
public static class FindResources {
public static final Mutex mutex = new Mutex();
@Advice.OnMethodExit
public static void exit(final @Advice.This ClassLoader thiz, final @Advice.Argument(0) String name, @Advice.Return(readOnly=false, typing=Typing.DYNAMIC) Enumeration<URL> returned) {
if (isExcluded(thiz))
return;
final Set<String> visited;
if (!(visited = mutex.get()).add(name))
return;
try {
final Enumeration<URL> resources = SpecialAgent.findResources(thiz, name);
if (resources == null)
return;
returned = returned == null ? resources : new CompoundEnumeration<>(returned, resources);
}
catch (final Throwable t) {
log("<><><><> ClassLoaderAgent.FindResources#exit", t, LocalLevel.SEVERE);
}
finally {
visited.remove(name);
}
}
}
}
| 40.690141
| 267
| 0.686512
|
ffab7dad1d75435e6d7db7d9f3bfe7642e7cb7f5
| 1,383
|
package com.adfmanager;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
@Configuration
@EnableResourceServer
public class ResourceServerConfig
extends ResourceServerConfigurerAdapter {
@Override
public void configure(ResourceServerSecurityConfigurer resources) {
resources.stateless(false); //https://github.com/spring-projects/spring-security-oauth/issues/907
}
@Override
public void configure(HttpSecurity http) throws Exception {
http.
// Since we want the protected resources to be accessible in the UI as well we need
// session creation to be allowed (it's disabled by default in 2.0.6)
sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED).
and().requestMatchers()
.antMatchers("/api/adf/user","/api/file/upload/adf").and() //Set ressources to protect here
.authorizeRequests().anyRequest().authenticated();
}
}
| 41.909091
| 111
| 0.809834
|
0f2fd32cb35f6111456f89bb5f12755ca2a82ef5
| 146
|
package org.jesperancinha.shell.webflux.model;
public record SeaShellLower(
String type,
String color,
String size
) {
}
| 16.222222
| 46
| 0.657534
|
7116ce2f57842000fa85d1d17b8e8260d52b37e9
| 688
|
package io.akoserwal.model;
public class User {
String name;
String email;
String company;
String address;
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| 16.780488
| 44
| 0.579942
|
982ed3567a72fee608e6356bd3d48993cedde4dc
| 5,309
|
package com.baro.bot.discord.service;
import com.baro.bot.discord.commands.music.audio.AudioHandler;
import com.baro.bot.discord.commands.music.audio.NowplayingHandler;
import com.baro.bot.discord.commands.music.audio.PlayerManager;
import com.baro.bot.discord.commands.music.playlist.PlaylistLoader;
import com.baro.bot.discord.components.Listener;
import com.baro.bot.discord.config.BotConfig;
import com.baro.bot.discord.config.FlagsConfig;
import com.baro.bot.discord.util.ConsoleColors;
import com.jagrosh.jdautilities.commons.waiter.EventWaiter;
import com.sedmelluq.discord.lavaplayer.jdaudp.NativeAudioSendFactory;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Activity;
import net.dv8tion.jda.api.entities.Guild;
import net.dv8tion.jda.api.requests.GatewayIntent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import javax.security.auth.login.LoginException;
import java.util.concurrent.Executors;
@Service
@Profile("!test")
public class BaroBot {
private static final Logger LOGGER = LoggerFactory.getLogger(BaroBot.class);
private final BotConfig botConfig;
private final FlagsConfig flagsConfig;
private final PlayerManager playerManager;
private final NowplayingHandler nowplayingHandler;
private final PlaylistLoader playlistLoader;
private final EventWaiter eventWaiter;
private final Listener listener;
private JDA jda;
private boolean shuttingDown = false;
public BaroBot(BotConfig botConfig, Listener listener, FlagsConfig flagsConfig) {
this.botConfig = botConfig;
this.flagsConfig = flagsConfig;
this.eventWaiter = new EventWaiter();
this.listener = listener;
this.playerManager = new PlayerManager(this);
this.playerManager.init();
this.nowplayingHandler = new NowplayingHandler(this);
this.nowplayingHandler.init();
this.playlistLoader = new PlaylistLoader();
}
@Bean
private void createJda() throws LoginException {
JDABuilder builder = JDABuilder.createDefault(botConfig.getToken())
.setBulkDeleteSplittingEnabled(true)
.setAudioSendFactory(new NativeAudioSendFactory())
.enableIntents(
GatewayIntent.DIRECT_MESSAGE_REACTIONS,
GatewayIntent.DIRECT_MESSAGES,
GatewayIntent.GUILD_BANS,
GatewayIntent.GUILD_MEMBERS,
GatewayIntent.GUILD_INVITES,
GatewayIntent.GUILD_PRESENCES,
GatewayIntent.GUILD_VOICE_STATES,
GatewayIntent.DIRECT_MESSAGE_TYPING,
GatewayIntent.GUILD_EMOJIS,
GatewayIntent.GUILD_MESSAGE_REACTIONS,
GatewayIntent.GUILD_MESSAGE_TYPING,
GatewayIntent.GUILD_MESSAGES
)
.addEventListeners(eventWaiter, listener);
if (!botConfig.getActivity().isEmpty()) {
builder.setActivity(Activity.watching(botConfig.getActivity()));
}
jda = builder.build();
LOGGER.info(ConsoleColors.PURPLE_BOLD_BRIGHT + "---------------------------------");
LOGGER.info("Logged in as: " + jda.getSelfUser().getName() + "#" + jda.getSelfUser().getDiscriminator());
LOGGER.info("UserID: " + jda.getSelfUser().getId());
LOGGER.info("Default Prefix: " + botConfig.getPrefix());
LOGGER.info("---------------------------------" + ConsoleColors.RESET);
}
public void resetActivity() {
jda.getPresence().setActivity(null);
}
public void shutdown() {
if (shuttingDown)
return;
shuttingDown = true;
if (jda.getStatus() != JDA.Status.SHUTTING_DOWN) {
jda.getGuilds().stream().forEach(g -> {
g.getAudioManager().closeAudioConnection();
AudioHandler ah = (AudioHandler) g.getAudioManager().getSendingHandler();
if (ah != null) {
ah.stopAndClear();
ah.getPlayer().destroy();
}
});
jda.shutdown();
}
System.exit(0);
}
public void closeAudioConnection(long guildId) {
Guild guild = jda.getGuildById(guildId);
if (guild != null)
Executors.newSingleThreadScheduledExecutor().submit(() -> guild.getAudioManager().closeAudioConnection());
}
public JDA getJda() {
return jda;
}
public EventWaiter getEventWaiter() {
return eventWaiter;
}
public PlayerManager getPlayerManager() {
return playerManager;
}
public NowplayingHandler getNowplayingHandler() {
return nowplayingHandler;
}
public PlaylistLoader getPlaylistLoader() {
return playlistLoader;
}
public Listener getListener() {
return listener;
}
public BotConfig getBotConfig() {
return botConfig;
}
public FlagsConfig getFlagsConfig() {
return flagsConfig;
}
}
| 36.363014
| 118
| 0.649652
|
2aaf1b5d0fc5ac4b86f4f608317a9e63915c1c5c
| 985
|
/*
* */
package com.synectiks.process.server.plugin.configuration.fields;
public class BooleanField extends AbstractConfigurationField {
public static final String FIELD_TYPE = "boolean";
private boolean defaultValue;
public BooleanField(String name, String humanName, boolean defaultValue, String description) {
super(FIELD_TYPE, name, humanName, description, Optional.OPTIONAL);
this.defaultValue = defaultValue;
}
public BooleanField(String name, String humanName, boolean defaultValue, String description, int position) {
super(FIELD_TYPE, name, humanName, description, Optional.OPTIONAL, position);
this.defaultValue = defaultValue;
}
@Override
public Object getDefaultValue() {
return this.defaultValue;
}
@Override
public void setDefaultValue(Object defaultValue) {
if (defaultValue instanceof Boolean) {
this.defaultValue = (boolean) defaultValue;
}
}
}
| 30.78125
| 112
| 0.706599
|
e77854652c012054f7460b4d45db1bf4597c636a
| 49,576
|
/*
* Copyright(C) 2017-2021 RINEARN (Fumihiro Matsui)
* This software is released under the MIT License.
*/
package org.vcssl.nano.interconnect;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.vcssl.connect.ClassToXnci1Adapter;
import org.vcssl.connect.ConnectorException;
import org.vcssl.connect.ConnectorPermissionName;
import org.vcssl.connect.ConnectorPermissionValue;
import org.vcssl.connect.ExternalFunctionConnectorInterface1;
import org.vcssl.connect.ExternalNamespaceConnectorInterface1;
import org.vcssl.connect.ExternalVariableConnectorInterface1;
import org.vcssl.connect.FieldToXvci1Adapter;
import org.vcssl.connect.MethodToXfci1Adapter;
import org.vcssl.connect.PermissionAuthorizerConnectorInterface1;
import org.vcssl.nano.spec.ErrorType;
import org.vcssl.nano.spec.IdentifierSyntax;
import org.vcssl.nano.spec.LanguageSpecContainer;
import org.vcssl.nano.spec.OptionValue;
import org.vcssl.nano.spec.SpecialBindingKey;
import org.vcssl.nano.vm.VirtualMachineObjectCode;
import org.vcssl.nano.vm.memory.DataContainer;
import org.vcssl.nano.vm.memory.Memory;
import org.vcssl.nano.VnanoException;
import org.vcssl.nano.VnanoFatalException;
/**
* <p>
* <span>
* <span class="lang-en">
* The class performing functions to manage and to provide some information
* shared between multiple components in the script engine of the Vnano
* </span>
* <span class="lang-ja">
* Vnanoのスクリプトエンジン内の各コンポーネント間で共有される,
* いくつかの情報を管理・提供する機能を担うクラスです
* </span>
* .
* </p>
*
* <p>
* <span class="lang-en">
* For example, information to resolve references of variables and functions
* are managed by this class in the script engine.
* Also, calling of external functions and synchronization of data of external variables
* are taken through this class.
* This class supports various types of plug-in connection interfaces,
* and plug-ins are internally connected to this class in the script engine.
* This kind of object is referred as "Interconnect" in the script engine of Vnano.
* </span>
*
* <span class="lang-ja">
* 関数・変数の参照解決のための情報は, スクリプトエンジン内で, このクラスが管理・提供します.
* 外部関数の呼び出しや、外部変数とのデータの同期(処理終了後の書き戻しなど)も,
* このクラスを介して行われます.
* 従って, 外部変数・外部関数プラグインの接続インターフェースをサポートし,
* (必要によりアダプタなどを介して)
* 処理系内で最終的にプラグインが接続されるハブとなるのも、このクラスです.
* VCSSL/Vnano処理系では、このような役割を提供するオブジェクトをインターコネクトと呼びます.
* </span>
* </p>
*
* <p>
* » <a href="../../../../../src/org/vcssl/nano/interconnect/Interconnect.java">Source code</a>
* </p>
*
* <hr>
*
* <p>
* | <a href="../../../../../api/org/vcssl/nano/interconnect/Interconnect.html">Public Only</a>
* | <a href="../../../../../api-all/org/vcssl/nano/interconnect/Interconnect.html">All</a> |
* </p>
*
* @author RINEARN (Fumihiro Matsui)
*/
public class Interconnect {
/** 各種の言語仕様設定類を格納するコンテナを保持します。 */
private final LanguageSpecContainer LANG_SPEC;
/** 上記コンテナ内の、識別子の判定規則類が定義された設定オブジェクトを保持します。 */
private final IdentifierSyntax IDENTIFIER_SYNTAX;
/** 外部関数の情報を保持する関数テーブルです。 */
private FunctionTable externalFunctionTable = null;
/** 外部変数の情報を保持するグローバル変数テーブルです。 */
private VariableTable externalVariableTable = null;
/** プラグインからスクリプトエンジンにアクセスする際に使用するコネクタです。 */
private EngineConnector engineConnector = null;
/** プラグインのパーミッションを管理する、PACI1形式のセキュリティプラグイン(複数同時登録は不可)です。 */
private PermissionAuthorizerConnectorInterface1 permissionAuthorizer = null;
/** 初期化/終了時処理のため、接続されているXNCI形式のプラグインを一括で保持するリストです。 */
private List<ExternalNamespaceConnectorInterface1> xnci1PluginList = null;
/** 初期化/終了時処理のため、接続されているXFCI形式のプラグインを一括で保持するリストです。 */
private List<ExternalFunctionConnectorInterface1> xfci1PluginList = null;
/** 初期化/終了時処理のため、接続されているXVCI形式のプラグインを一括で保持するリストです。 */
private List<ExternalVariableConnectorInterface1> xvci1PluginList = null;
/**
* <span class="lang-en">A map to store all names and values of option items</span>
* <span class="lang-ja">全てのオプション項目の名称と値を保持するマップです</span>
* .
*/
private Map<String, Object> optionMap = null;
/**
* <span class="lang-en">A map to store all names and values of permission items</span>
* <span class="lang-ja">全てのパーミッション項目の名称と値を保持するマップです</span>
* .
*/
private Map<String, String> permissionMap = null;
/**
* <span class="lang-en">
* Creates a blank interconnect to which nothing are connected,
* with the specified language specification settings
* </span>
* <span class="lang-ja">
* 指定された言語仕様設定で, 何も接続されていない空のインターコネクトを生成します
* </span>
* .
* @param langSpec
* <span class="lang-en">language specification settings.</span>
* <span class="lang-ja">言語仕様設定.</span>
*/
public Interconnect(LanguageSpecContainer langSpec) {
this.LANG_SPEC = langSpec;
this.IDENTIFIER_SYNTAX = LANG_SPEC.IDENTIFIER_SYNTAX;
this.engineConnector = new EngineConnector();
this.externalFunctionTable = new FunctionTable(LANG_SPEC);
this.externalVariableTable = new VariableTable(LANG_SPEC);
this.xnci1PluginList = new ArrayList<ExternalNamespaceConnectorInterface1>();
this.xfci1PluginList = new ArrayList<ExternalFunctionConnectorInterface1>();
this.xvci1PluginList = new ArrayList<ExternalVariableConnectorInterface1>();
// Create an option map and set default values, and reflect to the engine connector.
// オプションマップを生成し, 必須項目をデフォルト値で補完した上で、エンジンコネクタに反映
this.optionMap = new LinkedHashMap<String, Object>();
this.optionMap = OptionValue.normalizeValuesOf(optionMap, langSpec);
this.engineConnector = this.engineConnector.createOptionMapUpdatedInstance(this.optionMap);
// Create an empty permission map and set "DENY" to the default value, and reflect to the engine connector.
// パーミッションマップを生成し, デフォルト値を「DENY」に設定した上で、エンジンコネクタに反映
this.permissionMap = new LinkedHashMap<String, String>();
this.permissionMap.put(ConnectorPermissionName.DEFAULT, ConnectorPermissionValue.DENY);
try {
this.engineConnector = this.engineConnector.createPermissionMapUpdatedInstance(this.permissionMap);
} catch (VnanoException vne) {
// この時点ではパーミッション認可プラグイン(permission authorizer)が未ロードなため、
// 上記はパーミッションマップの参照を控えるのみで、例外が発生するはずはないので、発生した場合は実装の異常
throw new VnanoFatalException("Unexpected exception occurred", vne);
}
}
/**
* <span class="lang-en">
* Turns to the active state on which scripts are executable, with initializing all connected plug-ins
* </span>
* <span class="lang-ja">
* 接続されている全てのプラグインの初期化処理を行い, スクリプトを実行可能な待機状態に遷移します
* </span>
* .
*/
public void activate() throws VnanoException {
// 接続されている全プラグインの、スクリプト実行毎の初期化処理を実行
this.initializeAllPluginsForExecution();
}
/**
* <span class="lang-en">
* Turns to the idle state (on which scripts are not executable), with finalizing all connected plug-ins
* </span>
* <span class="lang-ja">
* 接続されている全てのプラグインの終了時処理を行い, 待機状態(スクリプトは実行不可能)に遷移します.
* </span>
* .
*/
public void deactivate() throws VnanoException {
// 接続されている全プラグインの、スクリプト実行毎の終了時処理を実行
this.finalizeAllPluginsForTermination();
}
/**
* <span class="lang-en">
* Sets options, by a Map (option map) storing names and values of options you want to set
* </span>
* <span class="lang-ja">
* オプションの名前と値を格納するマップ(オプションマップ)によって, オプションを設定します
* </span>
* .
* <span class="lang-en">
* Type of the option map is Map<String,Object>, and its keys represents option names.
* For details of option names and values,
* see {@link org.vcssl.nano.spec.OptionKey} and {@link org.vcssl.nano.spec.OptionValue}.
* </span>
*
* <span class="lang-ja">
* オプションマップは Map<String,Object> 型で, そのキーはオプション名に対応します.
* オプション名と値の詳細については,
* {@link org.vcssl.nano.spec.OptionKey} と {@link org.vcssl.nano.spec.OptioValue} の説明をご参照ください.
* </span>
*
* @param optionMap
* <span class="lang-en">A Map (option map) storing names and values of options</span>
* <span class="lang-ja">オプションの名前と値を格納するマップ(オプションマップ)</span>
*
* @throws VnanoException
* <span class="lang-en">Thrown if invalid option settings is detected.</span>
* <span class="lang-ja">オプションの指定内容が正しくなかった場合にスローされます.</span>
*/
public void setOptionMap(Map<String, Object> optionMap) throws VnanoException {
// Supplement some option items by default values, and store the map to the field of this class.
// 必須項目をデフォルト値で補完した上で、このクラスのフィールドに設定
this.optionMap = OptionValue.normalizeValuesOf(optionMap, LANG_SPEC);
// Check the content of option settings.
// オプション設定の内容を検査
OptionValue.checkContentsOf(this.optionMap);
// Reflect to the engine connector, because option values may be referred from plug-ins.
// オプションはプラグインからも参照されるので, エンジンコネクタにも反映させる
this.engineConnector = this.engineConnector.createOptionMapUpdatedInstance(this.optionMap);
}
/**
* <span class="lang-en">Gets the Map (option map) storing names and values of options</span>
* <span class="lang-ja">オプションの名前と値を格納するマップ(オプションマップ)を取得します</span>
* .
* <span class="lang-en">
* Type of the option map is Map<String,Object>, and its keys represents option names.
* For details of option names and values,
* see {@link org.vcssl.nano.spec.OptionKey} and {@link org.vcssl.nano.spec.OptionValue}.
* </span>
*
* <span class="lang-ja">
* オプションマップは Map<String,Object> 型で, そのキーはオプション名に対応します.
* オプション名と値の詳細については,
* {@link org.vcssl.nano.spec.OptionKey} と {@link org.vcssl.nano.spec.OptioValue} の説明をご参照ください.
* </span>
*
* @return
* <span class="lang-en">A Map (option map) storing names and values of options</span>
* <span class="lang-ja">オプションの名前と値を格納するマップ(オプションマップ)</span>
*/
public Map<String, Object> getOptionMap() {
return this.optionMap;
}
/**
* <span class="lang-en">
* Sets permissions, by a Map (permission map) storing names and values of permission items you want to set
* </span>
* <span class="lang-ja">
* パーミッション項目の名前と値を格納するマップ(パーミッションマップ)によって, 各パーミッションの値を設定します
* </span>
* .
* <span class="lang-en">
* Type of the permission map is Map<String,String>, and its keys represents names of permission items.
* For details of names and values of permission items,
* see {@link org.vcssl.connect.ConnectorPermissionName} and {@link org.vcssl.connect.ConnectorPermissionValue}.
* </span>
*
* <span class="lang-ja">
* パーミッションマップは Map<String,String> 型で, そのキーはパーミッション項目の名称に対応します.
* パーミッション項目の名称と値の詳細については,
* {@link org.vcssl.connect.ConnectorPermissionName} と {@link org.vcssl.connect.ConnectorPermissionValue}
* の説明をご参照ください.
* </span>
*
* @param permissionMap
* <span class="lang-en">A Map (permission map) storing names and values of permission items</span>
* <span class="lang-ja">パーミッション項目の名前と値を格納するマップ(パーミッションマップ)</span>
*
* @throws VnanoException
* <span class="lang-en">Thrown if invalid permission settings is detected.</span>
* <span class="lang-ja">パーミッションの指定内容が正しくなかった場合にスローされます.</span>
*/
public void setPermissionMap(Map<String, String> permissionMap) throws VnanoException {
this.permissionMap = permissionMap;
// Reflect to the engine connector, because permission values may be referred from plug-ins.
// パーミッションはプラグインからも参照されるので, エンジンコネクタにも反映させる
this.engineConnector = this.engineConnector.createPermissionMapUpdatedInstance(permissionMap);
}
/**
* <span class="lang-en">Gets the Map (permission map) storing names and values of permission items</span>
* <span class="lang-ja">パーミッション項目の名前と値を格納するマップ(パーミッションマップ)を取得します</span>
* .
* <span class="lang-en">
* Type of the permission map is Map<String,String>, and its keys represents names of permission items.
* For details of names and values of permission items,
* see {@link org.vcssl.connect.ConnectorPermissionName} and {@link org.vcssl.connect.ConnectorPermissionValue}.
* </span>
*
* <span class="lang-ja">
* パーミッションマップは Map<String,String> 型で, そのキーはパーミッション項目の名称に対応します.
* パーミッション項目の名称と値の詳細については,
* {@link org.vcssl.connect.ConnectorPermissionName} と {@link org.vcssl.connect.ConnectorPermissionValue}
* の説明をご参照ください.
* </span>
*
* @return
* <span class="lang-en">A Map (permission map) storing names and values of permission items</span>
* <span class="lang-ja">パーミッション項目の名前と値を格納するマップ(パーミッションマップ)</span>
*/
public Map<String, String> getPermissionMap() {
return this.permissionMap;
}
/**
* <span class="lang-en">
* Returns the table storing information of external functions (external function table)
* </span>
* <span class="lang-ja">
* 外部関数の情報を保持する関数テーブル(外部関数テーブル)を返します
* </span>
* .
* @return
* <span class="lang-en">The external function table</span>
* <span class="lang-ja">外部関数テーブル</span>
*/
public FunctionTable getExternalFunctionTable() {
return this.externalFunctionTable;
}
/**
* <span class="lang-en">
* Returns the table storing information of external variable (external variable table)
* </span>
* <span class="lang-ja">
* 外部変数の情報を保持する変数テーブル(外部変数テーブル)を返します
* </span>
* .
* @return
* <span class="lang-ja">外部変数テーブル</span>
* <span class="lang-en">The external variable table</span>
*/
public VariableTable getExternalVariableTable() {
return this.externalVariableTable;
}
/**
* <span class="lang-en">
* Calls the external function registered at the element with specified index in the external function table
* </span>
* <span class="lang-ja">
* 外部関数テーブル内の, 指定されたインデックスの要素に登録されている外部関数をコールします
* </span>
* .
*
* @param functionIndex
* <span class="lang-ja">The index of the extenral function to be called.</span>
* <span class="lang-ja">コールする外部関数のインデックス.</span>
*
* @param arguments
* <span class="lang-en">Data containers storing arguments to be passed to the callee function.</span>
* <span class="lang-ja">呼び出す関数に渡す引数を格納するデータユニット配列.</span>
*
* @param returnData
* <span class="lang-en">Data container storing returned value from the callee function.</span>
* <span class="lang-ja">呼び出した関数からの戻り値を格納するデータユニット.</span>
*/
public void callExternalFunction(int functionIndex, DataContainer<?>[] arguments, DataContainer<?> returnData)
throws VnanoException {
this.externalFunctionTable.getFunctionByIndex(functionIndex).invoke(arguments, returnData);
}
/**
* <span class="lang-en">
* Writebacks data to external variables from the virtual memory of VM.
* </span>
* <span class="lang-ja">
* VMの仮想メモリーから外部変数にデータを書き戻します
* </span>
* .
* <span class="lang-en">
* This method will be used for synchronization of data after execution of scripts.
* </span>
*
* <span class="lang-ja">
* このメソッドは, スクリプト実行終了後にデータを同期するために使用されます.
* </span>
*
* @param memory
* <span class="lang-en">The virtual memory which was used for execution of the script.</span>
* <span class="lang-ja">スクリプトの実行に使用した仮想メモリー.</span>
*/
public void writebackExternalVariables(Memory memory, VirtualMachineObjectCode intermediateCode)
throws VnanoException {
// グローバル変数の書き戻し
int maxGlobalAddress = intermediateCode.getMaximumGlobalAddress();
int minGlobalAddress = intermediateCode.getMinimumGlobalAddress();
for (int address=minGlobalAddress; address<=maxGlobalAddress; address++) {
// 注目アドレスのグローバル変数に、スクリプト内のどこからもアクセスしていない場合はスキップ
if (!intermediateCode.hasGlobalVariableRegisteredAt(address)) {
continue;
}
// 仮想メモリーを参照し、グローバル変数アドレスからデータコンテナを取得
DataContainer<?> dataContainer = memory.getDataContainer(Memory.Partition.GLOBAL, address);
// 中間コードのシンボルテーブルを参照し、グローバル変数アドレスから一意識別子を取得
String identifier = intermediateCode.getGlobalVariableUniqueIdentifier(address);
// グローバル変数テーブルを参照し、一意識別子から外部変数オブジェクトを取得
AbstractVariable variable = this.externalVariableTable.getVariableByAssemblyIdentifier(identifier);
// 書き換え不可能な定数の場合はスキップ
if (variable.isConstant()) {
continue;
}
// 外部変数オブジェクトにデータコンテナを渡して値を更新させる
variable.setDataContainer(dataContainer);
}
}
/**
* <span class="lang-en">Connects various types of plug-ins which provides external functions/variables</span>
* <span class="lang-ja">外部関数/変数を提供する, 各種のプラグインを接続します</span>
* .
* @param bindingName
* <span class="lang-en">
* A name in scripts of the variable/function/namespace provided by the connected plug-in.
* If the passed argument contains a white space or a character "(", the content after it will be ignored.
* By the above specification, for a function plug-in,
* you can specify a signature containing parameter-declarations like "foo(int,float)"
* (note that, syntax or correctness of parameter-declarations will not be checked).
* In addition, for plug-ins providing elements belonging to the same namespace "Bar",
* you can specify "Bar 1", "Bar 2", and so on.
* This is helpful to avoid the duplication of keys when you use
* {@link org.vcssl.nano.VnanoScriptEngine#put(String, Object) VnanoScriptEngine.put(String, Object) }
* method which wraps this method.
* Also, you can specify "___VNANO_AUTO_KEY" for using a valid value generated automatically.
* </span>
* <span class="lang-ja">
* 接続されるプラグインが提供する変数/関数/名前空間の, スクリプト内での名前.
* 内容に空白または「 ( 」が含まれている場合、それ以降は名前としては無視されます.
* これにより, 例えば関数 "foo" に対して引数部を含めて "foo(int,float)" 等と指定したり
* (引数部の構文や整合性検査などは行われません),
* 同じ名前空間 "Bar" の要素を提供するプラグイン群に対して "Bar 1", "Bar 2", ... のように指定する事ができます.
* これは, このメソッドをラップしている
* {@link org.vcssl.nano.VnanoScriptEngine#put(String, Object) VnanoScriptEngine.put(String, Object) }
* メソッドにおいて, キーの重複を避けたい場合に有効です.
* なお, "___VNANO_AUTO_KEY" を指定する事で, 有効な値の指定を自動で行う事もできます.
* </span>
*
* @param plugin
* <span class="lang-en">
* The plug-in to be connected.
* General "Object" type instances can be connected as a plug-in,
* for accessing their methods/fields from the script code as external functions/variables.
* For accessing only static methods and fields, "Class<T>" type instance can also be connected.
* In addition, if you want to choose a method/field to be accessible from script code,
* a "Method"/"Field" type instance can be connected.
* ( In that case, if the method/field is static, pass an Object type array for this argument,
* and store the Method/Field type instance at [0],
* and store "Class<T>" type instance of the class defining the method/field at [1] ).
* Furthermore, the instance of the class implementing
* {@link org.vcssl.connect.ExternalFunctionConnectorInterface1 XFCI1} /
* {@link org.vcssl.connect.ExternalVariableConnectorInterface1 XVCI1} /
* {@link org.vcssl.connect.ExternalNamespaceConnectorInterface1 XNCI1}
* type less-overhead plug-in interface can be connected.
* Also, this method is used for connecting
* {@link org.vcssl.connect.PermissionAuthorizerConnectorInterface1 PACI1}
* type plug-ins which is used for managing permissions (permission authorizer).
* </span>
* <span class="lang-ja">
* 接続したいプラグイン.
* 一般の Object 型のインスタンスをプラグインとして接続して,
* それに属するメソッド/フィールドに, スクリプト内から外部関数/変数としてアクセスする事もできます.
* static なメソッド/フィールドのみにアクセスする場合には, Class<T> 型のインスタンスも接続できます.
* また, 個々のメソッド/フィールドを選んで接続したい場合のために,
* Method / Field 型のインスタンスを接続する事もできます
* ( その際, もしそのフィールド・メソッドが static ではない場合には,
* 引数 plugin は Object 配列型とし、その [0] 番要素に Field または Method を格納し,
* [1] 番要素にそのフィールド・メソッドが定義されたクラスの Class<T> 型インスタンスを格納してください ).
* 加えて,
* {@link org.vcssl.connect.ExternalFunctionConnectorInterface1 XFCI1} /
* {@link org.vcssl.connect.ExternalVariableConnectorInterface1 XVCI1} /
* {@link org.vcssl.connect.ExternalNamespaceConnectorInterface1 XNCI1}
* 形式の, 低オーバーヘッドなプラグインインターフェースを実装したクラスのインスタンスも接続できます.
* また、パーミッションの管理を行う,
* {@link org.vcssl.connect.PermissionAuthorizerConnectorInterface1 PACI1}
* 形式のプラグイン(パーミッション許可プラグイン, permission authorizer)の接続にも、このメソッドを用います.
* </span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be connected,
* caused by unsupported interfaces, incompatibility of data types, and so on.
* </span>
* <span class="lang-ja">
* サポートされていないインターフェースの使用や, データ型の互換性などの原因により,
* プラグインの接続に失敗した場合にスローされます.
* </span>
*/
public void connectPlugin(String bindingName, Object plugin) throws VnanoException {
try {
// Replace the binding key with auto-generated one if, it it is requested.
// キーを自動生成するよう設定されている場合は、キーを置き換え
if (bindingName.equals(SpecialBindingKey.AUTO_KEY)) {
bindingName = this.generateBindingNameOf(plugin);
// これ、ここでシグネチャ求める前にプラグインを init する必要がある? (XNCI1など)
// -> init するまで名前やシグネチャが定まらない実装は XFCI1 的にはNGでいいのでは。init タイミングを早めてもいいけど、それはそれで制約が緩すぎて後でエンジン側でネックになる仕様になりそう(GPCIみたいな)。
}
// bindingName 内の空白や「 ( 」以降は無視する仕様なので、含まれていればカットする
bindingName = bindingName.split("\\s|\\(")[0];
// PACI 1 形式のセキュリティプラグイン
if (plugin instanceof PermissionAuthorizerConnectorInterface1) {
this.connectPaci1Plugin( (PermissionAuthorizerConnectorInterface1)plugin ); //このプラグインは役割的にバインディング情報は不要
// XVCI 1 形式の外部変数プラグイン
} else if (plugin instanceof ExternalVariableConnectorInterface1) {
this.connectXvci1Plugin( (ExternalVariableConnectorInterface1)plugin, true, bindingName, false, null );
// XFCI 1 形式の外部関数プラグイン
} else if (plugin instanceof ExternalFunctionConnectorInterface1) {
this.connectXfci1Plugin( (ExternalFunctionConnectorInterface1)plugin, true, bindingName, false, null);
// XNCI 1 形式の外部関数プラグイン
} else if (plugin instanceof ExternalNamespaceConnectorInterface1) {
this.connectXnci1Plugin( (ExternalNamespaceConnectorInterface1)plugin, true, bindingName, false );
// クラスフィールドの場合
} else if (plugin instanceof Field) {
this.connectFieldAsPlugin( (Field)plugin, null, true, bindingName );
// クラスメソッドの場合
} else if (plugin instanceof Method) {
this.connectMethodAsPlugin( (Method)plugin, null, true, bindingName );
// クラスの場合
} else if (plugin instanceof Class) {
this.connectClassAsPlugin( (Class<?>)plugin, null, true, bindingName );
// インスタンスフィールドやインスタンスメソッド等は、所属インスタンスも格納する配列で渡される
} else if (plugin instanceof Object[]) {
Object[] objects = (Object[])plugin;
// インスタンスフィールドの場合 >> 引数からFieldとインスタンスを取り出し、外部変数として接続
if (objects.length == 2 && objects[0] instanceof Field) {
Field field = (Field)objects[0]; // [0] はフィールドのリフレクション
Object instance = objects[1]; // [1] はフィールドの所属インスタンス
this.connectFieldAsPlugin( field, instance, true, bindingName );
// インスタンスメソッドの場合 >> 引数からMethodとインスタンスを取り出し、外部関数として接続
} else if (objects.length == 2 && objects[0] instanceof Method) {
Method method = (Method)objects[0]; // [0] はメソッドのリフレクション
Object instance = objects[1]; // [1] はメソッドの所属インスタンス
this.connectMethodAsPlugin( method, instance, true, bindingName );
// クラスの場合 >> 引数からClassとインスタンスを取り出し、外部ライブラリとして接続
} else if (objects.length == 2 && objects[0] instanceof Class) {
Class<?> pluginClass = (Class<?>)objects[0];
Object instance = objects[1];
this.connectClassAsPlugin( pluginClass, instance, true, bindingName );
} else {
throw new VnanoException(
ErrorType.UNSUPPORTED_PLUGIN, new String[] {objects[0].getClass().getCanonicalName()}
);
}
// その他のオブジェクトは、Classを取得して外部ライブラリとして接続
} else {
Class<?> pluginClass = plugin.getClass();
this.connectClassAsPlugin( pluginClass, plugin, true, bindingName );
}
// 内部で VnanoException が発生した場合は、原因プラグインを特定できるメッセージを持たせた VnanoException でラップして投げる
} catch (VnanoException vne) {
throw new VnanoException(ErrorType.PLUGIN_CONNECTION_FAILED, bindingName, vne);
}
}
/**
* <span class="lang-en">Disconnects all plug-ins</span>
* <span class="lang-ja">全てのプラグインの接続を解除します</span>
* .
* <span class="lang-en">
* If the finalization (for disconnection) method is implemented on the plug-in,
* it will be called when the plug-in will be disconnected by this method.
* </span>
* <span class="lang-ja">
* その際, 接続解除用の終了時処理が実装されているプラグインに対しては, その終了時処理が実行されます.
* </span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown when an exception occurred on the finalization of the plug-in to be disconnected.
* </span>
* <span class="lang-ja">
* プラグインの終了時処理でエラーが発生した場合にスローされます.
* </span>
*/
public void disconnectAllPlugins() throws VnanoException {
this.finalizeAllPluginsForDisconnection();
this.externalFunctionTable = new FunctionTable(LANG_SPEC);
this.externalVariableTable = new VariableTable(LANG_SPEC);
this.xnci1PluginList = new ArrayList<ExternalNamespaceConnectorInterface1>();
this.xfci1PluginList = new ArrayList<ExternalFunctionConnectorInterface1>();
this.xvci1PluginList = new ArrayList<ExternalVariableConnectorInterface1>();
this.permissionAuthorizer = null;
}
/**
* <span class="lang-en">
* Generate the value of the argument "bindingName" of
* {@link Interconnect#connectPlugin connectPlugin(String bindingKey, Object plugin)}
* method automatically
* </span>
* <span class="lang-ja">
* {@link Interconnect#connectPlugin connectPlugin(String bindingKey, Object plugin)}
* メソッドの引数 bindingName の値を自動生成します
* </span>
* .
* @param plugin
* <span class="lang-en">
* The value passed as the argument "plugin" of
* {@link Interconnect#connectPlugin connectPlugin(String bindingKey, Object plugin)}
* method.
* </span>
* <span class="lang-ja">
* {@link Interconnect#connectPlugin connectPlugin(String bindingKey, Object plugin)}
* メソッドに渡された引数 plugin の値.
* </span>
*
* @return
* <span class="lang-en">The generated value</span>
* <span class="lang-ja">自動生成された値</span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be analyzed,
* caused by unsupported interfaces, incompatibility of data types, and so on.
* </span>
* <span class="lang-ja">
* サポートされていないインターフェースの使用や, データ型の互換性などの原因により,
* プラグインの解析に失敗した場合にスローされます.
* </span>
*/
private String generateBindingNameOf(Object plugin) throws VnanoException {
// 内部変数と互換の変数オブジェクト
if (plugin instanceof AbstractVariable) {
return ((AbstractVariable)plugin).getVariableName();
// 内部関数と互換の変数オブジェクト
} else if (plugin instanceof AbstractFunction) {
return IDENTIFIER_SYNTAX.getSignatureOf((AbstractFunction)plugin);
// XVCI 1 形式の外部変数プラグイン
} else if (plugin instanceof ExternalVariableConnectorInterface1) {
return ((ExternalVariableConnectorInterface1)plugin).getVariableName();
// XFCI 1 形式の外部関数プラグイン
} else if (plugin instanceof ExternalFunctionConnectorInterface1) {
AbstractFunction functionAdapter =
new Xfci1ToFunctionAdapter((ExternalFunctionConnectorInterface1)plugin, LANG_SPEC);
return IDENTIFIER_SYNTAX.getSignatureOf(functionAdapter);
// XNCI 1 形式の外部関数プラグイン
} else if (plugin instanceof ExternalNamespaceConnectorInterface1) {
return ((ExternalNamespaceConnectorInterface1)plugin).getNamespaceName();
// クラスフィールドの場合
} else if (plugin instanceof Field) {
return ((Field)plugin).getName();
// クラスメソッドの場合
} else if (plugin instanceof Method) {
ExternalFunctionConnectorInterface1 xfci1Adapter = new MethodToXfci1Adapter((Method)plugin);
AbstractFunction functionAdapter = new Xfci1ToFunctionAdapter(xfci1Adapter, LANG_SPEC);
return IDENTIFIER_SYNTAX.getSignatureOf(functionAdapter);
// クラスの場合
} else if (plugin instanceof Class) {
return ((Class<?>)plugin).getCanonicalName();
// インスタンスフィールドやインスタンスメソッド等は、所属インスタンスも格納する配列で渡される
} else if (plugin instanceof Object[]) {
Object[] objects = (Object[])plugin;
// インスタンスフィールドの場合
if (objects.length == 2 && objects[0] instanceof Field) {
Field field = (Field)objects[0]; // [0] はフィールドのリフレクション
return generateBindingNameOf(field);
// インスタンスメソッドの場合
} else if (objects.length == 2 && objects[0] instanceof Method) {
Method method = (Method)objects[0]; // [0] はメソッドのリフレクション
return generateBindingNameOf(method);
// クラスの場合 >> 引数からClassとインスタンスを取り出し、外部ライブラリとして接続
} else if (objects.length == 2 && objects[0] instanceof Class) {
Class<?> pluginClass = (Class<?>)objects[0];
return generateBindingNameOf(pluginClass);
} else {
throw new VnanoException(
ErrorType.UNSUPPORTED_PLUGIN, new String[] {objects[0].getClass().getCanonicalName()}
);
}
// その他のオブジェクトは、Classを取得して外部ライブラリとして接続
} else {
Class<?> pluginClass = plugin.getClass();
return generateBindingNameOf(pluginClass);
}
}
/**
* <span class="lang-ja">Field 型のインスタンスを外部変数プラグインとして接続します</span>
* <span class="lang-en">Connects a Field type instance as a plug-in</span>
* .
* <span class="lang-en">
* This connection makes the field reflected by the passed Field type instance accessible
* from scripts as the external variable.
* </span>
* <span class="lang-ja">
* この接続により、指定した Field 型インスタンスによって参照されているフィールドに,
* スクリプト内から外部変数としてアクセス可能になります.
* </span>
*
* @param field
* <span class="lang-en">
* The Field type instance reflecting the field to be accessed from scripts.
* </span>
* <span class="lang-ja">
* スクリプト内からアクセスしたいフィールドを参照しているField型インスタンス.
* </span>
*
* @param instance
* <span class="lang-en">
* The instance of the class in which the method is defined.
* If the method is static, it allows null to be passed.
* </span>
* <span class="lang-ja">
* メソッドが属するクラスのインスタンス. static メソッドについては null を指定できます.
* </span>
*
* @param aliasingRequired
* <span class="lang-en">Whether use the alias for accessing from scripts or not ("true" for use).</span>
* <span class="lang-ja">スクリプト内から別名でアクセスするかどうか(する場合にtrue).</span>
*
* @param aliasName
* <span class="lang-en">The alias for accessing from scripts.</span>
* <span class="lang-ja">スクリプト内での別名.</span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be connected, caused by incompatibility of data types, and so on.
* </span>
* <span class="lang-ja">
* データ型の互換性などの原因により, プラグインの接続に失敗した場合にスローされます.
* </span>
*/
private void connectFieldAsPlugin(Field field, Object instance, boolean aliasingRequired, String aliasName)
throws VnanoException {
FieldToXvci1Adapter adapter = new FieldToXvci1Adapter(field, instance);
this.connectXvci1Plugin(adapter, aliasingRequired, aliasName, false, null);
}
/**
* <span class="lang-ja">Method 型のインスタンスを外部変数プラグインとして接続します</span>
* <span class="lang-en">Connects a Method type instance as a plug-in</span>
* .
* <span class="lang-en">
* This connection makes the method reflected by the passed Method type instance accessible
* from scripts as the external function.
* </span>
* <span class="lang-ja">
* この接続により、指定した Method 型インスタンスによって参照されているメソッドに,
* スクリプト内から外部関数としてアクセス可能になります.
* </span>
*
* @param method
* <span class="lang-en">
* The Method type instance reflecting the method to be accessed from scripts.
* </span>
* <span class="lang-ja">
* スクリプト内からアクセスしたいメソッドを参照しているMethod型インスタンス.
* </span>
*
* @param instance
* <span class="lang-en">
* The instance of the class to which the method belongs.
* If the method is static, it allows null to be passed.
* </span>
* <span class="lang-ja">
* メソッドが属するクラスのインスタンス. static メソッドについては null を指定できます.
* </span>
*
* @param aliasingRequired
* <span class="lang-en">Whether use the alias for accessing from scripts or not ("true" for use).</span>
* <span class="lang-ja">スクリプト内から別名でアクセスするかどうか(する場合にtrue).</span>
*
* @param aliasName
* <span class="lang-en">The alias for accessing from scripts.</span>
* <span class="lang-ja">スクリプト内での別名.</span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be connected, caused by incompatibility of data types, and so on.
* </span>
* <span class="lang-ja">
* データ型の互換性などの原因により, プラグインの接続に失敗した場合にスローされます.
* </span>
*/
private void connectMethodAsPlugin(Method method, Object instance, boolean aliasingRequired, String aliasSignature)
throws VnanoException {
MethodToXfci1Adapter adapter = new MethodToXfci1Adapter(method,instance);
this.connectXfci1Plugin(adapter, aliasingRequired, aliasSignature, false, null);
}
/**
* <span class="lang-ja">Class<T> 型のインスタンスを外部変数プラグインとして接続します</span>
* <span class="lang-en">Connects a Class<T> type instance as a plug-in</span>
* .
* <span class="lang-en">
* This connection makes methods and fields which belong to
* "the class T reflected by the passed Class<T> type instance"
* accessible from scripts as the external functions and variables.
* </span>
* <span class="lang-ja">
* この接続により、「 指定した Class<T> 型インスタンスによって参照されているクラス(T) 」
* に属するメソッドやフィールド(複数)に, スクリプト内から外部関数や外部変数としてアクセス可能になります.
* </span>
*
* @param pluginClass
* <span class="lang-en">
* The Class<T> type instance reflecting the class T to which
* methods and fields to be accessed from scripts belong.
* </span>
* <span class="lang-ja">
* スクリプト内からアクセスしたいメソッドやフィールドが属するクラス T を参照している
* Class<T> 型インスタンス.
* </span>
*
* @param instance
* <span class="lang-en">
* The instance of the class of T.
* If all methods and fields to be accessed are static, it allows null to be passed.
* </span>
* <span class="lang-ja">
* クラス T のインスタンス. static なメソッド/フィールドのみにアクセスする場合は null を指定できます.
* </span>
*
* @param aliasingRequired
* <span class="lang-en">Whether use the alias for accessing from scripts or not ("true" for use).</span>
* <span class="lang-ja">スクリプト内から別名でアクセスするかどうか(する場合にtrue).</span>
*
* @param aliasName
* <span class="lang-en">The alias for accessing from scripts.</span>
* <span class="lang-ja">スクリプト内での別名.</span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be connected, caused by incompatibility of data types, and so on.
* </span>
* <span class="lang-ja">
* データ型の互換性などの原因により, プラグインの接続に失敗した場合にスローされます.
* </span>
*/
private void connectClassAsPlugin(Class<?> pluginClass, Object instance, boolean aliasingRequired, String aliasName)
throws VnanoException {
ClassToXnci1Adapter adapter = new ClassToXnci1Adapter(pluginClass,instance);
this.connectXnci1Plugin(adapter, aliasingRequired, aliasName, true);
}
/**
* <span class="lang-ja">
* パーミッションの認可機能を提供する, {@link org.vcssl.connect.PermissionAuthorizerConnectorInterface1 PACI1}
* 形式のプラグインを接続します
* </span>
* <span class="lang-en">
* Connects the plug-in of {@link org.vcssl.connect.PermissionAuthorizerConnectorInterface1 PACI1} format,
* for authorization of permissions
* </span>
* .
* @param plugin
* <span class="lang-en">The plug-in to be connected.</span>
* <span class="lang-ja">接続するプラグイン.</span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be connected, caused by initialization errors and so on.
* </span>
* <span class="lang-ja">
* 初期化処理の異常などにより, プラグインの接続に失敗した場合にスローされます.
* </span>
*/
private void connectPaci1Plugin(PermissionAuthorizerConnectorInterface1 plugin) throws VnanoException {
// パーミッション許可プラグインは1個しか同時接続できないため、既に接続されている場合はエラー
if (this.permissionAuthorizer != null) {
throw new VnanoException(
ErrorType.MULTIPLE_PERMISSION_AUTHORIZERS_ARE_CONNECTED,
new String[]{ plugin.getClass().getCanonicalName(), this.permissionAuthorizer.getClass().getCanonicalName() }
);
}
// 接続時の初期化処理に成功すれば接続する
try {
plugin.initializeForConnection(this.engineConnector);
} catch (ConnectorException e) {
throw new VnanoException(
ErrorType.PLUGIN_INITIALIZATION_FAILED, plugin.getClass().getCanonicalName(), e
);
}
this.permissionAuthorizer = (PermissionAuthorizerConnectorInterface1) plugin;
// Reflect to the engine connector, because permissions may be requested from other plug-ins.
// パーミッションは他のプラグインからも要求されるので, エンジンコネクタにも反映させる
// (パーミッション認可プラグインの参照を差し替えたインスタンスを生成)
this.engineConnector = this.engineConnector.createPermissionAuthorizerUpdatedInstance(
this.permissionAuthorizer
);
}
/**
* <span class="lang-ja">
* 外部変数を提供する, {@link org.vcssl.connect.ExternalVariableConnectorInterface1 XVCI1}
* 形式のプラグインを接続します
* </span>
* <span class="lang-en">
* Connects the plug-in of {@link org.vcssl.connect.ExternalVariableConnectorInterface1 XVCI1} format,
* which provides an external variable
* </span>
* .
* @param plugin
* <span class="lang-en">The plug-in to be connected.</span>
* <span class="lang-ja">接続するプラグイン.</span>
*
* @param aliasingRequired
* <span class="lang-en">Whether use the alias for accessing from scripts or not ("true" for using).</span>
* <span class="lang-ja">スクリプト内から別名でアクセスするかどうか(する場合にtrue).</span>
*
* @param aliasName
* <span class="lang-en">The alias for accessing from scripts.</span>
* <span class="lang-ja">スクリプト内からのアクセスに使用する別名.</span>
*
* @param belongsToNamespace
* <span class="lang-en">Whether the variable provided by the plug-in belongs to any namespaces.</span>
* <span class="lang-ja">プラグインが提供する変数が属する名前空間が, 名前空間に属するかどうか(する場合に true).</span>
*
* @param namespaceName
* <span class="lang-en">The name of the namespace to which the variable provided by the plug-in belongs.</span>
* <span class="lang-ja">プラグインが提供する変数が属する名前空間の名称.</span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be connected, caused by incompatibility of data types, and so on.
* </span>
* <span class="lang-ja">
* データ型の互換性などの原因により, プラグインの接続に失敗した場合にスローされます.
* </span>
*/
private void connectXvci1Plugin(ExternalVariableConnectorInterface1 plugin,
boolean aliasingRequired, String aliasName, boolean belongsToNamespace, String namespaceName) throws VnanoException {
// 接続時の初期化処理を実行
try {
plugin.initializeForConnection(this.engineConnector);
} catch (ConnectorException e) {
throw new VnanoException(
ErrorType.PLUGIN_INITIALIZATION_FAILED, plugin.getClass().getCanonicalName(), e
);
}
// その他の初期化/終了時処理などの時に呼ぶため、XVCI1形式のままのインスタンスもフィールドのリストに登録
this.xvci1PluginList.add(plugin);
// コンパイラやVMでは各種変数は AbstractVariable に抽象化した形で扱うので、
// XVCI1 から AbstractVariable へ変換するアダプタ(AbstractVariableを継承している)を生成
AbstractVariable adapter = new Xvci1ToVariableAdapter(plugin, LANG_SPEC);
// 所属名前空間やエイリアス(別名)などが必要なら設定
if (belongsToNamespace) {
adapter.setNamespaceName(namespaceName);
}
if (aliasingRequired) {
adapter.setVariableName(aliasName);
}
// 設定を終えた AbstractVariable 継承アダプタを接続
this.connectVariable(adapter);
}
/**
* <span class="lang-ja">
* 外部関数を提供する, {@link org.vcssl.connect.ExternalFunctionConnectorInterface1 XFCI1}
* 形式のプラグインを接続します
* </span>
* <span class="lang-en">
* Connects the plug-in of {@link org.vcssl.connect.ExternalFunctionConnectorInterface1 XFCI1} format,
* which provides an external function
* </span>
* .
* @param plugin
* <span class="lang-en">The plug-in to be connected.</span>
* <span class="lang-ja">接続するプラグイン.</span>
*
* @param aliasingRequired
* <span class="lang-en">Whether use the alias for accessing from scripts or not ("true" for using).</span>
* <span class="lang-ja">スクリプト内から別名でアクセスするかどうか(する場合にtrue).</span>
*
* @param aliasName
* <span class="lang-en">The alias for accessing from scripts.</span>
* <span class="lang-ja">スクリプト内からのアクセスに使用する別名.</span>
*
* @param belongsToNamespace
* <span class="lang-en">Whether the function provided by the plug-in belongs to any namespaces.</span>
* <span class="lang-ja">プラグインが提供する関数が属する名前空間が, 名前空間に属するかどうか(する場合に true).</span>
*
* @param namespaceName
* <span class="lang-en">The name of the namespace to which the function provided by the plug-in belongs.</span>
* <span class="lang-ja">プラグインが提供する関数が属する名前空間.</span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be connected, caused by incompatibility of data types, and so on.
* </span>
* <span class="lang-ja">
* データ型の互換性などの原因により, プラグインの接続に失敗した場合にスローされます.
* </span>
*/
private void connectXfci1Plugin(ExternalFunctionConnectorInterface1 plugin,
boolean aliasingRequired, String aliasName, boolean belongsToNamespace, String namespaceName) throws VnanoException {
// 接続時の初期化処理を実行
try {
plugin.initializeForConnection(this.engineConnector);
} catch (ConnectorException e) {
throw new VnanoException(
ErrorType.PLUGIN_INITIALIZATION_FAILED, plugin.getClass().getCanonicalName(), e
);
}
// その他の初期化/終了時処理などの時に呼ぶため、XFCI1形式のままのインスタンスもフィールドのリストに登録
this.xfci1PluginList.add(plugin);
// コンパイラやVMでは各種関数は AbstractFunction に抽象化した形で扱うので、
// XFCI1 から AbstractFunction へ変換するアダプタ(AbstractFunctionを継承している)を生成
AbstractFunction adapter = new Xfci1ToFunctionAdapter(plugin, LANG_SPEC);
// 所属名前空間やエイリアス(別名)などが必要なら設定
if (belongsToNamespace) {
adapter.setNamespaceName(namespaceName);
}
if (aliasingRequired) {
adapter.setFunctionName(aliasName);
}
// 設定を終えた AbstractFunction 継承アダプタを接続
this.connectFunction(adapter);
}
/**
* <span class="lang-ja">
* 複数の外部変数や外部関数をまとめて提供する,
* {@link org.vcssl.connect.ExternalNamespaceConnectorInterface1 XNCI1} 形式のプラグインを接続します
* </span>
* <span class="lang-en">
* Connects the plug-in of {@link org.vcssl.connect.ExternalNamespaceConnectorInterface1 XNCI1} format,
* which provides a set of external variables and external functions
* </span>
* .
* @param plugin
* <span class="lang-en">The plug-in to be connected.</span>
* <span class="lang-ja">接続するプラグイン.</span>
*
* @param aliasingRequired
* <span class="lang-en">Whether use the alias for accessing from scripts or not ("true" for using).</span>
* <span class="lang-ja">スクリプト内から別名でアクセスするかどうか(する場合にtrue).</span>
*
* @param aliasName
* <span class="lang-en">The alias for accessing from scripts.</span>
* <span class="lang-ja">スクリプト内からのアクセスに使用する別名.</span>
*
* @throws VnanoException
* <span class="lang-en">
* Thrown if the plug-in could not be connected, caused by incompatibility of data types, and so on.
* </span>
* <span class="lang-ja">
* データ型の互換性などの原因により, プラグインの接続に失敗した場合にスローされます.
* </span>
*/
private void connectXnci1Plugin(
ExternalNamespaceConnectorInterface1 plugin, boolean aliasingRequired, String aliasName,
boolean ignoreIncompatibles) throws VnanoException {
// 本体の pre connect 初期化処理
try {
plugin.preInitializeForConnection(this.engineConnector);
} catch (ConnectorException e) {
throw new VnanoException(
ErrorType.PLUGIN_INITIALIZATION_FAILED, plugin.getClass().getCanonicalName(), e
);
}
// 名前空間の名称を取得、ただしエイリアスが指定されている場合はそちらを用いる
String nameapaceName = plugin.getNamespaceName();
if (aliasingRequired) {
nameapaceName = aliasName;
}
// 所属関数プラグインを接続(この中で関数の connect 初期化処理が行われる)
ExternalFunctionConnectorInterface1[] xfciPlugins = plugin.getFunctions();
for (ExternalFunctionConnectorInterface1 xfciPlugin: xfciPlugins) {
try {
this.connectXfci1Plugin(xfciPlugin, false, null, true, nameapaceName);
} catch (VnanoException e) {
if (!ignoreIncompatibles) {
throw e;
}
}
}
// 所属変数プラグインを接続(この中で変数の connect 初期化処理が行われる)
ExternalVariableConnectorInterface1[] xvciPlugins = plugin.getVariables();
for (ExternalVariableConnectorInterface1 xvciPlugin: xvciPlugins) {
try {
this.connectXvci1Plugin(xvciPlugin, false, null, true, nameapaceName);
} catch (VnanoException e) {
if (!ignoreIncompatibles) {
throw e;
}
}
}
// 本体の post connect 初期化処理
try {
plugin.postInitializeForConnection(this.engineConnector);
} catch (ConnectorException e) {
throw new VnanoException(
ErrorType.PLUGIN_INITIALIZATION_FAILED, plugin.getClass().getCanonicalName(), e
);
}
// 先のほうの初期化だけでなく、後のほうの初期化も正常に完了した段階でリストに登録する
this.xnci1PluginList.add(plugin);
}
/**
* Vnano処理系内部の変数形式に準拠した変数オブジェクトを接続します。
* @param variable 変数オブジェクト
*/
private void connectVariable(AbstractVariable variable) {
this.externalVariableTable.addVariable(variable);
}
/**
* Vnano処理系内部の関数形式に準拠した関数オブジェクトを接続します。
*
* @param function 関数オブジェクト
*/
private void connectFunction(AbstractFunction function) {
this.externalFunctionTable.addFunction(function);
}
private void finalizeAllPluginsForDisconnection() throws VnanoException {
Object finalizingPlugin = null; // 例外発生時のため、終了時処理中のプラグインを控えておく
try {
// 関数/変数系は、モジュールの preFinalize -> 関数/変数の init -> モジュールの postFinalize の順で破棄
for (ExternalNamespaceConnectorInterface1 plugin: xnci1PluginList) {
finalizingPlugin = plugin;
plugin.preFinalizeForDisconnection(this.engineConnector);
}
for (ExternalFunctionConnectorInterface1 plugin: xfci1PluginList) {
finalizingPlugin = plugin;
plugin.finalizeForDisconnection(this.engineConnector);
}
for (ExternalVariableConnectorInterface1 plugin: xvci1PluginList) {
finalizingPlugin = plugin;
plugin.finalizeForDisconnection(this.engineConnector);
}
for (ExternalNamespaceConnectorInterface1 plugin: xnci1PluginList) {
finalizingPlugin = plugin;
plugin.postFinalizeForDisconnection(this.engineConnector);
}
// セキュリティ系プラグインは最後に破棄
//(EngineConnector経由で、他プラグインの接続解除処理内で呼ばれる可能性があるため)
if (this.permissionAuthorizer != null) {
this.permissionAuthorizer.finalizeForDisconnection(this.engineConnector);
}
} catch (ConnectorException e) {
throw new VnanoException(
ErrorType.PLUGIN_FINALIZATION_FAILED, finalizingPlugin.getClass().getCanonicalName(), e
);
}
}
private void initializeAllPluginsForExecution() throws VnanoException {
Object initializingPlugin = null; // 例外発生時のため、初期化中のプラグインを控えておく
try {
// セキュリティ系プラグインは最初に初期化
//(EngineConnector経由で、他プラグインの初期化処理内で呼ばれる可能性があるため)
if (this.permissionAuthorizer != null) {
this.permissionAuthorizer.initializeForExecution(this.engineConnector);
}
// 関数/変数系は、モジュールの preInit -> 関数/変数の init -> モジュールの postInit の順で初期化
for (ExternalNamespaceConnectorInterface1 plugin: xnci1PluginList) {
initializingPlugin = plugin;
plugin.preInitializeForExecution(this.engineConnector);
}
for (ExternalFunctionConnectorInterface1 plugin: xfci1PluginList) {
initializingPlugin = plugin;
plugin.initializeForExecution(this.engineConnector);
}
for (ExternalVariableConnectorInterface1 plugin: xvci1PluginList) {
initializingPlugin = plugin;
plugin.initializeForExecution(this.engineConnector);
}
for (ExternalNamespaceConnectorInterface1 plugin: xnci1PluginList) {
initializingPlugin = plugin;
plugin.postInitializeForExecution(this.engineConnector);
}
} catch (ConnectorException e) {
throw new VnanoException(
ErrorType.PLUGIN_INITIALIZATION_FAILED, initializingPlugin.getClass().getCanonicalName(), e
);
}
}
private void finalizeAllPluginsForTermination() throws VnanoException {
Object finalizingPlugin = null; // 例外発生時のため、終了時処理中のプラグインを控えておく
try {
// 関数/変数系は、モジュールの preFinalize -> 関数/変数の init -> モジュールの postFinalize の順で破棄
for (ExternalNamespaceConnectorInterface1 plugin: xnci1PluginList) {
finalizingPlugin = plugin;
plugin.preFinalizeForTermination(this.engineConnector);
}
for (ExternalFunctionConnectorInterface1 plugin: xfci1PluginList) {
finalizingPlugin = plugin;
plugin.finalizeForTermination(this.engineConnector);
}
for (ExternalVariableConnectorInterface1 plugin: xvci1PluginList) {
finalizingPlugin = plugin;
plugin.finalizeForTermination(this.engineConnector);
}
for (ExternalNamespaceConnectorInterface1 plugin: xnci1PluginList) {
finalizingPlugin = plugin;
plugin.postFinalizeForTermination(this.engineConnector);
}
// セキュリティ系プラグインは最後に破棄
//(EngineConnector経由で、他プラグインの終了時処理内で呼ばれる可能性があるため)
if (this.permissionAuthorizer != null) {
this.permissionAuthorizer.finalizeForTermination(this.engineConnector);
}
} catch (ConnectorException e) {
throw new VnanoException(
ErrorType.PLUGIN_FINALIZATION_FAILED, finalizingPlugin.getClass().getCanonicalName(), e
);
}
}
}
| 37.500756
| 121
| 0.706007
|
eb702f4478d11040d86b98085d6ee07e49046ee7
| 10,609
|
/**
*
*/
package com.pact.healthapp.components.set;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.lidroid.xutils.BitmapUtils;
import com.lidroid.xutils.bitmap.BitmapDisplayConfig;
import com.pact.healthapp.R;
import com.pact.healthapp.components.checkupaccount.CheckupAccountActivity;
import com.pact.healthapp.components.favorite.MyFavoriteActivity;
import com.pact.healthapp.components.login.LoginActivity;
import com.pact.healthapp.components.serviceorder.ServiceOrderActivity;
import com.pact.healthapp.data.Constants;
import com.pact.healthapp.http.ServiceEngin;
import com.pact.healthapp.universal.BaseFragment;
import com.pact.healthapp.universal.WebviewActivity;
import com.pact.healthapp.utils.SharedPreferenceUtils;
import com.pact.healthapp.view.CommonDialog;
import com.pact.healthapp.view.CommonToast;
import com.pact.healthapp.view.RoundImageView;
/**
* @author zhangyl
*/
public class SetFragment extends BaseFragment implements OnClickListener {
private SharedPreferenceUtils sp = new SharedPreferenceUtils();
private View view;
private LinearLayout set_myfavorite, set_aboutus, set_changepwd,
set_logout, set_mycheckupaccount, set_myserviceorder;
private RelativeLayout setuserinfo;
private RoundImageView userinfo_img;
private TextView userinfo_nickname, userinfo_phonenumber;
private CommonDialog dialog;
@Override
public View onCreateView(LayoutInflater inflater,
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
// TODO Auto-generated method stub
view = inflater.inflate(R.layout.set_layout, null);
((SetActivity) getActivity()).setTitle("我的新华");
((SetActivity) getActivity()).setBackType(2);// fragment一层一层返回
initView();
loadData();
return view;
}
private void initView() {
// 个人信息设置
setuserinfo = (RelativeLayout) view.findViewById(R.id.set_userinfo);
setuserinfo.setOnClickListener(this);
userinfo_img = (RoundImageView) view
.findViewById(R.id.set_userinfo_img);
userinfo_nickname = (TextView) view
.findViewById(R.id.set_userinfo_nickname);
userinfo_phonenumber = (TextView) view
.findViewById(R.id.set_userinfo_phonenumber);
// 我的收藏
set_myfavorite = (LinearLayout) view.findViewById(R.id.set_myfavorite);
set_myfavorite.setOnClickListener(this);
// 关于我们
set_aboutus = (LinearLayout) view.findViewById(R.id.set_aboutus);
set_aboutus.setOnClickListener(this);
//我的体检账户
set_mycheckupaccount = (LinearLayout) view.findViewById(R.id.set_mycheckupaccount);
set_mycheckupaccount.setOnClickListener(this);
//我的服务单
set_myserviceorder = (LinearLayout) view.findViewById(R.id.set_myserviceorder);
set_myserviceorder.setOnClickListener(this);
// 修改密码
set_changepwd = (LinearLayout) view.findViewById(R.id.set_changepwd);
set_changepwd.setOnClickListener(this);
// 注销
set_logout = (LinearLayout) view.findViewById(R.id.set_logout);
set_logout.setOnClickListener(this);
if (!sp.getLoginState(context)) {
((TextView) set_logout.findViewById(R.id.set_logout_tv))
.setText(R.string.login_str);
} else {
((TextView) set_logout.findViewById(R.id.set_logout_tv))
.setText(R.string.logout_str);
}
}
private void loadData() {
// TODO Auto-generated method stub
BitmapUtils bitmapUtils = new BitmapUtils(context);
BitmapDisplayConfig bitmapDisplayConfig = new BitmapDisplayConfig();
bitmapDisplayConfig.setLoadFailedDrawable(context.getResources()
.getDrawable(R.mipmap.set_headimg_default));
bitmapDisplayConfig.setLoadingDrawable(context.getResources()
.getDrawable(R.mipmap.set_headimg_default));
bitmapUtils.configDefaultDisplayConfig(bitmapDisplayConfig);
bitmapUtils.display(userinfo_img, sp.getLoginInfo(context, "headImg"));
userinfo_nickname.setText(sp.getLoginInfo(context, "nickName"));
userinfo_phonenumber.setText("手机号:"
+ sp.getLoginInfo(context, "phoneNumber"));
if (sp.getLoginInfo(context, "phoneNumber").equals("")) {
userinfo_phonenumber.setText("");
}
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.set_userinfo: // 个人信息设置
if (!sp.getLoginState(context)) {
Intent intent = new Intent(context, LoginActivity.class);
startActivityForResult(intent, ServiceEngin.REQUEST_LOGIN);
return;
}
((SetActivity) getActivity()).setContenierView(1);// 隐藏Tab,显示Title
((SetActivity) getActivity()).setBackType(0);// fragment一层一层返回
/**
* ft事务是全局的变量,只能commit一次。 在这里用局部ft事务去做commit。
*/
mFragmentTransaction = getActivity().getSupportFragmentManager()
.beginTransaction();
mFragmentTransaction
.replace(R.id.login_fl_continer, new SetUserInfoFragment())
.addToBackStack("SetFragment").commit();
break;
case R.id.set_myfavorite: // 我的收藏
startActivity(new Intent(context, MyFavoriteActivity.class));
break;
case R.id.set_mycheckupaccount://我的体检账户
startActivity(new Intent(context, CheckupAccountActivity.class));
break;
case R.id.set_myserviceorder://我的服务单
startActivity(new Intent(context, ServiceOrderActivity.class));
break;
case R.id.set_aboutus: // 关于我们
Intent aboutus = new Intent(context, WebviewActivity.class);
aboutus.putExtra("url", Constants.SET_ABOUTUS_URL);
aboutus.putExtra("title", "关于我们");
startActivity(aboutus);
break;
case R.id.set_changepwd: // 修改密码
if (!sp.getLoginState(context)) {
Intent intent = new Intent(context, LoginActivity.class);
startActivityForResult(intent, 98);
return;
}
if (sp.getLoginState(context)
&& sp.getLoginInfo(context, "otherLogin").equals("true")) {
CommonToast.makeText(context, "第三方账号登录,不需要修改密码");
return;
}
((SetActivity) getActivity()).setContenierView(1);// 隐藏Tab,显示Title
((SetActivity) getActivity()).setBackType(0);// fragment一层一层返回
mFragmentTransaction = getActivity().getSupportFragmentManager()
.beginTransaction();
mFragmentTransaction
.replace(R.id.login_fl_continer, new ChangepwdFragment())
.addToBackStack("ChangepwdFragment").commit();
break;
case R.id.set_logout: // 注销
if (!sp.getLoginState(context)) {
startActivity(new Intent(context, LoginActivity.class));
} else {
dialog = new CommonDialog(context, 2, "注销", "否",
new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
SharedPreferenceUtils sp = new SharedPreferenceUtils();
String phoneNumber = sp.getLoginInfo(
getActivity(), "account");
Intent intent = new Intent(context,
LoginActivity.class);
intent.putExtra("phoneNumber", phoneNumber);
sp.clearUserinfo(context);
// LoginUser.getInstance().clearLoginState();
dialog.dismiss();
startActivity(intent);
}
}, null, null, "注销当前登录?");
dialog.show();
}
break;
}
}
@Override
public void onResume() {
// TODO Auto-generated method stub
super.onResume();
((SetActivity) getActivity()).btn_left.setVisibility(View.INVISIBLE);
((SetActivity) getActivity()).home_tabs.setVisibility(View.VISIBLE);
((SetActivity) getActivity()).home_tab5_cb.setSelected(true);
initView();
loadData();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if (resultCode == Activity.RESULT_OK) {
if (requestCode == ServiceEngin.REQUEST_LOGIN) {// 个人设置
((SetActivity) getActivity()).setContenierView(1);
((SetActivity) getActivity()).setBackType(0);
mFragmentTransaction = getActivity()
.getSupportFragmentManager().beginTransaction();
mFragmentTransaction
.replace(R.id.login_fl_continer,
new SetUserInfoFragment())
.addToBackStack("SetUserInfoFragment").commit();
} else if (requestCode == 98) {// 修改密码
((SetActivity) getActivity()).setContenierView(1);
((SetActivity) getActivity()).setBackType(0);
mFragmentTransaction = getActivity()
.getSupportFragmentManager().beginTransaction();
mFragmentTransaction
.replace(R.id.login_fl_continer,
new ChangepwdFragment())
.addToBackStack("ChangepwdFragment").commit();
}
}
}
}
| 42.951417
| 98
| 0.594024
|
b06049bb8618343bf99bc2884a4194d4425c5852
| 7,473
|
package ca.ualberta.cs.routinekeen.Controllers;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.io.FileOutputStream;
import java.lang.reflect.Type;
import java.util.ArrayList;
import ca.ualberta.cs.routinekeen.Models.Habit;
import ca.ualberta.cs.routinekeen.Models.HabitEvent;
import ca.ualberta.cs.routinekeen.Models.HabitHistory;
import ca.ualberta.cs.routinekeen.Models.HabitList;
import ca.ualberta.cs.routinekeen.Models.User;
import ca.ualberta.cs.routinekeen.Models.UserList;
/**
* Created by hughc on 2017-11-05.
*/
public class LocalDataManager {
private static LocalDataManager localDataManager = null;
private final String habitListPrefFile = "HabitListFile";
private final String userListPrefFile = "UserListFile";
private final String habitHistoryPreFile = "HabitHistoryFile";
private final String habitTypePrefFile = "TypeFile";
private final String userListKey = "userList";
private final String habitListKey = "habitList";
private final String habitHistoryKey = "habitHistoryList";
private final String typeListKey = "typeList";
private Gson gson = new Gson();
private String jsonString;
private Context context;
public LocalDataManager(Context context){
this.context = context;
}
public static void InitManager(Context context) {
if(localDataManager == null) {
if (context == null) {
throw new RuntimeException("No application context provided!");
}
localDataManager = new LocalDataManager(context);
}
}
public static LocalDataManager getManager(){
if(localDataManager == null){
throw new RuntimeException("Did not initialize Manager");
}
return localDataManager;
}
public void saveHabitList(HabitList habitList){
SharedPreferences settings = context.getSharedPreferences(habitListPrefFile,Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
jsonString = gson.toJson(habitList.getHabits());
editor.putString(habitListKey,jsonString);
editor.apply();
}
public HabitList loadHabitList(){
SharedPreferences settings = context.getSharedPreferences(habitListPrefFile,Context.MODE_PRIVATE);
String habitListData = settings.getString(habitListKey,"");
if (habitListData.equals("")) {
return new HabitList();
}else{
Type listType = new TypeToken<ArrayList<Habit>>(){}.getType();
ArrayList<Habit> listOfHabits = gson.fromJson(habitListData, listType);
return new HabitList(listOfHabits);
}
}
public void saveUserList(UserList userList){
SharedPreferences settings = context.getSharedPreferences(userListPrefFile, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
jsonString = gson.toJson(userList.getUsers());
editor.putString(userListKey, jsonString);
editor.apply();
}
public UserList loadUserList(){
SharedPreferences settings = context.getSharedPreferences(userListPrefFile, Context.MODE_PRIVATE);
String userListData = settings.getString(userListKey, "");
if (userListData.equals("")){
return new UserList();
} else{
Type listType = new TypeToken<ArrayList<User>>(){}.getType();
ArrayList<User> listOfUsers = gson.fromJson(userListData, listType);
return new UserList(listOfUsers);
}
}
public void saveHabitHistory(HabitHistory habitHistory) {
SharedPreferences settings = context.getSharedPreferences(habitHistoryPreFile, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
jsonString = gson.toJson(habitHistory.getEvents());
editor.putString(habitHistoryKey,jsonString);
editor.apply();
}
public HabitHistory loadHabitHistory() {
//TODO: 11/11/2017 implement
SharedPreferences settings = context.getSharedPreferences(habitHistoryPreFile,Context.MODE_PRIVATE);
String habitHistoryData = settings.getString(habitHistoryKey,"");
if(habitHistoryData == ""){
return new HabitHistory();
}else{
Type listType = new TypeToken<ArrayList<HabitEvent>>(){}.getType();
ArrayList<HabitEvent> list = gson.fromJson(habitHistoryData,listType);
return new HabitHistory(list);
}
}
public void saveHabitTypeList(ArrayList<String> typeList){
SharedPreferences settings = context.getSharedPreferences(habitTypePrefFile, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
jsonString = gson.toJson(typeList);
editor.putString(typeListKey, jsonString);
editor.apply();
}
public ArrayList<String> loadHabitTypeList() {
SharedPreferences settings = context.getSharedPreferences(habitTypePrefFile, Context.MODE_PRIVATE);
String typeListData = settings.getString(typeListKey, "");
if (typeListData.equals("")){
return null;
} else{
Type listType = new TypeToken<ArrayList<String>>(){}.getType();
return gson.fromJson(typeListData, listType);
}
}
public void loadSharedPrefs(String ... prefs) {
// Helper function to view local data within shared preferences
// Taken from https://stackoverflow.com/questions/23635644/
// how-can-i-view-the-shared-preferences-file-using-android-studio
// Date: Nov. 11, 2017
// Logging messages left in to view Shared Preferences.
// I filter out all logs except for ERROR; hence why I am printing error messages.
Log.i("Loading Shared Prefs", "-----------------------------------");
Log.i("----------------", "---------------------------------------");
for (String pref_name: prefs) {
SharedPreferences preference = context.getSharedPreferences(pref_name, Context.MODE_PRIVATE);
for (String key : preference.getAll().keySet()) {
Log.i(String.format("Shared Preference : %s - %s", pref_name, key),
preference.getString(key, "error!"));
}
Log.i("----------------", "---------------------------------------");
}
Log.i("Finished Shared Prefs", "----------------------------------");
}
public void clearUserSharedPrefs(){
// Clear the user habits that are stored locally
SharedPreferences habitPref = context.getSharedPreferences(habitListPrefFile, Context.MODE_PRIVATE);
SharedPreferences.Editor editor = habitPref.edit();
editor.clear();
editor.commit();
// Clear the users habit events that are stored locally
SharedPreferences habitEventPref = context.getSharedPreferences(habitHistoryPreFile, Context.MODE_PRIVATE);
editor = habitEventPref.edit();
editor.clear();
editor.commit();
// Clear the users habit types thata re stored locally
SharedPreferences habitTypeEventPref =
context.getSharedPreferences(habitTypePrefFile, Context.MODE_PRIVATE);
editor = habitTypeEventPref.edit();
editor.clear();
editor.commit();
}
}
| 41.06044
| 115
| 0.659574
|
9227481aab3ce1dc8f93a840c7105ddf26cebae8
| 2,301
|
package no.nav.registre.testnorge.organisasjonfastedataservice.service;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.UUID;
import no.nav.testnav.libs.dto.organiasjonbestilling.v1.ItemDTO;
import no.nav.testnav.libs.dto.organisasjonfastedataservice.v1.Gruppe;
import no.nav.registre.testnorge.organisasjonfastedataservice.consumer.OrganisasjonBestillingConsumer;
import no.nav.registre.testnorge.organisasjonfastedataservice.consumer.OrganisasjonMottakConsumer;
import no.nav.registre.testnorge.organisasjonfastedataservice.domain.Organisasjon;
import no.nav.registre.testnorge.organisasjonfastedataservice.repository.OrganisasjonRepository;
@Service
@RequiredArgsConstructor
public class OrganisasjonOrdreService {
private final OrganisasjonMottakConsumer organisasjonMottakConsumer;
private final OrganisasjonBestillingConsumer organisasjonBestillingConsumer;
private final OrganisasjonRepository repository;
public String create(Organisasjon organisasjon, String miljo) {
var ordreId = UUID.randomUUID().toString();
return organisasjonMottakConsumer.create(organisasjon, miljo, ordreId);
}
public String change(Organisasjon organisasjon, String miljo) {
var ordreId = UUID.randomUUID().toString();
return organisasjonMottakConsumer.change(organisasjon, miljo, ordreId);
}
public List<ItemDTO> getStatus(String ordreId) {
return organisasjonBestillingConsumer.getOrdreStatus(ordreId);
}
public String create(Gruppe gruppe, String miljo) {
var ordreId = UUID.randomUUID().toString();
repository.findAllByGruppeAndOverenhetIsNull(gruppe)
.stream()
.map(Organisasjon::new)
.forEach(organisasjon -> organisasjonMottakConsumer.create(organisasjon, miljo, ordreId));
return ordreId;
}
public String change(Gruppe gruppe, String miljo) {
var ordreId = UUID.randomUUID().toString();
repository.findAllByGruppeAndOverenhetIsNull(gruppe)
.stream()
.map(Organisasjon::new)
.forEach(organisasjon -> organisasjonMottakConsumer.change(organisasjon, miljo, ordreId));
return ordreId;
}
}
| 41.089286
| 106
| 0.756628
|
ea76dd66b9be789d0af2af910017400fa79f1332
| 11,301
|
package levelGenerators.benWeber;
import java.util.ArrayList;
import java.util.Random;
import engine.core.MarioLevelGenerator;
import engine.core.MarioLevelModel;
import engine.core.MarioTimer;
public class LevelGenerator implements MarioLevelGenerator {
private int maxGaps;
private int maxTurtles;
private int maxCoinBlocks;
private double CHANCE_BLOCK_POWER_UP = 0.1;
private double CHANCE_BLOCK_COIN = 0.3;
private double CHANCE_BLOCK_ENEMY = 0.2;
private double CHANCE_WINGED = 0.5;
private double CHANCE_COIN = 0.2;
private double COIN_HEIGHT = 5;
private double CHANCE_PLATFORM = 0.1;
private double CHANCE_END_PLATFORM = 0.1;
private int PLATFORM_HEIGHT = 4;
private double CHANCE_ENEMY = 0.1;
private double CHANCE_PIPE = 0.1;
private int PIPE_MIN_HEIGHT = 2;
private double PIPE_HEIGHT = 3.0;
private int minX = 5;
private double CHANCE_HILL = 0.1;
private double CHANCE_END_HILL = 0.3;
private double CHANCE_HILL_ENEMY = 0.3;
private double HILL_HEIGHT = 4;
private int GAP_LENGTH = 5;
private double CHANGE_GAP = 0.1;
private double CHANGE_HILL_CHANGE = 0.1;
private double GAP_OFFSET = -5;
private double GAP_RANGE = 10;
private int GROUND_MAX_HEIGHT = 5;
// controls the fun
Random rand;
// constraints
int gapCount = 0;
int turtleCount = 0;
int coinBlockCount = 0;
int xExit = 0;
int yExit = 0;
public LevelGenerator() {
this(10, 7, 10);
}
public LevelGenerator(int maxGaps, int maxTurtles, int maxCoinBlocks) {
this.maxGaps = maxGaps;
this.maxTurtles = maxTurtles;
this.maxCoinBlocks = maxCoinBlocks;
}
private void placeBlock(MarioLevelModel model, int x, int y) {
// choose block type
if (rand.nextDouble() < CHANCE_BLOCK_POWER_UP) {
model.setBlock(x, y, MarioLevelModel.SPECIAL_BRICK);
} else if (rand.nextDouble() < CHANCE_BLOCK_COIN && coinBlockCount < this.maxCoinBlocks) {
model.setBlock(x, y, MarioLevelModel.COIN_BRICK);
coinBlockCount++;
} else {
model.setBlock(x, y, MarioLevelModel.NORMAL_BRICK);
}
// place enemies
if (rand.nextDouble() < CHANCE_BLOCK_ENEMY) {
char t = MarioLevelModel.getEnemyCharacters(false)[this.rand.nextInt(MarioLevelModel.getEnemyCharacters(false).length)];
// turtle constraint
if (t == MarioLevelModel.GREEN_KOOPA || t == MarioLevelModel.RED_KOOPA) {
if (turtleCount < this.maxTurtles) {
turtleCount++;
} else {
t = MarioLevelModel.GOOMBA;
}
}
boolean winged = rand.nextDouble() < CHANCE_WINGED;
model.setBlock(x, y - 1, MarioLevelModel.getWingedEnemyVersion(t, winged));
}
}
private void placePipe(MarioLevelModel model, int x, int y, int height) {
model.setRectangle(x, y - height, 2, height, MarioLevelModel.PIPE);
}
private void setGroundHeight(MarioLevelModel model, int x, int y, int lastY, int nextY) {
int mapHeight = model.getHeight();
model.setRectangle(x, y + 1, 1, mapHeight - 1 - y, MarioLevelModel.GROUND);
if (y < lastY) {
model.setBlock(x, y, MarioLevelModel.GROUND);
for (int i = y + 1; i <= lastY; i++) {
model.setBlock(x, i, MarioLevelModel.GROUND);
}
} else if (y < nextY) {
model.setBlock(x, y, MarioLevelModel.GROUND);
for (int i = y + 1; i <= nextY; i++) {
model.setBlock(x, i, MarioLevelModel.GROUND);
}
} else {
model.setBlock(x, y, MarioLevelModel.GROUND);
}
// place the exit
if (x == (model.getWidth() - 5)) {
this.yExit = y - 1;
}
}
public String getGeneratedLevel(MarioLevelModel model, MarioTimer timer) {
this.rand = new Random();
model.clearMap();
ArrayList<Integer> ground = new ArrayList<Integer>();
// used to place the ground
int lastY = GROUND_MAX_HEIGHT + (int) (rand.nextDouble() * (model.getHeight() - 1 - GROUND_MAX_HEIGHT));
int y = lastY;
int nextY = y;
boolean justChanged = false;
int length = 0;
int landHeight = model.getHeight() - 1;
// place the ground
for (int x = 0; x < model.getWidth(); x++) {
// need more ground
if (length > GAP_LENGTH && y >= model.getHeight()) {
nextY = landHeight;
justChanged = true;
length = 1;
}
// adjust ground level
else if (x > minX && rand.nextDouble() < CHANGE_HILL_CHANGE && !justChanged) {
nextY += (int) (GAP_OFFSET + GAP_RANGE * rand.nextDouble());
nextY = Math.min(model.getHeight() - 2, nextY);
nextY = Math.max(5, nextY);
justChanged = true;
length = 1;
}
// add a gap
else if (x > minX && y < model.getHeight() && rand.nextDouble() < CHANGE_GAP && !justChanged
&& gapCount < this.maxGaps) {
landHeight = Math.min(model.getHeight() - 1, lastY);
nextY = model.getHeight();
justChanged = true;
length = 1;
gapCount++;
} else {
length++;
justChanged = false;
}
setGroundHeight(model, x, y, lastY, nextY);
ground.add(y);
lastY = y;
y = nextY;
}
// non colliding hills
int x = 0;
y = model.getHeight();
for (Integer h : ground) {
if (y == model.getHeight()) {
if (x > 10 && rand.nextDouble() < CHANCE_HILL) {
y = (int) (HILL_HEIGHT + rand.nextDouble() * (h - HILL_HEIGHT));
model.setBlock(x, y, MarioLevelModel.PLATFORM);
for (int i = y + 1; i < h; i++) {
model.setBlock(x, i, MarioLevelModel.PLATFORM_BACKGROUND);
}
}
} else {
// end if hitting a wall
if (y >= h) {
y = model.getHeight();
} else if (rand.nextDouble() < CHANCE_END_HILL) {
model.setBlock(x, y, MarioLevelModel.PLATFORM);
for (int i = y + 1; i < h; i++) {
model.setBlock(x, i, MarioLevelModel.PLATFORM_BACKGROUND);
}
y = model.getHeight();
} else {
model.setBlock(x, y, MarioLevelModel.PLATFORM);
for (int i = y + 1; i < h; i++) {
model.setBlock(x, i, MarioLevelModel.PLATFORM_BACKGROUND);
}
if (rand.nextDouble() < CHANCE_HILL_ENEMY) {
char t = MarioLevelModel.getEnemyCharacters(false)[this.rand.nextInt(MarioLevelModel.getEnemyCharacters(false).length)];
// turtle constraint
if (t == MarioLevelModel.GREEN_KOOPA || t == MarioLevelModel.RED_KOOPA) {
if (turtleCount < this.maxTurtles) {
turtleCount++;
} else {
t = MarioLevelModel.GOOMBA;
}
}
boolean winged = rand.nextDouble() < CHANCE_WINGED;
model.setBlock(x, y - 1, MarioLevelModel.getWingedEnemyVersion(t, winged));
}
}
}
x++;
}
// pipes
lastY = 0;
int lastlastY = 0;
x = 0;
int lastX = 0;
for (Integer h : ground) {
if (x > minX && rand.nextDouble() < CHANCE_PIPE) {
if (h == lastY && lastlastY <= lastY && x > (lastX + 1)) {
int height = PIPE_MIN_HEIGHT + (int) (Math.random() * PIPE_HEIGHT);
placePipe(model, x - 1, h, height);
lastX = x;
}
}
lastlastY = lastY;
lastY = h;
x++;
}
// place enemies
x = 0;
for (Integer h : ground) {
if (x > minX && rand.nextDouble() < CHANCE_ENEMY) {
char t = MarioLevelModel.getEnemyCharacters(false)[this.rand.nextInt(MarioLevelModel.getEnemyCharacters(false).length)];
// turtle constraint
if (t == MarioLevelModel.GREEN_KOOPA || t == MarioLevelModel.RED_KOOPA) {
if (turtleCount < this.maxTurtles) {
turtleCount++;
} else {
t = MarioLevelModel.GOOMBA;
}
}
boolean winged = rand.nextDouble() < CHANCE_WINGED;
char tile = model.getBlock(x, h - 1);
if (tile == MarioLevelModel.EMPTY) {
model.setBlock(x, h - 1, MarioLevelModel.getWingedEnemyVersion(t, winged));
}
}
x++;
}
// platforms
x = 0;
y = model.getHeight();
for (Integer h : ground) {
int max = 0;
// find the highest object
for (max = 0; max < h; max++) {
int tile = model.getBlock(x, max);
if (tile != 0) {
break;
}
}
if (y == model.getHeight()) {
if (x > minX && rand.nextDouble() < CHANCE_PLATFORM) {
y = max - PLATFORM_HEIGHT; // (int)(-5*rand.nextDouble()*(h - 0));
if (y >= 1 && h - max > 1) {
placeBlock(model, x, y);
} else {
y = model.getHeight();
}
}
} else {
// end if hitting a wall
if (y >= (max + 1)) {
y = model.getHeight();
} else if (rand.nextDouble() < CHANCE_END_PLATFORM) {
placeBlock(model, x, y);
y = model.getHeight();
} else {
placeBlock(model, x, y);
}
}
x++;
}
// coins
x = 0;
for (Integer h : ground) {
if (x > 5 && rand.nextDouble() < CHANCE_COIN) {
y = h - (int) (1 + Math.random() * COIN_HEIGHT);
char tile = model.getBlock(x, y);
if (tile == MarioLevelModel.EMPTY) {
model.setBlock(x, y, MarioLevelModel.COIN);
}
}
x++;
}
// place the exit
this.xExit = model.getWidth() - 5;
model.setBlock(this.xExit, this.yExit, MarioLevelModel.MARIO_EXIT);
return model.getMap();
}
public String getGeneratorName() {
return "BenWeberLevelGenerator";
}
}
| 35.537736
| 144
| 0.492965
|
1a8324674dbd90d710ceb37c539b91b46cee944e
| 13,304
|
/*
* 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.trino.plugin.bigquery;
import com.google.cloud.bigquery.DatasetId;
import com.google.cloud.bigquery.Field;
import com.google.cloud.bigquery.Schema;
import com.google.cloud.bigquery.Table;
import com.google.cloud.bigquery.TableDefinition;
import com.google.cloud.bigquery.TableId;
import com.google.cloud.bigquery.TableInfo;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Streams;
import io.airlift.log.Logger;
import io.trino.spi.connector.Assignment;
import io.trino.spi.connector.ColumnHandle;
import io.trino.spi.connector.ColumnMetadata;
import io.trino.spi.connector.ConnectorMetadata;
import io.trino.spi.connector.ConnectorSession;
import io.trino.spi.connector.ConnectorTableHandle;
import io.trino.spi.connector.ConnectorTableMetadata;
import io.trino.spi.connector.ConnectorTableProperties;
import io.trino.spi.connector.Constraint;
import io.trino.spi.connector.ConstraintApplicationResult;
import io.trino.spi.connector.LimitApplicationResult;
import io.trino.spi.connector.NotFoundException;
import io.trino.spi.connector.ProjectionApplicationResult;
import io.trino.spi.connector.SchemaTableName;
import io.trino.spi.connector.SchemaTablePrefix;
import io.trino.spi.connector.TableNotFoundException;
import io.trino.spi.expression.ConnectorExpression;
import io.trino.spi.predicate.TupleDomain;
import javax.inject.Inject;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static com.google.cloud.bigquery.TableDefinition.Type.TABLE;
import static com.google.cloud.bigquery.TableDefinition.Type.VIEW;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.util.Objects.requireNonNull;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toMap;
public class BigQueryMetadata
implements ConnectorMetadata
{
private static final Logger log = Logger.get(BigQueryMetadata.class);
static final int NUMERIC_DATA_TYPE_PRECISION = 38;
static final int NUMERIC_DATA_TYPE_SCALE = 9;
static final String INFORMATION_SCHEMA = "information_schema";
private final BigQueryClient bigQueryClient;
private final String projectId;
@Inject
public BigQueryMetadata(BigQueryClient bigQueryClient, BigQueryConfig config)
{
this.bigQueryClient = requireNonNull(bigQueryClient, "bigQueryClient is null");
this.projectId = requireNonNull(config, "config is null").getProjectId().orElse(bigQueryClient.getProjectId());
}
@Override
public List<String> listSchemaNames(ConnectorSession session)
{
log.debug("listSchemaNames(session=%s)", session);
return Streams.stream(bigQueryClient.listDatasets(projectId))
.map(dataset -> dataset.getDatasetId().getDataset())
.filter(schemaName -> !schemaName.equalsIgnoreCase(INFORMATION_SCHEMA))
.collect(toImmutableList());
}
@Override
public List<SchemaTableName> listTables(ConnectorSession session, Optional<String> schemaName)
{
log.debug("listTables(session=%s, schemaName=%s)", session, schemaName);
return listTablesWithTypes(session, schemaName, TABLE);
}
@Override
public List<SchemaTableName> listViews(ConnectorSession session, Optional<String> schemaName)
{
log.debug("listViews(session=%s, schemaName=%s)", session, schemaName);
return listTablesWithTypes(session, schemaName, VIEW);
}
private List<SchemaTableName> listTablesWithTypes(ConnectorSession session, Optional<String> schemaName, TableDefinition.Type... types)
{
if (schemaName.isPresent() && schemaName.get().equalsIgnoreCase(INFORMATION_SCHEMA)) {
return ImmutableList.of();
}
Set<String> schemaNames = schemaName.map(ImmutableSet::of)
.orElseGet(() -> ImmutableSet.copyOf(listSchemaNames(session)));
ImmutableList.Builder<SchemaTableName> tableNames = ImmutableList.builder();
for (String datasetId : schemaNames) {
for (Table table : bigQueryClient.listTables(DatasetId.of(projectId, datasetId), types)) {
tableNames.add(new SchemaTableName(datasetId, table.getTableId().getTable()));
}
}
return tableNames.build();
}
@Override
public ConnectorTableHandle getTableHandle(ConnectorSession session, SchemaTableName tableName)
{
log.debug("getTableHandle(session=%s, tableName=%s)", session, tableName);
TableInfo tableInfo = getBigQueryTable(tableName);
if (tableInfo == null) {
log.debug("Table [%s.%s] was not found", tableName.getSchemaName(), tableName.getTableName());
return null;
}
return BigQueryTableHandle.from(tableInfo);
}
// May return null
private TableInfo getBigQueryTable(SchemaTableName tableName)
{
return bigQueryClient.getTable(TableId.of(projectId, tableName.getSchemaName(), tableName.getTableName()));
}
public ConnectorTableMetadata getTableMetadata(ConnectorSession session, SchemaTableName schemaTableName)
{
ConnectorTableHandle table = getTableHandle(session, schemaTableName);
if (table == null) {
throw new TableNotFoundException(schemaTableName);
}
return getTableMetadata(session, table);
}
@Override
public ConnectorTableMetadata getTableMetadata(ConnectorSession session, ConnectorTableHandle tableHandle)
{
log.debug("getTableMetadata(session=%s, tableHandle=%s)", session, tableHandle);
TableInfo table = bigQueryClient.getTable(((BigQueryTableHandle) tableHandle).getTableId());
SchemaTableName schemaTableName = new SchemaTableName(table.getTableId().getDataset(), table.getTableId().getTable());
Schema schema = table.getDefinition().getSchema();
List<ColumnMetadata> columns = schema == null ?
ImmutableList.of() :
schema.getFields().stream()
.map(Conversions::toColumnMetadata)
.collect(toImmutableList());
return new ConnectorTableMetadata(schemaTableName, columns);
}
@Override
public Map<String, ColumnHandle> getColumnHandles(ConnectorSession session, ConnectorTableHandle tableHandle)
{
log.debug("getColumnHandles(session=%s, tableHandle=%s)", session, tableHandle);
List<BigQueryColumnHandle> columnHandles = getTableColumns(((BigQueryTableHandle) tableHandle).getTableId());
return columnHandles.stream().collect(toMap(BigQueryColumnHandle::getName, identity()));
}
List<BigQueryColumnHandle> getTableColumns(TableId tableId)
{
return getTableColumns(bigQueryClient.getTable(tableId));
}
private List<BigQueryColumnHandle> getTableColumns(TableInfo table)
{
ImmutableList.Builder<BigQueryColumnHandle> columns = ImmutableList.builder();
TableDefinition tableDefinition = table.getDefinition();
Schema schema = tableDefinition.getSchema();
if (schema != null) {
for (Field field : schema.getFields()) {
columns.add(Conversions.toColumnHandle(field));
}
}
return columns.build();
}
@Override
public ColumnMetadata getColumnMetadata(
ConnectorSession session,
ConnectorTableHandle tableHandle,
ColumnHandle columnHandle)
{
log.debug("getColumnMetadata(session=%s, tableHandle=%s, columnHandle=%s)", session, columnHandle, columnHandle);
return ((BigQueryColumnHandle) columnHandle).getColumnMetadata();
}
@Override
public Map<SchemaTableName, List<ColumnMetadata>> listTableColumns(ConnectorSession session, SchemaTablePrefix prefix)
{
log.debug("listTableColumns(session=%s, prefix=%s)", session, prefix);
requireNonNull(prefix, "prefix is null");
ImmutableMap.Builder<SchemaTableName, List<ColumnMetadata>> columns = ImmutableMap.builder();
for (SchemaTableName tableName : listTables(session, prefix)) {
try {
columns.put(tableName, getTableMetadata(session, tableName).getColumns());
}
catch (NotFoundException e) {
// table disappeared during listing operation
}
}
return columns.build();
}
private List<SchemaTableName> listTables(ConnectorSession session, SchemaTablePrefix prefix)
{
if (prefix.getTable().isEmpty()) {
return listTables(session, prefix.getSchema());
}
SchemaTableName tableName = prefix.toSchemaTableName();
TableInfo tableInfo = getBigQueryTable(tableName);
return tableInfo == null ?
ImmutableList.of() : // table does not exist
ImmutableList.of(tableName);
}
@Override
public boolean usesLegacyTableLayouts()
{
return false;
}
@Override
public ConnectorTableProperties getTableProperties(ConnectorSession session, ConnectorTableHandle table)
{
log.debug("getTableProperties(session=%s, prefix=%s)", session, table);
return new ConnectorTableProperties();
}
@Override
public Optional<LimitApplicationResult<ConnectorTableHandle>> applyLimit(
ConnectorSession session,
ConnectorTableHandle handle,
long limit)
{
log.debug("applyLimit(session=%s, handle=%s, limit=%s)", session, handle, limit);
BigQueryTableHandle bigQueryTableHandle = (BigQueryTableHandle) handle;
if (bigQueryTableHandle.getLimit().isPresent() && bigQueryTableHandle.getLimit().getAsLong() <= limit) {
return Optional.empty();
}
bigQueryTableHandle = bigQueryTableHandle.withLimit(limit);
return Optional.of(new LimitApplicationResult<>(bigQueryTableHandle, false));
}
@Override
public Optional<ProjectionApplicationResult<ConnectorTableHandle>> applyProjection(
ConnectorSession session,
ConnectorTableHandle handle,
List<ConnectorExpression> projections,
Map<String, ColumnHandle> assignments)
{
log.debug("applyProjection(session=%s, handle=%s, projections=%s, assignments=%s)",
session, handle, projections, assignments);
BigQueryTableHandle bigQueryTableHandle = (BigQueryTableHandle) handle;
List<ColumnHandle> newColumns = assignments.values().stream()
.collect(toImmutableList());
if (bigQueryTableHandle.getProjectedColumns().isPresent() && containSameElements(newColumns, bigQueryTableHandle.getProjectedColumns().get())) {
return Optional.empty();
}
ImmutableList.Builder<ColumnHandle> projectedColumns = ImmutableList.builder();
ImmutableList.Builder<Assignment> assignmentList = ImmutableList.builder();
assignments.forEach((name, column) -> {
projectedColumns.add(column);
assignmentList.add(new Assignment(name, column, ((BigQueryColumnHandle) column).getTrinoType()));
});
bigQueryTableHandle = bigQueryTableHandle.withProjectedColumns(projectedColumns.build());
return Optional.of(new ProjectionApplicationResult<>(bigQueryTableHandle, projections, assignmentList.build()));
}
@Override
public Optional<ConstraintApplicationResult<ConnectorTableHandle>> applyFilter(
ConnectorSession session,
ConnectorTableHandle handle,
Constraint constraint)
{
log.debug("applyFilter(session=%s, handle=%s, summary=%s, predicate=%s, columns=%s)",
session, handle, constraint.getSummary(), constraint.predicate(), constraint.getPredicateColumns());
BigQueryTableHandle bigQueryTableHandle = (BigQueryTableHandle) handle;
TupleDomain<ColumnHandle> oldDomain = bigQueryTableHandle.getConstraint();
TupleDomain<ColumnHandle> newDomain = oldDomain.intersect(constraint.getSummary());
if (oldDomain.equals(newDomain)) {
return Optional.empty();
}
BigQueryTableHandle updatedHandle = bigQueryTableHandle.withConstraint(newDomain);
return Optional.of(new ConstraintApplicationResult<>(updatedHandle, constraint.getSummary()));
}
private static boolean containSameElements(Iterable<? extends ColumnHandle> first, Iterable<? extends ColumnHandle> second)
{
return ImmutableSet.copyOf(first).equals(ImmutableSet.copyOf(second));
}
}
| 42.234921
| 152
| 0.70896
|
dc9608459fb519166c850ddbbb6ea43cb8a0de34
| 296
|
package pasha.grpc.wallet.practical.server.repo;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import pasha.grpc.wallet.practical.server.model.User;
@Repository
public interface UserRepository extends CrudRepository<User,Long> {
}
| 29.6
| 67
| 0.844595
|
eddf7eeb0b5d489a6bfae75adceebce66856b2a3
| 10,161
|
/*
* Cloudsmith API
* The API to the Cloudsmith Service
*
* OpenAPI spec version: v1
* Contact: support@cloudsmith.io
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package io.cloudsmith.api.models;
import java.util.Objects;
import com.google.gson.TypeAdapter;
import com.google.gson.annotations.JsonAdapter;
import com.google.gson.annotations.SerializedName;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.IOException;
import java.io.Serializable;
import javax.validation.constraints.*;
import javax.validation.Valid;
/**
* PackagesownerrepoFiles
*/
public class PackagesownerrepoFiles implements Serializable {
private static final long serialVersionUID = 1L;
@SerializedName("cdn_url")
private String cdnUrl = null;
@SerializedName("checksum_md5")
private String checksumMd5 = null;
@SerializedName("checksum_sha1")
private String checksumSha1 = null;
@SerializedName("checksum_sha256")
private String checksumSha256 = null;
@SerializedName("checksum_sha512")
private String checksumSha512 = null;
@SerializedName("downloads")
private Integer downloads = null;
@SerializedName("filename")
private String filename = null;
@SerializedName("is_downloadable")
private Boolean isDownloadable = null;
@SerializedName("is_primary")
private Boolean isPrimary = null;
@SerializedName("is_synchronised")
private Boolean isSynchronised = null;
@SerializedName("signature_url")
private String signatureUrl = null;
@SerializedName("size")
private Integer size = null;
@SerializedName("slug_perm")
private String slugPerm = null;
@SerializedName("tag")
private String tag = null;
public PackagesownerrepoFiles cdnUrl(String cdnUrl) {
this.cdnUrl = cdnUrl;
return this;
}
/**
*
* @return cdnUrl
**/
@ApiModelProperty(value = "")
public String getCdnUrl() {
return cdnUrl;
}
public void setCdnUrl(String cdnUrl) {
this.cdnUrl = cdnUrl;
}
public PackagesownerrepoFiles checksumMd5(String checksumMd5) {
this.checksumMd5 = checksumMd5;
return this;
}
/**
*
* @return checksumMd5
**/
@ApiModelProperty(value = "")
public String getChecksumMd5() {
return checksumMd5;
}
public void setChecksumMd5(String checksumMd5) {
this.checksumMd5 = checksumMd5;
}
public PackagesownerrepoFiles checksumSha1(String checksumSha1) {
this.checksumSha1 = checksumSha1;
return this;
}
/**
*
* @return checksumSha1
**/
@ApiModelProperty(value = "")
public String getChecksumSha1() {
return checksumSha1;
}
public void setChecksumSha1(String checksumSha1) {
this.checksumSha1 = checksumSha1;
}
public PackagesownerrepoFiles checksumSha256(String checksumSha256) {
this.checksumSha256 = checksumSha256;
return this;
}
/**
*
* @return checksumSha256
**/
@ApiModelProperty(value = "")
public String getChecksumSha256() {
return checksumSha256;
}
public void setChecksumSha256(String checksumSha256) {
this.checksumSha256 = checksumSha256;
}
public PackagesownerrepoFiles checksumSha512(String checksumSha512) {
this.checksumSha512 = checksumSha512;
return this;
}
/**
*
* @return checksumSha512
**/
@ApiModelProperty(value = "")
public String getChecksumSha512() {
return checksumSha512;
}
public void setChecksumSha512(String checksumSha512) {
this.checksumSha512 = checksumSha512;
}
public PackagesownerrepoFiles downloads(Integer downloads) {
this.downloads = downloads;
return this;
}
/**
*
* @return downloads
**/
@ApiModelProperty(value = "")
public Integer getDownloads() {
return downloads;
}
public void setDownloads(Integer downloads) {
this.downloads = downloads;
}
public PackagesownerrepoFiles filename(String filename) {
this.filename = filename;
return this;
}
/**
*
* @return filename
**/
@ApiModelProperty(value = "")
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public PackagesownerrepoFiles isDownloadable(Boolean isDownloadable) {
this.isDownloadable = isDownloadable;
return this;
}
/**
*
* @return isDownloadable
**/
@ApiModelProperty(value = "")
public Boolean getIsDownloadable() {
return isDownloadable;
}
public void setIsDownloadable(Boolean isDownloadable) {
this.isDownloadable = isDownloadable;
}
public PackagesownerrepoFiles isPrimary(Boolean isPrimary) {
this.isPrimary = isPrimary;
return this;
}
/**
*
* @return isPrimary
**/
@ApiModelProperty(value = "")
public Boolean getIsPrimary() {
return isPrimary;
}
public void setIsPrimary(Boolean isPrimary) {
this.isPrimary = isPrimary;
}
public PackagesownerrepoFiles isSynchronised(Boolean isSynchronised) {
this.isSynchronised = isSynchronised;
return this;
}
/**
*
* @return isSynchronised
**/
@ApiModelProperty(value = "")
public Boolean getIsSynchronised() {
return isSynchronised;
}
public void setIsSynchronised(Boolean isSynchronised) {
this.isSynchronised = isSynchronised;
}
public PackagesownerrepoFiles signatureUrl(String signatureUrl) {
this.signatureUrl = signatureUrl;
return this;
}
/**
*
* @return signatureUrl
**/
@ApiModelProperty(value = "")
public String getSignatureUrl() {
return signatureUrl;
}
public void setSignatureUrl(String signatureUrl) {
this.signatureUrl = signatureUrl;
}
public PackagesownerrepoFiles size(Integer size) {
this.size = size;
return this;
}
/**
* The calculated size of the file.
* @return size
**/
@ApiModelProperty(value = "The calculated size of the file.")
public Integer getSize() {
return size;
}
public void setSize(Integer size) {
this.size = size;
}
public PackagesownerrepoFiles slugPerm(String slugPerm) {
this.slugPerm = slugPerm;
return this;
}
/**
*
* @return slugPerm
**/
@ApiModelProperty(value = "")
public String getSlugPerm() {
return slugPerm;
}
public void setSlugPerm(String slugPerm) {
this.slugPerm = slugPerm;
}
public PackagesownerrepoFiles tag(String tag) {
this.tag = tag;
return this;
}
/**
* Freeform descriptor that describes what the file is.
* @return tag
**/
@ApiModelProperty(value = "Freeform descriptor that describes what the file is.")
public String getTag() {
return tag;
}
public void setTag(String tag) {
this.tag = tag;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PackagesownerrepoFiles packagesownerrepoFiles = (PackagesownerrepoFiles) o;
return Objects.equals(this.cdnUrl, packagesownerrepoFiles.cdnUrl) &&
Objects.equals(this.checksumMd5, packagesownerrepoFiles.checksumMd5) &&
Objects.equals(this.checksumSha1, packagesownerrepoFiles.checksumSha1) &&
Objects.equals(this.checksumSha256, packagesownerrepoFiles.checksumSha256) &&
Objects.equals(this.checksumSha512, packagesownerrepoFiles.checksumSha512) &&
Objects.equals(this.downloads, packagesownerrepoFiles.downloads) &&
Objects.equals(this.filename, packagesownerrepoFiles.filename) &&
Objects.equals(this.isDownloadable, packagesownerrepoFiles.isDownloadable) &&
Objects.equals(this.isPrimary, packagesownerrepoFiles.isPrimary) &&
Objects.equals(this.isSynchronised, packagesownerrepoFiles.isSynchronised) &&
Objects.equals(this.signatureUrl, packagesownerrepoFiles.signatureUrl) &&
Objects.equals(this.size, packagesownerrepoFiles.size) &&
Objects.equals(this.slugPerm, packagesownerrepoFiles.slugPerm) &&
Objects.equals(this.tag, packagesownerrepoFiles.tag);
}
@Override
public int hashCode() {
return Objects.hash(cdnUrl, checksumMd5, checksumSha1, checksumSha256, checksumSha512, downloads, filename, isDownloadable, isPrimary, isSynchronised, signatureUrl, size, slugPerm, tag);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PackagesownerrepoFiles {\n");
sb.append(" cdnUrl: ").append(toIndentedString(cdnUrl)).append("\n");
sb.append(" checksumMd5: ").append(toIndentedString(checksumMd5)).append("\n");
sb.append(" checksumSha1: ").append(toIndentedString(checksumSha1)).append("\n");
sb.append(" checksumSha256: ").append(toIndentedString(checksumSha256)).append("\n");
sb.append(" checksumSha512: ").append(toIndentedString(checksumSha512)).append("\n");
sb.append(" downloads: ").append(toIndentedString(downloads)).append("\n");
sb.append(" filename: ").append(toIndentedString(filename)).append("\n");
sb.append(" isDownloadable: ").append(toIndentedString(isDownloadable)).append("\n");
sb.append(" isPrimary: ").append(toIndentedString(isPrimary)).append("\n");
sb.append(" isSynchronised: ").append(toIndentedString(isSynchronised)).append("\n");
sb.append(" signatureUrl: ").append(toIndentedString(signatureUrl)).append("\n");
sb.append(" size: ").append(toIndentedString(size)).append("\n");
sb.append(" slugPerm: ").append(toIndentedString(slugPerm)).append("\n");
sb.append(" tag: ").append(toIndentedString(tag)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 25.530151
| 190
| 0.694026
|
8c9d4269a63c4785428250ff6c345fdf39a95157
| 12,948
|
package com.pinetree.mobile.activity;
import java.util.Calendar;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.view.View.OnLongClickListener;
import android.view.View.OnTouchListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.lidroid.xutils.DbUtils;
import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.db.sqlite.Selector;
import com.lidroid.xutils.exception.DbException;
import com.lidroid.xutils.view.ResType;
import com.lidroid.xutils.view.annotation.ContentView;
import com.lidroid.xutils.view.annotation.ResInject;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import com.pinetree.mobile.R;
import com.pinetree.mobile.bean.BI_IDInformation;
import com.pinetree.mobile.bean.BI_PersonalInformation;
import com.pinetree.mobile.bean.Customer;
import com.pinetree.mobile.utils.MyDatePickerDialog;
import com.pinetree.mobile.utils.SharedPreferencesUtil;
import com.pinetree.mobile.utils.Tools;
@ContentView(R.layout.activity_bi_persional_info)
public class BIPersonnalInfoActivity extends Activity implements MyBaseInterface,
OnLongClickListener{
@ViewInject(R.id.tv_Sex)
private TextView tv_Sex;
@ViewInject(R.id.tv_BirthDate)
private TextView tv_BirthDate;
@ViewInject(R.id.tv_PlaceofOrigin)
private TextView tv_PlaceofOrigin;
@ViewInject(R.id.tv_CensusRegisterAddress)
private TextView tv_CensusRegisterAddress;
@ViewInject(R.id.tv_LiveAddress)
private TextView tv_LiveAddress;
@ViewInject(R.id.tv_HomePhone)
private TextView tv_HomePhone;
@ViewInject(R.id.tv_Mobile)
private TextView tv_Mobile;
@ViewInject(R.id.tv_PostalCode)
private TextView tv_PostalCode;
@ViewInject(R.id.tv_EMail)
private TextView tv_EMail;
@ViewInject(R.id.tv_Nation)
private TextView tv_Nation;
@ViewInject(R.id.tv_ReligiousBelief)
private TextView tv_ReligiousBelief;
@ViewInject(R.id.tv_MaritalStatus)
private TextView tv_MaritalStatus;
@ViewInject(R.id.tv_CulturalDegree)
private TextView tv_CulturalDegree;
@ViewInject(R.id.tv_UsingLanguage)
private TextView tv_UsingLanguage;
@ViewInject(R.id.rg_Sex)
private RadioGroup rg_Sex;
@ViewInject(R.id.et_BirthDate)
private EditText et_BirthDate;
@ViewInject(R.id.et_PlaceofOrigin)
private EditText et_PlaceofOrigin;
@ViewInject(R.id.et_CensusRegisterAddress)
private EditText et_CensusRegisterAddress;
@ViewInject(R.id.et_LiveAddress)
private EditText et_LiveAddress;
@ViewInject(R.id.et_HomePhone)
private EditText et_HomePhone;
@ViewInject(R.id.et_Mobile)
private EditText et_Mobile;
@ViewInject(R.id.et_PostalCode)
private EditText et_PostalCode;
@ViewInject(R.id.et_EMail)
private EditText et_EMail;
@ViewInject(R.id.sp_Nation)
private Spinner sp_Nation;
@ViewInject(R.id.sp_ReligiousBelief)
private Spinner sp_ReligiousBelief;
@ViewInject(R.id.rg_MaritalStatus)
private RadioGroup rg_MaritalStatus;
@ViewInject(R.id.rg_CulturalDegree)
private RadioGroup rg_CulturalDegree;
@ViewInject(R.id.rg_UsingLanguage)
private RadioGroup rg_UsingLanguage;
@ResInject(id = R.array.array_xb, type = ResType.StringArray)
private String[] array_xb;
@ResInject(id = R.array.array_hyzk, type = ResType.StringArray)
private String[] array_hyzk;
@ResInject(id = R.array.array_whcd, type = ResType.StringArray)
private String[] array_whcd;
@ResInject(id = R.array.array_syyy, type = ResType.StringArray)
private String[] array_syyy;
@ResInject(id = R.array.array_mz, type = ResType.StringArray)
private String[] array_mz;
@ResInject(id = R.array.array_zjxy, type = ResType.StringArray)
private String[] array_zjxy;
private ArrayAdapter<?> adapter_mz, adapter_zjxy;
@ViewInject(R.id.bt_save)
Button btSave;
@ViewInject(R.id.bt_back)
Button btBack;
private Context mContext;
private String reportId = "";
private SharedPreferencesUtil sharedPreferencesUtil;
private Customer customer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
mContext = this;
sharedPreferencesUtil = new SharedPreferencesUtil(mContext);
customer = (Customer) getIntent().getExtras().getSerializable("customer");
ViewUtils.inject(this);
initView();
initData();
}
@Override
public void initView() {
reportId = sharedPreferencesUtil.get("reportId");
Tools.addRadioButtonH(mContext, array_xb, rg_Sex);
Tools.addRadioButtonV(mContext, array_hyzk, rg_MaritalStatus);
Tools.addRadioButtonV(mContext, array_whcd, rg_CulturalDegree);
Tools.addRadioButtonH(mContext, array_syyy, rg_UsingLanguage);
adapter_mz = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_item, array_mz);
adapter_mz.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp_Nation.setAdapter(adapter_mz);
sp_Nation.setSelection(0);
adapter_zjxy = new ArrayAdapter<String>(mContext, android.R.layout.simple_spinner_item, array_zjxy);
adapter_zjxy.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp_ReligiousBelief.setAdapter(adapter_zjxy);
et_BirthDate.setText(Tools.getCurrDate());
et_BirthDate.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
return false;
case MotionEvent.ACTION_UP:
switch (v.getId()) {
case R.id.et_BirthDate:
Calendar c = Calendar.getInstance();
new MyDatePickerDialog(mContext, et_BirthDate, c).showMyDatePickerDialog();
break;
default:
break;
}
return true;
}
return false;
}
});
tv_Sex.setOnLongClickListener(this);
tv_PlaceofOrigin.setOnLongClickListener(this);
tv_CensusRegisterAddress.setOnLongClickListener(this);
tv_LiveAddress.setOnLongClickListener(this);
tv_HomePhone.setOnLongClickListener(this);
tv_Mobile.setOnLongClickListener(this);
tv_PostalCode.setOnLongClickListener(this);
tv_EMail.setOnLongClickListener(this);
tv_Nation.setOnLongClickListener(this);
tv_ReligiousBelief.setOnLongClickListener(this);
tv_MaritalStatus.setOnLongClickListener(this);
tv_CulturalDegree.setOnLongClickListener(this);
tv_UsingLanguage.setOnLongClickListener(this);
}
@Override
public void initData() {
DbUtils dbUtils = DbUtils.create(mContext);
try {
BI_PersonalInformation bi = dbUtils.findFirst(Selector.from(BI_PersonalInformation.class).where("ReportId", "=", reportId));
if (bi != null && bi.getID() > 0) {
Log.v("TAG", "initData bi.getSex():" + bi.getSex());
rg_Sex.check(Integer.parseInt(bi.getSex()));
et_BirthDate.setText(bi.getBirthDate());
if (bi.getNation() != null&&!bi.getNation().equals(""))
sp_Nation.setSelection(Integer.parseInt(bi.getNation()), true);
if (bi.getReligiousBelief() != null&&!bi.getReligiousBelief().equals(""))
sp_ReligiousBelief.setSelection(Integer.parseInt(bi.getReligiousBelief()), true);
if (bi.getMaritalStatus() != null&&!bi.getMaritalStatus().equals(""))
rg_MaritalStatus.check(Integer.parseInt(bi.getMaritalStatus()));
if (bi.getCulturalDegree() != null&&!bi.getCulturalDegree().equals(""))
rg_CulturalDegree.check(Integer.parseInt(bi.getCulturalDegree()));
et_PlaceofOrigin.setText(bi.getPlaceofOrigin());
if (bi.getUsingLanguage() != null&&!bi.getUsingLanguage().equals(""))
rg_UsingLanguage.check(Integer.parseInt(bi.getUsingLanguage()));
et_CensusRegisterAddress.setText(bi.getCensusRegisterAddress());
et_LiveAddress.setText(bi.getLiveAddress());
et_HomePhone.setText(bi.getHomePhone());
et_Mobile.setText(bi.getMobile());
et_PostalCode.setText(bi.getPostalCode());
et_EMail.setText(bi.getEMail());
}
BI_IDInformation bi0 = dbUtils.findFirst(Selector.from(BI_IDInformation.class).where("ReportId", "=", reportId));
if (bi0 != null && bi0.getIDNumber() != null && !bi0.getIDNumber().equals("")) {
String birthday = Tools.getBirthdayFromIDNumber(bi0.getIDNumber());
if (!birthday.equals("")) {
et_BirthDate.setText(birthday);
}
}
} catch (DbException e) {
e.printStackTrace();
}
dbUtils.close();
}
@OnClick({ R.id.bt_save, R.id.bt_back })
public void clickMethod(View v) {
switch (v.getId()) {
case R.id.bt_back:
finish();
break;
case R.id.bt_save:
// if (isMatch()) {
DbUtils dbUtils = DbUtils.create(this);
BI_PersonalInformation bi = null;
bi = new BI_PersonalInformation();
bi.setID(Integer.parseInt(reportId));
bi.setReportId(reportId);
bi.setSex(rg_Sex.getCheckedRadioButtonId() + "");
Log.v("TAG", "bt_save rg_Sex.getCheckedRadioButtonId() + :" + rg_Sex.getCheckedRadioButtonId() + "");
bi.setBirthDate(et_BirthDate.getText().toString());
bi.setNation(sp_Nation.getSelectedItemPosition() + "");
bi.setReligiousBelief(sp_ReligiousBelief.getSelectedItemPosition() + "");
bi.setMaritalStatus(rg_MaritalStatus.getCheckedRadioButtonId() + "");
bi.setCulturalDegree(rg_CulturalDegree.getCheckedRadioButtonId() + "");
bi.setPlaceofOrigin(et_PlaceofOrigin.getText().toString());
bi.setUsingLanguage(rg_UsingLanguage.getCheckedRadioButtonId() + "");
bi.setCensusRegisterAddress(et_CensusRegisterAddress.getText().toString());
bi.setLiveAddress(et_LiveAddress.getText().toString());
bi.setHomePhone(et_HomePhone.getText().toString());
bi.setMobile(et_Mobile.getText().toString());
bi.setPostalCode(et_PostalCode.getText().toString());
bi.setEMail(et_EMail.getText().toString());
bi.setWhetherNew("0");
try {
if (dbUtils.findFirst(Selector.from(BI_PersonalInformation.class).where("ReportId", "=", reportId)) != null) {
bi = dbUtils.findFirst(Selector.from(BI_PersonalInformation.class).where("ReportId", "=", reportId));
bi.setSex(rg_Sex.getCheckedRadioButtonId() + "");
bi.setBirthDate(et_BirthDate.getText().toString());
bi.setNation(sp_Nation.getSelectedItemPosition() + "");
bi.setReligiousBelief(sp_ReligiousBelief.getSelectedItemPosition() + "");
bi.setMaritalStatus(rg_MaritalStatus.getCheckedRadioButtonId() + "");
bi.setCulturalDegree(rg_CulturalDegree.getCheckedRadioButtonId() + "");
bi.setPlaceofOrigin(et_PlaceofOrigin.getText().toString());
bi.setUsingLanguage(rg_UsingLanguage.getCheckedRadioButtonId() + "");
bi.setCensusRegisterAddress(et_CensusRegisterAddress.getText().toString());
bi.setLiveAddress(et_LiveAddress.getText().toString());
bi.setHomePhone(et_HomePhone.getText().toString());
bi.setMobile(et_Mobile.getText().toString());
bi.setPostalCode(et_PostalCode.getText().toString());
bi.setEMail(et_EMail.getText().toString());
dbUtils.update(bi);
Toast.makeText(this, getResources().getString(R.string.success_update), Toast.LENGTH_SHORT).show();
} else {
dbUtils.save(bi);
Toast.makeText(this, getResources().getString(R.string.success_save), Toast.LENGTH_SHORT).show();
}
} catch (DbException e) {
e.printStackTrace();
}
dbUtils.close();
// }
break;
default:
break;
}
}
private boolean isMatch() {
if (!"".equals(et_HomePhone.getText().toString().trim())){
return true;
} else {
Tools.showToast(mContext, getResources().getString(R.string.str_homephoto_noempty));
}
return false;
}
@Override
public boolean onLongClick(View v) {
Intent intent = new Intent(mContext, NoteActivity.class);
switch (v.getId()) {
case R.id.tv_Sex:
intent.putExtra("guid", "bi_xb");
break;
case R.id.tv_PlaceofOrigin:
intent.putExtra("guid", "bi_jg");
break;
case R.id.tv_CensusRegisterAddress:
intent.putExtra("guid", "bi_hjdz");
break;
case R.id.tv_LiveAddress:
intent.putExtra("guid", "bi_jzdz");
break;
case R.id.tv_HomePhone:
intent.putExtra("guid", "bi_zzdh");
break;
case R.id.tv_Mobile:
intent.putExtra("guid", "bi_zzdh");
break;
case R.id.tv_PostalCode:
intent.putExtra("guid", "bi_yzbm");
break;
case R.id.tv_EMail:
intent.putExtra("guid", "bi_dzyx");
break;
case R.id.tv_Nation:
intent.putExtra("guid", "bi_mz");
break;
case R.id.tv_ReligiousBelief:
intent.putExtra("guid", "bi_zjxy");
break;
case R.id.tv_MaritalStatus:
intent.putExtra("guid", "bi_hyzk");
break;
case R.id.tv_CulturalDegree:
intent.putExtra("guid", "bi_whcd");
break;
case R.id.tv_UsingLanguage:
intent.putExtra("guid", "bi_syyy");
break;
default:
break;
}
startActivity(intent);
return true;
}
}
| 36.370787
| 127
| 0.748224
|
02ed3ac25f396b22121e2661e953d0fe64899654
| 2,676
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mx.edu.ipn.cecyt9.thinkersjar.model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
/**
*
* @author Alumno
*/
@Entity
@Table(name = "rol")
@NamedQueries({
@NamedQuery(name = "Rol.findAll", query = "SELECT r FROM Rol r")})
public class Rol implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "idrol")
private Integer idrol;
@Size(max = 45)
@Column(name = "descripcion")
private String descripcion;
@JoinColumn(name = "idregistro", referencedColumnName = "idregistro")
@ManyToOne
private Registro registro;
public Rol() {
}
public Rol(Integer idrol) {
this.idrol = idrol;
}
public Integer getIdrol() {
return idrol;
}
public void setIdrol(Integer idrol) {
this.idrol = idrol;
}
public String getDescripcion() {
return descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public Registro getRegistro() {
return registro;
}
public void setRegistro(Registro registro) {
this.registro = registro;
}
@Override
public int hashCode() {
int hash = 0;
hash += (idrol != null ? idrol.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Rol)) {
return false;
}
Rol other = (Rol) object;
if ((this.idrol == null && other.idrol != null) || (this.idrol != null && !this.idrol.equals(other.idrol))) {
return false;
}
return true;
}
@Override
public String toString() {
return "mx.edu.ipn.cecyt9.thinkersjar.model.Rol[ idrol=" + idrol + " ]";
}
}
| 26.235294
| 118
| 0.626308
|
9edd47473a75564334c217b240002612d31e6219
| 498
|
package net.floodlightcontroller.debugcounter;
import org.restlet.resource.ResourceException;
import org.restlet.resource.ServerResource;
public class DebugCounterResourceBase extends ServerResource {
protected IDebugCounterService debugCounter;
@Override
protected void doInit() throws ResourceException {
super.doInit();
debugCounter = (IDebugCounterService)getContext().getAttributes().
get(IDebugCounterService.class.getCanonicalName());
}
}
| 29.294118
| 74
| 0.759036
|
63231d8840d833ad2aa0bb0fb2ef73fb4bd66b6a
| 4,297
|
package cn.mirrorming.blog.domain.po;
import cn.mirrorming.blog.domain.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
@ApiModel(value = "cn-mirrorming-blog-domain-po-Users")
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "users")
public class Users extends BaseEntity implements Serializable {
public static final String COL_IS_ADMIN = "is_admin";
/**
* 用户ID
*/
@TableId(value = "id", type = IdType.AUTO)
@ApiModelProperty(value = "用户ID")
private Integer id;
/**
* 用户邮箱
*/
@TableField(value = "email")
@ApiModelProperty(value = "用户邮箱")
private String email;
/**
* 用户密码
*/
@TableField(value = "password")
@ApiModelProperty(value = "用户密码")
private String password;
/**
* 用户名
*/
@TableField(value = "name")
@ApiModelProperty(value = "用户名")
private String name;
/**
* 用户手机号码
*/
@TableField(value = "phone")
@ApiModelProperty(value = "用户手机号码")
private String phone;
/**
* 用户性别
*/
@TableField(value = "sex")
@ApiModelProperty(value = "用户性别")
private Boolean sex;
/**
* 用户QQ号码
*/
@TableField(value = "qq")
@ApiModelProperty(value = "用户QQ号码")
private String qq;
/**
* 用户地址
*/
@TableField(value = "address")
@ApiModelProperty(value = "用户地址")
private String address;
/**
* 用户积分
*/
@TableField(value = "score")
@ApiModelProperty(value = "用户积分")
private Integer score;
/**
* 用户生日
*/
@TableField(value = "birthday")
@ApiModelProperty(value = "用户生日")
private Date birthday;
/**
* 自我描述
*/
@TableField(value = "description")
@ApiModelProperty(value = "自我描述")
private String description;
/**
* 头像存储路径
*/
@TableField(value = "avatar")
@ApiModelProperty(value = "头像存储路径")
private String avatar;
/**
* 创建时间
*/
@TableField(value = "register_time")
@ApiModelProperty(value = "创建时间")
private Date registerTime;
/**
* 更新时间
*/
@TableField(value = "last_update_time")
@ApiModelProperty(value = "更新时间")
private Date lastUpdateTime;
/**
* 注册时IP地址
*/
@TableField(value = "register_ip")
@ApiModelProperty(value = "注册时IP地址")
private String registerIp;
/**
* 用户微博
*/
@TableField(value = "weibo")
@ApiModelProperty(value = "用户微博")
private String weibo;
/**
* 是否冻结,1为冻结,0为不冻结
*/
@TableField(value = "is_freeze")
@ApiModelProperty(value = "是否冻结,1为冻结,0为不冻结")
private Boolean isFreeze;
private static final long serialVersionUID = 1L;
public static final String COL_ID = "id";
public static final String COL_EMAIL = "email";
public static final String COL_PASSWORD = "password";
public static final String COL_NAME = "name";
public static final String COL_PHONE = "phone";
public static final String COL_SEX = "sex";
public static final String COL_QQ = "qq";
public static final String COL_ADDRESS = "address";
public static final String COL_SCORE = "score";
public static final String COL_BIRTHDAY = "birthday";
public static final String COL_DESCRIPTION = "description";
public static final String COL_AVATAR = "avatar";
public static final String COL_REGISTER_TIME = "register_time";
public static final String COL_LAST_UPDATE_TIME = "last_update_time";
public static final String COL_REGISTER_IP = "register_ip";
public static final String COL_WEIBO = "weibo";
public static final String COL_IS_FREEZE = "is_freeze";
public static final String COL_CREATE_TIME = "create_time";
public static final String COL_UPDATE_TIME = "update_time";
}
| 23.227027
| 73
| 0.655574
|
f6936c2d6dd8007428d88c2429d3f162ec9359f9
| 1,284
|
package com.arkaces.ark_bitcoin_channel_service.transfer;
import com.arkaces.ark_bitcoin_channel_service.contract.ContractEntity;
import lombok.Data;
import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@Entity
@Table(name = "transfers")
public class TransferEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long pid;
private String id;
private LocalDateTime createdAt;
private String status;
private String arkTransactionId;
@Column(precision = 20, scale = 8)
private BigDecimal arkAmount;
@Column(precision = 20, scale = 8)
private BigDecimal arkToBtcRate;
@Column(precision = 20, scale = 8)
private BigDecimal arkFlatFee;
@Column(precision = 20, scale = 8)
private BigDecimal arkPercentFee;
@Column(precision = 20, scale = 8)
private BigDecimal arkTotalFee;
@Column(precision = 20, scale = 8)
private BigDecimal btcSendAmount;
private String btcTransactionId;
private Boolean needsBtcConfirmation;
private String btcConfirmationSubscriptionId;
private Boolean needsArkReturn;
private String returnArkTransactionId;
@ManyToOne(cascade = CascadeType.ALL)
private ContractEntity contractEntity;
}
| 23.345455
| 71
| 0.741433
|
02047f5569bcbf9b22f502d666751fc9fd45c71c
| 5,905
|
package yacx;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
class TestDoubleArg extends TestJNI {
static Kernel cpDoubleArray, cpDoubleSingle;
static int n;
static double[] testArray0, testArray1;
DoubleArg inArg, outArg;
@BeforeAll
static void init() {
// test-data
n = 17;
testArray0 = new double[n];
testArray1 = new double[n];
for (int i = 0; i < n; i++) {
testArray0[i] = 1.1d * i;
testArray1[i] = 13.3d + (n - i) * 0.999d;
}
// Kernel for copy double* in to double* out
String copyDoubleArrayString = "extern \"C\" __global__\n"
+ "void copyDouble(double* in, double* out) {\n"
+ " int i = (blockIdx.x * blockDim.x) + threadIdx.x;\n"
+ " out[i] = in[i];\n"
+ "}\n"
+ "";
cpDoubleArray = Program.create(copyDoubleArrayString, "copyDouble").compile();
// Configure with kernel n Threads
cpDoubleArray.configure(n, 1);
// Kernel for copy a double-value
String copyDoubleString = "extern \"C\" __global__\n"
+ "void copyDouble(double in, double* out) {\n"
+ " *out = in;\n"
+ "}\n"
+ "";
cpDoubleSingle = Program.create(copyDoubleString, "copyDouble").compile();
// Configure Kernel with 1 thread
cpDoubleSingle.configure(1, 1);
}
/**
* Check if testArray is expected testArray0
*
* @param testArray the array to be tested
*/
void checkTestArray0(double[] testArray) {
assertEquals(n, testArray.length);
for (int i = 0; i < n; i++) {
assertEquals(1.1d * i, testArray[i]);
}
}
/**
* Check if testArray is expected testArray1
*
* @param testArray the array to be tested
*/
void checkTestArray1(double[] testArray) {
assertEquals(n, testArray.length);
for (int i = 0; i < n; i++) {
assertEquals(13.3d + (n - i) * 0.999d, testArray[i]);
}
}
@Test
void testInvalidParameter() {
// Check if parameter is null
assertThrows(NullPointerException.class, () -> {
DoubleArg.create((double[]) null);
});
// Check without any parameters
assertThrows(IllegalArgumentException.class, () -> {
DoubleArg.create();
});
assertThrows(IllegalArgumentException.class, () -> {
DoubleArg.create(new double[0]);
});
// Check create output-array with invalid size
assertThrows(IllegalArgumentException.class, () -> {
DoubleArg.createOutput(0);
});
assertThrows(IllegalArgumentException.class, () -> {
DoubleArg.createOutput(-1);
});
assertThrows(IllegalArgumentException.class, () -> {
DoubleArg.createOutput(Integer.MIN_VALUE);
});
}
@Test
void testDoubleSingle() {
KernelArg inArg;
// Create KernelArgs
inArg = DoubleArg.createValue(4.9d);
outArg = DoubleArg.createOutput(1);
cpDoubleSingle.launch(inArg, outArg);
// Check result
assertEquals(1, outArg.asDoubleArray().length);
assertEquals(4.9d, outArg.asDoubleArray()[0]);
// Create KernelArgs
inArg = DoubleArg.createValue(-128.1d);
cpDoubleSingle.launch(inArg, outArg);
// Check result
assertEquals(1, outArg.asDoubleArray().length);
assertEquals(-128.1d, outArg.asDoubleArray()[0]);
}
@Test
void testDoubleArray() {
// Check test-Arrays should be correct
checkTestArray0(testArray0);
checkTestArray1(testArray1);
// Create KernelArgs (download both)
inArg = DoubleArg.create(testArray0, true);
outArg = DoubleArg.create(testArray1, true);
cpDoubleArray.launch(inArg, outArg);
// Check Result
checkTestArray0(inArg.asDoubleArray());
checkTestArray0(outArg.asDoubleArray());
// Other Array should be unchanged
checkTestArray0(testArray0);
checkTestArray1(testArray1);
// Create KernelArgs (download only inArg)
inArg = DoubleArg.create(testArray0, true);
outArg = DoubleArg.create(testArray1, false);
cpDoubleArray.launch(inArg, outArg);
// Check Result
checkTestArray0(inArg.asDoubleArray());
checkTestArray1(outArg.asDoubleArray());
// Other Array should be unchanged
checkTestArray0(testArray0);
checkTestArray1(testArray1);
// Create KernelArgs (download only outArg)
inArg = DoubleArg.create(testArray0, false);
outArg = DoubleArg.create(testArray1, true);
cpDoubleArray.launch(inArg, outArg);
// Check Result
checkTestArray0(inArg.asDoubleArray());
checkTestArray0(outArg.asDoubleArray());
// Other Array should be unchanged
checkTestArray0(testArray0);
checkTestArray1(testArray1);
// Create KernelArgs (download nothing)
inArg = DoubleArg.create(testArray0, false);
outArg = DoubleArg.create(testArray1, false);
cpDoubleArray.launch(inArg, outArg);
// Check Result
checkTestArray0(inArg.asDoubleArray());
checkTestArray1(outArg.asDoubleArray());
// Other Array should be unchanged
checkTestArray0(testArray0);
checkTestArray1(testArray1);
}
@Test
void testDoubleOutput() {
// Check test-Arrays should be correct
checkTestArray0(testArray0);
checkTestArray1(testArray1);
// Create KernelArgs
inArg = DoubleArg.create(testArray0);
outArg = DoubleArg.createOutput(n);
cpDoubleArray.launch(inArg, outArg);
// Check Result
checkTestArray0(inArg.asDoubleArray());
checkTestArray0(outArg.asDoubleArray());
// Other Array should be unchanged
checkTestArray0(testArray0);
checkTestArray1(testArray1);
// Create KernelArgs
inArg = DoubleArg.create(testArray1);
outArg = DoubleArg.createOutput(n);
cpDoubleArray.launch(inArg, outArg);
// Check Result
checkTestArray1(inArg.asDoubleArray());
checkTestArray1(outArg.asDoubleArray());
// Other Array should be unchanged
checkTestArray0(testArray0);
checkTestArray1(testArray1);
// Use the same KernelArgs again
cpDoubleArray.launch(inArg, outArg);
// Check Result
checkTestArray1(inArg.asDoubleArray());
checkTestArray1(outArg.asDoubleArray());
// Other Array should be unchanged
checkTestArray0(testArray0);
checkTestArray1(testArray1);
}
}
| 25.452586
| 80
| 0.704149
|
119be98fb2951f09667d2db7b21e9a8e12898eb2
| 191
|
package com.simplegame.server.stage.configure.constants;
public enum DropTriggerType {
NORMAL,
INGNORELEVEL,
TASK;
private DropTriggerType() {
}
}
| 12.733333
| 56
| 0.617801
|
270f2e83aa07ea08f722d3746744c4de4b21a469
| 6,825
|
package cn.keking.service.cache.impl;
import cn.keking.config.ConfigConstants;
import cn.keking.service.cache.CacheService;
import lombok.extern.slf4j.Slf4j;
import org.redisson.Redisson;
import org.redisson.api.RBlockingQueue;
import org.redisson.api.RLock;
import org.redisson.api.RMapCache;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @auther: chenjh
* @time: 2019/4/2 18:02
* @description
*/
@Slf4j
@ConditionalOnExpression("'${cache.type:default}'.equals('redis')")
@Service
public class CacheServiceRedisImpl implements CacheService {
private final RedissonClient redissonClient;
public CacheServiceRedisImpl(Config config) {
this.redissonClient = Redisson.create(config);
}
@Override
public void initPDFCachePool(Integer capacity) {
}
@Override
public void initIMGCachePool(Integer capacity) {
}
@Override
public void initPdfImagesCachePool(Integer capacity) {
}
@Override
public void putConvertedCache(String key, String value) {
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_FILE_KEY);
convertedList.fastPut(key, value);
}
@Override
public void putImgCache(String key, List<String> value) {
RMapCache<String, List<String>> convertedList = redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
convertedList.fastPut(key, value);
}
@Override
public Map<String, String> getConvertedCache() {
return redissonClient.getMapCache(FILE_PREVIEW_FILE_KEY);
}
@Override
public String getConvertedCache(String key) {
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_FILE_KEY);
return convertedList.get(key);
}
@Override
public Map<String, List<String>> getImgCache() {
return redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
}
@Override
public List<String> getImgCache(String key) {
RMapCache<String, List<String>> convertedList = redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
return convertedList.get(key);
}
@Override
public Integer getPdfImageCache(String key) {
RMapCache<String, Integer> convertedList = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
return convertedList.get(key);
}
@Override
public void putPdfImageCache(String pdfFilePath, int num) {
RMapCache<String, Integer> convertedList = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
convertedList.fastPut(pdfFilePath, num);
}
@Override
public void cleanCache() {
cleanPdfCache();
cleanImgCache();
cleanPdfImgCache();
cleanTempFileCache();
cleanConvertingFileCache();
}
@Override
public void addQueueTask(String url) {
RBlockingQueue<String> queue = redissonClient.getBlockingQueue(TASK_QUEUE_NAME);
queue.addAsync(url);
}
@Override
public String takeQueueTask() throws InterruptedException {
RBlockingQueue<String> queue = redissonClient.getBlockingQueue(TASK_QUEUE_NAME);
return queue.take();
}
private void cleanPdfCache() {
RMapCache<String, String> pdfCache = redissonClient.getMapCache(FILE_PREVIEW_FILE_KEY);
pdfCache.clear();
}
private void cleanImgCache() {
RMapCache<String, List<String>> imgCache = redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
imgCache.clear();
}
private void cleanPdfImgCache() {
RMapCache<String, Integer> pdfImg = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
pdfImg.clear();
}
private void cleanTempFileCache() {
RMapCache<String, Map<String, String>> tempFileCache = redissonClient.getMapCache(FILE_PREVIEW_TEMP_FILE_KEY);
tempFileCache.clear();
}
@Override
public void putTempFileCache(String key, Map<String, String> value) {
RMapCache<String, Map<String, String>> tempFileCache = redissonClient.getMapCache(FILE_PREVIEW_TEMP_FILE_KEY);
tempFileCache.fastPut(key, value);
}
@Override
public Map<String, String> getTempFileCache(String key) {
RMapCache<String, Map<String, String>> tempFileCache = redissonClient.getMapCache(FILE_PREVIEW_TEMP_FILE_KEY);
return tempFileCache.get(key);
}
@Override
public void initTempFileCache(Integer capacity) {
//nothing
}
@Override
public boolean putConvertingFileCache(String key, Integer value) {
RMapCache<String, Integer> convertingFileCache = redissonClient.getMapCache(FILE_PREVIEW_CONVERTING_FILE);
RLock lock = redissonClient.getLock("lock");
lock.lock();
try {
//当前值已经被设置
if (convertingFileCache.get(key)!=null){
return false;
}
convertingFileCache.fastPut(key, value);
} catch (Exception e) {
log.error(e.getMessage(), e);
} finally {
lock.unlock();
}
return true;
}
@Override
public void removeConvertingFileCache(String key) {
RMapCache<String, Integer> convertingFileCache = redissonClient.getMapCache(FILE_PREVIEW_CONVERTING_FILE);
convertingFileCache.remove(key);
}
@Override
public Integer getConvertingFileCache(String key) {
RMapCache<String, Integer> convertingFileCache = redissonClient.getMapCache(FILE_PREVIEW_CONVERTING_FILE);
return convertingFileCache.get(key);
}
@Override
public void cleanConvertingFileCache() {
RMapCache<String, Integer> convertingFileCache = redissonClient.getMapCache(FILE_PREVIEW_CONVERTING_FILE);
convertingFileCache.clear();
}
@Override
public void cleanConvertedCache(String key) {
RMapCache<String, Map<String, String>> fileCache = redissonClient.getMapCache(FILE_PREVIEW_FILE_KEY);
RMapCache<String, Map<String, String>> pdfImgCache = redissonClient.getMapCache(FILE_PREVIEW_PDF_IMGS_KEY);
RMapCache<String, Map<String, String>> imgCache = redissonClient.getMapCache(FILE_PREVIEW_IMGS_KEY);
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_FILE_KEY);
String tempName = convertedList.get(key);
log.debug("tempName:{}", tempName);
log.debug("删除pdfImgCache,key={} 返回值={}", key, pdfImgCache.remove(ConfigConstants.getFileDir() + tempName));
log.debug("删除压缩包内的imgCache,key={} 返回值={}", key, imgCache.remove(key));
log.debug("删除fileCache,key={} 返回值={}", key, fileCache.remove(key));
}
}
| 34.125
| 118
| 0.702857
|
0db85a7b43c193df493c1dc7d63c93398d51b71c
| 6,507
|
package com.raj.allthingspalette;
import androidx.appcompat.app.AppCompatActivity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.palette.graphics.Palette;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
LinearLayout rootLayout;
TextView tvTitle;
TextView tvBody;
ImageView ivTestImage;
Button btnNextSwatchButton;
Button btnNextImageButton;
//There are six types of swatches (color palette thingy) in total
Palette.Swatch vibrantSwatch;
Palette.Swatch lightVibrantSwatch;
Palette.Swatch darkVibrantSwatch;
Palette.Swatch mutedSwatch;
Palette.Swatch lightMutedSwatch;
Palette.Swatch darkMutedSwatch;
int imageNum;
int swatchNum;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rootLayout = findViewById(R.id.LL_root_layout);
tvTitle = findViewById(R.id.TV_title);
tvBody = findViewById(R.id.TV_body);
ivTestImage = findViewById(R.id.IV_test_image);
btnNextSwatchButton = findViewById(R.id.BTN_next_swatch_button);
btnNextImageButton = findViewById(R.id.BTN_next_image_button);
btnNextSwatchButton.setOnClickListener(this);
btnNextImageButton.setOnClickListener(this);
/*get drawable from the image displayed in the image view and then cast it to BitmapDrawable to convert it to
BitmapDrawable and then get the bimap out of that BitmapDrawable */
Bitmap bitmap = ((BitmapDrawable) ivTestImage.getDrawable()).getBitmap();
//A palette can be generated asynchronously or synchronously
//Asynchronous generation: Palette is generated via an async task by android
//Synchronous generation: Palette is generated in an image loading thread specified by us (we have to have coded another thread for this?
//Why palette is not generated in UI thread? Palette generation can take time and we don't want to hog and block the UI thread!
//Here we will do it asynchronously
//Max count value:
//higher the max color count... the higher the chance u will find a color for each and every swatch and vice versa
//higher the max color count... longer the time the palette will take to be generated and vice versa
//default max color count val is 16
//recommended max count value:
//>use something betw 8 and 16 for landscape images
//>higher value... something between 24 to 32 for images of faces
Palette.from(bitmap).maximumColorCount(32).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
vibrantSwatch = palette.getVibrantSwatch();
lightVibrantSwatch = palette.getLightVibrantSwatch();
darkVibrantSwatch = palette.getDarkVibrantSwatch();
mutedSwatch = palette.getMutedSwatch();
lightMutedSwatch = palette.getLightMutedSwatch();
darkMutedSwatch = palette.getDarkMutedSwatch();
}
});
}
public void nextSwatch(View v) {
Palette.Swatch currentSwatch = null;
switch(swatchNum) {
case 0:
currentSwatch = vibrantSwatch;
tvTitle.setText("Vibrant");
break;
case 1:
currentSwatch = lightVibrantSwatch;
tvTitle.setText("Light Vibrant");
break;
case 2:
currentSwatch = darkVibrantSwatch;
tvTitle.setText("Dark Vibrant");
break;
case 3:
currentSwatch = mutedSwatch;
tvTitle.setText("Muted");
break;
case 4:
currentSwatch = lightMutedSwatch;
tvTitle.setText("Light Muted");
break;
case 5:
currentSwatch = darkVibrantSwatch;
tvTitle.setText("Dark Muted");
break;
}
if(currentSwatch != null) {
rootLayout.setBackgroundColor(currentSwatch.getRgb());
tvTitle.setTextColor(currentSwatch.getTitleTextColor());
tvBody.setTextColor(currentSwatch.getBodyTextColor());
//Title text color is just a lighter version of the body text color cuz we dont need such an opaque color for the title cuz
//the title font is definitely bigger than the body font
}
else {
rootLayout.setBackgroundColor(Color.BLACK);
tvTitle.setTextColor(Color.WHITE);
tvBody.setTextColor(Color.WHITE);
Toast.makeText(getBaseContext(), "Unable to obtain color palette for current swatch", Toast.LENGTH_SHORT).show();
}
if(swatchNum <5) {
swatchNum++;
} else {
swatchNum = 0;
}
}
@Override
public void onClick(View view) {
switch(view.getId()) {
case R.id.BTN_next_swatch_button:
nextSwatch(view);
break;
case R.id.BTN_next_image_button:
if(imageNum < 4) {
imageNum++;
switch(imageNum) {
case 0:
ivTestImage.setImageDrawable(getResources().getDrawable(R.drawable.pic1));
break;
case 1:
ivTestImage.setImageDrawable(getResources().getDrawable(R.drawable.pic2));
break;
case 2:
ivTestImage.setImageDrawable(getResources().getDrawable(R.drawable.pic3));
break;
case 3:
ivTestImage.setImageDrawable(getResources().getDrawable(R.drawable.pic4));
}
} else {
imageNum = 0;
ivTestImage.setImageDrawable(getResources().getDrawable(R.drawable.pic1));
}
}
}
}
| 38.502959
| 145
| 0.611342
|
80c68c0feb834f45b9d8fef44eb7f42421818592
| 1,509
|
package org.mozartoz.truffle.nodes.literal;
import org.mozartoz.truffle.nodes.OzNode;
import org.mozartoz.truffle.nodes.OzRootNode;
import org.mozartoz.truffle.nodes.local.CopyVariableToFrameNode;
import org.mozartoz.truffle.runtime.ArrayUtils;
import org.mozartoz.truffle.runtime.OzProc;
import com.oracle.truffle.api.RootCallTarget;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.MaterializedFrame;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;
public class ProcDeclarationAndExtractionNode extends OzNode {
private final RootCallTarget callTarget;
private final FrameDescriptor capturedDescriptor;
@Children final CopyVariableToFrameNode[] captureNodes;
private final int arity;
public ProcDeclarationAndExtractionNode(RootCallTarget callTarget, FrameDescriptor capturedDescriptor, CopyVariableToFrameNode[] captureNodes) {
this.callTarget = callTarget;
this.capturedDescriptor = capturedDescriptor;
this.captureNodes = captureNodes;
this.arity = ((OzRootNode) callTarget.getRootNode()).getArity();
}
@Override
@ExplodeLoop
public Object execute(VirtualFrame frame) {
MaterializedFrame capture = Truffle.getRuntime().createVirtualFrame(ArrayUtils.EMPTY, capturedDescriptor).materialize();
for (int i = 0; i < captureNodes.length; i++) {
captureNodes[i].executeWrite(frame, capture);
}
return new OzProc(callTarget, capture, arity);
}
}
| 36.804878
| 145
| 0.813121
|
1e00784bffe49a07bc9f498415916fe0dedec6bf
| 992
|
/*
* Copyright (c) 2020-2021, Koninklijke Philips N.V., https://www.philips.com
* SPDX-License-Identifier: MIT
*/
package com.philips.research.bombase.core.meta;
import com.philips.research.bombase.core.MetaService.AttributeDto;
import com.philips.research.bombase.core.MetaService.PackageDto;
import com.philips.research.bombase.core.meta.registry.AttributeValue;
import com.philips.research.bombase.core.meta.registry.Package;
public abstract class DtoMapper {
static PackageDto toBaseDto(Package pkg) {
final var dto = new PackageDto();
dto.purl = pkg.getPurl();
dto.updated = pkg.getLastUpdated();
return dto;
}
static AttributeDto toDto(AttributeValue<?> value) {
final var dto = new AttributeDto();
dto.score = value.getScore();
value.getValue().ifPresent(v -> dto.value = v);
dto.altScore = value.getAltScore();
value.getAltValue().ifPresent(v -> dto.altValue = v);
return dto;
}
}
| 33.066667
| 77
| 0.689516
|
6d0d6d4f38e81f96956ec41cf413e2fff0536370
| 174
|
package bufmgr;
import chainexception.*;
public class BufMgrException extends ChainException{
public BufMgrException(Exception e, String name)
{ super(e, name); }
}
| 15.818182
| 52
| 0.752874
|
759d69cf385ad01582b2093752819543851350ec
| 2,355
|
package com.zzw.github.graphql.crawler.template;
import static com.zzw.github.graphql.crawler.template.MetaTemplate.NODE_ID;
/**
* Created by zzw on 2018/8/31.
*/
public class TeamDiscussionTemplate {
public static final String TEAM_DISCUSSION_INFO = "{\"query\":\"query{\\n" +
" node(id:\\\"" + NODE_ID + "\\\"){\\n" +
" __typename\\n" +
" ... on TeamDiscussion{\\n" +
" author{\\n" +
" __typename\\n" +
" ... on Bot{\\n" +
" id\\n" +
" }\\n" +
" ... on Organization{\\n" +
" id\\n" +
" }\\n" +
" ... on User{\\n" +
" id\\n" +
" }\\n" +
" }\\n" +
" authorAssociation\\n" +
" body\\n" +
" bodyHTML\\n" +
" bodyText\\n" +
" bodyVersion\\n" +
" commentsResourcePath\\n" +
" commentsUrl\\n" +
" createdAt\\n" +
" createdViaEmail\\n" +
" databaseId\\n" +
" editor{\\n" +
" __typename\\n" +
" ... on Bot{\\n" +
" id\\n" +
" }\\n" +
" ... on Organization{\\n" +
" id\\n" +
" }\\n" +
" ... on User{\\n" +
" id\\n" +
" }\\n" +
" }\\n" +
" id\\n" +
" includesCreatedEdit\\n" +
" isPinned\\n" +
" isPrivate\\n" +
" lastEditedAt\\n" +
" number\\n" +
" publishedAt\\n" +
" reactionGroups{\\n" +
" content\\n" +
" createdAt\\n" +
" viewerHasReacted\\n" +
" }\\n" +
" resourcePath\\n" +
" team{\\n" +
" id\\n" +
" }\\n" +
" title\\n" +
" updatedAt\\n" +
" url\\n" +
" }\\n" +
" }\\n" +
"}\",\"variables\":\"{}\"}";
}
| 33.642857
| 80
| 0.286624
|
cef4f41ef2e631c67cf608c4224fe88e975239c2
| 287
|
package com.dw.lib;
public class TimeSpan {
long start = System.nanoTime();
public TimeSpan() {
}
public long span() {
long end = System.nanoTime();
return (end - start)/1000000;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| 13.045455
| 41
| 0.641115
|
f7d45085c8b9bc547d5cb13bfd3118f1e16ded09
| 981
|
package com.atlassian.clover.eclipse.core.ui.editors.java.annotations.strategies.space;
import com.atlassian.clover.CloverDatabase;
import com.atlassian.clover.registry.entities.TestCaseInfo;
import com.atlassian.clover.eclipse.core.ui.editors.java.CoverageAnnotation;
import java.util.SortedSet;
import java.util.BitSet;
import java.util.Map;
import org.eclipse.jface.text.IDocument;
class RootAnnotationSpace extends AnnotationSpace {
public RootAnnotationSpace(
CloverDatabase database,
IDocument document,
Map<TestCaseInfo, BitSet> tcisAndHitsForFile) {
super(database, document, tcisAndHitsForFile);
}
@Override
protected AnnotationSpace getParent() { return null; }
@Override
public SortedSet<CoverageAnnotation> toAnnotations(SortedSet<CoverageAnnotation> set) {
sealed = true;
return super.toAnnotations(set);
}
public String toString() {
return "RootAnnotationSpace";
}
}
| 28.028571
| 91
| 0.744139
|
8d39dd9004f0478f4d9e47e780f8ff278ffe5d07
| 1,046
|
package edt.texteditor;
import java.io.Serializable;
public class Author implements Serializable {
/*==============================================================================
* Attributes
*============================================================================*/
private String _name = "";
private String _email = "";
/*==============================================================================
* Getters and Setters
*============================================================================*/
public String get_name(){
return _name;
}
public String get_email(){
return _email;
}
public void set_name(String name){
_name = name;
}
public void set_email(String email){
_email = email;
}
/*==============================================================================
* Constructor
*============================================================================*/
public Author(String name, String email){
_name = name;
_email = email;
}
}
| 26.820513
| 81
| 0.337476
|
70c0e902f62c98d5bc337e86eb85fde702a1a4c9
| 1,004
|
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
/**
* Displays all knowledge base (KB) articles and a search bar
*/
public class KB_IndexController extends BaseController {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doGet(request, response);
Category_DBWrapper categoryWrapper = this.getPortalBean().getCategories();
categoryWrapper.reset();
List<Category> categories = Arrays.asList(categoryWrapper.getCategories());
request.setAttribute("categories", categories);
request.getRequestDispatcher("/WEB-INF/jsp/kb/index.jsp").forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
super.doPost(request, response);
}
}
| 34.62069
| 122
| 0.755976
|
58fbda84f21c700ffcaad0117adb5f51b5927ef7
| 3,474
|
package com.kcrason.highperformancefriendscircle.beans;
import android.text.SpannableStringBuilder;
import com.kcrason.highperformancefriendscircle.utils.Utils;
import com.kcrason.highperformancefriendscircle.enums.TranslationState;
import java.util.List;
public class FriendCircleBean {
private int viewType;
private String content;
private List<CommentBean> commentBeans;
private List<PraiseBean> praiseBeans;
private List<String> imageUrls;
private UserBean userBean;
private OtherInfoBean otherInfoBean;
private boolean isShowPraise;
private boolean isExpanded;
public boolean isExpanded() {
return isExpanded;
}
public void setExpanded(boolean expanded) {
isExpanded = expanded;
}
private boolean isShowComment;
private boolean isShowCheckAll;
public boolean isShowCheckAll() {
return isShowCheckAll;
}
public void setShowCheckAll(boolean showCheckAll) {
isShowCheckAll = showCheckAll;
}
private TranslationState translationState = TranslationState.START;
public void setTranslationState(TranslationState translationState) {
this.translationState = translationState;
}
public TranslationState getTranslationState() {
return translationState;
}
public boolean isShowComment() {
return isShowComment;
}
public boolean isShowPraise() {
return isShowPraise;
}
public OtherInfoBean getOtherInfoBean() {
return otherInfoBean;
}
public void setOtherInfoBean(OtherInfoBean otherInfoBean) {
this.otherInfoBean = otherInfoBean;
}
public void setUserBean(UserBean userBean) {
this.userBean = userBean;
}
public UserBean getUserBean() {
return userBean;
}
public int getViewType() {
return viewType;
}
public void setViewType(int viewType) {
this.viewType = viewType;
}
public String getContent() {
return content;
}
public SpannableStringBuilder getContentSpan() {
return contentSpan;
}
public void setContentSpan(SpannableStringBuilder contentSpan) {
this.contentSpan = contentSpan;
this.isShowCheckAll = Utils.calculateShowCheckAllText(contentSpan.toString());
}
private SpannableStringBuilder contentSpan;
public void setContent(String content) {
this.content = content;
setContentSpan(new SpannableStringBuilder(content));
}
public List<CommentBean> getCommentBeans() {
return commentBeans;
}
public void setCommentBeans(List<CommentBean> commentBeans) {
isShowComment = commentBeans != null && commentBeans.size() > 0;
this.commentBeans = commentBeans;
}
public List<PraiseBean> getPraiseBeans() {
return praiseBeans;
}
public void setPraiseBeans(List<PraiseBean> praiseBeans) {
isShowPraise = praiseBeans != null && praiseBeans.size() > 0;
this.praiseBeans = praiseBeans;
}
public List<String> getImageUrls() {
return imageUrls;
}
public void setImageUrls(List<String> imageUrls) {
this.imageUrls = imageUrls;
}
public void setPraiseSpan(SpannableStringBuilder praiseSpan) {
this.praiseSpan = praiseSpan;
}
public SpannableStringBuilder getPraiseSpan() {
return praiseSpan;
}
private SpannableStringBuilder praiseSpan;
}
| 22.705882
| 86
| 0.688256
|
2019b9289d8300f329477a235a5342730d5ee722
| 2,921
|
package edu.umass.cs.ciir.waltz.dociter.movement;
import ciir.jfoley.chai.collections.util.ListFns;
import edu.umass.cs.ciir.waltz.dociter.IKeyBlock;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
/**
* @author jfoley.
*/
public abstract class AChildrenMover<T extends Mover> extends AMover {
protected final List<T> children;
protected int lastKey;
public AChildrenMover(List<T> children) {
this.children = ListFns.ensureRandomAccess(children);
assert(children.size() > 1);
assert(children.size() == new HashSet<>(children).size());
for (T child : children) {
Objects.requireNonNull(child, "All children of movers must be non-null.");
}
loadNewCurrentBlock();
}
@Override
public void reset() {
for (Mover child : children) {
child.reset();
}
loadNewCurrentBlock();
}
protected final int findLowestMax() {
int lastKey = children.get(0).maxKey();
for (int i = 1; i < children.size(); i++) {
Mover child = children.get(i);
lastKey = Math.min(lastKey, child.maxKey());
}
return lastKey;
}
protected final int findMinimumKey() {
int minimumChildKey = children.get(0).currentKey();
for (int i = 1; i < children.size(); i++) {
Mover child = children.get(i);
minimumChildKey = Math.min(minimumChildKey, child.currentKey());
}
return minimumChildKey;
}
protected final int findHighestMinimum() {
int highMin = children.get(0).currentKey();
for (int i = 1; i < children.size(); i++) {
Mover child = children.get(i);
highMin = Math.max(highMin, child.currentKey());
}
return highMin;
}
@Override
public void nextBlock() {
if(lastKey == DONE_ID) return;
for (Mover child : children) {
child.movePast(lastKey);
assert (child.isDoneWithBlock() || child.currentKey() > lastKey);
if (child.isDoneWithBlock()) {
child.nextBlock();
}
}
loadNewCurrentBlock();
}
protected void loadNewCurrentBlock() {
this.currentBlock = null;
this.index = 0;
this.lastKey = DONE_ID;
while(true) {
// find the first of any child's maximum keys.
int lastKey = findLowestMax();
if (lastKey == DONE_ID) {
return;
}
this.lastKey = lastKey;
this.currentBlock = loadKeysFromChildren(lastKey);
if(this.currentBlock == null) {
return; // End of List
}
if(!this.currentBlock.isEmpty()) {
break;
}
// No matches
for (T child : this.children) {
if(child.isDoneWithBlock()) {
child.nextBlock();
}
}
}
// rewind so values can be stepped through.
for (T child : children) {
int here = this.currentKey();
child.rewindBlock(here);
}
}
/**
* Select matching from child blocks
* @param lastKey is the min(x.maxKey for x in children); the upper bound of current block.
* @return a block filled with matches between here and lastKey inclusive.
*/
protected abstract IKeyBlock loadKeysFromChildren(int lastKey);
}
| 24.341667
| 92
| 0.670318
|
a92e912c37e6c6e43485762332c3baf92b698aeb
| 4,494
|
package com.stylefeng.guns.modular.system.service.impl;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.core.common.constant.state.DelFlag;
import com.stylefeng.guns.core.exception.GunsException;
import com.stylefeng.guns.core.exception.GunsExceptionEnum;
import com.stylefeng.guns.core.shiro.ShiroKit;
import com.stylefeng.guns.core.task.JobService;
import com.stylefeng.guns.core.task.TaskService;
import com.stylefeng.guns.core.task.job.QuartzJob;
import com.stylefeng.guns.modular.system.dao.SysTaskMapper;
import com.stylefeng.guns.modular.system.model.SysTask;
import com.stylefeng.guns.modular.system.service.ISysTaskService;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务实现类
* </p>
*
* @author wj123
* @since 2019-06-13
*/
@Service
public class SysTaskServiceImpl extends ServiceImpl<SysTaskMapper, SysTask> implements ISysTaskService {
private static final Logger logger = LoggerFactory.getLogger(TaskService.class);
@Resource
private SysTaskMapper sysTaskMapper;
@Autowired
private JobService jobService;
@Override
public List<Map<String, Object>> list(Page page, String condition) {
List<Map<String, Object>> list = this.baseMapper.list(page, condition);
return list;
}
@Override
public boolean insert(SysTask task) {
logger.info("新增定时任务%s", task.getName());
Integer insert = sysTaskMapper.insert(task);
try {
jobService.addJob(jobService.getJob(task));
} catch (SchedulerException e) {
logger.error(e.getMessage(), e);
}
return true;
}
/**
* 功能描述: 更新并且重置任务执行时间
*
* @param task
* @return boolean
* @author wj
* @date 2019/6/14 10:46
*/
@Override
public boolean updateById(SysTask task) {
logger.info("更新定时任务{}", task.getName());
sysTaskMapper.updateById(task);
try {
QuartzJob job = jobService.getJob(task.getId().toString(), task.getJobGroup());
if (job != null) {
jobService.deleteJob(job);
}
jobService.addJob(jobService.getJob(task));
} catch (SchedulerException e) {
logger.error(e.getMessage(), e);
}
return true;
}
public SysTask disable(Long id) {
SysTask task = this.sysTaskMapper.selectById(id);
task.setDisabled("1");
sysTaskMapper.updateById(task);
logger.info("禁用定时任务{}", id.toString());
try {
QuartzJob job = jobService.getJob(task.getId().toString(), task.getJobGroup());
if (job != null) {
jobService.deleteJob(job);
}
} catch (SchedulerException e) {
logger.error(e.getMessage(), e);
}
return task;
}
public SysTask enable(Long id) {
SysTask task = this.sysTaskMapper.selectById(id);
task.setDisabled("0");
sysTaskMapper.updateById(task);
logger.info("启用定时任务{}", id.toString());
try {
QuartzJob job = jobService.getJob(task.getId().toString(), task.getJobGroup());
if (job != null) {
jobService.deleteJob(job);
}
if ("0".equals(task.getDisabled())) {
jobService.addJob(jobService.getJob(task));
}
} catch (SchedulerException e) {
throw new GunsException(GunsExceptionEnum.TASK_CONFIG_ERROR);
}
return task;
}
public void delete(Long id) {
SysTask task = this.sysTaskMapper.selectById(id);
task.setDisabled("1");
task.setDeleteFlag(DelFlag.DELETED.getCode());
task.setCreateUser(ShiroKit.getUserNotNull().getId());
task.setUpdateTime(new Date());
sysTaskMapper.updateById(task);
logger.info("删除定时任务{}", id.toString());
try {
QuartzJob job = jobService.getJob(task.getId().toString(), task.getJobGroup());
if (job != null) {
jobService.deleteJob(job);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
}
| 31.208333
| 104
| 0.631064
|
275230ef2ca46e208f81e8bf4431702e7481c62a
| 3,715
|
/*
* Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.epam.pipeline.autotests.ao;
import com.codeborne.selenide.SelenideElement;
import java.io.File;
import java.util.Map;
import static com.codeborne.selenide.Selectors.byClassName;
import static com.codeborne.selenide.Selectors.byId;
import static com.codeborne.selenide.Selectors.byText;
import static com.codeborne.selenide.Selectors.withText;
import static com.epam.pipeline.autotests.ao.Primitive.CANCEL;
import static com.epam.pipeline.autotests.ao.Primitive.CERTIFICATE;
import static com.epam.pipeline.autotests.ao.Primitive.DELETE;
import static com.epam.pipeline.autotests.ao.Primitive.DESCRIPTION;
import static com.epam.pipeline.autotests.ao.Primitive.EDIT_CREDENTIALS;
import static com.epam.pipeline.autotests.ao.Primitive.INFO;
import static com.epam.pipeline.autotests.ao.Primitive.NAME;
import static com.epam.pipeline.autotests.ao.Primitive.PASSWORD;
import static com.epam.pipeline.autotests.ao.Primitive.PATH;
import static com.epam.pipeline.autotests.ao.Primitive.PERMISSIONS;
import static com.epam.pipeline.autotests.utils.PipelineSelectors.button;
import static org.openqa.selenium.By.tagName;
public abstract class RegistryPopup extends PopupAO<RegistryPopup, ToolsPage> {
private final Map<Primitive, SelenideElement> elements = initialiseElements(
entry(PERMISSIONS, context().find(byClassName("ant-tabs-nav")).find(byText("Permissions"))),
entry(INFO, context().find(byClassName("ant-tabs-nav")).find(byText("Info"))),
entry(PATH, context().find(byId("path"))),
entry(DESCRIPTION, context().find(byId("description"))),
entry(EDIT_CREDENTIALS, context().find(byText("Edit credentials"))),
entry(NAME, context().find(byId("userName"))),
entry(PASSWORD, context().find(byId("password"))),
entry(CERTIFICATE, context().find(withText("Certificate")).closest(".ant-row-flex").find(tagName("input"))),
entry(CANCEL, context().find(button("CANCEL"))),
entry(DELETE, context().find(button("DELETE")))
);
public RegistryPopup() {
super(new ToolsPage());
}
public RegistryPopup setPath(final String registryPath) {
return setValue(PATH, registryPath);
}
public RegistryPopup openCredentials() {
return click(EDIT_CREDENTIALS);
}
public RegistryPopup setCredentials(final String login, final String password) {
return setValue(NAME, login).setValue(PASSWORD, password);
}
public RegistryPopup setDescription(final String description) {
return setValue(DESCRIPTION, description);
}
public RegistryPopup uploadCertificate(final File certificate) {
get(CERTIFICATE).uploadFile(certificate);
return this;
}
public PermissionTabAO permissions() {
click(PERMISSIONS);
return new PermissionTabAO(this);
}
@Override
public ToolsPage cancel() {
return click(CANCEL).parent();
}
@Override
public Map<Primitive, SelenideElement> elements() {
return elements;
}
}
| 39.946237
| 120
| 0.722476
|
92f03f828c715190669f16a67e94169d74ee572f
| 262
|
package puppynux.rg.AI.actions;
/**
* Created by niamor972 on 07/04/16.
* Parts of puppynux.rg.AI.actions.
* >
*/
public class OutdatedActionException extends Exception {
public OutdatedActionException (String message) {
super(message);
}
}
| 20.153846
| 56
| 0.694656
|
241b6e811b07e61c735d169ebc1217079c26c58d
| 1,243
|
/*
*
* Copyright (c) 2006-2020, Speedment, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); You may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.speedment.runtime.core.db;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import org.junit.jupiter.api.Test;
import java.util.function.BiConsumer;
final class SqlBiConsumerTest {
@Test
void wrap() {
assertThrows(NullPointerException.class, () -> SqlBiConsumer.wrap(null));
final BiConsumer<String, String> biConsumer = (k, v) -> System.out.println(k + v);
final SqlBiConsumer<String, String> sqlBiConsumer = SqlBiConsumer.wrap(biConsumer);
assertNotNull(sqlBiConsumer);
}
}
| 32.710526
| 91
| 0.7321
|
f773a0a7986a9c11d466ef88d63f1bdff05047f5
| 1,271
|
/*
* Copyright 2007 Google 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.google.gwt.junit.client;
/**
* A mathematical operator used in {@link com.google.gwt.junit.client.Range}s
* to indicate the stepping function.
*/
public final class Operator {
/**
* The standard multiplication operator.
*/
public static Operator MULTIPLY = new Operator( "*" );
/**
* The standard addition operator.
*/
public static Operator ADD = new Operator( "+" );
private String value;
private Operator(String value) {
this.value = value;
}
/**
* Returns the textual representation of the <code>Operator</code>.
*
* @return a non-null {@link String}
*/
public String toString() {
return value;
}
}
| 25.938776
| 80
| 0.691581
|
aa22aeeaad7dca9366a8730e0854672c9a34c2eb
| 1,080
|
package str.rad.util.swing;
import java.awt.*;
public class JTextFieldResizeable extends javax.swing.JTextField {
private Dimension prefSize;
public static final int CHAR_COUNT = 3;
public JTextFieldResizeable(String s) {
super(s);
LARGEST_WIDTH_DIGIT = calculateMaxWidthDigit();
setPreferredSize(CHAR_COUNT);
}
public Dimension setPreferredSize(int charCount) {
Font f = this.getFont();
FontMetrics fm = this.getFontMetrics(f);
charCount++; // Needs a bit extra
setInternalPreferredSize(new Dimension(LARGEST_WIDTH_DIGIT * charCount, fm.getHeight()));
return prefSize;
}
public void setInternalPreferredSize(Dimension dim) {
prefSize = dim;
}
@Override
public Dimension getPreferredSize() {
return prefSize;
}
private final int LARGEST_WIDTH_DIGIT;
private int calculateMaxWidthDigit() {
Font f = this.getFont();
FontMetrics fm = this.getFontMetrics(f);
return SwingUtils.calculateMaxWidthDigit(fm);
}
}
| 27
| 97
| 0.667593
|
889d9a909d0b19fc9c8573a2beaa7d9a0a14b300
| 2,553
|
package com.brabbit.springboot.app;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.brabbit.springboot.app.auth.handler.LoginSuccessHandler;
import com.brabbit.springboot.app.models.service.JpaUserDetailsService;
@EnableGlobalMethodSecurity(securedEnabled=true, prePostEnabled=true)
@Configuration
public class SpringSecurityConfig extends WebSecurityConfigurerAdapter{
@Autowired
private LoginSuccessHandler successHandler;
@Autowired
private JpaUserDetailsService userDetailsService;
@Autowired
private BCryptPasswordEncoder passwordEncoder;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/", "/css/**", "/js/**","/login/**","/img/**","/h2-console/**","/registroA","/registroP","/alerta/**","/error_403","/cursosVisitante/**","/registro/alumno/**","/registro/profesor/**","/comprarVisitante/{id}/**").permitAll()
.antMatchers("/admin/**", "/eliminarUsuario/**", "/eliminar/{id}/**", "/verDenuncias/**").hasRole("ADMIN")
.antMatchers("/alumno/**","/denunciar/alumno/**","/alumno/vercursos/{id}/**","/alumno/comprar/{id}/**","/alumno/cursos/chat/{id}/**","/alumno/curso/chat/{id}/**","/alumno/cursos/**").hasRole("ALUMNO")
.antMatchers("/profesor/**","/curso/**","/nuevo/curso/**,/profesor/crearCurso/**","/denunciar/profesor/**","/profesor/asesorias/{id}/**","/denunciar/profesor/**","/verCursosProfesores/**","/profesor/cursoT/chat/{id}/**","/profesor/cursos/chat/{id}/**").hasRole("PROFESOR")
.anyRequest().authenticated()
.and()
.formLogin()
.successHandler(successHandler)
.loginPage("/login")
.permitAll()
.and()
.logout().permitAll()
.and()
.exceptionHandling().accessDeniedPage("/error_403");
http.headers().frameOptions().disable();
http.csrf().disable();
}
@Autowired
public void configurerGlobal(AuthenticationManagerBuilder build) throws Exception
{
build.userDetailsService(userDetailsService)
.passwordEncoder(passwordEncoder);
}
}
| 42.55
| 274
| 0.749315
|
cb37269e3d8508107aadb59b9d600c130b6fd106
| 357
|
import java.util.*;
public class P18
{
public static void main()
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter the side");
int s = sc.nextInt();
int a = s*s;
System.out.println("Area of the square="+a);
int p = 4*s;
System.out.println("Perimeter of the square="+p);
}
}
| 23.8
| 57
| 0.551821
|
30865b6a35c792310f5668e8248bee28cf5631e6
| 617
|
package ru.majordomo.hms.personmgr.exception;
import lombok.Getter;
import lombok.Setter;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
import java.util.Map;
@ResponseStatus(HttpStatus.BAD_REQUEST)
public abstract class WithErrorsException extends BaseException {
public WithErrorsException() {}
@Setter
@Getter
private Map errors;
public WithErrorsException(String message) {
super(message);
}
public WithErrorsException(String message, Map errors) {
super(message);
this.errors = errors;
}
}
| 22.851852
| 65
| 0.73906
|
4f8742a7f77bde05002729503e3b626d04f8eb00
| 4,449
|
/*
* Copyright (c) 2015, Florent Hedin, Markus Meuwly, and the University of Basel
* All rights reserved.
*
* The 3-clause BSD license is applied to this software.
* see LICENSE.txt
*
*/
package ch.unibas.charmmtools.gui.step2.showOutput;
import ch.unibas.charmmtools.generate.CHARMM_InOut;
import ch.unibas.charmmtools.generate.inputs.CHARMM_Input;
import ch.unibas.charmmtools.generate.outputs.CHARMM_Output;
import ch.unibas.charmmtools.gui.CHARMM_GUI_base;
import ch.unibas.charmmtools.gui.step1.mdAssistant.CHARMM_GUI_InputAssistant;
import ch.unibas.charmmtools.gui.step3.showResults.CHARMM_GUI_ShowResults;
import ch.unibas.charmmtools.workflows.RunCHARMMWorkflow;
import ch.unibas.fittingwizard.presentation.base.ButtonFactory;
import java.util.ArrayList;
import java.util.List;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.paint.Paint;
/**
* FXML Controller class
*
* @author hedin
*/
public class CHARMM_GUI_ShowOutput extends CHARMM_GUI_base {
private static final String title = "LJ fitting procedure : visualising output files";
@FXML
private TextArea out_left, out_right;
@FXML
private Label LabelLeft,LabelRight,errorLabelRight,errorLabelLeft;
private Button backAssistant,gotoShowResults;
public CHARMM_GUI_ShowOutput(RunCHARMMWorkflow flow, List<CHARMM_InOut> ioList)
{
super(title, flow);
for (CHARMM_InOut ioListIt : ioList) {
Class c = ioListIt.getClass();
Class sc = c.getSuperclass();
if (sc == CHARMM_Input.class) {
inp.add((CHARMM_Input) ioListIt);
} else if (sc == CHARMM_Output.class) {
out.add((CHARMM_Output) ioListIt);
} else {
throw new UnknownError("Unknown type of object in List<CHARMM_InOut> : get " + ioListIt.getClass() + " but expected types are " + CHARMM_Input.class + " or " + CHARMM_Output.class);
}
}
}//ctor
@Override
public void initializeData() {
out_left.setText(out.get(0).getText());
out_right.setText(out.get(1).getText());
LabelLeft.setText(LabelLeft.getText() + " " + out.get(0).getType() );
LabelRight.setText(LabelRight.getText() + " " + out.get(1).getType() );
if (out.get(0).getErrorOccured())
{
errorLabelLeft.setVisible(true);
errorLabelLeft.setText("Error while running CHARMM calculation ! Please check output :");
errorLabelLeft.setTextFill(Paint.valueOf("RED"));
gotoShowResults.setDisable(true);
}
if (out.get(1).getErrorOccured())
{
errorLabelRight.setVisible(true);
errorLabelRight.setText("Error while running CHARMM calculation ! Please check output :");
errorLabelRight.setTextFill(Paint.valueOf("RED"));
gotoShowResults.setDisable(true);
}
}
@Override
protected void fillButtonBar() {
backAssistant = ButtonFactory.createButtonBarButton("Back to ρ and ΔH input assistant", new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent actionEvent) {
List<CHARMM_InOut> myList = new ArrayList<>();
myList.addAll(inp);
myList.addAll(out);
logger.info("Going back to CHARMM input assistant");
// navigateTo(CHARMM_GUI_InputAssistant.class,myList);
navigateTo(CHARMM_GUI_InputAssistant.class,null);
}
});
addButtonToButtonBar(backAssistant);
gotoShowResults = ButtonFactory.createButtonBarButton("Proceed to Results page", new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent actionEvent) {
List<CHARMM_InOut> myList = new ArrayList<>();
myList.addAll(inp);
myList.addAll(out);
logger.info("Going to Results display");
navigateTo(CHARMM_GUI_ShowResults.class,myList);
}
});
addButtonToButtonBar(gotoShowResults);
}
}
| 34.757813
| 197
| 0.636772
|
edb761512384636da6885f1b832b3d814326724a
| 5,128
|
package org.comtel.javafx.robot;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import javafx.scene.input.Clipboard;
import javafx.scene.input.ClipboardContent;
import org.slf4j.LoggerFactory;
/**
* native OS support<p>
* dirty unicode char support only by transfer over OS clipboard..
*
* @author comtel
*
*/
public class NativeAsciiRobotHandler implements IRobot {
private final static org.slf4j.Logger logger = LoggerFactory.getLogger(NativeAsciiRobotHandler.class);
private final int controlKeyEvent;
String clipboardRecovered;
public NativeAsciiRobotHandler() {
String osName = System.getProperty("os.name");
if (osName.startsWith("Mac")){
controlKeyEvent = KeyEvent.VK_META;
}else{
controlKeyEvent = KeyEvent.VK_CONTROL;
}
}
@Override
public void sendToComponent(Object kb, char ch, boolean ctrl) {
logger.trace("fire: {}", ch);
send(ch, ctrl);
}
private void send(char ch, boolean ctrl) {
Robot robot;
try {
robot = new Robot();
} catch (AWTException e) {
logger.error(e.getMessage(), e);
return;
}
if (ctrl) {
switch (Character.toUpperCase(ch)) {
case KeyEvent.VK_A:
robot.keyPress(controlKeyEvent);
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_A);
robot.keyRelease(controlKeyEvent);
return;
case KeyEvent.VK_X:
robot.keyPress(controlKeyEvent);
robot.keyPress(KeyEvent.VK_X);
robot.keyRelease(KeyEvent.VK_X);
robot.keyRelease(controlKeyEvent);
return;
case KeyEvent.VK_C:
robot.keyPress(controlKeyEvent);
robot.keyPress(KeyEvent.VK_C);
robot.keyRelease(KeyEvent.VK_C);
robot.keyRelease(controlKeyEvent);
return;
case KeyEvent.VK_V:
robot.keyPress(controlKeyEvent);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(controlKeyEvent);
return;
}
switch (ch) {
case KeyEvent.VK_ENTER:
robot.keyPress(KeyEvent.VK_ENTER);
robot.keyRelease(KeyEvent.VK_ENTER);
return;
case KeyEvent.VK_BACK_SPACE:
robot.keyPress(KeyEvent.VK_BACK_SPACE);
robot.keyRelease(KeyEvent.VK_BACK_SPACE);
return;
case KeyEvent.VK_DELETE:
robot.keyPress(KeyEvent.VK_DELETE);
robot.keyRelease(KeyEvent.VK_DELETE);
return;
case KeyEvent.VK_ESCAPE:
robot.keyPress(KeyEvent.VK_ESCAPE);
robot.keyRelease(KeyEvent.VK_ESCAPE);
return;
case KeyEvent.VK_SPACE:
robot.keyPress(KeyEvent.VK_SPACE);
robot.keyRelease(KeyEvent.VK_SPACE);
return;
case KeyEvent.VK_TAB:
robot.keyPress(KeyEvent.VK_TAB);
robot.keyRelease(KeyEvent.VK_TAB);
return;
case KeyEvent.VK_UP:
robot.keyPress(KeyEvent.VK_UP);
robot.keyRelease(KeyEvent.VK_UP);
return;
case KeyEvent.VK_DOWN:
robot.keyPress(KeyEvent.VK_DOWN);
robot.keyRelease(KeyEvent.VK_DOWN);
return;
case KeyEvent.VK_LEFT:
robot.keyPress(KeyEvent.VK_LEFT);
robot.keyRelease(KeyEvent.VK_LEFT);
return;
case KeyEvent.VK_RIGHT:
robot.keyPress(KeyEvent.VK_RIGHT);
robot.keyRelease(KeyEvent.VK_RIGHT);
return;
}
}
if (Character.isWhitespace(ch)) {
robot.keyPress(ch);
robot.keyRelease(ch);
return;
}
boolean isUpperCase = Character.isUpperCase(ch);
int keyCode = KeyEvent.getExtendedKeyCodeForChar(ch);
System.err.println("key code: " + keyCode);
if (isUpperCase) {
robot.keyPress(KeyEvent.VK_SHIFT);
}
try {
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
} catch (IllegalArgumentException e) {
logger.error(e.getMessage() + " " + ch);
clipboardTransfer(robot, ch);
}
if (isUpperCase) {
robot.keyRelease(KeyEvent.VK_SHIFT);
}
}
private void clipboardTransfer(Robot robot, char ch) {
final String clipboardRecovered = Clipboard.getSystemClipboard().getString();
ClipboardContent content = new ClipboardContent();
content.putString(Character.toString(ch));
Clipboard.getSystemClipboard().setContent(content);
robot.keyPress(controlKeyEvent);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(controlKeyEvent);
// ClipboardContent recover = new ClipboardContent();
// recover.putString(clipboardRecovered != null ? clipboardRecovered :
// "");
// Clipboard.getSystemClipboard().setContent(recover);
// Thread recoverThread = new Thread(new Runnable() {
//
// @Override
// public void run() {
// try {
// Thread.sleep(200);
// } catch (final InterruptedException e) {
// }
// ClipboardContent recover = new ClipboardContent();
// recover.putString(clipboardRecovered != null ? clipboardRecovered :
// "");
// Clipboard.getSystemClipboard().setContent(recover);
//
// }
// });
// recoverThread.setDaemon(true);
// recoverThread.start();
// recover old content
// clipboard.setContent(Collections.singletonMap(DataFormat.PLAIN_TEXT,
// content != null ? content : ""));
}
}
| 27.132275
| 104
| 0.681747
|
e20f6e7d6d50066d00b3e6bf838cd49cc2b40dbe
| 549
|
package ru.job4j.fit;
/**
* Fit - human optimal weight.
*
* @author fourbarman (maks.java@yandex.ru)
* @version 1
* @since 17.08.2018
*/
public class Fit {
/**
* Man's ideal weight.
* @param height Height.
* @return ideal weight.
*/
public double manWeight(double height) {
return (height - 100) * 1.15;
}
/**
* Man's ideal weight.
* @param height Height.
* @return ideal weight.
*/
public double womanWeight(double height) {
return (height - 110) * 1.15;
}
}
| 18.3
| 46
| 0.559199
|
569d0a51f3b61b5993a43b2fc01a1967416ba3d3
| 5,930
|
/*
* Copyright 2012-2017 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 fm.pattern.tokamak.server.endpoints;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
import org.springframework.security.oauth2.provider.error.OAuth2ExceptionRenderer;
import org.springframework.web.HttpMediaTypeNotAcceptableException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.context.request.ServletWebRequest;
import fm.pattern.tokamak.sdk.commons.ErrorRepresentation;
import fm.pattern.tokamak.sdk.commons.ErrorsRepresentation;
public class RestExceptionRenderer implements OAuth2ExceptionRenderer {
private List<HttpMessageConverter<?>> messageConverters = getDefaultMessageConverters();
public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
this.messageConverters = messageConverters;
}
public void handleHttpEntityResponse(HttpEntity<?> responseEntity, ServletWebRequest webRequest) throws Exception {
if (responseEntity == null) {
return;
}
HttpInputMessage inputMessage = createHttpInputMessage(webRequest);
HttpOutputMessage outputMessage = createHttpOutputMessage(webRequest);
if (responseEntity instanceof ResponseEntity && outputMessage instanceof ServerHttpResponse) {
((ServerHttpResponse) outputMessage).setStatusCode(((ResponseEntity<?>) responseEntity).getStatusCode());
}
HttpHeaders entityHeaders = responseEntity.getHeaders();
if (!entityHeaders.isEmpty()) {
outputMessage.getHeaders().putAll(entityHeaders);
}
Object body = responseEntity.getBody();
if (body != null) {
writeWithMessageConverters(body, inputMessage, outputMessage);
}
else {
outputMessage.getBody();
}
}
@SuppressWarnings({ "unchecked", "rawtypes" })
private void writeWithMessageConverters(Object returnValue, HttpInputMessage inputMessage, HttpOutputMessage outputMessage) throws IOException, HttpMediaTypeNotAcceptableException {
List<MediaType> acceptedMediaTypes = inputMessage.getHeaders().getAccept();
if (acceptedMediaTypes.isEmpty()) {
acceptedMediaTypes = Collections.singletonList(MediaType.ALL);
}
ErrorsRepresentation errors = convertToInternal(returnValue);
MediaType.sortByQualityValue(acceptedMediaTypes);
Class<?> returnValueType = returnValue.getClass();
List<MediaType> allSupportedMediaTypes = new ArrayList<MediaType>();
for (MediaType acceptedMediaType : acceptedMediaTypes) {
for (HttpMessageConverter messageConverter : messageConverters) {
if (messageConverter.canWrite(returnValueType, acceptedMediaType)) {
messageConverter.write(errors, acceptedMediaType, outputMessage);
return;
}
}
}
for (HttpMessageConverter messageConverter : messageConverters) {
allSupportedMediaTypes.addAll(messageConverter.getSupportedMediaTypes());
}
throw new HttpMediaTypeNotAcceptableException(allSupportedMediaTypes);
}
private ErrorsRepresentation convertToInternal(Object object) {
if (!(object instanceof OAuth2Exception)) {
return new ErrorsRepresentation();
}
OAuth2Exception exception = (OAuth2Exception) object;
List<String> list = new ArrayList<String>();
list.add(exception.getMessage());
ErrorRepresentation error = new ErrorRepresentation("AUT-0001", exception.getMessage() + ".");
return new ErrorsRepresentation(Arrays.asList(error));
}
private List<HttpMessageConverter<?>> getDefaultMessageConverters() {
List<HttpMessageConverter<?>> result = new ArrayList<HttpMessageConverter<?>>();
result.addAll(new RestTemplate().getMessageConverters());
return result;
}
private HttpInputMessage createHttpInputMessage(NativeWebRequest webRequest) throws Exception {
HttpServletRequest servletRequest = webRequest.getNativeRequest(HttpServletRequest.class);
return new ServletServerHttpRequest(servletRequest);
}
private HttpOutputMessage createHttpOutputMessage(NativeWebRequest webRequest) throws Exception {
HttpServletResponse servletResponse = (HttpServletResponse) webRequest.getNativeResponse();
return new ServletServerHttpResponse(servletResponse);
}
}
| 42.661871
| 185
| 0.744688
|
ceb6619dd7ddf61cd38770d966994008ade63d83
| 3,817
|
package net.minecraft.world.entity.animal;
import net.minecraft.core.BlockPos;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.AgeableMob;
import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.Pose;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.goal.BreedGoal;
import net.minecraft.world.entity.ai.goal.FloatGoal;
import net.minecraft.world.entity.ai.goal.FollowParentGoal;
import net.minecraft.world.entity.ai.goal.LookAtPlayerGoal;
import net.minecraft.world.entity.ai.goal.PanicGoal;
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
import net.minecraft.world.entity.ai.goal.TemptGoal;
import net.minecraft.world.entity.ai.goal.WaterAvoidingRandomStrollGoal;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.ItemUtils;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
public class Cow extends Animal {
public Cow(EntityType<? extends Cow> p_28285_, Level p_28286_) {
super(p_28285_, p_28286_);
}
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
this.goalSelector.addGoal(1, new PanicGoal(this, 2.0D));
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.25D, Ingredient.of(Items.WHEAT), false));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.25D));
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 1.0D));
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
}
public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes().add(Attributes.MAX_HEALTH, 10.0D).add(Attributes.MOVEMENT_SPEED, (double)0.2F);
}
protected SoundEvent getAmbientSound() {
return SoundEvents.COW_AMBIENT;
}
protected SoundEvent getHurtSound(DamageSource p_28306_) {
return SoundEvents.COW_HURT;
}
protected SoundEvent getDeathSound() {
return SoundEvents.COW_DEATH;
}
protected void playStepSound(BlockPos p_28301_, BlockState p_28302_) {
this.playSound(SoundEvents.COW_STEP, 0.15F, 1.0F);
}
protected float getSoundVolume() {
return 0.4F;
}
public InteractionResult mobInteract(Player p_28298_, InteractionHand p_28299_) {
ItemStack itemstack = p_28298_.getItemInHand(p_28299_);
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
p_28298_.playSound(SoundEvents.COW_MILK, 1.0F, 1.0F);
ItemStack itemstack1 = ItemUtils.createFilledResult(itemstack, p_28298_, Items.MILK_BUCKET.getDefaultInstance());
p_28298_.setItemInHand(p_28299_, itemstack1);
return InteractionResult.sidedSuccess(this.level.isClientSide);
} else {
return super.mobInteract(p_28298_, p_28299_);
}
}
public Cow getBreedOffspring(ServerLevel p_148890_, AgeableMob p_148891_) {
return EntityType.COW.create(p_148890_);
}
protected float getStandingEyeHeight(Pose p_28295_, EntityDimensions p_28296_) {
return this.isBaby() ? p_28296_.height * 0.95F : 1.3F;
}
}
| 41.48913
| 122
| 0.765261
|
821199f232e026de86ed3551f42c5fab2afb2891
| 303
|
// This is a generated file. Not intended for manual editing.
package icu.windea.pls.cwt.psi;
import java.util.List;
import org.jetbrains.annotations.*;
import com.intellij.psi.PsiElement;
public interface CwtDocumentationText extends PsiElement {
@NotNull
PsiElement getDocumentationToken();
}
| 21.642857
| 61
| 0.788779
|
5921112d62d80093c35ff532e4194cc137e67f22
| 8,240
|
/*Vous trouverez les liens vers les licenses nécessaires pour l'utilisation du code dans README.md*/
package com.bonhomme.jb.smile;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;
import com.estimote.indoorsdk.EstimoteCloudCredentials;
import com.estimote.indoorsdk.IndoorLocationManagerBuilder;
import com.estimote.indoorsdk_module.algorithm.OnPositionUpdateListener;
import com.estimote.indoorsdk_module.algorithm.ScanningIndoorLocationManager;
import com.estimote.indoorsdk_module.cloud.CloudCallback;
import com.estimote.indoorsdk_module.cloud.CloudCredentials;
import com.estimote.indoorsdk_module.cloud.EstimoteCloudException;
import com.estimote.indoorsdk_module.cloud.IndoorCloudManager;
import com.estimote.indoorsdk_module.cloud.IndoorCloudManagerFactory;
import com.estimote.indoorsdk_module.cloud.Location;
import com.estimote.indoorsdk_module.cloud.LocationPosition;
import com.estimote.indoorsdk_module.view.IndoorLocationView;
import com.estimote.mustard.rx_goodness.rx_requirements_wizard.Requirement;
import com.estimote.mustard.rx_goodness.rx_requirements_wizard.RequirementsWizardFactory;
import com.google.firebase.auth.FirebaseAuth;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function1;
public class anonymousUser extends AppCompatActivity {
private FirebaseAuth mAuth;
private IndoorLocationView mLocationView;
private LocationPosition mLocalPos;
private IndoorCloudManager mCldMng;
private EstimoteCloudCredentials mCldCred;
private ImageButton mShelfBtn;
private ImageButton mDairyShelfBtn;
private Button mSignOutBtn;
private Button mRegister;
protected ScanningIndoorLocationManager mIndoorLocationManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.anonymous_user);
mAuth = FirebaseAuth.getInstance();
// Authenticate the app to access the Estimote Cloud
mCldCred = new EstimoteCloudCredentials("smile-0bg", "9e0f13942025ac504966bb6eb77e5a4d");
mCldMng = new IndoorCloudManagerFactory().create(this, mCldCred);
RequirementsWizardFactory.createEstimoteRequirementsWizard().fulfillRequirements(
this,
new Function0<Unit>() {
@Override
public Unit invoke() {
mCldMng.getLocation("smileindoorloc-17s", new CloudCallback<Location>() {
@Override
public void success(Location location) {
//do smthng with the location object
mLocationView = findViewById(R.id.indoor_location_view);
mLocationView.setLocation(location);
//mLocation = location;
// Initialize the IndoorLocationManager
mIndoorLocationManager = new IndoorLocationManagerBuilder(getApplicationContext(), location, mCldCred)
.withDefaultScanner()
.build();
startPositioning();
// Setting location listener to update location on the map
mIndoorLocationManager.setOnPositionUpdateListener(new OnPositionUpdateListener() {
@Override
public void onPositionUpdate(LocationPosition localPosition) {
mLocalPos = localPosition;
mLocationView.updatePosition(localPosition);
Log.d("UPDATED POS", "POS : " + localPosition);
}
@Override
public void onPositionOutsideLocation() {
mLocationView.hidePosition();
Log.d("UPDATED POS", "Hidden Position");
}
});
}
@Override
// If it fails to load the location
public void failure(EstimoteCloudException e) {
Toast.makeText(anonymousUser.this, "Error While loading the location: " + e.getErrorCode(),
Toast.LENGTH_SHORT).show();
}
});
return null;
}
},
new Function1<List<? extends Requirement>, Unit>() {
@Override
public Unit invoke(List<? extends Requirement> requirements) {
Toast.makeText(anonymousUser.this, "Error one or several requirements are missing, " +
"scanning won't work until all requirements are fulfilled: " + requirements.toString(),
Toast.LENGTH_LONG).show();
return null;
}
},
new Function1<Throwable, Unit>() {
@Override
public Unit invoke(Throwable throwable) {
Toast.makeText(anonymousUser.this, "Whoops some error has occurred: " + throwable.getMessage(),
Toast.LENGTH_LONG).show();
return null;
}
}
);
// Initialize the fruit shelf button and add an onClick listener
mShelfBtn = findViewById(R.id.fruit_shelf);
mShelfBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent shelfManagement = new Intent(anonymousUser.this, anonymousShelfActivity.class);
shelfManagement.putExtra("documentName", "fruit_shelf");
startActivity(shelfManagement);
}
});
// Initialize the dairy shelf button and add an onClick listener
mDairyShelfBtn = findViewById(R.id.dairy_shelf);
mDairyShelfBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent shelfManagement = new Intent(anonymousUser.this, anonymousShelfActivity.class);
shelfManagement.putExtra("documentName", "dairy_shelf");
startActivity(shelfManagement);
}
});
mRegister = findViewById(R.id.anonymous_user_register);
mRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent registerAnonymousUser = new Intent(anonymousUser.this, registerAnonymousUser.class);
startActivity(registerAnonymousUser);
}
});
mSignOutBtn = findViewById(R.id.anonymous_user_sign_out);
mSignOutBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
signOut();
Intent loginScreen = new Intent(anonymousUser.this, LoginActivity.class);
startActivity(loginScreen);
finish();
}
});
}
private void signOut() {
mAuth.signOut();
}
protected void startPositioning() {
mIndoorLocationManager.startPositioning();
Toast.makeText(anonymousUser.this, "You can now move on the map",
Toast.LENGTH_SHORT).show();
Log.d("POSITIONING", "STARTING");
}
@Override
protected void onStop() {
mIndoorLocationManager.stopPositioning();
super.onStop();
}
}
| 43.368421
| 134
| 0.587985
|
4511968b27550b0e5fdb6cdcfc11f37f2fef6bd6
| 990
|
package com.outlook.image.controller;
import java.util.Properties;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
public class JavaMailPropertiesForOutlook {
final static String EmailUser = "bhattarajaykumar@hotmail.com";
final static String EmailPassword = "Hotm@il512";
public Session getProperties(){
Properties props = new Properties();
props.put("mail.smtp.host", "smtp-mail.outlook.com");
props.put("mail.smtp.port", "587");
props.put("mail.smtp.ssl.trust", "smtp-mail.outlook.com");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.connectiontimeout", "10000");
/* Session session = Session.getDefaultInstance(props, null); */
Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(EmailUser, EmailPassword);
}
});
return session;
}
}
| 29.117647
| 79
| 0.737374
|
893eac44fecb69ed4d45cd6651ebad52bb0d6310
| 2,814
|
package com.tool4us.net.http;
import java.util.List;
import java.util.Map;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.DecoderResult;
import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.HttpMethod;
import io.netty.handler.codec.http.HttpRequest;
import io.netty.handler.codec.http.HttpVersion;
public class Requester implements HttpRequest
{
private HttpRequest _req = null;
private Map<String, List<String>> _params = null;
private ChannelHandlerContext _ctx = null;
public Requester( HttpRequest req
, Map<String, List<String>> params
, ChannelHandlerContext ctx )
{
_req = req;
_params = params;
_ctx = ctx;
}
public Channel channel()
{
return _ctx.channel();
}
public String getRemoteDescription()
{
if( _ctx == null )
return "Unkwoun";
return _ctx.channel().remoteAddress().toString();
}
@Override
public HttpVersion getProtocolVersion()
{
return _req.protocolVersion();
}
@Override
public HttpHeaders headers()
{
return _req.headers();
}
@Override
public DecoderResult getDecoderResult()
{
return _req.decoderResult();
}
@Override
public void setDecoderResult(DecoderResult result)
{
_req.setDecoderResult(result);
}
@Override
public HttpMethod getMethod()
{
return _req.method();
}
@Override
public HttpRequest setMethod(HttpMethod method)
{
return _req.setMethod(method);
}
@Override
public String getUri()
{
return _req.uri();
}
@Override
public HttpRequest setUri(String uri)
{
return _req.setUri(uri);
}
@Override
public HttpRequest setProtocolVersion(HttpVersion version)
{
return _req.setProtocolVersion(version);
}
public String getParameter(String paramName)
{
return parameter(paramName);
}
public String parameter(String paramName)
{
List<String> pList = _params.get(paramName);
return pList == null ? null : pList.get(0);
}
public Map<String, List<String>> parameterMap()
{
return _params;
}
@Override
public HttpVersion protocolVersion()
{
return _req.protocolVersion();
}
@Override
public DecoderResult decoderResult()
{
return _req.decoderResult();
}
@Override
public HttpMethod method()
{
return _req.method();
}
@Override
public String uri()
{
return _req.uri();
}
}
| 19.957447
| 62
| 0.604122
|
9a738b314b5f9f616f15c10ec19a420a207e3256
| 1,207
|
package ru.mail.polis.litemn.command;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
public class SequenceCommandProcessor<T> implements CommandProcessor<T> {
private static final Logger LOGGER = LoggerFactory.getLogger(SequenceCommandProcessor.class);
private final ExecutorService executorService;
SequenceCommandProcessor(ExecutorService executorService) {
this.executorService = executorService;
}
@Override
public List<T> process(List<Command<T>> commands) {
List<T> result = new ArrayList<>(commands.size());
try {
List<Future<T>> futures = executorService.invokeAll(commands);
for (Future<T> future : futures) {
T value = future.get();
result.add(value);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
LOGGER.error("Error to process commands", e);
}
return result;
}
}
| 31.763158
| 97
| 0.674399
|
2557e073599cdc13bce5c242bfa7fbe4339c8966
| 757
|
package havis.custom.harting.iso159612.hw;
import java.util.List;
import havis.application.component.db.Callback;
import havis.custom.harting.iso159612.data.Settings;
import havis.custom.harting.iso159612.data.Template;
public interface ConfigDao {
/**
* loads settings
*
* @param callback
*/
void loadSettings(Callback<Settings> callback);
/**
* saves settings
*
* @param settings
* @param callback
*/
void saveSettings(Settings settings, Callback<Void> callback);
/**
* load templates
*
* @param callback
*/
void loadTemplates(Callback<List<Template>> callback);
/**
* saves templates
*
* @param templates
* @param callback
*/
void saveTemplates(List<Template> templates, Callback<Void> callback);
}
| 18.463415
| 71
| 0.708058
|
509ed680dcd791f2d4baa2fdfdee5d267aae3b4d
| 1,795
|
package com.nitya.accounter.migration;
import org.hibernate.Criteria;
import org.json.JSONException;
import org.json.JSONObject;
import com.nitya.accounter.core.Customer;
import com.nitya.accounter.core.FinanceDate;
import com.nitya.accounter.core.Job;
public class JobMigrator implements IMigrator<Job> {
@Override
public JSONObject migrate(Job obj, MigratorContext context) throws JSONException {
JSONObject external = new JSONObject();
{
JSONObject jsonObject = new JSONObject();
external.put("com.nitya.accounter.shared.customer.Project", jsonObject);
String _lid = context.getLocalIdProvider().getOrCreate(obj);
jsonObject.put("@id", _lid);
jsonObject.put("@_lid", _lid);
CommonFieldsMigrator.migrateCommonFields(obj, jsonObject, context);
jsonObject.put("name", obj.getJobName());
FinanceDate startDate = obj.getStartDate();
jsonObject.put("startDate", startDate.toEpochDay());
FinanceDate endDate = obj.getEndDate();
if (startDate.after(endDate)) {
jsonObject.put("endDate", startDate.toEpochDay());
} else {
jsonObject.put("endDate", endDate.toEpochDay());
}
Customer customer = obj.getCustomer();
if (customer != null) {
JSONObject inter = new JSONObject();
JSONObject outter = new JSONObject();
outter.put("com.nitya.accounter.shared.customer.Customer", inter);
String localId = context.getLocalIdProvider().getOrCreate(customer);
inter.put("@_oid", context.get("Customer", customer.getID()));
inter.put("@_lid", localId);
jsonObject.put("customer", outter);
}
jsonObject.put("status", PicklistUtilMigrator.getProjectStatusIdentity(obj.getJobStatus()));
}
return external;
}
@Override
public void addRestrictions(Criteria criteria) {
// TODO Auto-generated method stub
}
}
| 32.053571
| 95
| 0.730919
|
a613ba2bf3cf494c7798067e9f2e7eaa65405d8c
| 1,790
|
package tools.maker;
import system.CoffeeRequst.Req;
import goods.homemade.coffee.Coffee;
/**
* 咖啡机类,用于获取指定类型的咖啡实体
* @author 刘畅
* @version 0.1
*/
public class CoffeeMaker extends DesertMaker {
CoffeeBuilder coffeeBuilder;
Coffee empty;
boolean busy;
public CoffeeMaker() {
super();
busy=false;
}
@Override
public void work(Object req, Object returnObj) {
busy=true;
Req req1 = (Req)req;
Coffee coffee = getCoffee(req1.type, req1.temperature,req1.sweetness,req1.price);
((Coffee) returnObj).setName(coffee.getName());
((Coffee) returnObj).setTemperature(coffee.getTemperature());
((Coffee) returnObj).setSweetness(coffee.getSweetness());
((Coffee) returnObj).setPrice(coffee.getPrice());
busy=false;
}
@Override
public boolean isBusy(){
return busy;
}
/**
*通过调用此接口获取一个制定的咖啡实体
* @param type 0.AmericanCoffee 1.GappuccinoCoffee 2.MochaCoffee
* @param temperature 0.Cool 1.Normal 2.Hot
* @param sweetness 0.FreeSugar 1.HalfSugar 2.RegularSugar
* @param price
* @return
*/
Coffee getCoffee(int type,int temperature,int sweetness,double price){
empty=new Coffee();
empty.setName("Empty");
if((type!=0)&&(type!=1)&&(type!=2))return empty;
if((temperature!=0)&&(temperature!=1)&&(temperature!=2))return empty;
if((sweetness!=0)&&(sweetness!=1)&&(sweetness!=2))return empty;
if(type==0)coffeeBuilder=new AmericanCoffeeBuilder();
else if(type==1)coffeeBuilder=new GappuccinoCoffeeBuilder();
else if(type==2)coffeeBuilder=new MochaCoffeeBuilder();
coffeeBuilder.makeCoffee();
coffeeBuilder.setSweetness(sweetness);
coffeeBuilder.setTemperature(temperature);
coffeeBuilder.setPrice(price);
coffeeBuilder.setName();
return coffeeBuilder.getCoffee();
}
}
| 28.412698
| 90
| 0.702235
|
9a6b6a66cfa480c0fe90bb17b0076a051e7cdf5b
| 457
|
package com.tvd12.ezyfox.database.service;
import com.tvd12.ezyfox.database.query.EzyUpdateOperations;
import com.tvd12.ezyfox.function.EzyApply;
public interface EzyUpdateOneByIdService<I,E> {
void updateOneById(I id, E entity);
void updateOneById(I id, E entity, boolean upsert);
void updateOneById(I id, EzyApply<EzyUpdateOperations<E>> operations);
void updateOneById(I id, EzyApply<EzyUpdateOperations<E>> operations, boolean upsert);
}
| 26.882353
| 87
| 0.787746
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.